add form request to start and finish api

This commit is contained in:
2025-06-28 08:54:15 +03:30
parent 47dd5afb47
commit 7769133bc3
7 changed files with 84 additions and 25 deletions

View File

@@ -16,14 +16,10 @@ class ControlUnitService
public function dataTable(Request $request)
{
$fields = [
'id', 'user_id', 'username', 'state_name', 'province_name', 'edare_shahri_name',
'description', 'requested_machines', 'type', 'type_fa', 'start_date',
'end_date', 'request_date', 'end_point', 'area', 'zone', 'zone_fa'
];
$query = Mission::query()
->where('state_id', '=', MissionStates::PENDING_CONFIRMATION->value)
->whereIn('state_id', [
MissionStates::PENDING_CONFIRMATION->value, MissionStates::START_MISSION->value
])
->where('edare_shahri_name', '=', Auth::user()->edarate_shahri_id);
return DataTableFacade::run(
@@ -31,7 +27,11 @@ class ControlUnitService
$request,
allowedFilters: ['*'],
allowedSortings: ['*'],
allowedSelects: $fields
allowedSelects: [
'id', 'user_id', 'username', 'state_name', 'province_name', 'edare_shahri_name',
'description', 'requested_machines', 'type', 'type_fa', 'start_date', 'state_id',
'end_date', 'request_date', 'end_point', 'area', 'zone', 'zone_fa'
]
);
}
}

View File

@@ -15,11 +15,6 @@ class RequestPortalService
public function datatable(Request $request)
{
$user = auth()->user();
$fields = [
'id', 'user_id', 'username', 'state_name', 'province_name', 'edare_shahri_name',
'description', 'requested_machines', 'type', 'type_fa', 'start_date',
'end_date', 'request_date', 'end_point', 'area', 'zone', 'zone_fa'
];
$query = Mission::query();
if ($user->hasPermissionTo('manage-request-portal-city')) {
@@ -34,7 +29,11 @@ class RequestPortalService
$request,
allowedFilters: ['*'],
allowedSortings: ['*'],
allowedSelects: $fields
allowedSelects: [
'id', 'user_id', 'username', 'state_name', 'province_name', 'edare_shahri_name',
'description', 'requested_machines', 'type', 'type_fa', 'start_date', 'state_id',
'end_date', 'request_date', 'end_point', 'area', 'zone', 'zone_fa'
]
);
}
}

View File

@@ -12,12 +12,6 @@ class TransportationUnitService
{
public function dataTable(Request $request)
{
$fields = [
'id', 'user_id', 'username', 'state_name', 'province_name', 'edare_shahri_name',
'description', 'requested_machines', 'type', 'type_fa', 'start_date',
'end_date', 'request_date', 'end_point', 'area', 'zone', 'zone_fa'
];
$query = Mission::query()
->where('state_id', '=', MissionStates::REQUEST_CREATED->value)
->where('edare_shahri_name', '=', Auth::user()->edarate_shahri_id);
@@ -27,7 +21,11 @@ class TransportationUnitService
$request,
allowedFilters: ['*'],
allowedSortings: ['*'],
allowedSelects: $fields
allowedSelects: [
'id', 'user_id', 'username', 'state_name', 'province_name', 'edare_shahri_name',
'description', 'requested_machines', 'type', 'type_fa', 'start_date', 'state_id',
'end_date', 'request_date', 'end_point', 'area', 'zone', 'zone_fa'
]
);
}
}