This commit is contained in:
meusinfirmary
2025-06-26 15:35:39 +07:00
parent 31862924d7
commit 42b0f99c25

View File

@ -37,6 +37,7 @@ class VehiclesController extends Controller
$filter["company"] = $req->cptid; $filter["company"] = $req->cptid;
} }
$list = Vehicles::listVehicles($req->auth, $filter); $list = Vehicles::listVehicles($req->auth, $filter);
foreach ($list as $key => $row) { foreach ($list as $key => $row) {
$list[$key]->DT_RowIndex = $key + 1; $list[$key]->DT_RowIndex = $key + 1;
// $list[$key]->mileage_km = '-'; // $list[$key]->mileage_km = '-';
@ -240,8 +241,10 @@ class VehiclesController extends Controller
"is_track_holiday" => Vehicles::DEFAULT_TRACK_HOLIDAY, "is_track_holiday" => Vehicles::DEFAULT_TRACK_HOLIDAY,
"track_sch_d" => Vehicles::DEFAULT_TRACK_SCH_D, "track_sch_d" => Vehicles::DEFAULT_TRACK_SCH_D,
"track_sch_h" => Vehicles::DEFAULT_TRACK_SCH_H, "track_sch_h" => Vehicles::DEFAULT_TRACK_SCH_H,
"client_group_id" => $req->auth->client_group_id ?? null, // "client_group_id" => $req->auth->client_group_id ?? 1,
"vendor_id" => $req->auth->client_group_id ?? 1, // "vendor_id" => $req->auth->client_group_id ?? 1,
"client_group_id" => 1,
"vendor_id" => 1,
"crt" => $now, "crt" => $now,
"crt_by" => $req->auth->uid, "crt_by" => $req->auth->uid,
"updt" => $now, "updt" => $now,
@ -252,10 +255,12 @@ class VehiclesController extends Controller
$insVhc["model_id"] = $req->model_id; $insVhc["model_id"] = $req->model_id;
} }
if ($req->auth->role == Users::ROLE_VENDOR) { if ($req->auth->role == Users::ROLE_VENDOR) {
$insVhc["vendor_id"] = $req->auth->uid; // $insVhc["vendor_id"] = $req->auth->uid;
$insVhc["vendor_id"] = 1;
$insVhc["simcard"] = 0; $insVhc["simcard"] = 0;
} else { } else {
$insVhc["vendor_id"] = $req->vendor_id ?? 1; // $insVhc["vendor_id"] = $req->vendor_id ?? 1;
$insVhc["vendor_id"] = 1;
} }
$vid = Vehicles::addVehicle($insVhc); $vid = Vehicles::addVehicle($insVhc);