add all manager api
This commit is contained in:
@@ -8,7 +8,7 @@ enum HarimAction: int
|
||||
case YES = 2;
|
||||
case NO = 3;
|
||||
case CONFIRM = 4;
|
||||
case REJECT = 5;
|
||||
case REFER = 5;
|
||||
|
||||
public static function name(int $state): string
|
||||
{
|
||||
@@ -17,7 +17,7 @@ enum HarimAction: int
|
||||
2 => "بله",
|
||||
3 => "خیر",
|
||||
4 => "تائید کردن",
|
||||
5 => "رد درخواست",
|
||||
5 => "ارجاع",
|
||||
];
|
||||
|
||||
return $mapArray[$state];
|
||||
|
||||
@@ -24,9 +24,9 @@ enum HarimStates: int
|
||||
{
|
||||
$mapArray = [
|
||||
1 => "بررسی ادارات شهرستان",
|
||||
2 => "بررسی راه توسط ادارات حریم",
|
||||
3 => "بررسی راه توسط معاون ",
|
||||
4 => "بررسی راه توسط مدیر کل",
|
||||
2 => "بررسی توسط ادارات حریم",
|
||||
3 => "بررسی توسط معاون ",
|
||||
4 => "بررسی توسط مدیر کل",
|
||||
5 => "بررسی فایل آپلود شده توسط اداره حریم",
|
||||
6 => "بررسی فایل آپلود شده توسط معاون",
|
||||
7 => "بررسی فایل آپلود شده توسط مدیر",
|
||||
|
||||
@@ -6,7 +6,12 @@ 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\GeneralManager\ConfirmRequest;
|
||||
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\ConfirmGuaranteeLetterNeedRequest;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\GeneralManager\ConfirmNoRoadAccessNeedRequest;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\GeneralManager\ReferFileRequest;
|
||||
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;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
@@ -22,7 +27,7 @@ class GeneralManagerController extends Controller
|
||||
{
|
||||
$user = auth()->user();
|
||||
$query = Harim::query()
|
||||
->where('state_id','=',HarimStates::Baresi_Imeni_Rah_Tavasot_Modir_Kol->value)
|
||||
->where('state_id', '=', HarimStates::BARESI_TAVASOT_MODIR_KOL->value)
|
||||
->where('edareh_shahri_id', '=', $user->edarate_shahri_id);
|
||||
|
||||
$data = DataTableFacade::run(
|
||||
@@ -33,7 +38,8 @@ class GeneralManagerController extends Controller
|
||||
);
|
||||
return response()->json($data);
|
||||
}
|
||||
public function conform(ConfirmRequest $request, Harim $harim): JsonResponse
|
||||
|
||||
public function rejectRequest(RejectRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
$action = HarimAction::CONFIRM->value;
|
||||
@@ -46,7 +52,8 @@ class GeneralManagerController extends Controller
|
||||
'action_name' => HarimAction::name($action),
|
||||
]);
|
||||
|
||||
$state = HarimStates::ERSAL_BE_PANJAREVAHED->value;
|
||||
$state = HarimStates::EMKAN_PAZIR_NEMEBASHAD->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
@@ -55,10 +62,10 @@ class GeneralManagerController extends Controller
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function reject(RejectRequest $request, Harim $harim): JsonResponse
|
||||
public function referRequest(ReferRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
$action = HarimAction::REJECT->value;
|
||||
$action = HarimAction::REFER->value;
|
||||
$harim->histories()->create([
|
||||
'expert_id'=> auth()->user()->id,
|
||||
'previous-state_id' => $harim->state_id,
|
||||
@@ -67,7 +74,120 @@ class GeneralManagerController extends Controller
|
||||
'action_id' => $action,
|
||||
'action_name' => HarimAction::name($action),
|
||||
]);
|
||||
$state = HarimStates::Baresi_Imeni_Rah_Tavasot_Moaven->value;
|
||||
|
||||
$state = HarimStates::BARESI_TAVASOT_MOAVEN->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
]);
|
||||
});
|
||||
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),
|
||||
]);
|
||||
});
|
||||
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),
|
||||
]);
|
||||
});
|
||||
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),
|
||||
]);
|
||||
});
|
||||
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),
|
||||
]);
|
||||
});
|
||||
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),
|
||||
|
||||
@@ -21,7 +21,7 @@ class ProvinceOfficeController extends Controller
|
||||
{
|
||||
$user = auth()->user();
|
||||
$query = Harim::query()
|
||||
->where('state_id','=',HarimStates::Baresi_Edare_Shahrestan->value)
|
||||
->where('state_id', '=', HarimStates::BARESI_EDARE_SHAHRESTAN->value)
|
||||
->where('edareh_shahri_id', '=', $user->edarate_shahri_id);
|
||||
|
||||
$data = DataTableFacade::run(
|
||||
@@ -47,7 +47,7 @@ class ProvinceOfficeController extends Controller
|
||||
'action_name' => HarimAction::name($action),
|
||||
]);
|
||||
|
||||
$state = HarimStates::Baresi_Imeni_Rah_Tavasot_Daftar_Harim->value;
|
||||
$state = HarimStates::BARESI_TAVASOT_DAFTAR_HARIM->value;
|
||||
|
||||
$harim ->update([
|
||||
'state_id' => $state,
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Dashboard\Harim\GeneralManager;
|
||||
|
||||
use App\Enums\HarimStates;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ConfirmGuaranteeLetterNeedRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->harim->edareh_shahri_id == auth()->user()->edarate_shahri_id &&
|
||||
$this->harim->state_id == HarimStates::BARESI_TAVASOT_MODIR_KOL->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'expert_description' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Dashboard\Harim\GeneralManager;
|
||||
|
||||
use App\Enums\HarimStates;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ConfirmNoRoadAccessNeedRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->harim->edareh_shahri_id == auth()->user()->edarate_shahri_id &&
|
||||
$this->harim->state_id == HarimStates::BARESI_TAVASOT_MODIR_KOL->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'expert_description' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Dashboard\Harim\GeneralManager;
|
||||
|
||||
use App\Enums\HarimStates;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ConfirmRoadAccessEditNeedRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->harim->edareh_shahri_id == auth()->user()->edarate_shahri_id &&
|
||||
$this->harim->state_id == HarimStates::BARESI_FILE_APLODE_SHODE_TAVASOTE_MODIR_KOL->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'expert_description' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Dashboard\Harim\GeneralManager;
|
||||
|
||||
use App\Enums\HarimStates;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ConfirmRoadAccessNeedRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->harim->edareh_shahri_id == auth()->user()->edarate_shahri_id &&
|
||||
$this->harim->state_id == HarimStates::BARESI_TAVASOT_MODIR_KOL->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'expert_description' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Dashboard\Harim\GeneralManager;
|
||||
|
||||
use App\Enums\HarimStates;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ReferFileRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->harim->edareh_shahri_id == auth()->user()->edarate_shahri_id &&
|
||||
$this->harim->state_id == HarimStates::BARESI_FILE_APLODE_SHODE_TAVASOTE_MODIR_KOL->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'expert_description' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace App\Http\Requests\V3\Dashboard\Harim\GeneralManager;
|
||||
use App\Enums\HarimStates;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ConfirmRequest extends FormRequest
|
||||
class ReferRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
@@ -13,7 +13,7 @@ class ConfirmRequest 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_TAVASOT_MODIR_KOL->value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13,7 +13,7 @@ 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_TAVASOT_MODIR_KOL->value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,7 +13,7 @@ class FeedBackRequest extends FormRequest
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->harim->edareh_shahri_id == auth()->user()->edarate_shahri_id &&
|
||||
$this->harim->state_id == HarimStates::Baresi_Edare_Shahrestan->value;
|
||||
$this->harim->state_id == HarimStates::BARESI_EDARE_SHAHRESTAN->value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,7 +18,7 @@ class HarimActionSeeder extends Seeder
|
||||
['id' => 2, 'name' => 'yes', 'created_at' => now(), 'updated_at' => now(),],
|
||||
['id' => 3, 'name' => 'no', 'created_at' => now(), 'updated_at' => now(),],
|
||||
['id' => 4, 'name' => 'confirm', 'created_at' => now(), 'updated_at' => now(),],
|
||||
['id' => 5, 'name' => 'reject', 'created_at' => now(), 'updated_at' => now(),],
|
||||
['id' => 5, 'name' => 'refer', 'created_at' => now(), 'updated_at' => now(),],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,9 +15,9 @@ 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(),],
|
||||
|
||||
Reference in New Issue
Block a user