refactor blades
This commit is contained in:
@@ -17,18 +17,18 @@ use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
||||
|
||||
class CountryActivityPerItemReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
|
||||
{
|
||||
public function __construct(private ?array $activities){}
|
||||
public function __construct(private ?array $data){}
|
||||
|
||||
public function view(): View
|
||||
{
|
||||
$activities = $this->activities;
|
||||
$fromDate = $activities['fromDate'] ?? '2021-03-21 00:00:00';
|
||||
$toDate = $activities['toDate'] ?? \Carbon\Carbon::now();
|
||||
$data = $this->data;
|
||||
|
||||
return view('v3.Reports.RoadItems.CountryActivityPerItem', [
|
||||
'activities' => $activities['data'],
|
||||
'fromDate' => $fromDate,
|
||||
'toDate' => $toDate
|
||||
'data' => $data['activities']['data'],
|
||||
'provinces' => $data['provinces'],
|
||||
'items' => $data['items'],
|
||||
'fromDate' => $data['activities']['fromDate'],
|
||||
'toDate' => $data['activities']['toDate']
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ 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;
|
||||
@@ -17,7 +18,7 @@ use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
||||
|
||||
class OperatorCartableReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
|
||||
{
|
||||
public function __construct(private ?string $data){}
|
||||
public function __construct(private ?Collection $data){}
|
||||
|
||||
public function view(): View
|
||||
{
|
||||
|
||||
@@ -17,18 +17,18 @@ use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
||||
|
||||
class ProvinceActivityPerItemReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
|
||||
{
|
||||
public function __construct(private ?array $activities){}
|
||||
public function __construct(private ?array $data){}
|
||||
|
||||
public function view(): View
|
||||
{
|
||||
$activities = $this->activities;
|
||||
$fromDate = $activities['fromDate'] ?? '2021-03-21 00:00:00';
|
||||
$toDate = $activities['toDate'] ?? \Carbon\Carbon::now();
|
||||
$data = $this->data;
|
||||
|
||||
return view('v3.Reports.RoadItems.ProvinceActivityPerItem', [
|
||||
'activitis' => $activities['data'],
|
||||
'fromDate' => $fromDate,
|
||||
'toDate' => $toDate
|
||||
'data' => $data['activities']['data'],
|
||||
'edarateShahri' => $data['edarateShahri'],
|
||||
'items' => $data['items'],
|
||||
'fromDate' => $data['activities']['fromDate'],
|
||||
'toDate' => $data['activities']['toDate']
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ 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;
|
||||
@@ -17,7 +18,7 @@ use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
||||
|
||||
class SupervisorCartableReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
|
||||
{
|
||||
public function __construct(private ?string $data){}
|
||||
public function __construct(private ?Collection $data){}
|
||||
|
||||
public function view(): View
|
||||
{
|
||||
|
||||
@@ -119,7 +119,11 @@ class RoadItemsReportController extends Controller
|
||||
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), $name);
|
||||
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
|
||||
@@ -127,7 +131,11 @@ class RoadItemsReportController extends Controller
|
||||
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), $name);
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user