From 150a96908641c6103de216a4a309e9eb948a78e1 Mon Sep 17 00:00:00 2001 From: Yoga Pangestu Date: Sun, 5 Jul 2026 02:38:21 +0700 Subject: [PATCH] feat: update revenue tooltip and chart display logic in Analysis.vue to conditionally show net revenue and profit metrics based on user role; enhance user experience for cashiers --- resources/js/pages/admin/Analysis.vue | 43 ++++++++++++++------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/resources/js/pages/admin/Analysis.vue b/resources/js/pages/admin/Analysis.vue index 452cfe0..a681333 100644 --- a/resources/js/pages/admin/Analysis.vue +++ b/resources/js/pages/admin/Analysis.vue @@ -356,6 +356,7 @@ const barSelector = GroupedBar.selectors.bar; function revenueTooltip(d: any) { const item = d as MonthlyRevenueData; + const isCashier = hasRole('cashier'); return `

${item.month}

@@ -364,11 +365,13 @@ function revenueTooltip(d: any) { ${revenueChartConfig.total.label} Rp${formatRupiah(item.total)}

+ ${!isCashier ? `

${revenueChartConfig.net.label} Rp${formatRupiah(item.net)}

+ ` : ''}

${revenueChartConfig.deduction.label} @@ -652,11 +655,9 @@ watch([startDate, endDate], () => { Pendapatan

-
{{ revenueChartConfig[chart].label }} @@ -670,11 +671,9 @@ watch([startDate, endDate], () => {
-
+
i " :y="[ (d: MonthlyRevenueData) => d.total, - (d: MonthlyRevenueData) => d.net, + ...(!hasRole('cashier') ? [(d: MonthlyRevenueData) => d.net] : []), (d: MonthlyRevenueData) => d.deduction, ]" :color="[ revenueChartConfig.total.color, - revenueChartConfig.net.color, + ...(!hasRole('cashier') ? [revenueChartConfig.net.color] : []), revenueChartConfig.deduction.color, ]" :bar-padding="0.1" :group-padding="0.2" :rounded-corners="4" />