create form request for supervisor
This commit is contained in:
@@ -9,6 +9,8 @@ use App\Exports\V3\SafetyAndPrivacy\CartableReport;
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Facades\File\FileFacade;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\V3\SafetyAndPrivacy\FinishRequest;
|
||||
use App\Http\Requests\V3\SafetyAndPrivacy\RejectRequest;
|
||||
use App\Http\Requests\V3\SafetyAndPrivacy\FirstStepStoreRequest;
|
||||
use App\Http\Requests\V3\SafetyAndPrivacy\SecondStepStoreRequest;
|
||||
use App\Http\Requests\V3\SafetyAndPrivacy\ThirdStepStoreRequest;
|
||||
@@ -60,6 +62,7 @@ class SafetyAndPrivacyController extends Controller
|
||||
|
||||
DB::transaction(function () use ($request, $coordinates, $item, $nominatimService, $user)
|
||||
{
|
||||
$step = SafetyAndPrivacySteps::SHENASAEI->value;
|
||||
$safety_and_privacy = SafetyAndPrivacy::query()->create([
|
||||
'lat' => $coordinates[0],
|
||||
'lon' => $coordinates[1],
|
||||
@@ -77,9 +80,10 @@ class SafetyAndPrivacyController extends Controller
|
||||
'way_id' => $nominatimService->get_way_id_from_nominatim($coordinates[0], $coordinates[1]),
|
||||
'axis_type_id' => $request->axis_type_id,
|
||||
'axis_type_name' => AxisTypes::name($request->axis_type_id),
|
||||
'step' => SafetyAndPrivacySteps::SHENASAEI->value,
|
||||
'step_fa' => SafetyAndPrivacySteps::name(1),
|
||||
'is_finished' => false
|
||||
'step' => $step,
|
||||
'step_fa' => SafetyAndPrivacySteps::name($step),
|
||||
'is_finished' => false,
|
||||
'final_description' => 'پیام سیستمی : این عملیات پس از طی تمامی گام ها خاتمه یافت'
|
||||
]);
|
||||
|
||||
$safety_and_privacy->recognize_picture = $request->has('recognize_picture') ?
|
||||
@@ -103,11 +107,12 @@ class SafetyAndPrivacyController extends Controller
|
||||
foreach ($request->judiciary_document as $index => $file) {
|
||||
$judiciary_document[] = FileFacade::save($file, "safety_and_privacy/{$safetyAndPrivacy->id}/judiciary_document");
|
||||
}
|
||||
$step = SafetyAndPrivacySteps::MOSTANADAT_GAZAEI->value;
|
||||
$safetyAndPrivacy->update([
|
||||
'judiciary_document' => serialize($judiciary_document),
|
||||
'judiciary_document_upload_date' => now(),
|
||||
'step' => SafetyAndPrivacySteps::MOSTANADAT_GAZAEI->value,
|
||||
'step_fa' => SafetyAndPrivacySteps::name(2),
|
||||
'step_fa' => SafetyAndPrivacySteps::name($step),
|
||||
]);
|
||||
|
||||
$user->addActivityComplete(1135);
|
||||
@@ -121,9 +126,10 @@ class SafetyAndPrivacyController extends Controller
|
||||
$user = auth()->user();
|
||||
|
||||
DB::transaction(function () use ($request, $safetyAndPrivacy, $user) {
|
||||
$step = SafetyAndPrivacySteps::BARKHORD->value;
|
||||
$safetyAndPrivacy->update([
|
||||
'step' => SafetyAndPrivacySteps::BARKHORD->value,
|
||||
'step_fa' => SafetyAndPrivacySteps::name(3),
|
||||
'step_fa' => SafetyAndPrivacySteps::name($step),
|
||||
'action_picture' => FileFacade::save($request->action_picture, "safety_and_privacy/{$safetyAndPrivacy->id}/action_picture"),
|
||||
'action_picture_document_upload_date' => now(),
|
||||
'action_date' => $request->action_date,
|
||||
@@ -200,20 +206,19 @@ class SafetyAndPrivacyController extends Controller
|
||||
));
|
||||
}
|
||||
|
||||
public function confirm(Request $request, SafetyAndPrivacy $safetyAndPrivacy): JsonResponse
|
||||
public function confirm(SafetyAndPrivacy $safetyAndPrivacy): JsonResponse
|
||||
{
|
||||
$status_id = SafetyAndPrivacyStatus::CONFIRM->value;
|
||||
|
||||
$safetyAndPrivacy->update([
|
||||
'status' => SafetyAndPrivacyStatus::CONFIRM->value,
|
||||
'status_fa' => SafetyAndPrivacyStatus::name($status_id),
|
||||
'supervisor_description' => $request->supervisor_description
|
||||
]);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function reject(Request $request, SafetyAndPrivacy $safetyAndPrivacy): JsonResponse
|
||||
public function reject(RejectRequest $request, SafetyAndPrivacy $safetyAndPrivacy): JsonResponse
|
||||
{
|
||||
$status_id = SafetyAndPrivacyStatus::REJECT->value;
|
||||
|
||||
@@ -226,7 +231,7 @@ class SafetyAndPrivacyController extends Controller
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function finish(Request $request, SafetyAndPrivacy $safetyAndPrivacy): JsonResponse
|
||||
public function finish(FinishRequest $request, SafetyAndPrivacy $safetyAndPrivacy): JsonResponse
|
||||
{
|
||||
$status_id = SafetyAndPrivacyStatus::PENDING->value;
|
||||
|
||||
|
||||
28
app/Http/Requests/V3/SafetyAndPrivacy/FinishRequest.php
Normal file
28
app/Http/Requests/V3/SafetyAndPrivacy/FinishRequest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\SafetyAndPrivacy;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class FinishRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'final_description' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
||||
28
app/Http/Requests/V3/SafetyAndPrivacy/RejectRequest.php
Normal file
28
app/Http/Requests/V3/SafetyAndPrivacy/RejectRequest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\SafetyAndPrivacy;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class RejectRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'supervisor_description' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -22,10 +22,10 @@ class SafetyAndPrivacyTableService
|
||||
{
|
||||
$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', 'province_fa', 'edare_shahri_name',
|
||||
'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'
|
||||
];
|
||||
|
||||
if ($user->hasPermissionTo('show-safety-and-privacy-operator-cartable')) {
|
||||
|
||||
@@ -337,7 +337,7 @@ Route::prefix('safety_and_privacy')
|
||||
->name('SafetyAndPrivacy.')
|
||||
->controller(SafetyAndPrivacyController::class)
|
||||
->group(function () {
|
||||
Route::get('/', 'operatorIndex')->name('operatorIndex')->middleware('permission:show-safety-and-privacy-operator-cartable|show-safety-and-privacy-operator-cartable-province|show-safety-and-privacy-operator-cartable-edarate-shahri');
|
||||
Route::get('/operator_index', 'operatorIndex')->name('operatorIndex')->middleware('permission:show-safety-and-privacy-operator-cartable|show-safety-and-privacy-operator-cartable-province|show-safety-and-privacy-operator-cartable-edarate-shahri');
|
||||
Route::get('/excel_report', 'excelReport')->name('excelReport')->middleware('permission:show-safety-and-privacy-operator-cartable|show-safety-and-privacy-operator-cartable-province|show-safety-and-privacy-operator-cartable-edarate-shahri');
|
||||
Route::post('/first_step_store', 'firstStepStore')->name('firstStepStore')
|
||||
->middleware(['validate-store-access', 'permission:add-safety-and-privacy']);
|
||||
|
||||
Reference in New Issue
Block a user