Initial comming of full program to main branch
This commit is contained in:
@@ -0,0 +1,778 @@
|
||||
|
||||
// =============================
|
||||
// Search Permits By Subdivision
|
||||
// =============================
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
console.log($sessionStorage);
|
||||
|
||||
// =================
|
||||
// Process Enter Key
|
||||
// =================
|
||||
|
||||
$(document).on('keypress', function (e) {
|
||||
if (e.which === 13) {
|
||||
e.preventDefault();
|
||||
$("#searchPermitsBySubdivision").submit();
|
||||
}
|
||||
});
|
||||
|
||||
// --------------------
|
||||
// Initialize Dropdowns
|
||||
// --------------------
|
||||
|
||||
$("#rdis_per_page").val($sessionStorage.rdis_per_page || "20");
|
||||
|
||||
// -----------
|
||||
// Input Masks
|
||||
// -----------
|
||||
|
||||
$(".date-mask").inputmask({alias: "datetime",
|
||||
inputFormat: "mm/dd/yyyy",
|
||||
placeholder: "MM/DD/YYYY",
|
||||
showMaskOnHover: false});
|
||||
|
||||
// Select Pickers
|
||||
|
||||
$(".multiple-dropdown").selectpicker({noneSelectedText: "Choose...",
|
||||
style: "",
|
||||
styleBase: "form-select form-select-sm",
|
||||
iconBase: "fa",
|
||||
actionsBox: true,
|
||||
selectedTextFormat: "count",
|
||||
virtualScroll: true,
|
||||
size: 10,
|
||||
selectOnTab: true,
|
||||
containter: "body",
|
||||
liveSearch: true});
|
||||
|
||||
// ------------
|
||||
// Date Pickers
|
||||
// ------------
|
||||
|
||||
$("#rdi_entry_start_date").datepicker({format: "mm-dd-yyyy",
|
||||
container: "div.rdi_entry_start_date",
|
||||
keyboardNavigation: false,
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
orientation: "left bottom",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true});
|
||||
|
||||
$("#rdi_entry_end_date").datepicker({format: "mm-dd-yyyy",
|
||||
container: "div.rdi_entry_end_date",
|
||||
keyboardNavigation: false,
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
orientation: "left bottom",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true});
|
||||
|
||||
$("#rdi_permit_start_date").datepicker({format: "mm-dd-yyyy",
|
||||
container: "div.rdi_permit_start_date",
|
||||
keyboardNavigation: false,
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
orientation: "left bottom",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true});
|
||||
|
||||
$("#rdi_permit_end_date").datepicker({format: "mm-dd-yyyy",
|
||||
container: "div.rdi_permit_end_date",
|
||||
keyboardNavigation: false,
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
orientation: "left bottom",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true});
|
||||
|
||||
// ---------------------
|
||||
// Show Calendar Buttons
|
||||
// ---------------------
|
||||
|
||||
$(".btnEntryStartDateCalendar").on("click", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$("#rdi_entry_start_date").focus().datepicker("show");
|
||||
|
||||
});
|
||||
|
||||
$(".btnEntryEndDateCalendar").on("click", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$("#rdi_entry_end_date").focus().datepicker("show");
|
||||
|
||||
});
|
||||
|
||||
$(".btnPermitStartDateCalendar").on("click", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$("#rdi_permit_start_date").focus().datepicker("show");
|
||||
|
||||
});
|
||||
|
||||
$(".btnPermitEndDateCalendar").on("click", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$("#rdi_permit_end_date").focus().datepicker("show");
|
||||
|
||||
});
|
||||
|
||||
// ----------------
|
||||
// Filter the Rows.
|
||||
// ----------------
|
||||
|
||||
$("#filter").on("keyup", function () {
|
||||
|
||||
var filter = $(this).val().toLowerCase();
|
||||
|
||||
$(".rdi-row").hide().filter(function () {
|
||||
return $(this).find(".filterable").text().toLowerCase().indexOf(filter) > -1;
|
||||
}).show();
|
||||
|
||||
if ($(".rdi-row:visible").length === 0) {
|
||||
$("#rdis-table thead").hide();
|
||||
$(".filter-error").removeClass("d-none");
|
||||
} else {
|
||||
$("#rdis-table thead").show();
|
||||
$(".filter-error").addClass("d-none");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// -------------------
|
||||
// Clear Filter Button
|
||||
// -------------------
|
||||
|
||||
$(".btnClearFilter").on("click", function () {
|
||||
|
||||
$("#filter").val("").trigger("change");
|
||||
|
||||
$sessionStorage.action = "PermitsBySubdivision.searchPermits";
|
||||
$sessionStorage.pagination = "first";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Per Page Change
|
||||
// ---------------
|
||||
|
||||
$("#rdis_per_page").on("change", function () {
|
||||
|
||||
$sessionStorage.rdis_per_page = $(this).val();
|
||||
$sessionStorage.action = "PermitsBySubdivision.searchPermits";
|
||||
$sessionStorage.pagination = "first";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
|
||||
// ------------------
|
||||
// Pagination Buttons
|
||||
// ------------------
|
||||
|
||||
$(".btnPagination").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "PermitsBySubdivision.searchPermits";
|
||||
$sessionStorage.pagination = $(this).data("pagination");
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
delete $sessionStorage.pagination;
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
});
|
||||
|
||||
// ---------------------
|
||||
// Autocomplete Searches
|
||||
// ---------------------
|
||||
|
||||
$(".subdivision-autocomplete").autoComplete({
|
||||
|
||||
resolverSettings: {
|
||||
url: "main.php?Xaction=PermitsBySubdivision.getAutoCompleteSubdivisions",
|
||||
queryKey: "rdi_sub_div_name",
|
||||
requestThrottling: 0
|
||||
},
|
||||
noResultsText: "No Matching Subdivisions Found.",
|
||||
bootstrapVersion: "4"
|
||||
|
||||
});
|
||||
|
||||
$(".city-autocomplete").autoComplete({
|
||||
resolverSettings: {
|
||||
url: "main.php?Xaction=PermitsBySubdivision.getAutoCompleteCities",
|
||||
queryKey: "rdi_project_city",
|
||||
requestThrottling: 0
|
||||
},
|
||||
noResultsText: "No Matching Cities Found.",
|
||||
bootstrapVersion: "4"
|
||||
|
||||
});
|
||||
|
||||
$(".street-autocomplete").autoComplete({
|
||||
|
||||
resolverSettings: {
|
||||
url: "main.php?Xaction=PermitsBySubdivision.getAutoCompleteStreets",
|
||||
queryKey: "rdi_project_addr",
|
||||
requestThrottling: 0
|
||||
},
|
||||
noResultsText: "No Matching Streets Found.",
|
||||
bootstrapVersion: "4"
|
||||
|
||||
});
|
||||
|
||||
// ----------------
|
||||
// Display Scollbar
|
||||
// ----------------
|
||||
|
||||
$(".scrollable").scroll(function () {
|
||||
if ($(this).scrollTop() > 60) {
|
||||
$("#btnTop").fadeIn();
|
||||
} else {
|
||||
$("#btnTop").fadeOut();
|
||||
}
|
||||
});
|
||||
|
||||
// -------------
|
||||
// Search Button
|
||||
// -------------
|
||||
|
||||
$(".btnSearch").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$("#searchPermitsBySubdivision").submit();
|
||||
});
|
||||
|
||||
// -------------
|
||||
// Search Button
|
||||
// -------------
|
||||
|
||||
$(".btnReset").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
$sessionStorage.action = "PermitsBySubdivision.searchPermits";
|
||||
$sessionStorage.pagination = $(this).data("pagination");
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
delete $sessionStorage.pagination;
|
||||
delete $sessionStorage.rdi_company;
|
||||
delete $sessionStorage.rdi_county;
|
||||
delete $sessionStorage.rdi_sub_div_name;
|
||||
delete $sessionStorage.rdi_project_city;
|
||||
delete $sessionStorage.rdi_project_addr;
|
||||
delete $sessionStorage.rdi_and_or;
|
||||
delete $sessionStorage.rdi_entry_start_date;
|
||||
delete $sessionStorage.rdi_entry_end_date;
|
||||
delete $sessionStorage.rdi_permit_start_date;
|
||||
delete $sessionStorage.rdi_permit_end_date;
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
});
|
||||
|
||||
// -------------
|
||||
// Cancel Button
|
||||
// -------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.userSubscriptions || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#searchPermitsBySubdivision").submit(function (e) {
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
var rdi_county = $("#rdi_county"),
|
||||
rdi_and_or = $("#rdi_and_or"),
|
||||
rdi_company = $("#rdi_company"),
|
||||
rdi_sub_div_name = $("#rdi_sub_div_name"),
|
||||
rdi_project_city = $("#rdi_project_city"),
|
||||
rdi_project_addr = $("#rdi_project_addr"),
|
||||
rdi_entry_start_date = $("#rdi_entry_start_date"),
|
||||
rdi_entry_end_date = $("#rdi_entry_end_date"),
|
||||
rdi_permit_start_date = $("#rdi_permit_start_date"),
|
||||
rdi_permit_end_date = $("#rdi_permit_end_date"),
|
||||
form_error = $("#search-form-error");
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
// Function to display errors and hide spinner
|
||||
function showError(message, element) {
|
||||
$("#spinner-dialog").modal("hide");
|
||||
createInputError(form_error, message);
|
||||
if (element)
|
||||
createInputError(element, "");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Validate required fields
|
||||
if ([rdi_county, rdi_company, rdi_sub_div_name, rdi_project_city, rdi_project_addr, rdi_entry_start_date, rdi_entry_end_date, rdi_permit_start_date, rdi_permit_end_date].every(isBlank)) {
|
||||
return showError("Please provide a search criteria.");
|
||||
}
|
||||
|
||||
if (isBlank(rdi_entry_start_date) && !isBlank(rdi_entry_end_date)) {
|
||||
return showError("Please provide an Entry From Date for range.", rdi_entry_start_date);
|
||||
}
|
||||
|
||||
if (isBlank(rdi_permit_start_date) && !isBlank(rdi_permit_end_date)) {
|
||||
return showError("Please provide a Permit From Date for range.", rdi_permit_start_date);
|
||||
}
|
||||
|
||||
// Validate date ranges
|
||||
if (rdi_entry_end_date.val() && !checkEndingDate(rdi_entry_start_date, rdi_entry_end_date)) {
|
||||
return showError("Start Date must be prior to End Date");
|
||||
}
|
||||
|
||||
if (rdi_permit_end_date.val() && !checkEndingDate(rdi_permit_start_date, rdi_permit_end_date)) {
|
||||
return showError("Start Date must be prior to End Date");
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$sessionStorage.rdi_company = rdi_company.val();
|
||||
$sessionStorage.rdi_county = rdi_county.val();
|
||||
$sessionStorage.rdi_and_or = rdi_and_or.val();
|
||||
$sessionStorage.rdi_sub_div_name = rdi_sub_div_name.val();
|
||||
$sessionStorage.rdi_project_city = rdi_project_city.val();
|
||||
$sessionStorage.rdi_project_addr = rdi_project_addr.val();
|
||||
$sessionStorage.rdi_entry_start_date = rdi_entry_start_date.val();
|
||||
$sessionStorage.rdi_entry_end_date = rdi_entry_end_date.val();
|
||||
$sessionStorage.rdi_permit_start_date = rdi_permit_start_date.val();
|
||||
$sessionStorage.rdi_permit_end_date = rdi_permit_end_date.val();
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// -------------------
|
||||
// Column Heading Sort
|
||||
// -------------------
|
||||
|
||||
if (($sessionStorage.rdis_order_by || "") !== "") {
|
||||
|
||||
$("th[data-order-by = '" + ($sessionStorage.rdis_order_by || "") + "']").append('<i class="' + ($sessionStorage.rdis_order_icon || "") + ' text-danger ms-1 me-0"/>');
|
||||
|
||||
}
|
||||
|
||||
$("th.sortable").on("click", function (e) {
|
||||
|
||||
if ($(e.target).data("order-by") !== ($sessionStorage.rdis_order_by || "")) { // New Column
|
||||
|
||||
$sessionStorage.rdis_order_by = $(e.target).data("order-by");
|
||||
$sessionStorage.rdis_order_direction = "asc";
|
||||
$sessionStorage.rdis_order_icon = "bi bi-arrow-up";
|
||||
|
||||
} else {
|
||||
|
||||
switch ($sessionStorage.rdis_order_direction) {
|
||||
|
||||
case "" :
|
||||
|
||||
$sessionStorage.rdis_order_by = $(e.target).data("order-by");
|
||||
$sessionStorage.rdis_order_direction = "asc";
|
||||
$sessionStorage.rdis_order_icon = "bi bi-arrow-up";
|
||||
break;
|
||||
|
||||
case "asc" :
|
||||
|
||||
$sessionStorage.rdis_order_by = $(e.target).data("order-by");
|
||||
$sessionStorage.rdis_order_direction = "desc";
|
||||
$sessionStorage.rdis_order_icon = "bi bi-arrow-down";
|
||||
break;
|
||||
|
||||
case "desc" :
|
||||
|
||||
$sessionStorage.rdis_order_by = "";
|
||||
$sessionStorage.rdis_order_direction = "";
|
||||
$sessionStorage.rdis_order_icon = "";
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// -----------------
|
||||
// Select All Button
|
||||
// -----------------
|
||||
|
||||
$(".btnSelectAll").on("click", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$(".selection-checkbox:input:checkbox").prop("checked", true);
|
||||
|
||||
$(".btnDeselectAll, .btnExportSelected").removeClass("d-none");
|
||||
|
||||
});
|
||||
|
||||
// -------------------
|
||||
// Deselect All Button
|
||||
// -------------------
|
||||
|
||||
$(".btnDeselectAll").on("click", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$(".selection-checkbox:input:checkbox").prop("checked", false);
|
||||
|
||||
$(".btnDeselectAll, .btnExportSelected").addClass("d-none");
|
||||
|
||||
});
|
||||
|
||||
// ------------------------
|
||||
// Toggle a Select Checkbox
|
||||
// ------------------------
|
||||
|
||||
$(".rdi-row").on("click touch", function (e) {
|
||||
|
||||
if (!($(e.target).hasClass("selection-area"))) {
|
||||
return false;
|
||||
}
|
||||
;
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
var $this = $(e.target), checked = ($this.closest("tr").find("input[name='selected[]']").prop("checked"));
|
||||
|
||||
// Toggle the selected Checkbox.
|
||||
|
||||
$this.closest("tr").find("input[name='selected[]']").prop("checked", !checked);
|
||||
|
||||
if ($("input[name='selected[]']:checked").length === 0) {
|
||||
$(".btnDeselectAll, .btnExportSelected").addClass("d-none");
|
||||
} else {
|
||||
$(".btnDeselectAll, .btnExportSelected").removeClass("d-none");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$("#rdis-table tbody tr").on("click touch", function (e) {
|
||||
|
||||
// If the click was on selection area (or the checkbox itself), do nothing
|
||||
if ($(e.target).closest(".selection-area, input[name='selected[]'], label").length) {
|
||||
return;
|
||||
}
|
||||
|
||||
const rdi_serial = $(this).data("rdi-serial");
|
||||
|
||||
openPermitDialog(getPermitRecordDialog(rdi_serial));
|
||||
|
||||
});
|
||||
|
||||
// ------------------------
|
||||
// Export All Permits - PDF
|
||||
// ------------------------
|
||||
|
||||
$(".btnExportAllPDF").on("click", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
window.open("", "PrintTab");
|
||||
|
||||
$("input[name = 'action']", "#PrintAllPermitsBySubdivisionPDFForm").val("print");
|
||||
$("input[name = 'subscription_serial']", "#PrintAllPermitsBySubdivisionPDFForm").val($sessionStorage.subscription_serial);
|
||||
$("#PrintAllPermitsBySubdivisionPDFForm").submit();
|
||||
|
||||
});
|
||||
|
||||
// --------------------------
|
||||
// Export All Permits - Excel
|
||||
// --------------------------
|
||||
|
||||
$(".btnExportAllExcel").on("click", function (e) {
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
$sessionStorage.action = "Export_AllPermitsBySubdivision_Excel.export";
|
||||
$sessionStorage.subscription_reference = $sessionStorage.subscription_serial;
|
||||
$sessionStorage.downloadReturn = "Reports.selectReport";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
// Submit in a new tab
|
||||
formSubmit($sessionStorage, "_blank");
|
||||
|
||||
// Hide spinner immediately, since the main page isn't going anywhere
|
||||
setTimeout(function () {
|
||||
$("#spinner-dialog").modal("hide");
|
||||
}, 2000); // optional: add a slight delay so it feels responsive
|
||||
});
|
||||
|
||||
// ------------------------
|
||||
// Export All Permits - CSV
|
||||
// ------------------------
|
||||
|
||||
$(".btnExportAllCSV").on("click", function (e) {
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
$sessionStorage.action = "Export_AllPermitsBySubdivision_CSV.export";
|
||||
$sessionStorage.subscription_reference = $sessionStorage.subscription_serial;
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
// Submit in a new tab
|
||||
formSubmit($sessionStorage, "_blank");
|
||||
|
||||
// Hide spinner immediately, since the main page isn't going anywhere
|
||||
setTimeout(function () {
|
||||
$("#spinner-dialog").modal("hide");
|
||||
}, 2000); // optional: add a slight delay so it feels responsive
|
||||
|
||||
});
|
||||
|
||||
// -----------------------------
|
||||
// Print Selected Permits Button
|
||||
// -----------------------------
|
||||
|
||||
$(".btnPrintSelected").on("click", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
window.open("", "PrintTab");
|
||||
|
||||
var selected = $("input[name='selected[]']:checked").map(function () {
|
||||
return $(this).val();
|
||||
}).get();
|
||||
|
||||
$("input[name = 'action']", "#PrintSelectedPermitsBySubdivisionForm").val("print");
|
||||
$("input[name = 'selected_permits']", "#PrintSelectedPermitsBySubdivisionForm").val(selected);
|
||||
$("input[name = 'subscription_serial']", "#PrintSelectedPermitsBySubdivisionForm").val($sessionStorage.subscription_serial);
|
||||
$("#PrintSelectedPermitsBySubdivisionForm").submit();
|
||||
|
||||
});
|
||||
|
||||
// -----------------------------
|
||||
// Export Selected Permits - CSV
|
||||
// -----------------------------
|
||||
|
||||
$(".btnExportCSV").on("click", function (e) {
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
var selected = $("input[name='selected[]']:checked").map(function () {
|
||||
return $(this).val();
|
||||
}).get();
|
||||
|
||||
console.log(selected);
|
||||
|
||||
$sessionStorage.action = "Export_SelectedPermitsBySubdivision_CSV.export";
|
||||
$sessionStorage.selected_permits = selected;
|
||||
$sessionStorage.subscription_reference = $sessionStorage.subscription_serial;
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
// Submit in a new tab
|
||||
formSubmit($sessionStorage, "_blank");
|
||||
|
||||
// Hide spinner immediately, since the main page isn't going anywhere
|
||||
setTimeout(function () {
|
||||
$("#spinner-dialog").modal("hide");
|
||||
}, 2000); // optional: add a slight delay so it feels responsive
|
||||
|
||||
});
|
||||
|
||||
// -------------------------------
|
||||
// Export Selected Permits - Excel
|
||||
// -------------------------------
|
||||
|
||||
$(".btnExportSelectedExcel").on("click", function (e) {
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
var selected = $("input[name='selected[]']:checked").map(function () {
|
||||
return $(this).val();
|
||||
}).get();
|
||||
|
||||
console.log(selected);
|
||||
|
||||
$sessionStorage.action = "Export_SelectedPermitsBySubdivision_Excel.export";
|
||||
$sessionStorage.subscription_reference = $sessionStorage.subscription_serial;
|
||||
$sessionStorage.selected_permits = selected;
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
// Submit in a new tab
|
||||
formSubmit($sessionStorage, "_blank");
|
||||
|
||||
// Hide spinner immediately, since the main page isn't going anywhere
|
||||
setTimeout(function () {
|
||||
$("#spinner-dialog").modal("hide");
|
||||
}, 2000); // optional: add a slight delay so it feels responsive
|
||||
});
|
||||
|
||||
// -------------------
|
||||
// Save Changed Inputs
|
||||
// -------------------
|
||||
|
||||
$(".autosave").on("change", function (e) {
|
||||
|
||||
switch (e.target.type) {
|
||||
|
||||
case "text" :
|
||||
$sessionStorage[e.target.name] = $(this).val();
|
||||
break;
|
||||
case "radio" :
|
||||
$sessionStorage[e.target.name] = $(this).val();
|
||||
break;
|
||||
case "checkbox" :
|
||||
$sessionStorage[e.target.name] = $(this).prop("checked");
|
||||
break;
|
||||
case "select-one" :
|
||||
$sessionStorage[e.target.name] = $(this).val();
|
||||
break;
|
||||
case "hidden" :
|
||||
$sessionStorage[e.target.name] = $(this).val();
|
||||
break;
|
||||
|
||||
default :
|
||||
$sessionStorage[e.target.name] = $(this).val();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
});
|
||||
|
||||
// ----------------
|
||||
// Initalize Inputs
|
||||
// ----------------
|
||||
|
||||
$.each($sessionStorage, function (name, value) {
|
||||
|
||||
var $input = $(":input").filter("[name='" + name + "']");
|
||||
|
||||
if ($input.length > 0) {
|
||||
|
||||
switch ($input.prop("type")) {
|
||||
|
||||
case "text" :
|
||||
$input.val(value);
|
||||
break;
|
||||
case "radio" :
|
||||
$input.filter("[value=" + value + "]").prop("checked", true);
|
||||
break;
|
||||
case "checkbox" :
|
||||
$input.prop("checked", value);
|
||||
break;
|
||||
case "select-one" :
|
||||
$input.val(value);
|
||||
break;
|
||||
case "hidden" :
|
||||
$input.val(value);
|
||||
break;
|
||||
|
||||
default :
|
||||
$input.val(value);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// ------------------
|
||||
// Save preset Inputs
|
||||
// ------------------
|
||||
|
||||
$("input[type=radio]:checked").trigger("change");
|
||||
|
||||
// -----------------
|
||||
// Per Page Dropdown
|
||||
// -----------------
|
||||
|
||||
$("#rdis_per_page").on("change", function () {
|
||||
|
||||
$(".btnFind").trigger("click");
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function openPermitDialog(modalHtml) {
|
||||
const $modal = $(modalHtml);
|
||||
|
||||
// Remove any existing instance
|
||||
$("#permit-details-dialog").remove();
|
||||
|
||||
$("body").append($modal);
|
||||
|
||||
const modal = new bootstrap.Modal(
|
||||
document.getElementById("permit-details-dialog"),
|
||||
{backdrop: "static", keyboard: false}
|
||||
);
|
||||
|
||||
modal.show();
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------
|
||||
// Returns Modal with Permit Record Data
|
||||
// -------------------------------------
|
||||
|
||||
function getPermitRecordDialog(rdi_serial) {
|
||||
|
||||
var dialog = null;
|
||||
|
||||
$.ajax({
|
||||
url: "main.php?Xaction=PermitsBySubdivision.getPermitRecordDialog",
|
||||
type: "POST",
|
||||
async: false,
|
||||
data: {rdi_serial: rdi_serial},
|
||||
dataType: "html",
|
||||
success: function (result) {
|
||||
dialog = result;
|
||||
}
|
||||
});
|
||||
|
||||
return dialog;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user