diff --git a/app/Http/Controllers/V3/Dashboard/RoadObservationController.php b/app/Http/Controllers/V3/Dashboard/RoadObservationController.php index bdc10f8c..1000a9ce 100644 --- a/app/Http/Controllers/V3/Dashboard/RoadObservationController.php +++ b/app/Http/Controllers/V3/Dashboard/RoadObservationController.php @@ -10,22 +10,20 @@ use App\Models\RoadObserved; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use App\Services\Cartables\RoadObservationTableservice; -use Illuminate\Support\Facades\Auth; use Maatwebsite\Excel\Facades\Excel; -use Illuminate\Support\Facades\Gate; use Symfony\Component\HttpFoundation\BinaryFileResponse; class RoadObservationController extends Controller { use ApiResponse; - public function supervisorindex (Request $request,RoadObservationTableservice $roadObservationTableservice ): JsonResponse + public function supervisorIndex (Request $request,RoadObservationTableservice $roadObservationTableservice ): JsonResponse { - $data = $roadObservationTableservice-> supervisorCartableIndex($request); + $data = $roadObservationTableservice->supervisorCartableIndex($request); return response()->json($data); } - public function verifybysupervisor (VerifyBySupervisorRequest $request, RoadObserved $roadObserved): JsonResponse + public function verifyBySupervisor (VerifyBySupervisorRequest $request, RoadObserved $roadObserved): JsonResponse { $statusFa = $request->verify == 1 ? 'تایید شده' : 'عدم تایید'; @@ -40,30 +38,30 @@ class RoadObservationController extends Controller auth()->user()->addActivityComplete(1138); - return $this->successResponse(['status' => 'succeed']); + return $this->successResponse(); } - public function supervisorcartablereport (Request $request, RoadObservationTableService $roadObservationTableService): BinaryFileResponse + public function supervisorCartableReport (Request $request, RoadObservationTableService $roadObservationTableService): BinaryFileResponse { $name = 'گزارش از کارتابل ارزیابی واکنش سریع '. verta()->now()->format('Y-m-d H:i') . '.xlsx'; $data = $roadObservationTableService->supervisorCartableIndex($request, true); - return Excel::download(new SupervisorCartableReport($data), $name); + return Excel::download(new SupervisorCartableReport($data['data']), $name); } - public function operatorindex(Request $request, RoadObservationTableService $roadObservationTableService): JsonResponse + public function operatorIndex(Request $request, RoadObservationTableService $roadObservationTableService): JsonResponse { $data = $roadObservationTableService->operatorCartableIndex($request); return response()->json($data); } - public function operatorcartablereport(Request $request, RoadObservationTableService $roadObservationTableService): BinaryFileResponse + public function operatorCartableReport(Request $request, RoadObservationTableService $roadObservationTableService): BinaryFileResponse { $name = 'گزارش از کارتابل ارزیابی واکنش سریع ' . verta()->now()->format('Y-m-d H:i') . '.xlsx'; $data = $roadObservationTableService->operatorCartableIndex($request); - return Excel::download(new OperatorCartableReport($data), $name); + return Excel::download(new OperatorCartableReport($data['data']), $name); } } diff --git a/routes/v3.php b/routes/v3.php index 22ec9951..fb984f0f 100644 --- a/routes/v3.php +++ b/routes/v3.php @@ -271,9 +271,9 @@ Route::prefix('road_observations') ->name('roadObservations.') ->controller(RoadObservationController::class) ->group(function () { - Route::get('/supervisor_index', 'supervisorindex')->name('supervisorIndex')->middleware('supervise-fast-react-province','supervise-fast-react'); - Route::post('/verify/{road_observed}', 'verifybysupervisor')->name('verifyBySupervisor'); - Route::get('/supervisor_report', 'supervisorcartablereport')->name('report'); - Route::get('/operator_index','operatorIndex')->name('operatorIndex')->middleware('show-fast-react','show-fast-react-province'); - Route::get('/operator_report', 'operatorcartablereport')->name('operatorExcelReport'); + Route::get('/supervisor_index', 'supervisorIndex')->name('supervisorIndex')->middleware('permission:supervise-fast-react-province|supervise-fast-react'); + Route::post('/verify/{road_observed}', 'verifyBySupervisor')->name('verifyBySupervisor'); + Route::get('/supervisor_report', 'supervisorCartableReport')->name('report'); + Route::get('/operator_index','operatorIndex')->name('operatorIndex')->middleware('permission:show-fast-react|show-fast-react-province'); + Route::get('/operator_report', 'operatorCartableReport')->name('operatorExcelReport'); });