create blade excel files
This commit is contained in:
@@ -44,7 +44,7 @@ class AccidentReceiptController extends Controller
|
||||
{
|
||||
auth()->user()->addActivityComplete(1126);
|
||||
$name = 'گزارش از خسارات وارده به ابنیه فنی و تاسیسات راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
$data = $accidentReceiptTableService->dataTable($request);
|
||||
$data = $accidentReceiptTableService->dataTable($request, true);
|
||||
return Excel::download(new DataTableReport($data), $name);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Http\Controllers\V3\Dashboard\Reports;
|
||||
|
||||
use App\Exports\V3\AccidentReceipt\CityReport;
|
||||
use App\Exports\V3\AccidentReceipt\ProvinceReport;
|
||||
use App\Exports\V3\AccidentReceipt\CountryReport;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\City;
|
||||
@@ -18,18 +18,18 @@ class AccidentReceiptReportController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function provinceReport(Request $request, AccidentReceiptTableService $accidentReceiptTableService): JsonResponse
|
||||
public function countryReport(Request $request, AccidentReceiptTableService $accidentReceiptTableService): JsonResponse
|
||||
{
|
||||
$data = $accidentReceiptTableService->provinceReport($request);
|
||||
$data = $accidentReceiptTableService->countryReport($request);
|
||||
return $this->successResponse([
|
||||
'activities' => $data['data'],
|
||||
'provinces' => Province::all(['id', 'name_fa']),
|
||||
]);
|
||||
}
|
||||
|
||||
public function cityReport(Request $request, AccidentReceiptTableService $accidentReceiptTableService): JsonResponse
|
||||
public function provinceReport(Request $request, AccidentReceiptTableService $accidentReceiptTableService): JsonResponse
|
||||
{
|
||||
$data = $accidentReceiptTableService->cityReport($request);
|
||||
$data = $accidentReceiptTableService->provinceReport($request);
|
||||
return $this->successResponse([
|
||||
'activities' => $data['data'],
|
||||
'cities' => City::query()->where('province_id', '=', $request->province_id)
|
||||
@@ -38,17 +38,22 @@ class AccidentReceiptReportController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function countryExcelReport(Request $request, AccidentReceiptTableService $accidentReceiptTableService): BinaryFileResponse
|
||||
{
|
||||
$data = $accidentReceiptTableService->countryReport($request);
|
||||
$name = 'گزارش از خسارات وارده به ابنیه فنی و تاسیسات راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
return Excel::download(new CountryReport($data), $name);
|
||||
}
|
||||
|
||||
public function provinceExcelReport(Request $request, AccidentReceiptTableService $accidentReceiptTableService): BinaryFileResponse
|
||||
{
|
||||
$data = $accidentReceiptTableService->provinceReport($request);
|
||||
$name = 'گزارش از خسارات وارده به ابنیه فنی و تاسیسات راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
return Excel::download(new ProvinceReport($data), $name);
|
||||
}
|
||||
|
||||
public function cityExcelReport(Request $request, AccidentReceiptTableService $accidentReceiptTableService): BinaryFileResponse
|
||||
{
|
||||
$data = $accidentReceiptTableService->cityReport($request);
|
||||
$name = 'گزارش از خسارات وارده به ابنیه فنی و تاسیسات راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
return Excel::download(new CityReport($data), $name);
|
||||
return Excel::download(new ProvinceReport([
|
||||
'report' => $data,
|
||||
'cities' => City::query()->where('province_id', '=', $request->province_id)
|
||||
->where('type_id', '=', 1)
|
||||
->get(['id', 'name_fa']),
|
||||
]), $name);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user