dashboardchanges
This commit is contained in:
@@ -159,135 +159,5 @@ class DashboardController extends Controller
|
||||
return view('Admin.dashboard', compact('customerCount','restaurantCount','dataMonthlyWithType3','dataMonthlyWithType4','dataQuarterlyWithType3', 'dataQuarterlyWithType4', 'dataYearlyWithType3', 'dataYearlyWithType4','formattedDefaultData','quarterlyData'));
|
||||
|
||||
}
|
||||
// public function showDashboard()
|
||||
// {
|
||||
|
||||
|
||||
// // Fetching data for sorting by day
|
||||
// // $dailyData = OrderedPassport::select(DB::raw("COUNT(*) as count"), DB::raw("DATE(created_at) as date"))
|
||||
// // ->whereBetween('created_at', [now()->subDays(7), now()]) // Fetch data for the last 7 days
|
||||
// // ->groupBy(DB::raw("DATE(created_at)"))
|
||||
// // ->orderBy(DB::raw("DATE(created_at)"))
|
||||
// // ->pluck('count', 'date')
|
||||
// // ->toArray();
|
||||
|
||||
// // Ensure that $dailyData contains zeros for days with no data
|
||||
// $start_date = now()->subDays(7)->startOfDay();
|
||||
// $end_date = now()->endOfDay();
|
||||
// $formattedDailyData = [];
|
||||
// while ($start_date <= $end_date) {
|
||||
// $formattedDailyData[$start_date->format('Y-m-d')] = isset($dailyData[$start_date->format('Y-m-d')]) ? $dailyData[$start_date->format('Y-m-d')] : 0;
|
||||
// $start_date->addDay();
|
||||
// }
|
||||
|
||||
// // Default sales chart data (monthly)
|
||||
// // $defaultData = OrderedPassport::select(DB::raw("COUNT(*) as count"), DB::raw("MONTH(created_at) as month"))
|
||||
// // ->whereYear('created_at', date('Y'))
|
||||
// // ->groupBy(DB::raw("MONTH(created_at)"))
|
||||
// // ->orderBy(DB::raw("MONTH(created_at)"))
|
||||
// // ->pluck('count', 'month')
|
||||
// // ->toArray();
|
||||
|
||||
// // Ensure that $defaultData contains zeros for months with no data
|
||||
// $months = range(1, 12);
|
||||
// $formattedDefaultData = [];
|
||||
// foreach ($months as $month) {
|
||||
// $formattedDefaultData[$month] = isset($defaultData[$month]) ? $defaultData[$month] : 0;
|
||||
// }
|
||||
|
||||
// // $quarterlyData = OrderedPassport::select(
|
||||
// // DB::raw("COUNT(*) as count"),
|
||||
// // DB::raw("QUARTER(created_at) as quarter")
|
||||
// // )
|
||||
// // ->whereYear('created_at', date('Y'))
|
||||
// // ->groupBy(DB::raw("QUARTER(created_at)"))
|
||||
// // ->orderBy(DB::raw("QUARTER(created_at)"))
|
||||
// // ->pluck('count', 'quarter')
|
||||
// // ->toArray();
|
||||
|
||||
// // Ensure that $quarterlyData contains zeros for quarters with no data
|
||||
// for ($i = 1; $i <= 4; $i++) {
|
||||
// if (!isset($quarterlyData[$i])) {
|
||||
// $quarterlyData[$i] = 0;
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Fetching data for yearly option
|
||||
// // $yearlyData = OrderedPassport::select(DB::raw("COUNT(*) as count"), DB::raw("YEAR(created_at) as year"))
|
||||
// // ->groupBy(DB::raw("YEAR(created_at)"))
|
||||
// // ->pluck('count', 'year')
|
||||
// // ->toArray();
|
||||
// //
|
||||
// // Monthly data
|
||||
// $dataMonthlyWithType3 = IamPrincipal::select(DB::raw("COUNT(*) as count"), DB::raw("MONTH(created_at) as month"))
|
||||
// ->whereIn('principal_type_xid', [3])
|
||||
// ->whereYear('created_at', date('Y'))
|
||||
// ->groupBy(DB::raw("MONTH(created_at)"))
|
||||
// ->orderBy(DB::raw("MONTH(created_at)"))
|
||||
// ->pluck('count', 'month')
|
||||
// ->toArray();
|
||||
|
||||
// $dataMonthlyWithType4 = IamPrincipal::select(DB::raw("COUNT(*) as count"), DB::raw("MONTH(created_at) as month"))
|
||||
// ->whereIn('principal_type_xid', [4])
|
||||
// ->whereYear('created_at', date('Y'))
|
||||
// ->groupBy(DB::raw("MONTH(created_at)"))
|
||||
// ->orderBy(DB::raw("MONTH(created_at)"))
|
||||
// ->pluck('count', 'month')
|
||||
// ->toArray();
|
||||
|
||||
// // Quarterly data
|
||||
// $dataQuarterlyWithType3 = IamPrincipal::select(
|
||||
// DB::raw("COUNT(*) as count"),
|
||||
// DB::raw("QUARTER(created_at) as quarter")
|
||||
// )
|
||||
// ->whereIn('principal_type_xid', [3])
|
||||
// ->groupBy(DB::raw("QUARTER(created_at)"))
|
||||
// ->orderBy(DB::raw("QUARTER(created_at)"))
|
||||
// ->pluck('count', 'quarter')
|
||||
// ->toArray();
|
||||
// for ($i = 1; $i <= 4; $i++) {
|
||||
// if (!isset($dataQuarterlyWithType3[$i])) {
|
||||
// $dataQuarterlyWithType3[$i] = 0;
|
||||
// }
|
||||
// }
|
||||
|
||||
// $dataQuarterlyWithType4 = IamPrincipal::select(
|
||||
// DB::raw("COUNT(*) as count"),
|
||||
// DB::raw("QUARTER(created_at) as quarter")
|
||||
// )
|
||||
// ->whereIn('principal_type_xid', [4])
|
||||
// ->groupBy(DB::raw("QUARTER(created_at)"))
|
||||
// ->orderBy(DB::raw("QUARTER(created_at)"))
|
||||
// ->pluck('count', 'quarter')
|
||||
// ->toArray();
|
||||
// for ($i = 1; $i <= 4; $i++) {
|
||||
// if (!isset($dataQuarterlyWithType4[$i])) {
|
||||
// $dataQuarterlyWithType4[$i] = 0;
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Yearly data
|
||||
// $dataYearlyWithType3 = IamPrincipal::select(DB::raw("COUNT(*) as count"), DB::raw("YEAR(created_at) as year"))
|
||||
// ->whereIn('principal_type_xid', [3])
|
||||
// ->groupBy(DB::raw("YEAR(created_at)"))
|
||||
// ->pluck('count', 'year')
|
||||
// ->toArray();
|
||||
// // dd($dataYearlyWithType3);
|
||||
|
||||
// $dataYearlyWithType4 = IamPrincipal::select(DB::raw("COUNT(*) as count"), DB::raw("YEAR(created_at) as year"))
|
||||
// ->whereIn('principal_type_xid', [4])
|
||||
// ->groupBy(DB::raw("YEAR(created_at)"))
|
||||
// ->pluck('count', 'year')
|
||||
// ->toArray();
|
||||
|
||||
|
||||
// $customerCount = IamPrincipal::where('principal_type_xid', '=', 3)->count();
|
||||
// // $activePassports = ManagePassport::where('is_active', 1)->take(12)->get();
|
||||
// // $restaurantCount = MyPassportVoucher::where('is_redeem', 1)->count();
|
||||
// // $recent_transaction = OrderedPassport::with('order', 'order_passport', 'carts.passport', 'iamPrincipal')->get()->toArray();
|
||||
// // $datas = MyPassportVoucher::with('passportVouchers', 'passportData', 'customer')->get()->toArray();
|
||||
|
||||
// // Pass the data to the view
|
||||
// return view('Admin.dashboard', compact('customerCount', '', 'restaurantCount', '', 'datas', 'formattedDefaultData', 'quarterlyData', 'yearlyData', 'dataMonthlyWithType3', 'dataMonthlyWithType4', 'dataQuarterlyWithType3', 'dataQuarterlyWithType4', 'dataYearlyWithType3', 'dataYearlyWithType4','formattedDailyData'));
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 d-flex align-items-center p-0 mb-4">
|
||||
<!-- <div class="col-12 d-flex align-items-center p-0 mb-4">
|
||||
<div class="col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
@@ -93,8 +93,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-12 d-flex p-0 mb-3">
|
||||
</div> -->
|
||||
<!-- <div class="col-12 d-flex p-0 mb-3">
|
||||
<div class="col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
@@ -155,7 +155,7 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<!-- <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 layout-spacing">
|
||||
<div class="widget widget-six">
|
||||
@@ -837,5 +837,7 @@
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
Reference in New Issue
Block a user