partial update create kpi and progress bar
This commit is contained in:
@@ -49,7 +49,28 @@ class TransactionController extends Controller
|
||||
->where('active', true)
|
||||
->get();
|
||||
|
||||
return view('transaction.index', compact('now', 'wash_work', 'work_works', 'user_sas', 'count_transaction_users', 'count_transaction_dealers', 'mechanic', 'products'));
|
||||
// Get KPI data for current user using KPI service
|
||||
$kpiService = app(\App\Services\KpiService::class);
|
||||
|
||||
// Auto-calculate current month KPI achievement to ensure data is up-to-date
|
||||
$kpiService->calculateKpiAchievement(Auth::user());
|
||||
|
||||
$kpiSummary = $kpiService->getKpiSummary(Auth::user());
|
||||
|
||||
// Get current month period name
|
||||
$currentMonthName = now()->translatedFormat('F Y');
|
||||
|
||||
$kpiData = [
|
||||
'target' => $kpiSummary['current_target'] ? $kpiSummary['current_target']->target_value : 0,
|
||||
'actual' => $kpiSummary['current_achievement'] ? $kpiSummary['current_achievement']->actual_value : 0,
|
||||
'percentage' => $kpiSummary['current_percentage'],
|
||||
'status' => $kpiSummary['current_achievement'] ? $kpiSummary['current_achievement']->status : 'pending',
|
||||
'status_color' => $kpiSummary['current_achievement'] ? $kpiSummary['current_achievement']->status_color : 'secondary',
|
||||
'period' => $currentMonthName,
|
||||
'has_target' => $kpiSummary['current_target'] ? true : false
|
||||
];
|
||||
|
||||
return view('transaction.index', compact('now', 'wash_work', 'work_works', 'user_sas', 'count_transaction_users', 'count_transaction_dealers', 'mechanic', 'products', 'kpiData'));
|
||||
}
|
||||
|
||||
public function workcategory($category_id)
|
||||
|
||||
Reference in New Issue
Block a user