mirror of
https://github.com/hargata/lubelog.git
synced 2025-12-10 00:46:08 -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 PlanPriority Priority { get; set; }
|
||||||
public PlanProgress Progress { get; set; }
|
public PlanProgress Progress { get; set; }
|
||||||
public decimal Cost { 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 PlanPriority Priority { get; set; }
|
||||||
public PlanProgress Progress { get; set; }
|
public PlanProgress Progress { get; set; }
|
||||||
public decimal Cost { get; set; }
|
public decimal Cost { get; set; }
|
||||||
|
public List<ExtraField> ExtraFields { get; set; } = new List<ExtraField>();
|
||||||
public PlanRecord ToPlanRecord() { return new PlanRecord {
|
public PlanRecord ToPlanRecord() { return new PlanRecord {
|
||||||
Id = Id,
|
Id = Id,
|
||||||
VehicleId = VehicleId,
|
VehicleId = VehicleId,
|
||||||
@ -25,7 +26,8 @@
|
|||||||
ImportMode = ImportMode,
|
ImportMode = ImportMode,
|
||||||
Cost = Cost,
|
Cost = Cost,
|
||||||
Priority = Priority,
|
Priority = Priority,
|
||||||
Progress = Progress
|
Progress = Progress,
|
||||||
|
ExtraFields = ExtraFields
|
||||||
}; }
|
}; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -386,4 +386,21 @@ function showBulkImportModal(mode) {
|
|||||||
}
|
}
|
||||||
function hideBulkImportModal() {
|
function hideBulkImportModal() {
|
||||||
$("#bulkImportModal").modal('hide');
|
$("#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