crate new repor for machin when they go to the mission and fix bugs in traddod mission
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\V3\Dashboard\Mission\Report;
|
||||
|
||||
use App\Exports\V3\Mission\Report\Tradod\CountryReport;
|
||||
use App\Exports\V3\Mission\Report\Tradod\ProvinceReport;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\City;
|
||||
use App\Models\Mission;
|
||||
use App\Models\Province;
|
||||
use App\Services\Cartables\Mission\Report\ReportMachineService;
|
||||
use App\Services\Cartables\Mission\Report\ReportTradodService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use PhpOffice\PhpSpreadsheet\Exception;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
|
||||
class ReportMachineController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function Activity(Request $request, ReportMachineService $reportMachineService): JsonResponse
|
||||
{
|
||||
return $this->successResponse([
|
||||
'activities' => $reportMachineService->Activity($request),
|
||||
'provinces' => Province::all(['id', 'name_fa']),
|
||||
'code' => Mission::query()
|
||||
->where('machine_code', $request->machine_code)
|
||||
->get()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||
*/
|
||||
public function ExcelActivity(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
|
||||
{
|
||||
$data = $reportMachineService->Activity($request);
|
||||
$name = 'گزارش کل تردد یک ماشین '.verta()->now()->format('Y-m-d H-i').'.xlsx';
|
||||
|
||||
return Excel::download(new CountryReport($data), $name);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user