Merge pull request 'fix the command' (#19) from feature/PolyLineEncoderCommand into develop
Reviewed-on: #19
This commit was merged in pull request #19.
This commit is contained in:
@@ -28,7 +28,8 @@ class EncodePolyLineCommand extends Command
|
|||||||
public function handle(PolylineEncoder $polylineEncoder): void
|
public function handle(PolylineEncoder $polylineEncoder): void
|
||||||
{
|
{
|
||||||
Mission::query()->whereNotNull('area')->each(function ($mission) use ($polylineEncoder) {
|
Mission::query()->whereNotNull('area')->each(function ($mission) use ($polylineEncoder) {
|
||||||
$encodedValue = $polylineEncoder->encodePolyLine($mission, lng_lat_format:true);
|
$area = json_decode($mission->area, true);
|
||||||
|
$encodedValue = $polylineEncoder->encodePolyLine($area['coordinates'], lng_lat_format:true);
|
||||||
$mission->update([
|
$mission->update([
|
||||||
'encoded_route' => $encodedValue,
|
'encoded_route' => $encodedValue,
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ class ReportMachineController extends Controller
|
|||||||
allowedSortings: ['*'],
|
allowedSortings: ['*'],
|
||||||
allowedSelects: [
|
allowedSelects: [
|
||||||
'id', 'province_id', 'province_name', 'city_id', 'city_name',
|
'id', 'province_id', 'province_name', 'city_id', 'city_name',
|
||||||
'end_km', 'km', 'driver_name', 'state_name', 'station_name'
|
'end_km', 'km', 'driver_name', 'state_id', 'station_name'
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -125,4 +125,26 @@ class ReportMachineController extends Controller
|
|||||||
|
|
||||||
return Excel::download(new machineReport($data), $name);
|
return Excel::download(new machineReport($data), $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function countryMachineDriversActivity(Request $request, ReportMachineService $reportMachineService)
|
||||||
|
{
|
||||||
|
return $this->successResponse([
|
||||||
|
'activities' => $reportMachineService->countryMachineDriversActivity($request),
|
||||||
|
// 'provinces' => Province::all(['id', 'name_fa']),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function provinceMachineDriversActivity(Request $request, ReportMachineService $reportMachineService)
|
||||||
|
{
|
||||||
|
return $this->successResponse([
|
||||||
|
'activities' => $reportMachineService->provinceMachineDriversActivity($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'])
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,4 +29,18 @@ class UpdateRequest extends FormRequest
|
|||||||
'enter_station' => 'required|date',
|
'enter_station' => 'required|date',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function after(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
function (Validator $validator) {
|
||||||
|
if (strtotime($this->violation->exit_station) < strtotime($this->enter_station)) {
|
||||||
|
$validator->errors()->add(
|
||||||
|
'time',
|
||||||
|
'زمان پایان ماموریت باید بعد از زمان شروع ماموریت باشد.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ class RequestPortalService
|
|||||||
'description', 'requested_machines', 'type', 'type_fa', 'start_date', 'state_id',
|
'description', 'requested_machines', 'type', 'type_fa', 'start_date', 'state_id',
|
||||||
'end_date', 'request_date', 'end_point', 'encoded_route', 'zone', 'zone_fa', 'start_time', 'finish_time',
|
'end_date', 'request_date', 'end_point', 'encoded_route', 'zone', 'zone_fa', 'start_time', 'finish_time',
|
||||||
'code', 'category_id', 'category_name', 'explanation', 'city_id', 'city_name', 'province_id', 'station_name',
|
'code', 'category_id', 'category_name', 'explanation', 'city_id', 'city_name', 'province_id', 'station_name',
|
||||||
|
'driver_id', 'driver_name'
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -573,6 +573,8 @@ Route::prefix('missions')
|
|||||||
Route::get('/country_machine_types_activity', 'countryMachineTypesActivity')->name('countryMachineTypesActivity');
|
Route::get('/country_machine_types_activity', 'countryMachineTypesActivity')->name('countryMachineTypesActivity');
|
||||||
Route::get('/province_machine_types_activity', 'provinceMachineTypesActivity')->name('provinceMachineTypesActivity');
|
Route::get('/province_machine_types_activity', 'provinceMachineTypesActivity')->name('provinceMachineTypesActivity');
|
||||||
Route::get('/machine_details_report', 'machineDetailsReport')->name('machineDetailsReport');
|
Route::get('/machine_details_report', 'machineDetailsReport')->name('machineDetailsReport');
|
||||||
|
Route::get('/country_machine_drivers_activity', 'countryMachineDriversActivity')->name('countryMachineDriversActivity');
|
||||||
|
Route::get('/province_machine_drivers_activity', 'provinceMachineDriversActivity')->name('provinceMachineDriversActivity');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user