mirror of
https://github.com/hargata/lubelog.git
synced 2025-12-10 17:20:15 -06:00
added JS to retrieve and validate extra fields.
This commit is contained in:
parent
7e70f5108f
commit
bae1839c06
@ -13,5 +13,6 @@
|
||||
public PlanPriority Priority { get; set; }
|
||||
public PlanProgress Progress { get; set; }
|
||||
public decimal Cost { get; set; }
|
||||
public List<ExtraField> ExtraFields { get; set; } = new List<ExtraField>();
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
public PlanPriority Priority { get; set; }
|
||||
public PlanProgress Progress { get; set; }
|
||||
public decimal Cost { get; set; }
|
||||
public List<ExtraField> ExtraFields { get; set; } = new List<ExtraField>();
|
||||
public PlanRecord ToPlanRecord() { return new PlanRecord {
|
||||
Id = Id,
|
||||
VehicleId = VehicleId,
|
||||
@ -25,7 +26,8 @@
|
||||
ImportMode = ImportMode,
|
||||
Cost = Cost,
|
||||
Priority = Priority,
|
||||
Progress = Progress
|
||||
Progress = Progress,
|
||||
ExtraFields = ExtraFields
|
||||
}; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -387,3 +387,20 @@ function showBulkImportModal(mode) {
|
||||
function hideBulkImportModal() {
|
||||
$("#bulkImportModal").modal('hide');
|
||||
}
|
||||
function getAndValidateExtraFields() {
|
||||
var hasError = false;
|
||||
var outputData = [];
|
||||
$(".extra-field").map((index, elem) => {
|
||||
var extraFieldName = $(elem).children("label").text();
|
||||
var extraFieldInput = $(elem).children("input");
|
||||
var extraFieldValue = extraFieldInput.val();
|
||||
if (extraFieldInput.hasClass('extra-field-required') && extraFieldValue.trim() == '') {
|
||||
hasError = true;
|
||||
extraFieldInput.addClass("is-invalid");
|
||||
} else {
|
||||
extraFieldInput.removeClass("is-invalid");
|
||||
}
|
||||
outputData.push({ name: extraFieldName, value: extraFieldValue });
|
||||
});
|
||||
return { hasError: hasError, extraFields: outputData };
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user