Merge pull request #97 from witelgroup/feature/HarimManager

debug
This commit is contained in:
Amir Ghasempoor
2025-11-26 09:47:26 +03:30
committed by GitHub
12 changed files with 102 additions and 18 deletions

View File

@@ -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
HARIM_AMOUNT_FEE=1

View File

@@ -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']));
}
}

View File

@@ -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(

View File

@@ -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(

View File

@@ -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(

View File

@@ -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(

View File

@@ -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 مقادیر بدست امده صحیح نمی باشد.'

View File

@@ -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'],

View File

@@ -37,6 +37,6 @@ return [
],
'Harim_Payment' => [
'per' => env('HARIM_AMOUNT_PER'),
'fee' => env('HARIM_AMOUNT_FEE'),
]
];

View File

@@ -21,7 +21,6 @@ return new class extends Migration
$table->dateTime('exit_time')->nullable();
$table->dateTime('enter_time')->nullable();
$table->timestamps();
$table->timestamps();
});
}

View File

@@ -13,8 +13,6 @@ return new class extends Migration
{
Schema::table('harims', function (Blueprint $table) {
$table->decimal('final_plan_space')->nullable();
});
}

View File

@@ -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');
});
}