improve code
This commit is contained in:
@@ -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];
|
||||
|
||||
@@ -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'));
|
||||
|
||||
|
||||
@@ -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'));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,9 +56,4 @@ class ProvinceOfficeController extends Controller
|
||||
});
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function show(Harim $harim): JsonResponse
|
||||
{
|
||||
return $this->successResponse($harim);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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'));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
30
app/Http/Requests/V3/Dashboard/Harim/Deputy/ShowRequest.php
Normal file
30
app/Http/Requests/V3/Dashboard/Harim/Deputy/ShowRequest.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Dashboard\Harim\Deputy;
|
||||
|
||||
use App\Enums\HarimStates;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ShowRequest 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_Imeni_Rah_Tavasot_Moaven->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 [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -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.
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Dashboard\Harim\GeneralManager;
|
||||
|
||||
use App\Enums\HarimStates;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ShowRequest 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_Imeni_Rah_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 [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Dashboard\Harim\HarimOffice;
|
||||
|
||||
use App\Enums\HarimStates;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ShowRequest 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_Imeni_Rah_Tavasot_Daftar_Harim->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 [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
@@ -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.')
|
||||
|
||||
Reference in New Issue
Block a user