added engine hours variable.

This commit is contained in:
DESKTOP-GENO133\IvanPlex 2024-01-27 21:14:29 -07:00
parent 5c2835ab76
commit 43fd40347f
3 changed files with 8 additions and 1 deletions

View File

@ -9,5 +9,6 @@
public string Model { get; set; } public string Model { get; set; }
public string LicensePlate { get; set; } public string LicensePlate { get; set; }
public bool IsElectric { get; set; } = false; public bool IsElectric { get; set; } = false;
public bool UseHours { get; set; } = false;
} }
} }

View File

@ -33,6 +33,10 @@
<input class="form-check-input" type="checkbox" role="switch" id="inputIsElectric" checked="@Model.IsElectric"> <input class="form-check-input" type="checkbox" role="switch" id="inputIsElectric" checked="@Model.IsElectric">
<label class="form-check-label" for="inputIsElectric">Electric Vehicle</label> <label class="form-check-label" for="inputIsElectric">Electric Vehicle</label>
</div> </div>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="inputUseHours" checked="@Model.UseHours">
<label class="form-check-label" for="inputUseHours">Use Engine Hours</label>
</div>
@if (!string.IsNullOrWhiteSpace(Model.ImageLocation)) @if (!string.IsNullOrWhiteSpace(Model.ImageLocation))
{ {
<label for="inputImage">Replace picture(optional)</label> <label for="inputImage">Replace picture(optional)</label>

View File

@ -38,6 +38,7 @@ function saveVehicle(isEdit) {
var vehicleModel = $("#inputModel").val(); var vehicleModel = $("#inputModel").val();
var vehicleLicensePlate = $("#inputLicensePlate").val(); var vehicleLicensePlate = $("#inputLicensePlate").val();
var vehicleIsElectric = $("#inputIsElectric").is(":checked"); var vehicleIsElectric = $("#inputIsElectric").is(":checked");
var vehicleUseHours = $("#inputUseHours").is(":checked");
//validate //validate
var hasError = false; var hasError = false;
if (vehicleYear.trim() == '' || parseInt(vehicleYear) < 1900) { if (vehicleYear.trim() == '' || parseInt(vehicleYear) < 1900) {
@ -74,7 +75,8 @@ function saveVehicle(isEdit) {
make: vehicleMake, make: vehicleMake,
model: vehicleModel, model: vehicleModel,
licensePlate: vehicleLicensePlate, licensePlate: vehicleLicensePlate,
isElectric: vehicleIsElectric isElectric: vehicleIsElectric,
useHours: vehicleUseHours
}, function (data) { }, function (data) {
if (data) { if (data) {
if (!isEdit) { if (!isEdit) {