change verta function and uuid generation mechanism

This commit is contained in:
2024-02-20 07:18:17 +00:00
parent 1074a2dc79
commit c8538855ae
11 changed files with 31 additions and 30 deletions

View File

@@ -20,6 +20,8 @@ use SoapClient;
use Illuminate\Support\Facades\Auth;
use Carbon\Carbon;
use App\Facades\Sms\Sms;
use App\Services\NominatimService;
use Illuminate\Support\Str;
class ContractSubItemsController extends Controller
{
@@ -101,7 +103,7 @@ class ContractSubItemsController extends Controller
]);
}
public function storeForDevelop(Request $request)
public function storeForDevelop(Request $request, NominatimService $nominatimService)
{
if ($request->has('operation_type_id1') && $request->operation_type_progress1 == null) {
@@ -137,9 +139,9 @@ class ContractSubItemsController extends Controller
$contract = Contracts::where('id', $request->contract_id)->first();
$parent_contract_date = explode('-', $contract->contract_date);
$parent_contract_date = Verta::getGregorian($parent_contract_date[0], $parent_contract_date[1], $parent_contract_date[2]);
// dd(Verta::jalaliToGregorian($parent_contract_date[0], $parent_contract_date[1], $parent_contract_date[2]));
$parent_contract_date = Verta::jalaliToGregorian($parent_contract_date[0], $parent_contract_date[1], $parent_contract_date[2]);
$city_fa = City::where('id', $request->city_id)->first();
$province_fa = Province::where('id', $request->province_id)->first();
@@ -204,8 +206,8 @@ class ContractSubItemsController extends Controller
$contractSubItem->contract_date_from_parent_contract = $parent_contract_date[0].'-'.$parent_contract_date[1].'-'.$parent_contract_date[2];
$contractSubItem->created_at_fa = Verta::instance(Verta::now());
$contractSubItem->updated_at_fa = Verta::instance(Verta::now());
$contractSubItem->start_way_id = self::get_way_id_from_nominatim($request->start_lat, $request->start_lng);
$contractSubItem->end_way_id = self::get_way_id_from_nominatim($request->end_lat, $request->end_lng);
$contractSubItem->start_way_id = $nominatimService->get_way_id_from_nominatim($request->start_lat, $request->start_lng);
$contractSubItem->end_way_id = $nominatimService->get_way_id_from_nominatim($request->end_lat, $request->end_lng);
$contractSubItem->user_id = Auth::user()->id;
$contractSubItem->contract_moshaver_tarahi = $contract->contract_moshaver_tarahi;
$contractSubItem->contract_moshaver_nezarat = $contract->contract_moshaver_nezarat;
@@ -238,7 +240,7 @@ class ContractSubItemsController extends Controller
$countRoadFiles = count($roadProjectHistoriesFiles);
}
$uuid = \Uuid::generate();
$uuid = Str::uuid();
if ($request->has('image1')) {
$file1 = $request->file('image1');
$destinationPath1 = 'storage/contract_subitems/' . now()->year . '/' . now()->month . '/';
@@ -296,7 +298,7 @@ class ContractSubItemsController extends Controller
}
}
public function updateForDevelop(Request $request, $id)
public function updateForDevelop(Request $request, $id, NominatimService $nominatimService)
{
if ($request->operation_type_id1 != 0 && $request->operation_type_progress1 == null) {
return response()->json(['message' => 'Operation type progress1 is NULL'], 400);
@@ -462,8 +464,8 @@ class ContractSubItemsController extends Controller
$contractSubItem->last_function_operator = $request->last_function_operator;
$contractSubItem->last_payable_operator = $request->last_payable_operator;
$contractSubItem->complete_payable = $request->complete_payable;
$contractSubItem->start_way_id = self::get_way_id_from_nominatim($request->start_lat, $request->start_lng);
$contractSubItem->end_way_id = self::get_way_id_from_nominatim($request->end_lat, $request->end_lng);
$contractSubItem->start_way_id = $nominatimService->get_way_id_from_nominatim($request->start_lat, $request->start_lng);
$contractSubItem->end_way_id = $nominatimService->get_way_id_from_nominatim($request->end_lat, $request->end_lng);
$contractSubItem->updated_at_fa = Verta::instance(Verta::now());
$contractSubItem->user_id = Auth::user()->id;
$contractSubItem->last_date_update = Carbon::now();
@@ -474,7 +476,7 @@ class ContractSubItemsController extends Controller
$contractSubItem->save();
$uuid = \Uuid::generate();
$uuid = Str::uuid();
if ($request->has('image1')) {
$file1 = $request->file('image1');
$destinationPath1 = 'storage/contract_subitems/' . now()->year . '/' . now()->month . '/';

View File

@@ -436,11 +436,10 @@ class ContractsController extends Controller
$contract->save();
// document end
// for updating sub contract contract date
foreach ($contract->subitems as $key => $value) {
$tmp = explode('-', $request->contract_date);
$tmp = Verta::getGregorian($tmp[0], $tmp[1], $tmp[2]);
$tmp = Verta::jalaliToGregorian($tmp[0], $tmp[1], $tmp[2]);
$value->contract_date_from_parent_contract = $tmp[0].'-'.$tmp[1].'-'.$tmp[2];
$value->save();
}

View File

@@ -105,7 +105,7 @@ $(document).ready(function () {
},
});
$.getScript('/version2/js/dashboard_pages/road_patrols/test.js');
$.getScript('/version2/js/dashboard_pages/road_patrols/sub_table.js');
$.ajax({
url: "/webapi/user/get-permission",

View File

@@ -42,7 +42,7 @@ $("#gozarehtowntable").on("click", "td.AcitivityMount", async function(e) {
objectfiltertable = []
$.ajax({
url: "https://rms.rmto.ir/public/contents/edarate_shahri_by_province/" + provinceid,
url: "/public/contents/edarate_shahri_by_province/" + provinceid,
async: false,
success: function(result) {
for (var i = 0; i < result.data.length; i++) {
@@ -57,7 +57,7 @@ $("#gozarehtowntable").on("click", "td.AcitivityMount", async function(e) {
// second ajax
$.ajax({
url: "https://rms.rmto.ir/v2/road_patrols/report/total-group-province-city?province_id=" + provinceid +
url: "/v2/road_patrols/report/total-group-province-city?province_id=" + provinceid +
"&from_date=" +
date_from +
"&date_to=" +

View File

@@ -356,21 +356,21 @@ Route::get('/user-activity-report/print/user/{user}', 'UserController@printGroup
// // dayli accident begin
// Route::get('/daily_accident', 'View\DailyAccidentController@index');
// Route::get('/daily_accident', 'View\DailyAccidentController@index');
Route::get('/daily_accident/show', 'DailyAccidentController@show');
Route::post('/daily_accident/store', 'DailyAccidentController@store');
// Route::post('/daily_accident/update/{accident}', 'DailyAccidentController@update');
// Route::post('/daily_accident/delete/{accident}', 'DailyAccidentController@delete');
Route::post('/daily_accident/update/{accident}', 'DailyAccidentController@update');
Route::post('/daily_accident/delete/{accident}', 'DailyAccidentController@delete');
// Route::get('/daily_accident/get_pending_accidents_count', 'DailyAccidentController@getPendingAccidentsCount');
Route::get('/daily_accident/accident_reasons', 'DailyAccidentController@getAccidentReasons');
Route::get('/daily_accident/accident_increase_damage_reasons', 'DailyAccidentController@getAccidentIncreaseDamageReasons');
Route::get('/daily_accident/get_participants', 'DailyAccidentController@getParticipants');
Route::get('/daily_accident/accident_types', 'DailyAccidentController@getAccidentTypes');
Route::get('/daily_accident/accident_types', 'DailyAccidentController@getAccidentTypes');
Route::get('/daily_accident/get_accident_collision_type', 'DailyAccidentController@getAccidentCollisionType');
// Route::get('/daily_accident/{accident}', 'DailyAccidentController@details');
// Route::post('/daily_accident/set_state/{accident}', 'DailyAccidentController@setState');
Route::get('/daily_accident/{accident}', 'DailyAccidentController@details');
Route::post('/daily_accident/set_state/{accident}', 'DailyAccidentController@setState');
Route::get('/daily_accident_poster', 'DailyAccidentController@poster');
// Route::get('/daily_accident_poster_information', 'DailyAccidentController@getPosterInformation');
@@ -902,23 +902,23 @@ Route::get('/reports/safety-and-privacy', 'Api\Excel\ReportController@downloadSa
Route::middleware('cors:api')->post('contracts/eblagh', 'ContractsController@get_eblagh_meli');
// Route::middleware('cors:api')->post('contracts/setad', 'ContractsController@get_mojavez_setad');
// Route::middleware('cors:api')->get('contracts/show/{id}', 'ContractsController@show');
// Route::middleware('cors:api')->post('contracts/delete', 'ContractsController@delete');
Route::middleware('cors:api')->get('contracts/show/{id}', 'ContractsController@show');
Route::middleware('cors:api')->post('contracts/delete', 'ContractsController@delete');
Route::middleware('cors:api')->get('contracts/document', 'ContractsController@document');
// Route::middleware('cors:api')->get('contracts/index-dev', 'ContractsController@indexForDevelop');
Route::get('contracts/index', 'ContractsController@index');
// Route::middleware('cors:api')->post('contracts/store-dev', 'ContractsController@storeForDevelop');
// Route::middleware('cors:api')->post('contracts/update-dev/{id}', 'ContractsController@updateForDevelop');
// Route::middleware('cors:api')->get('csi/operation/{id}', 'Api\ContractSubItemsController@getOperationType');
Route::middleware('cors:api')->post('contracts/update-dev/{id}', 'ContractsController@updateForDevelop');
Route::middleware('cors:api')->get('csi/operation/{id}', 'Api\ContractSubItemsController@getOperationType');
Route::middleware('cors:api')->get('csi/operation', 'Api\ContractSubItemsController@getAllOperationList');
// Route::middleware('cors:api')->post('csi/delete', 'Api\ContractSubItemsController@delete');
// Route::middleware('cors:api')->get('csi/history/{id}', 'Api\ContractSubItemsController@showHistory');
Route::middleware('cors:api')->post('csi/delete', 'Api\ContractSubItemsController@delete');
Route::middleware('cors:api')->get('csi/history/{id}', 'Api\ContractSubItemsController@showHistory');
// Route::middleware('cors:api')->post('csi/store-dev', 'Api\ContractSubItemsController@storeForDevelop');
// Route::middleware('cors:api')->post('csi/update-dev/{id}', 'Api\ContractSubItemsController@updateForDevelop');
Route::middleware('cors:api')->post('csi/store-dev', 'Api\ContractSubItemsController@storeForDevelop');
Route::middleware('cors:api')->post('csi/update-dev/{id}', 'Api\ContractSubItemsController@updateForDevelop');
// // finance end
@@ -1364,7 +1364,7 @@ Route::middleware('web', 'auth', 'confirmUser')->group(function () {
// // return $user->getPermissionsViaRoles()->count();
// });
// Route::get('get_all_accident_for_data_mining', 'DailyAccidentController@getAllAccidentForDataMining');
Route::get('get_all_accident_for_data_mining', 'DailyAccidentController@getAllAccidentForDataMining');