add report for machines
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\V3\Dashboard\Mission\Report;
|
||||
use App\Exports\V3\Mission\Report\Machine\machineReport;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\City;
|
||||
use App\Models\Province;
|
||||
use App\Services\Cartables\Mission\Report\ReportMachineService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -17,11 +18,11 @@ class ReportMachineController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function activity(Request $request, ReportMachineService $reportMachineService): JsonResponse
|
||||
public function countryMachinesActivity(Request $request, ReportMachineService $reportMachineService): JsonResponse
|
||||
{
|
||||
return $this->successResponse([
|
||||
'activities' => $reportMachineService->activity($request),
|
||||
'provinces' => Province::all(['id', 'name_fa']),
|
||||
'activities' => $reportMachineService->countryMachinesActivity($request),
|
||||
// 'provinces' => Province::all(['id', 'name_fa']),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -29,12 +30,59 @@ class ReportMachineController extends Controller
|
||||
* @throws Exception
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||
*/
|
||||
public function excelActivity(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
|
||||
public function countryMachinesActivityExcel(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
|
||||
{
|
||||
$data = $reportMachineService->activity($request);
|
||||
$name = 'گزارش کل تردد یک ماشین '.verta()->now()->format('Y-m-d H-i').'.xlsx';
|
||||
$data = $reportMachineService->countryMachinesActivity($request);
|
||||
$name = 'گزارش ماشین آلات'.verta()->now()->format('Y-m-d H-i').'.xlsx';
|
||||
|
||||
return Excel::download(new machineReport($data), $name);
|
||||
}
|
||||
|
||||
public function provinceMachinesActivity(Request $request, ReportMachineService $reportMachineService): JsonResponse
|
||||
{
|
||||
return $this->successResponse([
|
||||
'activities' => $reportMachineService->countryMachinesActivity($request),
|
||||
// 'city' => City::query()
|
||||
// ->where('province_id', $request->province_id)
|
||||
// ->where(function ($query) {
|
||||
// $query->where('type_id', 1)
|
||||
// ->orWhereIn('name_fa', ['اداره ماشينآلات', 'اداره نقلیه']);
|
||||
// })
|
||||
// ->get(['id', 'name_fa'])
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||
*/
|
||||
public function provinceMachinesActivityExcel(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
|
||||
{
|
||||
$data = $reportMachineService->countryMachinesActivity($request);
|
||||
$name = 'گزارش ماشین آلات'.verta()->now()->format('Y-m-d H-i').'.xlsx';
|
||||
|
||||
return Excel::download(new machineReport($data), $name);
|
||||
}
|
||||
|
||||
public function countryMachineTypesActivity(Request $request, ReportMachineService $reportMachineService): JsonResponse
|
||||
{
|
||||
return $this->successResponse([
|
||||
'activities' => $reportMachineService->countryMachineTypesActivity($request),
|
||||
// 'provinces' => Province::all(['id', 'name_fa']),
|
||||
]);
|
||||
}
|
||||
|
||||
public function provinceMachineTypesActivity(Request $request, ReportMachineService $reportMachineService): JsonResponse
|
||||
{
|
||||
return $this->successResponse([
|
||||
'activities' => $reportMachineService->provinceMachineTypesActivity($request),
|
||||
// 'city' => City::query()
|
||||
// ->where('province_id', $request->province_id)
|
||||
// ->where(function ($query) {
|
||||
// $query->where('type_id', 1)
|
||||
// ->orWhereIn('name_fa', ['اداره ماشينآلات', 'اداره نقلیه']);
|
||||
// })
|
||||
// ->get(['id', 'name_fa'])
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user