just for go enother work i donot no work or not

This commit is contained in:
2025-07-30 14:23:52 +03:30
parent ab059cfe52
commit a9067950d7
16 changed files with 652 additions and 412 deletions

View File

@@ -0,0 +1,83 @@
<?php
namespace App\Exports\V3\SafetyAndPrivacy\Country;
use App\Models\EdarateShahri;
use App\Models\Province;
use Illuminate\Contracts\View\View;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Http\Request;
use Maatwebsite\Excel\Concerns\FromView;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithDrawings;
use Maatwebsite\Excel\Concerns\WithEvents;
use Maatwebsite\Excel\Events\AfterSheet;
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class AccessRoadReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
{
public function __construct(private array $data){}
public function view(): View
{
$data = $this->data;
$existedProvinces = array_keys($data);
foreach (Province::all() as $value) {
$provinceId = $value->id;
if (!array_key_exists($provinceId, $existedProvinces)) {
$data[] = (object) [
'province_id' => $provinceId,
'name_fa' => $value->name_fa,
'sum' => 0,
'axis_data' => [
'آزادراه' => ['1' => 0, '2' => 0, '3' => 0],
'بزرگراه' => ['1' => 0, '2' => 0, '3' => 0],
'اصلی' => ['1' => 0, '2' => 0, '3' => 0],
'فرعی' => ['1' => 0, '2' => 0, '3' => 0],
'روستایی' => ['1' => 0, '2' => 0, '3' => 0],
],
];
}
}
return view('v3.Reports.SafetyAndPrivacy.Country.AccessRoadReport', [
'data' => $data,
]);
}
public function registerEvents(): array
{
return [
AfterSheet::class => function (AfterSheet $event) {
$event->sheet->getDelegate()->setRightToLeft(true);
},
];
}
public function drawings(): array
{
$drawing = new Drawing();
$drawing->setName('Logo');
$drawing->setDescription('This is my logo');
$drawing->setPath(public_path('/dist/logo.png'));
$drawing->setWidth(50);
$drawing->setHeight(50);
$drawing->setOffsetX(5);
$drawing->setOffsetY(5);
$drawing->setCoordinates('A1');
$drawing2 = new Drawing();
$drawing2->setName('Logo');
$drawing2->setDescription('This is my logo');
$drawing2->setPath(public_path('/dist/141icon.png'));
$drawing2->setWidth(50);
$drawing2->setHeight(50);
$drawing2->setOffsetX(5);
$drawing2->setOffsetY(5);
$drawing2->setCoordinates('Q1');
return [$drawing, $drawing2];
}
}

View File

@@ -0,0 +1,84 @@
<?php
namespace App\Exports\V3\SafetyAndPrivacy\Country;
use App\Models\EdarateShahri;
use App\Models\Province;
use Illuminate\Contracts\View\View;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Http\Request;
use Maatwebsite\Excel\Concerns\FromView;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithDrawings;
use Maatwebsite\Excel\Concerns\WithEvents;
use Maatwebsite\Excel\Events\AfterSheet;
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class ConstructionReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
{
public function __construct(private array $data){}
public function view(): View
{
$data = $this->data;
$existedProvinces = array_keys($data);
foreach (Province::all() as $value) {
$provinceId = $value->id;
if (!array_key_exists($provinceId, $existedProvinces)) {
$data[] = (object) [
'province_id' => $provinceId,
'name_fa' => $value->name_fa,
'sum' => 0,
'axis_data' => [
'آزادراه' => ['1' => 0, '2' => 0, '3' => 0],
'بزرگراه' => ['1' => 0, '2' => 0, '3' => 0],
'اصلی' => ['1' => 0, '2' => 0, '3' => 0],
'فرعی' => ['1' => 0, '2' => 0, '3' => 0],
'روستایی' => ['1' => 0, '2' => 0, '3' => 0],
],
];
}
}
return view('v3.Reports.SafetyAndPrivacy.Country.ConstructionReport', [
'data' => $data,
]);
}
public function registerEvents(): array
{
return [
AfterSheet::class => function (AfterSheet $event) {
$event->sheet->getDelegate()->setRightToLeft(true);
},
];
}
public function drawings(): array
{
$drawing = new Drawing();
$drawing->setName('Logo');
$drawing->setDescription('This is my logo');
$drawing->setPath(public_path('/dist/logo.png'));
$drawing->setWidth(50);
$drawing->setHeight(50);
$drawing->setOffsetX(5);
$drawing->setOffsetY(5);
$drawing->setCoordinates('A1');
$drawing2 = new Drawing();
$drawing2->setName('Logo');
$drawing2->setDescription('This is my logo');
$drawing2->setPath(public_path('/dist/141icon.png'));
$drawing2->setWidth(50);
$drawing2->setHeight(50);
$drawing2->setOffsetX(5);
$drawing2->setOffsetY(5);
$drawing2->setCoordinates('Q1');
return [$drawing, $drawing2];
}
}

View File

@@ -0,0 +1,84 @@
<?php
namespace App\Exports\V3\SafetyAndPrivacy\Country;
use App\Models\EdarateShahri;
use App\Models\Province;
use Illuminate\Contracts\View\View;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Http\Request;
use Maatwebsite\Excel\Concerns\FromView;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithDrawings;
use Maatwebsite\Excel\Concerns\WithEvents;
use Maatwebsite\Excel\Events\AfterSheet;
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class UtilityPassingReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
{
public function __construct(private array $data){}
public function view(): View
{
$data = $this->data;
$existedProvinces = array_keys($data);
foreach (Province::all() as $value) {
$provinceId = $value->id;
if (!array_key_exists($provinceId, $existedProvinces)) {
$data[] = (object) [
'province_id' => $provinceId,
'name_fa' => $value->name_fa,
'sum' => 0,
'axis_data' => [
'آزادراه' => ['1' => 0, '2' => 0, '3' => 0],
'بزرگراه' => ['1' => 0, '2' => 0, '3' => 0],
'اصلی' => ['1' => 0, '2' => 0, '3' => 0],
'فرعی' => ['1' => 0, '2' => 0, '3' => 0],
'روستایی' => ['1' => 0, '2' => 0, '3' => 0],
],
];
}
}
return view('v3.Reports.SafetyAndPrivacy.Country.UtilityPassingReport', [
'data' => $data,
]);
}
public function registerEvents(): array
{
return [
AfterSheet::class => function (AfterSheet $event) {
$event->sheet->getDelegate()->setRightToLeft(true);
},
];
}
public function drawings(): array
{
$drawing = new Drawing();
$drawing->setName('Logo');
$drawing->setDescription('This is my logo');
$drawing->setPath(public_path('/dist/logo.png'));
$drawing->setWidth(50);
$drawing->setHeight(50);
$drawing->setOffsetX(5);
$drawing->setOffsetY(5);
$drawing->setCoordinates('A1');
$drawing2 = new Drawing();
$drawing2->setName('Logo');
$drawing2->setDescription('This is my logo');
$drawing2->setPath(public_path('/dist/141icon.png'));
$drawing2->setWidth(50);
$drawing2->setHeight(50);
$drawing2->setOffsetX(5);
$drawing2->setOffsetY(5);
$drawing2->setCoordinates('Q1');
return [$drawing, $drawing2];
}
}

View File

@@ -0,0 +1,83 @@
<?php
namespace App\Exports\V3\SafetyAndPrivacy\Province;
use App\Models\EdarateShahri;
use Illuminate\Contracts\View\View;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Http\Request;
use Maatwebsite\Excel\Concerns\FromView;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithDrawings;
use Maatwebsite\Excel\Concerns\WithEvents;
use Maatwebsite\Excel\Events\AfterSheet;
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class AccessRoadReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
{
public function __construct(private array $data, public Request $request){}
public function view(): View
{
$data = $this->data;
$existedCities = array_keys($data);
$edarat = EdarateShahri::query()->where('province_id', '=', $this->request->province_id)->get(['id', 'name_fa']);
foreach ($edarat as $value) {
$edareId = $value->id;
if (!array_key_exists($edareId, $existedCities)) {
$data[] = (object) [
'edare_shahri_id' => $edareId,
'name_fa' => $value->name_fa,
'sum' => 0,
'axis_data' => [
'آزادراه' => ['1' => 0, '2' => 0, '3' => 0],
'بزرگراه' => ['1' => 0, '2' => 0, '3' => 0],
'اصلی' => ['1' => 0, '2' => 0, '3' => 0],
'فرعی' => ['1' => 0, '2' => 0, '3' => 0],
'روستایی' => ['1' => 0, '2' => 0, '3' => 0],
],
];
}
}
return view('v3.Reports.SafetyAndPrivacy.Province.AccessRoadReport', [
'data' => $data,
]);
}
public function registerEvents(): array
{
return [
AfterSheet::class => function (AfterSheet $event) {
$event->sheet->getDelegate()->setRightToLeft(true);
},
];
}
public function drawings(): array
{
$drawing = new Drawing();
$drawing->setName('Logo');
$drawing->setDescription('This is my logo');
$drawing->setPath(public_path('/dist/logo.png'));
$drawing->setWidth(50);
$drawing->setHeight(50);
$drawing->setOffsetX(5);
$drawing->setOffsetY(5);
$drawing->setCoordinates('A1');
$drawing2 = new Drawing();
$drawing2->setName('Logo');
$drawing2->setDescription('This is my logo');
$drawing2->setPath(public_path('/dist/141icon.png'));
$drawing2->setWidth(50);
$drawing2->setHeight(50);
$drawing2->setOffsetX(5);
$drawing2->setOffsetY(5);
$drawing2->setCoordinates('Q1');
return [$drawing, $drawing2];
}
}

View File

@@ -0,0 +1,83 @@
<?php
namespace App\Exports\V3\SafetyAndPrivacy\Province;
use App\Models\EdarateShahri;
use Illuminate\Contracts\View\View;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Http\Request;
use Maatwebsite\Excel\Concerns\FromView;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithDrawings;
use Maatwebsite\Excel\Concerns\WithEvents;
use Maatwebsite\Excel\Events\AfterSheet;
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class ConstructionReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
{
public function __construct(private array $data, public Request $request){}
public function view(): View
{
$data = $this->data;
$existedCities = array_keys($data);
$edarat = EdarateShahri::query()->where('province_id', '=', $this->request->province_id)->get(['id', 'name_fa']);
foreach ($edarat as $value) {
$edareId = $value->id;
if (!array_key_exists($edareId, $existedCities)) {
$data[] = (object) [
'edare_shahri_id' => $edareId,
'name_fa' => $value->name_fa,
'sum' => 0,
'axis_data' => [
'آزادراه' => ['1' => 0, '2' => 0, '3' => 0],
'بزرگراه' => ['1' => 0, '2' => 0, '3' => 0],
'اصلی' => ['1' => 0, '2' => 0, '3' => 0],
'فرعی' => ['1' => 0, '2' => 0, '3' => 0],
'روستایی' => ['1' => 0, '2' => 0, '3' => 0],
],
];
}
}
return view('v3.Reports.SafetyAndPrivacy.Province.ConstructionReport', [
'data' => $data,
]);
}
public function registerEvents(): array
{
return [
AfterSheet::class => function (AfterSheet $event) {
$event->sheet->getDelegate()->setRightToLeft(true);
},
];
}
public function drawings(): array
{
$drawing = new Drawing();
$drawing->setName('Logo');
$drawing->setDescription('This is my logo');
$drawing->setPath(public_path('/dist/logo.png'));
$drawing->setWidth(50);
$drawing->setHeight(50);
$drawing->setOffsetX(5);
$drawing->setOffsetY(5);
$drawing->setCoordinates('A1');
$drawing2 = new Drawing();
$drawing2->setName('Logo');
$drawing2->setDescription('This is my logo');
$drawing2->setPath(public_path('/dist/141icon.png'));
$drawing2->setWidth(50);
$drawing2->setHeight(50);
$drawing2->setOffsetX(5);
$drawing2->setOffsetY(5);
$drawing2->setCoordinates('Q1');
return [$drawing, $drawing2];
}
}

View File

@@ -0,0 +1,83 @@
<?php
namespace App\Exports\V3\SafetyAndPrivacy\Province;
use App\Models\EdarateShahri;
use Illuminate\Contracts\View\View;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Http\Request;
use Maatwebsite\Excel\Concerns\FromView;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithDrawings;
use Maatwebsite\Excel\Concerns\WithEvents;
use Maatwebsite\Excel\Events\AfterSheet;
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class UtilityPassingReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
{
public function __construct(private array $data, public Request $request){}
public function view(): View
{
$data = $this->data;
$existedCities = array_keys($data);
$edarat = EdarateShahri::query()->where('province_id', '=', $this->request->province_id)->get(['id', 'name_fa']);
foreach ($edarat as $value) {
$edareId = $value->id;
if (!array_key_exists($edareId, $existedCities)) {
$data[] = (object) [
'edare_shahri_id' => $edareId,
'name_fa' => $value->name_fa,
'sum' => 0,
'axis_data' => [
'آزادراه' => ['1' => 0, '2' => 0, '3' => 0],
'بزرگراه' => ['1' => 0, '2' => 0, '3' => 0],
'اصلی' => ['1' => 0, '2' => 0, '3' => 0],
'فرعی' => ['1' => 0, '2' => 0, '3' => 0],
'روستایی' => ['1' => 0, '2' => 0, '3' => 0],
],
];
}
}
return view('v3.Reports.SafetyAndPrivacy.Province.UtilityPassingReport', [
'data' => $data,
]);
}
public function registerEvents(): array
{
return [
AfterSheet::class => function (AfterSheet $event) {
$event->sheet->getDelegate()->setRightToLeft(true);
},
];
}
public function drawings(): array
{
$drawing = new Drawing();
$drawing->setName('Logo');
$drawing->setDescription('This is my logo');
$drawing->setPath(public_path('/dist/logo.png'));
$drawing->setWidth(50);
$drawing->setHeight(50);
$drawing->setOffsetX(5);
$drawing->setOffsetY(5);
$drawing->setCoordinates('A1');
$drawing2 = new Drawing();
$drawing2->setName('Logo');
$drawing2->setDescription('This is my logo');
$drawing2->setPath(public_path('/dist/141icon.png'));
$drawing2->setWidth(50);
$drawing2->setHeight(50);
$drawing2->setOffsetX(5);
$drawing2->setOffsetY(5);
$drawing2->setCoordinates('Q1');
return [$drawing, $drawing2];
}
}