create report for supervisor

This commit is contained in:
2025-04-23 10:34:05 +03:30
parent 99ce5133b0
commit c29738f96c
6 changed files with 202 additions and 9 deletions

View File

@@ -5,7 +5,8 @@ namespace App\Http\Controllers\V3\Dashboard;
use App\Enums\AxisTypes;
use App\Enums\SafetyAndPrivacyStatus;
use App\Enums\SafetyAndPrivacySteps;
use App\Exports\V3\SafetyAndPrivacy\CartableReport;
use App\Exports\V3\SafetyAndPrivacy\OperatorCartableReport;
use App\Exports\V3\SafetyAndPrivacy\SupervisorCartableReport;
use App\Facades\DataTable\DataTableFacade;
use App\Facades\File\FileFacade;
use App\Http\Controllers\Controller;
@@ -43,11 +44,11 @@ class SafetyAndPrivacyController extends Controller
/**
* @throws Throwable
*/
public function excelReport(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse
public function operatorExcelReport(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse
{
$name = 'گزارش از نگهداری حریم راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
$data = $safetyAndPrivacyTableService->operatorDatatable($request);
return Excel::download(new CartableReport($data['data']), $name);
return Excel::download(new OperatorCartableReport($data['data']), $name);
}
public function firstStepStore(FirstStepStoreRequest $request, NominatimService $nominatimService): JsonResponse
@@ -111,7 +112,7 @@ class SafetyAndPrivacyController extends Controller
$safetyAndPrivacy->update([
'judiciary_document' => serialize($judiciary_document),
'judiciary_document_upload_date' => now(),
'step' => SafetyAndPrivacySteps::MOSTANADAT_GAZAEI->value,
'step' => $step,
'step_fa' => SafetyAndPrivacySteps::name($step),
]);
@@ -128,7 +129,7 @@ class SafetyAndPrivacyController extends Controller
DB::transaction(function () use ($request, $safetyAndPrivacy, $user) {
$step = SafetyAndPrivacySteps::BARKHORD->value;
$safetyAndPrivacy->update([
'step' => SafetyAndPrivacySteps::BARKHORD->value,
'step' => $step,
'step_fa' => SafetyAndPrivacySteps::name($step),
'action_picture' => FileFacade::save($request->action_picture, "safety_and_privacy/{$safetyAndPrivacy->id}/action_picture"),
'action_picture_document_upload_date' => now(),
@@ -249,4 +250,11 @@ class SafetyAndPrivacyController extends Controller
{
return response()->json($safetyAndPrivacyTableService->supervisorDataTable($request));
}
public function supervisorExcelReport(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse
{
$name = 'گزارش از نگهداری حریم راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
$data = $safetyAndPrivacyTableService->supervisorDataTable($request);
return Excel::download(new SupervisorCartableReport($data['data']), $name);
}
}