add description section to second step

This commit is contained in:
2025-04-27 10:51:11 +03:30
parent c754a2a7ba
commit 65375bf399
4 changed files with 23 additions and 22 deletions

View File

@@ -120,6 +120,7 @@ class OperatorController extends Controller
'judiciary_document' => $need_judiciary ? serialize($judiciary_document) : null,
'judiciary_document_upload_date' => $need_judiciary ? now() : null,
'need_judiciary' => $need_judiciary,
'operator_description' => $request->operator_description,
]);
$user->addActivityComplete(1135);

View File

@@ -23,7 +23,8 @@ class SecondStepStoreRequest extends FormRequest
{
return [
'need_judiciary' => 'required|boolean',
'judiciary_document' => 'required|array',
'operator_description' => 'required_if:need_judiciary,0|string',
'judiciary_document' => 'required_if:need_judiciary,1|array',
'judiciary_document.*' => 'file',
];
}

View File

@@ -28,42 +28,40 @@ class SafetyAndPrivacyTableService
'step_fa', 'axis_type_id', 'axis_type_name', 'action_date', 'is_finished', 'status_fa', 'supervisor_description'
];
if ($user->hasPermissionTo('show-safety-and-privacy-operator-cartable')) {
$query = SafetyAndPrivacy::query()->select($fields);
}
elseif ($user->hasPermissionTo('show-safety-and-privacy-operator-cartable-province')) {
throw_if(is_null($user->province_id), new ProhibitedAction('استانی برای شما در سامانه ثبت نشده است!'));
throw_if(is_null($user->edarate_shahri_id), new ProhibitedAction('اداره ای برای شما در سامانه ثبت نشده است!'));
$query = SafetyAndPrivacy::query()->where('province_id', '=', $user->province_id)->select($fields);
}
elseif ($user->hasPermissionTo('show-safety-and-privacy-operator-cartable-edarate-shahri')) {
throw_if(is_null($user->edarate_shahri_id), new ProhibitedAction('اداره ای برای شما در سامانه ثبت نشده است!'));
$query = SafetyAndPrivacy::query()->where('edare_shahri_id', '=', $user->edarate_shahri_id);
}
$query = SafetyAndPrivacy::query()->where('edare_shahri_id', '=', $user->edarate_shahri_id);
return DataTableFacade::run(
$query,
$request,
allowedFilters: ['*'],
allowedSortings: ['*']
allowedSortings: ['*'],
allowedSelects: $fields
);
}
/**
* @throws Throwable
*/
public function supervisorDataTable(Request $request)
{
$user = auth()->user();
$fields = ['id','lat','lon','province_id','province_fa','city_id','city_fa','edare_shahri_id','edare_shahri_name',
'recognize_picture','action_picture','operator_id','operator_name','way_id','created_at','updated_at','step',
'info_id','info_fa','activity_date_time', 'action_picture_document_upload_date', 'judiciary_document_upload_date',
'step_fa', 'axis_type_id', 'axis_type_name', 'action_date'
$fields = [
'id','lat','lon', 'recognize_picture','action_picture','created_at','step', 'final_description',
'info_fa', 'activity_date_time', 'action_picture_document_upload_date', 'judiciary_document_upload_date',
'step_fa', 'axis_type_id', 'axis_type_name', 'action_date', 'is_finished', 'status_fa', 'supervisor_description'
];
$query = SafetyAndPrivacy::query()->where([
['province_id', '=', $user->province_id],
['is_finished', '=', 1]
]);
$query = SafetyAndPrivacy::query()->where('is_finished', '=', 1);
if ($user->hasPermissionTo('show-safety-and-privacy-operator-cartable-province'))
{
throw_if(is_null($user->province_id), new ProhibitedAction('استانی برای شما در سامانه ثبت نشده است!'));
$query = $query->where('province_id', '=', $user->province_id);
}
return DataTableFacade::run(
$query,

View File

@@ -15,6 +15,7 @@ return new class extends Migration
$table->boolean('is_finished')->nullable();
$table->integer('status')->nullable();
$table->string('status_fa')->nullable();
$table->string('operator_description')->nullable();
$table->string('supervisor_description')->nullable();
$table->string('final_description')->nullable();
$table->boolean('need_judiciary')->nullable();