fix(home): replace revenue stat with tomorrow's deliveries

Remove profit/revenue display from home page dashboard as this
information should not be visible to all employees. Replace with
tomorrow's deliveries count which is more useful for daily planning.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-03 21:05:04 -05:00
parent 9a4d5dd07b
commit 421ba896a0

View File

@@ -74,18 +74,18 @@
<div class="text-base-content/50 text-xs mt-1">this week</div> <div class="text-base-content/50 text-xs mt-1">this week</div>
</div> </div>
<!-- Week Profit --> <!-- Tomorrow's Deliveries -->
<div class="stat-card group"> <div class="stat-card group">
<div class="flex items-center justify-between mb-2"> <div class="flex items-center justify-between mb-2">
<span class="text-xs uppercase tracking-wider text-base-content/50 font-semibold">Revenue</span> <span class="text-xs uppercase tracking-wider text-base-content/50 font-semibold">Tomorrow</span>
<div class="w-8 h-8 rounded-lg bg-warning/10 flex items-center justify-center group-hover:scale-110 transition-transform"> <div class="w-8 h-8 rounded-lg bg-warning/10 flex items-center justify-center group-hover:scale-110 transition-transform">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="w-4 h-4 text-warning"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="w-4 h-4 text-warning">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 6v12m-3-2.818l.879.659c1.171.879 3.07.879 4.242 0 1.172-.879 1.172-2.303 0-3.182C13.536 12.219 12.768 12 12 12c-.725 0-1.45-.22-2.003-.659-1.106-.879-1.106-2.303 0-3.182s2.9-.879 4.006 0l.415.33M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /> <path stroke-linecap="round" stroke-linejoin="round" d="M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5m-9-6h.008v.008H12v-.008zM12 15h.008v.008H12V15zm0 2.25h.008v.008H12v-.008zM9.75 15h.008v.008H9.75V15zm0 2.25h.008v.008H9.75v-.008zM7.5 15h.008v.008H7.5V15zm0 2.25h.008v.008H7.5v-.008zm6.75-4.5h.008v.008h-.008v-.008zm0 2.25h.008v.008h-.008V15zm0 2.25h.008v.008h-.008v-.008zm2.25-4.5h.008v.008H16.5v-.008zm0 2.25h.008v.008H16.5V15z" />
</svg> </svg>
</div> </div>
</div> </div>
<div class="text-3xl font-bold text-success">${{ formatNumber(total_profit_past_week) }}</div> <div class="text-3xl font-bold">{{ countsStore.tomorrow }}</div>
<div class="text-base-content/50 text-xs mt-1">this week</div> <div class="text-base-content/50 text-xs mt-1">deliveries scheduled</div>
</div> </div>
</div> </div>
@@ -251,6 +251,7 @@ import { useRouter } from 'vue-router'
import axios from 'axios' import axios from 'axios'
import authHeader from '../services/auth.header' import authHeader from '../services/auth.header'
import { deliveryService } from '../services/deliveryService' import { deliveryService } from '../services/deliveryService'
import { useCountsStore } from '../stores/counts'
import { DeliveryMapItem } from '../types/models' import { DeliveryMapItem } from '../types/models'
import "leaflet/dist/leaflet.css" import "leaflet/dist/leaflet.css"
import { LMap, LTileLayer, LMarker, LPopup } from "@vue-leaflet/vue-leaflet" import { LMap, LTileLayer, LMarker, LPopup } from "@vue-leaflet/vue-leaflet"
@@ -282,11 +283,13 @@ ChartJS.register(
// Router // Router
const router = useRouter() const router = useRouter()
// Stores
const countsStore = useCountsStore()
// Reactive data // Reactive data
const delivery_count = ref(0) const delivery_count = ref(0)
const delivery_count_delivered = ref(0) const delivery_count_delivered = ref(0)
const total_gallons_past_week = ref(0) const total_gallons_past_week = ref(0)
const total_profit_past_week = ref(0)
const total_deliveries = ref(0) const total_deliveries = ref(0)
const user = ref({ const user = ref({
user_id: 0, user_id: 0,
@@ -423,7 +426,8 @@ onMounted(() => {
today_delivery_count() today_delivery_count()
today_delivery_delivered() today_delivery_delivered()
totalgallonsweek() totalgallonsweek()
totalprofitweek() totaldeliveriesweek()
countsStore.fetchSidebarCounts()
fetchMapDeliveries() fetchMapDeliveries()
fetchWeeklyChartData() fetchWeeklyChartData()
}) })
@@ -500,8 +504,8 @@ const totalgallonsweek = () => {
}) })
} }
const totalprofitweek = () => { const totaldeliveriesweek = () => {
const path = import.meta.env.VITE_BASE_URL + '/money/profit/week' const path = import.meta.env.VITE_BASE_URL + '/stats/delivery/count/week'
axios({ axios({
method: "get", method: "get",
url: path, url: path,
@@ -509,8 +513,20 @@ const totalprofitweek = () => {
headers: authHeader(), headers: authHeader(),
}) })
.then((response: any) => { .then((response: any) => {
total_profit_past_week.value = response.data.total_profit total_deliveries.value = response.data.data || response.data.total || 0
total_deliveries.value = response.data.total_deliveries })
.catch(() => {
// Fallback: use the money endpoint but only extract deliveries count
const fallbackPath = import.meta.env.VITE_BASE_URL + '/money/profit/week'
axios({
method: "get",
url: fallbackPath,
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
total_deliveries.value = response.data.total_deliveries || 0
})
}) })
} }