vehicle category

This commit is contained in:
pringgosutono
2026-06-12 15:33:51 +09:00
parent e3d92dfbd7
commit f69060c472
2 changed files with 33 additions and 6 deletions

View File

@ -170,6 +170,7 @@ class VehiclesController extends Controller
"vehicle_name" => $req->vhc_name,
"brand_id" => $req->brand_id,
"type_id" => $req->type_id,
"cat_id" => $req->cat_id,
"model_id" => $req->model_id,
"speed_limit" => $req->speed_limit,
"fuel_capacity" => $req->fuel_capacity,
@ -204,6 +205,7 @@ class VehiclesController extends Controller
"vehicle_name" => "required|string",
"brand_id" => "required|integer",
"type_id" => "required|integer",
"cat_id" => "required|in:car,motorcycle",
"model_id" => "nullable|integer",
"speed_limit" => "required|numeric",
// "fuel_capacity" => "required|numeric",
@ -274,9 +276,9 @@ class VehiclesController extends Controller
"dvc_id" => $req->dvc_id ?? 0,
"device_id" => $device_id,
"simcard" => $req->simcard ?? 0,
"cat_id" => Vehicles::DEFAULT_CAT_ID,
"brand_id" => $req->brand_id,
"type_id" => $req->type_id,
"cat_id" => $req->cat_id,
"nopol1" => strtoupper($req->nopol1),
// "nopol2" => strtoupper($req->nopol2),
// "nopol3" => strtoupper($req->nopol3),
@ -408,6 +410,7 @@ class VehiclesController extends Controller
"vehicle_name" => $req->vhc_name,
"brand_id" => $req->brand_id,
"type_id" => $req->type_id,
"cat_id" => $req->cat_id,
"model_id" => $req->model_id,
"speed_limit" => $req->speed_limit,
"sum_milleage" => $req->mileage,
@ -444,6 +447,7 @@ class VehiclesController extends Controller
"vehicle_name" => "required|string",
"brand_id" => "required|integer",
"type_id" => "required|integer",
"cat_id" => "required|integer",
"model_id" => "nullable|integer",
"speed_limit" => "required|numeric",
"sum_milleage" => "required|numeric",
@ -550,9 +554,9 @@ class VehiclesController extends Controller
"dvc_id" => $req->dvc_id,
"device_id" => $device_id,
"simcard" => (int) $req->simcard,
"cat_id" => Vehicles::DEFAULT_CAT_ID,
"brand_id" => $req->brand_id,
"type_id" => $req->type_id,
"cat_id" => $req->cat_id,
"nopol1" => strtoupper($req->nopol1),
"nopol2" => strtoupper($req->nopol2),
"nopol3" => strtoupper($req->nopol3),

View File

@ -127,6 +127,13 @@
@endforeach
</select>
</div> --}}
<div class="mb-0">
<label for="add-cat_id" class="col-form-label">Vehicle Category:</label>
<select id="add-cat_id" class="form-control" style="width:100%;">
<option value="2" selected>Car</option>
<option value="3">Motorcycle</option>
</select>
</div>
<div class="mb-0">
<label for="add-vhcname" class="col-form-label">Vehicle Name:</label>
<input type="text" id="add-vhcname" class="form-control" placeholder="">
@ -396,6 +403,13 @@
@endforeach
</select>
</div>
<div class="mb-0">
<label for="edt-cat_id" class="col-form-label">Vehicle Category:</label>
<select id="edt-cat_id" class="form-control" style="width:100%;">
<option value="2">Car</option>
<option value="3">Motorcycle</option>
</select>
</div>
<div class="mb-0">
<label for="edt-vhcname" class="col-form-label">Vehicle Name:</label>
<input type="text" id="edt-vhcname" class="form-control" placeholder="">
@ -708,6 +722,9 @@
$('#add-type').select2({
dropdownParent: $('#mdlNewVhc'),
});
$('#add-cat_id').select2({
dropdownParent: $('#mdlNewVhc'),
});
$('#add-model').select2({
dropdownParent: $('#mdlNewVhc'),
});
@ -730,6 +747,9 @@
$('#edt-type').select2({
dropdownParent: $('#mdlEdtVhc'),
});
$('#edt-cat_id').select2({
dropdownParent: $('#mdlEdtVhc'),
});
$('#edt-model').select2({
dropdownParent: $('#mdlEdtVhc'),
});
@ -995,6 +1015,7 @@
data.append('brand_id', safeVal('#add-brand'));
data.append('type_id', safeVal('#add-type'));
data.append('cat_id', safeVal('#add-cat_id'));
data.append('model_id', safeVal('#add-model') ?? 0);
data.append('speed_limit', safeVal('#add-speedlimit'));
data.append('mileage', safeVal('#add-mileage'));
@ -1214,6 +1235,7 @@
// $('#edt-simcard').val(data?.simcard);
$('#edt-brand').val(data?.brand_id).trigger('change');
$('#edt-type').val(data?.type_id).trigger('change');
$('#edt-cat_id').val(data?.cat_id).trigger('change');
$('#edt-model').val(data?.model_id).trigger('change');
$('#edt-speedlimit').val(data?.speed_limit);
@ -1273,6 +1295,7 @@
data.simcard = selected_device.attr('simcard');
data.brand_id = $('#edt-brand').val();
data.type_id = $('#edt-type').val();
data.cat_id = $('#edt-cat_id').val();
data.model_id = $('#edt-model').val();
data.speed_limit = $('#edt-speedlimit').val();