diff --git a/app/Exports/V3/SafetyAndPrivacy/CartableReport.php b/app/Exports/V3/SafetyAndPrivacy/OperatorCartableReport.php similarity index 91% rename from app/Exports/V3/SafetyAndPrivacy/CartableReport.php rename to app/Exports/V3/SafetyAndPrivacy/OperatorCartableReport.php index 6c066aa1..81137eea 100644 --- a/app/Exports/V3/SafetyAndPrivacy/CartableReport.php +++ b/app/Exports/V3/SafetyAndPrivacy/OperatorCartableReport.php @@ -12,13 +12,13 @@ use Maatwebsite\Excel\Events\AfterSheet; use PhpOffice\PhpSpreadsheet\Worksheet\Drawing; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; -class CartableReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings +class OperatorCartableReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings { public function __construct(private ?Collection $data){} public function view(): View { - return view('v3.Reports.SafetyAndPrivacy.CartableReport', [ + return view('v3.Reports.SafetyAndPrivacy.OperatorCartableReport', [ 'data' => $this->data, ]); } diff --git a/app/Exports/V3/SafetyAndPrivacy/SupervisorCartableReport.php b/app/Exports/V3/SafetyAndPrivacy/SupervisorCartableReport.php new file mode 100644 index 00000000..cf712aaf --- /dev/null +++ b/app/Exports/V3/SafetyAndPrivacy/SupervisorCartableReport.php @@ -0,0 +1,69 @@ + $this->data, + ]); + } + + public function registerEvents(): array + { + return [ + AfterSheet::class => function (AfterSheet $event) { + $event->sheet->getDelegate()->setRightToLeft(true); + }, + ]; + } + + public function drawings(): array + { + $drawing = new Drawing(); + $drawing->setName('Logo'); + $drawing->setDescription('This is my logo'); + $drawing->setPath(public_path('/dist/logo.png')); + $drawing->setWidth(50); + $drawing->setHeight(50); + $drawing->setOffsetX(5); + $drawing->setOffsetY(5); + $drawing->setCoordinates('A1'); + + $drawing2 = new Drawing(); + $drawing2->setName('Logo'); + $drawing2->setDescription('This is my logo'); + $drawing2->setPath(public_path('/dist/141icon.png')); + $drawing2->setWidth(50); + $drawing2->setHeight(50); + $drawing2->setOffsetX(5); + $drawing2->setOffsetY(5); + $drawing2->setCoordinates('B1'); + return [$drawing, $drawing2]; + } + + public function styles(Worksheet $sheet): array + { + return [ + 'A:BA' => [ + 'font' => [ + 'name' => 'B Nazanin' + ] + ], + ]; + } +} \ No newline at end of file diff --git a/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacyController.php b/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacyController.php index c89b5842..89d9324c 100644 --- a/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacyController.php +++ b/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacyController.php @@ -5,7 +5,8 @@ namespace App\Http\Controllers\V3\Dashboard; use App\Enums\AxisTypes; use App\Enums\SafetyAndPrivacyStatus; use App\Enums\SafetyAndPrivacySteps; -use App\Exports\V3\SafetyAndPrivacy\CartableReport; +use App\Exports\V3\SafetyAndPrivacy\OperatorCartableReport; +use App\Exports\V3\SafetyAndPrivacy\SupervisorCartableReport; use App\Facades\DataTable\DataTableFacade; use App\Facades\File\FileFacade; use App\Http\Controllers\Controller; @@ -43,11 +44,11 @@ class SafetyAndPrivacyController extends Controller /** * @throws Throwable */ - public function excelReport(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse + public function operatorExcelReport(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse { $name = 'گزارش از نگهداری حریم راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx'; $data = $safetyAndPrivacyTableService->operatorDatatable($request); - return Excel::download(new CartableReport($data['data']), $name); + return Excel::download(new OperatorCartableReport($data['data']), $name); } public function firstStepStore(FirstStepStoreRequest $request, NominatimService $nominatimService): JsonResponse @@ -111,7 +112,7 @@ class SafetyAndPrivacyController extends Controller $safetyAndPrivacy->update([ 'judiciary_document' => serialize($judiciary_document), 'judiciary_document_upload_date' => now(), - 'step' => SafetyAndPrivacySteps::MOSTANADAT_GAZAEI->value, + 'step' => $step, 'step_fa' => SafetyAndPrivacySteps::name($step), ]); @@ -128,7 +129,7 @@ class SafetyAndPrivacyController extends Controller DB::transaction(function () use ($request, $safetyAndPrivacy, $user) { $step = SafetyAndPrivacySteps::BARKHORD->value; $safetyAndPrivacy->update([ - 'step' => SafetyAndPrivacySteps::BARKHORD->value, + '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(), @@ -249,4 +250,11 @@ class SafetyAndPrivacyController extends Controller { return response()->json($safetyAndPrivacyTableService->supervisorDataTable($request)); } + + public function supervisorExcelReport(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); + } } diff --git a/resources/views/v3/Reports/SafetyAndPrivacy/CartableReport.blade.php b/resources/views/v3/Reports/SafetyAndPrivacy/OperatorCartableReport.blade.php similarity index 100% rename from resources/views/v3/Reports/SafetyAndPrivacy/CartableReport.blade.php rename to resources/views/v3/Reports/SafetyAndPrivacy/OperatorCartableReport.blade.php diff --git a/resources/views/v3/Reports/SafetyAndPrivacy/SupervisorCartableReport.blade.php b/resources/views/v3/Reports/SafetyAndPrivacy/SupervisorCartableReport.blade.php new file mode 100644 index 00000000..c1065678 --- /dev/null +++ b/resources/views/v3/Reports/SafetyAndPrivacy/SupervisorCartableReport.blade.php @@ -0,0 +1,109 @@ + + + + + + + + فعالیت های نگهداری حریم راه + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @foreach ($data as $item) + + + + + + + + + + + + + + + + @endforeach + +
+ تاریخ دریافت گزارش: {{ verta()->now()->format('Y/m/d H:i') }} +
+
+ گزارش فعالیت های نگهداری حریم راه +
+ کد یکتا + + استان + + اداره + + مورد مشاهده شده + + نوع محور + + تاریخ ثبت + + تاریخ بازدید + + تاریخ بارگذاری مستندات قضایی + + تاریخ اقدام + + وضعیت +
{{ $item['id'] ?? '-' }}{{ $item['province_fa'] ?? '-' }}{{ $item['edare_shahri_name'] ?? '-' }}{{ $item['info_fa'] ?? '-' }}{{ $item['axis_type_name'] ?? '-' }}{{ $item['created_at'] ? verta($item['created_at'])->format('Y/n/j H:i:s') : '-' }}{{ $item['activity_date_time'] ? verta($item['activity_date_time'])->format('Y/n/j H:i:s') : '-' }} + {{ $item['judiciary_document_upload_date'] && $item['judiciary_document_upload_date'] != '0000-00-00 00:00:00' ? verta($item['judiciary_document_upload_date'])->format('Y/n/j H:i:s') : '-' }} + + {{ $item['action_picture_document_upload_date'] ? verta($item['action_date'])->format('Y/n/j H:i:s') : '-' }} + {{ $item['step_fa'] ?? '-' }}
+ + diff --git a/routes/v3.php b/routes/v3.php index 55ab1d3f..9bb08728 100644 --- a/routes/v3.php +++ b/routes/v3.php @@ -337,8 +337,12 @@ Route::prefix('safety_and_privacy') ->name('SafetyAndPrivacy.') ->controller(SafetyAndPrivacyController::class) ->group(function () { - 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::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('/supervisor_index', 'supervisorIndex')->name('supervisorIndex') + ->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_excel_report', 'operatorExcelReport')->name('operatorExcelReport') + ->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']); @@ -350,6 +354,9 @@ Route::prefix('safety_and_privacy') Route::get('/{safetyAndPrivacy}', 'show')->name('show'); Route::delete('/{safetyAndPrivacy}', 'destroy')->name('destroy')->middleware('permission:delete-safety-and-privacy'); Route::get('/deserialize/{safetyAndPrivacy}', 'deserialize')->name('deserialize'); + Route::post('/confirm/{safetyAndPrivacy}', 'confirm')->name('confirm'); + Route::post('/reject/{safetyAndPrivacy}', 'reject')->name('reject'); + Route::post('/finish/{safetyAndPrivacy}', 'finish')->name('finish'); }); Route::prefix('safety_and_privacy_report')