diff --git a/app/Http/Controllers/GeneralController.php b/app/Http/Controllers/GeneralController.php index 30f3512..cb4a8f6 100644 --- a/app/Http/Controllers/GeneralController.php +++ b/app/Http/Controllers/GeneralController.php @@ -17,7 +17,9 @@ class GeneralController extends Controller $totalItem = SaleItem::whereHas('sale', function ($q) { return $q->where('date', now()->format('m/d/Y')); })->sum('quantity'); - $totalProduct = Product::count(); + $totalItemPrice = SaleItem::whereHas('sale', function ($q) { + return $q->where('date', now()->format('m/d/Y')); + })->sum('price'); $totalCustomer = Customer::count(); $startDate = now()->subDays(6)->format('m/d/Y'); @@ -65,7 +67,7 @@ class GeneralController extends Controller return inertia('Dashboard', [ 'total_sale_today' => $totalSaleToday, 'total_item_today' => $totalItem, - 'total_product' => $totalProduct, + 'total_item_price_today' => $totalItemPrice, 'total_customer' => $totalCustomer, 'sale_days' => $charts, 'favorite_categories' => $dounat, diff --git a/resources/js/Pages/Dashboard.jsx b/resources/js/Pages/Dashboard.jsx index 786eb8e..3325ed8 100644 --- a/resources/js/Pages/Dashboard.jsx +++ b/resources/js/Pages/Dashboard.jsx @@ -28,7 +28,7 @@ export default function Dashboard(props) { const { total_sale_today, total_item_today, - total_product, + total_item_price_today, total_customer, sale_days, list_favorite_product, @@ -50,13 +50,13 @@ export default function Dashboard(props) { data: sale_days.map((item) => item.stotal), // backgroundColor: 'rgb(87, 13, 248, 0.5)', //rgb(87, 13, 248, 0.5) //rgba(255, 99, 132, 0.5) backgroundColor: [ - 'rgba(201, 203, 207, 1)', - 'rgba(255, 159, 64, 1)', + // 'rgba(201, 203, 207, 1)', + // 'rgba(255, 159, 64, 1)', 'rgba(255, 205, 86, 1)', - 'rgba(75, 192, 192, 1)', - 'rgba(54, 162, 235, 1)', - 'rgba(153, 102, 255, 1)', - 'rgba(255, 99, 132, 1)', + // 'rgba(75, 192, 192, 1)', + // 'rgba(54, 162, 235, 1)', + // 'rgba(153, 102, 255, 1)', + // 'rgba(255, 99, 132, 1)', ], }, ], @@ -149,13 +149,16 @@ export default function Dashboard(props) { Hari Ini
- {total_item_today} + Rp. {formatIDR(total_item_price_today)}
-
Jumlah Barang
+
+ Jumlah Barang Terjual
+ Hari Ini +
- {total_product} + {total_item_today}
@@ -179,7 +182,7 @@ export default function Dashboard(props) {
- Top Product of The Month + Produk Paling laku terjual