Merge pull request #17 from witelgroup/feature/LangugeForm

create and change code
This commit is contained in:
Amir Ghasempoor
2025-09-07 14:29:08 +03:30
committed by GitHub
9 changed files with 138 additions and 70 deletions

View File

@@ -9,6 +9,7 @@ enum HarimAction: int
case NO = 3;
case CONFIRM = 4;
case REFER = 5;
case REJECT = 6;
public static function name(int $state): string
{
@@ -18,6 +19,7 @@ enum HarimAction: int
3 => "خیر",
4 => "تائید کردن",
5 => "ارجاع",
6 => "رد درخواست"
];
return $mapArray[$state];

View File

@@ -11,14 +11,15 @@ enum HarimStates: int
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_ZEMANAT_NAME_TAVASOTE_HARIM =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_KARBAR = 13;
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 MOKHALEFAT_BA_DASTGAH = 16;
public static function name(int $state): string
{
@@ -31,14 +32,14 @@ enum HarimStates: int
6 => "بررسی فایل آپلود شده توسط معاون",
7 => "بررسی فایل آپلود شده توسط مدیر",
8 => "ارسال ضمانت نامه توسط کاربر",
9 => "ارسال به پنجره واحد ( نیاز به راه دسترسی)",
9 => "ارسال به پنجره واحد (نیاز به راه دسترسی)",
10 => "امکان پذیر نمی باشد",
11 => "ارسال به پنجره واحد (بدون نیاز به راه دسترسی)",
12 => "بازبینی فایل بارگذاری شده",
13 => "تائید عرصه و اعیان ارسال شده توسط اداره حریم",
14 => "تائید عرصه و اعیان ارسال شده توسط معاون",
15 => "تائید عرصه و اعیان ارسال شده توسط مدیر",
16 => " مخالفت با درخواست"
];
return $mapArray[$state];

View File

@@ -5,12 +5,12 @@ namespace App\Http\Controllers\V3\Dashboard\Harim;
use App\Enums\HarimStates;
use App\Http\Controllers\Controller;
use App\Http\Requests\V3\Dashboard\Harim\PanjareVahed\GetAccessRoadRequest;
use App\Http\Requests\V3\Dashboard\Harim\PanjareVahed\GetRejectRequest;
use App\Http\Requests\V3\Dashboard\Harim\PanjareVahed\ReceiveNewRequest;
use App\Http\Traits\ApiResponse;
use App\Models\City;
use App\Models\Harim;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Http\Request;
class PanjareVahedController extends Controller
{
@@ -79,4 +79,18 @@ class PanjareVahedController extends Controller
return $this->successResponse();
}
public function getRejectRequest(GetRejectRequest $request)
{
$state = HarimStates::MOKHALEFAT_BA_DASTGAH->value;
Harim::query()
->firstWhere('panjare_vahed_id', '=', $request->panjare_vahed_id)
->update([
'state_id' => $state,
'state_name' => HarimStates::name($state),
]);
return $this->successResponse();
}
}

View File

@@ -26,50 +26,17 @@ class RoadMaintenanceStationController extends Controller
$user = auth()->user();
$user->addActivityComplete(1019);
$province = $request->province;
$status = $request->status;
$type = $request->type;
$query = RahdariPoint::query()
->when($status, fn ($query, $status) => $query->where('status', $status))
->when($type, fn ($query, $type) => $query->where('type', $type))
->when($province, fn($query, $province) => $query->where('province_id', $province));
->when($user->hasPermissionTo('show-tollhouse-province') && !$user->hasPermissionTo('show-tollhouse'),
fn ($query) => $query->where('province_id', $user->province_id)
);
if ($user->hasPermissionTo('show-tollhouse-province') && !$user->hasPermissionTo('show-tollhouse')) {
$query->where('province_id', $user->province_id);
}
$data = DataTableFacade::run(
return response()->json(DataTableFacade::run(
$query,
$request,
allowedFilters: ['*'],
allowedSortings: ['*']
);
foreach ($data['data'] as &$stations) {
if ($user->hasPermissionTo('edit-tollhouse')) {
$stations['canEdit'] = 1;
}
elseif ($user->hasPermissionTo('edit-tollhouse-province') && $stations->province_id == $user->province_id) {
$stations['canEdit'] = 1;
}
else {
$stations['canEdit'] = 0;
}
if ($user->hasPermissionTo('delete-tollhouse')) {
$stations['canDelete'] = 1;
}
elseif ($user->hasPermissionTo('delete-tollhouse-province') && $stations->province_id == $user->province_id) {
$stations['canDelete'] = 1;
}
else {
$stations['canDelete'] = 0;
}
}
return response()->json($data);
));
}
/**

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Http\Requests\V3\Dashboard\Harim\PanjareVahed;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
class GetRejectRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, ValidationRule|array|string>
*/
public function rules(): array
{
return [
'panjare_vahed_id' => 'required|string',
];
}
}

View File

@@ -21,38 +21,41 @@ class HarimFactory extends Factory
public function definition(): array
{
return [
'panjare_vahed_id' => $this->faker->numberBetween(1, 100),
'national_id' => $this->faker->numberBetween(1, 100),
'phone_number' => $this->faker->numerify('09#########'),
'state_id' => $this->faker->numberBetween(1,15),
'state_name' => function (array $attributes) {
return HarimState::query()->find($attributes['state_id'])->name;
},
'first_name' => $this->faker->firstName(),
'last_name' => $this->faker->lastName(),
'phone_number' => $this->faker->numerify('09#########'),
'request_number' => $this->faker->numerify(),
'request_date' => $this->faker->date(),
'province_id' => Province::factory(),
'province_name' => function (array $attributes) {
return Province::query()->find($attributes['province_id'])->name_fa;
return Province::query()->find($attributes['province_id'])->name_fa;
},
'city_id' => City::factory(),
'city_name' => function (array $attributes) {
return City::query()->find($attributes['city_id'])->name_fa;
return City::query()->find($attributes['city_id'])->name_fa;
},
'edareh_shahri_id' => EdarateShahri::factory(),
'county' => $this->faker->citySuffix,
'division' => $this->faker->word,
'village' => $this->faker->name,
'grand_area' => $this->faker->numberBetween(1,100),
'plan_area' => $this->faker->numberBetween(1,100),
'requested_organization' => $this->faker->name,
'plan_group' => $this->faker->name,
'plan_title' => $this->faker->title,
'address' => $this->faker->address,
'file' => $this->faker->name,
'polygon' => json_encode($this->faker->numerify()),
'need_road_access' => $this->faker->boolean(),
'is_file_good' => $this->faker->boolean(),
'is_possible' => $this->faker->boolean(),
'worksheet_id' => $this->faker->uuid,
'response_options' => json_encode(['type' => 'polygon', 'coordinates' => [[11.2, 22.2], [33.2, 44.2], [11.2, 22.2]]]),
'isic' => $this->faker->text,
'primary_area' => json_encode(['type' => 'polygon', 'coordinates' => [[11.2, 22.2], [33.2, 44.2], [11.2, 22.2]]]),
'forbidden_area' => json_encode(['type' => 'polygon', 'coordinates' => [[11.2, 22.2], [33.2, 44.2], [11.2, 22.2]]]),
'final_area' => json_encode(['type' => 'polygon', 'coordinates' => [[11.2, 22.2], [33.2, 44.2], [11.2, 22.2]]]),
'final_plan' => json_encode(['type' => 'polygon', 'coordinates' => [[11.2, 22.2], [33.2, 44.2], [11.2, 22.2]]]),
'access_road' => json_encode(['type' => 'polygon', 'coordinates' => [[11.2, 22.2], [33.2, 44.2], [11.2, 22.2]]]),
'need_payment' => $this->faker->boolean(),
'payment_amount' => $this->faker->numberBetween(1000, 1000000),
'need_access_road' => $this->faker->boolean(),
'access_road_allowed' => $this->faker->boolean(),
'lat' => $this->faker->latitude,
'lng' => $this->faker->longitude,
];
}
}

View File

@@ -25,17 +25,13 @@ class HarimHistoryFactory extends Factory
'previous_state_name' => function (array $attributes) {
return HarimStates::query()->find($attributes['state_id'])->name;
},
'current_state_id' => HarimState::factory(),
'current_state_name' => function (array $attributes) {
return HarimState::query()->find($attributes['state_id'])->name;
},
'action_id' => HarimAction::factory(),
'action_name' => function (array $attributes) {
return HarimAction::query()->find($attributes['state_id'])->name;
},
'expert_id' => User::factory(),
'expert_description' => $this->fake()->text,
'previous_data' => json_encode(['fake']),
];
}
}

View File

@@ -34,11 +34,11 @@ return new class extends Migration
$table->string('worksheet_id');
$table->json('response_options')->nullable();
$table->string('isic');
$table->polygon('primary_area');
$table->polygon('forbidden_area')->nullable();
$table->polygon('final_area')->nullable();
$table->polygon('final_plan')->nullable();
$table->polygon('access_road')->nullable();
$table->json('primary_area');
$table->json('forbidden_area')->nullable();
$table->json('final_area')->nullable();
$table->json('final_plan')->nullable();
$table->json('access_road')->nullable();
$table->boolean('need_payment')->nullable();
$table->string('payment_amount')->nullable();
$table->boolean('need_access_road')->nullable();

View File

@@ -204,6 +204,62 @@ return [
'contract_subitem_id' => 'کد یکتای پروژه',
'base_price' => 'قیمت پایه',
'unit' => 'واحد',
'phone_number'=> 'شماره تلفن'
'phone_number'=> 'شماره تلفن',
'final_description' => 'توضیحات نهایی',
'point' => 'منطقه' ,
'info_id' => 'دسته بندی' ,
'activity_date' => 'تاریخ فعالیت',
'activity_time' => 'زمان فعالیت',
'recognize_picture' => 'عکس بازدید' ,
'recognize_picture_second' => 'عکس بازدید' ,
'axis_type_id' => 'نوع محور',
'supervisor_description' => 'توضیحات کارشناس',
'need_judiciary' => 'دستور قضایی' ,
'operator_description' => 'توضیحات ناظر',
'judiciary_document' => 'فایل دستور قضایی',
'action_picture' => 'عکس اقدامات',
'finish_picture' => 'عکس پایان کار',
'action_date' => 'زمان فالیت',
'evidence_picture' => 'تصویر مشاهده شده' ,
'deposit_insurance_image' => 'عکس مبلغ بیمه' ,
'deposit_insurance_amount' => ' مبلغ بیمه',
'deposit_daghi_image' => 'عکس مبلغ بیمه',
'deposit_daghi_amount' => 'مبلغ داغی',
'is_foreign' => 'ناوگان خارجی',
'axis_name' => 'نام محور',
'driver_name' => 'اسم راننده',
'plaque' => 'پلاک',
'driver_national_code' => 'کدملی راننده',
'driver_phone_number' => 'شماره موبایل راننده' ,
'accident_type' => 'نوع خسارت' ,
'accident_date' => 'تاریخ تصادف' ,
'accident_time' => 'زمان تصادف' ,
'report_base' => 'گزارش' ,
'police_file' => 'تصویر کروکی یا نامه پلیس راه' ,
'police_serial' => 'شماره کروکی یا نامه پلیس راه',
'police_file_date' => 'تاریخ کروکی یا نامه پلیس راه' ,
'damage_picture1' => 'عکس تصادف' ,
'damage_picture2' => 'عکس تصادف' ,
'damage_items' => 'ایتم های خسارت ',
'damage_items.*.value' => 'میزان ایتم های خسارت ',
'damage_items.*.amount' => 'هزینه خسارت ' ,
'driver_rate' => 'سهم راننده' ,
'code' => 'کد',
'rahdaran' => 'افراد' ,
'machines' => 'خودرو' ,
'driver' => 'راننده' ,
'zone' => 'منطقه ' ,
'start_date' => 'تاریخ شروع' ,
'end_date' => 'تاریخ پایان' ,
'end_point' => 'مقصد',
'area' => 'منطقه عملیاتی',
'area.type' => 'نوع محدوده' ,
'area.coordinates' => 'محدوده مختصاتی' ,
'category_id' => 'دسته بندی',
'explanation' => 'توضیحات' ,
'requested_machines' => 'درخواست ماشین',
'type' => 'نوع',
'road_observed_id' => 'واکنش سریع',
'city_id' => 'شهر',
],
];