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,
|
'province' => $city->province()->first()->name_fa,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
public function getAccessRoad(GetAccessRoadRequest $request, Harim $harim)
|
public function getAccessRoad(GetAccessRoadRequest $request)
|
||||||
{
|
{
|
||||||
Harim::update([
|
$state = HarimStates::BARESI_FILE_APLODE_SHODE_TAVASOTE_DAFTAR_HARIM->value;
|
||||||
'panjarevahed_id' => $request->panjarevahed_id,
|
|
||||||
'polygon' => $request->polygon,
|
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();
|
return $this->successResponse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,10 +24,7 @@ class RoadMaintenanceStationController extends Controller
|
|||||||
public function index(Request $request): JsonResponse
|
public function index(Request $request): JsonResponse
|
||||||
{
|
{
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
auth()->user()->addActivityComplete(1019);
|
$user->addActivityComplete(1019);
|
||||||
|
|
||||||
$allowedFilters = ['*'];
|
|
||||||
$allowedSortings = ['*'];
|
|
||||||
|
|
||||||
$province = $request->province;
|
$province = $request->province;
|
||||||
$status = $request->status;
|
$status = $request->status;
|
||||||
@@ -38,15 +35,15 @@ class RoadMaintenanceStationController extends Controller
|
|||||||
->when($type, fn ($query, $type) => $query->where('type', $type))
|
->when($type, fn ($query, $type) => $query->where('type', $type))
|
||||||
->when($province, fn($query, $province) => $query->where('province_id', $province));
|
->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);
|
$query->where('province_id', $user->province_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = DataTableFacade::run(
|
$data = DataTableFacade::run(
|
||||||
$query,
|
$query,
|
||||||
$request,
|
$request,
|
||||||
allowedFilters: $allowedFilters,
|
allowedFilters: ['*'],
|
||||||
allowedSortings: $allowedSortings
|
allowedSortings: ['*']
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ class GetAccessRoadRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'panjarevahed_id'=> 'required|string',
|
'panjare_vahed_id' => 'required|string',
|
||||||
'polygon' => 'required|string',
|
'access_road' => 'required',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ class OperatorService
|
|||||||
return DB::select("
|
return DB::select("
|
||||||
WITH edareh_data AS (
|
WITH edareh_data AS (
|
||||||
SELECT
|
SELECT
|
||||||
e.id AS edareh_id,
|
e.id AS edare_id,
|
||||||
a.id AS axis_type_id,
|
a.id AS axis_type_id,
|
||||||
COALESCE(SUM(t.step = 1), 0) AS s1,
|
COALESCE(SUM(t.step = 1), 0) AS s1,
|
||||||
COALESCE(SUM(t.step = 2), 0) AS s2,
|
COALESCE(SUM(t.step = 2), 0) AS s2,
|
||||||
@@ -105,21 +105,21 @@ class OperatorService
|
|||||||
GROUP BY e.id, a.id
|
GROUP BY e.id, a.id
|
||||||
)
|
)
|
||||||
SELECT
|
SELECT
|
||||||
edareh_id,
|
edare_id,
|
||||||
axis_type_id,
|
axis_type_id,
|
||||||
s1,
|
s1,
|
||||||
s2,
|
s2,
|
||||||
s3,
|
s3,
|
||||||
COALESCE(
|
COALESCE(
|
||||||
SUM(s1 + s2 + s3)
|
SUM(s1 + s2 + s3)
|
||||||
OVER (PARTITION BY edareh_id), 0
|
OVER (PARTITION BY edare_id), 0
|
||||||
) AS total_sum
|
) AS total_sum
|
||||||
FROM edareh_data
|
FROM edareh_data
|
||||||
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
-1 AS edareh_id,
|
-1 AS edare_id,
|
||||||
axis_type_id,
|
axis_type_id,
|
||||||
COALESCE(SUM(s1), 0) AS s1,
|
COALESCE(SUM(s1), 0) AS s1,
|
||||||
COALESCE(SUM(s2), 0) AS s2,
|
COALESCE(SUM(s2), 0) AS s2,
|
||||||
@@ -130,7 +130,7 @@ class OperatorService
|
|||||||
FROM edareh_data
|
FROM edareh_data
|
||||||
GROUP BY axis_type_id
|
GROUP BY axis_type_id
|
||||||
|
|
||||||
ORDER BY edareh_id , axis_type_id
|
ORDER BY edare_id , axis_type_id
|
||||||
", [
|
", [
|
||||||
'provinceId' => $province_id,
|
'provinceId' => $province_id,
|
||||||
'infoId' => $info_id,
|
'infoId' => $info_id,
|
||||||
|
|||||||
Reference in New Issue
Block a user