Merge branch 'feature/SafetyAndPrivacy' into 'develop'
Feature/safety and privacy See merge request witelgroup/rms_v2!84
This commit is contained in:
26
app/Enums/AxisTypes.php
Normal file
26
app/Enums/AxisTypes.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Enums;
|
||||||
|
|
||||||
|
enum AxisTypes: int
|
||||||
|
{
|
||||||
|
case AZADRAH= 1;
|
||||||
|
case BOZORGRAH = 2;
|
||||||
|
case ASLI = 3;
|
||||||
|
|
||||||
|
case FARYI = 4;
|
||||||
|
case ROSTAYI = 5;
|
||||||
|
|
||||||
|
public static function name(int $state): string
|
||||||
|
{
|
||||||
|
$mapArray = [
|
||||||
|
1 => 'آزادراه',
|
||||||
|
2 => 'بزرگراه',
|
||||||
|
3 => 'اصلی',
|
||||||
|
4 => 'فرعی',
|
||||||
|
5 => 'روستایی',
|
||||||
|
];
|
||||||
|
|
||||||
|
return $mapArray[$state];
|
||||||
|
}
|
||||||
|
}
|
||||||
69
app/Exports/V3/SafetyAndPrivacy/CartableReport.php
Normal file
69
app/Exports/V3/SafetyAndPrivacy/CartableReport.php
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Exports\V3\SafetyAndPrivacy;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\View\View;
|
||||||
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
|
use Maatwebsite\Excel\Concerns\FromView;
|
||||||
|
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||||
|
use Maatwebsite\Excel\Concerns\WithDrawings;
|
||||||
|
use Maatwebsite\Excel\Concerns\WithEvents;
|
||||||
|
use Maatwebsite\Excel\Events\AfterSheet;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||||
|
|
||||||
|
class CartableReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
|
||||||
|
{
|
||||||
|
public function __construct(private ?Collection $data){}
|
||||||
|
|
||||||
|
public function view(): View
|
||||||
|
{
|
||||||
|
return view('v3.Reports.SafetyAndPrivacy.CartableReport', [
|
||||||
|
'data' => $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'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
78
app/Exports/V3/SafetyAndPrivacy/CountryActivityReport.php
Normal file
78
app/Exports/V3/SafetyAndPrivacy/CountryActivityReport.php
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Exports\V3\SafetyAndPrivacy;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\View\View;
|
||||||
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
|
use Maatwebsite\Excel\Concerns\FromView;
|
||||||
|
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||||
|
use Maatwebsite\Excel\Concerns\WithDrawings;
|
||||||
|
use Maatwebsite\Excel\Concerns\WithEvents;
|
||||||
|
use Maatwebsite\Excel\Events\AfterSheet;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||||
|
|
||||||
|
class CountryActivityReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
|
||||||
|
{
|
||||||
|
public function __construct(private array $data){}
|
||||||
|
|
||||||
|
public function view(): View
|
||||||
|
{
|
||||||
|
$data = $this->data;
|
||||||
|
$existedProvinces = array_keys($data['activities']);
|
||||||
|
|
||||||
|
foreach (\App\Models\Province::all() as $value) {
|
||||||
|
$provinceId = $value->id;
|
||||||
|
|
||||||
|
if (!array_key_exists($provinceId, $existedProvinces)) {
|
||||||
|
$data['activities'][] = (object) [
|
||||||
|
'province_id' => $provinceId,
|
||||||
|
'name_fa' => $value->name_fa,
|
||||||
|
'sum' => 0,
|
||||||
|
'89' => ['1' => 0, '2' => 0, '3' => 0],
|
||||||
|
'90' => ['1' => 0, '2' => 0, '3' => 0],
|
||||||
|
'91' => ['1' => 0, '2' => 0, '3' => 0],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('v3.Reports.SafetyAndPrivacy.CountryActivityReport', [
|
||||||
|
'data' => $data['activities'],
|
||||||
|
'fromDate' => $data['fromDate'],
|
||||||
|
'toDate' => $data['toDate'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
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('K1');
|
||||||
|
return [$drawing, $drawing2];
|
||||||
|
}
|
||||||
|
}
|
||||||
81
app/Exports/V3/SafetyAndPrivacy/ProvinceActivityReport.php
Normal file
81
app/Exports/V3/SafetyAndPrivacy/ProvinceActivityReport.php
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Exports\V3\SafetyAndPrivacy;
|
||||||
|
|
||||||
|
use App\Models\EdarateShahri;
|
||||||
|
use Illuminate\Contracts\View\View;
|
||||||
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Maatwebsite\Excel\Concerns\FromView;
|
||||||
|
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||||
|
use Maatwebsite\Excel\Concerns\WithDrawings;
|
||||||
|
use Maatwebsite\Excel\Concerns\WithEvents;
|
||||||
|
use Maatwebsite\Excel\Events\AfterSheet;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||||
|
|
||||||
|
class ProvinceActivityReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
|
||||||
|
{
|
||||||
|
public function __construct(private array $data, public Request $request){}
|
||||||
|
|
||||||
|
public function view(): View
|
||||||
|
{
|
||||||
|
$data = $this->data;
|
||||||
|
$existedCities = array_keys($data['activities']);
|
||||||
|
$edarat = EdarateShahri::query()->where('province_id', '=', $this->request->province_id)->get(['id', 'name_fa']);
|
||||||
|
|
||||||
|
foreach ($edarat as $value) {
|
||||||
|
$edareId = $value->id;
|
||||||
|
|
||||||
|
if (!array_key_exists($edareId, $existedCities)) {
|
||||||
|
$data['activities'][] = (object) [
|
||||||
|
'edare_shahri_id' => $edareId,
|
||||||
|
'name_fa' => $value->name_fa,
|
||||||
|
'sum' => 0,
|
||||||
|
'89' => ['1' => 0, '2' => 0, '3' => 0],
|
||||||
|
'90' => ['1' => 0, '2' => 0, '3' => 0],
|
||||||
|
'91' => ['1' => 0, '2' => 0, '3' => 0],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('v3.Reports.SafetyAndPrivacy.ProvinceActivityReport', [
|
||||||
|
'data' => $data['activities'],
|
||||||
|
'fromDate' => $data['fromDate'],
|
||||||
|
'toDate' => $data['toDate'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
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('K1');
|
||||||
|
return [$drawing, $drawing2];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,7 +22,7 @@ class ItemsManagementController extends Controller
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSubItems(InfoItem $item): JsonResponse
|
public function getSubItems($item): JsonResponse
|
||||||
{
|
{
|
||||||
return $this->successResponse(
|
return $this->successResponse(
|
||||||
InfoItem::query()
|
InfoItem::query()
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\V3\Dashboard\Reports;
|
||||||
|
|
||||||
|
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 SafetyAndPrivacyReportController extends Controller
|
||||||
|
{
|
||||||
|
use ApiResponse;
|
||||||
|
|
||||||
|
public function countryActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): JsonResponse
|
||||||
|
{
|
||||||
|
$data = $safetyAndPrivacyTableService->countryActivity($request);
|
||||||
|
return $this->successResponse([
|
||||||
|
'activities' => $data['activities'],
|
||||||
|
'provinces' => Province::all(['id', 'name_fa'])
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function provinceActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): JsonResponse
|
||||||
|
{
|
||||||
|
$data = $safetyAndPrivacyTableService->provinceActivity($request);
|
||||||
|
return $this->successResponse([
|
||||||
|
'activities' => $data['activities'],
|
||||||
|
'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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -254,7 +254,9 @@ class RoadObservationController extends Controller
|
|||||||
{
|
{
|
||||||
$data = RoadObservationHistory::query()
|
$data = RoadObservationHistory::query()
|
||||||
->where('id', '=', $roadObserved->id)
|
->where('id', '=', $roadObserved->id)
|
||||||
->where('action', '=', 'refer')->get([
|
->where('action', '=', 'refer')
|
||||||
|
->orderBy('created_at', 'desc')
|
||||||
|
->get([
|
||||||
'created_at', 'description', 'from_edareh', 'to_edareh',
|
'created_at', 'description', 'from_edareh', 'to_edareh',
|
||||||
'from_province', 'to_province', 'user_id'
|
'from_province', 'to_province', 'user_id'
|
||||||
]);
|
]);
|
||||||
|
|||||||
189
app/Http/Controllers/V3/Dashboard/SafetyAndPrivacyController.php
Normal file
189
app/Http/Controllers/V3/Dashboard/SafetyAndPrivacyController.php
Normal file
@@ -0,0 +1,189 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\V3\Dashboard;
|
||||||
|
|
||||||
|
use App\Enums\AxisTypes;
|
||||||
|
use App\Exports\V3\SafetyAndPrivacy\CartableReport;
|
||||||
|
use App\Facades\File\FileFacade;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Http\Requests\V3\SafetyAndPrivacy\FirstStepStoreRequest;
|
||||||
|
use App\Http\Requests\V3\SafetyAndPrivacy\SecondStepStoreRequest;
|
||||||
|
use App\Http\Requests\V3\SafetyAndPrivacy\ThirdStepStoreRequest;
|
||||||
|
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\Auth;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||||
|
|
||||||
|
class SafetyAndPrivacyController extends Controller
|
||||||
|
{
|
||||||
|
use ApiResponse;
|
||||||
|
|
||||||
|
public function index(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): JsonResponse
|
||||||
|
{
|
||||||
|
return response()->json($safetyAndPrivacyTableService->datatable($request));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function excelReport(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse
|
||||||
|
{
|
||||||
|
$name = 'گزارش از نگهداری حریم راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||||
|
$data = $safetyAndPrivacyTableService->datatable($request);
|
||||||
|
return Excel::download(new CartableReport($data['data']), $name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function firstStepStore(FirstStepStoreRequest $request, NominatimService $nominatimService): JsonResponse
|
||||||
|
{
|
||||||
|
$user = auth()->user();
|
||||||
|
|
||||||
|
if ($user->edarate_ostani_id || is_null($user->city_id)) {
|
||||||
|
return $this->errorResponse('امکان ثبت این مورد برای ادارات استانی و ستادی وجود ندارد!');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_null($user->edarate_shahri_id)) {
|
||||||
|
return $this->errorResponse('اداره شهری برای شما در سامانه ثبت نشده است!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$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)
|
||||||
|
{
|
||||||
|
$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' => 1,
|
||||||
|
'step_fa' => 'گام اول (شناسایی)'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$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();
|
||||||
|
|
||||||
|
if ($user->edarate_ostani_id || is_null($user->city_id)) {
|
||||||
|
return $this->errorResponse('امکان ثبت این مورد برای ادارات استانی و ستادی وجود ندارد!');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_null($user->edarate_shahri_id)) {
|
||||||
|
return $this->errorResponse('اداره شهری برای شما در سامانه ثبت نشده است!');
|
||||||
|
}
|
||||||
|
|
||||||
|
DB::transaction(function () use ($request, $safetyAndPrivacy, $user)
|
||||||
|
{
|
||||||
|
$judiciary_document = [];
|
||||||
|
foreach ($request->judiciary_document as $index => $file) {
|
||||||
|
$judiciary_document[] = FileFacade::save($file, "safety_and_privacy/{$safetyAndPrivacy->id}/judiciary_document");
|
||||||
|
}
|
||||||
|
$safetyAndPrivacy->update([
|
||||||
|
'judiciary_document' => serialize($judiciary_document),
|
||||||
|
'judiciary_document_upload_date' => now(),
|
||||||
|
'step' => 2,
|
||||||
|
'step_fa' => 'گام دوم (مستندات قضایی)'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user->addActivityComplete(1135);
|
||||||
|
});
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function thirdStepStore(SafetyAndPrivacy $safetyAndPrivacy, ThirdStepStoreRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
$user = auth()->user();
|
||||||
|
|
||||||
|
if ($user->edarate_ostani_id || is_null($user->city_id)) {
|
||||||
|
return $this->errorResponse('امکان ثبت این مورد برای ادارات استانی و ستادی وجود ندارد!');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_null($user->edarate_shahri_id)) {
|
||||||
|
return $this->errorResponse('اداره شهری برای شما در سامانه ثبت نشده است!');
|
||||||
|
}
|
||||||
|
|
||||||
|
DB::transaction(function () use ($request, $safetyAndPrivacy, $user) {
|
||||||
|
$safetyAndPrivacy->update([
|
||||||
|
'step' => 3,
|
||||||
|
'step_fa' => 'گام سوم (برخورد)',
|
||||||
|
'action_picture' => FileFacade::save($request->action_picture, "safety_and_privacy/{$safetyAndPrivacy->id}/action_picture"),
|
||||||
|
'action_picture_document_upload_date' => now(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user->addActivityComplete(1136);
|
||||||
|
});
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show(SafetyAndPrivacy $safetyAndPrivacy): JsonResponse
|
||||||
|
{
|
||||||
|
return $this->successResponse($safetyAndPrivacy);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(SafetyAndPrivacy $safetyAndPrivacy): JsonResponse
|
||||||
|
{
|
||||||
|
Storage::deleteDirectory("public/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());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\V3\SafetyAndPrivacy;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class FirstStepStoreRequest 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 [
|
||||||
|
'point' => 'required',
|
||||||
|
'info_id' => 'required',
|
||||||
|
'activity_date' => 'required|date_format:Y-m-d',
|
||||||
|
'activity_time' => 'required|date_format:H:i',
|
||||||
|
'recognize_picture' => 'required|image',
|
||||||
|
'axis_type_id' => 'required|integer|exists:axis_types,id',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function attributes(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'activity_date' => 'تاریخ فعالیت',
|
||||||
|
'activity_time' => 'ساعت فعالیت',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\V3\SafetyAndPrivacy;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class SecondStepStoreRequest 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 [
|
||||||
|
'judiciary_document' => 'required|array',
|
||||||
|
'judiciary_document.*' => 'file',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\V3\SafetyAndPrivacy;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class ThirdStepStoreRequest 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 [
|
||||||
|
'action_picture' => 'required|image',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
13
app/Models/AxisType.php
Normal file
13
app/Models/AxisType.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class AxisType extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $guarded = [];
|
||||||
|
}
|
||||||
@@ -2,9 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use App\Traits\SafetyAndPrivacyReportAble;
|
use App\Traits\SafetyAndPrivacyReportAble;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
class SafetyAndPrivacy extends Model
|
class SafetyAndPrivacy extends Model
|
||||||
{
|
{
|
||||||
@@ -26,7 +28,14 @@ class SafetyAndPrivacy extends Model
|
|||||||
'edare_shahri_name',
|
'edare_shahri_name',
|
||||||
'way_id',
|
'way_id',
|
||||||
'activity_date_time',
|
'activity_date_time',
|
||||||
|
'step',
|
||||||
|
'step_fa',
|
||||||
|
'judiciary_document',
|
||||||
|
'judiciary_document_upload_date',
|
||||||
|
'action_picture',
|
||||||
|
'action_picture_document_upload_date',
|
||||||
|
'axis_type_id',
|
||||||
|
'axis_type_name',
|
||||||
];
|
];
|
||||||
|
|
||||||
public $table = "safety_and_privacy";
|
public $table = "safety_and_privacy";
|
||||||
@@ -60,4 +69,23 @@ class SafetyAndPrivacy extends Model
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function recognizePicture(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => $value == null ? null :
|
||||||
|
(filter_var($value, FILTER_VALIDATE_URL)
|
||||||
|
? $value
|
||||||
|
: Storage::disk('public')->url($value))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function actionPicture(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => $value == null ? null :
|
||||||
|
(filter_var($value, FILTER_VALIDATE_URL)
|
||||||
|
? $value
|
||||||
|
: Storage::disk('public')->url($value))
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class RoadObservationTableService
|
|||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
||||||
$fields = [
|
$fields = [
|
||||||
'fk_RegisteredEventMessage', 'road_observeds.id', 'Title', 'road_observeds.created_at',
|
'fk_RegisteredEventMessage', 'road_observeds.id', 'Title', 'road_observeds.created_at', 'StartTime_DateTime',
|
||||||
'lat', 'lng', 'FeatureTypeTitle', 'Description', 'MobileForSendEventSms', 'rms_start_latlng',
|
'lat', 'lng', 'FeatureTypeTitle', 'Description', 'MobileForSendEventSms', 'rms_start_latlng',
|
||||||
'rms_description', 'rms_status', 'rms_last_activity_fa', 'rms_last_activity', 'edarate_shahri_id',
|
'rms_description', 'rms_status', 'rms_last_activity_fa', 'rms_last_activity', 'edarate_shahri_id',
|
||||||
'road_observeds.province_id', 'province_fa', 'city_id', 'city_fa', 'edarate_shahri.name_fa',
|
'road_observeds.province_id', 'province_fa', 'city_id', 'city_fa', 'edarate_shahri.name_fa',
|
||||||
@@ -53,7 +53,7 @@ class RoadObservationTableService
|
|||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
||||||
$fields = [
|
$fields = [
|
||||||
'fk_RegisteredEventMessage', 'road_observeds.id', 'Title', 'road_observeds.created_at',
|
'fk_RegisteredEventMessage', 'road_observeds.id', 'Title', 'road_observeds.created_at', 'StartTime_DateTime',
|
||||||
'lat', 'lng', 'FeatureTypeTitle', 'Description', 'MobileForSendEventSms', 'edarate_shahri_id',
|
'lat', 'lng', 'FeatureTypeTitle', 'Description', 'MobileForSendEventSms', 'edarate_shahri_id',
|
||||||
'rms_description', 'rms_status', 'rms_start_latlng', 'rms_last_activity_fa', 'image_after', 'image_before',
|
'rms_description', 'rms_status', 'rms_start_latlng', 'rms_last_activity_fa', 'image_after', 'image_before',
|
||||||
'rms_last_activity', 'road_observeds.province_id', 'province_fa', 'city_id', 'city_fa',
|
'rms_last_activity', 'road_observeds.province_id', 'province_fa', 'city_id', 'city_fa',
|
||||||
@@ -79,14 +79,15 @@ class RoadObservationTableService
|
|||||||
{
|
{
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
||||||
|
$fields = 'fk_RegisteredEventMessage, road_observeds.id, Title, FeatureTypeTitle, MobileForSendEventSms, StartTime_DateTime,
|
||||||
|
road_observeds.created_at, rms_last_activity, rms_last_activity_fa, status, edarate_shahri_id,
|
||||||
|
status_fa, supervisor_description, rms_description, province_fa, city_id, city_fa, Description, edarate_shahri.name_fa as edarate_shahri_name_fa, lat, lng';
|
||||||
|
|
||||||
if ($user->hasPermissionTo('show-fast-react')) {
|
if ($user->hasPermissionTo('show-fast-react')) {
|
||||||
$query = RoadObserved::query()->leftjoin('edarate_shahri', 'road_observeds.edarate_shahri_id', 'edarate_shahri.id')
|
$query = RoadObserved::query()->leftjoin('edarate_shahri', 'road_observeds.edarate_shahri_id', 'edarate_shahri.id')
|
||||||
->where('rms_status', '=', 0)
|
->where('rms_status', '=', 0)
|
||||||
->whereNotNull('edarate_shahri_id')
|
->whereNotNull('edarate_shahri_id')
|
||||||
->selectRaw('fk_RegisteredEventMessage, road_observeds.id, Title, FeatureTypeTitle, MobileForSendEventSms,
|
->selectRaw($fields);
|
||||||
road_observeds.created_at, rms_last_activity, rms_last_activity_fa, status, edarate_shahri_id,
|
|
||||||
status_fa, supervisor_description, rms_description, province_fa, city_id, city_fa, Description, edarate_shahri.name_fa as edarate_shahri_name_fa, lat, lng'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
elseif ($user->hasPermissionTo('show-fast-react-province')) {
|
elseif ($user->hasPermissionTo('show-fast-react-province')) {
|
||||||
|
|
||||||
@@ -98,10 +99,7 @@ class RoadObservationTableService
|
|||||||
->where('rms_status', '=', 0)
|
->where('rms_status', '=', 0)
|
||||||
->whereNotNull('road_observeds.province_id')
|
->whereNotNull('road_observeds.province_id')
|
||||||
->where('road_observeds.province_id', '=', $user->province_id)
|
->where('road_observeds.province_id', '=', $user->province_id)
|
||||||
->selectRaw('fk_RegisteredEventMessage, road_observeds.id, Title, FeatureTypeTitle, MobileForSendEventSms,
|
->selectRaw($fields);
|
||||||
road_observeds.created_at, rms_last_activity, rms_last_activity_fa, status, edarate_shahri_id,
|
|
||||||
status_fa, supervisor_description, rms_description, province_fa, city_id, city_fa, Description, edarate_shahri.name_fa as edarate_shahri_name_fa, lat, lng'
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
elseif ($user->hasPermissionTo('show-fast-react-edarate-shahri')) {
|
elseif ($user->hasPermissionTo('show-fast-react-edarate-shahri')) {
|
||||||
@@ -114,10 +112,7 @@ class RoadObservationTableService
|
|||||||
->where('rms_status', '=', 0)
|
->where('rms_status', '=', 0)
|
||||||
->whereNotNull('edarate_shahri_id')
|
->whereNotNull('edarate_shahri_id')
|
||||||
->where('edarate_shahri_id', '=', $user->edarate_shahri_id)
|
->where('edarate_shahri_id', '=', $user->edarate_shahri_id)
|
||||||
->selectRaw('fk_RegisteredEventMessage, road_observeds.id, Title, FeatureTypeTitle, MobileForSendEventSms,
|
->selectRaw($fields);
|
||||||
road_observeds.created_at, rms_last_activity, rms_last_activity_fa, status, edarate_shahri_id,
|
|
||||||
status_fa, supervisor_description, rms_description, province_fa, city_id, city_fa, Description, edarate_shahri.name_fa as edarate_shahri_name_fa, lat, lng'
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
240
app/Services/Cartables/SafetyAndPrivacyTableService.php
Normal file
240
app/Services/Cartables/SafetyAndPrivacyTableService.php
Normal file
@@ -0,0 +1,240 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Cartables;
|
||||||
|
|
||||||
|
use App\Facades\DataTable\DataTableFacade;
|
||||||
|
use App\Http\Traits\ApiResponse;
|
||||||
|
use App\Models\Province;
|
||||||
|
use App\Models\SafetyAndPrivacy;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class SafetyAndPrivacyTableService
|
||||||
|
{
|
||||||
|
use ApiResponse;
|
||||||
|
|
||||||
|
public function dataTable(Request $request, $loadRelations = false)
|
||||||
|
{
|
||||||
|
$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'
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($user->hasPermissionTo('show-safety-and-privacy-operator-cartable')) {
|
||||||
|
$query = SafetyAndPrivacy::query()->select($fields);
|
||||||
|
}
|
||||||
|
elseif ($user->hasPermissionTo('show-safety-and-privacy-operator-cartable-province')) {
|
||||||
|
if (is_null($user->province_id)) {
|
||||||
|
return $this->errorResponse('استانی برای شما در سامانه ثبت نشده است!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = SafetyAndPrivacy::query()->where('province_id', '=', $user->province_id)->select($fields);
|
||||||
|
}
|
||||||
|
elseif ($user->hasPermissionTo('show-safety-and-privacy-operator-cartable-edarate-shahri')) {
|
||||||
|
if (is_null($user->edarate_shahri_id)) {
|
||||||
|
return $this->errorResponse('اداره ای برای شما در سامانه ثبت نشده است!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = SafetyAndPrivacy::query()->where('edare_shahri_id', '=', $user->edarate_shahri_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return DataTableFacade::run(
|
||||||
|
$query,
|
||||||
|
$request,
|
||||||
|
allowedFilters: ['*'],
|
||||||
|
allowedSortings: ['*']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function countryActivity(Request $request): array
|
||||||
|
{
|
||||||
|
$fromDate = $request->from_date ? $request->from_date . ' 00:00:00' : now()->startOfDay()->toDateTimeString();
|
||||||
|
$toDate = $request->date_to ? $request->date_to . ' 23:59:59' : now()->endOfDay()->toDateTimeString();
|
||||||
|
$axisTypeId = $request->axis_type_id;
|
||||||
|
|
||||||
|
$activities = [];
|
||||||
|
|
||||||
|
$country = SafetyAndPrivacy::query()
|
||||||
|
->selectRaw('COUNT(*) as qty,info_id, step')
|
||||||
|
->whereBetween('created_at', [$fromDate, $toDate])
|
||||||
|
->when($axisTypeId, function ($query) use ($axisTypeId) {
|
||||||
|
$query->where('axis_type_id', '=', $axisTypeId);
|
||||||
|
})
|
||||||
|
->groupBy('info_id', 'step')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
// $country = DB::select(
|
||||||
|
// "SELECT COUNT(*) as qty,info_id, step
|
||||||
|
// FROM safety_and_privacy where created_at BETWEEN '".$fromDate."' and '".$toDate."'
|
||||||
|
// GROUP BY info_id,step"
|
||||||
|
// );
|
||||||
|
|
||||||
|
$countryTotalSum = 0;
|
||||||
|
$countryData = [
|
||||||
|
'name_fa' => 'کشوری',
|
||||||
|
'province_id' => -1,
|
||||||
|
'sum' => 0,
|
||||||
|
'89' => [
|
||||||
|
'1' => 0,
|
||||||
|
'2' => 0,
|
||||||
|
'3' => 0,
|
||||||
|
],
|
||||||
|
'90' => [
|
||||||
|
'1' => 0,
|
||||||
|
'2' => 0,
|
||||||
|
'3' => 0,
|
||||||
|
],
|
||||||
|
'91' => [
|
||||||
|
'1' => 0,
|
||||||
|
'2' => 0,
|
||||||
|
'3' => 0,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
foreach ($country as $key => $value) {
|
||||||
|
$countryTotalSum += $value->qty;
|
||||||
|
$countryData[$value->info_id][$value->step] = $value->qty;
|
||||||
|
$countryData["sum"] = $countryTotalSum;
|
||||||
|
}
|
||||||
|
$activities[] = (object) $countryData;
|
||||||
|
|
||||||
|
$provinces = SafetyAndPrivacy::query()
|
||||||
|
->selectRaw('province_id, province_fa, COUNT(*) as qty,info_id, step')
|
||||||
|
->whereBetween('created_at', [$fromDate, $toDate])
|
||||||
|
->when($axisTypeId, function ($query) use ($axisTypeId) {
|
||||||
|
$query->where('axis_type_id', '=', $axisTypeId);
|
||||||
|
})
|
||||||
|
->groupBy('info_id', 'step', 'province_id', 'province_fa')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
// $provinces = DB::select(
|
||||||
|
// "SELECT province_id, province_fa, COUNT(*) as qty,info_id, step
|
||||||
|
// FROM safety_and_privacy where created_at BETWEEN '".$fromDate."' and '".$toDate."'
|
||||||
|
// GROUP BY info_id,step,province_id,province_fa"
|
||||||
|
// );
|
||||||
|
|
||||||
|
foreach ($provinces as $value) {
|
||||||
|
$provinceId = $value->province_id;
|
||||||
|
|
||||||
|
// Check if the province already exists in the activities array
|
||||||
|
if (!isset($activities[$provinceId])) {
|
||||||
|
$activities[$provinceId] = (object) [
|
||||||
|
'province_id' => $provinceId,
|
||||||
|
'name_fa' => $value->province_fa,
|
||||||
|
'sum' => 0,
|
||||||
|
'89' => ['1' => 0, '2' => 0, '3' => 0],
|
||||||
|
'90' => ['1' => 0, '2' => 0, '3' => 0],
|
||||||
|
'91' => ['1' => 0, '2' => 0, '3' => 0],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$activities[$provinceId]->{$value->info_id}[$value->step] = $value->qty;
|
||||||
|
$activities[$provinceId]->sum += $value->qty;
|
||||||
|
}
|
||||||
|
|
||||||
|
$activities = array_values($activities);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'activities' => $activities,
|
||||||
|
'fromDate' => $fromDate,
|
||||||
|
'toDate' => $toDate,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function provinceActivity(Request $request): array
|
||||||
|
{
|
||||||
|
$fromDate = $request->from_date ? $request->from_date . ' 00:00:00' : now()->startOfDay()->toDateTimeString();
|
||||||
|
$toDate = $request->date_to ? $request->date_to . ' 23:59:59' : now()->endOfDay()->toDateTimeString();
|
||||||
|
$provinceId = $request->province_id;
|
||||||
|
$axisTypeId = $request->axis_type_id;
|
||||||
|
$activities = [];
|
||||||
|
|
||||||
|
$province = SafetyAndPrivacy::query()
|
||||||
|
->selectRaw('COUNT(*) as qty,info_id, step')
|
||||||
|
->where('province_id', '=', $provinceId)
|
||||||
|
->whereBetween('created_at', [$fromDate, $toDate])
|
||||||
|
->when($axisTypeId, function ($query) use ($axisTypeId) {
|
||||||
|
$query->where('axis_type_id', '=', $axisTypeId);
|
||||||
|
})
|
||||||
|
->groupBy('info_id', 'step')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
// $province = DB::select('
|
||||||
|
// SELECT COUNT(*) as qty,info_id, step
|
||||||
|
// FROM safety_and_privacy where province_id ='.$provinceId.' and created_at BETWEEN "'.$fromDate.'" and "'.$toDate.'"
|
||||||
|
// GROUP BY info_id,step
|
||||||
|
// ');
|
||||||
|
|
||||||
|
$provinceTotalSum = 0;
|
||||||
|
$provinceData = [
|
||||||
|
'name_fa' => 'استانی',
|
||||||
|
'edare_shahri_id' => -1,
|
||||||
|
'sum' => 0,
|
||||||
|
'89' => [
|
||||||
|
'1' => 0,
|
||||||
|
'2' => 0,
|
||||||
|
'3' => 0,
|
||||||
|
],
|
||||||
|
'90' => [
|
||||||
|
'1' => 0,
|
||||||
|
'2' => 0,
|
||||||
|
'3' => 0,
|
||||||
|
],
|
||||||
|
'91' => [
|
||||||
|
'1' => 0,
|
||||||
|
'2' => 0,
|
||||||
|
'3' => 0,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
foreach ($province as $key => $value) {
|
||||||
|
$provinceTotalSum += $value->qty;
|
||||||
|
$provinceData["sum"] = $provinceTotalSum;
|
||||||
|
$provinceData[$value->info_id][$value->step] = $value->qty;
|
||||||
|
}
|
||||||
|
$activities[] = (object) $provinceData;
|
||||||
|
|
||||||
|
$cities = SafetyAndPrivacy::query()
|
||||||
|
->selectRaw('edare_shahri_id, COUNT(*) as qty,info_id, step')
|
||||||
|
->where('province_id', '=', $provinceId)
|
||||||
|
->whereBetween('created_at', [$fromDate, $toDate])
|
||||||
|
->when($axisTypeId, function ($query) use ($axisTypeId) {
|
||||||
|
$query->where('axis_type_id', '=', $axisTypeId);
|
||||||
|
})
|
||||||
|
->groupBy('info_id', 'step', 'edare_shahri_id')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
// $cities = DB::select('
|
||||||
|
// SELECT edare_shahri_id, COUNT(*) as qty,info_id, step
|
||||||
|
// FROM safety_and_privacy where province_id ='.$provinceId.' and created_at BETWEEN "'.$fromDate.'" and "'.$toDate.'"
|
||||||
|
// GROUP BY info_id,step,edare_shahri_id
|
||||||
|
// ');
|
||||||
|
|
||||||
|
foreach ($cities as $value) {
|
||||||
|
$cityId = $value->edare_shahri_id;
|
||||||
|
|
||||||
|
// Initialize data for each unique city
|
||||||
|
if (!isset($activities[$cityId])) {
|
||||||
|
$activities[$cityId] = (object) [
|
||||||
|
'edare_shahri_id' => $cityId,
|
||||||
|
'name_fa' => \App\Models\EdarateShahri::query()->find($cityId)->name_fa,
|
||||||
|
'sum' => 0,
|
||||||
|
'89' => ['1' => 0, '2' => 0, '3' => 0],
|
||||||
|
'90' => ['1' => 0, '2' => 0, '3' => 0],
|
||||||
|
'91' => ['1' => 0, '2' => 0, '3' => 0],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
$activities[$cityId]->{$value->info_id}[$value->step] = $value->qty;
|
||||||
|
$activities[$cityId]->sum += $value->qty;
|
||||||
|
}
|
||||||
|
|
||||||
|
$activities = array_values($activities);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'activities' => $activities,
|
||||||
|
'fromDate' => $fromDate,
|
||||||
|
'toDate' => $toDate,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
23
database/factories/AxisTypeFactory.php
Normal file
23
database/factories/AxisTypeFactory.php
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\AxisType>
|
||||||
|
*/
|
||||||
|
class AxisTypeFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('axis_types', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('name');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('axis_types');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('safety_and_privacy', function (Blueprint $table) {
|
||||||
|
$table->foreignId('axis_type_id')->nullable()->constrained('axis_types');
|
||||||
|
$table->string('axis_type_name')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('safety_and_privacy', function (Blueprint $table) {
|
||||||
|
$table->dropForeign('axis_type_id');
|
||||||
|
$table->dropColumn('axis_type_name');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
17
database/seeders/AxisTypeSeeder.php
Normal file
17
database/seeders/AxisTypeSeeder.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class AxisTypeSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*/
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>فعالیت های نگهداری حریم راه</title>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
table,
|
||||||
|
th,
|
||||||
|
td {
|
||||||
|
border: 1px solid black;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body dir="rtl" style="text-align: center;">
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th colspan="9"
|
||||||
|
style="background-color: #DAEEF3;text-align: center;border-right: 1px solid black;font-weight:bolder;">
|
||||||
|
تاریخ دریافت گزارش: {{ verta()->now()->format('Y/m/d H:i') }}
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th colspan="9"
|
||||||
|
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;">
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th colspan="9"
|
||||||
|
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;font-size: 13px;">
|
||||||
|
گزارش فعالیت های نگهداری حریم راه
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th rowspan="1"
|
||||||
|
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||||
|
کد یکتا
|
||||||
|
</th>
|
||||||
|
<th rowspan="1"
|
||||||
|
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||||
|
استان
|
||||||
|
</th>
|
||||||
|
<th rowspan="1"
|
||||||
|
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||||
|
اداره
|
||||||
|
</th>
|
||||||
|
<th rowspan="1"
|
||||||
|
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||||
|
مورد
|
||||||
|
</th>
|
||||||
|
<th rowspan="1"
|
||||||
|
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||||
|
تاریخ بازدید
|
||||||
|
</th>
|
||||||
|
<th rowspan="1"
|
||||||
|
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||||
|
تاریخ ثبت مستندات قضایی
|
||||||
|
</th>
|
||||||
|
<th rowspan="1"
|
||||||
|
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||||
|
تاریخ اقدام
|
||||||
|
</th>
|
||||||
|
<th rowspan="1"
|
||||||
|
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||||
|
وضعیت
|
||||||
|
</th>
|
||||||
|
<th rowspan="1"
|
||||||
|
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||||
|
تاریخ ثبت
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
@foreach ($data as $item)
|
||||||
|
<tr>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['id'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['province_fa'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['edare_shahri_name'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['info_fa'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['activity_date_time'] ? verta($item['activity_date_time'])->format('Y/n/j H:i:s') : '-' }}</td>
|
||||||
|
|
||||||
|
<td style="border: 1px solid black;text-align: center;">
|
||||||
|
{{ $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') : '-' }}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td style="border: 1px solid black;text-align: center;">
|
||||||
|
{{ $item['action_picture_document_upload_date'] ? verta($item['action_picture_document_upload_date'])->format('Y/n/j H:i:s') : '-' }}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['step_fa'] ?? '-' }}</td>
|
||||||
|
<td style="border: 1px solid black;text-align: center;">{{ $item['created_at'] ? verta($item['created_at'])->format('Y/n/j H:i:s') : '-' }}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>کشوری</title>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body dir="rtl" style="text-align: center;">
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th colspan="11"
|
||||||
|
style="background-color: #DAEEF3;text-align: center;border-right: 1px solid black;font-weight:bolder;">
|
||||||
|
تاریخ دریافت گزارش: {{ verta()->now()->format('Y/m/d H:i') }}
|
||||||
|
</th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th colspan="11"
|
||||||
|
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;">
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th colspan="11"
|
||||||
|
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;font-size: 13px;">
|
||||||
|
گزارش نگهداری حریم راه از تاریخ
|
||||||
|
{{ verta($fromDate)->format('Y/n/j') }}
|
||||||
|
تا
|
||||||
|
تاریخ
|
||||||
|
{{ verta($toDate)->format('Y/n/j') }}
|
||||||
|
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
|
<tr class="headercolortable">
|
||||||
|
<th rowspan="2" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
|
||||||
|
اداره کل
|
||||||
|
</th>
|
||||||
|
<th rowspan="2" style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||||
|
تعداد کل
|
||||||
|
</th>
|
||||||
|
<th colspan="3" style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||||
|
ساخت و ساز غیر مجاز
|
||||||
|
</th>
|
||||||
|
<th colspan="3" style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||||
|
راه دسترسی غیر مجاز
|
||||||
|
</th>
|
||||||
|
<th colspan="3" style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||||
|
عبور تاسیسات زیربنایی غیر مجاز
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||||
|
گام اول (شناسایی)
|
||||||
|
</th>
|
||||||
|
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||||
|
گام دوم (مستندات قضایی)
|
||||||
|
</th>
|
||||||
|
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||||
|
گام سوم (برخورد)
|
||||||
|
</th>
|
||||||
|
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||||
|
گام اول (شناسایی)
|
||||||
|
</th>
|
||||||
|
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||||
|
گام دوم (مستندات قضایی)
|
||||||
|
</th>
|
||||||
|
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||||
|
گام سوم (برخورد)
|
||||||
|
</th>
|
||||||
|
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||||
|
گام اول (شناسایی)
|
||||||
|
</th>
|
||||||
|
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||||
|
گام دوم (مستندات قضایی)
|
||||||
|
</th>
|
||||||
|
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||||
|
گام سوم (برخورد)
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach ($data as $item)
|
||||||
|
<tr>
|
||||||
|
<td style="border:1px solid black;text-align: center;">{{ $item->name_fa }}</td>
|
||||||
|
<td style="border:1px solid black;text-align: center;">{{ $item->sum }}</td>
|
||||||
|
<td style="border:1px solid black;text-align: center;">{{ $item->{'89'}[1] }}</td>
|
||||||
|
<td style="border:1px solid black;text-align: center;">{{ $item->{'89'}[2] }}</td>
|
||||||
|
<td style="border:1px solid black;text-align: center;">{{ $item->{'89'}[3] }}</td>
|
||||||
|
<td style="border:1px solid black;text-align: center;">{{ $item->{'90'}[1] }}</td>
|
||||||
|
<td style="border:1px solid black;text-align: center;">{{ $item->{'90'}[2] }}</td>
|
||||||
|
<td style="border:1px solid black;text-align: center;">{{ $item->{'90'}[3] }}</td>
|
||||||
|
<td style="border:1px solid black;text-align: center;">{{ $item->{'91'}[1] }}</td>
|
||||||
|
<td style="border:1px solid black;text-align: center;">{{ $item->{'91'}[2] }}</td>
|
||||||
|
<td style="border:1px solid black;text-align: center;">{{ $item->{'91'}[3] }}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>استانی</title>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body dir="rtl" style="text-align: center;">
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th colspan="11"
|
||||||
|
style="background-color: #DAEEF3;text-align: center;border-right: 1px solid black;font-weight:bolder;">
|
||||||
|
تاریخ دریافت گزارش: {{ verta()->now()->format('Y/m/d H:i') }}
|
||||||
|
</th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th colspan="11"
|
||||||
|
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;">
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th colspan="11"
|
||||||
|
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;font-size: 13;">
|
||||||
|
گزارش نگهداری حریم راه از تاریخ
|
||||||
|
{{ verta($fromDate)->format('Y/n/j') }}
|
||||||
|
تا
|
||||||
|
تاریخ
|
||||||
|
{{ verta($toDate)->format('Y/n/j') }}
|
||||||
|
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="headercolortable">
|
||||||
|
<th rowspan="2" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
|
||||||
|
اداره کل
|
||||||
|
</th>
|
||||||
|
<th rowspan="2" style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||||
|
تعداد کل
|
||||||
|
</th>
|
||||||
|
<th colspan="3" style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||||
|
ساخت و ساز غیر مجاز
|
||||||
|
</th>
|
||||||
|
<th colspan="3" style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||||
|
راه دسترسی غیر مجاز
|
||||||
|
</th>
|
||||||
|
<th colspan="3" style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||||
|
عبور تاسیسات زیربنایی غیر مجاز
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||||
|
گام اول (شناسایی)
|
||||||
|
</th>
|
||||||
|
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||||
|
گام دوم (مستندات قضایی)
|
||||||
|
</th>
|
||||||
|
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||||
|
گام سوم (برخورد)
|
||||||
|
</th>
|
||||||
|
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||||
|
گام اول (شناسایی)
|
||||||
|
</th>
|
||||||
|
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||||
|
گام دوم (مستندات قضایی)
|
||||||
|
</th>
|
||||||
|
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||||
|
گام سوم (برخورد)
|
||||||
|
</th>
|
||||||
|
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||||
|
گام اول (شناسایی)
|
||||||
|
</th>
|
||||||
|
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||||
|
گام دوم (مستندات قضایی)
|
||||||
|
</th>
|
||||||
|
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||||
|
گام سوم (برخورد)
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach ($data as $item)
|
||||||
|
<tr>
|
||||||
|
<td style="border:1px solid black;text-align: center;">{{ $item->name_fa }}</td>
|
||||||
|
<td style="border:1px solid black;text-align: center;">{{ $item->sum }}</td>
|
||||||
|
<td style="border:1px solid black;text-align: center;">{{ $item->{'89'}[1] }}</td>
|
||||||
|
<td style="border:1px solid black;text-align: center;">{{ $item->{'89'}[2] }}</td>
|
||||||
|
<td style="border:1px solid black;text-align: center;">{{ $item->{'89'}[3] }}</td>
|
||||||
|
<td style="border:1px solid black;text-align: center;">{{ $item->{'90'}[1] }}</td>
|
||||||
|
<td style="border:1px solid black;text-align: center;">{{ $item->{'90'}[2] }}</td>
|
||||||
|
<td style="border:1px solid black;text-align: center;">{{ $item->{'90'}[3] }}</td>
|
||||||
|
<td style="border:1px solid black;text-align: center;">{{ $item->{'91'}[1] }}</td>
|
||||||
|
<td style="border:1px solid black;text-align: center;">{{ $item->{'91'}[2] }}</td>
|
||||||
|
<td style="border:1px solid black;text-align: center;">{{ $item->{'91'}[3] }}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -6,14 +6,18 @@ use App\Http\Controllers\V3\DamageManagementController;
|
|||||||
use App\Http\Controllers\V3\Dashboard\Azmayesh\AzmayeshController;
|
use App\Http\Controllers\V3\Dashboard\Azmayesh\AzmayeshController;
|
||||||
use App\Http\Controllers\V3\Dashboard\Azmayesh\AzmayeshSampleController;
|
use App\Http\Controllers\V3\Dashboard\Azmayesh\AzmayeshSampleController;
|
||||||
use App\Http\Controllers\V3\Dashboard\Azmayesh\AzmayeshTypeController;
|
use App\Http\Controllers\V3\Dashboard\Azmayesh\AzmayeshTypeController;
|
||||||
|
use App\Http\Controllers\V3\Dashboard\ItemsManagementController;
|
||||||
use App\Http\Controllers\V3\Dashboard\ObservedItemController;
|
use App\Http\Controllers\V3\Dashboard\ObservedItemController;
|
||||||
use App\Http\Controllers\V3\Dashboard\AccidentReceiptController;
|
use App\Http\Controllers\V3\Dashboard\AccidentReceiptController;
|
||||||
|
use App\Http\Controllers\V3\Dashboard\OtpManagementController;
|
||||||
use App\Http\Controllers\V3\Dashboard\Reports\AccidentReceiptReportController;
|
use App\Http\Controllers\V3\Dashboard\Reports\AccidentReceiptReportController;
|
||||||
use App\Http\Controllers\V3\Dashboard\Reports\RoadItemsReportController;
|
use App\Http\Controllers\V3\Dashboard\Reports\RoadItemsReportController;
|
||||||
use App\Http\Controllers\V3\Dashboard\Reports\RoadPatrolReportController;
|
use App\Http\Controllers\V3\Dashboard\Reports\RoadPatrolReportController;
|
||||||
|
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\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\LogListController;
|
use App\Http\Controllers\V3\LogListController;
|
||||||
@@ -23,7 +27,7 @@ use Illuminate\Support\Facades\Route;
|
|||||||
|
|
||||||
Route::get('admin/permissions', function () {
|
Route::get('admin/permissions', function () {
|
||||||
if (auth()->user()->username == 'witel') {
|
if (auth()->user()->username == 'witel') {
|
||||||
auth()->user()->syncPermissions(\App\Models\Permission::all()->pluck('id')->toArray());
|
auth()->user()->syncPermissions(\App\Models\Permission::all());
|
||||||
return response('done');
|
return response('done');
|
||||||
}
|
}
|
||||||
abort(404);
|
abort(404);
|
||||||
@@ -319,3 +323,42 @@ Route::prefix('log_list')
|
|||||||
->group(function () {
|
->group(function () {
|
||||||
Route::get('/', 'index')->name('index');
|
Route::get('/', 'index')->name('index');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::prefix('safety_and_privacy')
|
||||||
|
->name('SafetyAndPrivacy.')
|
||||||
|
->controller(SafetyAndPrivacyController::class)
|
||||||
|
->group(function () {
|
||||||
|
Route::get('/', 'index')->name('index')->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('permission:add-safety-and-privacy');
|
||||||
|
Route::post('/second_step_store/{safetyAndPrivacy}', 'secondStepStore')->name('secondStepStore')->middleware('permission:add-safety-and-privacy');
|
||||||
|
Route::post('/third_step_store/{safetyAndPrivacy}', 'thirdStepStore')->name('thirdStepStore')->middleware('permission:add-safety-and-privacy');
|
||||||
|
Route::get('/sub_items', 'subItems')->name('subItems');
|
||||||
|
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::prefix('safety_and_privacy_report')
|
||||||
|
->name('SafetyAndPrivacyReport.')
|
||||||
|
->controller(SafetyAndPrivacyReportController::class)
|
||||||
|
->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('otp')
|
||||||
|
->name('otp.')
|
||||||
|
->controller(OtpManagementController::class)
|
||||||
|
->group(function () {
|
||||||
|
Route::post('/get_token', 'getOtpToken')->name('getOtpToken');
|
||||||
|
});
|
||||||
|
|
||||||
|
Route::name('items.')
|
||||||
|
->controller(ItemsManagementController::class)
|
||||||
|
->group(function () {
|
||||||
|
Route::get('/items', 'getItems')->name('list');
|
||||||
|
Route::get('/sub_items/{item}', 'getSubItems')->name('subItems');
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user