43 lines
1.9 KiB
PHP
43 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Services\System\DashboardService;
|
|
use Carbon\Carbon;
|
|
use Illuminate\Http\Request;
|
|
use Inertia\Inertia;
|
|
use Inertia\Response;
|
|
|
|
class AnalysisController extends Controller
|
|
{
|
|
public function __construct(
|
|
private readonly DashboardService $dashboardService,
|
|
) {}
|
|
|
|
public function index(Request $request): Response
|
|
{
|
|
$startDate = $request->query('start_date') ? Carbon::parse($request->query('start_date'))->startOfDay() : null;
|
|
$endDate = $request->query('end_date') ? Carbon::parse($request->query('end_date'))->endOfDay() : null;
|
|
|
|
return Inertia::render('admin/Analysis', [
|
|
'filters' => [
|
|
'start_date' => $request->query('start_date', ''),
|
|
'end_date' => $request->query('end_date', ''),
|
|
],
|
|
'rawMaterialStock' => $this->dashboardService->getRawMaterialStock(),
|
|
'productStock' => $this->dashboardService->getProductStock(),
|
|
'kasbonSummary' => $this->dashboardService->getKasbonSummary($startDate, $endDate),
|
|
'leaveRequestSummary' => $this->dashboardService->getLeaveRequestSummary($startDate, $endDate),
|
|
'lowStockProducts' => $this->dashboardService->getLowStockProducts(),
|
|
'lowStockMaterials' => $this->dashboardService->getLowStockMaterials(),
|
|
'attendanceToday' => $this->dashboardService->getAttendanceToday($startDate, $endDate),
|
|
'cashAccounts' => $this->dashboardService->getCashAccounts(),
|
|
'cashSummary' => $this->dashboardService->getCashSummary($startDate, $endDate),
|
|
'purchaseSummary' => $this->dashboardService->getPurchaseSummary($startDate, $endDate),
|
|
'monthlyExpenses' => $this->dashboardService->getMonthlyExpenses($startDate, $endDate),
|
|
'revenueSummary' => $this->dashboardService->getRevenueSummary($startDate, $endDate),
|
|
]);
|
|
}
|
|
}
|