From 07d8202469e132ee421659076e24b3d9b52ed4e4 Mon Sep 17 00:00:00 2001 From: joddyabott Date: Sun, 3 Aug 2025 17:42:21 +0330 Subject: [PATCH 1/7] create controller and these dependensi --- app/Enums/HarimStates.php | 4 +- .../Harim/GeneralManagerController.php | 83 ++++++++++++++++++ .../Dashboard/Harim/HarimOfficeController.php | 8 +- .../Harim/ProvinceOfficeController.php | 12 ++- .../Harim/TechnicalDeputyController.php | 84 +++++++++++++++++++ .../Dashboard/Harim/Deputy/ConfirmRequest.php | 30 +++++++ .../Dashboard/Harim/Deputy/RejectRequest.php | 30 +++++++ .../Harim/GeneralManager/ConfirmRequest.php | 30 +++++++ .../Harim/GeneralManager/RejectRequest.php | 29 +++++++ .../Dashboard/Harim/HarimOffice/NoRequest.php | 3 +- routes/v3.php | 10 +++ 11 files changed, 315 insertions(+), 8 deletions(-) create mode 100644 app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php create mode 100644 app/Http/Controllers/V3/Dashboard/Harim/TechnicalDeputyController.php create mode 100644 app/Http/Requests/V3/Dashboard/Harim/Deputy/ConfirmRequest.php create mode 100644 app/Http/Requests/V3/Dashboard/Harim/Deputy/RejectRequest.php create mode 100644 app/Http/Requests/V3/Dashboard/Harim/GeneralManager/ConfirmRequest.php create mode 100644 app/Http/Requests/V3/Dashboard/Harim/GeneralManager/RejectRequest.php diff --git a/app/Enums/HarimStates.php b/app/Enums/HarimStates.php index b8e2c54b..3e74b903 100644 --- a/app/Enums/HarimStates.php +++ b/app/Enums/HarimStates.php @@ -8,7 +8,7 @@ enum HarimStates: int case Baresi_Imeni_Rah_Tavasot_Daftar_Harim = 2; case Baresi_Imeni_Rah_Tavasot_Moaven = 3; case Baresi_Imeni_Rah_Tavasot_Modir_Kol = 4; - case Rad_Be_Dalil_Imeni_Rah = 5; + case ERSAL_BE_PANJAREVAHED = 5; public static function name(int $state): string { @@ -17,7 +17,7 @@ enum HarimStates: int 2 => "بررسی ایمنی راه توسط ادارات حریم", 3 => "بررسی ایمنی راه توسط معاون ", 4 => "بررسی ایمنی راه توسط مدیر کل", - 5 => "رد درخواست به دلیل ایمنی راه", + 5 => "ارسال به پنجره واحد", ]; return $mapArray[$state]; diff --git a/app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php b/app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php new file mode 100644 index 00000000..53b7ee9d --- /dev/null +++ b/app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php @@ -0,0 +1,83 @@ +user(); + $query = Harim::query() + ->where('state_id','=',HarimStates::Baresi_Imeni_Rah_Tavasot_Modir_Kol->value) + ->where('edare_shahri_id', '=', $user->edarate_shahri_id) + ->with('histories:expert_description'); + + $data = DataTableFacade::run( + $query, + $request, + allowedFilters: ['*'], + allowedSortings: ['*'] + ); + return response()->json($data); + } + public function conform(ConfirmRequest $request, Harim $harim): JsonResponse + { + DB::transaction(function () use ($request, $harim) { + $action = HarimAction::CONFIRM->value; + $harim->histories()->create([ + 'user_id' => auth()->user()->id, + 'previous_state_id' => $harim->state_id, + 'previous_state_name' => $harim->state_name, + 'expert_description' => $request->expert_description, + 'action_id' => $action, + 'action_name' => HarimAction::name($action), + ]); + + $state = HarimStates::ERSAL_BE_PANJAREVAHED->value; + $harim->update([ + 'state_id' => $state, + 'state_name' => HarimStates::name($state), + ]); + }); + return $this->successResponse(); + } + + public function reject(RejectRequest $request, Harim $harim): JsonResponse + { + DB::transaction(function () use ($request, $harim) { + $action = HarimAction::REJECT->value; + $harim->histories()->create([ + 'user_id'=> auth()->user()->id, + 'previous-state_id' => $harim->state_id, + 'previous_state_name' => $harim->state_name, + 'export_description' => $request->export_description, + 'action_id' => $action, + 'action_name' => HarimAction::name($action), + ]); + $state = HarimStates::Baresi_Imeni_Rah_Tavasot_Moaven->value; + $harim->update([ + 'state_id' => $state, + 'state_name' => HarimStates::name($state), + ]); + }); + return $this->successResponse(); + } + public function show(Harim $harim): JsonResponse + { + return $this->successResponse($harim); + + } +} diff --git a/app/Http/Controllers/V3/Dashboard/Harim/HarimOfficeController.php b/app/Http/Controllers/V3/Dashboard/Harim/HarimOfficeController.php index 609ec75c..845feb18 100644 --- a/app/Http/Controllers/V3/Dashboard/Harim/HarimOfficeController.php +++ b/app/Http/Controllers/V3/Dashboard/Harim/HarimOfficeController.php @@ -20,7 +20,11 @@ class HarimOfficeController extends Controller public function index(Request $request): JsonResponse { - $query = Harim::query()->where('edareh_shahri_id', '=', auth()->user()->edarate_shahri_id); + $user = auth()->user(); + $query = Harim::query() + ->where('state_id','=',HarimStates::Baresi_Imeni_Rah_Tavasot_Daftar_Harim->value) + ->where('edare_shahri_id', '=', $user->edarate_shahri_id) + ->with('expert_description'); $data = DataTableFacade::run( $query, $request, @@ -47,6 +51,7 @@ class HarimOfficeController extends Controller $harim ->update([ 'state_id' => $state, 'state_name' => HarimStates::name($state), + 'final_description' => 'yes' ]); }); return $this->successResponse(); @@ -69,6 +74,7 @@ class HarimOfficeController extends Controller $harim ->update([ 'state_id' => $state, 'state_name' => HarimStates::name($state), + 'final_description' => 'no' ]); }); return $this->successResponse(); diff --git a/app/Http/Controllers/V3/Dashboard/Harim/ProvinceOfficeController.php b/app/Http/Controllers/V3/Dashboard/Harim/ProvinceOfficeController.php index 1faf9abe..6953e132 100644 --- a/app/Http/Controllers/V3/Dashboard/Harim/ProvinceOfficeController.php +++ b/app/Http/Controllers/V3/Dashboard/Harim/ProvinceOfficeController.php @@ -20,7 +20,10 @@ class ProvinceOfficeController extends Controller public function index(Request $request): JsonResponse { $user = auth()->user(); - $query = Harim::query()->where('edareh_shahri_id', '=', $user->edarate_shahri_id); + $query = Harim::query() + ->where('state_id','=',HarimStates::Baresi_Edare_Shahrestan->value) + ->where('edare_shahri_id', '=', $user->edarate_shahri_id); + $data = DataTableFacade::run( $query, $request, @@ -33,13 +36,15 @@ class ProvinceOfficeController extends Controller public function feedback(FeedBackRequest $request, Harim $harim): JsonResponse { DB::transaction(function () use ($request,$harim) { + $action = HarimAction::FEEDBACK->value; + $harim->histories()->create([ 'user_id' => auth()->user()->id, 'previous_state_id' => $harim->state_id, 'previous_state_name' => $harim->state_name, 'expert_description' => $request->expert_description, - 'action_id' => HarimAction::FEEDBACK->value, - 'action_name' => HarimAction::FEEDBACK->name, + 'action_id' => $action, + 'action_name' => HarimAction::name($action), ]); $state = HarimStates::Baresi_Imeni_Rah_Tavasot_Daftar_Harim->value; @@ -55,6 +60,5 @@ class ProvinceOfficeController extends Controller public function show(Harim $harim): JsonResponse { return $this->successResponse($harim); - } } diff --git a/app/Http/Controllers/V3/Dashboard/Harim/TechnicalDeputyController.php b/app/Http/Controllers/V3/Dashboard/Harim/TechnicalDeputyController.php new file mode 100644 index 00000000..43dc0bf3 --- /dev/null +++ b/app/Http/Controllers/V3/Dashboard/Harim/TechnicalDeputyController.php @@ -0,0 +1,84 @@ +user(); + $query = Harim::query() + ->where('state_id', '=', HarimStates::Baresi_Imeni_Rah_Tavasot_Moaven->value) + ->where('edare_shahri_id', '=', $user->edarate_shahri_id) + ->with('histories:expert_description'); + + $data = DataTableFacade::run( + $query, + $request, + allowedFilters: ['*'], + allowedSortings: ['*'], + ); + return response()->json($data); + } + public function conform(ConfirmRequest $request, Harim $harim): JsonResponse + { + DB::transaction(function () use ($request,$harim) { + $action = HarimAction::CONFIRM->value; + + $harim->histories()->create([ + 'user_id' => auth()->user()->id, + 'previous_state_id' => $harim->state_id, + 'previous_state_name' => $harim->state_name, + 'expert_description' => $request->expert_description, + 'action_id' => $action, + 'action_name' => HarimAction::name($action), + ]); + $state = HarimStates::Baresi_Imeni_Rah_Tavasot_Modir_Kol->value; + + $harim ->update([ + 'state_id' => $state, + 'state_name' => HarimStates::name($state), + ]); + }); + return $this->successResponse(); + + } + public function reject(ConfirmRequest $request, Harim $harim): JsonResponse + { + DB::transaction(function () use ($request,$harim) { + $action = HarimAction::REJECT->value; + + $harim->histories()->create([ + 'user_id' => auth()->user()->id, + 'previous_state_id' => $harim->state_id, + 'previous_state_name' => $harim->state_name, + 'expert_description' => $request->expert_description, + 'action_id' => $action, + 'action_name' => HarimAction::name($action), + ]); + $state = HarimStates::Baresi_Imeni_Rah_Tavasot_Daftar_Harim->value; + $harim->update([ + 'state_id' => $state, + 'state_name' => HarimStates::name($state), + ]); + }); + return $this->successResponse(); + } + public function show(Harim $harim): JsonResponse + { + return $this->successResponse($harim); + } +} diff --git a/app/Http/Requests/V3/Dashboard/Harim/Deputy/ConfirmRequest.php b/app/Http/Requests/V3/Dashboard/Harim/Deputy/ConfirmRequest.php new file mode 100644 index 00000000..e3cb82cb --- /dev/null +++ b/app/Http/Requests/V3/Dashboard/Harim/Deputy/ConfirmRequest.php @@ -0,0 +1,30 @@ +harim->edare_shahri_id == auth()->user()->edarate_shahri_id && + $this->harim->state_id == HarimStates::Baresi_Imeni_Rah_Tavasot_Moaven->value; + } + + /** + * Get the validation rules that apply to the request. + * + * @return array|string> + */ + public function rules(): array + { + return [ + 'expert_description' => 'required|string', + ]; + } +} diff --git a/app/Http/Requests/V3/Dashboard/Harim/Deputy/RejectRequest.php b/app/Http/Requests/V3/Dashboard/Harim/Deputy/RejectRequest.php new file mode 100644 index 00000000..db73d533 --- /dev/null +++ b/app/Http/Requests/V3/Dashboard/Harim/Deputy/RejectRequest.php @@ -0,0 +1,30 @@ +harim->edare_shahri_id == auth()->user()->edarate_shahri_id && + $this->harim->state_id == HarimStates::Baresi_Imeni_Rah_Tavasot_Moaven->value; + } + + /** + * Get the validation rules that apply to the request. + * + * @return array|string> + */ + public function rules(): array + { + return [ + 'expert_description' => 'required|string', + ]; + } +} diff --git a/app/Http/Requests/V3/Dashboard/Harim/GeneralManager/ConfirmRequest.php b/app/Http/Requests/V3/Dashboard/Harim/GeneralManager/ConfirmRequest.php new file mode 100644 index 00000000..5f93d671 --- /dev/null +++ b/app/Http/Requests/V3/Dashboard/Harim/GeneralManager/ConfirmRequest.php @@ -0,0 +1,30 @@ +harim->edare_shahri_id == auth()->user()->edarate_shahri_id && + $this->harim->state_id == HarimStates::Baresi_Imeni_Rah_Tavasot_Modir_Kol->value; + } + + /** + * Get the validation rules that apply to the request. + * + * @return array|string> + */ + public function rules(): array + { + return [ + 'expert_description' => 'required|string', + ]; + } +} diff --git a/app/Http/Requests/V3/Dashboard/Harim/GeneralManager/RejectRequest.php b/app/Http/Requests/V3/Dashboard/Harim/GeneralManager/RejectRequest.php new file mode 100644 index 00000000..5a16c5b9 --- /dev/null +++ b/app/Http/Requests/V3/Dashboard/Harim/GeneralManager/RejectRequest.php @@ -0,0 +1,29 @@ +harim->edare_shahri_id == auth()->user()->edarate_shahri_id && + $this->harim->state_id == HarimStates::Baresi_Imeni_Rah_Tavasot_Modir_Kol->value; } + + /** + * Get the validation rules that apply to the request. + * + * @return array|string> + */ + public function rules(): array + { + return [ + 'expert_description' => 'required|string', + ]; + } +} diff --git a/app/Http/Requests/V3/Dashboard/Harim/HarimOffice/NoRequest.php b/app/Http/Requests/V3/Dashboard/Harim/HarimOffice/NoRequest.php index 9e35c3b8..ad4b876b 100644 --- a/app/Http/Requests/V3/Dashboard/Harim/HarimOffice/NoRequest.php +++ b/app/Http/Requests/V3/Dashboard/Harim/HarimOffice/NoRequest.php @@ -13,7 +13,8 @@ class NoRequest extends FormRequest public function authorize(): bool { return $this->harim->edare_shahri_id == auth()->user()->edarate_shahri_id && - $this->harim->state_id == HarimStates::Baresi_Imeni_Rah_Tavasot_Daftar_Harim->value; } + $this->harim->state_id == HarimStates::Baresi_Imeni_Rah_Tavasot_Daftar_Harim->value; + } /** * Get the validation rules that apply to the request. diff --git a/routes/v3.php b/routes/v3.php index 47e6f1fd..7a2ae468 100644 --- a/routes/v3.php +++ b/routes/v3.php @@ -10,6 +10,7 @@ use App\Http\Controllers\V3\Dashboard\Azmayesh\AzmayeshSampleController; use App\Http\Controllers\V3\Dashboard\Azmayesh\AzmayeshTypeController; use App\Http\Controllers\V3\Dashboard\Harim\HarimOfficeController; use App\Http\Controllers\V3\Dashboard\Harim\ProvinceOfficeController; +use App\Http\Controllers\V3\Dashboard\Harim\TechnicalDeputyController; use App\Http\Controllers\V3\Dashboard\ItemsManagementController; use App\Http\Controllers\V3\Dashboard\Mission\ControlUnitController; use App\Http\Controllers\V3\Dashboard\Mission\DetailController; @@ -528,5 +529,14 @@ Route::prefix('harim') Route::post('/no/{harim}', 'no')->name('no'); Route::get('/{harim}', 'show')->name('show'); }); + Route::prefix('technical_deputy') + ->name('technical_deputy.') + ->controller(TechnicalDeputyController::class) + ->group(function () { + Route::get('/', 'index')->name('index'); + Route::post('/conform/{harim}', 'conform')->name('conform'); + Route::post('/reject/{harim}', 'reject')->name('reject'); + Route::get('/{harim}', 'show')->name('show'); + }); }); From ab6d6f2cb0c23884219dcd2a38e66661bc06741d Mon Sep 17 00:00:00 2001 From: joddyabott Date: Mon, 4 Aug 2025 12:06:18 +0330 Subject: [PATCH 2/7] debug code --- .../V3/Dashboard/Harim/GeneralManagerController.php | 2 +- .../Controllers/V3/Dashboard/Harim/HarimOfficeController.php | 2 +- .../V3/Dashboard/Harim/ProvinceOfficeController.php | 2 +- .../V3/Dashboard/Harim/TechnicalDeputyController.php | 2 +- .../Requests/V3/Dashboard/Harim/Deputy/ConfirmRequest.php | 2 +- .../Requests/V3/Dashboard/Harim/Deputy/RejectRequest.php | 2 +- .../V3/Dashboard/Harim/GeneralManager/ConfirmRequest.php | 2 +- .../V3/Dashboard/Harim/GeneralManager/RejectRequest.php | 2 +- .../Requests/V3/Dashboard/Harim/HarimOffice/NoRequest.php | 2 +- .../Requests/V3/Dashboard/Harim/HarimOffice/YesRequest.php | 2 +- .../V3/Dashboard/Harim/ProvinceOffice/FeedBackRequest.php | 2 +- app/Models/Harim.php | 1 - database/factories/HarimFactory.php | 4 ++-- .../migrations/2025_07_30_153041_create_harims_table.php | 5 ++++- database/seeders/HarimStateSeeder.php | 2 +- 15 files changed, 18 insertions(+), 16 deletions(-) diff --git a/app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php b/app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php index 53b7ee9d..14bcd353 100644 --- a/app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php +++ b/app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php @@ -22,7 +22,7 @@ class GeneralManagerController extends Controller $user = auth()->user(); $query = Harim::query() ->where('state_id','=',HarimStates::Baresi_Imeni_Rah_Tavasot_Modir_Kol->value) - ->where('edare_shahri_id', '=', $user->edarate_shahri_id) + ->where('edareh_shahri_id', '=', $user->edarate_shahri_id) ->with('histories:expert_description'); $data = DataTableFacade::run( diff --git a/app/Http/Controllers/V3/Dashboard/Harim/HarimOfficeController.php b/app/Http/Controllers/V3/Dashboard/Harim/HarimOfficeController.php index 845feb18..5ffa40c6 100644 --- a/app/Http/Controllers/V3/Dashboard/Harim/HarimOfficeController.php +++ b/app/Http/Controllers/V3/Dashboard/Harim/HarimOfficeController.php @@ -23,7 +23,7 @@ class HarimOfficeController extends Controller $user = auth()->user(); $query = Harim::query() ->where('state_id','=',HarimStates::Baresi_Imeni_Rah_Tavasot_Daftar_Harim->value) - ->where('edare_shahri_id', '=', $user->edarate_shahri_id) + ->where('edareh_shahri_id', '=', $user->edarate_shahri_id) ->with('expert_description'); $data = DataTableFacade::run( $query, diff --git a/app/Http/Controllers/V3/Dashboard/Harim/ProvinceOfficeController.php b/app/Http/Controllers/V3/Dashboard/Harim/ProvinceOfficeController.php index 6953e132..0739cd31 100644 --- a/app/Http/Controllers/V3/Dashboard/Harim/ProvinceOfficeController.php +++ b/app/Http/Controllers/V3/Dashboard/Harim/ProvinceOfficeController.php @@ -22,7 +22,7 @@ class ProvinceOfficeController extends Controller $user = auth()->user(); $query = Harim::query() ->where('state_id','=',HarimStates::Baresi_Edare_Shahrestan->value) - ->where('edare_shahri_id', '=', $user->edarate_shahri_id); + ->where('edareh_shahri_id', '=', $user->edarate_shahri_id); $data = DataTableFacade::run( $query, diff --git a/app/Http/Controllers/V3/Dashboard/Harim/TechnicalDeputyController.php b/app/Http/Controllers/V3/Dashboard/Harim/TechnicalDeputyController.php index 43dc0bf3..f5c3099a 100644 --- a/app/Http/Controllers/V3/Dashboard/Harim/TechnicalDeputyController.php +++ b/app/Http/Controllers/V3/Dashboard/Harim/TechnicalDeputyController.php @@ -22,7 +22,7 @@ class TechnicalDeputyController extends Controller $user = auth()->user(); $query = Harim::query() ->where('state_id', '=', HarimStates::Baresi_Imeni_Rah_Tavasot_Moaven->value) - ->where('edare_shahri_id', '=', $user->edarate_shahri_id) + ->where('edareh_shahri_id', '=', $user->edarate_shahri_id) ->with('histories:expert_description'); $data = DataTableFacade::run( diff --git a/app/Http/Requests/V3/Dashboard/Harim/Deputy/ConfirmRequest.php b/app/Http/Requests/V3/Dashboard/Harim/Deputy/ConfirmRequest.php index e3cb82cb..3ac727b1 100644 --- a/app/Http/Requests/V3/Dashboard/Harim/Deputy/ConfirmRequest.php +++ b/app/Http/Requests/V3/Dashboard/Harim/Deputy/ConfirmRequest.php @@ -12,7 +12,7 @@ class ConfirmRequest extends FormRequest */ public function authorize(): bool { - return $this->harim->edare_shahri_id == auth()->user()->edarate_shahri_id && + return $this->harim->edareh_shahri_id == auth()->user()->edarate_shahri_id && $this->harim->state_id == HarimStates::Baresi_Imeni_Rah_Tavasot_Moaven->value; } diff --git a/app/Http/Requests/V3/Dashboard/Harim/Deputy/RejectRequest.php b/app/Http/Requests/V3/Dashboard/Harim/Deputy/RejectRequest.php index db73d533..b9dcf259 100644 --- a/app/Http/Requests/V3/Dashboard/Harim/Deputy/RejectRequest.php +++ b/app/Http/Requests/V3/Dashboard/Harim/Deputy/RejectRequest.php @@ -12,7 +12,7 @@ class RejectRequest extends FormRequest */ public function authorize(): bool { - return $this->harim->edare_shahri_id == auth()->user()->edarate_shahri_id && + return $this->harim->edareh_shahri_id == auth()->user()->edarate_shahri_id && $this->harim->state_id == HarimStates::Baresi_Imeni_Rah_Tavasot_Moaven->value; } diff --git a/app/Http/Requests/V3/Dashboard/Harim/GeneralManager/ConfirmRequest.php b/app/Http/Requests/V3/Dashboard/Harim/GeneralManager/ConfirmRequest.php index 5f93d671..145086b2 100644 --- a/app/Http/Requests/V3/Dashboard/Harim/GeneralManager/ConfirmRequest.php +++ b/app/Http/Requests/V3/Dashboard/Harim/GeneralManager/ConfirmRequest.php @@ -12,7 +12,7 @@ class ConfirmRequest extends FormRequest */ public function authorize(): bool { - return $this->harim->edare_shahri_id == auth()->user()->edarate_shahri_id && + return $this->harim->edareh_shahri_id == auth()->user()->edarate_shahri_id && $this->harim->state_id == HarimStates::Baresi_Imeni_Rah_Tavasot_Modir_Kol->value; } diff --git a/app/Http/Requests/V3/Dashboard/Harim/GeneralManager/RejectRequest.php b/app/Http/Requests/V3/Dashboard/Harim/GeneralManager/RejectRequest.php index 5a16c5b9..e81ecd88 100644 --- a/app/Http/Requests/V3/Dashboard/Harim/GeneralManager/RejectRequest.php +++ b/app/Http/Requests/V3/Dashboard/Harim/GeneralManager/RejectRequest.php @@ -12,7 +12,7 @@ class RejectRequest extends FormRequest */ public function authorize(): bool { - return $this->harim->edare_shahri_id == auth()->user()->edarate_shahri_id && + return $this->harim->edareh_shahri_id == auth()->user()->edarate_shahri_id && $this->harim->state_id == HarimStates::Baresi_Imeni_Rah_Tavasot_Modir_Kol->value; } /** diff --git a/app/Http/Requests/V3/Dashboard/Harim/HarimOffice/NoRequest.php b/app/Http/Requests/V3/Dashboard/Harim/HarimOffice/NoRequest.php index ad4b876b..ee6a53ce 100644 --- a/app/Http/Requests/V3/Dashboard/Harim/HarimOffice/NoRequest.php +++ b/app/Http/Requests/V3/Dashboard/Harim/HarimOffice/NoRequest.php @@ -12,7 +12,7 @@ class NoRequest extends FormRequest */ public function authorize(): bool { - return $this->harim->edare_shahri_id == auth()->user()->edarate_shahri_id && + return $this->harim->edareh_shahri_id == auth()->user()->edarate_shahri_id && $this->harim->state_id == HarimStates::Baresi_Imeni_Rah_Tavasot_Daftar_Harim->value; } diff --git a/app/Http/Requests/V3/Dashboard/Harim/HarimOffice/YesRequest.php b/app/Http/Requests/V3/Dashboard/Harim/HarimOffice/YesRequest.php index a61edd56..20b39e7e 100644 --- a/app/Http/Requests/V3/Dashboard/Harim/HarimOffice/YesRequest.php +++ b/app/Http/Requests/V3/Dashboard/Harim/HarimOffice/YesRequest.php @@ -12,7 +12,7 @@ class YesRequest extends FormRequest */ public function authorize(): bool { - return $this->harim->edare_shahri_id == auth()->user()->edarate_shahri_id && + return $this->harim->edareh_shahri_id == auth()->user()->edarate_shahri_id && $this->harim->state_id == HarimStates::Baresi_Imeni_Rah_Tavasot_Daftar_Harim->value; } diff --git a/app/Http/Requests/V3/Dashboard/Harim/ProvinceOffice/FeedBackRequest.php b/app/Http/Requests/V3/Dashboard/Harim/ProvinceOffice/FeedBackRequest.php index d9260edf..ce8b313d 100644 --- a/app/Http/Requests/V3/Dashboard/Harim/ProvinceOffice/FeedBackRequest.php +++ b/app/Http/Requests/V3/Dashboard/Harim/ProvinceOffice/FeedBackRequest.php @@ -12,7 +12,7 @@ class FeedBackRequest extends FormRequest */ public function authorize(): bool { - return $this->harim->edare_shahri_id == auth()->user()->edarate_shahri_id && + return $this->harim->edareh_shahri_id == auth()->user()->edarate_shahri_id && $this->harim->state_id == HarimStates::Baresi_Edare_Shahrestan->value; } diff --git a/app/Models/Harim.php b/app/Models/Harim.php index 655a7c84..b0e51a75 100644 --- a/app/Models/Harim.php +++ b/app/Models/Harim.php @@ -10,7 +10,6 @@ class Harim extends Model { use HasFactory; protected $guarded = []; - protected $table = 'harim'; public function histories(): HasMany { diff --git a/database/factories/HarimFactory.php b/database/factories/HarimFactory.php index 4748c539..428a416e 100644 --- a/database/factories/HarimFactory.php +++ b/database/factories/HarimFactory.php @@ -48,8 +48,8 @@ class HarimFactory extends Factory 'plan_group' => $this->faker->name, 'plan_title' => $this->faker->title, 'address' => $this->faker->address, - 'file' => $this->faker->file, - 'polygon' => $this->faker->numerify(), + 'file' => $this->faker->name, + 'polygon' => json_encode($this->faker->numerify()), ]; } } diff --git a/database/migrations/2025_07_30_153041_create_harims_table.php b/database/migrations/2025_07_30_153041_create_harims_table.php index 556bc2a5..231432fa 100644 --- a/database/migrations/2025_07_30_153041_create_harims_table.php +++ b/database/migrations/2025_07_30_153041_create_harims_table.php @@ -38,7 +38,10 @@ return new class extends Migration $table->string('plan_title'); $table->string('address'); $table->string('file'); - $table->polygon('polygon'); + $table->json('polygon'); + $table->boolean('need_road_access')->nullable(); + $table->integer('final_decision')->nullable(); + $table->string('final_description')->nullable(); $table->timestamps(); }); } diff --git a/database/seeders/HarimStateSeeder.php b/database/seeders/HarimStateSeeder.php index 96c414a2..ce564b4c 100644 --- a/database/seeders/HarimStateSeeder.php +++ b/database/seeders/HarimStateSeeder.php @@ -18,7 +18,7 @@ class HarimStateSeeder extends Seeder ['id' => 2, 'name' => 'در انتظار بررسی ایمنی راه توسط دفتر حریم', 'created_at' => now(), 'updated_at' => now(),], ['id' => 3, 'name' => 'در انتظار بررسی ایمنی راه توسط معاون', 'created_at' => now(), 'updated_at' => now(),], ['id' => 4, 'name' => 'در انتظار بررسی ایمنی راه توسط مدیر کل', 'created_at' => now(), 'updated_at' => now(),], - ['id' => 5, 'name' => 'رد به دلیل ایمنی راه', 'created_at' => now(), 'updated_at' => now(),], + ['id' => 5, 'name' => 'ارسال به پنجره واحد', 'created_at' => now(), 'updated_at' => now(),], ]); } } From c03601aebb9b64f98c59935c8e1f52313400da22 Mon Sep 17 00:00:00 2001 From: joddyabott Date: Mon, 4 Aug 2025 12:14:01 +0330 Subject: [PATCH 3/7] debug code for seecend time --- .../V3/Dashboard/Harim/GeneralManagerController.php | 4 ++-- .../Controllers/V3/Dashboard/Harim/HarimOfficeController.php | 4 ++-- .../V3/Dashboard/Harim/ProvinceOfficeController.php | 2 +- .../V3/Dashboard/Harim/TechnicalDeputyController.php | 2 +- .../2025_07_30_153216_create_harim_histories_table.php | 4 +--- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php b/app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php index 14bcd353..28bd14c8 100644 --- a/app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php +++ b/app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php @@ -38,7 +38,7 @@ class GeneralManagerController extends Controller DB::transaction(function () use ($request, $harim) { $action = HarimAction::CONFIRM->value; $harim->histories()->create([ - 'user_id' => auth()->user()->id, + 'expert_id' => auth()->user()->id, 'previous_state_id' => $harim->state_id, 'previous_state_name' => $harim->state_name, 'expert_description' => $request->expert_description, @@ -60,7 +60,7 @@ class GeneralManagerController extends Controller DB::transaction(function () use ($request, $harim) { $action = HarimAction::REJECT->value; $harim->histories()->create([ - 'user_id'=> auth()->user()->id, + 'expert_id'=> auth()->user()->id, 'previous-state_id' => $harim->state_id, 'previous_state_name' => $harim->state_name, 'export_description' => $request->export_description, diff --git a/app/Http/Controllers/V3/Dashboard/Harim/HarimOfficeController.php b/app/Http/Controllers/V3/Dashboard/Harim/HarimOfficeController.php index 5ffa40c6..60f8cff9 100644 --- a/app/Http/Controllers/V3/Dashboard/Harim/HarimOfficeController.php +++ b/app/Http/Controllers/V3/Dashboard/Harim/HarimOfficeController.php @@ -38,7 +38,7 @@ class HarimOfficeController extends Controller DB::transaction(function () use ($request,$harim) { $action = HarimAction::YES->value; $harim->histories()->create([ - 'user_id' => auth()->user()->id, + 'expert_id' => auth()->user()->id, 'previous_state_id' => $harim->state_id, 'previous_state_name' => $harim->state_name, 'expert_description' => $request->expert_description, @@ -61,7 +61,7 @@ class HarimOfficeController extends Controller DB::transaction(function () use ($request,$harim) { $action = HarimAction::NO->value; $harim->histories()->create([ - 'user_id' => auth()->user()->id, + 'expert_id' => auth()->user()->id, 'previous_state_id' => $harim->state_id, 'previous_state_name' => $harim->state_name, 'expert_description' => $request->expert_description, diff --git a/app/Http/Controllers/V3/Dashboard/Harim/ProvinceOfficeController.php b/app/Http/Controllers/V3/Dashboard/Harim/ProvinceOfficeController.php index 0739cd31..43dd7ef6 100644 --- a/app/Http/Controllers/V3/Dashboard/Harim/ProvinceOfficeController.php +++ b/app/Http/Controllers/V3/Dashboard/Harim/ProvinceOfficeController.php @@ -39,7 +39,7 @@ class ProvinceOfficeController extends Controller $action = HarimAction::FEEDBACK->value; $harim->histories()->create([ - 'user_id' => auth()->user()->id, + 'expert_id' => auth()->user()->id, 'previous_state_id' => $harim->state_id, 'previous_state_name' => $harim->state_name, 'expert_description' => $request->expert_description, diff --git a/app/Http/Controllers/V3/Dashboard/Harim/TechnicalDeputyController.php b/app/Http/Controllers/V3/Dashboard/Harim/TechnicalDeputyController.php index f5c3099a..c48ac1ff 100644 --- a/app/Http/Controllers/V3/Dashboard/Harim/TechnicalDeputyController.php +++ b/app/Http/Controllers/V3/Dashboard/Harim/TechnicalDeputyController.php @@ -39,7 +39,7 @@ class TechnicalDeputyController extends Controller $action = HarimAction::CONFIRM->value; $harim->histories()->create([ - 'user_id' => auth()->user()->id, + 'expert_id' => auth()->user()->id, 'previous_state_id' => $harim->state_id, 'previous_state_name' => $harim->state_name, 'expert_description' => $request->expert_description, diff --git a/database/migrations/2025_07_30_153216_create_harim_histories_table.php b/database/migrations/2025_07_30_153216_create_harim_histories_table.php index 74b7a907..8ac45608 100644 --- a/database/migrations/2025_07_30_153216_create_harim_histories_table.php +++ b/database/migrations/2025_07_30_153216_create_harim_histories_table.php @@ -15,14 +15,12 @@ return new class extends Migration $table->id(); $table->foreignId('previous_state_id')->constrained('harim_states'); $table->string('previous_state_name'); - $table->foreignId('current_state_id')->constrained('harim_states'); - $table->string('current_state_name'); + $table->foreignId('harim_id')->constrained('harims'); $table->foreignId('action_id')->constrained('harim_actions'); $table->string('action_name'); $table->unsignedInteger('expert_id'); $table->foreign('expert_id')->references('id')->on('users'); $table->string('expert_description'); - $table->json('previous_data'); $table->timestamps(); }); } From 8628ec7d144d89885a7ee8de7ca57402b0d56689 Mon Sep 17 00:00:00 2001 From: joddyabott Date: Mon, 4 Aug 2025 12:30:42 +0330 Subject: [PATCH 4/7] debug code for seecend time --- .../V3/Dashboard/Harim/GeneralManagerController.php | 5 ++--- .../V3/Dashboard/Harim/HarimOfficeController.php | 5 ++--- .../V3/Dashboard/Harim/TechnicalDeputyController.php | 7 +++---- routes/v3.php | 10 ++++++++++ 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php b/app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php index 28bd14c8..35fe4547 100644 --- a/app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php +++ b/app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php @@ -22,8 +22,7 @@ class GeneralManagerController extends Controller $user = auth()->user(); $query = Harim::query() ->where('state_id','=',HarimStates::Baresi_Imeni_Rah_Tavasot_Modir_Kol->value) - ->where('edareh_shahri_id', '=', $user->edarate_shahri_id) - ->with('histories:expert_description'); + ->where('edareh_shahri_id', '=', $user->edarate_shahri_id); $data = DataTableFacade::run( $query, @@ -77,7 +76,7 @@ class GeneralManagerController extends Controller } public function show(Harim $harim): JsonResponse { - return $this->successResponse($harim); + return $this->successResponse($harim->load('histories')); } } diff --git a/app/Http/Controllers/V3/Dashboard/Harim/HarimOfficeController.php b/app/Http/Controllers/V3/Dashboard/Harim/HarimOfficeController.php index 60f8cff9..9c06f67b 100644 --- a/app/Http/Controllers/V3/Dashboard/Harim/HarimOfficeController.php +++ b/app/Http/Controllers/V3/Dashboard/Harim/HarimOfficeController.php @@ -23,8 +23,7 @@ class HarimOfficeController extends Controller $user = auth()->user(); $query = Harim::query() ->where('state_id','=',HarimStates::Baresi_Imeni_Rah_Tavasot_Daftar_Harim->value) - ->where('edareh_shahri_id', '=', $user->edarate_shahri_id) - ->with('expert_description'); + ->where('edareh_shahri_id', '=', $user->edarate_shahri_id); $data = DataTableFacade::run( $query, $request, @@ -81,6 +80,6 @@ class HarimOfficeController extends Controller } public function show(Harim $harim): JsonResponse { - return $this->successResponse($harim); + return $this->successResponse($harim->load('histories')); } } diff --git a/app/Http/Controllers/V3/Dashboard/Harim/TechnicalDeputyController.php b/app/Http/Controllers/V3/Dashboard/Harim/TechnicalDeputyController.php index c48ac1ff..cbf7b4e4 100644 --- a/app/Http/Controllers/V3/Dashboard/Harim/TechnicalDeputyController.php +++ b/app/Http/Controllers/V3/Dashboard/Harim/TechnicalDeputyController.php @@ -22,8 +22,7 @@ class TechnicalDeputyController extends Controller $user = auth()->user(); $query = Harim::query() ->where('state_id', '=', HarimStates::Baresi_Imeni_Rah_Tavasot_Moaven->value) - ->where('edareh_shahri_id', '=', $user->edarate_shahri_id) - ->with('histories:expert_description'); + ->where('edareh_shahri_id', '=', $user->edarate_shahri_id); $data = DataTableFacade::run( $query, @@ -62,7 +61,7 @@ class TechnicalDeputyController extends Controller $action = HarimAction::REJECT->value; $harim->histories()->create([ - 'user_id' => auth()->user()->id, + 'expert_id' => auth()->user()->id, 'previous_state_id' => $harim->state_id, 'previous_state_name' => $harim->state_name, 'expert_description' => $request->expert_description, @@ -79,6 +78,6 @@ class TechnicalDeputyController extends Controller } public function show(Harim $harim): JsonResponse { - return $this->successResponse($harim); + return $this->successResponse($harim->load('histories')); } } diff --git a/routes/v3.php b/routes/v3.php index 7a2ae468..785be560 100644 --- a/routes/v3.php +++ b/routes/v3.php @@ -8,6 +8,7 @@ use App\Http\Controllers\V3\Dashboard\Accident\AccidentReceiptReportController; use App\Http\Controllers\V3\Dashboard\Azmayesh\AzmayeshController; use App\Http\Controllers\V3\Dashboard\Azmayesh\AzmayeshSampleController; use App\Http\Controllers\V3\Dashboard\Azmayesh\AzmayeshTypeController; +use App\Http\Controllers\V3\Dashboard\Harim\GeneralManagerController; use App\Http\Controllers\V3\Dashboard\Harim\HarimOfficeController; use App\Http\Controllers\V3\Dashboard\Harim\ProvinceOfficeController; use App\Http\Controllers\V3\Dashboard\Harim\TechnicalDeputyController; @@ -538,5 +539,14 @@ Route::prefix('harim') Route::post('/reject/{harim}', 'reject')->name('reject'); Route::get('/{harim}', 'show')->name('show'); }); + Route::prefix('general_manager') + ->name('general_manager.') + ->controller(GeneralManagerController::class) + ->group(function () { + Route::get('/', 'index')->name('index'); + Route::post('/conform/{harim}', 'conform')->name('conform'); + Route::post('/reject/{harim}', 'reject')->name('reject'); + Route::get('/{harim}', 'show')->name('show'); + }); }); From c89ae6e826f8136c1076deed42f1291738cc530a Mon Sep 17 00:00:00 2001 From: joddyabott Date: Mon, 4 Aug 2025 19:03:07 +0330 Subject: [PATCH 5/7] improve code --- app/Enums/HarimStates.php | 16 ++++++++-- .../Harim/GeneralManagerController.php | 3 +- .../Dashboard/Harim/HarimOfficeController.php | 4 ++- .../Harim/ProvinceOfficeController.php | 5 ---- .../Harim/TechnicalDeputyController.php | 7 +++-- .../V3/Dashboard/Harim/Deputy/ShowRequest.php | 30 +++++++++++++++++++ .../Harim/GeneralManager/RejectRequest.php | 3 +- .../Harim/GeneralManager/ShowRequest.php | 30 +++++++++++++++++++ .../Harim/HarimOffice/ShowRequest.php | 30 +++++++++++++++++++ .../2025_07_30_153041_create_harims_table.php | 3 +- routes/v3.php | 1 - 11 files changed, 118 insertions(+), 14 deletions(-) create mode 100644 app/Http/Requests/V3/Dashboard/Harim/Deputy/ShowRequest.php create mode 100644 app/Http/Requests/V3/Dashboard/Harim/GeneralManager/ShowRequest.php create mode 100644 app/Http/Requests/V3/Dashboard/Harim/HarimOffice/ShowRequest.php diff --git a/app/Enums/HarimStates.php b/app/Enums/HarimStates.php index 3e74b903..7e0a0a8d 100644 --- a/app/Enums/HarimStates.php +++ b/app/Enums/HarimStates.php @@ -8,7 +8,13 @@ enum HarimStates: int case Baresi_Imeni_Rah_Tavasot_Daftar_Harim = 2; case Baresi_Imeni_Rah_Tavasot_Moaven = 3; case Baresi_Imeni_Rah_Tavasot_Modir_Kol = 4; - case ERSAL_BE_PANJAREVAHED = 5; + case BARESI_FILE_APLODE_SHODE_TAVASOTE_Daftar_HARIM = 5; + case BARESI_FILE_APLODE_SHODE_TAVASOTE_MOAVEN = 6; + case BARESI_FILE_APLODE_SHODE_TAVASOTE_MODIR_KOL = 7; + case ERSAL_ZEMANAT_NAME_TAVASOTE_KARBAR =8; + case ERSAL_BE_PANJAREH_VAHED_NIAZ_BE_RAH_DASTRASI = 9; + case EMKAN_PAZIR_NEMEBASHAD = 10; + case ERSAL_BE_PANJAREH_VAHED_BEDONEH_NIAZ_BE_RAH_DASTRASI = 11; public static function name(int $state): string { @@ -17,7 +23,13 @@ enum HarimStates: int 2 => "بررسی ایمنی راه توسط ادارات حریم", 3 => "بررسی ایمنی راه توسط معاون ", 4 => "بررسی ایمنی راه توسط مدیر کل", - 5 => "ارسال به پنجره واحد", + 5 => "بررسی فایل آپلود شده توسط اداره حریم", + 6 => "بررسی فایل آپلود شده توسط معاون", + 7 => "بررسی فایل آپلود شده توسط مدیر", + 8 => "ارسال ضمانت نامه توسط کاربر", + 9 => "بارسال به پنجره واحد ( نیاز به راه دسترسی)", + 10 => "امکان پذیر نمی باشد", + 11 => "ارسال به پنجره واحد (بدون نیاز به راه دسترسی)", ]; return $mapArray[$state]; diff --git a/app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php b/app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php index 35fe4547..6645c841 100644 --- a/app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php +++ b/app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php @@ -8,6 +8,7 @@ use App\Facades\DataTable\DataTableFacade; use App\Http\Controllers\Controller; use App\Http\Requests\V3\Dashboard\Harim\GeneralManager\ConfirmRequest; use App\Http\Requests\V3\Dashboard\Harim\GeneralManager\RejectRequest; +use App\Http\Requests\V3\Dashboard\Harim\GeneralManager\ShowRequest; use App\Http\Traits\ApiResponse; use App\Models\Harim; use Illuminate\Http\JsonResponse; @@ -74,7 +75,7 @@ class GeneralManagerController extends Controller }); return $this->successResponse(); } - public function show(Harim $harim): JsonResponse + public function show(ShowRequest $request, Harim $harim): JsonResponse { return $this->successResponse($harim->load('histories')); diff --git a/app/Http/Controllers/V3/Dashboard/Harim/HarimOfficeController.php b/app/Http/Controllers/V3/Dashboard/Harim/HarimOfficeController.php index 9c06f67b..eaf9012f 100644 --- a/app/Http/Controllers/V3/Dashboard/Harim/HarimOfficeController.php +++ b/app/Http/Controllers/V3/Dashboard/Harim/HarimOfficeController.php @@ -6,6 +6,7 @@ use App\Enums\HarimAction; use App\Enums\HarimStates; use App\Facades\DataTable\DataTableFacade; use App\Http\Controllers\Controller; +use App\Http\Requests\V3\Dashboard\Harim\HarimOffice\ShowRequest; use App\Http\Requests\V3\Dashboard\Harim\HarimOffice\YesRequest; use App\Http\Requests\V3\Dashboard\Harim\HarimOffice\NoRequest; use App\Http\Traits\ApiResponse; @@ -78,8 +79,9 @@ class HarimOfficeController extends Controller }); return $this->successResponse(); } - public function show(Harim $harim): JsonResponse + public function show(ShowRequest $request, Harim $harim): JsonResponse { return $this->successResponse($harim->load('histories')); + } } diff --git a/app/Http/Controllers/V3/Dashboard/Harim/ProvinceOfficeController.php b/app/Http/Controllers/V3/Dashboard/Harim/ProvinceOfficeController.php index 43dd7ef6..5537e15f 100644 --- a/app/Http/Controllers/V3/Dashboard/Harim/ProvinceOfficeController.php +++ b/app/Http/Controllers/V3/Dashboard/Harim/ProvinceOfficeController.php @@ -56,9 +56,4 @@ class ProvinceOfficeController extends Controller }); return $this->successResponse(); } - - public function show(Harim $harim): JsonResponse - { - return $this->successResponse($harim); - } } diff --git a/app/Http/Controllers/V3/Dashboard/Harim/TechnicalDeputyController.php b/app/Http/Controllers/V3/Dashboard/Harim/TechnicalDeputyController.php index cbf7b4e4..a920d9fc 100644 --- a/app/Http/Controllers/V3/Dashboard/Harim/TechnicalDeputyController.php +++ b/app/Http/Controllers/V3/Dashboard/Harim/TechnicalDeputyController.php @@ -7,6 +7,7 @@ use App\Enums\HarimStates; use App\Facades\DataTable\DataTableFacade; use App\Http\Controllers\Controller; use App\Http\Requests\V3\Dashboard\Harim\Deputy\ConfirmRequest; +use App\Http\Requests\V3\Dashboard\Harim\Deputy\ShowRequest; use App\Http\Traits\ApiResponse; use App\Models\Harim; use Illuminate\Http\JsonResponse; @@ -22,7 +23,8 @@ class TechnicalDeputyController extends Controller $user = auth()->user(); $query = Harim::query() ->where('state_id', '=', HarimStates::Baresi_Imeni_Rah_Tavasot_Moaven->value) - ->where('edareh_shahri_id', '=', $user->edarate_shahri_id); + ->where('edare_shahri_id', '=', $user->edarate_shahri_id) + ->with('histories:expert_description'); $data = DataTableFacade::run( $query, @@ -76,8 +78,9 @@ class TechnicalDeputyController extends Controller }); return $this->successResponse(); } - public function show(Harim $harim): JsonResponse + public function show(ShowRequest $request, Harim $harim): JsonResponse { return $this->successResponse($harim->load('histories')); + } } diff --git a/app/Http/Requests/V3/Dashboard/Harim/Deputy/ShowRequest.php b/app/Http/Requests/V3/Dashboard/Harim/Deputy/ShowRequest.php new file mode 100644 index 00000000..e9301952 --- /dev/null +++ b/app/Http/Requests/V3/Dashboard/Harim/Deputy/ShowRequest.php @@ -0,0 +1,30 @@ +harim->edareh_shahri_id == auth()->user()->edarate_shahri_id && + $this->harim->state_id == HarimStates::Baresi_Imeni_Rah_Tavasot_Moaven->value; + } + + /** + * Get the validation rules that apply to the request. + * + * @return array|string> + */ + public function rules(): array + { + return [ + // + ]; + } +} diff --git a/app/Http/Requests/V3/Dashboard/Harim/GeneralManager/RejectRequest.php b/app/Http/Requests/V3/Dashboard/Harim/GeneralManager/RejectRequest.php index e81ecd88..b4281fea 100644 --- a/app/Http/Requests/V3/Dashboard/Harim/GeneralManager/RejectRequest.php +++ b/app/Http/Requests/V3/Dashboard/Harim/GeneralManager/RejectRequest.php @@ -13,7 +13,8 @@ class RejectRequest extends FormRequest public function authorize(): bool { return $this->harim->edareh_shahri_id == auth()->user()->edarate_shahri_id && - $this->harim->state_id == HarimStates::Baresi_Imeni_Rah_Tavasot_Modir_Kol->value; } + $this->harim->state_id == HarimStates::Baresi_Imeni_Rah_Tavasot_Modir_Kol->value; + } /** * Get the validation rules that apply to the request. diff --git a/app/Http/Requests/V3/Dashboard/Harim/GeneralManager/ShowRequest.php b/app/Http/Requests/V3/Dashboard/Harim/GeneralManager/ShowRequest.php new file mode 100644 index 00000000..186523b1 --- /dev/null +++ b/app/Http/Requests/V3/Dashboard/Harim/GeneralManager/ShowRequest.php @@ -0,0 +1,30 @@ +harim->edareh_shahri_id == auth()->user()->edarate_shahri_id && + $this->harim->state_id == HarimStates::Baresi_Imeni_Rah_Tavasot_Modir_Kol->value; + } + + /** + * Get the validation rules that apply to the request. + * + * @return array|string> + */ + public function rules(): array + { + return [ + // + ]; + } +} diff --git a/app/Http/Requests/V3/Dashboard/Harim/HarimOffice/ShowRequest.php b/app/Http/Requests/V3/Dashboard/Harim/HarimOffice/ShowRequest.php new file mode 100644 index 00000000..fe46f1a8 --- /dev/null +++ b/app/Http/Requests/V3/Dashboard/Harim/HarimOffice/ShowRequest.php @@ -0,0 +1,30 @@ +harim->edareh_shahri_id == auth()->user()->edarate_shahri_id && + $this->harim->state_id == HarimStates::Baresi_Imeni_Rah_Tavasot_Daftar_Harim->value; + } + + /** + * Get the validation rules that apply to the request. + * + * @return array|string> + */ + public function rules(): array + { + return [ + // + ]; + } +} diff --git a/database/migrations/2025_07_30_153041_create_harims_table.php b/database/migrations/2025_07_30_153041_create_harims_table.php index 231432fa..74ea3fa9 100644 --- a/database/migrations/2025_07_30_153041_create_harims_table.php +++ b/database/migrations/2025_07_30_153041_create_harims_table.php @@ -40,7 +40,8 @@ return new class extends Migration $table->string('file'); $table->json('polygon'); $table->boolean('need_road_access')->nullable(); - $table->integer('final_decision')->nullable(); + $table->boolean('is_file_good')->nullable(); + $table->boolean('is_possible')->nullable(); $table->string('final_description')->nullable(); $table->timestamps(); }); diff --git a/routes/v3.php b/routes/v3.php index 785be560..00fd6a2e 100644 --- a/routes/v3.php +++ b/routes/v3.php @@ -519,7 +519,6 @@ Route::prefix('harim') ->group(function () { Route::get('/', 'index')->name('index'); Route::post('/feedback/{harim}', 'feedback')->name('feedback'); - Route::get('/{harim}', 'show')->name('show'); }); Route::prefix('harim_office') ->name('harim_office.') From 1e5903db1af96f5400a4b94848e12164c873c4e7 Mon Sep 17 00:00:00 2001 From: joddyabott Date: Tue, 5 Aug 2025 09:25:18 +0330 Subject: [PATCH 6/7] update seeder and enum for harim state --- app/Enums/HarimStates.php | 21 +++++++++++++++------ database/seeders/HarimStateSeeder.php | 20 +++++++++++++++----- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/app/Enums/HarimStates.php b/app/Enums/HarimStates.php index 7e0a0a8d..cb181a44 100644 --- a/app/Enums/HarimStates.php +++ b/app/Enums/HarimStates.php @@ -4,17 +4,21 @@ namespace App\Enums; enum HarimStates: int { - case Baresi_Edare_Shahrestan = 1; - case Baresi_Imeni_Rah_Tavasot_Daftar_Harim = 2; - case Baresi_Imeni_Rah_Tavasot_Moaven = 3; - case Baresi_Imeni_Rah_Tavasot_Modir_Kol = 4; - case BARESI_FILE_APLODE_SHODE_TAVASOTE_Daftar_HARIM = 5; + case BARESI_EDARE_SHAHRESTAN = 1; + case BARESI_TAVASOT_DAFTAR_HARIM = 2; + case BARESI_TAVASOT_MOAVEN = 3; + case BARESI_TAVASOT_MODIR_KOL = 4; + case BARESI_FILE_APLODE_SHODE_TAVASOTE_DAFTAR_HARIM = 5; case BARESI_FILE_APLODE_SHODE_TAVASOTE_MOAVEN = 6; case BARESI_FILE_APLODE_SHODE_TAVASOTE_MODIR_KOL = 7; case ERSAL_ZEMANAT_NAME_TAVASOTE_KARBAR =8; case ERSAL_BE_PANJAREH_VAHED_NIAZ_BE_RAH_DASTRASI = 9; case EMKAN_PAZIR_NEMEBASHAD = 10; case ERSAL_BE_PANJAREH_VAHED_BEDONEH_NIAZ_BE_RAH_DASTRASI = 11; + case UPDATE_FILE_BARGOZARE_SHODE = 12; + case TAEDE_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_DAFTAR_KARBAR = 13; + case TAEDE_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_TAVASOTE_MOAVEN = 14; + case TAEDE_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_MODIR_KOL = 15; public static function name(int $state): string { @@ -27,9 +31,14 @@ enum HarimStates: int 6 => "بررسی فایل آپلود شده توسط معاون", 7 => "بررسی فایل آپلود شده توسط مدیر", 8 => "ارسال ضمانت نامه توسط کاربر", - 9 => "بارسال به پنجره واحد ( نیاز به راه دسترسی)", + 9 => "ارسال به پنجره واحد ( نیاز به راه دسترسی)", 10 => "امکان پذیر نمی باشد", 11 => "ارسال به پنجره واحد (بدون نیاز به راه دسترسی)", + 12 => "بازبینی فایل بارگذاری شده", + 13 => "تائید دریافت عرصه و عیان ارسال شده توسط اداره حریم", + 14 => "تائید دریافت عرصه و عیان ارسال شده توسط معاون", + 15 => "تائید دریافت عرصه و عیان ارسال شده توسط مدیر", + ]; return $mapArray[$state]; diff --git a/database/seeders/HarimStateSeeder.php b/database/seeders/HarimStateSeeder.php index ce564b4c..8f2c5016 100644 --- a/database/seeders/HarimStateSeeder.php +++ b/database/seeders/HarimStateSeeder.php @@ -14,11 +14,21 @@ class HarimStateSeeder extends Seeder public function run(): void { DB::table('harim_states')->insert([ - ['id' => 1, 'name' => 'در انتظار بررسی اداره شهرستان', 'created_at' => now(), 'updated_at' => now(),], - ['id' => 2, 'name' => 'در انتظار بررسی ایمنی راه توسط دفتر حریم', 'created_at' => now(), 'updated_at' => now(),], - ['id' => 3, 'name' => 'در انتظار بررسی ایمنی راه توسط معاون', 'created_at' => now(), 'updated_at' => now(),], - ['id' => 4, 'name' => 'در انتظار بررسی ایمنی راه توسط مدیر کل', 'created_at' => now(), 'updated_at' => now(),], - ['id' => 5, 'name' => 'ارسال به پنجره واحد', 'created_at' => now(), 'updated_at' => now(),], + ['id' => 1, 'name' => 'بررسی ادارات شهرستان', 'created_at' => now(), 'updated_at' => now(),], + ['id' => 2, 'name' => 'بررسی ایمنی راه توسط ادارات حریم', 'created_at' => now(), 'updated_at' => now(),], + ['id' => 3, 'name' => 'بررسی ایمنی راه توسط معاون', 'created_at' => now(), 'updated_at' => now(),], + ['id' => 4, 'name' => 'بررسی ایمنی راه توسط مدیر کل', 'created_at' => now(), 'updated_at' => now(),], + ['id' => 5, 'name' => 'بررسی فایل آپلود شده توسط اداره حریم', 'created_at' => now(), 'updated_at' => now(),], + ['id' => 6, 'name' => 'بررسی فایل آپلود شده توسط معاون', 'created_at' => now(), 'updated_at' => now(),], + ['id' => 7, 'name' => 'بررسی فایل آپلود شده توسط مدیر', 'created_at' => now(), 'updated_at' => now(),], + ['id' => 8, 'name' => 'ارسال ضمانت نامه توسط کاربر', 'created_at' => now(), 'updated_at' => now(),], + ['id' => 9, 'name' => 'ارسال به پنجره واحد ( نیاز به راه دسترسی)', 'created_at' => now(), 'updated_at' => now(),], + ['id' => 10, 'name' => 'امکان پذیر نمی باشد', 'created_at' => now(), 'updated_at' => now(),], + ['id' => 11, 'name' => 'ارسال به پنجره واحد (بدون نیاز به راه دسترسی)', 'created_at' => now(), 'updated_at' => now(),], + ['id' => 12, 'name' => 'بازبینی فایل بارگذاری شده', 'created_at' => now(), 'updated_at' => now(),], + ['id' => 13, 'name' => 'تائید دریافت عرصه و عیان ارسال شده توسط اداره حریم', 'created_at' => now(), 'updated_at' => now(),], + ['id' => 14, 'name' => 'تائید دریافت عرصه و عیان ارسال شده توسط معاون', 'created_at' => now(), 'updated_at' => now(),], + ['id' => 15, 'name' => 'تائید دریافت عرصه و عیان ارسال شده توسط مدیر', 'created_at' => now(), 'updated_at' => now(),], ]); } } From 26ecc03e6c19806f03751192641cbdef9b2ecc92 Mon Sep 17 00:00:00 2001 From: joddyabott Date: Tue, 5 Aug 2025 09:53:41 +0330 Subject: [PATCH 7/7] debug --- app/Enums/HarimStates.php | 12 ++++++------ database/seeders/HarimStateSeeder.php | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/Enums/HarimStates.php b/app/Enums/HarimStates.php index cb181a44..aaea9851 100644 --- a/app/Enums/HarimStates.php +++ b/app/Enums/HarimStates.php @@ -24,9 +24,9 @@ enum HarimStates: int { $mapArray = [ 1 => "بررسی ادارات شهرستان", - 2 => "بررسی ایمنی راه توسط ادارات حریم", - 3 => "بررسی ایمنی راه توسط معاون ", - 4 => "بررسی ایمنی راه توسط مدیر کل", + 2 => "بررسی راه توسط ادارات حریم", + 3 => "بررسی راه توسط معاون ", + 4 => "بررسی راه توسط مدیر کل", 5 => "بررسی فایل آپلود شده توسط اداره حریم", 6 => "بررسی فایل آپلود شده توسط معاون", 7 => "بررسی فایل آپلود شده توسط مدیر", @@ -35,9 +35,9 @@ enum HarimStates: int 10 => "امکان پذیر نمی باشد", 11 => "ارسال به پنجره واحد (بدون نیاز به راه دسترسی)", 12 => "بازبینی فایل بارگذاری شده", - 13 => "تائید دریافت عرصه و عیان ارسال شده توسط اداره حریم", - 14 => "تائید دریافت عرصه و عیان ارسال شده توسط معاون", - 15 => "تائید دریافت عرصه و عیان ارسال شده توسط مدیر", + 13 => "تائید عرصه و اعیان ارسال شده توسط اداره حریم", + 14 => "تائید عرصه و اعیان ارسال شده توسط معاون", + 15 => "تائید عرصه و اعیان ارسال شده توسط مدیر", ]; diff --git a/database/seeders/HarimStateSeeder.php b/database/seeders/HarimStateSeeder.php index 8f2c5016..20083f60 100644 --- a/database/seeders/HarimStateSeeder.php +++ b/database/seeders/HarimStateSeeder.php @@ -15,20 +15,20 @@ class HarimStateSeeder extends Seeder { DB::table('harim_states')->insert([ ['id' => 1, 'name' => 'بررسی ادارات شهرستان', 'created_at' => now(), 'updated_at' => now(),], - ['id' => 2, 'name' => 'بررسی ایمنی راه توسط ادارات حریم', 'created_at' => now(), 'updated_at' => now(),], - ['id' => 3, 'name' => 'بررسی ایمنی راه توسط معاون', 'created_at' => now(), 'updated_at' => now(),], - ['id' => 4, 'name' => 'بررسی ایمنی راه توسط مدیر کل', 'created_at' => now(), 'updated_at' => now(),], + ['id' => 2, 'name' => 'بررسی توسط ادارات حریم', 'created_at' => now(), 'updated_at' => now(),], + ['id' => 3, 'name' => 'بررسی توسط معاون', 'created_at' => now(), 'updated_at' => now(),], + ['id' => 4, 'name' => 'بررسی توسط مدیر کل', 'created_at' => now(), 'updated_at' => now(),], ['id' => 5, 'name' => 'بررسی فایل آپلود شده توسط اداره حریم', 'created_at' => now(), 'updated_at' => now(),], ['id' => 6, 'name' => 'بررسی فایل آپلود شده توسط معاون', 'created_at' => now(), 'updated_at' => now(),], ['id' => 7, 'name' => 'بررسی فایل آپلود شده توسط مدیر', 'created_at' => now(), 'updated_at' => now(),], ['id' => 8, 'name' => 'ارسال ضمانت نامه توسط کاربر', 'created_at' => now(), 'updated_at' => now(),], - ['id' => 9, 'name' => 'ارسال به پنجره واحد ( نیاز به راه دسترسی)', 'created_at' => now(), 'updated_at' => now(),], + ['id' => 9, 'name' => 'ارسال به پنجره واحد ( نیاز به راه دسترسی)', 'created_at' => now(), 'updated_at' => now(),], ['id' => 10, 'name' => 'امکان پذیر نمی باشد', 'created_at' => now(), 'updated_at' => now(),], ['id' => 11, 'name' => 'ارسال به پنجره واحد (بدون نیاز به راه دسترسی)', 'created_at' => now(), 'updated_at' => now(),], ['id' => 12, 'name' => 'بازبینی فایل بارگذاری شده', 'created_at' => now(), 'updated_at' => now(),], - ['id' => 13, 'name' => 'تائید دریافت عرصه و عیان ارسال شده توسط اداره حریم', 'created_at' => now(), 'updated_at' => now(),], - ['id' => 14, 'name' => 'تائید دریافت عرصه و عیان ارسال شده توسط معاون', 'created_at' => now(), 'updated_at' => now(),], - ['id' => 15, 'name' => 'تائید دریافت عرصه و عیان ارسال شده توسط مدیر', 'created_at' => now(), 'updated_at' => now(),], + ['id' => 13, 'name' => 'تائید عرصه و اعیان ارسال شده توسط اداره حریم', 'created_at' => now(), 'updated_at' => now(),], + ['id' => 14, 'name' => 'تائید عرصه و اعیان ارسال شده توسط معاون', 'created_at' => now(), 'updated_at' => now(),], + ['id' => 15, 'name' => 'تائید عرصه و اعیان ارسال شده توسط مدیر', 'created_at' => now(), 'updated_at' => now(),], ]); } }