reform the blade files
This commit is contained in:
@@ -13,16 +13,18 @@ use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
||||
|
||||
class CountryActivityPerSubItemReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
|
||||
{
|
||||
public function __construct(private array $activities){}
|
||||
public function __construct(private array $data){}
|
||||
|
||||
public function view(): View
|
||||
{
|
||||
$activities = $this->activities;
|
||||
$data = $this->data;
|
||||
|
||||
return view('v3.Reports.RoadItems.CountryActivityPerSubItem', [
|
||||
'activities' => $activities["data"],
|
||||
'fromDate' => $activities["fromDate"],
|
||||
'toDate' => $activities["toDate"],
|
||||
'data' => $data['activities']['data'],
|
||||
'provinces' => $data['provinces'],
|
||||
'subItems' => $data['subItems'],
|
||||
'fromDate' => $data['activities']['fromDate'],
|
||||
'toDate' => $data['activities']['toDate']
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,16 +18,18 @@ use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
||||
|
||||
class ProvinceActivityPerSubItemReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
|
||||
{
|
||||
public function __construct(private array $activities){}
|
||||
public function __construct(private array $data){}
|
||||
|
||||
public function view(): View
|
||||
{
|
||||
$activities = $this->activities;
|
||||
$data = $this->data;
|
||||
|
||||
return view('v3.Reports.RoadItems.ProvinceActivityPerSubItem', [
|
||||
'activities' => $activities["data"],
|
||||
'fromDate' => $activities["fromDate"],
|
||||
'toDate' => $activities["toDate"],
|
||||
'data' => $data['activities']['data'],
|
||||
'edarateShahri' => $data['edarateShahri'],
|
||||
'subItems' => $data['subItems'],
|
||||
'fromDate' => $data['activities']['fromDate'],
|
||||
'toDate' => $data['activities']['toDate']
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -143,7 +143,15 @@ class RoadItemsReportController extends Controller
|
||||
auth()->user()->addActivityComplete(1034);
|
||||
$name = "گزارش کشوری از فعالیت روزانه و جاری - جدول 2 " . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
$activities = $roadItemReportService->countryActivityPerSubItem($request);
|
||||
return Excel::download(new CountryActivityPerSubItemReport($activities), $name);
|
||||
$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
|
||||
@@ -151,6 +159,14 @@ class RoadItemsReportController extends Controller
|
||||
auth()->user()->addActivityComplete(1034);
|
||||
$activities = $roadItemReportService->provinceActivityPerSubItem($request);
|
||||
$name = "گزارش استانی از فعالیت روزانه و جاری - جدول 2 " . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
return Excel::download(new ProvinceActivityPerSubItemReport($activities), $name);
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user