2026-02-14 07:57:18 -05:00
|
|
|
|
2026-04-04 19:14:39 -04:00
|
|
|
// ===========
|
|
|
|
|
// Edit Permit
|
|
|
|
|
// ===========
|
2026-02-14 07:57:18 -05:00
|
|
|
|
|
|
|
|
$(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
|
|
|
|
|
// ------------
|
|
|
|
|
|
2026-04-04 19:14:39 -04:00
|
|
|
$("#permit_entry_date").datepicker({format: "mm-dd-yyyy",
|
|
|
|
|
container: "div.permit_entry_date",
|
2026-02-14 07:57:18 -05:00
|
|
|
keyboardNavigation: false,
|
|
|
|
|
showOnFocus: false,
|
|
|
|
|
autoclose: true,
|
|
|
|
|
endDate: "0d",
|
|
|
|
|
orientation: "left bottom",
|
|
|
|
|
todayBtn: "linked",
|
|
|
|
|
todayHighlight: true});
|
|
|
|
|
|
2026-04-04 19:14:39 -04:00
|
|
|
$("#permit_permit_date").datepicker({format: "mm-dd-yyyy",
|
|
|
|
|
container: "div.permit_permit_date",
|
2026-02-14 07:57:18 -05:00
|
|
|
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();
|
|
|
|
|
|
2026-04-04 19:14:39 -04:00
|
|
|
$("#permit_entry_date").focus().datepicker("show");
|
2026-02-14 07:57:18 -05:00
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$(".btnPermitDateCalendar").on("click", function (e) {
|
|
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
2026-04-04 19:14:39 -04:00
|
|
|
$("#permit_permit_date").focus().datepicker("show");
|
2026-02-14 07:57:18 -05:00
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// -----------
|
|
|
|
|
// Save Button
|
|
|
|
|
// -----------
|
|
|
|
|
|
|
|
|
|
$(".btnSave").on("click", function (e) {
|
|
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
2026-04-04 19:14:39 -04:00
|
|
|
$("#editPermit").submit();
|
2026-02-14 07:57:18 -05:00
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// --------------
|
|
|
|
|
// Cancel Button.
|
|
|
|
|
// --------------
|
|
|
|
|
|
|
|
|
|
$(".btnCancel").on("click", function () {
|
|
|
|
|
|
2026-04-04 19:14:39 -04:00
|
|
|
$sessionStorage.action = $sessionStorage.editPermit || "";
|
2026-02-14 07:57:18 -05:00
|
|
|
|
|
|
|
|
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
|
|
|
|
|
|
|
|
|
formSubmit($sessionStorage);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// -------------
|
|
|
|
|
// Delete Button
|
|
|
|
|
// -------------
|
|
|
|
|
|
|
|
|
|
$(".btnDelete").on("click", function () {
|
|
|
|
|
|
2026-04-04 19:14:39 -04:00
|
|
|
$("#confirm-dialog").removeClass().addClass("modal confirm-delete-permit")
|
|
|
|
|
.find(".modal-title").html("Confirm Delete Permit").end()
|
|
|
|
|
.find(".modal-body").html("Are you sure you wish to delete this Permit?").end()
|
2026-02-14 07:57:18 -05:00
|
|
|
.modal("show");
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
2026-04-04 19:14:39 -04:00
|
|
|
$("body").on("click", ".confirm-delete-permit .btnConfirmDialogConfirm", function () {
|
2026-02-14 07:57:18 -05:00
|
|
|
|
2026-04-04 19:14:39 -04:00
|
|
|
$.post("./", {action: "Permits.deletePermit", permit_serial: $sessionStorage.permit_serial})
|
2026-02-14 07:57:18 -05:00
|
|
|
.done(function () {
|
2026-04-04 19:14:39 -04:00
|
|
|
formSubmit({action: $sessionStorage.deletePermit});
|
2026-02-14 07:57:18 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// ---------------
|
|
|
|
|
// Validate Inputs
|
|
|
|
|
// ---------------
|
|
|
|
|
|
2026-04-04 19:14:39 -04:00
|
|
|
$("#editPermit").submit(function (e) {
|
2026-02-14 07:57:18 -05:00
|
|
|
|
2026-04-04 19:14:39 -04:00
|
|
|
var permit_entry_date = $("#permit_entry_date"), permit_county = $("#permit_county");
|
2026-02-14 07:57:18 -05:00
|
|
|
|
|
|
|
|
clearInputErrors();
|
|
|
|
|
|
|
|
|
|
|
2026-04-04 19:14:39 -04:00
|
|
|
if (isBlank(permit_entry_date)) {
|
|
|
|
|
createInputError(permit_entry_date, "Entry Date is required");
|
2026-02-14 07:57:18 -05:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-04 19:14:39 -04:00
|
|
|
if ($("option:selected", permit_county).val() === "") {
|
|
|
|
|
createInputError(permit_county, "County is required");
|
2026-02-14 07:57:18 -05:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$.post("./", $(this).serialize())
|
|
|
|
|
|
|
|
|
|
.done(function () {
|
|
|
|
|
|
2026-04-04 19:14:39 -04:00
|
|
|
$sessionStorage.action = $sessionStorage.editPermit || "";
|
2026-02-14 07:57:18 -05:00
|
|
|
|
|
|
|
|
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
|
|
|
|
|
|
|
|
|
formSubmit($sessionStorage);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|