Merge branch 'develop' into 'main'

Develop

See merge request witelgroup/rms_v2!68
This commit is contained in:
2025-02-17 09:43:19 +00:00
56 changed files with 3411 additions and 535 deletions

View File

@@ -0,0 +1,54 @@
<?php
namespace App\Console\Commands;
use App\Jobs\SendRoadObservationToNikarayan;
use App\Models\RoadObserved;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class SendRoadObservationToNikarayanCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'road-observation:send-to-nikarayan';
/**
* The console command description.
*
* @var string
*/
protected $description = 'send road observation to nikarayan from 1 farvardin 1403 to 14 mehr 1403';
/**
* Execute the console command.
*/
public function handle(): void
{
$count = 0;
$this->info("Dispatching jobs with a delay between each...");
DB::transaction(function () use ($count) {
$delay = 0;
RoadObserved::query()
->whereBetween('StartTime_DateTime_fa', ['1403-01-01 00:00:00', '1403-07-13 23:59:59'])
->where('rms_status', '=', 0)
->chunkById(50, function ($roads) use ($delay, $count) {
foreach ($roads as $road) {
$road->update(['rms_status' => 1]);
SendRoadObservationToNikarayan::dispatch($road)->delay(now()->addMinutes(10)->addSeconds($delay));
Log::channel('road_observation_problem')->info("Job for Road Observed ID {$road->id} scheduled with a {$delay} seconds delay.");
$this->info("Scheduled job for Road ID: {$road->id} {$delay}s");
$delay += 3;
$count +=1;
}
});
});
$this->info("{$count} item's sent successfully");
}
}

View File

@@ -0,0 +1,75 @@
<?php
namespace App\Exports\V3\RoadItemsProjects;
use App\Models\Province;
use App\Models\RoadItemsProject;
use Carbon\Carbon;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Facades\DB;
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\Style\Alignment;
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
class CountryActivityPerItemReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
{
public function __construct(private ?array $data){}
public function view(): View
{
$data = $this->data;
return view('v3.Reports.RoadItems.CountryActivityPerItem', [
'data' => $data['activities']['data'],
'provinces' => $data['provinces'],
'items' => $data['items'],
'fromDate' => $data['activities']['fromDate'],
'toDate' => $data['activities']['toDate']
]);
}
public function registerEvents(): array
{
return [
AfterSheet::class => function (AfterSheet $event) {
$event->sheet->getDelegate()->setRightToLeft(true);
$event->sheet->getDelegate()->getStyle('A:U')->getFont()->setName('Arial');
$event->sheet->getDelegate()->getStyle('A:U')
->getAlignment()
->setHorizontal(Alignment::HORIZONTAL_CENTER);
$event->sheet->getDelegate()->getStyle('A:U')
->getAlignment()
->setVertical(Alignment::VERTICAL_CENTER);
}
];
}
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('q1');
return [$drawing, $drawing2];
}
}

View File

@@ -0,0 +1,71 @@
<?php
namespace App\Exports\V3\RoadItemsProjects;
use Illuminate\Contracts\View\View;
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\Style\Alignment;
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
class CountryActivityPerSubItemReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
{
public function __construct(private array $data){}
public function view(): View
{
$data = $this->data;
return view('v3.Reports.RoadItems.CountryActivityPerSubItem', [
'data' => $data['activities']['data'],
'provinces' => $data['provinces'],
'subItems' => $data['subItems'],
'fromDate' => $data['activities']['fromDate'],
'toDate' => $data['activities']['toDate']
]);
}
public function registerEvents(): array
{
return [
AfterSheet::class => function (AfterSheet $event) {
$event->sheet->getDelegate()->setRightToLeft(true);
$event->sheet->getDelegate()->getStyle('A:U')->getFont()->setName('Arial');
$event->sheet->getDelegate()->getStyle('A:U')
->getAlignment()
->setHorizontal(Alignment::HORIZONTAL_CENTER);
$event->sheet->getDelegate()->getStyle('A:U')
->getAlignment()
->setVertical(Alignment::VERTICAL_CENTER);
}
];
}
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('q1');
return [$drawing, $drawing2];
}
}

View File

@@ -0,0 +1,70 @@
<?php
namespace App\Exports\V3\RoadItemsProjects;
use App\Models\Province;
use App\Models\RoadItemsProject;
use Carbon\Carbon;
use Illuminate\Contracts\View\View;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Facades\DB;
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\Style\Alignment;
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
class OperatorCartableReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
{
public function __construct(private ?Collection $data){}
public function view(): View
{
return view('v3.Reports.RoadItems.OperatorCartableReport', [
'data' => $this->data,
]);
}
public function registerEvents(): array
{
return [
AfterSheet::class => function (AfterSheet $event) {
$event->sheet->getDelegate()->setRightToLeft(true);
$event->sheet->getDelegate()->getStyle('A:U')->getFont()->setName('Arial');
$event->sheet->getDelegate()->getStyle('A:U')
->getAlignment()
->setHorizontal(Alignment::HORIZONTAL_CENTER);
$event->sheet->getDelegate()->getStyle('A:U')
->getAlignment()
->setVertical(Alignment::VERTICAL_CENTER);
}
];
}
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('q1');
return [$drawing, $drawing2];
}
}

View File

@@ -0,0 +1,75 @@
<?php
namespace App\Exports\V3\RoadItemsProjects;
use App\Models\Province;
use App\Models\RoadItemsProject;
use Carbon\Carbon;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Facades\DB;
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\Style\Alignment;
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
class ProvinceActivityPerItemReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
{
public function __construct(private ?array $data){}
public function view(): View
{
$data = $this->data;
return view('v3.Reports.RoadItems.ProvinceActivityPerItem', [
'data' => $data['activities']['data'],
'edarateShahri' => $data['edarateShahri'],
'items' => $data['items'],
'fromDate' => $data['activities']['fromDate'],
'toDate' => $data['activities']['toDate']
]);
}
public function registerEvents(): array
{
return [
AfterSheet::class => function (AfterSheet $event) {
$event->sheet->getDelegate()->setRightToLeft(true);
$event->sheet->getDelegate()->getStyle('A:U')->getFont()->setName('Arial');
$event->sheet->getDelegate()->getStyle('A:U')
->getAlignment()
->setHorizontal(Alignment::HORIZONTAL_CENTER);
$event->sheet->getDelegate()->getStyle('A:U')
->getAlignment()
->setVertical(Alignment::VERTICAL_CENTER);
}
];
}
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('q1');
return [$drawing, $drawing2];
}
}

View File

@@ -0,0 +1,76 @@
<?php
namespace App\Exports\V3\RoadItemsProjects;
use App\Models\Province;
use App\Models\RoadItemsProject;
use Carbon\Carbon;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
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\Style\Alignment;
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
class ProvinceActivityPerSubItemReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
{
public function __construct(private array $data){}
public function view(): View
{
$data = $this->data;
return view('v3.Reports.RoadItems.ProvinceActivityPerSubItem', [
'data' => $data['activities']['data'],
'edarateShahri' => $data['edarateShahri'],
'subItems' => $data['subItems'],
'fromDate' => $data['activities']['fromDate'],
'toDate' => $data['activities']['toDate']
]);
}
public function registerEvents(): array
{
return [
AfterSheet::class => function (AfterSheet $event) {
$event->sheet->getDelegate()->setRightToLeft(true);
$event->sheet->getDelegate()->getStyle('A:U')->getFont()->setName('Arial');
$event->sheet->getDelegate()->getStyle('A:U')
->getAlignment()
->setHorizontal(Alignment::HORIZONTAL_CENTER);
$event->sheet->getDelegate()->getStyle('A:U')
->getAlignment()
->setVertical(Alignment::VERTICAL_CENTER);
}
];
}
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('q1');
return [$drawing, $drawing2];
}
}

View File

@@ -0,0 +1,70 @@
<?php
namespace App\Exports\V3\RoadItemsProjects;
use App\Models\Province;
use App\Models\RoadItemsProject;
use Carbon\Carbon;
use Illuminate\Contracts\View\View;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Facades\DB;
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\Style\Alignment;
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
class SupervisorCartableReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
{
public function __construct(private ?Collection $data){}
public function view(): View
{
return view('v3.Reports.RoadItems.SupervisorCartableReport', [
'data' => $this->data,
]);
}
public function registerEvents(): array
{
return [
AfterSheet::class => function (AfterSheet $event) {
$event->sheet->getDelegate()->setRightToLeft(true);
$event->sheet->getDelegate()->getStyle('A:U')->getFont()->setName('Arial');
$event->sheet->getDelegate()->getStyle('A:U')
->getAlignment()
->setHorizontal(Alignment::HORIZONTAL_CENTER);
$event->sheet->getDelegate()->getStyle('A:U')
->getAlignment()
->setVertical(Alignment::VERTICAL_CENTER);
}
];
}
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('q1');
return [$drawing, $drawing2];
}
}

View File

@@ -0,0 +1,71 @@
<?php
namespace App\Exports\V3\RoadPatrols;
use Illuminate\Contracts\View\View;
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\Style\Alignment;
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
class CountryActivity implements FromView, WithEvents, ShouldAutoSize, WithDrawings
{
public function __construct(private array $activities){}
public function view(): View
{
$activities = $this->activities;
return view('v3.Reports.RoadPatrols.CountryActivity', [
'activities' => $activities["activities"]['data'],
'provinces' => $activities["provinces"],
'fromDate' => $activities["activities"]["fromDate"],
'toDate' => $activities["activities"]["toDate"]
]);
}
public function registerEvents(): array
{
return [
AfterSheet::class => function (AfterSheet $event) {
$event->sheet->getDelegate()->setRightToLeft(true);
$event->sheet->getDelegate()->getStyle('A:U')->getFont()->setName('Arial');
$event->sheet->getDelegate()->getStyle('A:U')
->getAlignment()
->setHorizontal(Alignment::HORIZONTAL_CENTER);
$event->sheet->getDelegate()->getStyle('A:U')
->getAlignment()
->setVertical(Alignment::VERTICAL_CENTER);
}
];
}
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('q1');
return [$drawing, $drawing2];
}
}

View File

@@ -0,0 +1,69 @@
<?php
namespace App\Exports\V3\RoadPatrols;
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\Style\Alignment;
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
class OperatorCartableReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
{
public function __construct(private Collection $data){}
public function view(): View
{
$data = $this->data;
return view('v3.Reports.RoadPatrols.OperatorCartableReport', [
'data' => $data
]);
}
public function registerEvents(): array
{
return [
AfterSheet::class => function (AfterSheet $event) {
$event->sheet->getDelegate()->setRightToLeft(true);
$event->sheet->getDelegate()->getStyle('A:U')->getFont()->setName('Arial');
$event->sheet->getDelegate()->getStyle('A:U')
->getAlignment()
->setHorizontal(Alignment::HORIZONTAL_CENTER);
$event->sheet->getDelegate()->getStyle('A:U')
->getAlignment()
->setVertical(Alignment::VERTICAL_CENTER);
}
];
}
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('i1');
return [$drawing, $drawing2];
}
}

View File

@@ -0,0 +1,71 @@
<?php
namespace App\Exports\V3\RoadPatrols;
use Illuminate\Contracts\View\View;
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\Style\Alignment;
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
class ProvinceActivity implements FromView, WithEvents, ShouldAutoSize, WithDrawings
{
public function __construct(private array $activities){}
public function view(): View
{
$activities = $this->activities;
return view('v3.Reports.RoadPatrols.ProvinceActivity', [
'activities' => $activities["activities"]['data'],
'edarateShahri' => $activities["edarateShahri"],
'fromDate' => $activities["activities"]["fromDate"],
'toDate' => $activities["activities"]["toDate"]
]);
}
public function registerEvents(): array
{
return [
AfterSheet::class => function (AfterSheet $event) {
$event->sheet->getDelegate()->setRightToLeft(true);
$event->sheet->getDelegate()->getStyle('A:U')->getFont()->setName('Arial');
$event->sheet->getDelegate()->getStyle('A:U')
->getAlignment()
->setHorizontal(Alignment::HORIZONTAL_CENTER);
$event->sheet->getDelegate()->getStyle('A:U')
->getAlignment()
->setVertical(Alignment::VERTICAL_CENTER);
}
];
}
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('q1');
return [$drawing, $drawing2];
}
}

View File

@@ -0,0 +1,69 @@
<?php
namespace App\Exports\V3\RoadPatrols;
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\Style\Alignment;
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
class SupervisorCartableReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
{
public function __construct(private Collection $data){}
public function view(): View
{
$data = $this->data;
return view('v3.Reports.RoadPatrols.SupervisorCartableReport', [
'data' => $data
]);
}
public function registerEvents(): array
{
return [
AfterSheet::class => function (AfterSheet $event) {
$event->sheet->getDelegate()->setRightToLeft(true);
$event->sheet->getDelegate()->getStyle('A:U')->getFont()->setName('Arial');
$event->sheet->getDelegate()->getStyle('A:U')
->getAlignment()
->setHorizontal(Alignment::HORIZONTAL_CENTER);
$event->sheet->getDelegate()->getStyle('A:U')
->getAlignment()
->setVertical(Alignment::VERTICAL_CENTER);
}
];
}
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('i1');
return [$drawing, $drawing2];
}
}

View File

@@ -658,7 +658,7 @@ class DevelopController extends Controller
$save = $file->move(storage_path('images'), $fileName);
\App\Helpers\Compress::resize($save);
// \App\Helpers\Compress::resize($save);
return response()->json(['msg' => 'ok']);
}

View File

@@ -154,13 +154,13 @@ class RoadItemsProjectController extends Controller
$after = $request->file('after_image')->store('road_items_projects_new/after', 'public');
$roadItems->files()->create(['path' => $after]);
$urlAfter = "/var/www/rms/public/storage/{$after}";
\App\Helpers\Compress::resize($urlAfter);
// \App\Helpers\Compress::resize($urlAfter);
}
if ($request->has('before_image')) {
$before = $request->file('before_image')->store('/road_items_projects_new/before', 'public');
$roadItems->files()->create(['path' => $before]);
$urlBefore = "/var/www/rms/public/storage/{$before}";
\App\Helpers\Compress::resize($urlBefore);
// \App\Helpers\Compress::resize($urlBefore);
}
if (auth()->user()) {

View File

@@ -372,7 +372,7 @@ class RoadItemsProjectController extends Controller
]);
// $road_item->files()->create(['path' => $after]);
$urlAfter = "/var/www/rms/public/storage/{$after}";
\App\Helpers\Compress::resize($urlAfter);
// \App\Helpers\Compress::resize($urlAfter);
}
if ($request->has('before_image')) {
Storage::delete('public/'. $road_item->files[1]->path);
@@ -383,7 +383,7 @@ class RoadItemsProjectController extends Controller
]);
// $road_item->files()->create(['path' => $before]);
$urlBefore = "/var/www/rms/public/storage/{$before}";
\App\Helpers\Compress::resize($urlBefore);
// \App\Helpers\Compress::resize($urlBefore);
}
}

View File

@@ -0,0 +1,131 @@
<?php
namespace App\Http\Controllers\V3\Dashboard;
use App\Facades\DataTable\DataTableFacade;
use App\Facades\Sms\Sms;
use App\Http\Controllers\Controller;
use App\Http\Traits\ApiResponse;
use App\Models\Accident;
use App\Models\City;
use App\Models\DailyAccidentSettings;
use App\Models\Damage;
use App\Models\Province;
use App\Services\NominatimService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
class ReceiptController extends Controller
{
use ApiResponse;
public function show(Request $request): JsonResponse
{
$columns = array('id', 'province_fa','city_fa', 'axis_name', 'accident_type_fa', 'accident_date', 'id',
'damage_picture1', 'damage_picture2', 'plaque', 'created_at', 'sum', 'deposit_date', 'status',
'police_file_date','deposit_insurance_image','deposit_daghi_image','deposit_insurance_amount',
'deposit_daghi_amount','status_fa','final_amount','province_id','accident_time','accident_type',
'city_id','driver_name','driver_national_code','driver_phone_number','police_file','lat','lng',
'police_serial','report_base'
);
$allowedFilters = $columns;
$allowedSortings = $columns;
$user = auth()->user();
$query = null;
if ($user->hasPermissionTo('show-receipt')) {
$query = Accident::with('damages');
} else {
if (is_null($user->province_id)) {
return $this->errorResponse('استانی برای شما در سامانه ثبت نشده است!');
}
$query = Accident::with('damages')->where('province_id', '=', $user->province_id);
}
$data = DataTableFacade::run(
$query,
$request,
allowedFilters: $allowedFilters,
allowedSortings: $allowedSortings
);
$user->addActivityComplete(1122);
return $this->successResponse($data);
}
public function store(Request $request, NominatimService $nominatimService)
{
DB::transaction(function () use ($request, $nominatimService) {
$province = Province::query()->where('id', '=', $request->province_id)->first();
$city = City::query()->where('id', '=', $request->city_id)->first();
$accident = [
'province_id' => $province->id,
'province_fa' => $province->name_fa,
'city_id' => $city->id,
'city_fa' => $city->name_fa,
'axis_name' => $request->axis_name,
'driver_name' => $request->driver_name,
'plaque' => $request->plaque,
'driver_national_code' => $request->driver_national_code,
'driver_phone_number' => $request->driver_phone_number,
'user_id' => auth()->user()->id,
'lat' => $request->lat,
'lng' => $request->lng,
'accident_type' => $request->accident_type,
'accident_date' => $request->accident_date,
'accident_time' => $request->accident_time,
'accident_type_fa' => DailyAccidentSettings::where('type', 'accident_type')->where('name', $request->accident_type)->first()->value,
'way_id' => $nominatimService->get_way_id_from_nominatim($request->lat, $request->lng),
];
if ($request->report_base) {
$accident['report_base'] = 1;
} else {
$accident['police_file'] = $request->file('police_file')->storeAs('receipts_files/'.$accident->id, 'police_file_'.$accident->id.'_'.time().'.'.$request->file('police_file')->extension(), 'public');
$accident['police_serial'] = $request->police_serial;
$accident['police_file_date'] = $request->police_file_date;
$accident['report_base'] = 0;
}
if ($request->has('damage_picture1')) {
$new_accident->damage_picture1 = $request->file('damage_picture1')->storeAs('receipts_files/'.$new_accident->id, 'damage_picture1_'.$new_accident->id.'_'.time().'.'.$request->file('damage_picture1')->extension(), 'public');
}
if ($request->has('damage_picture2')) {
$new_accident->damage_picture2 = $request->file('damage_picture2')->storeAs('receipts_files/'.$new_accident->id, 'damage_picture2_'.$new_accident->id.'_'.time().'.'.$request->file('damage_picture2')->extension(), 'public');
}
$new_accident->save();
$sum = 0;
foreach (json_decode($request->items_damge) as $key => $item) {
$damage = Damage::find($item->id);
$new_accident->damages()->attach($item->id, [
'value' => $item->value,
'unit' => $damage->unit,
'amount' => $item->amount,
]);
$sum += $item->amount;
}
$ojrate_nasb = $sum/100*20;
$new_accident->ojrate_nasb = $ojrate_nasb;
$sum += $ojrate_nasb;
$new_accident->sum = $sum;
$new_accident->withoutAction();
$new_accident->save();
$msg = "درخواست شما بابت پرداخت خسارت وارده به ابنیه فنی و تاسیسات راه با کد یکتا ".$new_accident->id." ثبت شد.\n".verta()->now()->format('Y/m/d H:i') ;
Sms::sendSms($request->phone_number, $msg);
auth()->user()->addActivityComplete(1123);
});
}
}

View File

@@ -2,13 +2,17 @@
namespace App\Http\Controllers\V3\Dashboard\Reports;
use App\Exports\Activities\One\AllSheets as OneSheet;
use App\Exports\V3\RoadItemsProjects\CountryActivityPerItemReport;
use App\Exports\V3\RoadItemsProjects\CountryActivityPerSubItemReport;
use App\Exports\V3\RoadItemsProjects\ProvinceActivityPerItemReport;
use App\Exports\V3\RoadItemsProjects\ProvinceActivityPerSubItemReport;
use App\Http\Controllers\Controller;
use App\Http\Traits\ApiResponse;
use App\Models\EdarateShahri;
use App\Models\InfoItem;
use App\Models\Province;
use App\Models\RoadItemsProject;
use App\Services\Reports\RoadItemReportService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Maatwebsite\Excel\Facades\Excel;
@@ -28,234 +32,147 @@ class RoadItemsReportController extends Controller
]);
}
public function provinceActivityPerSubItem(Request $request): JsonResponse
public function countryActivityPerSubItem(Request $request, RoadItemReportService $roadItemReportService): JsonResponse
{
$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();
$item = $request->item;
$provinceRoadItemsPerSubItem = RoadItemsProject::query()->selectRaw('
sub_item AS t,
COUNT(*) AS c,
CAST(SUM(CASE WHEN sub_item_data > 0 THEN sub_item_data ELSE ABS(sub_item_data) END) AS UNSIGNED) AS s,
province_id AS p')
->where('item', '=', $item)
->whereBetween('activity_date_time', [$fromDate, $toDate])
->where('status', '=', 1)
->groupBy('province_id', 'sub_item')
->get();
$countryRoadItemsPerSubItem = RoadItemsProject::query()->selectRaw('
sub_item AS t,
COUNT(*) AS c,
CAST(SUM(CASE WHEN sub_item_data > 0 THEN sub_item_data ELSE ABS(sub_item_data) END) AS UNSIGNED) AS s,
-1 AS p')
->where('item', '=', $item)
->whereBetween('activity_date_time', [$fromDate, $toDate])
->where('status', '=', 1)
->groupBy('sub_item')
->get();
$activities = $provinceRoadItemsPerSubItem->push(...$countryRoadItemsPerSubItem);
$activities = $roadItemReportService->countryActivityPerSubItem($request);
$provinces = Province::all(['id', 'name_fa']);
$subItems = InfoItem::query()
->where('item', $item)
->where('item', $request->item)
->get(['id', 'item', 'item_str', 'sub_item_str', 'sub_item_unit', 'sub_item']);
return $this->successResponse([
'activities' => $activities,
'activities' => $activities['data'],
'sub_items' => $subItems,
'provinces' => $provinces,
]);
}
public function cityActivityPerSubItem(Request $request): JsonResponse
public function provinceActivityPerSubItem(Request $request, RoadItemReportService $roadItemReportService): JsonResponse
{
$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();
$item = $request->item;
$province = $request->province_id;
$activities = $roadItemReportService->provinceActivityPerSubItem($request);
$cityRoadItemsPerSubItem = RoadItemsProject::query()->selectRaw('
sub_item AS t,
COUNT(*) AS c,
CAST(SUM(CASE WHEN sub_item_data > 0 THEN sub_item_data ELSE ABS(sub_item_data) END) AS UNSIGNED) AS s,
province_id AS p,
edarat_id AS ci
')
->where('item', '=', $item)
->where('province_id', '=', $province)
->whereBetween('activity_date_time', [$fromDate, $toDate])
->where('status', '=', 1)
->groupBy('edarat_id', 'sub_item')
->get();
$edarateShahri = EdarateShahri::query()->where('province_id', '=', $request->province_id)->get(['id', 'name_fa']);
$provinceRoadItemsPerSubItem = RoadItemsProject::query()->selectRaw('
sub_item AS t,
COUNT(*) AS c,
CAST(SUM(CASE WHEN sub_item_data > 0 THEN sub_item_data ELSE ABS(sub_item_data) END) AS UNSIGNED) AS s,
province_id AS p,
-1 AS ci
')
->where('item', '=', $item)
->where('province_id', '=', $province)
->whereBetween('activity_date_time', [$fromDate, $toDate])
->where('status', '=', 1)
->groupBy('sub_item')
->get();
$edarateShahri = EdarateShahri::query()->where('province_id', '=', $province)->get(['id', 'name_fa']);
$activities = $cityRoadItemsPerSubItem->push(...$provinceRoadItemsPerSubItem);
$subItems = InfoItem::query()
->where('item', $item)
->where('item', $request->item)
->get(['id', 'item', 'item_str', 'sub_item_str', 'sub_item_unit', 'sub_item']);
return $this->successResponse([
'activities' => $activities,
'activities' => $activities['data'],
'edarateShahri' => $edarateShahri,
'sub_items' => $subItems,
]);
}
public function provinceActivityPerItem(Request $request): JsonResponse
public function countryActivityPerItem(Request $request, RoadItemReportService $roadItemReportService): JsonResponse
{
if (auth()->check()) {
auth()->user()->addActivityComplete(1033);
}
$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();
$user = auth()->user();
// $isSpecialUser = in_array($user->username, ['witel', 'drdanesh']);
$isSpecialUser = $user->hasPermissionTo("show-road-item-supervise-cartable");
$provinceId = $isSpecialUser ? null : $user->province_id;
$provinceActivity = RoadItemsProject::query()
->selectRaw('COUNT(*) AS s, province_id AS p, item AS i')
->where('status', 1)
->whereBetween('activity_date_time', [$fromDate, $toDate])
->when(!$isSpecialUser, function ($query) use ($provinceId) {
$query->where('province_id', $provinceId);
})
->groupBy('province_id', 'item');
$countryActivity = RoadItemsProject::query()
->selectRaw('COUNT(*) AS s, -1 AS p, item AS i')
->where('status', 1)
->whereBetween('activity_date_time', [$fromDate, $toDate])
->when(!$isSpecialUser, function ($query) use ($provinceId) {
$query->where('province_id', $provinceId);
})
->groupBy('item');
$activities = $provinceActivity
->unionAll($countryActivity)
->get();
$activities = $roadItemReportService->countryActivityPerItem($request);
$provinces = Province::all(['id', 'name_fa']);
return $this->successResponse([
'activities' => $activities,
'activities' => $activities['data'],
'provinces' => $provinces,
]);
}
public function cityActivityPerItem(Request $request): JsonResponse
public function provinceActivityPerItem(Request $request, RoadItemReportService $roadItemReportService): JsonResponse
{
$provinceId = $request->province_id;
$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();
$edarehActivity = RoadItemsProject::query()
->selectRaw('
COUNT(*) AS s,
edarat_id AS c,
item AS i')
->where('status', '=', 1)
->whereBetween('activity_date_time', [$fromDate, $toDate])
->where('province_id', $provinceId)
->groupBy('item', 'edarat_id');
$cityActivity = RoadItemsProject::query()
->selectRaw('
COUNT(*) AS s,
-1 AS c,
item AS i')
->where('status', '=', 1)
->whereBetween('activity_date_time', [$fromDate, $toDate])
->where('province_id', $provinceId)
->groupBy('item');
$activities = $edarehActivity
->unionAll($cityActivity)
->get();
$edarateShahri = EdarateShahri::query()->where('province_id', '=', $provinceId)->get(['id', 'name_fa']);
$activities = $roadItemReportService->provinceActivityPerItem($request);
$edarateShahri = EdarateShahri::query()->where('province_id', '=', $request->province_id)->get(['id', 'name_fa']);
return $this->successResponse([
'activities' => $activities,
'activities' => $activities['data'],
'edarateShahri' => $edarateShahri,
]);
}
public function map(Request $request): JsonResponse
public function countryActivityExcelPerItem(Request $request, RoadItemReportService $roadItemReportService): BinaryFileResponse
{
auth()->user()->addActivityComplete(1034);
$name = 'گزارش کشوری از فعالیت روزانه و جاری - جدول 1 ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
$activities = $roadItemReportService->countryActivityPerItem($request);
return Excel::download(new CountryActivityPerItemReport([
'activities' => $activities,
'provinces' => Province::all(['id', 'name_fa']),
'items' => InfoItem::query()->distinct()->get(['item', 'item_str']),
]), $name);
}
public function provinceActivityExcelPerItem(Request $request, RoadItemReportService $roadItemReportService): BinaryFileResponse
{
auth()->user()->addActivityComplete(1034);
$name = 'گزارش استانی از فعالیت روزانه و جاری - جدول 1 ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
$activities = $roadItemReportService->provinceActivityPerItem($request);
return Excel::download(new ProvinceActivityPerItemReport([
'activities' => $activities,
'edarateShahri' => EdarateShahri::query()->where('province_id', '=', $request->province_id)->get(['id', 'name_fa']),
'items' => InfoItem::query()->distinct()->get(['item', 'item_str']),
]), $name);
}
public function countryActivityExcelPerSubItem(Request $request, RoadItemReportService $roadItemReportService): BinaryFileResponse
{
auth()->user()->addActivityComplete(1034);
$name = "گزارش کشوری از فعالیت روزانه و جاری - جدول 2 " . verta()->now()->format('Y-m-d H-i') . '.xlsx';
$activities = $roadItemReportService->countryActivityPerSubItem($request);
$subItems = InfoItem::query()
->where('item', $request->item)
->get(['id', 'item', 'item_str', 'sub_item_str', 'sub_item_unit', 'sub_item']);
return Excel::download(new CountryActivityPerSubItemReport([
'activities' => $activities,
'provinces' => Province::all(['id', 'name_fa']),
'subItems' => $subItems
]), $name);
}
public function provinceActivityExcelPerSubItem(Request $request, RoadItemReportService $roadItemReportService): BinaryFileResponse
{
auth()->user()->addActivityComplete(1034);
$activities = $roadItemReportService->provinceActivityPerSubItem($request);
$name = "گزارش استانی از فعالیت روزانه و جاری - جدول 2 " . verta()->now()->format('Y-m-d H-i') . '.xlsx';
$subItems = InfoItem::query()
->where('item', $request->item)
->get(['id', 'item', 'item_str', 'sub_item_str', 'sub_item_unit', 'sub_item']);
return Excel::download(new ProvinceActivityPerSubItemReport([
'activities' => $activities,
'subItems' => $subItems,
'edarateShahri' => EdarateShahri::query()->where('province_id', '=', $request->province_id)->get(['id', 'name_fa']),
]), $name);
}
public function activitiesOnMap(Request $request): JsonResponse
{
$provinceId = $request->province_id;
$cityId = $request->city_id;
$subId = $request->sub_id;
$item = $request->item;
$status = $request->status;
$dateFrom = $request->date_from ? $request->date_from . ' 00:00:00' : now()->startOfDay()->toDateTimeString();
$dateTo = $request->date_to ? $request->date_to . ' 23:59:59' : now()->addDay()->startOfDay()->toDateTimeString();
$data = RoadItemsProject::query()
->where('is_new', '=', 1)
->when($provinceId, fn($query) => $query->where('province_id', '=', $provinceId))
->when($cityId, fn($query) => $query->where('city_id', '=', $cityId))
->when($subId, fn($query) => $query->where('sub_items', 'like', '%' . $subId . '%'))
->when($item, fn($query) => $query->where('item', '=', $item))
->when(!is_null($request->status), fn($query) => $query->where('status', '=', $request->status))
->whereBetween('activity_date', [$dateFrom, $dateTo])
->when($provinceId, fn($query, $provinceId) => $query->where('road_items_projects.province_id', '=', $provinceId))
->when($cityId, fn($query, $cityId) => $query->where('road_items_projects.city_id', '=', $cityId))
->when($subId, fn($query, $subId) => $query->where('sub_items', 'like', '%' . $subId . '%'))
->when($item, fn($query, $item) => $query->where('item', '=', $item))
->when(!is_null($status), fn($query, $status) => $query->where('status', '=', $status))
->leftJoin('users', 'users.id', '=', 'road_items_projects.user_id')
->whereBetween('road_items_projects.activity_date', [$dateFrom, $dateTo])
->select('road_items_projects.id as i', 'start_lat as l', 'start_lng as g', 'status')
->get();
return $this->successResponse($data);
}
public function activityExcelPerItem(Request $request): BinaryFileResponse
public function showOnMap(RoadItemsProject $roadItemsProject): JsonResponse
{
auth()->user()->addActivityComplete(1034);
$name = 'گزارش از فعالیت روزانه و جاری - جدول 1 ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
return Excel::download(new OneSheet($request->fromDate, $request->toDate, $request->province), $name);
}
public function activityExcelPerSubItem(Request $request)
{
$url_correction = $request->province ? "&province={$request->province}" : "";
return match ($request->type) {
1 => redirect("/reports/two/maremat?fromDate={$request->fromDate}&toDate={$request->toDate}" . $url_correction),
2 => redirect("/reports/two/paksazi?fromDate={$request->fromDate}&toDate={$request->toDate}" . $url_correction),
3 => redirect("/reports/two/alaem?fromDate={$request->fromDate}&toDate={$request->toDate}" . $url_correction),
4 => redirect("/reports/two/hefaz?fromDate={$request->fromDate}&toDate={$request->toDate}" . $url_correction),
5 => redirect("/reports/two/roshanaei?fromDate={$request->fromDate}&toDate={$request->toDate}" . $url_correction),
6 => redirect("/reports/two/khatkeshi?fromDate={$request->fromDate}&toDate={$request->toDate}" . $url_correction),
7 => redirect("/reports/two/rangamizi?fromDate={$request->fromDate}&toDate={$request->toDate}" . $url_correction),
8 => redirect("/reports/two/shosteshoo?fromDate={$request->fromDate}&toDate={$request->toDate}" . $url_correction),
9 => redirect("/reports/two/imensazi?fromDate={$request->fromDate}&toDate={$request->toDate}" . $url_correction),
10 => redirect("/reports/two/harim?fromDate={$request->fromDate}&toDate={$request->toDate}" . $url_correction),
11 => redirect("/reports/two/pol?fromDate={$request->fromDate}&toDate={$request->toDate}" . $url_correction),
12 => redirect("/reports/two/toonel?fromDate={$request->fromDate}&toDate={$request->toDate}" . $url_correction),
13 => redirect("/reports/two/zemestani?fromDate={$request->fromDate}&toDate={$request->toDate}" . $url_correction),
14 => redirect("/reports/two/mashinalat?fromDate={$request->fromDate}&toDate={$request->toDate}" . $url_correction),
15 => redirect("/reports/two/rahdar?fromDate={$request->fromDate}&toDate={$request->toDate}" . $url_correction),
16 => redirect("/reports/two/ezterari?fromDate={$request->fromDate}&toDate={$request->toDate}" . $url_correction),
20 => redirect("/reports/two/bazrasi?fromDate={$request->fromDate}&toDate={$request->toDate}" . $url_correction),
default => response()->json([
'error' => '404'
], 404),
};
return $this->successResponse($roadItemsProject->load(['files', 'rahdaran:id,name,code', 'cmmsMachines:id,machine_code,car_name,plak_number']));
}
}

View File

@@ -2,153 +2,94 @@
namespace App\Http\Controllers\V3\Dashboard\Reports;
use App\Exports\V2\RoadPatrol\RoadPatrolTable\AllSheets as RoadPatrolTable;
use App\Exports\V3\RoadPatrols\CountryActivity;
use App\Exports\V3\RoadPatrols\ProvinceActivity;
use App\Http\Controllers\Controller;
use App\Http\Traits\ApiResponse;
use App\Models\EdarateShahri;
use App\Models\Province;
use App\Models\RoadPatrolProject;
use App\Models\RoadObserved;
use App\Models\RoadPatrol;
use App\Services\Reports\RoadPatrolReportService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Facades\Excel;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
class RoadPatrolReportController extends Controller
{
use ApiResponse;
public function provincePatrolActivity(Request $request): JsonResponse
public function countryPatrolActivity(Request $request, RoadPatrolReportService $roadPatrolReportService): JsonResponse
{
$fromDate = $request->from_date ? $request->from_date . ' 00:00:00' : now()->startOfDay()->toDateTimeString();
$dateTo = $request->date_to ? $request->date_to . ' 23:59:59' : now()->endOfDay()->toDateTimeString();
$activities = DB::select('SELECT
"کشوری" as province_fa,
-1 as province_id,
COUNT(*) tedade,
SUM(tedad_mavarede_moshede_shode_adi) as tedad_mavarede_moshede_shode_adi,
SUM(tedad_mavarede_moshede_shode_fori) as tedad_mavarede_moshede_shode_fori,
SUM(tedad_mavarede_moshede_shode_ani) as tedad_mavarede_moshede_shode_ani,
SUM(tedad_mavarede_peygiri_shode) as tedad_mavarede_peygiri_shode,
SUM(tedad_faliyat_sabt_shode) as tedad_faliyat_sabt_shode,
ROUND(SUM(distance)) as masafat_tey_shode
FROM (SELECT
province_id,
province_fa,
distance,
(SELECT COUNT(*) FROM `observed_items` oi WHERE rp.`id`= oi.road_patrol_id AND priority = 1) AS tedad_mavarede_moshede_shode_adi,
(SELECT COUNT(*) FROM `observed_items` oi WHERE rp.`id`= oi.road_patrol_id AND priority = 2) AS tedad_mavarede_moshede_shode_fori,
(SELECT COUNT(*) FROM `observed_items` oi WHERE rp.`id`= oi.road_patrol_id AND priority = 3) AS tedad_mavarede_moshede_shode_ani,
(SELECT COUNT(*) FROM `observed_items` oii WHERE rp.`id`= oii.road_patrol_id AND oii.road_item_id IS NOT NULL AND priority IS NOT NULL) AS tedad_mavarede_peygiri_shode,
(SELECT COUNT(*) FROM `observed_items` oii WHERE rp.`id`= oii.road_patrol_id AND oii.road_item_id IS NOT NULL AND priority IS NULL) AS tedad_faliyat_sabt_shode
FROM `road_patrols` rp where rp.start_time BETWEEN "'.$fromDate.'" AND "'.$dateTo.'") temp
union
SELECT
province_fa,
province_id,
COUNT(*) tedade,
SUM(tedad_mavarede_moshede_shode_adi) as tedad_mavarede_moshede_shode_adi,
SUM(tedad_mavarede_moshede_shode_fori) as tedad_mavarede_moshede_shode_fori,
SUM(tedad_mavarede_moshede_shode_ani) as tedad_mavarede_moshede_shode_ani,
SUM(tedad_mavarede_peygiri_shode) as tedad_mavarede_peygiri_shode,
SUM(tedad_faliyat_sabt_shode) as tedad_faliyat_sabt_shode,
ROUND(SUM(distance)) as masafat_tey_shode
FROM (SELECT
province_id,
province_fa,
distance,
(SELECT COUNT(*) FROM `observed_items` oi WHERE rp.`id`= oi.road_patrol_id AND priority = 1) AS tedad_mavarede_moshede_shode_adi,
(SELECT COUNT(*) FROM `observed_items` oi WHERE rp.`id`= oi.road_patrol_id AND priority = 2) AS tedad_mavarede_moshede_shode_fori,
(SELECT COUNT(*) FROM `observed_items` oi WHERE rp.`id`= oi.road_patrol_id AND priority = 3) AS tedad_mavarede_moshede_shode_ani,
(SELECT COUNT(*) FROM `observed_items` oii WHERE rp.`id`= oii.road_patrol_id AND oii.road_item_id IS NOT NULL AND priority IS NOT NULL) AS tedad_mavarede_peygiri_shode,
(SELECT COUNT(*) FROM `observed_items` oii WHERE rp.`id`= oii.road_patrol_id AND oii.road_item_id IS NOT NULL AND priority IS NULL) AS tedad_faliyat_sabt_shode
FROM `road_patrols` rp where rp.start_time BETWEEN "'.$fromDate.'" AND "'.$dateTo.'") temp
GROUP BY province_id'
);
$activities = $roadPatrolReportService->countryActivity($request);
$provinces = Province::all(['id', 'name_fa']);
return $this->successResponse([
'activities' => $activities,
'activities' => $activities['data'],
'provinces' => $provinces
]);
}
public function cityPatrolActivity(Request $request): JsonResponse
public function provincePatrolActivity(Request $request, RoadPatrolReportService $roadPatrolReportService): JsonResponse
{
$request->validate(["province_id" => "required",]);
$fromDate = $request->from_date ? $request->from_date . ' 00:00:00' : now()->startOfDay()->toDateTimeString();
$dateTo = $request->date_to ? $request->date_to . ' 23:59:59' : now()->endOfDay()->toDateTimeString();
$provinceId = $request->province_id;
$activities = DB::select(
'SELECT
province_fa,
province_id,
-1 AS edare_id,
"استانی" AS edare_name,
COUNT(*) tedade,
SUM(tedad_mavarede_moshede_shode_adi) as tedad_mavarede_moshede_shode_adi,
SUM(tedad_mavarede_moshede_shode_fori) as tedad_mavarede_moshede_shode_fori,
SUM(tedad_mavarede_moshede_shode_ani) as tedad_mavarede_moshede_shode_ani,
SUM(tedad_mavarede_peygiri_shode) as tedad_mavarede_peygiri_shode,
SUM(tedad_faliyat_sabt_shode) as tedad_faliyat_sabt_shode,
ROUND(SUM(distance)) as masafat_tey_shode
FROM (SELECT
province_id,
province_fa,
edare_id,
edare_name,
distance,
(SELECT COUNT(*) FROM `observed_items` oi WHERE rp.`id`= oi.road_patrol_id AND priority = 1) AS tedad_mavarede_moshede_shode_adi,
(SELECT COUNT(*) FROM `observed_items` oi WHERE rp.`id`= oi.road_patrol_id AND priority = 2) AS tedad_mavarede_moshede_shode_fori,
(SELECT COUNT(*) FROM `observed_items` oi WHERE rp.`id`= oi.road_patrol_id AND priority = 3) AS tedad_mavarede_moshede_shode_ani,
(SELECT COUNT(*) FROM `observed_items` oii WHERE rp.`id`= oii.road_patrol_id AND oii.road_item_id IS NOT NULL AND priority IS NOT NULL) AS tedad_mavarede_peygiri_shode,
(SELECT COUNT(*) FROM `observed_items` oii WHERE rp.`id`= oii.road_patrol_id AND oii.road_item_id IS NOT NULL AND priority IS NULL) AS tedad_faliyat_sabt_shode
FROM `road_patrols` rp where rp.province_id = "'.$provinceId.'" AND rp.start_time BETWEEN "'.$fromDate.'" AND "'.$dateTo.'") temp
UNION
SELECT
province_fa,
province_id,
edare_id,
edare_name,
COUNT(*) tedade,
SUM(tedad_mavarede_moshede_shode_adi) as tedad_mavarede_moshede_shode_adi,
SUM(tedad_mavarede_moshede_shode_fori) as tedad_mavarede_moshede_shode_fori,
SUM(tedad_mavarede_moshede_shode_ani) as tedad_mavarede_moshede_shode_ani,
SUM(tedad_mavarede_peygiri_shode) as tedad_mavarede_peygiri_shode,
SUM(tedad_faliyat_sabt_shode) as tedad_faliyat_sabt_shode,
ROUND(SUM(distance)) as masafat_tey_shode
FROM (SELECT
province_id,
province_fa,
edare_id,
edare_name,
distance,
(SELECT COUNT(*) FROM `observed_items` oi WHERE rp.`id`= oi.road_patrol_id AND priority = 1) AS tedad_mavarede_moshede_shode_adi,
(SELECT COUNT(*) FROM `observed_items` oi WHERE rp.`id`= oi.road_patrol_id AND priority = 2) AS tedad_mavarede_moshede_shode_fori,
(SELECT COUNT(*) FROM `observed_items` oi WHERE rp.`id`= oi.road_patrol_id AND priority = 3) AS tedad_mavarede_moshede_shode_ani,
(SELECT COUNT(*) FROM `observed_items` oii WHERE rp.`id`= oii.road_patrol_id AND oii.road_item_id IS NOT NULL AND priority IS NOT NULL) AS tedad_mavarede_peygiri_shode,
(SELECT COUNT(*) FROM `observed_items` oii WHERE rp.`id`= oii.road_patrol_id AND oii.road_item_id IS NOT NULL AND priority IS NULL) AS tedad_faliyat_sabt_shode
FROM `road_patrols` rp where rp.province_id = "'.$provinceId.'" AND rp.start_time BETWEEN "'.$fromDate.'" AND "'.$dateTo.'") temp
GROUP BY edare_id
'
);
$activities = $roadPatrolReportService->provinceActivity($request);
$edarateShahri = EdarateShahri::query()->where('province_id', '=', $provinceId)->get(['id', 'name_fa']);
$edarateShahri = EdarateShahri::query()->where('province_id', '=', $request->province_id)->get(['id', 'name_fa']);
return $this->successResponse([
'activities' => $activities,
'activities' => $activities['data'],
'edarateShahri' => $edarateShahri,
]);
}
public function excel(Request $request): BinaryFileResponse
public function countryActivityExcel(Request $request, RoadPatrolReportService $roadPatrolReportService): BinaryFileResponse
{
$activities = $roadPatrolReportService->countryActivity($request);
$provinces = Province::all(['id', 'name_fa']);
$name = 'گزارش از گشت راهداری و ترابری ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
return Excel::download(
new RoadPatrolTable($request->from_date, $request->date_to), $name
);
return Excel::download(new CountryActivity([
'activities' => $activities,
'provinces' => $provinces,
]), $name);
}
public function provinceActivityExcel(Request $request, RoadPatrolReportService $roadPatrolReportService): BinaryFileResponse
{
$activities = $roadPatrolReportService->provinceActivity($request);
$edarateShahri = EdarateShahri::query()->where('province_id', '=', $request->province_id)->get(['id', 'name_fa']);
$name = 'گزارش از گشت راهداری و ترابری ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
return Excel::download(new ProvinceActivity([
'activities' => $activities,
'edarateShahri' => $edarateShahri,
]), $name);
}
public function activitiesOnMap(Request $request): JsonResponse
{
$date_from = $request->from_date ? $request->from_date .' 00:00:00' : now()->startOfDay()->toDateTimeString();
$date_to = $request->date_to ? $request->date_to.' 23:59:59' : now()->addDay()->startOfDay()->toDateTimeString();
$provinceId = $request->province_id;
$edareId = $request->edare_id;
$data = RoadPatrol::query()
->when($provinceId, fn($query, $provinceId) => $query->where('province_id', '=', $provinceId))
->when($edareId, fn($query, $edareId) => $query->where('edare_id', '=', $edareId))
->whereBetween('created_at', [$date_from, $date_to])
->select('id', 'start_lat', 'start_lon')
->get();
return $this->successResponse($data);
}
public function showOnMap(RoadPatrol $roadPatrol): JsonResponse
{
return $this->successResponse($roadPatrol->load(['rahdaran:id,name,code', 'cmmsMachines:id,machine_code,car_name,plak_number']));
}
}

View File

@@ -2,9 +2,8 @@
namespace App\Http\Controllers\V3\Dashboard;
use App\Exports\V2\RoadItems\OperatorCartableExport;
use App\Exports\V2\RoadItems\SupervisorCartableExport;
use App\Facades\DataTable\DataTableFacade;
use App\Exports\V3\RoadItemsProjects\OperatorCartableReport;
use App\Exports\V3\RoadItemsProjects\SupervisorCartableReport;
use App\Http\Controllers\Controller;
use App\Http\Requests\V3\RoadItemsProject\StoreRequest;
use App\Http\Requests\V3\RoadItemsProject\UpdateRequest;
@@ -14,6 +13,7 @@ use App\Models\EdarateShahri;
use App\Models\InfoItem;
use App\Models\RoadItemsProject;
use App\Services\NominatimService;
use App\Services\Reports\RoadItemReportService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Gate;
@@ -28,39 +28,9 @@ class RoadItemsProjectController extends Controller
/**
* Display a listing of the resource.
*/
public function supervisorIndex(Request $request): JsonResponse
public function supervisorIndex(Request $request, RoadItemReportService $roadItemReportService): JsonResponse
{
$columns = array(
'id', 'user_id', 'start_lat', 'start_lng', 'end_lat',
'end_lng', 'project_distance', 'item', 'item_fa', 'sub_item_fa', 'sub_item',
'sub_item_data', 'created_at', 'updated_at', 'province_id', 'province_fa',
'unit_fa', 'status', 'status_fa', 'supervisor_description', 'supervising_time',
'supervisor_name', 'edarat_id', 'edarat_name', 'activity_date_time','cmmsMachines.machine_code'
);
$allowedFilters = $columns;
$allowedSortings = $columns;
$user = auth()->user();
$query = null;
if ($user->hasPermissionTo('show-road-item-supervise-cartable')) {
$query = RoadItemsProject::query()->where('is_new', 1)->with(['files', 'rahdaran:id,name,code', 'cmmsMachines:id,machine_code,car_name,plak_number']);
}
elseif ($user->hasPermissionTo('show-road-item-supervise-cartable-province')) {
if (is_null($user->province_id)) {
return $this->errorResponse('استانی برای شما در سامانه ثبت نشده است!');
}
$query = RoadItemsProject::query()->where('is_new', 1)
->with(['files', 'rahdaran:id,name,code', 'cmmsMachines:id,machine_code,car_name,plak_number'])->where('province_id', auth()->user()->province_id);
}
$data = DataTableFacade::run(
$query,
$request,
allowedFilters: $allowedFilters,
allowedSortings: $allowedSortings);
$data = $roadItemReportService->supervisorCartableReport($request);
foreach ($data['data'] as $road_item) {
if (Gate::allows('gate-supervise-road-item', $road_item)) {
@@ -95,9 +65,7 @@ class RoadItemsProjectController extends Controller
public function restore(RoadItemsProject $roadItemsProject): JsonResponse
{
if ($roadItemsProject->status == 0) {
return response()->json([
'message' => 'امکان بازگردانی وضعیت این فعالیت وجود ندارد!'
], 400);
return $this->errorResponse('امکان بازگردانی وضعیت این فعالیت وجود ندارد!');
}
$roadItemsProject->update([
@@ -128,36 +96,16 @@ class RoadItemsProjectController extends Controller
}
public function supervisorCartableReport(Request $request): BinaryFileResponse
public function supervisorCartableReport(Request $request, RoadItemReportService $roadItemReportService): BinaryFileResponse
{
$name = 'گزارش از کارتابل ارزیابی فعالیت روزانه ' . verta()->now()->format('Y-m-d H:i') . '.xlsx';
return Excel::download(new SupervisorCartableExport($request->id, $request->item, $request->status,
$request->fromDate, $request->toDate, $request->province_id, $request->edarat_id), $name);
$data = $roadItemReportService->supervisorCartableReport($request);
return Excel::download(new SupervisorCartableReport($data['data']), $name);
}
public function operatorIndex(Request $request): JsonResponse
public function operatorIndex(Request $request, RoadItemReportService $roadItemReportService): JsonResponse
{
$columns = array(
'id', 'user_id', 'start_lat', 'start_lng', 'end_lat',
'end_lng', 'project_distance', 'item', 'item_fa', 'sub_item_fa', 'sub_item',
'sub_item_data', 'created_at', 'updated_at', 'province_id', 'province_fa',
'unit_fa', 'status', 'status_fa', 'supervisor_description', 'supervising_time',
'supervisor_name', 'edarat_id', 'edarat_name', 'activity_date_time', 'cmmsMachines.machine_code'
);
$allowedFilters = $columns;
$allowedSortings = $columns;
$query = RoadItemsProject::with(['files', 'rahdaran:id,name,code', 'cmmsMachines:id,machine_code,car_name,plak_number'])
->where('is_new', 1)
->where('user_id', auth()->user()->id);
$data = DataTableFacade::run(
$query,
$request,
allowedFilters: $allowedFilters,
allowedSortings: $allowedSortings);
$data = $roadItemReportService->operatorCartableReport($request);
return response()->json($data);
}
@@ -170,15 +118,11 @@ class RoadItemsProjectController extends Controller
$user = auth()->user();
if ($user->edarate_ostani_id || is_null($user->city_id)) {
return response()->json([
'message' => 'امکان ثبت فعالیت برای ادارات استانی و ستادی وجود ندارد!'
], 400);
return $this->errorResponse('امکان ثبت فعالیت برای ادارات استانی و ستادی وجود ندارد!');
}
if (is_null($user->edarate_shahri_id)) {
return response()->json([
'message' => 'اداره شهری برای شما در سامانه ثبت نشده است!'
], 400);
return $this->errorResponse('اداره شهری برای شما در سامانه ثبت نشده است!');
}
$info_item = InfoItem::query()->where('item', $request->item_id)
@@ -241,9 +185,7 @@ class RoadItemsProjectController extends Controller
$road_item = RoadItemsProject::store($user, $attributes, $before_image, $after_image, $request->observed_item_id);
if ($road_item === -1) {
return response()->json([
'message' => 'اقدام مربوطه قبلا رسیدگی شده است.'
], 400);
return $this->errorResponse('اقدام مربوطه قبلا رسیدگی شده است.');
}
$road_item->rahdaran()->attach($request->rahdaran_id);
@@ -322,12 +264,10 @@ class RoadItemsProjectController extends Controller
return $this->successResponse();
}
public function operatorCartableReport(Request $request): BinaryFileResponse
public function operatorCartableReport(Request $request, RoadItemReportService $roadItemReportService): BinaryFileResponse
{
$name = 'گزارش از کارتابل عملیات فعالیت روزانه ' . verta()->now()->format('Y-m-d H:i') . '.xlsx';
return Excel::download(
new OperatorCartableExport($request->id, $request->item, $request->status, $request->fromDate, $request->toDate),
$name
);
$data = $roadItemReportService->operatorCartableReport($request);
return Excel::download(new OperatorCartableReport($data['data']), $name);
}
}

View File

@@ -2,9 +2,8 @@
namespace App\Http\Controllers\V3\Dashboard;
use App\Exports\V2\RoadPatrol\OperatorCartableExport;
use App\Exports\V2\RoadPatrol\SupervisorCartableExport;
use App\Facades\DataTable\DataTableFacade;
use App\Exports\V3\RoadPatrols\OperatorCartableReport;
use App\Exports\V3\RoadPatrols\SupervisorCartableReport;
use App\Facades\Sms\Sms;
use App\Http\Controllers\Controller;
use App\Http\Requests\V3\RoadPatrolProject\DeleteRequest;
@@ -16,6 +15,7 @@ use App\Models\RoadItemsProject;
use App\Models\RoadObserved;
use App\Models\RoadPatrol;
use App\Services\NominatimService;
use App\Services\Reports\RoadPatrolReportService;
use Carbon\Carbon;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
@@ -30,40 +30,9 @@ class RoadPatrolProjectController extends Controller
{
use ApiResponse;
public function supervisorIndex(Request $request): JsonResponse
public function supervisorIndex(Request $request, RoadPatrolReportService $roadPatrolReportService): JsonResponse
{
$columns = array(
'id', 'start_lat', 'start_lon', 'end_lat', 'end_lon', 'operator_id',
'operator_name', 'officer_plaque', 'officer_phone_number', 'officer_name',
'supervisor_description', 'supervising_time', 'supervisor_name', 'status',
'status_fa', 'distance', 'province_id', 'province_fa', 'edare_id', 'edare_name',
'start_time', 'end_time','description', 'cmmsMachines.machine_code'
);
$allowedFilters = $columns;
$allowedSortings = $columns;
$user = auth()->user();
$query = null;
if ($user->hasPermissionTo('show-road-patrol-supervise-cartable')) {
$query = RoadPatrol::query()
->with(['rahdaran:id,name,code', 'cmmsMachines:id,machine_code,car_name,plak_number']);
}
elseif ($user->hasPermissionTo('show-road-patrol-supervise-cartable-province')) {
if (is_null($user->province_id)) {
return $this->errorResponse('استانی برای شما در سامانه ثبت نشده است!');
}
$query = RoadPatrol::query()
->with(['rahdaran:id,name,code', 'cmmsMachines:id,machine_code,car_name,plak_number'])
->where('province_id', '=', $user->province_id);
}
$data = DataTableFacade::run(
$query,
$request,
allowedFilters: $allowedFilters,
allowedSortings: $allowedSortings);
$data = $roadPatrolReportService->supervisorCartableReport($request);
foreach ($data['data'] as $road_patrol) {
if (Gate::allows('gate-supervise-road-item', $road_patrol)) {
@@ -111,37 +80,16 @@ class RoadPatrolProjectController extends Controller
return $this->successResponse();
}
public function supervisorCartableReport(Request $request): BinaryFileResponse
public function supervisorCartableReport(Request $request, RoadPatrolReportService $roadPatrolReportService): BinaryFileResponse
{
$name = 'گزارش از کارتابل ارزیابی گشت راهداری ' . verta()->now()->format('Y-m-d H:i') . '.xlsx';
return Excel::download(
new SupervisorCartableExport($request->id, $request->fromDate,
$request->toDate, $request->province_id, $request->edare_id
), $name
);
$data = $roadPatrolReportService->supervisorCartableReport($request);
return Excel::download(new SupervisorCartableReport($data['data']), $name);
}
public function operatorIndex(Request $request): JsonResponse
public function operatorIndex(Request $request, RoadPatrolReportService $roadPatrolReportService): JsonResponse
{
$columns = array(
'id', 'start_lat', 'start_lon', 'end_lat', 'end_lon', 'officer_plaque',
'officer_phone_number', 'officer_name', 'supervisor_description', 'supervising_time',
'supervisor_name', 'status', 'status_fa', 'distance', 'start_time', 'end_time', 'cmmsMachines.machine_code'
);
$allowedFilters = $columns;
$allowedSortings = $columns;
$query = RoadPatrol::query()
->with(['rahdaran:id,name,code', 'cmmsMachines:id,machine_code,car_name,plak_number'])
->where('operator_id', '=', auth()->user()->id);
$data = DataTableFacade::run(
$query,
$request,
allowedFilters: $allowedFilters,
allowedSortings: $allowedSortings);
$data = $roadPatrolReportService->operatorCartableReport($request);
return response()->json($data);
}
@@ -150,15 +98,11 @@ class RoadPatrolProjectController extends Controller
$user = auth()->user();
if ($user->edarate_ostani_id || is_null($user->city_id)) {
return response()->json([
'message' => 'امکان ثبت فعالیت برای ادارات استانی وجود ندارد!'
], 400);
return $this->errorResponse('امکان ثبت فعالیت برای ادارات استانی وجود ندارد!');
}
if (is_null($user->edarate_shahri_id)) {
return response()->json([
'message' => 'اداره شهری برای شما در سامانه ثبت نشده است!'
], 400);
return $this->errorResponse('اداره شهری برای شما در سامانه ثبت نشده است!');
}
$edare_id = $user->edarate_shahri_id ?? $user->edarate_ostani_id;
@@ -211,8 +155,13 @@ class RoadPatrolProjectController extends Controller
$item_end_coordinates = null;
if ($item['instant_action'] == 0) {
$priority = [
1 => 'عادی',
2 => 'فوری',
3 => 'آنی',
];
$observed_item->priority = $item['priority'];
$observed_item->priority_fa = $item['priority_fa'];
$observed_item->priority_fa = $priority[$item['priority']];
$observed_item->save();
} elseif ($item['instant_action'] == 1) {
if ($info_item->needs_end_point) {
@@ -279,9 +228,7 @@ class RoadPatrolProjectController extends Controller
$road_item = RoadItemsProject::store($user, $attributes, $before_image, $after_image, $observed_item->id);
if ($road_item === -1) {
return response()->json([
'message' => 'اقدام مربوطه قبلا رسیدگی شده است.'
], 400);
return $this->errorResponse('اقدام مربوطه قبلا رسیدگی شده است.');
}
$road_item->rahdaran()->attach($item['road_item_rahdaran_id']);
@@ -332,27 +279,6 @@ class RoadPatrolProjectController extends Controller
return $this->successResponse($data);
}
public function getAllDataToMap(Request $request): JsonResponse
{
$date_from = $request->date_from ? $request->date_from .' 00:00:00' : Date('Y-m-d') .' 00:00:00';
$date_to = $request->date_to ? $request->date_to.' 23:59:59' : (new \DateTime('tomorrow'))->format('Y-m-d').' 23:59:59';
$data = RoadPatrol::query()->when($request->province_id, function ($query, $province) {
return $query->where('province_id', '=', $province);
})
->when($request->edare_id, function ($query, $edare_id) {
return $query->where('edare_id', '=', $edare_id);
})
->whereBetween('created_at', [
$date_from,
$date_to,
])
->select('id', 'start_lat', 'start_lon')
->get();
return $this->successResponse($data);
}
public function map(Request $request): JsonResponse
{
$province = $request->province_id;
@@ -360,8 +286,8 @@ class RoadPatrolProjectController extends Controller
$status = $request->status;
$rms_status = $request->rms_status;
if ($request->date_from && $request->date_to) {
$date_from = $request->date_from.' 00:00:00';
if ($request->from_date && $request->date_to) {
$date_from = $request->from_date.' 00:00:00';
$date_to = $request->date_to.' 23:59:59';
} else {
$date_from = Date('Y-m-d');
@@ -396,12 +322,10 @@ class RoadPatrolProjectController extends Controller
return $this->successResponse($roadPatrol);
}
public function operatorCartableReport(Request $request): BinaryFileResponse
public function operatorCartableReport(Request $request, RoadPatrolReportService $roadPatrolReportService): BinaryFileResponse
{
$name = 'گزارش از کارتابل عملیات گشت راهداری ' . verta()->now()->format('Y-m-d H:i') . '.xlsx';
return Excel::download(
new OperatorCartableExport($request->id, $request->status, $request->officer_name, $request->fromDate, $request->toDate),
$name
);
$data = $roadPatrolReportService->operatorCartableReport($request);
return Excel::download(new OperatorCartableReport($data['data']), $name);
}
}

View File

@@ -27,7 +27,7 @@ class StoreRequest extends FormRequest
'distance' => 'numeric',
'start_time' => 'required|date_format:Y-m-d H:i',
'end_time' => 'required|date_format:Y-m-d H:i|after:start_time',
'fuel_consumption' => 'required|integer',
'fuel_consumption' => 'required|numeric',
'vehicle_runtime' => 'required|integer',
'stop_points' => 'required|array',
'road_patrol_machines_id' => 'required|array',
@@ -38,9 +38,9 @@ class StoreRequest extends FormRequest
'observed_items' => 'array',
'observed_items.*.item_id' => 'required|integer',
'observed_items.*.sub_item_id' => 'required|integer',
'observed_items.*.local_name' => 'required',
'observed_items.*.description' => '',
'observed_items.*.instant_action' => 'required|in:0,1',
'observed_items.*.local_name' => 'required_if:observed_items.*.instant_action,0',
// road item projects fields
'observed_items.*.start_point' => 'required',
@@ -49,8 +49,7 @@ class StoreRequest extends FormRequest
'observed_items.*.before_image' => 'image|max:4096',
'observed_items.*.after_image' => 'image|max:4096',
'observed_items.*.priority' => 'integer|in:1,2,3|required_if:observed_items.*.instant_action,0',
'observed_items.*.priority_fa' => 'string|required_if:observed_items.*.instant_action,0',
'description' => 'string|required_with:observed_items',
'description' => 'string',
'observed_items.*.road_item_machines_id' => 'required_if:observed_items.*.instant_action,1|array',
'observed_items.*.road_item_machines_id.*' => 'required_if:observed_items.*.instant_action,1|exists:cmms_machines,id',

View File

@@ -0,0 +1,50 @@
<?php
namespace App\Jobs;
use App\Models\RoadObserved;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use SoapClient;
class SendRoadObservationToNikarayan implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*/
public function __construct(private RoadObserved $roadObserved){}
/**
* Execute the job.
*/
public function handle(): void
{
try {
$url = "https://riws.rmto.ir/WebServices/NRPTrafficStatus.asmx?wsdl";
$array = array(
'strUserName' => 'vaytelrop',
'strPassword' => 'VaYtelROP*2024',
'strAutoID' => $this->roadObserved->fk_RegisteredEventMessage,
'strStateID' => '2',
'strDescription' => 'گزارشات تایید شده از تاریخ 1 فروردین 1403 تا 14 مهر 1403',
'strRMSDateAndTime' => $this->roadObserved->updated_at
);
$soapClient = new SoapClient($url);
$soapClient->UpdateInfo_RoadObservedProblems($array);
}
catch (\Exception $exception){
Log::channel('road_observation_problem')->error($exception->getMessage(), [
'roadObserved' => $this->roadObserved,
]);
}
}
}

View File

@@ -6,6 +6,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\MorphToMany;
use Illuminate\Database\Eloquent\Casts\Attribute;
class RoadPatrol extends Model
{
@@ -13,6 +14,13 @@ class RoadPatrol extends Model
protected $guarded = ['id'];
protected function stopPoints(): Attribute
{
return Attribute::make(
get: fn ($value) => $value ? json_decode($value) : null,
);
}
public function observedItems(): HasMany
{
return $this->hasMany(ObservedItem::class);

View File

@@ -2,6 +2,7 @@
namespace App\Providers;
use App\Models\User;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
use App\Models\EdarateOstani;
@@ -50,5 +51,9 @@ class AuthServiceProvider extends ServiceProvider
return $user->can('supervise-fast-react') ||
($user->can('supervise-fast-react-province') && $road_observed->province_id == $user->province_id);
});
Gate::define('viewPulse', function (User $user) {
return $user->username == 'witel';
});
}
}

View File

@@ -15,10 +15,10 @@ class DataTableInput
* @param array $rels
*/
public function __construct(
private int $start,
private ?int $start,
private ?int $size,
private array $filters,
private array $sorting,
private ?array $sorting,
private array $rels,
private array $allowedFilters,
private array $allowedSortings,
@@ -26,7 +26,7 @@ class DataTableInput
{
}
public function getStart(): int
public function getStart(): ?int
{
return $this->start;
}
@@ -74,6 +74,4 @@ class DataTableInput
{
return $this->rels;
}
}

View File

@@ -76,7 +76,9 @@ class DataTableService
$this->totalRowCount = $query->count();
$query->offset($this->dataTableInput->getStart());
if (!is_null($this->dataTableInput->getStart())) {
$query->offset($this->dataTableInput->getStart());
}
if(!is_null($this->dataTableInput->getSize())){
$query->limit($this->dataTableInput->getSize());

View File

@@ -13,11 +13,17 @@ class FilterBetween extends SearchFilter
[$minVal, $maxVal] = $this->filter->getValue();
if ($minVal) {
if ($this->filter->getDatatype() == "date") {
$minVal = $minVal . " 00:00:00";
}
$this->filter->setValue($minVal);
$query = (new FilterGreaterThanOrEqual($this->query, $this->filter))->apply();
}
if ($maxVal) {
if ($this->filter->getDatatype() == "date") {
$maxVal = $maxVal . " 23:59:59";
}
$this->filter->setValue($maxVal);
$query = (new FilterLessThanOrEqual($this->query, $this->filter))->apply();
}

View File

@@ -50,7 +50,7 @@ class FilterValidator
protected function isAllowed(Filter $filter, array $allowedFilters): bool
{
return in_array($filter->getId(), $allowedFilters);
return $allowedFilters == ['*'] || in_array($filter->getId(), $allowedFilters);
}
protected function isValidSearchFunction(Filter $filter): bool

View File

@@ -34,6 +34,6 @@ class SortingValidator
protected function isAllowed(Sort $sorting, array $allowedSortings): bool
{
return in_array($sorting->getId(), $allowedSortings);
return $allowedSortings == ['*'] || in_array($sorting->getId(), $allowedSortings);
}
}

View File

@@ -0,0 +1,233 @@
<?php
namespace App\Services\Reports;
use App\Facades\DataTable\DataTableFacade;
use App\Models\InfoItem;
use App\Models\RoadItemsProject;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
class RoadItemReportService
{
public function supervisorCartableReport(Request $request)
{
$columns = array(
'id', 'user_id', 'start_lat', 'start_lng', 'end_lat',
'end_lng', 'project_distance', 'item', 'item_fa', 'sub_item_fa', 'sub_item',
'sub_item_data', 'created_at', 'updated_at', 'province_id', 'province_fa',
'unit_fa', 'status', 'status_fa', 'supervisor_description', 'supervising_time',
'supervisor_name', 'edarat_id', 'edarat_name', 'activity_date_time','cmmsMachines.machine_code', 'rahdaran.code',
);
$allowedFilters = $columns;
$allowedSortings = $columns;
$user = auth()->user();
$query = null;
if ($user->hasPermissionTo('show-road-item-supervise-cartable')) {
$query = RoadItemsProject::query()->where('is_new', 1)->with(['files', 'rahdaran:id,name,code', 'cmmsMachines:id,machine_code,car_name,plak_number']);
}
elseif ($user->hasPermissionTo('show-road-item-supervise-cartable-province')) {
if (is_null($user->province_id)) {
return $this->errorResponse('استانی برای شما در سامانه ثبت نشده است!');
}
$query = RoadItemsProject::query()->where('is_new', 1)
->with(['files', 'rahdaran:id,name,code', 'cmmsMachines:id,machine_code,car_name,plak_number'])->where('province_id', auth()->user()->province_id);
}
$data = DataTableFacade::run(
$query,
$request,
allowedFilters: $allowedFilters,
allowedSortings: $allowedSortings);
return $data;
}
public function operatorCartableReport(Request $request)
{
$columns = array(
'id', 'user_id', 'start_lat', 'start_lng', 'end_lat',
'end_lng', 'project_distance', 'item', 'item_fa', 'sub_item_fa', 'sub_item',
'sub_item_data', 'created_at', 'updated_at', 'province_id', 'province_fa',
'unit_fa', 'status', 'status_fa', 'supervisor_description', 'supervising_time',
'supervisor_name', 'edarat_id', 'edarat_name', 'activity_date_time', 'cmmsMachines.machine_code', 'rahdaran.code',
);
$allowedFilters = $columns;
$allowedSortings = $columns;
$query = RoadItemsProject::with(['files', 'rahdaran:id,name,code', 'cmmsMachines:id,machine_code,car_name,plak_number'])
->where('is_new', 1)
->where('user_id', auth()->user()->id);
$data = DataTableFacade::run(
$query,
$request,
allowedFilters: $allowedFilters,
allowedSortings: $allowedSortings);
return $data;
}
public function countryActivityPerSubItem(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();
$item = $request->item;
$provinceRoadItemsPerSubItem = RoadItemsProject::query()->selectRaw('
sub_item AS t,
COUNT(*) AS c,
CAST(SUM(CASE WHEN sub_item_data > 0 THEN sub_item_data ELSE ABS(sub_item_data) END) AS UNSIGNED) AS s,
province_id AS p')
->where('item', '=', $item)
->whereBetween('activity_date_time', [$fromDate, $toDate])
->where('status', '=', 1)
->groupBy('province_id', 'sub_item')
->get();
$countryRoadItemsPerSubItem = RoadItemsProject::query()->selectRaw('
sub_item AS t,
COUNT(*) AS c,
CAST(SUM(CASE WHEN sub_item_data > 0 THEN sub_item_data ELSE ABS(sub_item_data) END) AS UNSIGNED) AS s,
-1 AS p')
->where('item', '=', $item)
->whereBetween('activity_date_time', [$fromDate, $toDate])
->where('status', '=', 1)
->groupBy('sub_item')
->get();
$activities = $provinceRoadItemsPerSubItem->push(...$countryRoadItemsPerSubItem);
return [
'data' => $activities,
'fromDate' => $fromDate,
'toDate' => $toDate,
];
}
public function provinceActivityPerSubItem(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();
$item = $request->item;
$province = $request->province_id;
$cityRoadItemsPerSubItem = RoadItemsProject::query()->selectRaw('
sub_item AS t,
COUNT(*) AS c,
CAST(SUM(CASE WHEN sub_item_data > 0 THEN sub_item_data ELSE ABS(sub_item_data) END) AS UNSIGNED) AS s,
province_id AS p,
edarat_id AS ci
')
->where('item', '=', $item)
->where('province_id', '=', $province)
->whereBetween('activity_date_time', [$fromDate, $toDate])
->where('status', '=', 1)
->groupBy('edarat_id', 'sub_item')
->get();
$provinceRoadItemsPerSubItem = RoadItemsProject::query()->selectRaw('
sub_item AS t,
COUNT(*) AS c,
CAST(SUM(CASE WHEN sub_item_data > 0 THEN sub_item_data ELSE ABS(sub_item_data) END) AS UNSIGNED) AS s,
province_id AS p,
-1 AS ci
')
->where('item', '=', $item)
->where('province_id', '=', $province)
->whereBetween('activity_date_time', [$fromDate, $toDate])
->where('status', '=', 1)
->groupBy('sub_item')
->get();
$activities = $cityRoadItemsPerSubItem->push(...$provinceRoadItemsPerSubItem);
return [
'data' => $activities,
'fromDate' => $fromDate,
'toDate' => $toDate,
];
}
public function countryActivityPerItem(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();
$user = auth()->user();
// $isSpecialUser = in_array($user->username, ['witel', 'drdanesh']);
$isSpecialUser = $user->hasPermissionTo("show-road-item-supervise-cartable");
$provinceId = $isSpecialUser ? null : $user->province_id;
$provinceActivity = RoadItemsProject::query()
->selectRaw('COUNT(*) AS s, province_id AS p, item AS i')
->where('status', 1)
->whereBetween('activity_date_time', [$fromDate, $toDate])
->when(!$isSpecialUser, function ($query) use ($provinceId) {
$query->where('province_id', $provinceId);
})
->groupBy('province_id', 'item');
$countryActivity = RoadItemsProject::query()
->selectRaw('COUNT(*) AS s, -1 AS p, item AS i')
->where('status', 1)
->whereBetween('activity_date_time', [$fromDate, $toDate])
->when(!$isSpecialUser, function ($query) use ($provinceId) {
$query->where('province_id', $provinceId);
})
->groupBy('item');
$activities = $provinceActivity
->unionAll($countryActivity)
->get();
return [
'data' => $activities,
'fromDate' => $fromDate,
'toDate' => $toDate,
];
}
public function provinceActivityPerItem(Request $request): array
{
$provinceId = $request->province_id;
$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();
$edarehActivity = RoadItemsProject::query()
->selectRaw('
COUNT(*) AS s,
edarat_id AS c,
item AS i')
->where('status', '=', 1)
->whereBetween('activity_date_time', [$fromDate, $toDate])
->where('province_id', $provinceId)
->groupBy('item', 'edarat_id');
$cityActivity = RoadItemsProject::query()
->selectRaw('
COUNT(*) AS s,
-1 AS c,
item AS i')
->where('status', '=', 1)
->whereBetween('activity_date_time', [$fromDate, $toDate])
->where('province_id', $provinceId)
->groupBy('item');
$activities = $edarehActivity
->unionAll($cityActivity)
->get();
return [
'data' => $activities,
'fromDate' => $fromDate,
'toDate' => $toDate,
];
}
}

View File

@@ -0,0 +1,196 @@
<?php
namespace App\Services\Reports;
use App\Facades\DataTable\DataTableFacade;
use App\Models\RoadPatrol;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class RoadPatrolReportService
{
public function supervisorCartableReport(Request $request)
{
$columns = array(
'id', 'start_lat', 'start_lon', 'end_lat', 'end_lon', 'operator_id', 'created_at',
'operator_name', 'officer_plaque', 'officer_phone_number', 'officer_name',
'supervisor_description', 'supervising_time', 'supervisor_name', 'status',
'status_fa', 'distance', 'province_id', 'province_fa', 'edare_id', 'edare_name',
'start_time', 'end_time','description', 'cmmsMachines.machine_code', 'rahdaran.code',
);
$allowedFilters = $columns;
$allowedSortings = $columns;
$user = auth()->user();
$query = null;
if ($user->hasPermissionTo('show-road-patrol-supervise-cartable')) {
$query = RoadPatrol::query()
->with(['rahdaran:id,name,code', 'cmmsMachines:id,machine_code,car_name,plak_number']);
}
elseif ($user->hasPermissionTo('show-road-patrol-supervise-cartable-province')) {
if (is_null($user->province_id)) {
return $this->errorResponse('استانی برای شما در سامانه ثبت نشده است!');
}
$query = RoadPatrol::query()
->with(['rahdaran:id,name,code', 'cmmsMachines:id,machine_code,car_name,plak_number'])
->where('province_id', '=', $user->province_id);
}
$data = DataTableFacade::run(
$query,
$request,
allowedFilters: $allowedFilters,
allowedSortings: $allowedSortings);
return $data;
}
public function operatorCartableReport(Request $request)
{
$columns = array(
'id', 'start_lat', 'start_lon', 'end_lat', 'end_lon', 'officer_plaque', 'created_at',
'officer_phone_number', 'officer_name', 'supervisor_description', 'supervising_time',
'supervisor_name', 'status', 'status_fa', 'distance', 'start_time', 'end_time', 'cmmsMachines.machine_code', 'rahdaran.code',
);
$allowedFilters = $columns;
$allowedSortings = $columns;
$query = RoadPatrol::query()
->with(['rahdaran:id,name,code', 'cmmsMachines:id,machine_code,car_name,plak_number'])
->where('operator_id', '=', auth()->user()->id);
$data = DataTableFacade::run(
$query,
$request,
allowedFilters: $allowedFilters,
allowedSortings: $allowedSortings);
return $data;
}
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();
$activities = DB::select('SELECT
"کشوری" as province_fa,
-1 as province_id,
COUNT(*) tedade,
SUM(tedad_mavarede_moshede_shode_adi) as tedad_mavarede_moshede_shode_adi,
SUM(tedad_mavarede_moshede_shode_fori) as tedad_mavarede_moshede_shode_fori,
SUM(tedad_mavarede_moshede_shode_ani) as tedad_mavarede_moshede_shode_ani,
SUM(tedad_mavarede_peygiri_shode) as tedad_mavarede_peygiri_shode,
SUM(tedad_faliyat_sabt_shode) as tedad_faliyat_sabt_shode,
ROUND(SUM(distance)) as masafat_tey_shode
FROM (SELECT
province_id,
province_fa,
distance,
(SELECT COUNT(*) FROM `observed_items` oi WHERE rp.`id`= oi.road_patrol_id AND priority = 1) AS tedad_mavarede_moshede_shode_adi,
(SELECT COUNT(*) FROM `observed_items` oi WHERE rp.`id`= oi.road_patrol_id AND priority = 2) AS tedad_mavarede_moshede_shode_fori,
(SELECT COUNT(*) FROM `observed_items` oi WHERE rp.`id`= oi.road_patrol_id AND priority = 3) AS tedad_mavarede_moshede_shode_ani,
(SELECT COUNT(*) FROM `observed_items` oii WHERE rp.`id`= oii.road_patrol_id AND oii.road_item_id IS NOT NULL AND priority IS NOT NULL) AS tedad_mavarede_peygiri_shode,
(SELECT COUNT(*) FROM `observed_items` oii WHERE rp.`id`= oii.road_patrol_id AND oii.road_item_id IS NOT NULL AND priority IS NULL) AS tedad_faliyat_sabt_shode
FROM `road_patrols` rp where rp.start_time BETWEEN "'.$fromDate.'" AND "'.$toDate.'") temp
union
SELECT
province_fa,
province_id,
COUNT(*) tedade,
SUM(tedad_mavarede_moshede_shode_adi) as tedad_mavarede_moshede_shode_adi,
SUM(tedad_mavarede_moshede_shode_fori) as tedad_mavarede_moshede_shode_fori,
SUM(tedad_mavarede_moshede_shode_ani) as tedad_mavarede_moshede_shode_ani,
SUM(tedad_mavarede_peygiri_shode) as tedad_mavarede_peygiri_shode,
SUM(tedad_faliyat_sabt_shode) as tedad_faliyat_sabt_shode,
ROUND(SUM(distance)) as masafat_tey_shode
FROM (SELECT
province_id,
province_fa,
distance,
(SELECT COUNT(*) FROM `observed_items` oi WHERE rp.`id`= oi.road_patrol_id AND priority = 1) AS tedad_mavarede_moshede_shode_adi,
(SELECT COUNT(*) FROM `observed_items` oi WHERE rp.`id`= oi.road_patrol_id AND priority = 2) AS tedad_mavarede_moshede_shode_fori,
(SELECT COUNT(*) FROM `observed_items` oi WHERE rp.`id`= oi.road_patrol_id AND priority = 3) AS tedad_mavarede_moshede_shode_ani,
(SELECT COUNT(*) FROM `observed_items` oii WHERE rp.`id`= oii.road_patrol_id AND oii.road_item_id IS NOT NULL AND priority IS NOT NULL) AS tedad_mavarede_peygiri_shode,
(SELECT COUNT(*) FROM `observed_items` oii WHERE rp.`id`= oii.road_patrol_id AND oii.road_item_id IS NOT NULL AND priority IS NULL) AS tedad_faliyat_sabt_shode
FROM `road_patrols` rp where rp.start_time BETWEEN "'.$fromDate.'" AND "'.$toDate.'") temp
GROUP BY province_id'
);
return [
'data' => $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;
$activities = DB::select(
'SELECT
province_fa,
province_id,
-1 AS edare_id,
"استانی" AS edare_name,
COUNT(*) tedade,
SUM(tedad_mavarede_moshede_shode_adi) as tedad_mavarede_moshede_shode_adi,
SUM(tedad_mavarede_moshede_shode_fori) as tedad_mavarede_moshede_shode_fori,
SUM(tedad_mavarede_moshede_shode_ani) as tedad_mavarede_moshede_shode_ani,
SUM(tedad_mavarede_peygiri_shode) as tedad_mavarede_peygiri_shode,
SUM(tedad_faliyat_sabt_shode) as tedad_faliyat_sabt_shode,
ROUND(SUM(distance)) as masafat_tey_shode
FROM (SELECT
province_id,
province_fa,
edare_id,
edare_name,
distance,
(SELECT COUNT(*) FROM `observed_items` oi WHERE rp.`id`= oi.road_patrol_id AND priority = 1) AS tedad_mavarede_moshede_shode_adi,
(SELECT COUNT(*) FROM `observed_items` oi WHERE rp.`id`= oi.road_patrol_id AND priority = 2) AS tedad_mavarede_moshede_shode_fori,
(SELECT COUNT(*) FROM `observed_items` oi WHERE rp.`id`= oi.road_patrol_id AND priority = 3) AS tedad_mavarede_moshede_shode_ani,
(SELECT COUNT(*) FROM `observed_items` oii WHERE rp.`id`= oii.road_patrol_id AND oii.road_item_id IS NOT NULL AND priority IS NOT NULL) AS tedad_mavarede_peygiri_shode,
(SELECT COUNT(*) FROM `observed_items` oii WHERE rp.`id`= oii.road_patrol_id AND oii.road_item_id IS NOT NULL AND priority IS NULL) AS tedad_faliyat_sabt_shode
FROM `road_patrols` rp where rp.province_id = "'.$provinceId.'" AND rp.start_time BETWEEN "'.$fromDate.'" AND "'.$toDate.'") temp
UNION
SELECT
province_fa,
province_id,
edare_id,
edare_name,
COUNT(*) tedade,
SUM(tedad_mavarede_moshede_shode_adi) as tedad_mavarede_moshede_shode_adi,
SUM(tedad_mavarede_moshede_shode_fori) as tedad_mavarede_moshede_shode_fori,
SUM(tedad_mavarede_moshede_shode_ani) as tedad_mavarede_moshede_shode_ani,
SUM(tedad_mavarede_peygiri_shode) as tedad_mavarede_peygiri_shode,
SUM(tedad_faliyat_sabt_shode) as tedad_faliyat_sabt_shode,
ROUND(SUM(distance)) as masafat_tey_shode
FROM (SELECT
province_id,
province_fa,
edare_id,
edare_name,
distance,
(SELECT COUNT(*) FROM `observed_items` oi WHERE rp.`id`= oi.road_patrol_id AND priority = 1) AS tedad_mavarede_moshede_shode_adi,
(SELECT COUNT(*) FROM `observed_items` oi WHERE rp.`id`= oi.road_patrol_id AND priority = 2) AS tedad_mavarede_moshede_shode_fori,
(SELECT COUNT(*) FROM `observed_items` oi WHERE rp.`id`= oi.road_patrol_id AND priority = 3) AS tedad_mavarede_moshede_shode_ani,
(SELECT COUNT(*) FROM `observed_items` oii WHERE rp.`id`= oii.road_patrol_id AND oii.road_item_id IS NOT NULL AND priority IS NOT NULL) AS tedad_mavarede_peygiri_shode,
(SELECT COUNT(*) FROM `observed_items` oii WHERE rp.`id`= oii.road_patrol_id AND oii.road_item_id IS NOT NULL AND priority IS NULL) AS tedad_faliyat_sabt_shode
FROM `road_patrols` rp where rp.province_id = "'.$provinceId.'" AND rp.start_time BETWEEN "'.$fromDate.'" AND "'.$toDate.'") temp
GROUP BY edare_id
'
);
return [
'data' => $activities,
'fromDate' => $fromDate,
'toDate' => $toDate
];
}
}

View File

@@ -28,6 +28,17 @@
0 => 'KitLoong\\MigrationsGenerator\\MigrationsGeneratorServiceProvider',
),
),
'laravel/pulse' =>
array (
'aliases' =>
array (
'Pulse' => 'Laravel\\Pulse\\Facades\\Pulse',
),
'providers' =>
array (
0 => 'Laravel\\Pulse\\PulseServiceProvider',
),
),
'laravel/sail' =>
array (
'providers' =>
@@ -63,6 +74,17 @@
0 => 'Laravel\\Ui\\UiServiceProvider',
),
),
'livewire/livewire' =>
array (
'aliases' =>
array (
'Livewire' => 'Livewire\\Livewire',
),
'providers' =>
array (
0 => 'Livewire\\LivewireServiceProvider',
),
),
'maatwebsite/excel' =>
array (
'providers' =>

View File

@@ -26,26 +26,28 @@
22 => 'Barryvdh\\Debugbar\\ServiceProvider',
23 => 'Hekmatinasser\\Verta\\Laravel\\VertaServiceProvider',
24 => 'KitLoong\\MigrationsGenerator\\MigrationsGeneratorServiceProvider',
25 => 'Laravel\\Sail\\SailServiceProvider',
26 => 'Laravel\\Sanctum\\SanctumServiceProvider',
27 => 'Laravel\\Telescope\\TelescopeServiceProvider',
28 => 'Laravel\\Tinker\\TinkerServiceProvider',
29 => 'Laravel\\Ui\\UiServiceProvider',
30 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
31 => 'Carbon\\Laravel\\ServiceProvider',
32 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
33 => 'Termwind\\Laravel\\TermwindServiceProvider',
34 => 'Spatie\\LaravelIgnition\\IgnitionServiceProvider',
35 => 'Spatie\\Permission\\PermissionServiceProvider',
36 => 'Spatie\\Permission\\PermissionServiceProvider',
37 => 'App\\Providers\\AppServiceProvider',
38 => 'App\\Providers\\AuthServiceProvider',
39 => 'App\\Providers\\EventServiceProvider',
40 => 'App\\Providers\\RouteServiceProvider',
41 => 'App\\Providers\\TelescopeServiceProvider',
42 => 'Barryvdh\\Debugbar\\ServiceProvider',
43 => 'App\\Providers\\DataTableServiceProvider',
44 => 'App\\Providers\\FileServiceProvider',
25 => 'Laravel\\Pulse\\PulseServiceProvider',
26 => 'Laravel\\Sail\\SailServiceProvider',
27 => 'Laravel\\Sanctum\\SanctumServiceProvider',
28 => 'Laravel\\Telescope\\TelescopeServiceProvider',
29 => 'Laravel\\Tinker\\TinkerServiceProvider',
30 => 'Laravel\\Ui\\UiServiceProvider',
31 => 'Livewire\\LivewireServiceProvider',
32 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
33 => 'Carbon\\Laravel\\ServiceProvider',
34 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
35 => 'Termwind\\Laravel\\TermwindServiceProvider',
36 => 'Spatie\\LaravelIgnition\\IgnitionServiceProvider',
37 => 'Spatie\\Permission\\PermissionServiceProvider',
38 => 'Spatie\\Permission\\PermissionServiceProvider',
39 => 'App\\Providers\\AppServiceProvider',
40 => 'App\\Providers\\AuthServiceProvider',
41 => 'App\\Providers\\EventServiceProvider',
42 => 'App\\Providers\\RouteServiceProvider',
43 => 'App\\Providers\\TelescopeServiceProvider',
44 => 'Barryvdh\\Debugbar\\ServiceProvider',
45 => 'App\\Providers\\DataTableServiceProvider',
46 => 'App\\Providers\\FileServiceProvider',
),
'eager' =>
array (
@@ -62,24 +64,26 @@
10 => 'Barryvdh\\Debugbar\\ServiceProvider',
11 => 'Hekmatinasser\\Verta\\Laravel\\VertaServiceProvider',
12 => 'KitLoong\\MigrationsGenerator\\MigrationsGeneratorServiceProvider',
13 => 'Laravel\\Sanctum\\SanctumServiceProvider',
14 => 'Laravel\\Telescope\\TelescopeServiceProvider',
15 => 'Laravel\\Ui\\UiServiceProvider',
16 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
17 => 'Carbon\\Laravel\\ServiceProvider',
18 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
19 => 'Termwind\\Laravel\\TermwindServiceProvider',
20 => 'Spatie\\LaravelIgnition\\IgnitionServiceProvider',
21 => 'Spatie\\Permission\\PermissionServiceProvider',
22 => 'Spatie\\Permission\\PermissionServiceProvider',
23 => 'App\\Providers\\AppServiceProvider',
24 => 'App\\Providers\\AuthServiceProvider',
25 => 'App\\Providers\\EventServiceProvider',
26 => 'App\\Providers\\RouteServiceProvider',
27 => 'App\\Providers\\TelescopeServiceProvider',
28 => 'Barryvdh\\Debugbar\\ServiceProvider',
29 => 'App\\Providers\\DataTableServiceProvider',
30 => 'App\\Providers\\FileServiceProvider',
13 => 'Laravel\\Pulse\\PulseServiceProvider',
14 => 'Laravel\\Sanctum\\SanctumServiceProvider',
15 => 'Laravel\\Telescope\\TelescopeServiceProvider',
16 => 'Laravel\\Ui\\UiServiceProvider',
17 => 'Livewire\\LivewireServiceProvider',
18 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
19 => 'Carbon\\Laravel\\ServiceProvider',
20 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
21 => 'Termwind\\Laravel\\TermwindServiceProvider',
22 => 'Spatie\\LaravelIgnition\\IgnitionServiceProvider',
23 => 'Spatie\\Permission\\PermissionServiceProvider',
24 => 'Spatie\\Permission\\PermissionServiceProvider',
25 => 'App\\Providers\\AppServiceProvider',
26 => 'App\\Providers\\AuthServiceProvider',
27 => 'App\\Providers\\EventServiceProvider',
28 => 'App\\Providers\\RouteServiceProvider',
29 => 'App\\Providers\\TelescopeServiceProvider',
30 => 'Barryvdh\\Debugbar\\ServiceProvider',
31 => 'App\\Providers\\DataTableServiceProvider',
32 => 'App\\Providers\\FileServiceProvider',
),
'deferred' =>
array (

View File

@@ -11,6 +11,7 @@
"guzzlehttp/guzzle": "^7.2",
"hekmatinasser/verta": "^8.3",
"laravel/framework": "^10.10",
"laravel/pulse": "^1.0@beta",
"laravel/sanctum": "^3.2",
"laravel/telescope": "^4.17",
"laravel/tinker": "^2.8",
@@ -76,6 +77,6 @@
"php-http/discovery": true
}
},
"minimum-stability": "stable",
"minimum-stability": "beta",
"prefer-stable": true
}

227
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "f354c54643bedde32669099052baa40c",
"content-hash": "fb6adbe1f5e02aaf3de31c514710f0b6",
"packages": [
{
"name": "beberlei/assert",
@@ -865,6 +865,61 @@
],
"time": "2022-12-15T16:57:16+00:00"
},
{
"name": "doctrine/sql-formatter",
"version": "1.5.2",
"source": {
"type": "git",
"url": "https://github.com/doctrine/sql-formatter.git",
"reference": "d6d00aba6fd2957fe5216fe2b7673e9985db20c8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/sql-formatter/zipball/d6d00aba6fd2957fe5216fe2b7673e9985db20c8",
"reference": "d6d00aba6fd2957fe5216fe2b7673e9985db20c8",
"shasum": ""
},
"require": {
"php": "^8.1"
},
"require-dev": {
"doctrine/coding-standard": "^12",
"ergebnis/phpunit-slow-test-detector": "^2.14",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^10.5"
},
"bin": [
"bin/sql-formatter"
],
"type": "library",
"autoload": {
"psr-4": {
"Doctrine\\SqlFormatter\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jeremy Dorn",
"email": "jeremy@jeremydorn.com",
"homepage": "https://jeremydorn.com/"
}
],
"description": "a PHP SQL highlighting library",
"homepage": "https://github.com/doctrine/sql-formatter/",
"keywords": [
"highlight",
"sql"
],
"support": {
"issues": "https://github.com/doctrine/sql-formatter/issues",
"source": "https://github.com/doctrine/sql-formatter/tree/1.5.2"
},
"time": "2025-01-24T11:45:48+00:00"
},
{
"name": "dragonmantank/cron-expression",
"version": "v3.3.3",
@@ -2043,6 +2098,92 @@
},
"time": "2023-12-29T22:37:42+00:00"
},
{
"name": "laravel/pulse",
"version": "v1.0.0-beta15",
"source": {
"type": "git",
"url": "https://github.com/laravel/pulse.git",
"reference": "6fc88b3ead77fd1c67428f0c0fa6ac2ec5302e2b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/pulse/zipball/6fc88b3ead77fd1c67428f0c0fa6ac2ec5302e2b",
"reference": "6fc88b3ead77fd1c67428f0c0fa6ac2ec5302e2b",
"shasum": ""
},
"require": {
"doctrine/sql-formatter": "^1.1",
"guzzlehttp/promises": "^1.0|^2.0",
"illuminate/auth": "^10.34|^11.0",
"illuminate/cache": "^10.34|^11.0",
"illuminate/config": "^10.34|^11.0",
"illuminate/console": "^10.34|^11.0",
"illuminate/contracts": "^10.34|^11.0",
"illuminate/database": "^10.34|^11.0",
"illuminate/events": "^10.34|^11.0",
"illuminate/http": "^10.34|^11.0",
"illuminate/queue": "^10.34|^11.0",
"illuminate/redis": "^10.34|^11.0",
"illuminate/routing": "^10.34|^11.0",
"illuminate/support": "^10.34|^11.0",
"illuminate/view": "^10.34|^11.0",
"livewire/livewire": "^3.2",
"nesbot/carbon": "^2.67|^3.0",
"php": "^8.1"
},
"conflict": {
"nunomaduro/collision": "<7.7.0"
},
"require-dev": {
"guzzlehttp/guzzle": "^7.7",
"mockery/mockery": "^1.0",
"orchestra/testbench": "^8.16|^9.0",
"pestphp/pest": "^2.0",
"pestphp/pest-plugin-laravel": "^2.2",
"phpstan/phpstan": "^1.11",
"predis/predis": "^1.0|^2.0"
},
"type": "library",
"extra": {
"laravel": {
"aliases": {
"Pulse": "Laravel\\Pulse\\Facades\\Pulse"
},
"providers": [
"Laravel\\Pulse\\PulseServiceProvider"
]
},
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"Laravel\\Pulse\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}
],
"description": "Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.",
"homepage": "https://github.com/laravel/pulse",
"keywords": [
"laravel"
],
"support": {
"issues": "https://github.com/laravel/pulse/issues",
"source": "https://github.com/laravel/pulse"
},
"time": "2024-03-11T13:19:11+00:00"
},
{
"name": "laravel/sanctum",
"version": "v3.3.3",
@@ -2762,6 +2903,82 @@
],
"time": "2024-01-28T23:22:08+00:00"
},
{
"name": "livewire/livewire",
"version": "v3.5.4",
"source": {
"type": "git",
"url": "https://github.com/livewire/livewire.git",
"reference": "b158c6386a892efc6c5e4682e682829baac1f933"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/livewire/livewire/zipball/b158c6386a892efc6c5e4682e682829baac1f933",
"reference": "b158c6386a892efc6c5e4682e682829baac1f933",
"shasum": ""
},
"require": {
"illuminate/database": "^10.0|^11.0",
"illuminate/routing": "^10.0|^11.0",
"illuminate/support": "^10.0|^11.0",
"illuminate/validation": "^10.0|^11.0",
"league/mime-type-detection": "^1.9",
"php": "^8.1",
"symfony/console": "^6.0|^7.0",
"symfony/http-kernel": "^6.2|^7.0"
},
"require-dev": {
"calebporzio/sushi": "^2.1",
"laravel/framework": "^10.15.0|^11.0",
"laravel/prompts": "^0.1.6",
"mockery/mockery": "^1.3.1",
"orchestra/testbench": "^8.21.0|^9.0",
"orchestra/testbench-dusk": "^8.24|^9.1",
"phpunit/phpunit": "^10.4",
"psy/psysh": "^0.11.22|^0.12"
},
"type": "library",
"extra": {
"laravel": {
"aliases": {
"Livewire": "Livewire\\Livewire"
},
"providers": [
"Livewire\\LivewireServiceProvider"
]
}
},
"autoload": {
"files": [
"src/helpers.php"
],
"psr-4": {
"Livewire\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Caleb Porzio",
"email": "calebporzio@gmail.com"
}
],
"description": "A front-end framework for Laravel.",
"support": {
"issues": "https://github.com/livewire/livewire/issues",
"source": "https://github.com/livewire/livewire/tree/v3.5.4"
},
"funding": [
{
"url": "https://github.com/livewire",
"type": "github"
}
],
"time": "2024-07-15T18:27:32+00:00"
},
{
"name": "maatwebsite/excel",
"version": "3.1.52",
@@ -9807,14 +10024,16 @@
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"minimum-stability": "beta",
"stability-flags": {
"laravel/pulse": 10
},
"prefer-stable": true,
"prefer-lowest": false,
"platform": {
"php": "^8.1",
"ext-zip": "*"
},
"platform-dev": [],
"platform-dev": {},
"plugin-api-version": "2.6.0"
}

View File

@@ -111,6 +111,12 @@ return [
'path' => storage_path('logs/fms/vehicle_activity_service.log'),
'level' => 'info',
],
'road_observation_problem' => [
'driver' => 'single',
'path' => storage_path('logs/road_observation_problem.log'),
'level' => 'info',
],
],
];

233
config/pulse.php Normal file
View File

@@ -0,0 +1,233 @@
<?php
use Laravel\Pulse\Http\Middleware\Authorize;
use Laravel\Pulse\Pulse;
use Laravel\Pulse\Recorders;
return [
/*
|--------------------------------------------------------------------------
| Pulse Domain
|--------------------------------------------------------------------------
|
| This is the subdomain which the Pulse dashboard will be accessible from.
| When set to null, the dashboard will reside under the same domain as
| the application. Remember to configure your DNS entries correctly.
|
*/
'domain' => env('PULSE_DOMAIN'),
/*
|--------------------------------------------------------------------------
| Pulse Path
|--------------------------------------------------------------------------
|
| This is the path which the Pulse dashboard will be accessible from. Feel
| free to change this path to anything you'd like. Note that this won't
| affect the path of the internal API that is never exposed to users.
|
*/
'path' => env('PULSE_PATH', 'pulse'),
/*
|--------------------------------------------------------------------------
| Pulse Master Switch
|--------------------------------------------------------------------------
|
| This configuration option may be used to completely disable all Pulse
| data recorders regardless of their individual configurations. This
| provides a single option to quickly disable all Pulse recording.
|
*/
'enabled' => env('PULSE_ENABLED', true),
/*
|--------------------------------------------------------------------------
| Pulse Storage Driver
|--------------------------------------------------------------------------
|
| This configuration option determines which storage driver will be used
| while storing entries from Pulse's recorders. In addition, you also
| may provide any options to configure the selected storage driver.
|
*/
'storage' => [
'driver' => env('PULSE_STORAGE_DRIVER', 'database'),
'database' => [
'connection' => env('PULSE_DB_CONNECTION', null),
'chunk' => 1000,
],
],
/*
|--------------------------------------------------------------------------
| Pulse Ingest Driver
|--------------------------------------------------------------------------
|
| This configuration options determines the ingest driver that will be used
| to capture entries from Pulse's recorders. Ingest drivers are great to
| free up your request workers quickly by offloading the data storage.
|
*/
'ingest' => [
'driver' => env('PULSE_INGEST_DRIVER', 'storage'),
'buffer' => env('PULSE_INGEST_BUFFER', 5_000),
'trim' => [
'lottery' => [1, 1_000],
'keep' => '7 days',
],
'redis' => [
'connection' => env('PULSE_REDIS_CONNECTION'),
'chunk' => 1000,
],
],
/*
|--------------------------------------------------------------------------
| Pulse Cache Driver
|--------------------------------------------------------------------------
|
| This configuration option determines the cache driver that will be used
| for various tasks, including caching dashboard results, establishing
| locks for events that should only occur on one server and signals.
|
*/
'cache' => env('PULSE_CACHE_DRIVER'),
/*
|--------------------------------------------------------------------------
| Pulse Route Middleware
|--------------------------------------------------------------------------
|
| These middleware will be assigned to every Pulse route, giving you the
| chance to add your own middleware to this list or change any of the
| existing middleware. Of course, reasonable defaults are provided.
|
*/
'middleware' => [
'web',
Authorize::class,
],
/*
|--------------------------------------------------------------------------
| Pulse Recorders
|--------------------------------------------------------------------------
|
| The following array lists the "recorders" that will be registered with
| Pulse, along with their configuration. Recorders gather application
| event data from requests and tasks to pass to your ingest driver.
|
*/
'recorders' => [
Recorders\CacheInteractions::class => [
'enabled' => env('PULSE_CACHE_INTERACTIONS_ENABLED', true),
'sample_rate' => env('PULSE_CACHE_INTERACTIONS_SAMPLE_RATE', 1),
'ignore' => [
...Pulse::defaultVendorCacheKeys(),
],
'groups' => [
'/^job-exceptions:.*/' => 'job-exceptions:*',
// '/:\d+/' => ':*',
],
],
Recorders\Exceptions::class => [
'enabled' => env('PULSE_EXCEPTIONS_ENABLED', true),
'sample_rate' => env('PULSE_EXCEPTIONS_SAMPLE_RATE', 1),
'location' => env('PULSE_EXCEPTIONS_LOCATION', true),
'ignore' => [
// '/^Package\\\\Exceptions\\\\/',
],
],
Recorders\Queues::class => [
'enabled' => env('PULSE_QUEUES_ENABLED', true),
'sample_rate' => env('PULSE_QUEUES_SAMPLE_RATE', 1),
'ignore' => [
// '/^Package\\\\Jobs\\\\/',
],
],
Recorders\Servers::class => [
'server_name' => env('PULSE_SERVER_NAME', gethostname()),
'directories' => explode(':', env('PULSE_SERVER_DIRECTORIES', '/')),
],
Recorders\SlowJobs::class => [
'enabled' => env('PULSE_SLOW_JOBS_ENABLED', true),
'sample_rate' => env('PULSE_SLOW_JOBS_SAMPLE_RATE', 1),
'threshold' => env('PULSE_SLOW_JOBS_THRESHOLD', 1000),
'ignore' => [
// '/^Package\\\\Jobs\\\\/',
],
],
Recorders\SlowOutgoingRequests::class => [
'enabled' => env('PULSE_SLOW_OUTGOING_REQUESTS_ENABLED', true),
'sample_rate' => env('PULSE_SLOW_OUTGOING_REQUESTS_SAMPLE_RATE', 1),
'threshold' => env('PULSE_SLOW_OUTGOING_REQUESTS_THRESHOLD', 1000),
'ignore' => [
// '#^http://127\.0\.0\.1:13714#', // Inertia SSR...
],
'groups' => [
// '#^https://api\.github\.com/repos/.*$#' => 'api.github.com/repos/*',
// '#^https?://([^/]*).*$#' => '\1',
// '#/\d+#' => '/*',
],
],
Recorders\SlowQueries::class => [
'enabled' => env('PULSE_SLOW_QUERIES_ENABLED', true),
'sample_rate' => env('PULSE_SLOW_QUERIES_SAMPLE_RATE', 1),
'threshold' => env('PULSE_SLOW_QUERIES_THRESHOLD', 1000),
'location' => env('PULSE_SLOW_QUERIES_LOCATION', true),
'highlighting' => env('PULSE_SLOW_QUERIES_HIGHLIGHTING', true),
'max_query_length' => env('PULSE_SLOW_QUERIES_MAX_QUERY_LENGTH', null),
'ignore' => [
'/(["`])pulse_[\w]+?\1/', // Pulse tables...
'/(["`])telescope_[\w]+?\1/', // Telescope tables...
],
],
Recorders\SlowRequests::class => [
'enabled' => env('PULSE_SLOW_REQUESTS_ENABLED', true),
'sample_rate' => env('PULSE_SLOW_REQUESTS_SAMPLE_RATE', 1),
'threshold' => env('PULSE_SLOW_REQUESTS_THRESHOLD', 1000),
'ignore' => [
'#^/pulse$#', // Pulse dashboard...
'#^/telescope#', // Telescope dashboard...
],
],
Recorders\UserJobs::class => [
'enabled' => env('PULSE_USER_JOBS_ENABLED', true),
'sample_rate' => env('PULSE_USER_JOBS_SAMPLE_RATE', 1),
'ignore' => [
// '/^Package\\\\Jobs\\\\/',
],
],
Recorders\UserRequests::class => [
'enabled' => env('PULSE_USER_REQUESTS_ENABLED', true),
'sample_rate' => env('PULSE_USER_REQUESTS_SAMPLE_RATE', 1),
'ignore' => [
'#^/pulse$#', // Pulse dashboard...
'#^/telescope#', // Telescope dashboard...
],
],
],
];

View File

@@ -0,0 +1,84 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Laravel\Pulse\Support\PulseMigration;
return new class extends PulseMigration
{
/**
* Run the migrations.
*/
public function up(): void
{
if (! $this->shouldRun()) {
return;
}
Schema::create('pulse_values', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('timestamp');
$table->string('type');
$table->mediumText('key');
match ($this->driver()) {
'mysql' => $table->char('key_hash', 16)->charset('binary')->virtualAs('unhex(md5(`key`))'),
'pgsql' => $table->uuid('key_hash')->storedAs('md5("key")::uuid'),
'sqlite' => $table->string('key_hash'),
};
$table->mediumText('value');
$table->index('timestamp'); // For trimming...
$table->index('type'); // For fast lookups and purging...
$table->unique(['type', 'key_hash']); // For data integrity and upserts...
});
Schema::create('pulse_entries', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('timestamp');
$table->string('type');
$table->mediumText('key');
match ($this->driver()) {
'mysql' => $table->char('key_hash', 16)->charset('binary')->virtualAs('unhex(md5(`key`))'),
'pgsql' => $table->uuid('key_hash')->storedAs('md5("key")::uuid'),
'sqlite' => $table->string('key_hash'),
};
$table->bigInteger('value')->nullable();
$table->index('timestamp'); // For trimming...
$table->index('type'); // For purging...
$table->index('key_hash'); // For mapping...
$table->index(['timestamp', 'type', 'key_hash', 'value']); // For aggregate queries...
});
Schema::create('pulse_aggregates', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('bucket');
$table->unsignedMediumInteger('period');
$table->string('type');
$table->mediumText('key');
match ($this->driver()) {
'mysql' => $table->char('key_hash', 16)->charset('binary')->virtualAs('unhex(md5(`key`))'),
'pgsql' => $table->uuid('key_hash')->storedAs('md5("key")::uuid'),
'sqlite' => $table->string('key_hash'),
};
$table->string('aggregate');
$table->decimal('value', 20, 2);
$table->unsignedInteger('count')->nullable();
$table->unique(['bucket', 'period', 'type', 'aggregate', 'key_hash']); // Force "on duplicate update"...
$table->index(['period', 'bucket']); // For trimming...
$table->index('type'); // For purging...
$table->index(['period', 'type', 'aggregate', 'bucket']); // For aggregate queries...
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('pulse_values');
Schema::dropIfExists('pulse_entries');
Schema::dropIfExists('pulse_aggregates');
}
};

View File

@@ -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::table('road_patrols', function (Blueprint $table) {
$table->string('fuel_consumption')->change();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('road_patrols', function (Blueprint $table) {
$table->integer('fuel_consumption')->change();
});
}
};

View File

@@ -0,0 +1,32 @@
<?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('jobs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('jobs');
}
};

View File

@@ -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::table('edarate_ostani', function (Blueprint $table) {
$table->text('sub_items_for_confirm')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('edarate_ostani', function (Blueprint $table) {
$table->dropColumn('sub_items_for_confirm');
});
}
};

View File

@@ -0,0 +1,32 @@
<?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('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('failed_jobs');
}
};

View File

@@ -1 +1,3 @@
views
/views/*
!/views/v3/
!/views/v3/*

View File

@@ -0,0 +1,97 @@
<!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="20"
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="20"
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;">
</th>
</tr>
<tr>
<th colspan="20"
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>
<th rowspan="2" style="border:1px solid black;text-align:center;background-color: #EBF1DE;">اداره</th>
<th rowspan="2" style="border:1px solid black;text-align:center;background-color: #EBF1DE;">مجموع</th>
<th colspan="18" style="border:1px solid black;text-align:center;background-color: #EBF1DE;">ایتم های فعالیت روزانه</th>
</tr>
<tr>
@foreach($items as $item)
<th style="border:1px solid black;text-align:center;background-color: #C4D79B;">{{ $item['item_str'] }}</th>
@endforeach
</tr>
</thead>
<tbody>
@php
// محاسبه مجموع مقدار s برای کل کشور
$totalForCountry = collect($data)->where('p', -1)->sum('s');
// محاسبه مجموع مقدار s برای هر آیتم در کل کشور
$itemTotalsForCountry = [];
foreach ($items as $item) {
$itemTotalsForCountry[$item['item']] = collect($data)->where('p', -1)->where('i', $item['item'])->sum('s');
}
@endphp
{{-- ردیف کل کشور --}}
<tr>
<td style="border:1px solid black;text-align: center;">کل کشور</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForCountry }}</td>
@foreach($items as $item)
<td style="border:1px solid black;text-align: center;">{{ $itemTotalsForCountry[$item['item']] ?? '-' }}</td>
@endforeach
</tr>
{{-- ردیف‌های مربوط به هر استان --}}
@foreach($provinces as $province)
@php
// محاسبه مجموع مقدار s برای این استان
$totalForProvince = collect($data)->where('p', $province['id'])->sum('s');
// محاسبه مجموع مقدار s برای هر آیتم در این استان
$itemTotalsForProvince = [];
foreach ($items as $item) {
$itemTotalsForProvince[$item['item']] = collect($data)->where('p', $province['id'])->where('i', $item['item'])->sum('s');
}
@endphp
<tr>
<td style="border:1px solid black;text-align: center;">{{ $province['name_fa'] }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForProvince }}</td>
@foreach($items as $item)
<td style="border:1px solid black;text-align: center;">{{ $itemTotalsForProvince[$item['item']] ?? '-' }}</td>
@endforeach
</tr>
@endforeach
</tbody>
</table>
</body>
</html>

View File

@@ -0,0 +1,96 @@
<!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="25" 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="25" style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;"></th>
</tr>
<tr>
<th colspan="26" 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>
<th rowspan="3" style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">اداره کل</th>
<th colspan="24" style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">فعالیت های انجام شده</th>
</tr>
<tr>
@foreach($subItems as $subItem)
<th colspan="2" style="border:1px solid black;text-align:center;background-color:#C4D79B">{{ $subItem->sub_item_str }}</th>
@endforeach
</tr>
<tr>
@foreach($subItems as $subItem)
<th style="background-color: #FDE9D9;border: 1px solid black;text-align: center;">تعداد</th>
<th style="background-color: #FDE9D9;border: 1px solid black;text-align: center;">مجموع ({{ $subItem->sub_item_unit }})</th>
@endforeach
</tr>
</thead>
<tbody>
@php
// محاسبه مقدار c و s برای هر ساب‌آیتم در کل کشور
$countTotalsForCountry = [];
$sumTotalsForCountry = [];
foreach ($subItems as $subItem) {
$countTotalsForCountry[$subItem['sub_item']] = collect($data)->where('p', -1)->where('t', $subItem['sub_item'])->sum('c');
$sumTotalsForCountry[$subItem['sub_item']] = collect($data)->where('p', -1)->where('t', $subItem['sub_item'])->sum('s');
}
@endphp
{{-- ردیف کل کشور --}}
<tr>
<td style="border:1px solid black;text-align: center;">کل کشور</td>
@foreach($subItems as $subItem)
<td style="border:1px solid black;text-align: center;">{{ $countTotalsForCountry[$subItem['sub_item']] ?? '-' }}</td>
<td style="border:1px solid black;text-align: center;">{{ $sumTotalsForCountry[$subItem['sub_item']] ?? '-' }}</td>
@endforeach
</tr>
{{-- ردیف‌های مربوط به هر استان --}}
@foreach($provinces as $province)
@php
$countTotalsForProvince = [];
$sumTotalsForProvince = [];
foreach ($subItems as $subItem) {
$countTotalsForProvince[$subItem['sub_item']] = collect($data)->where('p', $province['id'])->where('t', $subItem['sub_item'])->sum('c');
$sumTotalsForProvince[$subItem['sub_item']] = collect($data)->where('p', $province['id'])->where('t', $subItem['sub_item'])->sum('s');
}
@endphp
<tr>
<td style="border:1px solid black;text-align: center;">{{ $province['name_fa'] }}</td>
@foreach($subItems as $subItem)
<td style="border:1px solid black;text-align: center;">{{ $countTotalsForProvince[$subItem['sub_item']] ?? '-' }}</td>
<td style="border:1px solid black;text-align: center;">{{ $sumTotalsForProvince[$subItem['sub_item']] ?? '-' }}</td>
@endforeach
</tr>
@endforeach
</tbody>
</table>
</body>
</html>

View File

@@ -0,0 +1,118 @@
<!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="14"
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="14"
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;">
</th>
</tr>
<tr>
<th colspan="14"
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>
<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['edarat_name'] ?? '-' }}</td>
<td style="border: 1px solid black;text-align: center;">{{ $item['item_fa'] ?? '-' }}</td>
<td style="border: 1px solid black;text-align: center;">{{ $item['sub_item_fa'] ?? '-' }}</td>
<td style="border: 1px solid black;text-align: center;">
{{ $item['sub_item_data'] ? ($item['unit_fa'] ? $item['sub_item_data'] . '(' . $item['unit_fa'] . ')' : $item['sub_item_data'] . '(-)') : '-' }}
</td>
<td style="border: 1px solid black;text-align: center;">{{ $item['cmms_machines'] != null ? $item['cmms_machines']->pluck('machine_code')->implode(', ') : '-' }}</td>
<td style="border: 1px solid black;text-align: center;">{{ $item['rahdaran'] != null ? $item['rahdaran']->pluck('code')->implode(', ') : '-' }}</td>
<td style="border: 1px solid black;text-align: center;">
{{ isset($item['start_lat']) && isset($item['start_lng']) ? $item['start_lat'] . ' ' . $item['start_lng'] : '-' }}
</td>
<td style="border: 1px solid black;text-align: center;">
{{ isset($item['end_lat']) && isset($item['end_lng']) ? $item['end_lat'] . ' ' . $item['end_lng'] : '-' }}
</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 style="border: 1px solid black;text-align: center;">{{ $item['created_at'] ? verta($item['created_at'])->format('Y/n/j H:i:s') : '-' }}</td>
<td style="border: 1px solid black;text-align: center;">{{ $item['status_fa'] ?? '-' }}</td>
<td style="border: 1px solid black;text-align: center;">{{ $item['supervisor_description'] ?? '-' }}</td>
</tr>
@endforeach
</tbody>
</table>
</body>
</html>

View File

@@ -0,0 +1,94 @@
<!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="20"
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="20"
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;">
</th>
</tr>
<tr>
<th colspan="20"
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>
<th rowspan="2" style="border:1px solid black;text-align:center;background-color: #EBF1DE;">اداره</th>
<th rowspan="2" style="border:1px solid black;text-align:center;background-color: #EBF1DE;">مجموع</th>
<th colspan="18" style="border:1px solid black;text-align:center;background-color: #EBF1DE;">ایتم های فعالیت روزانه</th>
</tr>
<tr>
@foreach($items as $item)
<th style="border:1px solid black;text-align:center;background-color: #C4D79B;">{{ $item['item_str'] }}</th>
@endforeach
</tr>
</thead>
<tbody>
@php
$totalForProvince = collect($data)->where('c', -1)->sum('s');
$itemTotalsForProvince = [];
foreach ($items as $item) {
$itemTotalsForProvince[$item['item']] = collect($data)->where('c', -1)->where('i', $item['item'])->sum('s');
}
@endphp
<tr>
<td style="border:1px solid black;text-align: center;">کل استان</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForProvince }}</td>
@foreach($items as $item)
<td style="border:1px solid black;text-align: center;">{{ $itemTotalsForProvince[$item['item']] ?? '-' }}</td>
@endforeach
</tr>
{{-- ردیف‌های مربوط به هر استان --}}
@foreach($edarateShahri as $edareShahri)
@php
// محاسبه مجموع مقدار s برای این استان
$totalForProvince = collect($data)->where('c', $edareShahri['id'])->sum('s');
// محاسبه مجموع مقدار s برای هر آیتم در این استان
$itemTotalsForProvince = [];
foreach ($items as $item) {
$itemTotalsForProvince[$item['item']] = collect($data)->where('c', $edareShahri['id'])->where('i', $item['item'])->sum('s');
}
@endphp
<tr>
<td style="border:1px solid black;text-align: center;">{{ $edareShahri['name_fa'] }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForProvince }}</td>
@foreach($items as $item)
<td style="border:1px solid black;text-align: center;">{{ $itemTotalsForProvince[$item['item']] ?? '-' }}</td>
@endforeach
</tr>
@endforeach
</tbody>
</table>
</body>
</html>

View File

@@ -0,0 +1,96 @@
<!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="25" 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="25" style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;"></th>
</tr>
<tr>
<th colspan="26" 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>
<th rowspan="3" style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">اداره کل</th>
<th colspan="24" style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">فعالیت های انجام شده</th>
</tr>
<tr>
@foreach($subItems as $subItem)
<th colspan="2" style="border:1px solid black;text-align:center;background-color:#C4D79B">{{ $subItem->sub_item_str }}</th>
@endforeach
</tr>
<tr>
@foreach($subItems as $subItem)
<th style="background-color: #FDE9D9;border: 1px solid black;text-align: center;">تعداد</th>
<th style="background-color: #FDE9D9;border: 1px solid black;text-align: center;">مجموع ({{ $subItem->sub_item_unit }})</th>
@endforeach
</tr>
</thead>
<tbody>
@php
// محاسبه مقدار c و s برای هر ساب‌آیتم در کل کشور
$countTotalsForProvince = [];
$sumTotalsForProvince = [];
foreach ($subItems as $subItem) {
$countTotalsForProvince[$subItem['sub_item']] = collect($data)->where('ci', -1)->where('t', $subItem['sub_item'])->sum('c');
$sumTotalsForProvince[$subItem['sub_item']] = collect($data)->where('ci', -1)->where('t', $subItem['sub_item'])->sum('s');
}
@endphp
{{-- ردیف کل کشور --}}
<tr>
<td style="border:1px solid black;text-align: center;">کل کشور</td>
@foreach($subItems as $subItem)
<td style="border:1px solid black;text-align: center;">{{ $countTotalsForProvince[$subItem['sub_item']] ?? '-' }}</td>
<td style="border:1px solid black;text-align: center;">{{ $sumTotalsForProvince[$subItem['sub_item']] ?? '-' }}</td>
@endforeach
</tr>
{{-- ردیف‌های مربوط به هر استان --}}
@foreach($edarateShahri as $edareShahri)
@php
$countTotalsForProvince = [];
$sumTotalsForProvince = [];
foreach ($subItems as $subItem) {
$countTotalsForProvince[$subItem['sub_item']] = collect($data)->where('ci', $edareShahri['id'])->where('t', $subItem['sub_item'])->sum('c');
$sumTotalsForProvince[$subItem['sub_item']] = collect($data)->where('ci', $edareShahri['id'])->where('t', $subItem['sub_item'])->sum('s');
}
@endphp
<tr>
<td style="border:1px solid black;text-align: center;">{{ $edareShahri['name_fa'] }}</td>
@foreach($subItems as $subItem)
<td style="border:1px solid black;text-align: center;">{{ $countTotalsForProvince[$subItem['sub_item']] ?? '-' }}</td>
<td style="border:1px solid black;text-align: center;">{{ $sumTotalsForProvince[$subItem['sub_item']] ?? '-' }}</td>
@endforeach
</tr>
@endforeach
</tbody>
</table>
</body>
</html>

View File

@@ -0,0 +1,118 @@
<!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="14"
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="14"
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;">
</th>
</tr>
<tr>
<th colspan="14"
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>
<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['edarat_name'] ?? '-' }}</td>
<td style="border: 1px solid black;text-align: center;">{{ $item['item_fa'] ?? '-' }}</td>
<td style="border: 1px solid black;text-align: center;">{{ $item['sub_item_fa'] ?? '-' }}</td>
<td style="border: 1px solid black;text-align: center;">
{{ $item['sub_item_data'] ? ($item['unit_fa'] ? $item['sub_item_data'] . '(' . $item['unit_fa'] . ')' : $item['sub_item_data'] . '(-)') : '-' }}
</td>
<td style="border: 1px solid black;text-align: center;">{{ $item['cmms_machines'] != null ? $item['cmms_machines']->pluck('machine_code')->implode(', ') : '-' }}</td>
<td style="border: 1px solid black;text-align: center;">{{ $item['rahdaran'] != null ? $item['rahdaran']->pluck('code')->implode(', ') : '-' }}</td>
<td style="border: 1px solid black;text-align: center;">
{{ isset($item['start_lat']) && isset($item['start_lng']) ? $item['start_lat'] . ' ' . $item['start_lng'] : '-' }}
</td>
<td style="border: 1px solid black;text-align: center;">
{{ isset($item['end_lat']) && isset($item['end_lng']) ? $item['end_lat'] . ' ' . $item['end_lng'] : '-' }}
</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 style="border: 1px solid black;text-align: center;">{{ $item['created_at'] ? verta($item['created_at'])->format('Y/n/j H:i:s') : '-' }}</td>
<td style="border: 1px solid black;text-align: center;">{{ $item['status_fa'] ?? '-' }}</td>
<td style="border: 1px solid black;text-align: center;">{{ $item['supervisor_description'] ?? '-' }}</td>
</tr>
@endforeach
</tbody>
</table>
</body>
</html>

View File

@@ -0,0 +1,131 @@
<!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="8"
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="8"
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;">
</th>
</tr>
<tr>
<th colspan="8"
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="3" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
اداره کل
</th>
<th colspan="7" style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
گشت راهداری
</th>
</tr>
<tr>
<th rowspan="2" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
تعداد کل
</th>
<th colspan="3" style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
اقدامات لازم جهت رسیدگی آتی
</th>
<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: #C4D79B;">
مجموع مسافت پیمایش شده(کیلومتر)
</th>
<th rowspan="2" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
تعداد فعالیت صورت گرفته حین گشت زنی
</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>
</tr>
</thead>
<tbody>
@php
// محاسبه مجموع مقدار s برای کل کشور
$totalForCountry = collect($activities)->where('province_id', -1)->first();
@endphp
{{-- ردیف کل کشور --}}
<tr>
<td style="border:1px solid black;text-align: center;">کل کشور</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForCountry->tedade }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForCountry->tedad_mavarede_moshede_shode_adi }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForCountry->tedad_mavarede_moshede_shode_fori }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForCountry->tedad_mavarede_moshede_shode_ani }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForCountry->tedad_mavarede_peygiri_shode }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForCountry->masafat_tey_shode }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForCountry->tedad_faliyat_sabt_shode }}</td>
</tr>
@foreach ($provinces as $province)
@php
$totalForProvince = collect($activities)->where('province_id', $province->id)->first();
@endphp
@if($totalForProvince)
<tr>
<td style="border:1px solid black;text-align: center;">{{ $totalForProvince->province_fa }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForProvince->tedade }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForProvince->tedad_mavarede_moshede_shode_adi }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForProvince->tedad_mavarede_moshede_shode_fori }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForProvince->tedad_mavarede_moshede_shode_ani }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForProvince->tedad_mavarede_peygiri_shode }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForProvince->masafat_tey_shode }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForProvince->tedad_faliyat_sabt_shode }}</td>
</tr>
@else
<tr>
<td style="border:1px solid black;text-align: center;">{{ $province->name_fa }}</td>
<td style="border:1px solid black;text-align: center;">0</td>
<td style="border:1px solid black;text-align: center;">0</td>
<td style="border:1px solid black;text-align: center;">0</td>
<td style="border:1px solid black;text-align: center;">0</td>
<td style="border:1px solid black;text-align: center;">0</td>
<td style="border:1px solid black;text-align: center;">0</td>
<td style="border:1px solid black;text-align: center;">0</td>
</tr>
@endif
@endforeach
</tbody>
</table>
</body>
</html>

View File

@@ -0,0 +1,89 @@
<!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="14"
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="14"
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;">
</th>
</tr>
<tr>
<th colspan="14"
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;font-size: 13;">
گزارش کارتابل عملیات گشت راهداری
</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_name'] ?? '-' }}</td>
<td style="border: 1px solid black;text-align: center;">{{ $item['cmms_machines'] != null ? $item['cmms_machines']->pluck('machine_code')->implode(', ') : '-' }}</td>
<td style="border: 1px solid black;text-align: center;">{{ $item['rahdaran'] != null ? $item['rahdaran']->pluck('code')->implode(', ') : '-' }}</td>
<td style="border: 1px solid black;text-align: center;">{{ $item['start_time'] ? verta($item['start_time'])->format('Y/n/j H:i:s') : '-' }}
<td style="border: 1px solid black;text-align: center;">{{ $item['end_time'] ? verta($item['end_time'])->format('Y/n/j H:i:s') : '-' }}
<td style="border: 1px solid black;text-align: center;">{{ $item['created_at'] ? verta($item['created_at'])->format('Y/n/j H:i:s') : '-' }}</td>
<td style="border: 1px solid black;text-align: center;">{{ $item['description'] ?? '-' }}</td>
</tr>
@endforeach
</tbody>
</table>
</body>
</html>

View File

@@ -0,0 +1,131 @@
<!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="8"
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="8"
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;">
</th>
</tr>
<tr>
<th colspan="8"
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="3" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
اداره کل
</th>
<th colspan="7" style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
گشت راهداری
</th>
</tr>
<tr>
<th rowspan="2" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
تعداد کل
</th>
<th colspan="3" style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
اقدامات لازم جهت رسیدگی آتی
</th>
<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: #C4D79B;">
مجموع مسافت پیمایش شده(کیلومتر)
</th>
<th rowspan="2" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
تعداد فعالیت صورت گرفته حین گشت زنی
</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>
</tr>
</thead>
<tbody>
@php
// محاسبه مجموع مقدار s برای کل کشور
$totalForProvince = collect($activities)->where('edare_id', -1)->first();
@endphp
{{-- ردیف کل کشور --}}
<tr>
<td style="border:1px solid black;text-align: center;">کل استان</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForProvince->tedade ?? 0 }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForProvince->tedad_mavarede_moshede_shode_adi ?? 0 }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForProvince->tedad_mavarede_moshede_shode_fori ?? 0 }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForProvince->tedad_mavarede_moshede_shode_ani ?? 0 }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForProvince->tedad_mavarede_peygiri_shode ?? 0 }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForProvince->masafat_tey_shode ?? 0 }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForProvince->tedad_faliyat_sabt_shode ?? 0 }}</td>
</tr>
@foreach ($edarateShahri as $edareShahri)
@php
$totalForEdare = collect($activities)->where('edare_id', $edareShahri->id)->first();
@endphp
@if($totalForEdare)
<tr>
<td style="border:1px solid black;text-align: center;">{{ $totalForEdare->edare_name }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForEdare->tedade }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForEdare->tedad_mavarede_moshede_shode_adi }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForEdare->tedad_mavarede_moshede_shode_fori }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForEdare->tedad_mavarede_moshede_shode_ani }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForEdare->tedad_mavarede_peygiri_shode }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForEdare->masafat_tey_shode }}</td>
<td style="border:1px solid black;text-align: center;">{{ $totalForEdare->tedad_faliyat_sabt_shode }}</td>
</tr>
@else
<tr>
<td style="border:1px solid black;text-align: center;">{{ $edareShahri->name_fa }}</td>
<td style="border:1px solid black;text-align: center;">0</td>
<td style="border:1px solid black;text-align: center;">0</td>
<td style="border:1px solid black;text-align: center;">0</td>
<td style="border:1px solid black;text-align: center;">0</td>
<td style="border:1px solid black;text-align: center;">0</td>
<td style="border:1px solid black;text-align: center;">0</td>
<td style="border:1px solid black;text-align: center;">0</td>
</tr>
@endif
@endforeach
</tbody>
</table>
</body>
</html>

View File

@@ -0,0 +1,89 @@
<!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: 13;">
گزارش کارتابل ارزیابی گشت راهداری
</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_name'] ?? '-' }}</td>
<td style="border: 1px solid black;text-align: center;">{{ $item['cmms_machines'] != null ? $item['cmms_machines']->pluck('machine_code')->implode(', ') : '-' }}</td>
<td style="border: 1px solid black;text-align: center;">{{ $item['rahdaran'] != null ? $item['rahdaran']->pluck('code')->implode(', ') : '-' }}</td>
<td style="border: 1px solid black;text-align: center;">{{ $item['start_time'] ? verta($item['start_time'])->format('Y/n/j H:i:s') : '-' }}
<td style="border: 1px solid black;text-align: center;">{{ $item['end_time'] ? verta($item['end_time'])->format('Y/n/j H:i:s') : '-' }}
<td style="border: 1px solid black;text-align: center;">{{ $item['created_at'] ? verta($item['created_at'])->format('Y/n/j H:i:s') : '-' }}</td>
<td style="border: 1px solid black;text-align: center;">{{ $item['description'] ?? '-' }}</td>
</tr>
@endforeach
</tbody>
</table>
</body>
</html>

View File

@@ -152,9 +152,6 @@ Route::prefix('road_patrols')
Route::get('/operator/report/{roadPatrol}', 'getReport')
->name('getReport');
Route::get('/operator/map_data', 'getAllDataToMap')
->name('getAllDataToMap');
Route::get('/detail/{roadPatrol}', 'show')
->name('show');
});
@@ -195,18 +192,26 @@ Route::prefix('road_item_reports')
->controller(RoadItemsReportController::class)
->group(function () {
Route::get('/get_sub_items', 'getSubItems')->name('getSubItems');
Route::get('/country_activity_per_sub_item', 'countryActivityPerSubItem')->name('countryActivityPerSubItem');
Route::get('/province_activity_per_sub_item', 'provinceActivityPerSubItem')->name('provinceActivityPerSubItem');
Route::get('/city_activity_per_sub_item', 'cityActivityPerSubItem')->name('cityActivityPerSubItem');
Route::get('/country_activity_per_item', 'countryActivityPerItem')->name('countryActivityPerItem');
Route::get('/province_activity_per_item', 'provinceActivityPerItem')->name('provinceActivityPerItem');
Route::get('/city_activity_per_item', 'cityActivityPerItem')->name('cityActivityPerItem');
Route::get('/map', 'map')->name('map');
Route::get('/country_activity_excel_per_item', 'countryActivityExcelPerItem')->name('countryActivityExcelPerItem');
Route::get('/province_activity_excel_per_item', 'provinceActivityExcelPerItem')->name('provinceActivityExcelPerItem');
Route::get('/country_activity_excel_per_sub_item', 'countryActivityExcelPerSubItem')->name('countryActivityExcelPerSubItem');
Route::get('/province_activity_excel_per_sub_item', 'provinceActivityExcelPerSubItem')->name('provinceActivityExcelPerSubItem');
Route::get('/activities_on_map', 'activitiesOnMap')->name('activitiesOnMap');
Route::get('/show_on_map/{roadItemsProject}', 'showOnMap')->name('showOnMap');
});
Route::prefix('road_patrol_reports')
->name('roadPatrolReports.')
->controller(RoadPatrolReportController::class)
->group(function () {
Route::get('/country_activity', 'countryPatrolActivity')->name('countryPatrolActivity');
Route::get('/province_activity', 'provincePatrolActivity')->name('provincePatrolActivity');
Route::get('/city_activity', 'cityPatrolActivity')->name('cityPatrolActivity');
Route::get('/excel', 'excel')->name('excel');
Route::get('/country_activity_excel', 'countryActivityExcel')->name('countryActivityExcel');
Route::get('/province_activity_excel', 'provinceActivityExcel')->name('provinceActivityExcel');
Route::get('/activities_on_map', 'activitiesOnMap')->name('activitiesOnMap');
Route::get('/show_on_map/{roadPatrol}', 'showOnMap')->name('showOnMap');
});

View File

@@ -518,6 +518,6 @@ INSERT INTO edarate_shahri (name_fa,province_id,created_at,updated_at) VALUES
('اداره آق قلا',27,'2023-03-13 14:12:25','2023-03-13 14:12:25');
INSERT INTO edarate_shahri (name_fa,province_id,created_at,updated_at) VALUES
('اداره خمام',28,'2023-06-17 08:43:14','2023-06-17 08:43:14'),
('اداره اصلاندوز',3,'2023-08-15 09:33:55','2023-08-15 09:33:55');
('اداره گالیکش',27,'2024-11-16 14:33:55','2024-11-16 14:33:55');
('اداره اصلاندوز',3,'2023-08-15 09:33:55','2023-08-15 09:33:55'),
('اداره گالیکش',27,'2024-11-16 14:33:55','2024-11-16 14:33:55'),
('آزادراه ساوه-تهران',32,'2025-01-06 14:33:55','2025-01-06 14:33:55');

View File

@@ -160,4 +160,4 @@ INSERT INTO log_lists (description,log_unique_code,action_type,is_done) VALUES
('حذف نوع آزمایش','1164','action',0),
('ثبت نمونه آزمایش','1165','action',0),
('ویرایش نمونه آزمایش','1166','action',0),
('حذف نمونه آزمایش','1167','action',0),
('حذف نمونه آزمایش','1167','action',0);

View File

@@ -132,6 +132,6 @@ INSERT INTO permissions (name,guard_name,name_fa,description,created_at,updated_
('delete-safety-and-privacy','web','حذف نگهداری و حریم','کاربر امکان حذف یک فعالیت نگهداری حریم راه را دارد',NULL,NULL,NULL,NULL,'safety-and-privacy','نگهداری حریم راه',0,0),
('show-receipt','web','نمایش خسارت (کشوری)','نمایش خسارات کشوری',NULL,NULL,NULL,NULL,'receipt','خسارات وارد بر ابنیه فنی راه',0,0),
('show-receipt-province','web','نمایش خسارت (استانی)','نمایش خسارات استانی',NULL,NULL,NULL,NULL,'receipt','خسارات وارد بر ابنیه فنی راه',1,0),
('supervise-road-item-by-edareostani','web','نظارت بر ثبت فعالیت روزانه و جاری(ادارات استانی)',NULL,'2023-07-09 09:48:35','2023-07-09 09:48:37',NULL,NULL,'road-item','فعالیت روزانه',0,0);
('azmayesh-management','web','مدیریت آزمایشات',NULL,'2024-11-18 09:48:35','2024-11-18 09:48:35',NULL,NULL,'azmayesh','آزمایشات',0,0);
('supervise-road-item-by-edareostani','web','نظارت بر ثبت فعالیت روزانه و جاری(ادارات استانی)',NULL,'2023-07-09 09:48:35','2023-07-09 09:48:37',NULL,NULL,'road-item','فعالیت روزانه',0,0),
('azmayesh-management','web','مدیریت آزمایشات',NULL,'2024-11-18 09:48:35','2024-11-18 09:48:35',NULL,NULL,'azmayesh','آزمایشات',0,0),
('azmayesh-type-management','web','مدیریت نوع آزمایشات',NULL,'2024-11-18 09:48:35','2024-11-18 09:48:35',NULL,NULL,'azmayesh','آزمایشات',0,0);