Merge pull request #90 from witelgroup/feature/CheckPaymentHarim
appand new position for 3 position in harim and need dependency
This commit is contained in:
@@ -8,40 +8,40 @@ enum HarimStates: int
|
||||
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 BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_DAFTAR_HARIM = 5;
|
||||
case BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MOAVEN = 6;
|
||||
case BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MODIR_KOL = 7;
|
||||
case ARSE_VA_AYAN_NAHAI =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_HARIM = 13;
|
||||
case TAEDE_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_TAVASOTE_MOAVEN = 14;
|
||||
case TAEDE_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_MODIR_KOL = 15;
|
||||
case UPDATE_RAHE_DASTRASI_BARGOZARE_SHODE = 12;
|
||||
case BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_DAFTAR_HARIM = 13;
|
||||
case BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_MOAVEN = 14;
|
||||
case BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_MODIR_KOL = 15;
|
||||
case MOKHALEFAT_BA_DASTGAH = 16;
|
||||
case ETMAM_FARAYAND = 17;
|
||||
|
||||
public static function name(int $state): string
|
||||
public function label(): string
|
||||
{
|
||||
$mapArray = [
|
||||
1 => "بررسی ادارات شهرستان",
|
||||
2 => "بررسی توسط ادارات حریم",
|
||||
3 => "بررسی توسط معاون ",
|
||||
4 => "بررسی توسط مدیر کل",
|
||||
5 => "بررسی فایل آپلود شده توسط اداره حریم",
|
||||
6 => "بررسی فایل آپلود شده توسط معاون",
|
||||
7 => "بررسی فایل آپلود شده توسط مدیر",
|
||||
8 => "ارسال ضمانت نامه توسط کاربر",
|
||||
9 => "ارسال به پنجره واحد (نیاز به راه دسترسی)",
|
||||
10 => "امکان پذیر نمی باشد",
|
||||
11 => "ارسال به پنجره واحد (بدون نیاز به راه دسترسی)",
|
||||
12 => "بازبینی فایل بارگذاری شده",
|
||||
13 => "تائید عرصه و اعیان ارسال شده توسط اداره حریم",
|
||||
14 => "تائید عرصه و اعیان ارسال شده توسط معاون",
|
||||
15 => "تائید عرصه و اعیان ارسال شده توسط مدیر",
|
||||
16 => "مخالفت با درخواست"
|
||||
];
|
||||
|
||||
return $mapArray[$state];
|
||||
return match ($this) {
|
||||
self::BARESI_EDARE_SHAHRESTAN => "بررسی ادارات شهرستان",
|
||||
self::BARESI_TAVASOT_DAFTAR_HARIM => "بررسی توسط ادارات حریم",
|
||||
self::BARESI_TAVASOT_MOAVEN => "بررسی توسط معاون ",
|
||||
self::BARESI_TAVASOT_MODIR_KOL => "بررسی توسط مدیر کل",
|
||||
self::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_DAFTAR_HARIM => "بررسی راه دسترسی آپلود شده توسط اداره حریم",
|
||||
self::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MOAVEN => "بررسی راه دسترسی آپلود شده توسط معاون",
|
||||
self::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MODIR_KOL => "بررسی راه دسترسی آپلود شده توسط مدیر",
|
||||
self::ARSE_VA_AYAN_NAHAI => "ارسال ضمانت نامه توسط کاربر",
|
||||
self::ERSAL_BE_PANJAREH_VAHED_NIAZ_BE_RAH_DASTRASI => "ارسال به پنجره واحد (نیاز به راه دسترسی)",
|
||||
self::EMKAN_PAZIR_NEMEBASHAD => "امکان پذیر نمی باشد",
|
||||
self::ERSAL_BE_PANJAREH_VAHED_BEDONEH_NIAZ_BE_RAH_DASTRASI => "ارسال به پنجره واحد (بدون نیاز به راه دسترسی)",
|
||||
self::UPDATE_RAHE_DASTRASI_BARGOZARE_SHODE => "بازبینی راه دسترسی بارگذاری شده",
|
||||
self::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_DAFTAR_HARIM => "تائید عرصه و اعیان ارسال شده توسط اداره حریم",
|
||||
self::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_MOAVEN => "تائید عرصه و اعیان ارسال شده توسط معاون",
|
||||
self::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_MODIR_KOL => "تائید عرصه و اعیان ارسال شده توسط مدیر",
|
||||
self::MOKHALEFAT_BA_DASTGAH => "مخالفت با درخواست",
|
||||
self::ETMAM_FARAYAND => "اتمام فرایند",
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
enum HarimTerafic : string
|
||||
enum HarimTraffic : string
|
||||
{
|
||||
case SABOK = 'سبک';
|
||||
case MOTEVASET = 'متوسط';
|
||||
@@ -7,15 +7,16 @@ use App\Enums\HarimStates;
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmGuaranteeLetterNeedEvent;
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmNoRoadAccessNeedEvent;
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmRoadAccessEditNeedEvent;
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmRoadAccessNeedEvent;
|
||||
use App\Events\V3\Dashboard\Harim\RejectRequestEvent;
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\GeneralManager\ConfirmGuaranteeLetterNeedRequest;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\GeneralManager\ConfirmNoRoadAccessNeedRequest;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\GeneralManager\ConfirmPaymentRequest;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\GeneralManager\ConfirmRoadAccessEditNeedRequest;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\GeneralManager\ConfirmRoadAccessNeedRequest;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\GeneralManager\ReferFileRequest;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\GeneralManager\ReferPaymentRequest;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\GeneralManager\ReferRequest;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\GeneralManager\RejectRequest;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\GeneralManager\ShowRequest;
|
||||
@@ -23,7 +24,6 @@ use App\Http\Traits\ApiResponse;
|
||||
use App\Models\Harim;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class GeneralManagerController extends Controller
|
||||
{
|
||||
@@ -46,186 +46,102 @@ class GeneralManagerController extends Controller
|
||||
|
||||
public function rejectRequest(RejectRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
$action = HarimAction::CONFIRM->value;
|
||||
|
||||
$harim->histories()->create([
|
||||
'expert_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::EMKAN_PAZIR_NEMEBASHAD->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
]);
|
||||
|
||||
RejectRequestEvent::dispatch($harim);
|
||||
});
|
||||
$harim->updateStateWithHistory(
|
||||
action: HarimAction::CONFIRM->value,
|
||||
description: $request->expert_description,
|
||||
data: [
|
||||
'state_id' => HarimStates::EMKAN_PAZIR_NEMEBASHAD->value,
|
||||
'state_name' => HarimStates::EMKAN_PAZIR_NEMEBASHAD->label(),
|
||||
]
|
||||
);
|
||||
RejectRequestEvent::dispatch($harim);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function referRequest(ReferRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
$action = HarimAction::REFER->value;
|
||||
|
||||
$harim->histories()->create([
|
||||
'expert_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_TAVASOT_MOAVEN->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
]);
|
||||
});
|
||||
$harim->updateStateWithHistory(
|
||||
action: HarimAction::REFER->value,
|
||||
description: $request->expert_description,
|
||||
data: [
|
||||
'state_id' => HarimStates::BARESI_TAVASOT_MOAVEN->value,
|
||||
'state_name' => HarimStates::BARESI_TAVASOT_MOAVEN->label(),
|
||||
]
|
||||
);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function referFile(ReferFileRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
$action = HarimAction::REFER->value;
|
||||
|
||||
$harim->histories()->create([
|
||||
'expert_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_FILE_APLODE_SHODE_TAVASOTE_MOAVEN->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
]);
|
||||
});
|
||||
$harim->updateStateWithHistory(
|
||||
action: HarimAction::REFER->value,
|
||||
description: $request->expert_description,
|
||||
data: [
|
||||
'state_id' => HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MOAVEN->value,
|
||||
'state_name' => HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MOAVEN->label(),
|
||||
]
|
||||
);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function confirmRoadAccessNeed(ConfirmRoadAccessNeedRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
$action = HarimAction::CONFIRM->value;
|
||||
|
||||
$harim->histories()->create([
|
||||
'expert_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_PANJAREH_VAHED_NIAZ_BE_RAH_DASTRASI->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
]);
|
||||
|
||||
ConfirmRoadAccessNeedEvent::dispatch($harim);
|
||||
});
|
||||
$harim->updateStateWithHistory(
|
||||
action: HarimAction::CONFIRM->value,
|
||||
description: $request->expert_description,
|
||||
data: [
|
||||
'state_id' => HarimStates::ERSAL_BE_PANJAREH_VAHED_NIAZ_BE_RAH_DASTRASI->value,
|
||||
'state_name' => HarimStates::ERSAL_BE_PANJAREH_VAHED_NIAZ_BE_RAH_DASTRASI->label(),
|
||||
]
|
||||
);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function confirmNoRoadAccessNeed(ConfirmNoRoadAccessNeedRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
$action = HarimAction::CONFIRM->value;
|
||||
|
||||
$harim->histories()->create([
|
||||
'expert_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_PANJAREH_VAHED_BEDONEH_NIAZ_BE_RAH_DASTRASI->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
]);
|
||||
|
||||
ConfirmNoRoadAccessNeedEvent::dispatch($harim);
|
||||
|
||||
});
|
||||
$harim->updateStateWithHistory(
|
||||
action: HarimAction::CONFIRM->value,
|
||||
description: $request->expert_description,
|
||||
data: [
|
||||
'state_id' => HarimStates::ERSAL_BE_PANJAREH_VAHED_BEDONEH_NIAZ_BE_RAH_DASTRASI->value,
|
||||
'state_name' => HarimStates::ERSAL_BE_PANJAREH_VAHED_BEDONEH_NIAZ_BE_RAH_DASTRASI->label(),
|
||||
]
|
||||
);
|
||||
ConfirmNoRoadAccessNeedEvent::dispatch($harim);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function confirmRoadAccessEditNeed(ConfirmRoadAccessEditNeedRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
$action = HarimAction::CONFIRM->value;
|
||||
|
||||
$harim->histories()->create([
|
||||
'expert_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::UPDATE_FILE_BARGOZARE_SHODE->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
]);
|
||||
|
||||
ConfirmRoadAccessEditNeedEvent::dispatch($harim);
|
||||
});
|
||||
$harim->updateStateWithHistory(
|
||||
action: HarimAction::CONFIRM->value,
|
||||
description: $request->expert_description,
|
||||
data: [
|
||||
'state_id' => HarimStates::UPDATE_RAHE_DASTRASI_BARGOZARE_SHODE->value,
|
||||
'state_name' => HarimStates::UPDATE_RAHE_DASTRASI_BARGOZARE_SHODE->label(),
|
||||
]
|
||||
);
|
||||
ConfirmRoadAccessEditNeedEvent::dispatch($harim);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function confirmGuaranteeLetterNeed(ConfirmGuaranteeLetterNeedRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
$action = HarimAction::CONFIRM->value;
|
||||
|
||||
$harim->histories()->create([
|
||||
'expert_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_ZEMANAT_NAME_TAVASOTE_KARBAR->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
]);
|
||||
|
||||
ConfirmGuaranteeLetterNeedEvent::dispatch($harim);
|
||||
});
|
||||
$harim->updateStateWithHistory(
|
||||
action: HarimAction::CONFIRM->value,
|
||||
description: $request->expert_description,
|
||||
data: [
|
||||
'state_id' => HarimStates::ARSE_VA_AYAN_NAHAI->value,
|
||||
'state_name' => HarimStates::ARSE_VA_AYAN_NAHAI->label(),
|
||||
]
|
||||
);
|
||||
ConfirmGuaranteeLetterNeedEvent::dispatch($harim);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
@@ -234,4 +150,34 @@ class GeneralManagerController extends Controller
|
||||
{
|
||||
return $this->successResponse($harim->load('histories'));
|
||||
}
|
||||
|
||||
public function referPayment(ReferPaymentRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
$harim->updateStateWithHistory(
|
||||
action: HarimAction::REFER->value,
|
||||
description: $request->expert_description,
|
||||
data: [
|
||||
'state_id' => HarimStates::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_MOAVEN->value,
|
||||
'state_name' => HarimStates::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_MOAVEN->label(),
|
||||
]
|
||||
);
|
||||
ConfirmGuaranteeLetterNeedEvent::dispatch($harim);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function confirmPayment(ConfirmPaymentRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
$harim->updateStateWithHistory(
|
||||
action: HarimAction::CONFIRM->value,
|
||||
description: $request->expert_description,
|
||||
data: [
|
||||
'state_id' => HarimStates::ETMAM_FARAYAND->value,
|
||||
'state_name' => HarimStates::ETMAM_FARAYAND->label(),
|
||||
]
|
||||
);
|
||||
ConfirmGuaranteeLetterNeedEvent::dispatch($harim);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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\ComputingPaymentRequest;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\HarimOffice\FileAcceptedRequest;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\HarimOffice\FileRejectedRequest;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\HarimOffice\NeedRoadAccessRequest;
|
||||
@@ -18,7 +19,6 @@ use App\Models\Harim;
|
||||
use App\Models\Province;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class HarimOfficeController extends Controller
|
||||
{
|
||||
@@ -41,154 +41,93 @@ class HarimOfficeController extends Controller
|
||||
|
||||
public function rejectRequest(RejectRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
$action = HarimAction::NO->value;
|
||||
$harim->histories()->create([
|
||||
'expert_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_TAVASOT_MOAVEN->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
$harim->updateStateWithHistory(
|
||||
action: HarimAction::NO->value,
|
||||
description: $request->expert_description,
|
||||
data: [
|
||||
'state_id' => HarimStates::BARESI_TAVASOT_MOAVEN->value,
|
||||
'state_name' => HarimStates::BARESI_TAVASOT_MOAVEN->label(),
|
||||
'is_possible' => false,
|
||||
]);
|
||||
});
|
||||
]
|
||||
);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function referRequest(ReferRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
$action = HarimAction::REFER->value;
|
||||
|
||||
$harim->histories()->create([
|
||||
'expert_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_EDARE_SHAHRESTAN->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
]);
|
||||
});
|
||||
$harim->updateStateWithHistory(
|
||||
action: HarimAction::REFER->value,
|
||||
description: $request->expert_description,
|
||||
data: [
|
||||
'state_id' => HarimStates::BARESI_EDARE_SHAHRESTAN->value,
|
||||
'state_name' => HarimStates::BARESI_EDARE_SHAHRESTAN->label(),
|
||||
]
|
||||
);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function needRoadAccess(NeedRoadAccessRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
$action = HarimAction::YES->value;
|
||||
$harim->histories()->create([
|
||||
'expert_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_TAVASOT_MOAVEN->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
$harim->updateStateWithHistory(
|
||||
action: HarimAction::YES->value,
|
||||
description: $request->expert_description,
|
||||
data: [
|
||||
'state_id' => HarimStates::BARESI_TAVASOT_MOAVEN->value,
|
||||
'state_name' => HarimStates::BARESI_TAVASOT_MOAVEN->label(),
|
||||
'is_possible' => true,
|
||||
'need_access_road' => true,
|
||||
'need_payment' => $request->need_payment,
|
||||
]);
|
||||
});
|
||||
]
|
||||
);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function withoutRoadAccess(WithoutRoadAccessRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
$action = HarimAction::YES->value;
|
||||
$harim->histories()->create([
|
||||
'expert_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_TAVASOT_MOAVEN->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
$harim->updateStateWithHistory(
|
||||
action: HarimAction::YES->value,
|
||||
description: $request->expert_description,
|
||||
data: [
|
||||
'state_id' => HarimStates::BARESI_TAVASOT_MOAVEN->value,
|
||||
'state_name' => HarimStates::BARESI_TAVASOT_MOAVEN->label(),
|
||||
'is_possible' => true,
|
||||
'need_access_road' => false,
|
||||
'need_payment' => $request->need_payment,
|
||||
]);
|
||||
});
|
||||
]
|
||||
);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function fileAccepted(FileAcceptedRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
$action = HarimAction::YES->value;
|
||||
$harim->histories()->create([
|
||||
'expert_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_FILE_APLODE_SHODE_TAVASOTE_MOAVEN->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
$harim->updateStateWithHistory(
|
||||
action: HarimAction::YES->value,
|
||||
description: $request->expert_description,
|
||||
data: [
|
||||
'state_id' => HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MOAVEN->value,
|
||||
'state_name' => HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MOAVEN->label(),
|
||||
'access_road_allowed' => true,
|
||||
]);
|
||||
});
|
||||
]
|
||||
);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function fileRejected(FileRejectedRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
$action = HarimAction::NO->value;
|
||||
$harim->histories()->create([
|
||||
'expert_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_FILE_APLODE_SHODE_TAVASOTE_MOAVEN->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
$harim->updateStateWithHistory(
|
||||
action: HarimAction::YES->value,
|
||||
description: $request->expert_description,
|
||||
data: [
|
||||
'state_id' => HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MOAVEN->value,
|
||||
'state_name' => HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MOAVEN->label(),
|
||||
'access_road_allowed' => false,
|
||||
]);
|
||||
});
|
||||
]
|
||||
);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
@@ -208,4 +147,23 @@ class HarimOfficeController extends Controller
|
||||
'province_name' => $province->name_fa,
|
||||
]);
|
||||
}
|
||||
|
||||
public function computingPayment(ComputingPaymentRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
$harim->updateStateWithHistory(
|
||||
action: HarimAction::CONFIRM->value,
|
||||
description: $request->expert_description,
|
||||
data: [
|
||||
'state_id' => HarimStates::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_MOAVEN->value,
|
||||
'state_name' => HarimStates::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_MOAVEN->label(),
|
||||
'traffic' => $request->traffic,
|
||||
'position' => $request->position,
|
||||
'final_plan_space' => $request->final_plan_space,
|
||||
'road_type' => $request->road_type,
|
||||
'payment_amount' => $request->payment_amount,
|
||||
]
|
||||
);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,8 +68,6 @@ class PanjareVahedController extends Controller
|
||||
|
||||
public function getAccessRoad(GetAccessRoadRequest $request): JsonResponse
|
||||
{
|
||||
$state = HarimStates::BARESI_FILE_APLODE_SHODE_TAVASOTE_DAFTAR_HARIM->value;
|
||||
|
||||
$harim = Harim::query()->firstWhere('panjare_vahed_id', '=', $request->request_id);
|
||||
|
||||
$harim->panjarehVahedHistories()->create([
|
||||
@@ -78,8 +76,8 @@ class PanjareVahedController extends Controller
|
||||
]);
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
'state_id' => HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_DAFTAR_HARIM->value,
|
||||
'state_name' => HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_DAFTAR_HARIM->label(),
|
||||
'access_road' => json_encode($request->access_road),
|
||||
'data' => $request->data,
|
||||
]);
|
||||
@@ -117,7 +115,6 @@ class PanjareVahedController extends Controller
|
||||
|
||||
public function getFinalPolygons(GetFinalPolygonsRequest $request): JsonResponse
|
||||
{
|
||||
$state = HarimStates::TAEDE_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_DAFTAR_HARIM->value;
|
||||
|
||||
$harim = Harim::query()->firstWhere('panjare_vahed_id', '=', $request->request_id);
|
||||
|
||||
@@ -127,8 +124,8 @@ class PanjareVahedController extends Controller
|
||||
]);
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
'state_id' => HarimStates::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_DAFTAR_HARIM->value,
|
||||
'state_name' => HarimStates::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_DAFTAR_HARIM->label(),
|
||||
'final_area' => json_encode($request->final_area),
|
||||
'final_plan' => json_encode($request->final_plan),
|
||||
'data' => $request->data,
|
||||
|
||||
@@ -12,7 +12,6 @@ use App\Http\Traits\ApiResponse;
|
||||
use App\Models\Harim;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class ProvinceOfficeController extends Controller
|
||||
{
|
||||
@@ -37,26 +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([
|
||||
'expert_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_TAVASOT_DAFTAR_HARIM->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
$harim->updateStateWithHistory(
|
||||
action: HarimAction::FEEDBACK->value,
|
||||
description: $request->expert_description,
|
||||
data: [
|
||||
'state_id' => HarimStates::BARESI_TAVASOT_DAFTAR_HARIM->value,
|
||||
'state_name' => HarimStates::BARESI_TAVASOT_DAFTAR_HARIM->label(),
|
||||
'forbidden_area' => $request->input('forbidden_area'),
|
||||
]);
|
||||
});
|
||||
]
|
||||
);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
@@ -6,8 +6,10 @@ 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\Deputy\ConfirmPaymentRequest;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\Deputy\ConfirmRequest;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\Deputy\ConfirmRoadAccessRequest;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\Deputy\ReferPaymentRequest;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\Deputy\ReferRequest;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\Deputy\ReferRoadAccessRequest;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\Deputy\ShowRequest;
|
||||
@@ -15,7 +17,6 @@ use App\Http\Traits\ApiResponse;
|
||||
use App\Models\Harim;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class TechnicalDeputyController extends Controller
|
||||
{
|
||||
@@ -38,98 +39,56 @@ class TechnicalDeputyController extends Controller
|
||||
|
||||
public function confirmRequest(ConfirmRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
$action = HarimAction::CONFIRM->value;
|
||||
|
||||
$harim->histories()->create([
|
||||
'expert_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_TAVASOT_MODIR_KOL->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
]);
|
||||
});
|
||||
$harim->updateStateWithHistory(
|
||||
action: HarimAction::CONFIRM->value,
|
||||
description: $request->expert_description,
|
||||
data: [
|
||||
'state_id' => HarimStates::BARESI_TAVASOT_MODIR_KOL->value,
|
||||
'state_name' => HarimStates::BARESI_TAVASOT_MODIR_KOL->label(),
|
||||
]
|
||||
);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function referRequest(ReferRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
$action = HarimAction::REFER->value;
|
||||
|
||||
$harim->histories()->create([
|
||||
'expert_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_TAVASOT_DAFTAR_HARIM->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
]);
|
||||
});
|
||||
$harim->updateStateWithHistory(
|
||||
action: HarimAction::REFER->value,
|
||||
description: $request->expert_description,
|
||||
data: [
|
||||
'state_id' => HarimStates::BARESI_TAVASOT_DAFTAR_HARIM->value,
|
||||
'state_name' => HarimStates::BARESI_TAVASOT_DAFTAR_HARIM->label(),
|
||||
]
|
||||
);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function confirmRoadAccess(ConfirmRoadAccessRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
$action = HarimAction::CONFIRM->value;
|
||||
$harim->histories()->create([
|
||||
'expert_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_FILE_APLODE_SHODE_TAVASOTE_MODIR_KOL->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
]);
|
||||
});
|
||||
$harim->updateStateWithHistory(
|
||||
action: HarimAction::CONFIRM->value,
|
||||
description: $request->expert_description,
|
||||
data: [
|
||||
'state_id' => HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MODIR_KOL->value,
|
||||
'state_name' => HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MODIR_KOL->label(),
|
||||
]
|
||||
);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function referRoadAccess(ReferRoadAccessRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
$action = HarimAction::REFER->value;
|
||||
$harim->histories()->create([
|
||||
'expert_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_FILE_APLODE_SHODE_TAVASOTE_DAFTAR_HARIM->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
]);
|
||||
});
|
||||
$harim->updateStateWithHistory(
|
||||
action: HarimAction::REFER->value,
|
||||
description: $request->expert_description,
|
||||
data: [
|
||||
'state_id' => HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_DAFTAR_HARIM->value,
|
||||
'state_name' => HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_DAFTAR_HARIM->label(),
|
||||
]
|
||||
);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
@@ -138,4 +97,32 @@ class TechnicalDeputyController extends Controller
|
||||
{
|
||||
return $this->successResponse($harim->load('histories'));
|
||||
}
|
||||
|
||||
public function referPayment(ReferPaymentRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
$harim->updateStateWithHistory(
|
||||
action: HarimAction::REFER->value,
|
||||
description: $request->expert_description,
|
||||
data: [
|
||||
'state_id' => HarimStates::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_DAFTAR_HARIM->value,
|
||||
'state_name' => HarimStates::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_DAFTAR_HARIM->label(),
|
||||
]
|
||||
);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function confirmPayment(ConfirmPaymentRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
$harim->updateStateWithHistory(
|
||||
action: HarimAction::CONFIRM->value,
|
||||
description: $request->expert_description,
|
||||
data: [
|
||||
'state_id' => HarimStates::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_MODIR_KOL->value,
|
||||
'state_name' => HarimStates::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_MODIR_KOL->label(),
|
||||
]
|
||||
);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Dashboard\Harim\Deputy;
|
||||
|
||||
use App\Enums\HarimStates;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ConfirmPaymentRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->harim->province_id == auth()->user()->province_id &&
|
||||
$this->harim->state_id == HarimStates::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_MOAVEN->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, ValidationRule|array|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'expert_description' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ class ConfirmRoadAccessRequest extends FormRequest
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->harim->province_id == auth()->user()->province_id &&
|
||||
$this->harim->state_id == HarimStates::BARESI_FILE_APLODE_SHODE_TAVASOTE_MOAVEN->value;
|
||||
$this->harim->state_id == HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MOAVEN->value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Dashboard\Harim\Deputy;
|
||||
|
||||
use App\Enums\HarimStates;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ReferPaymentRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->harim->province_id == auth()->user()->province_id &&
|
||||
$this->harim->state_id == HarimStates::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_MOAVEN->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, ValidationRule|array|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'expert_description' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ class ReferRoadAccessRequest extends FormRequest
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->harim->province_id == auth()->user()->province_id &&
|
||||
$this->harim->state_id == HarimStates::BARESI_FILE_APLODE_SHODE_TAVASOTE_MOAVEN->value;
|
||||
$this->harim->state_id == HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MOAVEN->value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Dashboard\Harim\GeneralManager;
|
||||
|
||||
use App\Enums\HarimStates;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ConfirmPaymentRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->harim->province_id == auth()->user()->province_id &&
|
||||
$this->harim->state_id == HarimStates::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_MODIR_KOL->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, ValidationRule|array|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'expert_description' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ class ConfirmRoadAccessEditNeedRequest extends FormRequest
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->harim->province_id == auth()->user()->province_id &&
|
||||
$this->harim->state_id == HarimStates::BARESI_FILE_APLODE_SHODE_TAVASOTE_MODIR_KOL->value;
|
||||
$this->harim->state_id == HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MODIR_KOL->value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,7 +14,7 @@ class ReferFileRequest extends FormRequest
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->harim->province_id == auth()->user()->province_id &&
|
||||
$this->harim->state_id == HarimStates::BARESI_FILE_APLODE_SHODE_TAVASOTE_MODIR_KOL->value;
|
||||
$this->harim->state_id == HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MODIR_KOL->value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Dashboard\Harim\GeneralManager;
|
||||
|
||||
use App\Enums\HarimStates;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ReferPaymentRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->harim->province_id == auth()->user()->province_id &&
|
||||
$this->harim->state_id == HarimStates::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_MODIR_KOL->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, ValidationRule|array|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'expert_description' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Dashboard\Harim\HarimOffice;
|
||||
|
||||
use App\Enums\HarimStates;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ComputingPaymentRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->harim->province_id === auth()->user()->province_id &&
|
||||
$this->harim->state_id === HarimStates::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_DAFTAR_HARIM->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, ValidationRule|array|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'traffic' => 'required|numeric|decimal:1',
|
||||
'road_type' => 'required|numeric|decimal:1',
|
||||
'position' => 'required|numeric|decimal:1',
|
||||
'final_area_space' => 'required|numeric|decimal:2',
|
||||
'payment_amount' => 'required|numeric|decimal:2',
|
||||
'expert_description' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ class FileAcceptedRequest extends FormRequest
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->harim->province_id == auth()->user()->province_id &&
|
||||
$this->harim->state_id == HarimStates::BARESI_FILE_APLODE_SHODE_TAVASOTE_DAFTAR_HARIM->value;
|
||||
$this->harim->state_id == HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_DAFTAR_HARIM->value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,7 +14,7 @@ class FileRejectedRequest extends FormRequest
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->harim->province_id == auth()->user()->province_id &&
|
||||
$this->harim->state_id == HarimStates::BARESI_FILE_APLODE_SHODE_TAVASOTE_DAFTAR_HARIM->value;
|
||||
$this->harim->state_id == HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_DAFTAR_HARIM->value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Http\Requests\V3\Dashboard\Harim\PanjareVahed;
|
||||
|
||||
use App\Models\Harim;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\HarimStates;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Throwable;
|
||||
|
||||
class Harim extends Model
|
||||
{
|
||||
@@ -24,6 +27,23 @@ class Harim extends Model
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function updateStateWithHistory(int $action, string $description , array $data): void
|
||||
{
|
||||
DB::transaction(function () use ($action, $description, $data) {
|
||||
$this->histories()->create([
|
||||
'expert_id' => auth()->user()->id,
|
||||
'previous_state_id' => $this->state_id,
|
||||
'previous_state_name'=> $this->state_name,
|
||||
'expert_description' => $description,
|
||||
'action_id' => $action,
|
||||
'action_name' => HarimAction::name($action),
|
||||
]);
|
||||
|
||||
$this->update($data);
|
||||
});
|
||||
public function panjarehVahedHistories(): HasMany
|
||||
{
|
||||
return $this->hasMany(PanjarehVahedHistory::class);
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('harims', function (Blueprint $table) {
|
||||
$table->decimal('traffic',total: 3,places: 1)->nullable();
|
||||
$table->decimal('road_type', total: 3,places: 1)->nullable();
|
||||
$table->decimal('position', total: 3,places: 1)->nullable();
|
||||
$table->decimal('final_area_space')->nullable();
|
||||
$table->decimal('forbidden_area_space')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('harims', function (Blueprint $table) {
|
||||
$table->dropColumn('traffic', 'road_type', 'position');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -552,6 +552,8 @@ Route::prefix('harim')
|
||||
Route::post('/file_rejected/{harim}', 'fileRejected')->name('fileRejected');
|
||||
Route::get('/{harim}', 'show')->name('show');
|
||||
Route::post('/refer_request/{harim}', 'referRequest')->name('referRequest');
|
||||
Route::post('/computing_payment/{harim}', 'computingPayment')->name('computingPayment');
|
||||
Route::post('/refer_to_city/{harim}', 'referToCity')->name('referToCity');
|
||||
});
|
||||
|
||||
Route::prefix('technical_deputy')
|
||||
@@ -564,6 +566,8 @@ Route::prefix('harim')
|
||||
Route::post('/confirm_road_access/{harim}', 'confirmRoadAccess')->name('confirmRoadAccess');
|
||||
Route::post('/refer_road_access/{harim}', 'referRoadAccess')->name('referRoadAccess');
|
||||
Route::get('/{harim}', 'show')->name('show');
|
||||
Route::post('/refer_payment/{harim}', 'referPayment')->name('referPayment');
|
||||
Route::post('/confirm_payment/{harim}', 'confirmPayment')->name('confirmPayment');
|
||||
});
|
||||
|
||||
Route::prefix('general_manager')
|
||||
@@ -579,6 +583,8 @@ Route::prefix('harim')
|
||||
Route::post('/confirm_road_access_edit_need/{harim}', 'confirmRoadAccessEditNeed')->name('confirmRoadAccessEditNeed');
|
||||
Route::post('/confirm_guarantee_letter_need/{harim}', 'confirmGuaranteeLetterNeed')->name('confirmGuaranteeLetterNeed');
|
||||
Route::get('/{harim}', 'show')->name('show');
|
||||
Route::post('/refer_payment/{harim}', 'referPayment')->name('referPayment');
|
||||
Route::post('/confirm_payment/{harim}', 'confirmPayment')->name('confirmPayment');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user