Merge branch 'feature/SafetyReport' into 'develop'

Feature/safety report

See merge request witelgroup/rms_v2!107
This commit is contained in:
2025-05-12 05:28:37 +00:00
10 changed files with 507 additions and 70 deletions

View File

@@ -0,0 +1,231 @@
<?php
namespace App\Http\Controllers\V3\Dashboard\SafetyAndPrivacy;
use App\Enums\AxisTypes;
use App\Enums\SafetyAndPrivacyStatus;
use App\Enums\SafetyAndPrivacySteps;
use App\Exports\V3\SafetyAndPrivacy\OperatorCartableReport;
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\FirstStepStoreRequest;
use App\Http\Requests\V3\SafetyAndPrivacy\SecondStepStoreRequest;
use App\Http\Requests\V3\SafetyAndPrivacy\ThirdStepStoreRequest;
use App\Http\Requests\V3\SafetyAndPrivacy\UpdateRequest;
use App\Http\Traits\ApiResponse;
use App\Models\InfoItem;
use App\Models\SafetyAndPrivacy;
use App\Services\Cartables\SafetyAndPrivacyTableService;
use App\Services\NominatimService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
use Maatwebsite\Excel\Facades\Excel;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Throwable;
class OperatorController extends Controller
{
use ApiResponse;
/**
* @throws Throwable
*/
public function index(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): JsonResponse
{
return response()->json($safetyAndPrivacyTableService->operatorDatatable($request));
}
/**
* @throws Throwable
*/
public function excelReport(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse
{
$name = 'گزارش از نگهداری حریم راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
$data = $safetyAndPrivacyTableService->operatorDatatable($request);
return Excel::download(new OperatorCartableReport($data['data']), $name);
}
public function firstStepStore(FirstStepStoreRequest $request, NominatimService $nominatimService): JsonResponse
{
$user = auth()->user();
$coordinates = explode(',', $request->point);
$item = InfoItem::query()
->where('id', $request->info_id)
->where('item', 17)
->firstOrFail();
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],
'operator_id' => $user->id,
'operator_name' => $user->name,
'province_id' => $user->province_id,
'province_fa' => $user->province_fa,
'info_id' => $item->id,
'info_fa' => $item->sub_item_str,
'city_id' => $user->city_id,
'city_fa' => $user->city_fa,
'activity_date_time' => $request->activity_date." ".$request->activity_time,
'edare_shahri_id' => $user->edarate_shahri_id,
'edare_shahri_name' => $user->edarate_shahri_name,
'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' => $step,
'step_fa' => SafetyAndPrivacySteps::name($step),
'is_finished' => false,
]);
$safety_and_privacy->recognize_picture = $request->has('recognize_picture') ?
FileFacade::save($request->recognize_picture, "safety_and_privacy/{$safety_and_privacy->id}") :
null;
$safety_and_privacy->save();
$user->addActivityComplete(1134);
});
return $this->successResponse();
}
public function secondStepStore(SafetyAndPrivacy $safetyAndPrivacy, SecondStepStoreRequest $request): JsonResponse
{
$user = auth()->user();
DB::transaction(function () use ($request, $safetyAndPrivacy, $user) {
$need_judiciary = $request->need_judiciary;
$judiciary_document = [];
if ($need_judiciary) {
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([
'step' => $step,
'step_fa' => SafetyAndPrivacySteps::name($step),
'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);
});
return $this->successResponse();
}
public function thirdStepStore(SafetyAndPrivacy $safetyAndPrivacy, ThirdStepStoreRequest $request): JsonResponse
{
$user = auth()->user();
DB::transaction(function () use ($request, $safetyAndPrivacy, $user) {
$step = SafetyAndPrivacySteps::BARKHORD->value;
$safetyAndPrivacy->update([
'step' => $step,
'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,
'is_finished' => true,
'final_description' => 'پیام سیستمی : این عملیات پس از طی تمامی گام ها خاتمه یافت'
]);
$user->addActivityComplete(1136);
});
return $this->successResponse();
}
public function update(SafetyAndPrivacy $safetyAndPrivacy, UpdateRequest $request): JsonResponse
{
DB::transaction(function () use ($request, $safetyAndPrivacy) {
$safetyAndPrivacy->update([
'axis_type_id' => $request->axis_type_id,
'axis_type_name' => AxisTypes::name($request->axis_type_id),
]);
auth()->user()->addActivityComplete(1168);
});
return $this->successResponse();
}
public function show(SafetyAndPrivacy $safetyAndPrivacy): JsonResponse
{
return $this->successResponse($safetyAndPrivacy);
}
public function destroy(SafetyAndPrivacy $safetyAndPrivacy): JsonResponse
{
FileFacade::deleteDirectory("safety_and_privacy/{$safetyAndPrivacy->id}");
DB::transaction(function () use ($safetyAndPrivacy)
{
auth()->user()->addActivityComplete(1155);
$safetyAndPrivacy->delete();
});
return $this->successResponse();
}
public function deserialize(SafetyAndPrivacy $safetyAndPrivacy): JsonResponse
{
$judiciaries = $safetyAndPrivacy->judiciary_document ? unserialize($safetyAndPrivacy->judiciary_document) : [];
$result = [];
foreach ($judiciaries as $judiciary) {
$result[] = Storage::disk('public')->url($judiciary);
}
return $this->successResponse($result);
}
public function subItems(): JsonResponse
{
return $this->successResponse(InfoItem::query()
->where('item', '=', 17)
->select('id', 'item', 'item_str', 'sub_item_str as name', 'sub_item_unit as unit', 'needs_image', 'needs_end_point', 'sub_item')
->get());
}
public function finish(FinishRequest $request, SafetyAndPrivacy $safetyAndPrivacy): JsonResponse
{
$status_id = SafetyAndPrivacyStatus::PENDING->value;
$safetyAndPrivacy->update([
'is_finished' => 1,
'final_description' => $request->final_description,
'status' => $status_id,
'status_fa' => SafetyAndPrivacyStatus::name($status_id),
]);
return $this->successResponse();
}
public function map(Request $request): JsonResponse
{
return response()->json(DataTableFacade::run(
SafetyAndPrivacy::query(),
$request,
allowedFilters: ['*'],
allowedSortings: ['*'],
allowedSelects: ['id', 'lat', 'lon', 'step']
));
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace App\Http\Controllers\V3\Dashboard\SafetyAndPrivacy;
use App\Exports\V3\SafetyAndPrivacy\CountryActivityReport;
use App\Exports\V3\SafetyAndPrivacy\ProvinceActivityReport;
use App\Http\Controllers\Controller;
use App\Http\Traits\ApiResponse;
use App\Models\EdarateShahri;
use App\Models\Province;
use App\Services\Cartables\SafetyAndPrivacyTableService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Maatwebsite\Excel\Facades\Excel;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
class OperatorReportController extends Controller
{
use ApiResponse;
public function countryActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): JsonResponse
{
$data = $safetyAndPrivacyTableService->countryActivity($request);
return $this->successResponse([
'activities' => $data,
'provinces' => Province::all(['id', 'name_fa'])
]);
}
public function provinceActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): JsonResponse
{
$data = $safetyAndPrivacyTableService->provinceActivity($request);
return $this->successResponse([
'activities' => $data,
'edarateShahri' => EdarateShahri::query()->where('province_id', '=', $request->province_id)->get(['id', 'name_fa']),
]);
}
public function countryExcelActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse
{
$data = $safetyAndPrivacyTableService->countryActivity($request);
$name = 'گزارش از نگهداری حریم راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
return Excel::download(new CountryActivityReport($data), $name);
}
public function provinceExcelActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse
{
$data = $safetyAndPrivacyTableService->provinceActivity($request);
$name = 'گزارش از نگهداری حریم راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
return Excel::download(new ProvinceActivityReport($data, $request), $name);
}
}

View File

@@ -0,0 +1,69 @@
<?php
namespace App\Http\Controllers\V3\Dashboard\SafetyAndPrivacy;
use App\Enums\SafetyAndPrivacyStatus;
use App\Exports\V3\SafetyAndPrivacy\SupervisorCartableReport;
use App\Http\Controllers\Controller;
use App\Http\Requests\V3\SafetyAndPrivacy\RejectRequest;
use App\Http\Traits\ApiResponse;
use App\Models\SafetyAndPrivacy;
use App\Services\Cartables\SafetyAndPrivacyTableService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Maatwebsite\Excel\Facades\Excel;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Throwable;
class SupervisorController extends Controller
{
use ApiResponse;
/**
* @throws Throwable
*/
public function index(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): JsonResponse
{
return response()->json($safetyAndPrivacyTableService->supervisorDataTable($request));
}
/**
* @throws Throwable
*/
public function excelReport(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse
{
$name = 'گزارش از نگهداری حریم راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
$data = $safetyAndPrivacyTableService->supervisorDataTable($request);
return Excel::download(new SupervisorCartableReport($data['data']), $name);
}
public function confirm(SafetyAndPrivacy $safetyAndPrivacy, Request $request): JsonResponse
{
$status_id = SafetyAndPrivacyStatus::CONFIRM->value;
$safetyAndPrivacy->update([
'status' => $status_id,
'status_fa' => SafetyAndPrivacyStatus::name($status_id),
'supervisor_description' => $request->supervisor_description,
'supervisor_id' => auth()->user()->id,
'supervisor_name' => auth()->user()->name,
]);
return $this->successResponse();
}
public function reject(RejectRequest $request, SafetyAndPrivacy $safetyAndPrivacy): JsonResponse
{
$status_id = SafetyAndPrivacyStatus::REJECT->value;
$safetyAndPrivacy->update([
'status' => $status_id,
'status_fa' => SafetyAndPrivacyStatus::name($status_id),
'supervisor_description' => $request->supervisor_description,
'supervisor_id' => auth()->user()->id,
'supervisor_name' => auth()->user()->name,
]);
return $this->successResponse();
}
}

View File

@@ -0,0 +1,56 @@
<?php
namespace App\Http\Controllers\V3\Dashboard\SafetyAndPrivacy;
use App\Enums\SafetyAndPrivacyStatus;
use App\Exports\V3\SafetyAndPrivacy\CountryActivityReport;
use App\Exports\V3\SafetyAndPrivacy\ProvinceActivityReport;
use App\Exports\V3\SafetyAndPrivacy\SupervisorCartableReport;
use App\Http\Controllers\Controller;
use App\Http\Requests\V3\SafetyAndPrivacy\RejectRequest;
use App\Http\Traits\ApiResponse;
use App\Models\EdarateShahri;
use App\Models\Province;
use App\Models\SafetyAndPrivacy;
use App\Services\Cartables\SafetyAndPrivacyTableService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Maatwebsite\Excel\Facades\Excel;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
class SupervisorReportController extends Controller
{
use ApiResponse;
public function countryActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): JsonResponse
{
$data = $safetyAndPrivacyTableService->countryActivity($request);
return $this->successResponse([
'activities' => $data,
'provinces' => Province::all(['id', 'name_fa'])
]);
}
public function provinceActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): JsonResponse
{
$data = $safetyAndPrivacyTableService->provinceActivity($request);
return $this->successResponse([
'activities' => $data,
'edarateShahri' => EdarateShahri::query()->where('province_id', '=', $request->province_id)->get(['id', 'name_fa']),
]);
}
public function countryExcelActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse
{
$data = $safetyAndPrivacyTableService->countryActivity($request);
$name = 'گزارش از نگهداری حریم راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
return Excel::download(new CountryActivityReport($data), $name);
}
public function provinceExcelActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse
{
$data = $safetyAndPrivacyTableService->provinceActivity($request);
$name = 'گزارش از نگهداری حریم راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
return Excel::download(new ProvinceActivityReport($data, $request), $name);
}
}

View File

@@ -92,24 +92,21 @@ class NotificationController extends Controller
{ {
$user = auth()->user(); $user = auth()->user();
$safety_and_privacy = array(); $safety_and_privacy = array();
if ($user->hasPermissionTo('show-safety-and-privacy-operator-cartable')) {
$activity = SafetyAndPrivacy::query()
->selectRaw('count(*) as cnt, step')
->groupby('step')
->orderBy('step')
->get();
if ($user->hasPermissionTo('show-safety-and-privacy-operator-cartable')) {
$safety_and_privacy['supervise_cnt'] = SafetyAndPrivacy::query()
->where('is_finished', '=', 1)
->where('status', '=', 0)
->count();
} }
elseif ($user->hasPermissionTo('show-safety-and-privacy-operator-cartable-province')) { elseif ($user->hasPermissionTo('show-safety-and-privacy-operator-cartable-province')) {
throw_if(is_null($user->province_id), new ProhibitedAction('استانی برای شما در سامانه ثبت نشده است!')); throw_if(is_null($user->province_id), new ProhibitedAction('استانی برای شما در سامانه ثبت نشده است!'));
$activity = SafetyAndPrivacy::query() $safety_and_privacy['supervise_cnt'] = SafetyAndPrivacy::query()
->where('province_id', '=', $user->province_id) ->where('province_id', '=', $user->province_id)
->selectRaw('count(*) as cnt, step') ->where('is_finished', '=', 1)
->groupby('step') ->where('status', '=', 0)
->orderBy('step') ->count();
->get();
} }
elseif ($user->hasPermissionTo('show-safety-and-privacy-operator-cartable-edarate-shahri')) { elseif ($user->hasPermissionTo('show-safety-and-privacy-operator-cartable-edarate-shahri')) {
throw_if(is_null($user->edarate_shahri_id), new ProhibitedAction('اداره ای برای شما در سامانه ثبت نشده است!')); throw_if(is_null($user->edarate_shahri_id), new ProhibitedAction('اداره ای برای شما در سامانه ثبت نشده است!'));
@@ -117,17 +114,18 @@ class NotificationController extends Controller
$activity = SafetyAndPrivacy::query() $activity = SafetyAndPrivacy::query()
->where('edare_shahri_id', '=', $user->edarate_shahri_id) ->where('edare_shahri_id', '=', $user->edarate_shahri_id)
->selectRaw('count(*) as cnt, step') ->selectRaw('count(*) as cnt, step')
->where('is_finished', '=', 0)
->groupby('step') ->groupby('step')
->orderBy('step') ->orderBy('step')
->get(); ->get();
$step_one = $activity->where('step', '=', 1)->first();
$step_two = $activity->where('step', '=', 2)->first();
$safety_and_privacy['step_one'] = $step_one->cnt ?? 0;
$safety_and_privacy['step_two'] = $step_two->cnt ?? 0;
} }
$step_one = $activity->where('step', '=', 1)->first();
$step_two = $activity->where('step', '=', 2)->first();
$safety_and_privacy['step_one'] = $step_one->cnt ?? 0;
$safety_and_privacy['step_two'] = $step_two->cnt ?? 0;
return $safety_and_privacy; return $safety_and_privacy;
} }

View File

@@ -23,7 +23,8 @@ class SecondStepStoreRequest extends FormRequest
{ {
return [ return [
'need_judiciary' => 'required|boolean', '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', 'judiciary_document.*' => 'file',
]; ];
} }

View File

@@ -42,7 +42,10 @@ class SafetyAndPrivacy extends Model
'is_finished', 'is_finished',
'supervisor_description', 'supervisor_description',
'status_fa', 'status_fa',
'need_judiciary' 'need_judiciary',
'operator_description',
'supervisor_name',
'supervisor_id'
]; ];
public $table = "safety_and_privacy"; public $table = "safety_and_privacy";

View File

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

View File

@@ -15,9 +15,12 @@ return new class extends Migration
$table->boolean('is_finished')->nullable(); $table->boolean('is_finished')->nullable();
$table->integer('status')->nullable(); $table->integer('status')->nullable();
$table->string('status_fa')->nullable(); $table->string('status_fa')->nullable();
$table->string('operator_description')->nullable();
$table->string('supervisor_description')->nullable(); $table->string('supervisor_description')->nullable();
$table->string('final_description')->nullable(); $table->string('final_description')->nullable();
$table->boolean('need_judiciary')->nullable(); $table->boolean('need_judiciary')->nullable();
$table->integer('supervisor_id')->nullable();
$table->string('supervisor_name')->nullable();
$table->text('judiciary_document')->nullable()->change(); $table->text('judiciary_document')->nullable()->change();
$table->dateTime('judiciary_document_upload_date')->nullable()->change(); $table->dateTime('judiciary_document_upload_date')->nullable()->change();
}); });
@@ -29,7 +32,11 @@ return new class extends Migration
public function down(): void public function down(): void
{ {
Schema::table('safety_and_privacy', function (Blueprint $table) { Schema::table('safety_and_privacy', function (Blueprint $table) {
$table->dropColumn(['status', 'final_description', 'is_finished', 'supervisor_description', 'status_fa', 'need_judiciary']); $table->dropColumn([
'status', 'final_description', 'is_finished',
'supervisor_description', 'status_fa', 'need_judiciary',
'operator_description', 'supervisor_name', 'supervisor_id',
]);
$table->text('judiciary_document')->change(); $table->text('judiciary_document')->change();
$table->dateTime('judiciary_document_upload_date')->change(); $table->dateTime('judiciary_document_upload_date')->change();
}); });

View File

@@ -18,7 +18,10 @@ use App\Http\Controllers\V3\Dashboard\Reports\SafetyAndPrivacyReportController;
use App\Http\Controllers\V3\Dashboard\RoadItemsProjectController; use App\Http\Controllers\V3\Dashboard\RoadItemsProjectController;
use App\Http\Controllers\V3\Dashboard\RoadObservationController; use App\Http\Controllers\V3\Dashboard\RoadObservationController;
use App\Http\Controllers\V3\Dashboard\RoadPatrolProjectController; use App\Http\Controllers\V3\Dashboard\RoadPatrolProjectController;
use App\Http\Controllers\V3\Dashboard\SafetyAndPrivacyController; use App\Http\Controllers\V3\Dashboard\SafetyAndPrivacy\OperatorController;
use App\Http\Controllers\V3\Dashboard\SafetyAndPrivacy\OperatorReportController;
use App\Http\Controllers\V3\Dashboard\SafetyAndPrivacy\SupervisorController;
use App\Http\Controllers\V3\Dashboard\SafetyAndPrivacy\SupervisorReportController;
use App\Http\Controllers\V3\FMSVehicleManagementController; use App\Http\Controllers\V3\FMSVehicleManagementController;
use App\Http\Controllers\V3\Harim\DivarkeshiController; use App\Http\Controllers\V3\Harim\DivarkeshiController;
use App\Http\Controllers\V3\LogListManagementController; use App\Http\Controllers\V3\LogListManagementController;
@@ -335,39 +338,58 @@ Route::prefix('log_list')
Route::prefix('safety_and_privacy') Route::prefix('safety_and_privacy')
->name('SafetyAndPrivacy.') ->name('SafetyAndPrivacy.')
->controller(SafetyAndPrivacyController::class)
->group(function () { ->group(function () {
Route::get('/operator_index', 'operatorIndex')->name('operatorIndex') Route::name('operator.')
->middleware('permission:show-safety-and-privacy-operator-cartable-edarate-shahri'); ->controller(OperatorController::class)
Route::get('/supervisor_index', 'supervisorIndex')->name('supervisorIndex') ->group(function () {
->middleware('permission:show-safety-and-privacy-operator-cartable|show-safety-and-privacy-operator-cartable-province'); Route::get('operator', 'index')->name('index')
Route::get('/operator_excel_report', 'operatorExcelReport')->name('operatorExcelReport') ->middleware('permission:show-safety-and-privacy-operator-cartable-edarate-shahri');
->middleware('permission:show-safety-and-privacy-operator-cartable-edarate-shahri'); Route::get('operator/excel_report', 'excelReport')->name('excelReport')
Route::get('/supervisor_excel_report', 'supervisorExcelReport')->name('supervisorExcelReport') ->middleware('permission:show-safety-and-privacy-operator-cartable-edarate-shahri');
->middleware('permission:show-safety-and-privacy-operator-cartable|show-safety-and-privacy-operator-cartable-province'); Route::post('operator/first_step_store', 'firstStepStore')->name('firstStepStore')->middleware(['validate-store-access', 'permission:add-safety-and-privacy']);
Route::get('/sub_items', 'subItems')->name('subItems');
Route::get('/map', 'map')->name('map');
Route::post('operator/second_step_store/{safetyAndPrivacy}', 'secondStepStore')->name('secondStepStore')->middleware(['validate-store-access','permission:add-safety-and-privacy']);
Route::post('operator/third_step_store/{safetyAndPrivacy}', 'thirdStepStore')->name('thirdStepStore')->middleware(['validate-store-access','permission:add-safety-and-privacy']);
Route::post('operator/{safetyAndPrivacy}', 'update')->name('update')->middleware('permission:update-safety-and-privacy');
Route::get('operator/{safetyAndPrivacy}', 'show')->name('show');
Route::delete('operator/{safetyAndPrivacy}', 'destroy')->name('destroy')->middleware('permission:delete-safety-and-privacy');
Route::get('/deserialize/{safetyAndPrivacy}', 'deserialize')->name('deserialize');
Route::post('operator/finish/{safetyAndPrivacy}', 'finish')->name('finish');
});
Route::post('/first_step_store', 'firstStepStore')->name('firstStepStore')->middleware(['validate-store-access', 'permission:add-safety-and-privacy']); Route::prefix('supervisor')
Route::get('/sub_items', 'subItems')->name('subItems'); ->name('supervisor.')
Route::get('/map', 'map')->name('map'); ->controller(SupervisorController::class)
Route::post('/second_step_store/{safetyAndPrivacy}', 'secondStepStore')->name('secondStepStore')->middleware(['validate-store-access','permission:add-safety-and-privacy']); ->group(function () {
Route::post('/third_step_store/{safetyAndPrivacy}', 'thirdStepStore')->name('thirdStepStore')->middleware(['validate-store-access','permission:add-safety-and-privacy']); Route::get('/', 'index')->name('index')
Route::post('/{safetyAndPrivacy}', 'update')->name('update')->middleware('permission:update-safety-and-privacy'); ->middleware('permission:show-safety-and-privacy-operator-cartable|show-safety-and-privacy-operator-cartable-province');
Route::get('/{safetyAndPrivacy}', 'show')->name('show'); Route::get('/excel_report', 'excelReport')->name('excelReport')
Route::delete('/{safetyAndPrivacy}', 'destroy')->name('destroy')->middleware('permission:delete-safety-and-privacy'); ->middleware('permission:show-safety-and-privacy-operator-cartable|show-safety-and-privacy-operator-cartable-province');
Route::get('/deserialize/{safetyAndPrivacy}', 'deserialize')->name('deserialize'); Route::post('/confirm/{safetyAndPrivacy}', 'confirm')->name('confirm');
Route::post('/confirm/{safetyAndPrivacy}', 'confirm')->name('confirm'); Route::post('/reject/{safetyAndPrivacy}', 'reject')->name('reject');
Route::post('/reject/{safetyAndPrivacy}', 'reject')->name('reject'); });
Route::post('/finish/{safetyAndPrivacy}', 'finish')->name('finish');
}); });
Route::prefix('safety_and_privacy_report') Route::prefix('safety_and_privacy_report')
->name('SafetyAndPrivacyReport.') ->name('SafetyAndPrivacyReport.')
->controller(SafetyAndPrivacyReportController::class)
->group(function () { ->group(function () {
Route::get('/country_activity', 'countryActivity')->name('countryActivity'); Route::prefix('operator')
Route::get('/province_activity', 'provinceActivity')->name('provinceActivity'); ->name('operator.')
Route::get('/country_excel_activity', 'countryExcelActivity')->name('countryExcelActivity'); ->controller(OperatorReportController::class)
Route::get('/province_excel_activity', 'provinceExcelActivity')->name('provinceExcelActivity'); ->group(function () {
Route::get('/country_activity', 'countryActivity')->name('countryActivity');
Route::get('/province_activity', 'provinceActivity')->name('provinceActivity');
Route::get('/country_excel_activity', 'countryExcelActivity')->name('countryExcelActivity');
Route::get('/province_excel_activity', 'provinceExcelActivity')->name('provinceExcelActivity');
});
Route::prefix('supervisor')
->name('supervisor.')
->controller(SupervisorReportController::class)
->group(function () {
});
}); });
Route::prefix('otp') Route::prefix('otp')