Initial comming of full program to main branch
This commit is contained in:
+163
@@ -0,0 +1,163 @@
|
||||
|
||||
// =================
|
||||
// Edit RDI
|
||||
// =================
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// -----------
|
||||
// Input Masks
|
||||
// -----------
|
||||
|
||||
$(".phone-mask").inputmask("(999) 999-9999", {showMaskOnHover: false});
|
||||
$(".zip-mask").inputmask("9{5}", {showMaskOnHover: false, removeMaskOnSubmit: true});
|
||||
|
||||
$(".date-mask").inputmask({alias: "datetime",
|
||||
inputFormat: "mm/dd/yyyy",
|
||||
placeholder: "MM/DD/YYYY",
|
||||
showMaskOnHover: false});
|
||||
|
||||
// --------------
|
||||
// Select Picker.
|
||||
// --------------
|
||||
|
||||
$(".search-dropdown").selectpicker({noneSelectedText: "",
|
||||
style: "",
|
||||
styleBase: "form-select form-select-sm",
|
||||
iconBase: "bi",
|
||||
virtualScroll: true,
|
||||
size: 10,
|
||||
selectOnTab: true,
|
||||
containter: "body",
|
||||
liveSearch: true});
|
||||
|
||||
// ------------
|
||||
// Date Pickers
|
||||
// ------------
|
||||
|
||||
$("#rdi_entry_date").datepicker({format: "mm-dd-yyyy",
|
||||
container: "div.rdi_entry_date",
|
||||
keyboardNavigation: false,
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
endDate: "0d",
|
||||
orientation: "left bottom",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true});
|
||||
|
||||
$("#rdi_permit_date").datepicker({format: "mm-dd-yyyy",
|
||||
container: "div.rdi_permit_date",
|
||||
keyboardNavigation: false,
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
endDate: "0d",
|
||||
orientation: "left bottom",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true});
|
||||
|
||||
// ---------------------
|
||||
// Show Calendar Buttons
|
||||
// ---------------------
|
||||
|
||||
$(".btnEntryDateCalendar").on("click", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$("#rdi_entry_date").focus().datepicker("show");
|
||||
|
||||
});
|
||||
|
||||
$(".btnPermitDateCalendar").on("click", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$("#rdi_permit_date").focus().datepicker("show");
|
||||
|
||||
});
|
||||
|
||||
// -----------
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$("#editRDI").submit();
|
||||
|
||||
});
|
||||
|
||||
// --------------
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editRDI || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// -------------
|
||||
// Delete Button
|
||||
// -------------
|
||||
|
||||
$(".btnDelete").on("click", function () {
|
||||
|
||||
$("#confirm-dialog").removeClass().addClass("modal confirm-delete-rdi")
|
||||
.find(".modal-title").html("Confirm Delete RDI").end()
|
||||
.find(".modal-body").html("Are you sure you wish to delete this RDI?").end()
|
||||
.modal("show");
|
||||
|
||||
});
|
||||
|
||||
$("body").on("click", ".confirm-delete-rdi .btnConfirmDialogConfirm", function () {
|
||||
|
||||
$.post("./", {action: "RDI.deleteRDI", rdi_serial: $sessionStorage.rdi_serial})
|
||||
.done(function () {
|
||||
formSubmit({action: $sessionStorage.deleteRDI});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#editRDI").submit(function (e) {
|
||||
|
||||
var rdi_entry_date = $("#rdi_entry_date"), rdi_county = $("#rdi_county");
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
|
||||
if (isBlank(rdi_entry_date)) {
|
||||
createInputError(rdi_entry_date, "Entry Date is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($("option:selected", rdi_county).val() === "") {
|
||||
createInputError(rdi_county, "County is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editRDI || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user