From 6a8d27b2c34f7e01a2539232db49900b67b727b2 Mon Sep 17 00:00:00 2001 From: amirghasempoor Date: Wed, 26 Nov 2025 09:46:17 +0330 Subject: [PATCH] debug --- .env.example | 2 +- .../V3/Dashboard/Harim/DetailController.php | 16 +++++++++-- .../Harim/GeneralManagerController.php | 28 +++++++++++++++++++ .../Dashboard/Harim/HarimOfficeController.php | 24 +++++++++++++++- .../Harim/ProvinceOfficeController.php | 5 +++- .../Harim/TechnicalDeputyController.php | 21 +++++++++++++- .../HarimOffice/ComputingPaymentRequest.php | 8 +++--- .../ConfirmGuaranteeLetterNeedListener.php | 2 +- config/harim_web_services.php | 2 +- ...155435_create_mission_violations_table.php | 1 - ...3_add_final_plan_space_to_harims_table.php | 2 -- ...3636_add_column_to_cmms_machines_table.php | 9 ++++-- 12 files changed, 102 insertions(+), 18 deletions(-) diff --git a/.env.example b/.env.example index 994bd3e2..4e0ec85b 100644 --- a/.env.example +++ b/.env.example @@ -103,4 +103,4 @@ CHECKE_LIST_MACHINES_ACTIVITY_URL='fms.141.ir:7030/api/RMS/GetMovingVehicles', CHECKE_LIST_MACHINES_ACTIVITY_PASSWORD= CHECKE_LIST_MACHINES_ACTIVITY_USERNAME= -HARIM_AMOUNT_PER=1 \ No newline at end of file +HARIM_AMOUNT_FEE=1 \ No newline at end of file diff --git a/app/Http/Controllers/V3/Dashboard/Harim/DetailController.php b/app/Http/Controllers/V3/Dashboard/Harim/DetailController.php index 6d0b0fb0..17c0aad1 100644 --- a/app/Http/Controllers/V3/Dashboard/Harim/DetailController.php +++ b/app/Http/Controllers/V3/Dashboard/Harim/DetailController.php @@ -2,18 +2,30 @@ namespace App\Http\Controllers\V3\Dashboard\Harim; +use App\Exceptions\ProhibitedAction; use App\Http\Controllers\Controller; use App\Http\Traits\ApiResponse; +use App\Models\Harim; use App\Models\HarimState; use Illuminate\Http\JsonResponse; -use Illuminate\Http\Request; +use Throwable; class DetailController extends Controller { use ApiResponse; - public function states(Request $request): JsonResponse + public function states(): JsonResponse { return $this->successResponse(HarimState::query()->get(['id', 'name'])); } + + /** + * @throws Throwable + */ + public function histories(Harim $harim): JsonResponse + { + throw_if($this->harim->edareh_shahri_id == auth()->user()->edarate_shahri_id, new ProhibitedAction("unauthorized")); + + return $this->successResponse($harim->histories()->get(['id', 'expert_description', 'action_name', 'previous_state_name'])); + } } diff --git a/app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php b/app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php index e0c45aba..14a5a8ac 100644 --- a/app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php +++ b/app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php @@ -26,6 +26,7 @@ use App\Http\Traits\ApiResponse; use App\Models\Harim; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; +use Throwable; class GeneralManagerController extends Controller { @@ -46,6 +47,9 @@ class GeneralManagerController extends Controller return response()->json($data); } + /** + * @throws Throwable + */ public function rejectRequest(RejectRequest $request, Harim $harim): JsonResponse { $harim->updateStateWithHistory( @@ -62,6 +66,9 @@ class GeneralManagerController extends Controller return $this->successResponse(); } + /** + * @throws Throwable + */ public function referRequest(ReferRequest $request, Harim $harim): JsonResponse { $harim->updateStateWithHistory( @@ -76,6 +83,9 @@ class GeneralManagerController extends Controller return $this->successResponse(); } + /** + * @throws Throwable + */ public function referFile(ReferFileRequest $request, Harim $harim): JsonResponse { $harim->updateStateWithHistory( @@ -90,6 +100,9 @@ class GeneralManagerController extends Controller return $this->successResponse(); } + /** + * @throws Throwable + */ public function confirmRoadAccessNeed(ConfirmRoadAccessNeedRequest $request, Harim $harim): JsonResponse { $harim->updateStateWithHistory( @@ -106,6 +119,9 @@ class GeneralManagerController extends Controller return $this->successResponse(); } + /** + * @throws Throwable + */ public function confirmNoRoadAccessNeed(ConfirmNoRoadAccessNeedRequest $request, Harim $harim): JsonResponse { $harim->updateStateWithHistory( @@ -122,6 +138,9 @@ class GeneralManagerController extends Controller return $this->successResponse(); } + /** + * @throws Throwable + */ public function confirmRoadAccessEditNeed(ConfirmRoadAccessEditNeedRequest $request, Harim $harim): JsonResponse { $harim->updateStateWithHistory( @@ -138,6 +157,9 @@ class GeneralManagerController extends Controller return $this->successResponse(); } + /** + * @throws Throwable + */ public function confirmGuaranteeLetterNeed(ConfirmGuaranteeLetterNeedRequest $request, Harim $harim): JsonResponse { $harim->updateStateWithHistory( @@ -159,6 +181,9 @@ class GeneralManagerController extends Controller return $this->successResponse($harim->load('histories')); } + /** + * @throws Throwable + */ public function referPayment(ReferPaymentRequest $request, Harim $harim): JsonResponse { $harim->updateStateWithHistory( @@ -173,6 +198,9 @@ class GeneralManagerController extends Controller return $this->successResponse(); } + /** + * @throws Throwable + */ public function confirmPayment(ConfirmPaymentRequest $request, Harim $harim): JsonResponse { $harim->updateStateWithHistory( diff --git a/app/Http/Controllers/V3/Dashboard/Harim/HarimOfficeController.php b/app/Http/Controllers/V3/Dashboard/Harim/HarimOfficeController.php index db93216a..d16d128f 100644 --- a/app/Http/Controllers/V3/Dashboard/Harim/HarimOfficeController.php +++ b/app/Http/Controllers/V3/Dashboard/Harim/HarimOfficeController.php @@ -19,6 +19,7 @@ use App\Models\Harim; use App\Models\Province; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; +use Throwable; class HarimOfficeController extends Controller { @@ -39,6 +40,9 @@ class HarimOfficeController extends Controller return response()->json($data); } + /** + * @throws Throwable + */ public function rejectRequest(RejectRequest $request, Harim $harim): JsonResponse { $harim->updateStateWithHistory( @@ -54,6 +58,9 @@ class HarimOfficeController extends Controller return $this->successResponse(); } + /** + * @throws Throwable + */ public function referRequest(ReferRequest $request, Harim $harim): JsonResponse { $harim->updateStateWithHistory( @@ -68,6 +75,9 @@ class HarimOfficeController extends Controller return $this->successResponse(); } + /** + * @throws Throwable + */ public function needRoadAccess(NeedRoadAccessRequest $request, Harim $harim): JsonResponse { $harim->updateStateWithHistory( @@ -85,6 +95,9 @@ class HarimOfficeController extends Controller return $this->successResponse(); } + /** + * @throws Throwable + */ public function withoutRoadAccess(WithoutRoadAccessRequest $request, Harim $harim): JsonResponse { $harim->updateStateWithHistory( @@ -102,6 +115,9 @@ class HarimOfficeController extends Controller return $this->successResponse(); } + /** + * @throws Throwable + */ public function fileAccepted(FileAcceptedRequest $request, Harim $harim): JsonResponse { $harim->updateStateWithHistory( @@ -117,6 +133,9 @@ class HarimOfficeController extends Controller return $this->successResponse(); } + /** + * @throws Throwable + */ public function fileRejected(FileRejectedRequest $request, Harim $harim): JsonResponse { $harim->updateStateWithHistory( @@ -134,7 +153,7 @@ class HarimOfficeController extends Controller public function show(ShowRequest $request, Harim $harim): JsonResponse { - return $this->successResponse($harim->load('histories')); + return $this->successResponse($harim); } public function referToCity(Request $request, Harim $harim) @@ -148,6 +167,9 @@ class HarimOfficeController extends Controller ]); } + /** + * @throws Throwable + */ public function computingPayment(ComputingPaymentRequest $request, Harim $harim): JsonResponse { $harim->updateStateWithHistory( diff --git a/app/Http/Controllers/V3/Dashboard/Harim/ProvinceOfficeController.php b/app/Http/Controllers/V3/Dashboard/Harim/ProvinceOfficeController.php index 9e38f1af..fba863cb 100644 --- a/app/Http/Controllers/V3/Dashboard/Harim/ProvinceOfficeController.php +++ b/app/Http/Controllers/V3/Dashboard/Harim/ProvinceOfficeController.php @@ -12,6 +12,7 @@ use App\Http\Traits\ApiResponse; use App\Models\Harim; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; +use Throwable; class ProvinceOfficeController extends Controller { @@ -31,9 +32,11 @@ class ProvinceOfficeController extends Controller ); return response()->json($data); - } + /** + * @throws Throwable + */ public function feedback(FeedBackRequest $request, Harim $harim): JsonResponse { $harim->updateStateWithHistory( diff --git a/app/Http/Controllers/V3/Dashboard/Harim/TechnicalDeputyController.php b/app/Http/Controllers/V3/Dashboard/Harim/TechnicalDeputyController.php index 4323f36c..9e29b326 100644 --- a/app/Http/Controllers/V3/Dashboard/Harim/TechnicalDeputyController.php +++ b/app/Http/Controllers/V3/Dashboard/Harim/TechnicalDeputyController.php @@ -17,6 +17,7 @@ use App\Http\Traits\ApiResponse; use App\Models\Harim; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; +use Throwable; class TechnicalDeputyController extends Controller { @@ -37,6 +38,9 @@ class TechnicalDeputyController extends Controller return response()->json($data); } + /** + * @throws Throwable + */ public function confirmRequest(ConfirmRequest $request, Harim $harim): JsonResponse { $harim->updateStateWithHistory( @@ -51,6 +55,9 @@ class TechnicalDeputyController extends Controller return $this->successResponse(); } + /** + * @throws Throwable + */ public function referRequest(ReferRequest $request, Harim $harim): JsonResponse { $harim->updateStateWithHistory( @@ -65,6 +72,9 @@ class TechnicalDeputyController extends Controller return $this->successResponse(); } + /** + * @throws Throwable + */ public function confirmRoadAccess(ConfirmRoadAccessRequest $request, Harim $harim): JsonResponse { $harim->updateStateWithHistory( @@ -79,6 +89,9 @@ class TechnicalDeputyController extends Controller return $this->successResponse(); } + /** + * @throws Throwable + */ public function referRoadAccess(ReferRoadAccessRequest $request, Harim $harim): JsonResponse { $harim->updateStateWithHistory( @@ -95,9 +108,12 @@ class TechnicalDeputyController extends Controller public function show(ShowRequest $request, Harim $harim): JsonResponse { - return $this->successResponse($harim->load('histories')); + return $this->successResponse($harim); } + /** + * @throws Throwable + */ public function referPayment(ReferPaymentRequest $request, Harim $harim): JsonResponse { $harim->updateStateWithHistory( @@ -112,6 +128,9 @@ class TechnicalDeputyController extends Controller return $this->successResponse(); } + /** + * @throws Throwable + */ public function confirmPayment(ConfirmPaymentRequest $request, Harim $harim): JsonResponse { $harim->updateStateWithHistory( diff --git a/app/Http/Requests/V3/Dashboard/Harim/HarimOffice/ComputingPaymentRequest.php b/app/Http/Requests/V3/Dashboard/Harim/HarimOffice/ComputingPaymentRequest.php index 63116bce..4c4670a5 100644 --- a/app/Http/Requests/V3/Dashboard/Harim/HarimOffice/ComputingPaymentRequest.php +++ b/app/Http/Requests/V3/Dashboard/Harim/HarimOffice/ComputingPaymentRequest.php @@ -40,24 +40,24 @@ class ComputingPaymentRequest extends FormRequest { return [ function () { - $fe = config('harim_web_services.Harim_Payment.per'); + $fee = config('harim_web_services.Harim_Payment.fee'); $arse = ( $this->traffic * $this->road_type * $this->position * - $fe* + $fee * $this->final_area_space ); $ayan =( $this->traffic * $this->road_type * $this->position * - $fe* + $fee * $this->final_plan_space ); $result = floor($arse + $ayan); - if ($result !== $this->payment_amount) { + if ($result != $this->payment_amount) { $this->validator->errors()->add( 'payment_amount', 'payment_amount مقادیر بدست امده صحیح نمی باشد.' diff --git a/app/Listeners/V3/Dashboard/Harim/ConfirmGuaranteeLetterNeedListener.php b/app/Listeners/V3/Dashboard/Harim/ConfirmGuaranteeLetterNeedListener.php index bcee0cf0..b121fb0f 100644 --- a/app/Listeners/V3/Dashboard/Harim/ConfirmGuaranteeLetterNeedListener.php +++ b/app/Listeners/V3/Dashboard/Harim/ConfirmGuaranteeLetterNeedListener.php @@ -35,7 +35,7 @@ class ConfirmGuaranteeLetterNeedListener implements ShouldQueue 'taskId' => $arrayData['taskId'], 'code' => $event->harim->id, 'resultStatus' => 1, - 'Description' => $event->harim->last_description, + 'Description' => $event->harim->latestDescription(), ], 'token' => $arrayData['token'], diff --git a/config/harim_web_services.php b/config/harim_web_services.php index 1b1e6f65..dc3f4686 100644 --- a/config/harim_web_services.php +++ b/config/harim_web_services.php @@ -37,6 +37,6 @@ return [ ], 'Harim_Payment' => [ - 'per' => env('HARIM_AMOUNT_PER'), + 'fee' => env('HARIM_AMOUNT_FEE'), ] ]; diff --git a/database/migrations/2025_11_12_155435_create_mission_violations_table.php b/database/migrations/2025_11_12_155435_create_mission_violations_table.php index c741572f..f54d33d0 100644 --- a/database/migrations/2025_11_12_155435_create_mission_violations_table.php +++ b/database/migrations/2025_11_12_155435_create_mission_violations_table.php @@ -21,7 +21,6 @@ return new class extends Migration $table->dateTime('exit_time')->nullable(); $table->dateTime('enter_time')->nullable(); $table->timestamps(); - $table->timestamps(); }); } diff --git a/database/migrations/2025_11_17_142433_add_final_plan_space_to_harims_table.php b/database/migrations/2025_11_17_142433_add_final_plan_space_to_harims_table.php index 348d4924..6692b847 100644 --- a/database/migrations/2025_11_17_142433_add_final_plan_space_to_harims_table.php +++ b/database/migrations/2025_11_17_142433_add_final_plan_space_to_harims_table.php @@ -13,8 +13,6 @@ return new class extends Migration { Schema::table('harims', function (Blueprint $table) { $table->decimal('final_plan_space')->nullable(); - - }); } diff --git a/database/migrations/2025_11_18_153636_add_column_to_cmms_machines_table.php b/database/migrations/2025_11_18_153636_add_column_to_cmms_machines_table.php index 970d867e..c6e84ec6 100644 --- a/database/migrations/2025_11_18_153636_add_column_to_cmms_machines_table.php +++ b/database/migrations/2025_11_18_153636_add_column_to_cmms_machines_table.php @@ -12,9 +12,12 @@ return new class extends Migration public function up(): void { Schema::table('cmms_machines', function (Blueprint $table) { - $table->foreignId('province_id')->nullable()->constrained('provinces'); - $table->foreignId('city_id')->nullable()->constrained('cities'); - $table->foreignId('station_id')->nullable()->constrained('rahdari_points'); + $table->unsignedTinyInteger('province_id')->nullable(); + $table->foreign('province_id')->references('id')->on('provinces'); + $table->unsignedSmallInteger('city_id')->nullable(); + $table->foreign('city_id')->references('id')->on('cities'); + $table->unsignedSmallInteger('station_id')->nullable(); + $table->foreign('station_id')->references('id')->on('rahdari_points'); }); }