diff --git a/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacy/OperatorController.php b/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacy/OperatorController.php new file mode 100644 index 00000000..650a6a93 --- /dev/null +++ b/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacy/OperatorController.php @@ -0,0 +1,231 @@ +json($safetyAndPrivacyTableService->operatorDatatable($request)); + } + + /** + * @throws Throwable + */ + public function excelReport(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse + { + $name = 'گزارش از نگهداری حریم راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx'; + $data = $safetyAndPrivacyTableService->operatorDatatable($request); + return Excel::download(new OperatorCartableReport($data['data']), $name); + } + + public function firstStepStore(FirstStepStoreRequest $request, NominatimService $nominatimService): JsonResponse + { + $user = auth()->user(); + + $coordinates = explode(',', $request->point); + $item = InfoItem::query() + ->where('id', $request->info_id) + ->where('item', 17) + ->firstOrFail(); + + DB::transaction(function () use ($request, $coordinates, $item, $nominatimService, $user) + { + $step = SafetyAndPrivacySteps::SHENASAEI->value; + $safety_and_privacy = SafetyAndPrivacy::query()->create([ + 'lat' => $coordinates[0], + 'lon' => $coordinates[1], + 'operator_id' => $user->id, + 'operator_name' => $user->name, + 'province_id' => $user->province_id, + 'province_fa' => $user->province_fa, + 'info_id' => $item->id, + 'info_fa' => $item->sub_item_str, + 'city_id' => $user->city_id, + 'city_fa' => $user->city_fa, + 'activity_date_time' => $request->activity_date." ".$request->activity_time, + 'edare_shahri_id' => $user->edarate_shahri_id, + 'edare_shahri_name' => $user->edarate_shahri_name, + 'way_id' => $nominatimService->get_way_id_from_nominatim($coordinates[0], $coordinates[1]), + 'axis_type_id' => $request->axis_type_id, + 'axis_type_name' => AxisTypes::name($request->axis_type_id), + 'step' => $step, + 'step_fa' => SafetyAndPrivacySteps::name($step), + 'is_finished' => false, + ]); + + $safety_and_privacy->recognize_picture = $request->has('recognize_picture') ? + FileFacade::save($request->recognize_picture, "safety_and_privacy/{$safety_and_privacy->id}") : + null; + $safety_and_privacy->save(); + + $user->addActivityComplete(1134); + }); + + return $this->successResponse(); + } + + public function secondStepStore(SafetyAndPrivacy $safetyAndPrivacy, SecondStepStoreRequest $request): JsonResponse + { + $user = auth()->user(); + + DB::transaction(function () use ($request, $safetyAndPrivacy, $user) { + + $need_judiciary = $request->need_judiciary; + + $judiciary_document = []; + if ($need_judiciary) { + foreach ($request->judiciary_document as $index => $file) { + $judiciary_document[] = FileFacade::save( + $file, + "safety_and_privacy/{$safetyAndPrivacy->id}/judiciary_document" + ); + } + } + + $step = SafetyAndPrivacySteps::MOSTANADAT_GAZAEI->value; + $safetyAndPrivacy->update([ + 'step' => $step, + 'step_fa' => SafetyAndPrivacySteps::name($step), + 'judiciary_document' => $need_judiciary ? serialize($judiciary_document) : null, + 'judiciary_document_upload_date' => $need_judiciary ? now() : null, + 'need_judiciary' => $need_judiciary, + 'operator_description' => $request->operator_description, + ]); + + $user->addActivityComplete(1135); + }); + + return $this->successResponse(); + } + + public function thirdStepStore(SafetyAndPrivacy $safetyAndPrivacy, ThirdStepStoreRequest $request): JsonResponse + { + $user = auth()->user(); + + DB::transaction(function () use ($request, $safetyAndPrivacy, $user) { + $step = SafetyAndPrivacySteps::BARKHORD->value; + $safetyAndPrivacy->update([ + '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(), + 'action_date' => $request->action_date, + 'is_finished' => true, + 'final_description' => 'پیام سیستمی : این عملیات پس از طی تمامی گام ها خاتمه یافت' + ]); + + $user->addActivityComplete(1136); + }); + + return $this->successResponse(); + } + + public function update(SafetyAndPrivacy $safetyAndPrivacy, UpdateRequest $request): JsonResponse + { + DB::transaction(function () use ($request, $safetyAndPrivacy) { + $safetyAndPrivacy->update([ + 'axis_type_id' => $request->axis_type_id, + 'axis_type_name' => AxisTypes::name($request->axis_type_id), + ]); + + auth()->user()->addActivityComplete(1168); + }); + + return $this->successResponse(); + } + + public function show(SafetyAndPrivacy $safetyAndPrivacy): JsonResponse + { + return $this->successResponse($safetyAndPrivacy); + } + + public function destroy(SafetyAndPrivacy $safetyAndPrivacy): JsonResponse + { + FileFacade::deleteDirectory("safety_and_privacy/{$safetyAndPrivacy->id}"); + + DB::transaction(function () use ($safetyAndPrivacy) + { + auth()->user()->addActivityComplete(1155); + $safetyAndPrivacy->delete(); + }); + + return $this->successResponse(); + } + + public function deserialize(SafetyAndPrivacy $safetyAndPrivacy): JsonResponse + { + $judiciaries = $safetyAndPrivacy->judiciary_document ? unserialize($safetyAndPrivacy->judiciary_document) : []; + + $result = []; + + foreach ($judiciaries as $judiciary) { + $result[] = Storage::disk('public')->url($judiciary); + } + + return $this->successResponse($result); + } + + public function subItems(): JsonResponse + { + return $this->successResponse(InfoItem::query() + ->where('item', '=', 17) + ->select('id', 'item', 'item_str', 'sub_item_str as name', 'sub_item_unit as unit', 'needs_image', 'needs_end_point', 'sub_item') + ->get()); + } + + public function finish(FinishRequest $request, SafetyAndPrivacy $safetyAndPrivacy): JsonResponse + { + $status_id = SafetyAndPrivacyStatus::PENDING->value; + + $safetyAndPrivacy->update([ + 'is_finished' => 1, + 'final_description' => $request->final_description, + 'status' => $status_id, + 'status_fa' => SafetyAndPrivacyStatus::name($status_id), + ]); + + return $this->successResponse(); + } + + public function map(Request $request): JsonResponse + { + return response()->json(DataTableFacade::run( + SafetyAndPrivacy::query(), + $request, + allowedFilters: ['*'], + allowedSortings: ['*'], + allowedSelects: ['id', 'lat', 'lon', 'step'] + )); + } +} diff --git a/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacy/OperatorReportController.php b/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacy/OperatorReportController.php new file mode 100644 index 00000000..31b41c52 --- /dev/null +++ b/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacy/OperatorReportController.php @@ -0,0 +1,52 @@ +countryActivity($request); + return $this->successResponse([ + 'activities' => $data, + 'provinces' => Province::all(['id', 'name_fa']) + ]); + } + + public function provinceActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): JsonResponse + { + $data = $safetyAndPrivacyTableService->provinceActivity($request); + return $this->successResponse([ + 'activities' => $data, + 'edarateShahri' => EdarateShahri::query()->where('province_id', '=', $request->province_id)->get(['id', 'name_fa']), + ]); + } + + public function countryExcelActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse + { + $data = $safetyAndPrivacyTableService->countryActivity($request); + $name = 'گزارش از نگهداری حریم راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx'; + return Excel::download(new CountryActivityReport($data), $name); + } + + public function provinceExcelActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse + { + $data = $safetyAndPrivacyTableService->provinceActivity($request); + $name = 'گزارش از نگهداری حریم راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx'; + return Excel::download(new ProvinceActivityReport($data, $request), $name); + } +} diff --git a/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacy/SupervisorController.php b/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacy/SupervisorController.php new file mode 100644 index 00000000..fc026166 --- /dev/null +++ b/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacy/SupervisorController.php @@ -0,0 +1,69 @@ +json($safetyAndPrivacyTableService->supervisorDataTable($request)); + } + + /** + * @throws Throwable + */ + public function excelReport(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); + } + + public function confirm(SafetyAndPrivacy $safetyAndPrivacy, Request $request): JsonResponse + { + $status_id = SafetyAndPrivacyStatus::CONFIRM->value; + + $safetyAndPrivacy->update([ + 'status' => $status_id, + 'status_fa' => SafetyAndPrivacyStatus::name($status_id), + 'supervisor_description' => $request->supervisor_description, + 'supervisor_id' => auth()->user()->id, + 'supervisor_name' => auth()->user()->name, + ]); + + return $this->successResponse(); + } + + public function reject(RejectRequest $request, SafetyAndPrivacy $safetyAndPrivacy): JsonResponse + { + $status_id = SafetyAndPrivacyStatus::REJECT->value; + + $safetyAndPrivacy->update([ + 'status' => $status_id, + 'status_fa' => SafetyAndPrivacyStatus::name($status_id), + 'supervisor_description' => $request->supervisor_description, + 'supervisor_id' => auth()->user()->id, + 'supervisor_name' => auth()->user()->name, + ]); + + return $this->successResponse(); + } +} diff --git a/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacy/SupervisorReportController.php b/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacy/SupervisorReportController.php new file mode 100644 index 00000000..60b3ab87 --- /dev/null +++ b/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacy/SupervisorReportController.php @@ -0,0 +1,56 @@ +countryActivity($request); + return $this->successResponse([ + 'activities' => $data, + 'provinces' => Province::all(['id', 'name_fa']) + ]); + } + + public function provinceActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): JsonResponse + { + $data = $safetyAndPrivacyTableService->provinceActivity($request); + return $this->successResponse([ + 'activities' => $data, + 'edarateShahri' => EdarateShahri::query()->where('province_id', '=', $request->province_id)->get(['id', 'name_fa']), + ]); + } + + public function countryExcelActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse + { + $data = $safetyAndPrivacyTableService->countryActivity($request); + $name = 'گزارش از نگهداری حریم راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx'; + return Excel::download(new CountryActivityReport($data), $name); + } + + public function provinceExcelActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse + { + $data = $safetyAndPrivacyTableService->provinceActivity($request); + $name = 'گزارش از نگهداری حریم راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx'; + return Excel::download(new ProvinceActivityReport($data, $request), $name); + } +} diff --git a/app/Http/Controllers/V3/NotificationController.php b/app/Http/Controllers/V3/NotificationController.php index 833ba72c..f5d3bb82 100644 --- a/app/Http/Controllers/V3/NotificationController.php +++ b/app/Http/Controllers/V3/NotificationController.php @@ -92,24 +92,21 @@ class NotificationController extends Controller { $user = auth()->user(); $safety_and_privacy = array(); - if ($user->hasPermissionTo('show-safety-and-privacy-operator-cartable')) { - $activity = SafetyAndPrivacy::query() - ->selectRaw('count(*) as cnt, step') - ->groupby('step') - ->orderBy('step') - ->get(); + if ($user->hasPermissionTo('show-safety-and-privacy-operator-cartable')) { + $safety_and_privacy['supervise_cnt'] = SafetyAndPrivacy::query() + ->where('is_finished', '=', 1) + ->where('status', '=', 0) + ->count(); } elseif ($user->hasPermissionTo('show-safety-and-privacy-operator-cartable-province')) { throw_if(is_null($user->province_id), new ProhibitedAction('استانی برای شما در سامانه ثبت نشده است!')); - $activity = SafetyAndPrivacy::query() + $safety_and_privacy['supervise_cnt'] = SafetyAndPrivacy::query() ->where('province_id', '=', $user->province_id) - ->selectRaw('count(*) as cnt, step') - ->groupby('step') - ->orderBy('step') - ->get(); - + ->where('is_finished', '=', 1) + ->where('status', '=', 0) + ->count(); } elseif ($user->hasPermissionTo('show-safety-and-privacy-operator-cartable-edarate-shahri')) { throw_if(is_null($user->edarate_shahri_id), new ProhibitedAction('اداره ای برای شما در سامانه ثبت نشده است!')); @@ -117,17 +114,18 @@ class NotificationController extends Controller $activity = SafetyAndPrivacy::query() ->where('edare_shahri_id', '=', $user->edarate_shahri_id) ->selectRaw('count(*) as cnt, step') + ->where('is_finished', '=', 0) ->groupby('step') ->orderBy('step') ->get(); + + $step_one = $activity->where('step', '=', 1)->first(); + $step_two = $activity->where('step', '=', 2)->first(); + + $safety_and_privacy['step_one'] = $step_one->cnt ?? 0; + $safety_and_privacy['step_two'] = $step_two->cnt ?? 0; } - $step_one = $activity->where('step', '=', 1)->first(); - $step_two = $activity->where('step', '=', 2)->first(); - - $safety_and_privacy['step_one'] = $step_one->cnt ?? 0; - $safety_and_privacy['step_two'] = $step_two->cnt ?? 0; - return $safety_and_privacy; } diff --git a/app/Http/Requests/V3/SafetyAndPrivacy/SecondStepStoreRequest.php b/app/Http/Requests/V3/SafetyAndPrivacy/SecondStepStoreRequest.php index 78e471ad..dc88a0b6 100644 --- a/app/Http/Requests/V3/SafetyAndPrivacy/SecondStepStoreRequest.php +++ b/app/Http/Requests/V3/SafetyAndPrivacy/SecondStepStoreRequest.php @@ -23,7 +23,8 @@ class SecondStepStoreRequest extends FormRequest { return [ 'need_judiciary' => 'required|boolean', - 'judiciary_document' => 'required|array', + 'operator_description' => 'required_if:need_judiciary,0|string', + 'judiciary_document' => 'required_if:need_judiciary,1|array', 'judiciary_document.*' => 'file', ]; } diff --git a/app/Models/SafetyAndPrivacy.php b/app/Models/SafetyAndPrivacy.php index 55e0a239..0ae5ac91 100644 --- a/app/Models/SafetyAndPrivacy.php +++ b/app/Models/SafetyAndPrivacy.php @@ -42,7 +42,10 @@ class SafetyAndPrivacy extends Model 'is_finished', 'supervisor_description', 'status_fa', - 'need_judiciary' + 'need_judiciary', + 'operator_description', + 'supervisor_name', + 'supervisor_id' ]; public $table = "safety_and_privacy"; diff --git a/app/Services/Cartables/SafetyAndPrivacyTableService.php b/app/Services/Cartables/SafetyAndPrivacyTableService.php index 4e651ef4..b6331901 100644 --- a/app/Services/Cartables/SafetyAndPrivacyTableService.php +++ b/app/Services/Cartables/SafetyAndPrivacyTableService.php @@ -25,45 +25,43 @@ class SafetyAndPrivacyTableService $fields = [ 'id','lat','lon', 'recognize_picture','action_picture','created_at','step', 'final_description', 'info_fa', 'activity_date_time', 'action_picture_document_upload_date', 'judiciary_document_upload_date', - 'step_fa', 'axis_type_id', 'axis_type_name', 'action_date', 'is_finished', 'status_fa', 'supervisor_description' + 'step_fa', 'axis_type_id', 'axis_type_name', 'action_date', 'is_finished', 'status_fa', 'supervisor_description', 'operator_description' ]; - if ($user->hasPermissionTo('show-safety-and-privacy-operator-cartable')) { - $query = SafetyAndPrivacy::query()->select($fields); - } - elseif ($user->hasPermissionTo('show-safety-and-privacy-operator-cartable-province')) { - throw_if(is_null($user->province_id), new ProhibitedAction('استانی برای شما در سامانه ثبت نشده است!')); + throw_if(is_null($user->edarate_shahri_id), new ProhibitedAction('اداره ای برای شما در سامانه ثبت نشده است!')); - $query = SafetyAndPrivacy::query()->where('province_id', '=', $user->province_id)->select($fields); - } - elseif ($user->hasPermissionTo('show-safety-and-privacy-operator-cartable-edarate-shahri')) { - throw_if(is_null($user->edarate_shahri_id), new ProhibitedAction('اداره ای برای شما در سامانه ثبت نشده است!')); - - $query = SafetyAndPrivacy::query()->where('edare_shahri_id', '=', $user->edarate_shahri_id); - } + $query = SafetyAndPrivacy::query()->where('edare_shahri_id', '=', $user->edarate_shahri_id); return DataTableFacade::run( $query, $request, allowedFilters: ['*'], - allowedSortings: ['*'] + allowedSortings: ['*'], + allowedSelects: $fields ); } + /** + * @throws Throwable + */ public function supervisorDataTable(Request $request) { $user = auth()->user(); - $fields = ['id','lat','lon','province_id','province_fa','city_id','city_fa','edare_shahri_id','edare_shahri_name', - 'recognize_picture','action_picture','operator_id','operator_name','way_id','created_at','updated_at','step', - 'info_id','info_fa','activity_date_time', 'action_picture_document_upload_date', 'judiciary_document_upload_date', - 'step_fa', 'axis_type_id', 'axis_type_name', 'action_date' + $fields = [ + 'id','lat','lon', 'recognize_picture','action_picture','created_at','status', 'final_description', 'province_fa', + 'info_fa', 'activity_date_time', 'action_picture_document_upload_date', 'judiciary_document_upload_date', 'edare_shahri_name', + 'step_fa', 'axis_type_id', 'axis_type_name', 'action_date', 'is_finished', 'status_fa', 'supervisor_description', 'operator_description' ]; - $query = SafetyAndPrivacy::query()->where([ - ['province_id', '=', $user->province_id], - ['is_finished', '=', 1] - ]); + $query = SafetyAndPrivacy::query(); + + if ($user->hasPermissionTo('show-safety-and-privacy-operator-cartable-province')) + { + throw_if(is_null($user->province_id), new ProhibitedAction('استانی برای شما در سامانه ثبت نشده است!')); + + $query = $query->where('province_id', '=', $user->province_id); + } return DataTableFacade::run( $query, diff --git a/database/migrations/2025_04_22_100327_add_column_to_safety_and_privacy_table.php b/database/migrations/2025_04_22_100327_add_column_to_safety_and_privacy_table.php index e78b6af7..ac7409c5 100644 --- a/database/migrations/2025_04_22_100327_add_column_to_safety_and_privacy_table.php +++ b/database/migrations/2025_04_22_100327_add_column_to_safety_and_privacy_table.php @@ -15,9 +15,12 @@ return new class extends Migration $table->boolean('is_finished')->nullable(); $table->integer('status')->nullable(); $table->string('status_fa')->nullable(); + $table->string('operator_description')->nullable(); $table->string('supervisor_description')->nullable(); $table->string('final_description')->nullable(); $table->boolean('need_judiciary')->nullable(); + $table->integer('supervisor_id')->nullable(); + $table->string('supervisor_name')->nullable(); $table->text('judiciary_document')->nullable()->change(); $table->dateTime('judiciary_document_upload_date')->nullable()->change(); }); @@ -29,7 +32,11 @@ return new class extends Migration public function down(): void { Schema::table('safety_and_privacy', function (Blueprint $table) { - $table->dropColumn(['status', 'final_description', 'is_finished', 'supervisor_description', 'status_fa', 'need_judiciary']); + $table->dropColumn([ + 'status', 'final_description', 'is_finished', + 'supervisor_description', 'status_fa', 'need_judiciary', + 'operator_description', 'supervisor_name', 'supervisor_id', + ]); $table->text('judiciary_document')->change(); $table->dateTime('judiciary_document_upload_date')->change(); }); diff --git a/routes/v3.php b/routes/v3.php index 7d6b2e8f..01f34693 100644 --- a/routes/v3.php +++ b/routes/v3.php @@ -18,7 +18,10 @@ use App\Http\Controllers\V3\Dashboard\Reports\SafetyAndPrivacyReportController; use App\Http\Controllers\V3\Dashboard\RoadItemsProjectController; use App\Http\Controllers\V3\Dashboard\RoadObservationController; use App\Http\Controllers\V3\Dashboard\RoadPatrolProjectController; -use App\Http\Controllers\V3\Dashboard\SafetyAndPrivacyController; +use App\Http\Controllers\V3\Dashboard\SafetyAndPrivacy\OperatorController; +use App\Http\Controllers\V3\Dashboard\SafetyAndPrivacy\OperatorReportController; +use App\Http\Controllers\V3\Dashboard\SafetyAndPrivacy\SupervisorController; +use App\Http\Controllers\V3\Dashboard\SafetyAndPrivacy\SupervisorReportController; use App\Http\Controllers\V3\FMSVehicleManagementController; use App\Http\Controllers\V3\Harim\DivarkeshiController; use App\Http\Controllers\V3\LogListManagementController; @@ -335,39 +338,58 @@ Route::prefix('log_list') Route::prefix('safety_and_privacy') ->name('SafetyAndPrivacy.') - ->controller(SafetyAndPrivacyController::class) ->group(function () { - Route::get('/operator_index', 'operatorIndex')->name('operatorIndex') - ->middleware('permission:show-safety-and-privacy-operator-cartable-edarate-shahri'); - Route::get('/supervisor_index', 'supervisorIndex')->name('supervisorIndex') - ->middleware('permission:show-safety-and-privacy-operator-cartable|show-safety-and-privacy-operator-cartable-province'); - Route::get('/operator_excel_report', 'operatorExcelReport')->name('operatorExcelReport') - ->middleware('permission:show-safety-and-privacy-operator-cartable-edarate-shahri'); - Route::get('/supervisor_excel_report', 'supervisorExcelReport')->name('supervisorExcelReport') - ->middleware('permission:show-safety-and-privacy-operator-cartable|show-safety-and-privacy-operator-cartable-province'); + Route::name('operator.') + ->controller(OperatorController::class) + ->group(function () { + Route::get('operator', 'index')->name('index') + ->middleware('permission:show-safety-and-privacy-operator-cartable-edarate-shahri'); + Route::get('operator/excel_report', 'excelReport')->name('excelReport') + ->middleware('permission:show-safety-and-privacy-operator-cartable-edarate-shahri'); + Route::post('operator/first_step_store', 'firstStepStore')->name('firstStepStore')->middleware(['validate-store-access', 'permission:add-safety-and-privacy']); + Route::get('/sub_items', 'subItems')->name('subItems'); + Route::get('/map', 'map')->name('map'); + Route::post('operator/second_step_store/{safetyAndPrivacy}', 'secondStepStore')->name('secondStepStore')->middleware(['validate-store-access','permission:add-safety-and-privacy']); + Route::post('operator/third_step_store/{safetyAndPrivacy}', 'thirdStepStore')->name('thirdStepStore')->middleware(['validate-store-access','permission:add-safety-and-privacy']); + Route::post('operator/{safetyAndPrivacy}', 'update')->name('update')->middleware('permission:update-safety-and-privacy'); + Route::get('operator/{safetyAndPrivacy}', 'show')->name('show'); + Route::delete('operator/{safetyAndPrivacy}', 'destroy')->name('destroy')->middleware('permission:delete-safety-and-privacy'); + Route::get('/deserialize/{safetyAndPrivacy}', 'deserialize')->name('deserialize'); + Route::post('operator/finish/{safetyAndPrivacy}', 'finish')->name('finish'); + }); - Route::post('/first_step_store', 'firstStepStore')->name('firstStepStore')->middleware(['validate-store-access', 'permission:add-safety-and-privacy']); - Route::get('/sub_items', 'subItems')->name('subItems'); - Route::get('/map', 'map')->name('map'); - Route::post('/second_step_store/{safetyAndPrivacy}', 'secondStepStore')->name('secondStepStore')->middleware(['validate-store-access','permission:add-safety-and-privacy']); - Route::post('/third_step_store/{safetyAndPrivacy}', 'thirdStepStore')->name('thirdStepStore')->middleware(['validate-store-access','permission:add-safety-and-privacy']); - Route::post('/{safetyAndPrivacy}', 'update')->name('update')->middleware('permission:update-safety-and-privacy'); - Route::get('/{safetyAndPrivacy}', 'show')->name('show'); - Route::delete('/{safetyAndPrivacy}', 'destroy')->name('destroy')->middleware('permission:delete-safety-and-privacy'); - Route::get('/deserialize/{safetyAndPrivacy}', 'deserialize')->name('deserialize'); - Route::post('/confirm/{safetyAndPrivacy}', 'confirm')->name('confirm'); - Route::post('/reject/{safetyAndPrivacy}', 'reject')->name('reject'); - Route::post('/finish/{safetyAndPrivacy}', 'finish')->name('finish'); + Route::prefix('supervisor') + ->name('supervisor.') + ->controller(SupervisorController::class) + ->group(function () { + Route::get('/', 'index')->name('index') + ->middleware('permission:show-safety-and-privacy-operator-cartable|show-safety-and-privacy-operator-cartable-province'); + Route::get('/excel_report', 'excelReport')->name('excelReport') + ->middleware('permission:show-safety-and-privacy-operator-cartable|show-safety-and-privacy-operator-cartable-province'); + Route::post('/confirm/{safetyAndPrivacy}', 'confirm')->name('confirm'); + Route::post('/reject/{safetyAndPrivacy}', 'reject')->name('reject'); + }); }); Route::prefix('safety_and_privacy_report') ->name('SafetyAndPrivacyReport.') - ->controller(SafetyAndPrivacyReportController::class) ->group(function () { - Route::get('/country_activity', 'countryActivity')->name('countryActivity'); - Route::get('/province_activity', 'provinceActivity')->name('provinceActivity'); - Route::get('/country_excel_activity', 'countryExcelActivity')->name('countryExcelActivity'); - Route::get('/province_excel_activity', 'provinceExcelActivity')->name('provinceExcelActivity'); + Route::prefix('operator') + ->name('operator.') + ->controller(OperatorReportController::class) + ->group(function () { + Route::get('/country_activity', 'countryActivity')->name('countryActivity'); + Route::get('/province_activity', 'provinceActivity')->name('provinceActivity'); + Route::get('/country_excel_activity', 'countryExcelActivity')->name('countryExcelActivity'); + Route::get('/province_excel_activity', 'provinceExcelActivity')->name('provinceExcelActivity'); + }); + + Route::prefix('supervisor') + ->name('supervisor.') + ->controller(SupervisorReportController::class) + ->group(function () { + + }); }); Route::prefix('otp')