Fixed Subdivision Exports
This commit is contained in:
@@ -204,8 +204,6 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
// ====================
|
||||
// Autocomplete Searches
|
||||
// ====================
|
||||
@@ -529,6 +527,23 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
// // ------------------------
|
||||
// // 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);
|
||||
// $("input[name = 'subscription_serial']", "#PrintAllPermitsBySubdivisionPDFForm").val($sessionStorage.subscription_serial);
|
||||
// $("#PrintAllPermitsBySubdivisionPDFForm").submit();
|
||||
//
|
||||
// });
|
||||
|
||||
// ------------------------
|
||||
// Export All Permits - PDF
|
||||
// ------------------------
|
||||
@@ -537,14 +552,55 @@ $(document).ready(function () {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
const $printForm = $("#PrintAllPermitsBySubdivisionPDFForm");
|
||||
const $searchForm = $("#searchPermitsBySubdivision");
|
||||
|
||||
// Remove fields added by a previous PDF export.
|
||||
$printForm.find(".print-search-field").remove();
|
||||
|
||||
// Copy populated search criteria into the PDF form.
|
||||
$searchForm.find(":input[name]").not(":button, :submit, :reset").not("[name='action']").not("[name='subscription_serial']").each(function () {
|
||||
|
||||
const $input = $(this);
|
||||
const fieldName = $input.attr("name");
|
||||
|
||||
// Ignore unchecked checkboxes and radio buttons.
|
||||
if (($input.is(":checkbox") || $input.is(":radio")) && !$input.is(":checked")) {
|
||||
return;
|
||||
}
|
||||
|
||||
let values = $input.val();
|
||||
|
||||
if (values === null || values === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Supports multiple-select inputs.
|
||||
if (!Array.isArray(values)) {
|
||||
values = [values];
|
||||
}
|
||||
|
||||
$.each(values, function (_, value) {
|
||||
|
||||
value = String(value).trim();
|
||||
|
||||
if (value === "") {
|
||||
return;
|
||||
}
|
||||
|
||||
$("<input>", {type: "hidden", name: fieldName, value: value, class: "print-search-field"}).appendTo($printForm);
|
||||
});
|
||||
});
|
||||
|
||||
$printForm.find("[name='action']").val("print");
|
||||
$printForm.find("[name='subscription_serial']").val($sessionStorage.subscription_serial);
|
||||
|
||||
window.open("", "PrintTab");
|
||||
|
||||
$("input[name = 'action']", "#PrintAllPermitsBySubdivisionPDFForm").val("print");
|
||||
$("input[name = 'subscription_serial']", "#PrintAllPermitsBySubdivisionPDFForm").val($sessionStorage.subscription_serial);
|
||||
$("#PrintAllPermitsBySubdivisionPDFForm").submit();
|
||||
|
||||
$printForm.trigger("submit");
|
||||
});
|
||||
|
||||
|
||||
|
||||
// --------------------------
|
||||
// Export All Permits - Excel
|
||||
// --------------------------
|
||||
|
||||
Reference in New Issue
Block a user