Merge branch 'feature/GetAccessWeb' into 'develop'
write web service for get answer when panjareh vahed send it See merge request witelgroup/rms_v2!173
This commit is contained in:
@@ -63,12 +63,18 @@ class PanjareVahedController extends Controller
|
||||
'province' => $city->province()->first()->name_fa,
|
||||
]);
|
||||
}
|
||||
public function getAccessRoad(GetAccessRoadRequest $request, Harim $harim)
|
||||
public function getAccessRoad(GetAccessRoadRequest $request)
|
||||
{
|
||||
Harim::update([
|
||||
'panjarevahed_id' => $request->panjarevahed_id,
|
||||
'polygon' => $request->polygon,
|
||||
$state = HarimStates::BARESI_FILE_APLODE_SHODE_TAVASOTE_DAFTAR_HARIM->value;
|
||||
|
||||
Harim::query()
|
||||
->firstWhere('panjare_vahed_id', '=', $request->panjare_vahed_id)
|
||||
->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
'access_road' => $request->access_road,
|
||||
]);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,10 +24,7 @@ class RoadMaintenanceStationController extends Controller
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
$user = auth()->user();
|
||||
auth()->user()->addActivityComplete(1019);
|
||||
|
||||
$allowedFilters = ['*'];
|
||||
$allowedSortings = ['*'];
|
||||
$user->addActivityComplete(1019);
|
||||
|
||||
$province = $request->province;
|
||||
$status = $request->status;
|
||||
@@ -38,15 +35,15 @@ class RoadMaintenanceStationController extends Controller
|
||||
->when($type, fn ($query, $type) => $query->where('type', $type))
|
||||
->when($province, fn($query, $province) => $query->where('province_id', $province));
|
||||
|
||||
if ($user->hasPermissionTo('show-tollhouse-province')) {
|
||||
if ($user->hasPermissionTo('show-tollhouse-province') && !$user->hasPermissionTo('show-tollhouse')) {
|
||||
$query->where('province_id', $user->province_id);
|
||||
}
|
||||
|
||||
$data = DataTableFacade::run(
|
||||
$query,
|
||||
$request,
|
||||
allowedFilters: $allowedFilters,
|
||||
allowedSortings: $allowedSortings
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*']
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ class GetAccessRoadRequest extends FormRequest
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'panjarevahed_id'=> 'required|string',
|
||||
'polygon' => 'required|string',
|
||||
'panjare_vahed_id' => 'required|string',
|
||||
'access_road' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ class OperatorService
|
||||
return DB::select("
|
||||
WITH edareh_data AS (
|
||||
SELECT
|
||||
e.id AS edareh_id,
|
||||
e.id AS edare_id,
|
||||
a.id AS axis_type_id,
|
||||
COALESCE(SUM(t.step = 1), 0) AS s1,
|
||||
COALESCE(SUM(t.step = 2), 0) AS s2,
|
||||
@@ -105,21 +105,21 @@ class OperatorService
|
||||
GROUP BY e.id, a.id
|
||||
)
|
||||
SELECT
|
||||
edareh_id,
|
||||
edare_id,
|
||||
axis_type_id,
|
||||
s1,
|
||||
s2,
|
||||
s3,
|
||||
COALESCE(
|
||||
SUM(s1 + s2 + s3)
|
||||
OVER (PARTITION BY edareh_id), 0
|
||||
OVER (PARTITION BY edare_id), 0
|
||||
) AS total_sum
|
||||
FROM edareh_data
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
-1 AS edareh_id,
|
||||
-1 AS edare_id,
|
||||
axis_type_id,
|
||||
COALESCE(SUM(s1), 0) AS s1,
|
||||
COALESCE(SUM(s2), 0) AS s2,
|
||||
@@ -130,7 +130,7 @@ class OperatorService
|
||||
FROM edareh_data
|
||||
GROUP BY axis_type_id
|
||||
|
||||
ORDER BY edareh_id , axis_type_id
|
||||
ORDER BY edare_id , axis_type_id
|
||||
", [
|
||||
'provinceId' => $province_id,
|
||||
'infoId' => $info_id,
|
||||
|
||||
Reference in New Issue
Block a user