change nominatim original function
This commit is contained in:
@@ -24,6 +24,7 @@ use App\Exports\V2\RoadObservation\OperatorCartableExport;
|
||||
use App\Exports\V2\RoadObservation\SupervisorCartableExport;
|
||||
use App\Exports\V2\RoadObservation\PendingComplaintsExport;
|
||||
use App\Exports\V2\RoadObservation\ReportComplaintsExport;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class RoadObservationController extends Controller
|
||||
{
|
||||
@@ -434,7 +435,9 @@ class RoadObservationController extends Controller
|
||||
$files_path = [];
|
||||
$file_index = 0;
|
||||
$file_time = time();
|
||||
$uuid = \Uuid::generate();
|
||||
// $uuid = \Uuid::generate();
|
||||
$uuid = (string) Str::uuid();
|
||||
|
||||
if ($request->file('image-before-1')) {
|
||||
$roadObserved->files()->where('path', 'like', '%_image-before-1_%')->delete();
|
||||
|
||||
|
||||
@@ -50,48 +50,6 @@ class RoadObservationReportController extends Controller
|
||||
|
||||
$data = processDataTable($request, '', $fields, $query);
|
||||
|
||||
// $data = RoadObserved::leftjoin('edarate_shahri', 'road_observeds.edarate_shahri_id', 'edarate_shahri.id')->select('road_observeds.id', 'province_fa', 'city_fa', 'FeatureTypeTitle', 'road_observeds.created_at', 'Title', 'Description', 'MobileForSendEventSms', 'lat', 'lng', 'rms_description', 'road_observeds.updated_at', 'rms_status', 'rms_last_activity_fa', 'rms_description', 'AutoId', 'edarate_shahri.name_fa')
|
||||
// ->whereIn('fk_FeatureType', ['1', '2', '3', '4', '5', '6'])
|
||||
// ->where('rms_status', "<>", 1)
|
||||
// ->get();
|
||||
|
||||
// $all = DB::select(DB::raw(
|
||||
// 'SELECT
|
||||
// "کشوری" as province_fa,
|
||||
// -1 as province_id,
|
||||
// COUNT(*) tedade,
|
||||
// SUM(tedad_mavarede_moshede_shode) as tedad_mavarede_moshede_shode,
|
||||
// SUM(tedad_mavarede_peygiri_shode) as tedad_mavarede_peygiri_shode,
|
||||
// SUM(tedad_faliyat_sabt_shode) as tedad_faliyat_sabt_shode,
|
||||
// ROUND(SUM(distance)) as masafat_tey_shode
|
||||
// FROM (SELECT
|
||||
// province_id,
|
||||
// province_fa,
|
||||
// distance,
|
||||
// (SELECT COUNT(*) FROM `observed_items` oi WHERE rp.`id`= oi.road_patrol_id) AS tedad_mavarede_moshede_shode,
|
||||
// (SELECT COUNT(*) FROM `observed_items` oii WHERE rp.`id`= oii.road_patrol_id AND oii.road_item_id IS NOT NULL AND priority IS NOT NULL) AS tedad_mavarede_peygiri_shode,
|
||||
// (SELECT COUNT(*) FROM `observed_items` oii WHERE rp.`id`= oii.road_patrol_id AND oii.road_item_id IS NOT NULL AND priority IS NULL) AS tedad_faliyat_sabt_shode
|
||||
// FROM `road_patrols` rp where rp.start_time BETWEEN "'.$from_date.'" AND "'.$date_to.'") temp
|
||||
// union
|
||||
// SELECT
|
||||
// province_fa,
|
||||
// province_id,
|
||||
// COUNT(*) tedade,
|
||||
// SUM(tedad_mavarede_moshede_shode) as tedad_mavarede_moshede_shode,
|
||||
// SUM(tedad_mavarede_peygiri_shode) as tedad_mavarede_peygiri_shode,
|
||||
// SUM(tedad_faliyat_sabt_shode) as tedad_faliyat_sabt_shode,
|
||||
// ROUND(SUM(distance)) as masafat_tey_shode
|
||||
// FROM (SELECT
|
||||
// province_id,
|
||||
// province_fa,
|
||||
// distance,
|
||||
// (SELECT COUNT(*) FROM `observed_items` oi WHERE rp.`id`= oi.road_patrol_id) AS tedad_mavarede_moshede_shode,
|
||||
// (SELECT COUNT(*) FROM `observed_items` oii WHERE rp.`id`= oii.road_patrol_id AND oii.road_item_id IS NOT NULL AND priority IS NOT NULL) AS tedad_mavarede_peygiri_shode,
|
||||
// (SELECT COUNT(*) FROM `observed_items` oii WHERE rp.`id`= oii.road_patrol_id AND oii.road_item_id IS NOT NULL AND priority IS NULL) AS tedad_faliyat_sabt_shode
|
||||
// FROM `road_patrols` rp where rp.start_time BETWEEN "'.$from_date.'" AND "'.$date_to.'") temp
|
||||
// GROUP BY province_id
|
||||
// '
|
||||
// ));
|
||||
return response()->json(
|
||||
$data,
|
||||
$data['status'],
|
||||
|
||||
@@ -18,7 +18,7 @@ use App\Models\RoadPatrol;
|
||||
use App\Models\RoadItemsProject;
|
||||
use App\Models\EdarateShahri;
|
||||
use App\Models\InfoItem;
|
||||
|
||||
use App\Services\NominatimService;
|
||||
use App\Exports\V2\RoadPatrol\OperatorCartableExport;
|
||||
use App\Exports\V2\RoadPatrol\SupervisorCartableExport;
|
||||
|
||||
@@ -206,7 +206,7 @@ class RoadPatrolProjectController extends Controller
|
||||
);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
public function store(Request $request, NominatimService $nominatimService)
|
||||
{
|
||||
if (!auth()->user()->hasPermissionTo('add-road-patrol')) {
|
||||
return response()->json([
|
||||
@@ -264,7 +264,7 @@ class RoadPatrolProjectController extends Controller
|
||||
$edare_name = auth()->user()->edarate_shahri_id ? auth()->user()->edarate_shahri_name : auth()->user()->edarate_ostani_name;
|
||||
|
||||
try {
|
||||
$road_patrol = \DB::transaction(function () use ($request, $start_coordinates, $end_coordinates, $edare_id, $edare_name) {
|
||||
$road_patrol = \DB::transaction(function () use ($request, $start_coordinates, $end_coordinates, $edare_id, $edare_name, $nominatimService) {
|
||||
if (!$request->observed_items && !$request->description) {
|
||||
throw ValidationException::withMessages([
|
||||
"description" => __('validation.required', ['attribute' => 'description']),
|
||||
@@ -287,8 +287,8 @@ class RoadPatrolProjectController extends Controller
|
||||
'city_fa' => auth()->user()->city_fa,
|
||||
'edare_id' => $edare_id,
|
||||
'edare_name' => $edare_name,
|
||||
'start_way_id' => get_way_id_from_nominatim($start_coordinates[0], $start_coordinates[1]),
|
||||
'end_way_id' => get_way_id_from_nominatim($end_coordinates[0], $end_coordinates[1]),
|
||||
'start_way_id' => $nominatimService->get_way_id_from_nominatim($start_coordinates[0], $start_coordinates[1]),
|
||||
'end_way_id' => $nominatimService->get_way_id_from_nominatim($end_coordinates[0], $end_coordinates[1]),
|
||||
'status' => 0,
|
||||
'status_fa' => 'در حال بررسی',
|
||||
'distance' => $request->distance,
|
||||
@@ -397,8 +397,8 @@ class RoadPatrolProjectController extends Controller
|
||||
'city_id' => auth()->user()->city_id,
|
||||
'city_fa' => auth()->user()->city_fa,
|
||||
'user_name' => auth()->user()->name,
|
||||
'start_way_id' => get_way_id_from_nominatim($item_start_coordinates[0], $item_start_coordinates[1]),
|
||||
'end_way_id' => $item_end_coordinates ? get_way_id_from_nominatim($item_end_coordinates[0], $item_end_coordinates[1]) : null,
|
||||
'start_way_id' => $nominatimService->get_way_id_from_nominatim($item_start_coordinates[0], $item_start_coordinates[1]),
|
||||
'end_way_id' => $item_end_coordinates ? $nominatimService->get_way_id_from_nominatim($item_end_coordinates[0], $item_end_coordinates[1]) : null,
|
||||
'unit_fa' => $info_item->sub_item_unit,
|
||||
'created_at_fa' => verta(Carbon::now())->format('Y-m-d H:i:s'),
|
||||
'info_id' => $info_item->id,
|
||||
|
||||
@@ -17,6 +17,7 @@ use App\Models\EdarateShahri;
|
||||
use App\Models\Contractor;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Models\SafetyAndPrivacy;
|
||||
use App\Services\NominatimService;
|
||||
use App\Models\InfoItem;
|
||||
|
||||
class SafetyAndPrivacyController extends Controller
|
||||
@@ -84,7 +85,7 @@ class SafetyAndPrivacyController extends Controller
|
||||
return view('version2.dashboard_pages.safety_and_privacy.operation_create');
|
||||
}
|
||||
|
||||
public function operatorFirstStepStore(Request $request)
|
||||
public function operatorFirstStepStore(Request $request, NominatimService $nominatimService)
|
||||
{
|
||||
if (! auth()->user()->hasAnyPermission(['add-safety-and-privacy'])) {
|
||||
abort(403);
|
||||
@@ -118,7 +119,7 @@ class SafetyAndPrivacyController extends Controller
|
||||
$item = InfoItem::where('id', $request->info_id)->where('item', 17)->firstOrFail();
|
||||
|
||||
try {
|
||||
$safety_and_privacy = \DB::transaction(function () use ($request, $coordinates, $item) {
|
||||
$safety_and_privacy = \DB::transaction(function () use ($request, $coordinates, $item, $nominatimService) {
|
||||
$safety_and_privacy = SafetyAndPrivacy::create([
|
||||
'lat' => $coordinates[0],
|
||||
'lon' => $coordinates[1],
|
||||
@@ -133,7 +134,7 @@ class SafetyAndPrivacyController extends Controller
|
||||
'activity_date_time' => $request->activity_date." ".$request->activity_time,
|
||||
'edare_shahri_id' => auth()->user()->edarate_shahri_id,
|
||||
'edare_shahri_name' => auth()->user()->edarate_shahri_name,
|
||||
'way_id' => get_way_id_from_nominatim($coordinates[0], $coordinates[1]),
|
||||
'way_id' => $nominatimService->get_way_id_from_nominatim(),
|
||||
]);
|
||||
|
||||
if ($request->has('recognize_picture')) {
|
||||
|
||||
Reference in New Issue
Block a user