Initial comming of full program to main branch

This commit is contained in:
James Richie
2026-02-14 07:57:18 -05:00
parent 2b18dcef82
commit 6195ca4709
1516 changed files with 432116 additions and 0 deletions
+84
View File
@@ -0,0 +1,84 @@
// ==========
// Add County
// ==========
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// --------------
// Select Pickers
// --------------
$(".search-dropdown").selectpicker({noneSelectedText: "",
style: "",
styleBase: "form-select form-select-sm",
iconBase: "bi",
virtualScroll: true,
size: 10,
selectOnTab: true,
containter: "body",
liveSearch: true});
// -----------
// Save Button
// -----------
$(".btnSave").on("click", function (e) {
e.preventDefault();
$("#addCounty").submit();
});
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", function () {
$sessionStorage.action = $sessionStorage.addCounty || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// ---------------
// Validate Inputs
// ---------------
$("#addCounty").submit(function (e) {
var county_name = $("#county_name"), county_area = $("#county_area");
clearInputErrors();
county_name.val(trimString(county_name.val()));
if (isBlank(county_name)) {
createInputError(county_name, "Name is required");
return false;
}
if (formPost({action: "Counties.countyExists", county_serial: 0, county_name: county_name.val()}) === true) {
createInputError(county_name, "Name already exists");
return false;
}
if ($("option:selected", county_area).val() === "") {
createInputError(county_area, "Area is required");
return false;
}
e.preventDefault();
$.post("./", $(this).serialize())
.done(function () {
formSubmit({action: $sessionStorage.addCounty});
});
});
});
+68
View File
@@ -0,0 +1,68 @@
// ============
// Add Dropdown
// ============
$(document).ready(function() {
var $application = "ATLHOUSINGREPORT",
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -----------
// Save Button
// -----------
$(".btnSave").on("click", function(e) {
e.preventDefault();
$("#addDropdown").submit();
});
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", function() {
formSubmit({ action : $sessionStorage.addDropdown });
});
// ---------------
// Validate Inputs
// ---------------
$("#addDropdown").submit( function(e) {
var dropdowntype_serial = $("#dropdowntype_serial").val(),
dropdown_value = $("#dropdown_value");
clearInputErrors();
dropdown_value.val(trimString(dropdown_value.val()));
if (isBlank(dropdown_value)) {
createInputError(dropdown_value, "Value is required");
return false;
}
if (formPost({ action : "Dropdowns.dropdownExists", dropdowntype_serial : dropdowntype_serial, dropdown_serial : 0, dropdown_value : dropdown_value.val() }) === true) {
createInputError(dropdown_value, "Value already exists");
return false;
}
e.preventDefault();
$.post("./", $(this).serialize())
.done(function() {
$sessionStorage.action = $sessionStorage.addDropdown || "";
$sessionStorage.toast = "Dropdown was Added";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
});
+93
View File
@@ -0,0 +1,93 @@
// ================
// Add Dropdowntype
// ================
$(document).ready(function() {
var $application = "ATLHOUSINGREPORT",
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -----------
// Save Button
// -----------
$(".btnSave").on("click", function(e) {
e.preventDefault();
$("#addDropdowntype").submit();
});
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", function() {
formSubmit({ action : $sessionStorage.addDropdowntype });
});
// ---------------
// Validate Inputs
// ---------------
$("#addDropdowntype").submit( function(e) {
var dropdowntype_name = $("#dropdowntype_name"),
dropdowntype_title = $("#dropdowntype_title"),
dropdowntype_table = $("#dropdowntype_table"),
dropdowntype_column = $("#dropdowntype_column");
clearInputErrors();
dropdowntype_name.val(dropdowntype_name.val().replace(/\s+/g, " ").trim());
dropdowntype_title.val(dropdowntype_title.val().replace(/\s+/g, " ").trim());
dropdowntype_table.val(dropdowntype_table.val().replace(/\s+/g, " ").trim());
dropdowntype_column.val(dropdowntype_column.val().replace(/\s+/g, " ").trim());
if (isBlank(dropdowntype_name)) {
createInputError(dropdowntype_name, "Name is required");
return false;
}
if (formPost({ action : "Dropdowns.dropdowntypeExists", dropdowntype_serial : 0, dropdowntype_name : dropdowntype_name.val() }) === true) {
createInputError(dropdowntype_name, "Name already exists");
return false;
}
if (isBlank(dropdowntype_title)) {
createInputError(dropdowntype_title, "Title is required");
return false;
}
if (formPost({ action : "Dropdowns.dropdowntypetitleExists", dropdowntype_serial : 0, dropdowntype_title : dropdowntype_title.val() }) === true) {
createInputError(dropdowntype_title, "Title already exists");
return false;
}
if (isBlank(dropdowntype_table)) {
createInputError(dropdowntype_table, "Table is required");
return false;
}
if (isBlank(dropdowntype_column)) {
createInputError(dropdowntype_column, "Column is required");
return false;
}
e.preventDefault();
$.post("./", $(this).serialize())
.done(function() {
$sessionStorage.action = $sessionStorage.addDropdowntype || "";
$sessionStorage.toast = "Dropdown Type was Added";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
});
+68
View File
@@ -0,0 +1,68 @@
// ========
// Add Note
// ========
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(),
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -----------
// Save Button
// -----------
$(".btnSave").on("click", function (e) {
e.preventDefault();
$("#addNote").submit();
});
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", function () {
$sessionStorage.action = $sessionStorage.addNote || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// ---------------
// Validate Inputs
// ---------------
$("#addNote").submit(function (e) {
var note_text = $("#note_text");
clearInputErrors();
if (isBlank(note_text)) {
createInputError(note_text, "Note is required");
return false;
}
e.preventDefault();
$.post("./", $(this).serialize())
.done(function () {
$sessionStorage.action = $sessionStorage.addNote || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
});
+132
View File
@@ -0,0 +1,132 @@
// ===========
// Add Popover
// ===========
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(),
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}"),
$CKEditor;
// ----------------------
// Initialize the Editor.
// ----------------------
ClassicEditor
.create(document.querySelector('#popover_text'), {
toolbar: {
items: [
'heading',
'|',
'bold',
'italic',
'underline',
'link',
'bulletedList',
'numberedList',
'|',
'fontColor',
'fontSize',
'fontFamily',
'|',
'indent',
'outdent',
'alignment',
'|',
'horizontalLine',
'insertTable',
'|',
'undo',
'redo',
'|'
]},
link: {
addTargetToExternalLinks: true,
defaultProtocol: "http://"
}
})
.then(editor => {
$CKEditor = editor;
})
.catch(error => {
console.error('CK-Editor error...');
console.error(error);
});
// -----------
// Save Button
// -----------
$(".btnSave").on("click", function (e) {
e.preventDefault();
$("#addPopover").submit();
});
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", function () {
$sessionStorage.action = $sessionStorage.addPopover || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// ---------------
// Validate Inputs
// ---------------
$("#addPopover").submit(function (e) {
var popover_name = $("#popover_name"),
popover_title = $("#popover_title"),
popover_text = $("#popover_text");
clearInputErrors();
popover_name.val(popover_name.val().replace(/\s+/g, " ").trim());
popover_title.val(popover_title.val().replace(/\s+/g, " ").trim());
if (isBlank(popover_name)) {
createInputError(popover_name, "Name is required");
return false;
}
if (formPost({action: "Popovers.popoverExists", popover_serial: 0, popover_name: popover_name.val()}) === true) {
createInputError(popover_name, "Name already exists");
return false;
}
if (isBlank(popover_title)) {
createInputError(popover_title, "Title is required");
return false;
}
e.preventDefault();
$CKEditor.updateSourceElement();
$.post("./", $(this).serialize())
.done(function () {
$sessionStorage.action = $sessionStorage.addPopover || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
});
+141
View File
@@ -0,0 +1,141 @@
// =======
// Add 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();
$("#addRDI").submit();
});
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", function () {
$sessionStorage.action = $sessionStorage.addRDI || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// ---------------
// Validate Inputs
// ---------------
$("#addRDI").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);
});
});
});
+89
View File
@@ -0,0 +1,89 @@
// ==========
// Add Report
// ==========
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(),
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -----------
// Save Button
// -----------
$(".btnSave").on("click", function (e) {
e.preventDefault();
$("#addReport").submit();
});
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", function () {
$sessionStorage.action = $sessionStorage.addReport || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// ---------------
// Validate Inputs
// ---------------
$("#addReport").submit(function (e) {
var report_name = $("#report_name"),
report_class = $("#report_class"),
report_type = $("#report_type"),
report_description = $("#report_description");
clearInputErrors();
report_name.val(report_name.val().replace(/\s+/g, " ").trim());
if (isBlank(report_name)) {
createInputError(report_name, "Name is required");
return false;
}
if (isBlank(report_class)) {
createInputError(report_class, "Class is required");
return false;
}
if (formPost({action: "Reports.reportExists", report_serial: 0, report_class: report_class.val()}) === true) {
createInputError(report_class, "Class already exists");
return false;
}
if (isBlank(report_description)) {
createInputError(report_description, "Description is required");
return false;
}
e.preventDefault();
$.post("./", $(this).serialize())
.done(function () {
$sessionStorage.action = $sessionStorage.addReport || "";
$sessionStorage.toast = "Report was Added";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
});
+75
View File
@@ -0,0 +1,75 @@
// ==========
// Add Status
// ==========
$(document).ready(function() {
var $application = "ATLHOUSINGREPORT",
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -----------
// Save Button
// -----------
$(".btnSave").on("click", function(e) {
e.preventDefault();
$("#addStatus").submit();
});
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", function() {
$sessionStorage.action = $sessionStorage.addStatus || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// ---------------
// Validate Inputs
// ---------------
$("#addStatus").submit( function(e) {
var status_name = $("#status_name"),
status_classes = $("#status_classes");
clearInputErrors();
status_name.val(trimString(status_name.val()));
status_classes.val(trimString(status_classes.val()));
if (isBlank(status_name)) {
createInputError(status_name, "Name is required");
return false;
}
if (formPost({ action : "Statuses.statusExists", status_serial : 0, status_name : status_name.val() }) === true) {
createInputError(status_name, "Name already exists");
return false;
}
e.preventDefault();
$.post("./", $(this).serialize())
.done(function() {
$sessionStorage.action = $sessionStorage.addStatus || "";
$sessionStorage.toast = "Status was Added";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
});
+103
View File
@@ -0,0 +1,103 @@
// ================
// Add Subscription
// ================
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// --------------
// 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});
// -----------
// Save Button
// -----------
$(".btnSave").on("click", function (e) {
e.preventDefault();
$("#addSubscription").submit();
});
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", function () {
$sessionStorage.action = $sessionStorage.addSubscription || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// ---------------
// Validate Inputs
// ---------------
$("#addSubscription").submit(function (e) {
var subscription_title = $("#subscription_title"),
subscription_description = $("#subscription_description"),
subscription_project_type = $("#subscription_projecttype"),
subscription_area = $("#subscription_area");
clearInputErrors();
subscription_title.val(subscription_title.val().replace(/\s+/g, " ").trim());
subscription_title.val(subscription_title.val().replace(/\s+/g, " ").trim());
if (isBlank(subscription_title)) {
createInputError(subscription_title, "Title is required");
return false;
}
if (isBlank(subscription_description)) {
createInputError(subscription_description, "Description is required");
return false;
}
if ($("option:selected", subscription_project_type).val() === "") {
createInputError(subscription_project_type, "Project Type is required");
return false;
}
if ($("option:selected", subscription_area).val() === "") {
createInputError(subscription_area, "Area is required");
return false;
}
e.preventDefault();
$.post("./", $(this).serialize())
.done(function () {
$sessionStorage.action = $sessionStorage.addSubscription || "";
$sessionStorage.toast = "Subscription was Added";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
});
+120
View File
@@ -0,0 +1,120 @@
// ========================
// Add Subscription To User
// ========================
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -----------
// Input Masks
// -----------
$(".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
// ------------
$("#subscription_stop_date").datepicker({format: "mm-dd-yyyy",
container: "div.subscription_stop_date",
keyboardNavigation: false,
showOnFocus: false,
autoclose: true,
orientation: "left bottom",
todayBtn: "linked",
todayHighlight: true});
// ---------------------
// Show Calendar Buttons
// ---------------------
$(".btnSubscriptionStopDateCalendar").on("click", function (e) {
e.preventDefault();
$("#subscription_stop_date").focus().datepicker("show");
});
// -----------
// Save Button
// -----------
$(".btnSave").on("click", function (e) {
e.preventDefault();
$("#addSubscriptionToUser").submit();
});
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", function () {
$sessionStorage.action = $sessionStorage.addSubscriptionToUser || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// ---------------
// Validate Inputs
// ---------------
$("#addSubscriptionToUser").submit(function (e) {
var subscription_title = $("#subscription_serial"), subscription_stop_date = $("#subscription_stop_date");
clearInputErrors();
if ($("option:selected", subscription_title).val() === "") {
createInputError(subscription_title, "Subscription is required");
return false;
}
if (isBlank(subscription_stop_date)) {
createInputError(subscription_stop_date, "Date is required");
return false;
}
e.preventDefault();
$.post("./", $(this).serialize())
.done(function () {
$sessionStorage.action = $sessionStorage.addSubscriptionToUser || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
});
+136
View File
@@ -0,0 +1,136 @@
// ========
// Add User
// ========
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
console.log(sessionStorage);
// --------------
// 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});
// ------------------------
// Get the User Information
// ------------------------
$("#user_name").on("change", function () {
clearInputErrors();
let user = formPost({action: "Users.getUser_AJAX", user_name: $(this).val()});
if (user.exists === true) {
createInputError($(this), "User ID already exists");
return false;
}
});
// -----------
// Save Button
// -----------
$(".btnSave").on("click", function (e) {
e.preventDefault();
$("#addUser").submit();
});
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", function () {
$sessionStorage.action = $sessionStorage.addUser || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// --------------------
// Toggle Show Password
// --------------------
$("#togglePassword").click(function () {
var passwordField = $("#user_password");
var type = passwordField.attr("type") === "password" ? "text" : "password";
passwordField.attr("type", type);
// Toggle eye icon if using Bootstrap Icons
var icon = $(this).find("i");
icon.toggleClass("bi-eye bi-eye-slash");
});
// ---------------
// Validate Inputs
// ---------------
$("#addUser").submit(function (e) {
var user_name = $("#user_name"),
user_client_name = $("#user_client_name"),
user_email = $("#user_email"),
user_role = $("#user_role");
clearInputErrors();
user_name.val(user_name.val().replace(/\s+/g, " ").trim());
if (isBlank(user_name)) {
createInputError(user_name, "User ID is required");
return false;
}
let user = formPost({action: "Users.getUser_AJAX", user_name: user_name.val()});
if (user.valid === false) {
createInputError(user_name, "User Name is invalid");
return false;
}
if (user.exists === true) {
createInputError(user_name, "User Name already exists");
return false;
}
if (isBlank(user_client_name)) {
createInputError(user_client_name, "Client Name is required");
return false;
}
if (isBlank(user_email)) {
createInputError(user_email, "Email is required");
return false;
}
if ($("option:selected", user_role).val() === "") {
createInputError(user_role, "Role is required");
return false;
}
e.preventDefault();
$.post("./", $(this).serialize())
.done(function () {
formSubmit({action: $sessionStorage.addUser});
});
});
});
+33
View File
@@ -0,0 +1,33 @@
let logoutTimer;
function startLogoutTimer() {
// Set the timeout to 30 minutes (adjust as needed)
const timeoutInMinutes = 15;
const timeoutInMillis = timeoutInMinutes * 60 * 1000;
// Clear any existing timer to avoid duplicates
clearTimeout(logoutTimer);
// Set the new timer
logoutTimer = setTimeout(logoutUser, timeoutInMillis);
}
function resetLogoutTimer() {
// Restart the logout timer whenever there's user activity
startLogoutTimer();
}
function logoutUser() {
// Redirect to a PHP logout script
formPost({action: "signout"});
window.location.reload();
}
// Start the logout timer when the user logs in or performs any activity
startLogoutTimer();
// Reset the logout timer whenever there's user activity
document.addEventListener("mousemove", resetLogoutTimer);
document.addEventListener("keypress", resetLogoutTimer);
+84
View File
@@ -0,0 +1,84 @@
// =====================
// Auto Save and Restore
// =====================
var $sessionStorage = JSON.parse(sessionStorage.getItem("ATLHOUSINGREPORT") || "{}");
// -------------------
// 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("HOMESTEAD", 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");
+293
View File
@@ -0,0 +1,293 @@
// ==============
// Base Functions
// ==============
// --------------------------------
// Clear the Error State for Inputs
// --------------------------------
function clearInputErrors() {
$(".is-invalid").removeClass("is-invalid");
$(".invalid-feedback").remove();
}
// -----------------------------------
// Create an Error State for an Input.
// -----------------------------------
function createInputError(input, message = "", scroll = false) {
if ($(input).hasClass("search-dropdown")) { // Select Picker
$(input).closest(".bootstrap-select")
.find("button").first()
.addClass("is-invalid")
.after("<div class='invalid-feedback fs-875'>" + message + "</div>")
.focus();
} else {
$(input).focus().addClass("is-invalid");
if ($(input).is(":last-child")) {
$(input).after("<div class='invalid-feedback'>" + message + "</div>");
} else {
$(input).siblings(":last").after("<div class='invalid-feedback'>" + message + "</div>");
}
}
if (scroll === true) {
var element = document.getElementById(input.attr("id"));
var header_offset = 130;
var element_position = element.getBoundingClientRect().top;
var offset_position = element_position + window.pageYOffset - header_offset;
window.scrollTo({
top: offset_position,
behavior: "smooth"
});
}
}
// ---------------------
// Test for Blank Value.
// ---------------------
function isBlank(object) {
if ($.trim(object.val()).length == 0) {
return true;
} else {
return false;
}
}
// ------------------------
// Verify an Email Address.
// ------------------------
function isEmail(email) {
var valid = false;
var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,6})+$/;
return regex.test(email.val());
}
// ------------------------
// Validate a URL (syntax).
// ------------------------
function isURL(object) {
return /^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(object.val());
}
// ---------------------------------
// AJAX Call to Get Zip Code Detail.
// ---------------------------------
function getZipCodeDetail(zipcode) {
var zipCodeDetail = null;
$.ajax({
url: "./",
type: "POST",
async: false,
data: {action: "get_zipcode_detail",
zip_code: zipcode},
dataType: "json",
success: function (info) {
zipCodeDetail = info;
}
});
return zipCodeDetail;
}
// -----------------------------
// AJAX Call to Validate a Date.
// -----------------------------
function isDate(date) {
var valid = false;
$.ajax({
url: "./",
type: "POST",
async: false,
data: {action: "validateDate",
date: date.val()},
dataType: "json",
success: function (result) {
valid = result;
}
});
return valid;
}
// ---------------------------------------------
// Ending Date cannot be prior to Starting Date.
// ---------------------------------------------
function checkEndingDate(startingDate, endingDate) {
var parts = startingDate.val().match(/(\d+)/g);
var sDate = new Date(parts[0], parts[1] - 1, parts[2]);
parts = endingDate.val().match(/(\d+)/g);
var eDate = new Date(parts[0], parts[1] - 1, parts[2]);
sDate.setHours(0, 0, 0, 0);
eDate.setHours(0, 0, 0, 0);
// The Ending Date cannot be prior to the Starting Date.
if (eDate.getTime() < sDate.getTime()) {
return false;
} else {
return true;
}
}
// -------------------------------------------------------
// Convert a string to Title Case and remove extra spaces.
// -------------------------------------------------------
function titleCase(string) {
string = string.replace(/([^\W_]+[^\s-]*) */g, function (s) {
return s.charAt(0).toUpperCase() + s.slice(1);
});
string = string.replace(/\s+/g, " ").trim();
return string;
}
// ------------------------------------------
// Trim a string and remove extra white space
// ------------------------------------------
function trimString(string) {
return string.replace(/\s+/g, " ").trim();
}
// -------------------
// Post a Form (AJAX).
// -------------------
function formPost(inputs) {
var response = "";
$.ajax({
url: "./",
type: "POST",
async: false,
dataType: "json",
data: inputs,
success: function (results) {
response = results;
}, error: function (errorcode) {
console.log(errorcode);
}
});
return response;
}
// --------------
// Submit a Form.
// --------------
//function formSubmit(inputs, target) {
//
// $('<form action="./" method="post" id="formSubmit"/>').appendTo("body");
//
// var form = $("#formSubmit");
//
// if (target === "_blank") {
// form.prop("target", target);
// }
//
// for (var name in inputs) {
// form.append('<input type="hidden" name="' + name + '" value="' + inputs[name] + '"/>');
// }
//
// console.log($('#formSubmit').html());
//
//// form.submit();
//
//}
// --------------
// Submit a Form.
// --------------
function formSubmit(inputs, target = "") {
var form = $("#formSubmit");
if (target === "_blank") {
form.prop("target", target);
} else {
form.prop("target", "");
}
for (var name in inputs) {
form.append('<input type="hidden" name="' + name + '" value="' + inputs[name] + '"/>');
}
form.submit();
}
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// ----------------------------
// Enable Tooltips and Popovers
// ----------------------------
$("[data-bs-toggle=tooltip]").tooltip({trigger: "hover", container: "body"});
$("[data-bs-toggle=popover]").popover({trigger: "focus", container: "body"});
// -------------
// Display Toast
// -------------
const toast = $sessionStorage.toast || "";
if (toast !== "") {
$(".toast-body").html(toast);
$("#toast-message").toast("show");
$sessionStorage.toast = "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
}
});
+1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2039
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+3630
View File
File diff suppressed because it is too large Load Diff
+7
View File
File diff suppressed because one or more lines are too long
+6294
View File
File diff suppressed because it is too large Load Diff
+6
View File
File diff suppressed because one or more lines are too long
+4418
View File
File diff suppressed because it is too large Load Diff
+6
View File
File diff suppressed because one or more lines are too long
+62
View File
@@ -0,0 +1,62 @@
// ===============
// Change Password
// ===============
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -----------
// Save Button
// -----------
$(".btnSave").on("click", function (e) {
e.preventDefault();
$("#changePassword").submit();
});
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", function () {
formSubmit({action: $sessionStorage.addUser});
});
// ---------------
// Validate Inputs
// ---------------
$("#changePassword").submit(function (e) {
var user_new_password = $("#user_new_password"),
user_verify_password = $("#user_verify_password");
clearInputErrors();
if (isBlank(user_new_password)) {
createInputError(user_new_password, "New password is required");
return false;
}
if (isBlank(user_verify_password)) {
createInputError(user_verify_password, "Type password again");
return false;
}
if (user_new_password.val() !== user_verify_password.val()) {
createInputError(user_verify_password, "Password do not match.");
return false;
}
e.preventDefault();
$.post("./", $(this).serialize())
.done(function () {
formSubmit({action: "./"});
});
});
});
+13
View File
File diff suppressed because one or more lines are too long
+129
View File
@@ -0,0 +1,129 @@
// =============
// Choose Export
// =============
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -----------
// Input Masks
// -----------
$(".date-mask").inputmask({alias: "datetime",
inputFormat: "mm/dd/yyyy",
placeholder: "MM/DD/YYYY",
showMaskOnHover: false});
$(".accounting-period").inputmask("9999-99", {showMaskOnHover: false});
// ------------
// Date Pickers
// ------------
$("#export_processdate").datepicker({format: "mm-dd-yyyy",
container: "div.process_date",
keyboardNavigation: false,
showOnFocus: false,
autoclose: true,
endDate: "0d",
orientation: "left bottom",
todayBtn: "linked",
todayHighlight: true});
// ---------------------
// Show Calendar Buttons
// ---------------------
$(".btnProcessDateCalendar").on("click", function (e) {
e.preventDefault();
$("#export_processdate").focus().datepicker("show");
});
// --------------
// Select Pickers
// --------------
$(".search-dropdown").selectpicker({noneSelectedText: "",
style: "",
styleBase: "form-select form-select-sm",
iconBase: "fa",
virtualScroll: true,
size: 10,
selectOnTab: true,
containter: "body",
liveSearch: true});
// -----------
// Save Button
// -----------
$(".btnRun").on("click", function (e) {
e.preventDefault();
$("#chooseExport").submit();
});
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", function () {
$sessionStorage.action = "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// ---------------
// Validate Inputs
// ---------------
$("#chooseExport").submit(function (e) {
var export_process_date = $("#export_processdate"),
export_accounting_period = $("#export_accounting_period"),
export_type = $("#export_type");
clearInputErrors();
if (isBlank(export_process_date)) {
createInputError(export_process_date, "Date is required");
return false;
}
if ((!isBlank(export_process_date)) && (!export_process_date.inputmask("isComplete"))) {
createInputError(export_process_date, "Date is incomplete");
return false;
}
if (isBlank(export_accounting_period)) {
createInputError(export_accounting_period, "Accounting Period is required");
return false;
}
if ((!isBlank(export_accounting_period)) && (!export_accounting_period.inputmask("isComplete"))) {
createInputError(export_accounting_period, "Accounting Period is incomplete");
return false;
}
if ($("option:selected", export_type).val() === "") {
createInputError(export_type, "Export Type is required");
return false;
}
e.preventDefault();
$.post("./", $(this).serialize())
.done(function () {
$sessionStorage.action = $sessionStorage.run || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
});
+6
View File
File diff suppressed because one or more lines are too long
+29
View File
@@ -0,0 +1,29 @@
// ===================
// Consolidation Alert
// ===================
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -----------------
// Run Consolidation
// -----------------
$(".btnRunConsolidation").on("click", function () {
$("#spinner-dialog").modal("show");
$sessionStorage.action = "Consolidation.consolidationSequence";
$sessionStorage.step = "run";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
+27
View File
@@ -0,0 +1,27 @@
// =====================
// Consolidation Results
// =====================
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -----------
// Import CSVs
// -----------
$(".btnImportCSVs").on("click", function () {
$sessionStorage.action = "Import.uploadCSVFile";
$sessionStorage.step = "prompt";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
+312
View File
@@ -0,0 +1,312 @@
// ============
// Content Page
// ============
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// ============
// Navbar Links
// ============
// ------------
// Manage Links
// ------------
$(".user-subscriptions").on("click", function () {
$sessionStorage.action = "Subscriptions.userSubscriptions";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
console.log($sessionStorage);
formSubmit($sessionStorage);
});
// -------
// Support
// -------
$(".start-support-ticket").on("click", function () {
$sessionStorage.action = "SupportTickets.startSupportTicket";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
console.log($sessionStorage);
formSubmit($sessionStorage);
});
$(".manage-rdi").on("click", function () {
$sessionStorage.action = "RDI.manageRDI";
$sessionStorage.pagination = "first";
$sessionStorage.find_rdi = "";
$sessionStorage.rdis_order_by = "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -------------
// Consolidation
// -------------
$(".rdi-consolidation").on("click", function () {
$sessionStorage.action = "Consolidation.consolidationSequence";
$sessionStorage.step = "prompt";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -----------------
// Import Permit CSV
// -----------------
$(".import-permit-csv").on("click", function () {
$sessionStorage.action = "Import.uploadCSVFile";
$sessionStorage.step = "prompt";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// =============
// Reports Links
// =============
// -------------
// Select Report
// -------------
$(".select-report").on("click", function () {
$sessionStorage.action = "Reports.selectReport";
$sessionStorage.pagination = "first";
$sessionStorage.find_report = "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// ===========
// Setup Links
// ===========
// --------
// Counties
// --------
$(".setup-counties").on("click", function () {
$sessionStorage.action = "Counties.setupCounties";
$sessionStorage.pagination = "first";
$sessionStorage.find_county = "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -----
// Users
// -----
$(".setup-users").on("click", function () {
$sessionStorage.action = "Users.setupUsers";
$sessionStorage.pagination = "first";
$sessionStorage.find_user = "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -------------
// Subscriptions
// -------------
$(".setup-subscriptions").on("click", function () {
$sessionStorage.action = "Subscriptions.setupSubscriptions";
$sessionStorage.pagination = "first";
$sessionStorage.find_subscription = "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// ---------
// Dropdowns
// ---------
$(".setup-dropdowns").on("click", function () {
sessionStorage.removeItem($application);
formSubmit({action: "Dropdowns.setupDropdowns"});
});
// ===================
// User Dropdown Links
// ===================
// -----------------------
// Toggle Dark/Light Theme
// -----------------------
$(".toggle-theme").on("click", function () {
formPost({action: "toggleTheme"});
if (document.documentElement.getAttribute("data-bs-theme") === "dark") {
document.documentElement.setAttribute("data-bs-theme", "light");
} else {
document.documentElement.setAttribute("data-bs-theme", "dark");
}
});
// ---------------
// Sign out system
// ---------------
$(".sign-out").on("click", function () {
formPost({action: "signout"});
window.location.reload();
});
// --------------------
// Setup Dropdown Types
// --------------------
$(".setup-dropdowntypes").on("click", function () {
$sessionStorage.action = "Dropdowns.setupDropdowntypes";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// ------------
// View Journal
// ------------
$(".view-journal").on("click", function () {
$sessionStorage.action = "Journal.viewJournal";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// --------------------
// View Support Tickets
// --------------------
$(".view-support-tickets").on("click", function () {
$sessionStorage.action = "SupportTickets.viewSupportTickets";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// --------------
// Setup Popovers
// --------------
$(".setup-popovers").on("click", function () {
$sessionStorage.action = "Popovers.setupPopovers";
$sessionStorage.pagination = "first";
$sessionStorage.find_popover = "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -------------
// Setup Reports
// -------------
$(".setup-reports").on("click", function () {
$sessionStorage.action = "Reports.setupReports";
$sessionStorage.pagination = "first";
$sessionStorage.find_report = "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// --------------
// Setup Statuses
// --------------
$(".setup-statuses").on("click", function () {
$sessionStorage.action = "Statuses.setupStatuses";
$sessionStorage.pagination = "first";
$sessionStorage.find_status = "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// --------------
// Setup Statuses
// --------------
$(".run-developer-stub").on("click", function () {
$sessionStorage.action = "testing";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
+1
View File
File diff suppressed because one or more lines are too long
+1
View File
File diff suppressed because one or more lines are too long
+128
View File
@@ -0,0 +1,128 @@
// ===========
// Edit County
// ===========
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// =================
// Process Enter Key
// =================
$(document).on('keypress', function (e) {
if (e.which == 13) {
e.preventDefault();
$("#editCounty").submit();
}
});
// --------------
// Select Pickers
// --------------
$(".search-dropdown").selectpicker({noneSelectedText: "",
style: "",
styleBase: "form-select form-select-sm",
iconBase: "bi",
virtualScroll: true,
size: 10,
selectOnTab: true,
containter: "body",
liveSearch: true});
// -----------
// Save Button
// -----------
$(".btnSave").on("click", function (e) {
e.preventDefault();
$("#editCounty").submit();
});
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", function () {
$sessionStorage.action = $sessionStorage.editCounty || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -------------
// Delete Button
// -------------
$(".btnDelete").on("click", function () {
if (formPost({action: "Counties.countyActive", county_serial: $sessionStorage.county_serial}) === true) {
$("#continue-dialog").find(".modal-title").html("Cannot Delete County").end()
.find(".modal-body").html("This County is in use and cannot be deleted.").end()
.modal("show");
} else {
$("#confirm-dialog").removeClass().addClass("modal confirm-delete-county")
.find(".modal-title").html("Confirm Delete County").end()
.find(".modal-body").html("Are you sure you wish to delete this County?").end()
.modal("show");
}
});
$("body").on("click", ".confirm-delete-county .btnConfirmDialogConfirm", function () {
$.post("./", {action: "Counties.deleteCounty", county_serial: $sessionStorage.county_serial})
.done(function () {
formSubmit({action: $sessionStorage.deleteCounty});
});
});
// ---------------
// Validate Inputs
// ---------------
$("#editCounty").submit(function (e) {
var county_serial = $("#county_serial"),
county_name = $("#county_name"),
county_area = $("#county_area");
clearInputErrors();
county_name.val(trimString(county_name.val()));
if (isBlank(county_name)) {
createInputError(county_name, "Name is required");
return false;
}
if (formPost({action: "Counties.countyExists", county_serial: county_serial.val(), county_name: county_name.val()}) === true) {
createInputError(county_name, "Name already exists");
return false;
}
if ($("option:selected", county_area).val() === "") {
createInputError(county_area, "Area is required");
return false;
}
e.preventDefault();
$.post("./", $(this).serialize())
.done(function () {
formSubmit({action: $sessionStorage.editCounty});
});
});
});
+109
View File
@@ -0,0 +1,109 @@
// =============
// Edit Dropdown
// =============
$(document).ready(function() {
var $application = "ATLHOUSINGREPORT",
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -----------
// Save Button
// -----------
$(".btnSave").on("click", function(e) {
e.preventDefault();
$("#editDropdown").submit();
});
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", function() {
formSubmit({ action : $sessionStorage.editDropdown });
});
// -------------
// Delete Button
// -------------
$(".btnDelete").on("click", function() {
if (formPost({ action : "Dropdowns.dropdownActive", dropdown_serial : $sessionStorage.dropdown_serial }) === true) {
$("#continue-dialog").find(".modal-title").html("Cannot Delete Dropdown").end()
.find(".modal-body").html("This Dropdown is in use and cannot be deleted.").end()
.modal("show");
} else {
$("#confirm-dialog").removeClass().addClass("modal confirm-delete-dropdown")
.find(".modal-title").html("Confirm Delete Dropdown").end()
.find(".modal-body").html("Are you sure you wish to delete this Dropdown?").end()
.modal("show");
}
});
$("body").on("click", ".confirm-delete-dropdown .btnConfirmDialogConfirm", function() {
$.post("./", { action : "Dropdowns.deleteDropdown", dropdown_serial : $sessionStorage.dropdown_serial })
.done(function() {
$sessionStorage.action = $sessionStorage.editDropdown || "";
$sessionStorage.toast = "Dropdown was Deleted";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
// ---------------
// Validate Inputs
// ---------------
$("#editDropdown").submit( function(e) {
var dropdowntype_serial = $("#dropdowntype_serial").val(),
dropdown_serial = $("#dropdown_serial").val(),
dropdown_value = $("#dropdown_value");
clearInputErrors();
dropdown_value.val(trimString(dropdown_value.val()));
if (isBlank(dropdown_value)) {
createInputError(dropdown_value, "Value is required");
return false;
}
if (formPost({ action : "Dropdowns.dropdownExists", dropdowntype_serial : dropdowntype_serial, dropdown_serial : dropdown_serial, dropdown_value : dropdown_value.val() }) === true) {
createInputError(dropdown_value, "Value already exists");
return false;
}
e.preventDefault();
$.post("./", $(this).serialize())
.done(function() {
$sessionStorage.action = $sessionStorage.editDropdown || "";
$sessionStorage.toast = "Dropdown was Saved";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
});
+134
View File
@@ -0,0 +1,134 @@
// =================
// Edit Dropdowntype
// =================
$(document).ready(function() {
var $application = "ATLHOUSINGREPORT",
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -----------
// Save Button
// -----------
$(".btnSave").on("click", function(e) {
e.preventDefault();
$("#editDropdowntype").submit();
});
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", function() {
formSubmit({ action : $sessionStorage.editDropdowntype });
});
// -------------
// Delete Button
// -------------
$(".btnDelete").on("click", function() {
if (formPost({ action : "Dropdowns.dropdowntypeActive", dropdowntype_serial : $sessionStorage.dropdowntype_serial }) === true) {
$("#continue-dialog").find(".modal-title").html("Cannot Delete Dropdown Type").end()
.find(".modal-body").html("Dropdown Type is in use and cannot be deleted.").end()
.modal("show");
} else {
$("#confirm-dialog").removeClass().addClass("modal confirm-delete-dropdowntype")
.find(".modal-title").html("Confirm Delete Dropdown Type").end()
.find(".modal-body").html("Are you sure you wish to delete this Dropdown Type?").end()
.modal("show");
}
});
$("body").on("click", ".confirm-delete-dropdowntype .btnConfirmDialogConfirm", function() {
$.post("./", { action : "Dropdowns.deleteDropdowntype", dropdowntype_serial : $sessionStorage.dropdowntype_serial })
.done(function() {
$sessionStorage.action = $sessionStorage.editDropdowntype || "";
$sessionStorage.toast = "Dropdown Type was Deleted";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
// ---------------
// Validate Inputs
// ---------------
$("#editDropdowntype").submit( function(e) {
var dropdowntype_serial = $("#dropdowntype_serial"),
dropdowntype_name = $("#dropdowntype_name"),
dropdowntype_title = $("#dropdowntype_title"),
dropdowntype_table = $("#dropdowntype_table"),
dropdowntype_column = $("#dropdowntype_column");
clearInputErrors();
dropdowntype_name.val(dropdowntype_name.val().replace(/\s+/g, " ").trim());
dropdowntype_title.val(dropdowntype_title.val().replace(/\s+/g, " ").trim());
dropdowntype_table.val(dropdowntype_table.val().replace(/\s+/g, " ").trim());
dropdowntype_column.val(dropdowntype_column.val().replace(/\s+/g, " ").trim());
if (isBlank(dropdowntype_name)) {
createInputError(dropdowntype_name, "Name is required");
return false;
}
if (formPost({ action : "Dropdowns.dropdowntypeExists", dropdowntype_serial : dropdowntype_serial.val(), dropdowntype_name : dropdowntype_name.val() }) === true) {
createInputError(dropdowntype_name, "Name already exists");
return false;
}
if (isBlank(dropdowntype_title)) {
createInputError(dropdowntype_title, "Title is required");
return false;
}
if (formPost({ action : "Dropdowns.dropdowntypetitleExists", dropdowntype_serial : dropdowntype_serial.val(), dropdowntype_title : dropdowntype_title.val() }) === true) {
createInputError(dropdowntype_title, "Title already exists");
return false;
}
if (isBlank(dropdowntype_table)) {
createInputError(dropdowntype_table, "Table is required");
return false;
}
if (isBlank(dropdowntype_column)) {
createInputError(dropdowntype_column, "Column is required");
return false;
}
e.preventDefault();
$.post("./", $(this).serialize())
.done(function() {
$sessionStorage.action = $sessionStorage.editDropdowntype || "";
$sessionStorage.toast = "Dropdown Type was Saved";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
});
+91
View File
@@ -0,0 +1,91 @@
// =========
// Edit Note
// =========
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(),
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -----------
// Save Button
// -----------
$(".btnSave").on("click", function (e) {
e.preventDefault();
$("#editNote").submit();
});
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", function () {
$sessionStorage.action = $sessionStorage.editNote || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -------------
// Delete Button
// -------------
$(".btnDelete").on("click", function () {
$("#confirm-dialog").removeClass().addClass("modal confirm-delete-note")
.find(".modal-title").html("Confirm Delete Note").end()
.find(".modal-body").html("Are you sure you wish to delete this Note?").end()
.modal("show");
});
$("body").on("click", ".confirm-delete-note .btnConfirmDialogConfirm", function () {
$.post("./", {action: "Notes.deleteNote", note_serial: $sessionStorage.note_serial})
.done(function () {
$sessionStorage.action = $sessionStorage.deleteNote || "";
formSubmit($sessionStorage);
});
});
// ---------------
// Validate Inputs
// ---------------
$("#editNote").submit(function (e) {
var note_text = $("#note_text");
clearInputErrors();
if (isBlank(note_text)) {
createInputError(note_text, "Note is required");
return false;
}
e.preventDefault();
$.post("./", $(this).serialize())
.done(function () {
$sessionStorage.action = $sessionStorage.editNote || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
});
+162
View File
@@ -0,0 +1,162 @@
// ============
// Edit Popover
// ============
$(document).ready(function() {
var $application = "ATLHOUSINGREPORT",
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}"),
$CKEditor;
// ----------------------
// Initialize the Editor.
// ----------------------
ClassicEditor
.create( document.querySelector( '#popover_text' ), {
toolbar: {
items: [
'heading',
'|',
'bold',
'italic',
'underline',
'link',
'bulletedList',
'numberedList',
'|',
'fontColor',
'fontSize',
'fontFamily',
'|',
'indent',
'outdent',
'alignment',
'|',
'horizontalLine',
'insertTable',
'|',
'undo',
'redo',
'|'
] },
link: {
addTargetToExternalLinks : true,
defaultProtocol : "http://"
}
})
.then( editor => {
$CKEditor = editor;
})
.catch( error => {
console.error( 'CK-Editor error...' );
console.error( error );
});
// -----------
// Save Button
// -----------
$(".btnSave").on("click", function(e) {
e.preventDefault();
$("#editPopover").submit();
});
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", function() {
$sessionStorage.action = $sessionStorage.editPopover || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -------------
// Delete Button
// -------------
$(".btnDelete").on("click", function() {
$("#confirm-dialog").removeClass().addClass("modal confirm-delete-popover")
.find(".modal-title").html("Confirm Delete Popover").end()
.find(".modal-body").html("Are you sure you wish to delete this Popover?").end()
.modal("show");
});
$("body").on("click", ".confirm-delete-popover .btnConfirmDialogConfirm", function() {
$.post("./", { action : "Popovers.deletePopover", popover_serial : $sessionStorage.popover_serial })
.done(function() {
$sessionStorage.action = $sessionStorage.editPopover || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
// ---------------
// Validate Inputs
// ---------------
$("#editPopover").submit( function(e) {
var popover_serial = $("#popover_serial"),
popover_name = $("#popover_name"),
popover_title = $("#popover_title"),
popover_text = $("#popover_text");
clearInputErrors();
popover_name.val(popover_name.val().replace(/\s+/g, " ").trim());
popover_title.val(popover_title.val().replace(/\s+/g, " ").trim());
if (isBlank(popover_name)) {
createInputError(popover_name, "Name is required");
return false;
}
if (formPost({ action : "Popovers.popoverExists", popover_serial : popover_serial.val(), popover_name : popover_name.val() }) === true) {
createInputError(popover_name, "Name already exists");
return false;
}
if (isBlank(popover_title)) {
createInputError(popover_title, "Title is required");
return false;
}
e.preventDefault();
$CKEditor.updateSourceElement();
$.post("./", $(this).serialize())
.done(function() {
$sessionStorage.action = $sessionStorage.editPopover || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
});
+163
View File
@@ -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);
});
});
});
+120
View File
@@ -0,0 +1,120 @@
// ===========
// Edit Report
// ===========
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(),
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -----------
// Save Button
// -----------
$(".btnSave").on("click", function (e) {
e.preventDefault();
$("#editReport").submit();
});
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", function () {
$sessionStorage.action = $sessionStorage.editReport || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -------------
// Delete Button
// -------------
$(".btnDelete").on("click", function () {
$("#confirm-dialog").removeClass().addClass("modal confirm-delete-report")
.find(".modal-title").html("Confirm Delete Report").end()
.find(".modal-body").html("Are you sure you wish to delete this Report?").end()
.modal("show");
});
$("body").on("click", ".confirm-delete-report .btnConfirmDialogConfirm", function () {
$.post("./", {action: "Reports.deleteReport", report_serial: $sessionStorage.report_serial})
.done(function () {
$sessionStorage.action = $sessionStorage.editReport || "";
$sessionStorage.toast = "Report was Deleted";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
// ---------------
// Validate Inputs
// ---------------
$("#editReport").submit(function (e) {
var report_name = $("#report_name"),
report_serial = $("#report_serial"),
report_class = $("#report_class"),
report_type = $("#report_type"),
report_description = $("#report_description");
clearInputErrors();
report_name.val(report_name.val().replace(/\s+/g, " ").trim());
if (isBlank(report_name)) {
createInputError(report_name, "Name is required");
return false;
}
if (isBlank(report_class)) {
createInputError(report_class, "Class is required");
return false;
}
if (formPost({action: "Reports.reportExists", report_serial: report_serial.val(), report_class: report_class.val()}) === true) {
createInputError(report_class, "Class already exists");
return false;
}
if (isBlank(report_description)) {
createInputError(report_description, "Description is required");
return false;
}
e.preventDefault();
$.post("./", $(this).serialize())
.done(function () {
$sessionStorage.action = $sessionStorage.editReport || "";
$sessionStorage.toast = "Report was Saved";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
});
+108
View File
@@ -0,0 +1,108 @@
// ===========
// Edit Status
// ===========
$(document).ready(function() {
var $application = "ATLHOUSINGREPORT",
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -----------
// Save Button
// -----------
$(".btnSave").on("click", function(e) {
e.preventDefault();
$("#editStatus").submit();
});
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", function() {
$sessionStorage.action = $sessionStorage.editStatus || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -------------
// Delete Button
// -------------
$(".btnDelete").on("click", function() {
if (formPost({ action : "Statuses.statusActive", status_serial : $sessionStorage.status_serial }) === true) {
$("#continue-dialog").find(".modal-title").html("Cannot Delete Status").end()
.find(".modal-body").html("This Status is in use and cannot be deleted.").end()
.modal("show");
} else {
$("#confirm-dialog").removeClass().addClass("modal confirm-delete-status")
.find(".modal-title").html("Confirm Delete Status").end()
.find(".modal-body").html("Are you sure you wish to delete this Status?").end()
.modal("show");
}
});
$("body").on("click", ".confirm-delete-status .btnConfirmDialogConfirm", function() {
$.post("./", { action : "Statuses.deleteStatus", status_serial : $sessionStorage.status_serial })
.done(function() {
formSubmit({ action : $sessionStorage.deleteStatus });
});
});
// ---------------
// Validate Inputs
// ---------------
$("#editStatus").submit( function(e) {
var status_serial = $("#status_serial"),
status_name = $("#status_name"),
status_classes = $("#status_classes");
clearInputErrors();
status_name.val(trimString(status_name.val()));
status_classes.val(trimString(status_classes.val()));
if (isBlank(status_name)) {
createInputError(status_name, "Name is required");
return false;
}
if (formPost({ action : "Statuses.statusExists", status_serial : status_serial.val(), status_name : status_name.val() }) === true) {
createInputError(status_name, "Name already exists");
return false;
}
e.preventDefault();
$.post("./", $(this).serialize())
.done(function() {
$sessionStorage.action = $sessionStorage.editStatus || "";
$sessionStorage.toast = "Status was Saved";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
});
+132
View File
@@ -0,0 +1,132 @@
// =================
// Edit Subscription
// =================
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// --------------
// 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});
// -----------
// Save Button
// -----------
$(".btnSave").on("click", function (e) {
e.preventDefault();
$("#editSubscription").submit();
});
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", function () {
$sessionStorage.action = $sessionStorage.editSubscription || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -------------
// Delete Button
// -------------
$(".btnDelete").on("click", function () {
if (formPost({action: "Subscriptions.subscriptionActive", subscription_serial: $sessionStorage.subscription_serial}) === true) {
$("#continue-dialog").find(".modal-title").html("Cannot Delete Subscription").end()
.find(".modal-body").html("This Subscription is in use and cannot be deleted.").end()
.modal("show");
} else {
$("#confirm-dialog").removeClass().addClass("modal confirm-delete-subscription")
.find(".modal-title").html("Confirm Delete Subscription").end()
.find(".modal-body").html("Are you sure you wish to delete this Subscription?").end()
.modal("show");
}
});
$("body").on("click", ".confirm-delete-subscription .btnConfirmDialogConfirm", function () {
$.post("./", {action: "Subscriptions.deleteSubscription", subscription_serial: $sessionStorage.subscription_serial})
.done(function () {
formSubmit({action: $sessionStorage.deleteSubscription});
});
});
// ---------------
// Validate Inputs
// ---------------
$("#editSubscription").submit(function (e) {
var subscription_title = $("#subscription_title"),
subscription_description = $("#subscription_description"),
subscription_project_type = $("subscription_projecttype"),
subscription_area = $("#subscription_area");
clearInputErrors();
subscription_title.val(subscription_title.val().replace(/\s+/g, " ").trim());
subscription_title.val(subscription_title.val().replace(/\s+/g, " ").trim());
if (isBlank(subscription_title)) {
createInputError(subscription_title, "Title is required");
return false;
}
if (isBlank(subscription_description)) {
createInputError(subscription_description, "Description is required");
return false;
}
if ($("option:selected", subscription_project_type).val() === "") {
createInputError(subscription_project_type, "Project Type is required");
return false;
}
if ($("option:selected", subscription_area).val() === "") {
createInputError(subscription_area, "Area is required");
return false;
}
$.post("./", $(this).serialize())
.done(function () {
$sessionStorage.action = $sessionStorage.editSubscription || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
});
+144
View File
@@ -0,0 +1,144 @@
// =========
// Edit User
// =========
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// --------------
// 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});
// -----------
// Save Button
// -----------
$(".btnSave").on("click", function (e) {
e.preventDefault();
$("#editUser").submit();
});
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", function () {
$sessionStorage.action = $sessionStorage.editUser || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -------------
// Delete Button
// -------------
$(".btnDelete").on("click", function () {
if (formPost({action: "Users.userActive", user_serial: $sessionStorage.user_serial}) === true) {
$("#continue-dialog").find(".modal-title").html("Cannot Delete User").end()
.find(".modal-body").html("This User is Active and cannot be deleted.").end()
.modal("show");
} else {
$("#confirm-dialog").removeClass().addClass("modal confirm-delete-user")
.find(".modal-title").html("Confirm Delete User").end()
.find(".modal-body").html("Are you sure you wish to delete this User?").end()
.modal("show");
}
});
$("body").on("click", ".confirm-delete-user .btnConfirmDialogConfirm", function () {
$.post("./", {action: "Users.deleteUser", user_serial: $sessionStorage.user_serial})
.done(function () {
$sessionStorage.action = $sessionStorage.deleteUser || "";
$sessionStorage.toast = "User was Deleted";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
// ---------------
// Validate Inputs
// ---------------
$("#editUser").submit(function (e) {
var user_name = $("#user_name"),
user_email = $("#user_email"),
user_role = $("#user_role"),
user_client_name = $("#user_client_name");
clearInputErrors();
user_name.val(titleCase(user_name.val()));
user_email.val(trimString(user_email.val()));
if (isBlank(user_name)) {
createInputError(user_name, "Name is required");
return false;
}
if (isBlank(user_email)) {
createInputError(user_email, "Email is required");
return false;
}
if (isBlank(user_client_name)) {
createInputError(user_client_name, "Client Name is required");
return false;
}
if ($("option:selected", user_role).val() === "") {
createInputError(user_role, "Role is required");
return false;
}
e.preventDefault();
$.post("./", $(this).serialize())
.done(function () {
$sessionStorage.action = $sessionStorage.editUser || "";
$sessionStorage.toast = "User was Saved";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
});
+144
View File
@@ -0,0 +1,144 @@
// =========
// Edit User
// =========
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
console.log(sessionStorage);
// --------------
// 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});
// -----------
// Save Button
// -----------
$(".btnSave").on("click", function (e) {
e.preventDefault();
$("#editUser").submit();
});
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", function (e) {
e.preventDefault();
formSubmit({action: $sessionStorage.editUser});
});
// -------------
// Delete Button
// -------------
$(".btnDelete").on("click", function () {
if (formPost({action: "Users.userActive", user_serial: $sessionStorage.user_serial}) === true) {
$("#continue-dialog").find(".modal-title").html("Cannot Delete User").end()
.find(".modal-body").html("This User is Active and cannot be deleted.").end()
.modal("show");
} else {
$("#confirm-dialog").removeClass().addClass("modal confirm-delete-user")
.find(".modal-title").html("Confirm Delete User").end()
.find(".modal-body").html("Are you sure you wish to delete this User?").end()
.modal("show");
}
});
$("body").on("click", ".confirm-delete-user .btnConfirmDialogConfirm", function () {
$.post("./", {action: "Users.deleteUser", user_serial: $sessionStorage.user_serial})
.done(function () {
$sessionStorage.action = $sessionStorage.deleteUser || "";
$sessionStorage.toast = "User was Deleted";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
// ---------------
// Validate Inputs
// ---------------
$("#editUser").submit(function (e) {
var user_name = $("#user_name"),
user_email = $("#user_email"),
user_role = $("#user_role"),
user_client_name = $("#user_client_name");
clearInputErrors();
user_name.val(titleCase(user_name.val()));
user_email.val(trimString(user_email.val()));
if (isBlank(user_name)) {
createInputError(user_name, "Name is required");
return false;
}
if (isBlank(user_email)) {
createInputError(user_email, "Email is required");
return false;
}
if (isBlank(user_client_name)) {
createInputError(user_client_name, "Client Name is required");
return false;
}
if ($("option:selected", user_role).val() === "") {
createInputError(user_role, "Role is required");
return false;
}
e.preventDefault();
$.post("./", $(this).serialize())
.done(function () {
$sessionStorage.action = $sessionStorage.editUser || "";
$sessionStorage.toast = "User was Saved";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
});
+152
View File
@@ -0,0 +1,152 @@
// ========================
// Add Subscription To User
// ========================
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -----------
// Input Masks
// -----------
$(".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
// ------------
$("#subscription_stop_date").datepicker({format: "mm-dd-yyyy",
container: "div.subscription_stop_date",
keyboardNavigation: false,
showOnFocus: false,
autoclose: true,
orientation: "left bottom",
todayBtn: "linked",
todayHighlight: true});
// ---------------------
// Show Calendar Buttons
// ---------------------
$(".btnSubscriptionStopDateCalendar").on("click", function (e) {
e.preventDefault();
$("#subscription_stop_date").focus().datepicker("show");
});
// -----------
// Save Button
// -----------
$(".btnSave").on("click", function (e) {
e.preventDefault();
$("#editUsersSubscription").submit();
});
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", function () {
$sessionStorage.action = $sessionStorage.editUsersSubscription || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -------------
// Delete Button
// -------------
$(".btnDelete").on("click", function () {
$("#confirm-dialog").removeClass().addClass("modal confirm-delete-user-subscription")
.find(".modal-title").html("Confirm Deletion of User Subscription").end()
.find(".modal-body").html("Are you sure you wish to delete this Users Subscription?").end()
.modal("show");
});
$("body").on("click", ".confirm-delete-user-subscription .btnConfirmDialogConfirm", function () {
$.post("./", {action: "Subscriptions.deleteUsersSubscription", usersubscription_serial: $sessionStorage.usersubscription_serial})
.done(function () {
$sessionStorage.action = $sessionStorage.deleteUsersSubscription || "";
$sessionStorage.toast = "Users Subscription was Deleted";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
// ---------------
// Validate Inputs
// ---------------
$("#editUsersSubscription").submit(function (e) {
var subscription_title = $("#subscription_serial"), subscription_stop_date = $("#subscription_stop_date");
clearInputErrors();
if ($("option:selected", subscription_title).val() === "") {
createInputError(subscription_title, "Subscription is required");
return false;
}
if (isBlank(subscription_stop_date)) {
createInputError(subscription_stop_date, "Date is required");
return false;
}
e.preventDefault();
$.post("./", $(this).serialize())
.done(function () {
$sessionStorage.action = $sessionStorage.editUsersSubscription || "";
$sessionStorage.toast = "Users Subscription was Updated";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
});
+4
View File
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+8
View File
File diff suppressed because one or more lines are too long
+379
View File
@@ -0,0 +1,379 @@
// ==========
// Manage RDI
// ==========
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// --------------------
// Initialize Dropdowns
// --------------------
$("#rdis_per_page").val($sessionStorage.rdis_per_page || "20");
// -----------
// Find Button
// -----------
$(".btnFind").on("click", function () {
$sessionStorage.action = "RDI.manageRDI";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
$("#spinner-dialog").modal("show");
formSubmit($sessionStorage);
});
$("#find_rdi").on("keyup", function (e) {
if (e.key === "Enter") {
$(".btnFind").trigger("click");
}
});
// -----------------
// Clear Find Button
// -----------------
$(".btnClearFind").on("click", function () {
$("#find_rdi").val("").trigger("change");
$sessionStorage.action = "RDI.manageRDI";
$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 = "RDI.manageRDI";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
$("#spinner-dialog").modal("show");
formSubmit($sessionStorage);
});
// ------------------
// Pagination Buttons
// ------------------
$(".btnPagination").on("click", function () {
$sessionStorage.action = "RDI.manageRDI";
$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));
});
// ----------
// Add Button
// ----------
$(".btnAdd").on("click", function () {
$sessionStorage.action = "RDI.addRDI";
$sessionStorage.addRDI = "RDI.manageRDI";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -----------
// Done Button
// -----------
$(".btnDone").on("click", function () {
formSubmit({action: ""});
});
// --------------
// Refresh Button
// --------------
$(".btnRefresh").on("click", function () {
$sessionStorage.action = "RDI.manageRDI";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
$("#spinner-dialog").modal("show");
formSubmit($sessionStorage);
});
// -----------
// RDI Summary
// -----------
$("#rdis-table tbody td:not('.selection-checkboxes')").on("click touch", function (e) {
e.preventDefault();
$sessionStorage.action = "RDI.editRDI";
$sessionStorage.rdi_serial = $(e.target).closest("tr").data("rdi-serial");
$sessionStorage.rdiSummary = "RDI.manageRDI";
$sessionStorage.editRDI = "RDI.manageRDI";
$sessionStorage.deleteRDI = "RDI.manageRDI";
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, .btnPrintSelected").removeClass("d-none");
});
// -------------------
// Deselect All Button
// -------------------
$(".btnDeselectAll").on("click", function (e) {
e.preventDefault();
$(".selection-checkbox:input:checkbox").prop("checked", false);
$(".btnDeselectAll, .btnPrintSelected").addClass("d-none");
});
// ------------------------
// Toggle a Select Checkbox
// ------------------------
$(".rdi-row").on("click touch", function (e) {
if (!($(e.target).hasClass("selection-area"))) {
return false;
}
;
e.preventDefault();
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, .btnPrintSelected").addClass("d-none");
} else {
$(".btnDeselectAll, .btnPrintSelected").removeClass("d-none");
}
});
// ---------------------------------
// Print Selected Work Orders 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']", "#PrintRDIForm").val("print");
$("input[name = 'selected_rdis']", "#PrintRDIForm").val(selected);
$("#PrintRDIForm").submit();
});
// -------------------
// 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");
});
});
+286
View File
@@ -0,0 +1,286 @@
/*global ActiveXObject, window, console, define, module, jQuery */
//jshint unused:false, strict: false
/*
PDFObject v2.1.1
https://github.com/pipwerks/PDFObject
Copyright (c) 2008-2018 Philip Hutchison
MIT-style license: http://pipwerks.mit-license.org/
UMD module pattern from https://github.com/umdjs/umd/blob/master/templates/returnExports.js
*/
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], factory);
} else if (typeof module === 'object' && module.exports) {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory();
} else {
// Browser globals (root is window)
root.PDFObject = factory();
}
}(this, function () {
"use strict";
//jshint unused:true
//PDFObject is designed for client-side (browsers), not server-side (node)
//Will choke on undefined navigator and window vars when run on server
//Return boolean false and exit function when running server-side
if(typeof window === "undefined" || typeof navigator === "undefined"){ return false; }
var pdfobjectversion = "2.1.1",
ua = window.navigator.userAgent,
//declare booleans
supportsPDFs,
isIE,
supportsPdfMimeType = (typeof navigator.mimeTypes['application/pdf'] !== "undefined"),
supportsPdfActiveX,
isModernBrowser = (function (){ return (typeof window.Promise !== "undefined"); })(),
isFirefox = (function (){ return (ua.indexOf("irefox") !== -1); } )(),
isFirefoxWithPDFJS = (function (){
//Firefox started shipping PDF.js in Firefox 19.
//If this is Firefox 19 or greater, assume PDF.js is available
if(!isFirefox){ return false; }
//parse userAgent string to get release version ("rv")
//ex: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:57.0) Gecko/20100101 Firefox/57.0
return (parseInt(ua.split("rv:")[1].split(".")[0], 10) > 18);
})(),
isIOS = (function (){ return (/iphone|ipad|ipod/i.test(ua.toLowerCase())); })(),
//declare functions
createAXO,
buildFragmentString,
log,
embedError,
embed,
getTargetElement,
generatePDFJSiframe,
generateEmbedElement;
/* ----------------------------------------------------
Supporting functions
---------------------------------------------------- */
createAXO = function (type){
var ax;
try {
ax = new ActiveXObject(type);
} catch (e) {
ax = null; //ensure ax remains null
}
return ax;
};
//IE11 still uses ActiveX for Adobe Reader, but IE 11 doesn't expose
//window.ActiveXObject the same way previous versions of IE did
//window.ActiveXObject will evaluate to false in IE 11, but "ActiveXObject" in window evaluates to true
//so check the first one for older IE, and the second for IE11
//FWIW, MS Edge (replacing IE11) does not support ActiveX at all, both will evaluate false
//Constructed as a method (not a prop) to avoid unneccesarry overhead -- will only be evaluated if needed
isIE = function (){ return !!(window.ActiveXObject || "ActiveXObject" in window); };
//If either ActiveX support for "AcroPDF.PDF" or "PDF.PdfCtrl" are found, return true
//Constructed as a method (not a prop) to avoid unneccesarry overhead -- will only be evaluated if needed
supportsPdfActiveX = function (){ return !!(createAXO("AcroPDF.PDF") || createAXO("PDF.PdfCtrl")); };
//Determines whether PDF support is available
supportsPDFs = (
//as of iOS 12, inline PDF rendering is still not supported in Safari or native webview
//3rd-party browsers (eg Chrome, Firefox) use Apple's webview for rendering, and thus the same result as Safari
//Therefore if iOS, we shall assume that PDF support is not available
!isIOS && (
//Modern versions of Firefox come bundled with PDFJS
isFirefoxWithPDFJS ||
//Browsers that still support the original MIME type check
supportsPdfMimeType || (
//Pity the poor souls still using IE
isIE() && supportsPdfActiveX()
)
)
);
//Create a fragment identifier for using PDF Open parameters when embedding PDF
buildFragmentString = function(pdfParams){
var string = "",
prop;
if(pdfParams){
for (prop in pdfParams) {
if (pdfParams.hasOwnProperty(prop)) {
string += encodeURIComponent(prop) + "=" + encodeURIComponent(pdfParams[prop]) + "&";
}
}
//The string will be empty if no PDF Params found
if(string){
string = "#" + string;
//Remove last ampersand
string = string.slice(0, string.length - 1);
}
}
return string;
};
log = function (msg){
if(typeof console !== "undefined" && console.log){
console.log("[PDFObject] " + msg);
}
};
embedError = function (msg){
log(msg);
return false;
};
getTargetElement = function (targetSelector){
//Default to body for full-browser PDF
var targetNode = document.body;
//If a targetSelector is specified, check to see whether
//it's passing a selector, jQuery object, or an HTML element
if(typeof targetSelector === "string"){
//Is CSS selector
targetNode = document.querySelector(targetSelector);
} else if (typeof jQuery !== "undefined" && targetSelector instanceof jQuery && targetSelector.length) {
//Is jQuery element. Extract HTML node
targetNode = targetSelector.get(0);
} else if (typeof targetSelector.nodeType !== "undefined" && targetSelector.nodeType === 1){
//Is HTML element
targetNode = targetSelector;
}
return targetNode;
};
generatePDFJSiframe = function (targetNode, url, pdfOpenFragment, PDFJS_URL, id){
var fullURL = PDFJS_URL + "?file=" + encodeURIComponent(url) + pdfOpenFragment;
var scrollfix = (isIOS) ? "-webkit-overflow-scrolling: touch; overflow-y: scroll; " : "overflow: hidden; ";
var iframe = "<div style='" + scrollfix + "position: absolute; top: 0; right: 0; bottom: 0; left: 0;'><iframe " + id + " src='" + fullURL + "' style='border: none; width: 100%; height: 100%;' frameborder='0'></iframe></div>";
targetNode.className += " pdfobject-container";
targetNode.style.position = "relative";
targetNode.style.overflow = "auto";
targetNode.innerHTML = iframe;
return targetNode.getElementsByTagName("iframe")[0];
};
generateEmbedElement = function (targetNode, targetSelector, url, pdfOpenFragment, width, height, id){
var style = "";
if(targetSelector && targetSelector !== document.body){
style = "width: " + width + "; height: " + height + ";";
} else {
style = "position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%;";
}
targetNode.className += " pdfobject-container";
targetNode.innerHTML = "<embed " + id + " class='pdfobject' src='" + url + pdfOpenFragment + "' type='application/pdf' style='overflow: auto; " + style + "'/>";
return targetNode.getElementsByTagName("embed")[0];
};
embed = function(url, targetSelector, options){
//Ensure URL is available. If not, exit now.
if(typeof url !== "string"){ return embedError("URL is not valid"); }
//If targetSelector is not defined, convert to boolean
targetSelector = (typeof targetSelector !== "undefined") ? targetSelector : false;
//Ensure options object is not undefined -- enables easier error checking below
options = (typeof options !== "undefined") ? options : {};
//Get passed options, or set reasonable defaults
var id = (options.id && typeof options.id === "string") ? "id='" + options.id + "'" : "",
page = (options.page) ? options.page : false,
pdfOpenParams = (options.pdfOpenParams) ? options.pdfOpenParams : {},
fallbackLink = (typeof options.fallbackLink !== "undefined") ? options.fallbackLink : true,
width = (options.width) ? options.width : "100%",
height = (options.height) ? options.height : "100%",
assumptionMode = (typeof options.assumptionMode === "boolean") ? options.assumptionMode : true,
forcePDFJS = (typeof options.forcePDFJS === "boolean") ? options.forcePDFJS : false,
PDFJS_URL = (options.PDFJS_URL) ? options.PDFJS_URL : false,
targetNode = getTargetElement(targetSelector),
fallbackHTML = "",
pdfOpenFragment = "",
fallbackHTML_default = "<p>This browser does not support inline PDFs. Please download the PDF to view it: <a href='[url]'>Download PDF</a></p>";
//If target element is specified but is not valid, exit without doing anything
if(!targetNode){ return embedError("Target element cannot be determined"); }
//page option overrides pdfOpenParams, if found
if(page){
pdfOpenParams.page = page;
}
//Stringify optional Adobe params for opening document (as fragment identifier)
pdfOpenFragment = buildFragmentString(pdfOpenParams);
//Do the dance
//If the forcePDFJS option is invoked, skip everything else and embed as directed
if(forcePDFJS && PDFJS_URL){
return generatePDFJSiframe(targetNode, url, pdfOpenFragment, PDFJS_URL, id);
//If traditional support is provided, or if this is a modern browser and not iOS (see comment for supportsPDFs declaration)
} else if(supportsPDFs || (assumptionMode && isModernBrowser && !isIOS)){
return generateEmbedElement(targetNode, targetSelector, url, pdfOpenFragment, width, height, id);
//If everything else has failed and a PDFJS fallback is provided, try to use it
} else if(PDFJS_URL){
return generatePDFJSiframe(targetNode, url, pdfOpenFragment, PDFJS_URL, id);
} else {
//Display the fallback link if available
if(fallbackLink){
fallbackHTML = (typeof fallbackLink === "string") ? fallbackLink : fallbackHTML_default;
targetNode.innerHTML = fallbackHTML.replace(/\[url\]/g, url);
}
return embedError("This browser does not support embedded PDFs");
}
};
return {
embed: function (a,b,c){ return embed(a,b,c); },
pdfobjectversion: (function () { return pdfobjectversion; })(),
supportsPDFs: (function (){ return supportsPDFs; })()
};
}));
+20
View File
@@ -0,0 +1,20 @@
/*
PDFObject v2.1.1
https://github.com/pipwerks/PDFObject
Copyright (c) 2008-2018 Philip Hutchison
MIT-style license: http://pipwerks.mit-license.org/
UMD module pattern from https://github.com/umdjs/umd/blob/master/templates/returnExports.js
*/
(function(root,factory){if(typeof define==='function'&&define.amd){define([],factory);}else if(typeof module==='object'&&module.exports){module.exports=factory();}else{root.PDFObject=factory();}}(this,function(){"use strict";if(typeof window==="undefined"||typeof navigator==="undefined"){return false;}
var pdfobjectversion="2.1.1",ua=window.navigator.userAgent,supportsPDFs,isIE,supportsPdfMimeType=(typeof navigator.mimeTypes['application/pdf']!=="undefined"),supportsPdfActiveX,isModernBrowser=(function(){return(typeof window.Promise!=="undefined");})(),isFirefox=(function(){return(ua.indexOf("irefox")!==-1);})(),isFirefoxWithPDFJS=(function(){if(!isFirefox){return false;}
return(parseInt(ua.split("rv:")[1].split(".")[0],10)>18);})(),isIOS=(function(){return(/iphone|ipad|ipod/i.test(ua.toLowerCase()));})(),createAXO,buildFragmentString,log,embedError,embed,getTargetElement,generatePDFJSiframe,generateEmbedElement;createAXO=function(type){var ax;try{ax=new ActiveXObject(type);}catch(e){ax=null;}
return ax;};isIE=function(){return!!(window.ActiveXObject||"ActiveXObject"in window);};supportsPdfActiveX=function(){return!!(createAXO("AcroPDF.PDF")||createAXO("PDF.PdfCtrl"));};supportsPDFs=(!isIOS&&(isFirefoxWithPDFJS||supportsPdfMimeType||(isIE()&&supportsPdfActiveX())));buildFragmentString=function(pdfParams){var string="",prop;if(pdfParams){for(prop in pdfParams){if(pdfParams.hasOwnProperty(prop)){string+=encodeURIComponent(prop)+"="+encodeURIComponent(pdfParams[prop])+"&";}}
if(string){string="#"+string;string=string.slice(0,string.length-1);}}
return string;};log=function(msg){if(typeof console!=="undefined"&&console.log){console.log("[PDFObject] "+msg);}};embedError=function(msg){log(msg);return false;};getTargetElement=function(targetSelector){var targetNode=document.body;if(typeof targetSelector==="string"){targetNode=document.querySelector(targetSelector);}else if(typeof jQuery!=="undefined"&&targetSelector instanceof jQuery&&targetSelector.length){targetNode=targetSelector.get(0);}else if(typeof targetSelector.nodeType!=="undefined"&&targetSelector.nodeType===1){targetNode=targetSelector;}
return targetNode;};generatePDFJSiframe=function(targetNode,url,pdfOpenFragment,PDFJS_URL,id){var fullURL=PDFJS_URL+"?file="+encodeURIComponent(url)+pdfOpenFragment;var scrollfix=(isIOS)?"-webkit-overflow-scrolling: touch; overflow-y: scroll; ":"overflow: hidden; ";var iframe="<div style='"+scrollfix+"position: absolute; top: 0; right: 0; bottom: 0; left: 0;'><iframe "+id+" src='"+fullURL+"' style='border: none; width: 100%; height: 100%;' frameborder='0'></iframe></div>";targetNode.className+=" pdfobject-container";targetNode.style.position="relative";targetNode.style.overflow="auto";targetNode.innerHTML=iframe;return targetNode.getElementsByTagName("iframe")[0];};generateEmbedElement=function(targetNode,targetSelector,url,pdfOpenFragment,width,height,id){var style="";if(targetSelector&&targetSelector!==document.body){style="width: "+width+"; height: "+height+";";}else{style="position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%;";}
targetNode.className+=" pdfobject-container";targetNode.innerHTML="<embed "+id+" class='pdfobject' src='"+url+pdfOpenFragment+"' type='application/pdf' style='overflow: auto; "+style+"'/>";return targetNode.getElementsByTagName("embed")[0];};embed=function(url,targetSelector,options){if(typeof url!=="string"){return embedError("URL is not valid");}
targetSelector=(typeof targetSelector!=="undefined")?targetSelector:false;options=(typeof options!=="undefined")?options:{};var id=(options.id&&typeof options.id==="string")?"id='"+options.id+"'":"",page=(options.page)?options.page:false,pdfOpenParams=(options.pdfOpenParams)?options.pdfOpenParams:{},fallbackLink=(typeof options.fallbackLink!=="undefined")?options.fallbackLink:true,width=(options.width)?options.width:"100%",height=(options.height)?options.height:"100%",assumptionMode=(typeof options.assumptionMode==="boolean")?options.assumptionMode:true,forcePDFJS=(typeof options.forcePDFJS==="boolean")?options.forcePDFJS:false,PDFJS_URL=(options.PDFJS_URL)?options.PDFJS_URL:false,targetNode=getTargetElement(targetSelector),fallbackHTML="",pdfOpenFragment="",fallbackHTML_default="<p>This browser does not support inline PDFs. Please download the PDF to view it: <a href='[url]'>Download PDF</a></p>";if(!targetNode){return embedError("Target element cannot be determined");}
if(page){pdfOpenParams.page=page;}
pdfOpenFragment=buildFragmentString(pdfOpenParams);if(forcePDFJS&&PDFJS_URL){return generatePDFJSiframe(targetNode,url,pdfOpenFragment,PDFJS_URL,id);}else if(supportsPDFs||(assumptionMode&&isModernBrowser&&!isIOS)){return generateEmbedElement(targetNode,targetSelector,url,pdfOpenFragment,width,height,id);}else if(PDFJS_URL){return generatePDFJSiframe(targetNode,url,pdfOpenFragment,PDFJS_URL,id);}else{if(fallbackLink){fallbackHTML=(typeof fallbackLink==="string")?fallbackLink:fallbackHTML_default;targetNode.innerHTML=fallbackHTML.replace(/\[url\]/g,url);}
return embedError("This browser does not support embedded PDFs");}};return{embed:function(a,b,c){return embed(a,b,c);},pdfobjectversion:(function(){return pdfobjectversion;})(),supportsPDFs:(function(){return supportsPDFs;})()};}));
+653
View File
@@ -0,0 +1,653 @@
// =========================
// Search Permits By Builder
// =========================
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// =================
// Process Enter Key
// =================
$(document).on('keypress', function (e) {
if (e.which === 13) {
e.preventDefault();
$("#searchPermitsByBuilder").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});
// ------------
// 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 = "PermitsByBuilder.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 = "PermitsByBuilder.searchPermits";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
$("#spinner-dialog").modal("show");
formSubmit($sessionStorage);
});
// ------------------
// Pagination Buttons
// ------------------
$(".btnPagination").on("click", function () {
$sessionStorage.action = "PermitsByBuilder.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));
});
// ----------------
// Display Scollbar
// ----------------
$(".scrollable").scroll(function () {
if ($(this).scrollTop() > 60) {
$("#btnTop").fadeIn();
} else {
$("#btnTop").fadeOut();
}
});
// -------------
// Search Button
// -------------
$(".btnSearch").on("click", function (e) {
e.preventDefault();
$("#searchPermitsByBuilder").submit();
});
// -------------
// Search Button
// -------------
$(".btnReset").on("click", function (e) {
e.preventDefault();
$sessionStorage.action = "PermitsByBuilder.searchPermits";
$sessionStorage.pagination = $(this).data("pagination");
$("#spinner-dialog").modal("show");
delete $sessionStorage.pagination;
delete $sessionStorage.rdi_company;
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
// ---------------
$("#searchPermitsByBuilder").submit(function (e) {
$("#spinner-dialog").modal("show");
var builder = $("#rdi_company"),
rdi_and_or = $("#rdi_and_or"),
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 ([builder, 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 = builder.val();
$sessionStorage.rdi_and_or = rdi_and_or.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();
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");
}
});
// ------------------------
// Export All Permits - PDF
// ------------------------
$(".btnExportAllPDF").on("click", function (e) {
e.preventDefault();
window.open("", "PrintTab");
$("input[name = 'action']", "#PrintAllPermitsByBuilderPDFForm").val("print");
$("input[name = 'subscription_serial']", "#PrintAllPermitsByBuilderPDFForm").val($sessionStorage.subscription_serial);
$("#PrintAllPermitsByBuilderPDFForm").submit();
});
// --------------------------
// Export All Permits - Excel
// --------------------------
$(".btnExportAllExcel").on("click", function (e) {
$("#spinner-dialog").modal("show");
$sessionStorage.action = "Export_AllPermitsByBuilderExcel.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_AllPermitsByBuilderCSV.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 Work Orders 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']", "#PrintSelectedPermitsByBuilderForm").val("print");
$("input[name = 'selected_permits']", "#PrintSelectedPermitsByBuilderForm").val(selected);
$("input[name = 'subscription_serial']", "#PrintSelectedPermitsByBuilderForm").val($sessionStorage.subscription_serial);
$("#PrintSelectedPermitsByBuilderForm").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();
$sessionStorage.action = "Export_SelectedPermitsByBuilderCSV.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
// -------------------------------
$(".btnExportExcel").on("click", function (e) {
$("#spinner-dialog").modal("show");
var selected = $("input[name='selected[]']:checked").map(function () {
return $(this).val();
}).get();
$sessionStorage.action = "Export_SelectedPermitsByBuilderExcel.export";
$sessionStorage.selected_permits = selected;
$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
});
// -------------------
// 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");
});
});
+778
View File
@@ -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;
}
+229
View File
@@ -0,0 +1,229 @@
// =============
// Select Report
// =============
$(document).ready(function() {
var $application = "ATLHOUSINGREPORT",
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -----------
// Find Button
// -----------
$(".btnFind").on("click", function() {
$sessionStorage.action = "Reports.selectReport";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
$("#spinner-dialog").modal("show");
formSubmit($sessionStorage);
});
$("#select_report").on("keyup", function(e) {
if (e.key === "Enter") {
$(".btnFind").trigger("click");
}
});
// -----------------
// Clear Find Button
// -----------------
$(".btnClearFind").on("click", function() {
$("#select_report").val("").trigger("change");
$sessionStorage.action = "Reports.selectReport";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
$("#spinner-dialog").modal("show");
formSubmit($sessionStorage);
});
// --------------------
// Show Per Page Change
// --------------------
$("#reports_per_page").on("change", function() {
$sessionStorage.alerts_per_page = $(this).val();
$sessionStorage.action = "Reports.selectReport";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
$("#spinner-dialog").modal("show");
formSubmit($sessionStorage);
});
// ------------------
// Pagination Buttons
// ------------------
$(".btnPagination").on("click", function() {
$sessionStorage.action = "Reports.selectReport";
$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));
});
// -----------
// Done Button
// -----------
$(".btnDone").on("click", function() {
formSubmit({ action : "" });
});
// ---------------------------
// Process the selected Report
// ---------------------------
$("#reports-table tbody").on("click touch", "tr", function(e) {
e.preventDefault();
switch ($(this).data("report-type")) {
case "Report" :
$sessionStorage.action = $(this).data("report-class");
$sessionStorage.printReturn = "Reports.selectReport";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
var target = $(this).data("report-target").trim();
formSubmit($sessionStorage, target);
break;
case "Download" :
$sessionStorage.action = $(this).data("report-class");
$sessionStorage.downloadReturn = "Reports.selectReport";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
break;
case "Email" :
break;
case "Graph" :
$sessionStorage.action = $(this).data("report-class");
$sessionStorage.graphReturn = "Reports.selectReport";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
break;
case "Upload" :
break;
default :
return false;
break;
}
});
// -------------------
// 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
// -----------------
$("#reports_per_page").on("change", function() {
$(".btnFind").trigger("click");
});
});
+190
View File
@@ -0,0 +1,190 @@
// ==============
// Setup Counties
// ==============
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(),
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -----------
// Find Button
// -----------
$(".btnFind").on("click", function () {
$sessionStorage.action = "Counties.setupCounties";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
$("#find_county").on("keyup", function (e) {
if (e.key === "Enter") {
$(".btnFind").trigger("click");
}
});
// -----------------
// Clear Find Button
// -----------------
$(".btnClearFind").on("click", function () {
$("#find_county").val("").trigger("change");
$sessionStorage.action = "Counties.setupCounties";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// ------------------
// Pagination Buttons
// ------------------
$(".btnPagination").on("click", function () {
$sessionStorage.action = "Counties.setupCounties";
$sessionStorage.pagination = $(this).data("pagination");
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
delete $sessionStorage.pagination;
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
});
// ----------
// Add Button
// ----------
$(".btnAdd").on("click", function () {
$sessionStorage.action = "Counties.addCounty";
$sessionStorage.addCounty = "Counties.setupCounties";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -----------
// Done Button
// -----------
$(".btnDone").on("click", function () {
formSubmit({action: ""});
});
// ----
// Edit
// ----
$("#counties-table tbody").on("click touch", "tr", function (e) {
e.preventDefault();
$sessionStorage.action = "Counties.editCounty";
$sessionStorage.county_serial = $(this).data("county-serial");
$sessionStorage.editCounty = "Counties.setupCounties";
$sessionStorage.deleteCounty = "Counties.setupCounties";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -------------------
// 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");
});
+127
View File
@@ -0,0 +1,127 @@
// ===============
// Setup Dropdowns
// ===============
$(document).ready(function() {
var $application = "ATLHOUSINGREPORT",
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// --------------------------------
// Open previously opened Accordion
// --------------------------------
if ((typeof $sessionStorage.reveal !== "undefined") && ($sessionStorage.reveal !== "")) {
var reveal = $sessionStorage.reveal.split("|");
reveal.forEach((element) => {
$("#" + element).collapse("show");
});
}
// -------------------
// Save open Accordion
// -------------------
$("#dropdown-accordion").on("shown.bs.collapse hidden.bs.collapse", function(e) {
const open = new Array();
$(".collapse.show").each(function() {
open.push($(this).attr("id"));
});
$sessionStorage.reveal = open.join("|");
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
});
// ----------
// Add Button
// ----------
$(".btnAdd").on("click", function() {
$sessionStorage.action = "Dropdowns.addDropdown";
$sessionStorage.dropdowntype_serial = $(this).data("dropdowntype-serial");
$sessionStorage.addDropdown = "Dropdowns.setupDropdowns";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -----------
// Done Button
// -----------
$(".btnDone").on("click", function() {
formSubmit({ action : "" });
});
// ----
// Edit
// ----
$(".dropdown-table tbody td:not('.dropdown_default, .dropdown_active')").on("click touch", function(e) {
e.preventDefault();
$sessionStorage.action = "Dropdowns.editDropdown";
$sessionStorage.dropdown_serial = $(this).closest("tr").data("dropdown-serial");
$sessionStorage.editDropdown = "Dropdowns.setupDropdowns";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// ----------------------------
// Process the Default Checkbox
// ----------------------------
$(".dropdown_default").on("click", function(e) {
// Get the clicked Checkbox's current value.
var $this = $(e.target),
checked = ($this.closest("tr").find("input[name='dropdown_default']").prop("checked"));
// Uncheck all Checkboxes.
$this.closest("tbody").find("input[name='dropdown_default']").each(function() {
$(this).prop("checked", false);
});
// Toggle the selected Checkbox.
$this.closest("tr").find("input[name='dropdown_default']").prop("checked", !checked);
// Update the Dropdowns Table with the chosen Default.
var dropdown_serial = $(e.target).closest("tr").data("dropdown-serial"),
dropdown_dropdowntype = $(e.target).closest("tr").data("dropdown-dropdowntype"),
dropdown_checked = !checked;
formPost({action : "Dropdowns.updateDropdownDefault", dropdown_serial : dropdown_serial, dropdown_dropdowntype : dropdown_dropdowntype, dropdown_checked: dropdown_checked});
});
// ---------------------------
// Process the Active Checkbox
// ---------------------------
$("input[name='dropdown_active']").on("change", function(e) {
formPost({ action : "Dropdowns.updateDropdownActive", dropdown_serial : $(this).data("dropdown-serial"), dropdown_checked: $(this).prop("checked") });
});
});
+181
View File
@@ -0,0 +1,181 @@
// ===================
// Setup Dropdowntypes
// ===================
$(document).ready(function() {
var $application = "ATLHOUSINGREPORT",
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -----------
// Find Button
// -----------
$(".btnFind").on("click", function() {
$sessionStorage.action = "Dropdowns.setupDropdowntypes";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
$("#spinner-dialog").modal("show");
formSubmit($sessionStorage);
});
$("#find_dropdowntype").on("keyup", function(e) {
if (e.key === "Enter") {
$(".btnFind").trigger("click");
}
});
// -----------------
// Clear Find Button
// -----------------
$(".btnClearFind").on("click", function() {
$("#find_dropdowntype").val("").trigger("change");
$sessionStorage.action = "Dropdowns.setupDropdowntypes";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
$("#spinner-dialog").modal("show");
formSubmit($sessionStorage);
});
// ------------------
// Pagination Buttons
// ------------------
$(".btnPagination").on("click", function() {
$sessionStorage.action = "Dropdowns.setupDropdowntypes";
$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));
});
// ----------
// Add Button
// ----------
$(".btnAdd").on("click", function() {
$sessionStorage.action = "Dropdowns.addDropdowntype";
$sessionStorage.addDropdowntype = "Dropdowns.setupDropdowntypes";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -----------
// Done Button
// -----------
$(".btnDone").on("click", function() {
formSubmit({ action : "" });
});
// ----
// Edit
// ----
$("#dropdowntypes-table tbody").on("click touch", "tr", function(e) {
e.preventDefault();
$sessionStorage.action = "Dropdowns.editDropdowntype";
$sessionStorage.dropdowntype_serial = $(this).data("dropdowntype-serial");
$sessionStorage.editDropdowntype = "Dropdowns.setupDropdowntypes";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -------------------
// 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
// -----------------
$("#dropdowntypes_per_page").on("change", function() {
$(".btnFind").trigger("click");
});
});
+181
View File
@@ -0,0 +1,181 @@
// ==============
// Setup Popovers
// ==============
$(document).ready(function() {
var $application = "PARKS",
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -----------
// Find Button
// -----------
$(".btnFind").on("click", function() {
$sessionStorage.action = "Popovers.setupPopovers";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
$("#spinner-dialog").modal("show");
formSubmit($sessionStorage);
});
$("#find_popover").on("keyup", function(e) {
if (e.key === "Enter") {
$(".btnFind").trigger("click");
}
});
// -----------------
// Clear Find Button
// -----------------
$(".btnClearFind").on("click", function() {
$("#find_popover").val("").trigger("change");
$sessionStorage.action = "Popovers.setupPopovers";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
$("#spinner-dialog").modal("show");
formSubmit($sessionStorage);
});
// ------------------
// Pagination Buttons
// ------------------
$(".btnPagination").on("click", function() {
$sessionStorage.action = "Popovers.setupPopovers";
$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));
});
// ----------
// Add Button
// ----------
$(".btnAdd").on("click", function() {
$sessionStorage.action = "Popovers.addPopover";
$sessionStorage.addPopover = "Popovers.setupPopovers";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -----------
// Done Button
// -----------
$(".btnDone").on("click", function() {
formSubmit({ action : "" });
});
// ----
// Edit
// ----
$("#popovers-table tbody").on("click touch", "tr", function(e) {
e.preventDefault();
$sessionStorage.action = "Popovers.editPopover";
$sessionStorage.popover_serial = $(this).data("popover-serial");
$sessionStorage.editPopover = "Popovers.setupPopovers";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -------------------
// 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
// -----------------
$("#popovers_per_page").on("change", function() {
$(".btnFind").trigger("click");
});
});
+175
View File
@@ -0,0 +1,175 @@
// =============
// Setup Reports
// =============
$(document).ready(function() {
var $application = "ATLHOUSINGREPORT",
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -----------
// Find Button
// -----------
$(".btnFind").on("click", function() {
$sessionStorage.action = "Reports.setupReports";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
$("#find_report").on("keyup", function(e) {
if (e.key === "Enter") {
$(".btnFind").trigger("click");
}
});
// -----------------
// Clear Find Button
// -----------------
$(".btnClearFind").on("click", function() {
$("#find_report").val("").trigger("change");
$sessionStorage.action = "Reports.setupReports";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// ------------------
// Pagination Buttons
// ------------------
$(".btnPagination").on("click", function() {
$sessionStorage.action = "Reports.setupReports";
$sessionStorage.pagination = $(this).data("pagination");
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
delete $sessionStorage.pagination;
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
});
// ----------
// Add Button
// ----------
$(".btnAdd").on("click", function() {
$sessionStorage.action = "Reports.addReport";
$sessionStorage.addReport = "Reports.setupReports";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -----------
// Done Button
// -----------
$(".btnDone").on("click", function() {
formSubmit({ action : "" });
});
// ----
// Edit
// ----
$("#reports-table tbody").on("click touch", "tr", function(e) {
e.preventDefault();
$sessionStorage.action = "Reports.editReport";
$sessionStorage.report_serial = $(this).data("report-serial");
$sessionStorage.editReport = "Reports.setupReports";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -------------------
// 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
// -----------------
$("#reports_per_page").on("change", function() {
$(".btnFind").trigger("click");
});
});
+190
View File
@@ -0,0 +1,190 @@
// ==============
// Setup Statuses
// ==============
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(),
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -----------
// Find Button
// -----------
$(".btnFind").on("click", function () {
$sessionStorage.action = "Statuses.setupStatuses";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
$("#find_status").on("keyup", function (e) {
if (e.key === "Enter") {
$(".btnFind").trigger("click");
}
});
// -----------------
// Clear Find Button
// -----------------
$(".btnClearFind").on("click", function () {
$("#find_status").val("").trigger("change");
$sessionStorage.action = "Statuses.setupStatuses";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// ------------------
// Pagination Buttons
// ------------------
$(".btnPagination").on("click", function () {
$sessionStorage.action = "Statuses.setupStatuses";
$sessionStorage.pagination = $(this).data("pagination");
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
delete $sessionStorage.pagination;
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
});
// ----------
// Add Button
// ----------
$(".btnAdd").on("click", function () {
$sessionStorage.action = "Statuses.addStatus";
$sessionStorage.addStatus = "Statuses.setupStatuses";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -----------
// Done Button
// -----------
$(".btnDone").on("click", function () {
formSubmit({action: ""});
});
// ----
// Edit
// ----
$("#statuses-table tbody").on("click touch", "tr", function (e) {
e.preventDefault();
$sessionStorage.action = "Statuses.editStatus";
$sessionStorage.status_serial = $(this).data("status-serial");
$sessionStorage.editStatus = "Statuses.setupStatuses";
$sessionStorage.deleteStatus = "Statuses.setupStatuses";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -------------------
// 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");
});
+189
View File
@@ -0,0 +1,189 @@
// ===================
// Setup Subscriptions
// ===================
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -----------
// Find Button
// -----------
$(".btnFind").on("click", function () {
$sessionStorage.action = "Subscriptions.setupSubscriptions";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
$("#find_subscription").on("keyup", function (e) {
if (e.key === "Enter") {
$(".btnFind").trigger("click");
}
});
// -----------------
// Clear Find Button
// -----------------
$(".btnClearFind").on("click", function () {
$("#find_subscription").val("").trigger("change");
$sessionStorage.action = "Subscriptions.setupSubscriptions";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// ------------------
// Pagination Buttons
// ------------------
$(".btnPagination").on("click", function () {
$sessionStorage.action = "Subscriptions.setupSubscriptions";
$sessionStorage.pagination = $(this).data("pagination");
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
delete $sessionStorage.pagination;
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
});
// ----------
// Add Button
// ----------
$(".btnAdd").on("click", function () {
$sessionStorage.action = "Subscriptions.addSubscription";
$sessionStorage.addSubscription = "Subscriptions.setupSubscriptions";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -----------
// Done Button
// -----------
$(".btnDone").on("click", function () {
formSubmit({action: ""});
});
// ----
// Edit
// ----
$("#subscriptions-table tbody").on("click touch", "tr", function (e) {
e.preventDefault();
$sessionStorage.action = "Subscriptions.editSubscription";
$sessionStorage.subscription_serial = $(this).data("subscription-serial");
$sessionStorage.editSubscription = "Subscriptions.setupSubscriptions";
$sessionStorage.deleteSubscription = "Subscriptions.setupSubscriptions";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -------------------
// 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");
});
+223
View File
@@ -0,0 +1,223 @@
// ===========
// Setup Users
// ===========
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -----------
// Find Button
// -----------
$(".btnFind").on("click", function () {
$sessionStorage.action = "Users.setupUsers";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
$("#spinner-dialog").modal("show");
formSubmit($sessionStorage);
});
$("#find_user").on("keyup", function (e) {
if (e.key === "Enter") {
$(".btnFind").trigger("click");
}
});
// -----------------
// Clear Find Button
// -----------------
$(".btnClearFind").on("click", function () {
$("#find_user").val("").trigger("change");
$sessionStorage.action = "Users.setupUsers";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
$("#spinner-dialog").modal("show");
formSubmit($sessionStorage);
});
// ------------------
// Pagination Buttons
// ------------------
$(".btnPagination").on("click", function () {
$sessionStorage.action = "Users.setupUsers";
$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));
});
// ---------------
// Add User Button
// ---------------
$(".btnAdd").on("click", function () {
$sessionStorage.action = "Users.addUser";
$sessionStorage.addUser = "Users.setupUsers";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -----------
// Done Button
// -----------
$(".btnDone").on("click", function () {
formSubmit({action: ""});
});
// ----
// Edit
// ----
// $("#users-table tbody").on("click touch", "tr", function (e) {
//
// e.preventDefault();
//
// $sessionStorage.action = "Users.userSummary";
// $sessionStorage.user_serial = $(this).data("user-serial");
// $sessionStorage.editUser = "Users.setupUsers";
//
// sessionStorage.setItem($application, JSON.stringify($sessionStorage));
//
// formSubmit($sessionStorage);
//
// });
// ------------
// User Summary
// ------------
$("#users-table tbody").on("click touch", "tr", function (e) {
e.preventDefault();
$sessionStorage.action = "Users.userSummary";
$sessionStorage.user_serial = $(e.target).closest("tr").data("user-serial");
$sessionStorage.userSummary = "Users.setupUsers";
$sessionStorage.userSummary_tab = "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -------------------
// 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
// -----------------
$("#users_per_page").on("change", function () {
$(".btnFind").trigger("click");
});
});
+122
View File
@@ -0,0 +1,122 @@
// =======
// Sign In
// =======
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// =================
// Process Enter Key
// =================
$(document).on('keypress', function (e) {
if (e.which == 13) {
e.preventDefault();
$("#signIn").submit();
}
});
// -----------
// Save Button
// -----------
$(".btnSignIn").on("click", function (e) {
e.preventDefault();
$("#signIn").submit();
});
// ---------------
// Validate Inputs
// ---------------
$("#signIn").submit(function (e) {
var user_name = $("#user_name"), user_password = $("#user_password");
clearInputErrors();
user_name.val(user_name.val().replace(/\s+/g, " ").trim());
if (isBlank(user_name)) {
createInputError(user_name, "User Name/Email is required");
return false;
}
if (isBlank(user_password)) {
createInputError(user_password, "Password is required");
return false;
}
return true;
});
});
// --------------------------------
// Clear the Error State for Inputs
// --------------------------------
function clearInputErrors() {
$(".is-invalid").removeClass("is-invalid");
$(".invalid-feedback").remove();
}
// --------------------
// Test for Blank Value
// --------------------
function isBlank(object) {
if ($.trim(object.val()).length == 0) {
return true;
} else {
return false;
}
}
// -----------------------------------
// Create an Error State for an Input.
// -----------------------------------
function createInputError(input, message = "", scroll = false) {
if ($(input).hasClass("search-dropdown")) { // Select Picker
$(input).closest(".bootstrap-select")
.find(".bs-placeholder")
.addClass("is-invalid")
.after("<div class='invalid-feedback fs-875'>" + message + "</div>")
.focus();
} else {
$(input).focus().addClass("is-invalid");
if ($(input).is(":last-child")) {
$(input).after("<div class='invalid-feedback text-center'>" + message + "</div>");
} else {
$(input).siblings(":last").after("<div class='invalid-feedback'>" + message + "</div>");
}
}
if (scroll === true) {
var element = document.getElementById(input.attr("id"));
var header_offset = 130;
var element_position = element.getBoundingClientRect().top;
var offset_position = element_position + window.pageYOffset - header_offset;
window.scrollTo({
top: offset_position,
behavior: "smooth"
});
}
}
+187
View File
@@ -0,0 +1,187 @@
// ====================
// Start Support Ticket
// ====================
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(),
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}"),
$CKEditor;
// ----------------------
// Initialize the Editor.
// ----------------------
ClassicEditor
.create(document.querySelector('#supportticket_message'), {
toolbar: {
items: [
'heading',
'|',
'bold',
'italic',
'underline',
'link',
'bulletedList',
'numberedList',
'|',
'fontColor',
'fontSize',
'fontFamily',
'|',
'indent',
'outdent',
'alignment',
'|',
'horizontalLine',
'insertTable',
'|',
'undo',
'redo',
'|'
]},
link: {
addTargetToExternalLinks: true,
defaultProtocol: "http://"
}
})
.then(editor => {
$CKEditor = editor;
})
.catch(error => {
console.error('CK-Editor error...');
console.error(error);
});
// -----------
// Save Button
// -----------
$(".btnSubmit").on("click", function (e) {
e.preventDefault();
$("#startSupportTicket").submit();
});
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", function () {
$sessionStorage.action = $sessionStorage.startSupportTicket || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// ---------------------
// Show "Other Category"
// ---------------------
$('#supportticket_category').on('change', function () {
const isOther =
$(this).find('option:selected').data('tokens') === 'Other';
$('.other_catagory').toggleClass('d-none', !isOther);
if (!isOther) {
$('#supportticket_category_other').val('');
}
});
// ---------------
// Validate Inputs
// ---------------
$("#startSupportTicket").submit(function (e) {
var supportticket_subject = $("#supportticket_subject"),
supportticket_category = $("#supportticket_category"),
supportticket_category_other = $("#supportticket_category_other"),
supportticket_message = $("#supportticket_message");
clearInputErrors();
supportticket_subject.val(supportticket_subject.val().replace(/\s+/g, " ").trim());
supportticket_category.val(supportticket_category.val().replace(/\s+/g, " ").trim());
if (isBlank(supportticket_subject)) {
createInputError(supportticket_subject, "Subject is required");
return false;
}
if ($("option:selected", supportticket_category).val() === "") {
createInputError(supportticket_category, "Catagory is required");
return false;
}
if ($("option:selected", supportticket_category).data('tokens') === "Other" && isBlank(supportticket_category_other)) {
createInputError(supportticket_category_other, "Other Catagory is required");
return false;
}
// Make sure editor is ready
const html = ($CKEditor) ? $CKEditor.getData() : "";
// Convert HTML -> plain text and trim (handles <p>&nbsp;</p> etc.)
const text = html
.replace(/<[^>]*>/g, " ")
.replace(/&nbsp;/g, " ")
.replace(/\s+/g, " ")
.trim();
if (!text) {
// highlight editor UI (not just hidden textarea)
const editableEl = $CKEditor?.ui?.view?.editable?.element;
if (editableEl)
$(editableEl).addClass("is-invalid");
createInputError(supportticket_message, "Message is required");
return false;
}
e.preventDefault();
$CKEditor.updateSourceElement();
// show spinner + prevent double submit
$("#ticketSending").removeClass("d-none");
$(".btnSubmit, .btnCancel").prop("disabled", true);
$.post("./", $(this).serialize())
.done(function () {
$sessionStorage.action = $sessionStorage.startSupportTicket || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
})
.fail(function () {
// show a friendly message (optional)
alert("Something went wrong sending the ticket. Please try again.");
})
.always(function () {
// hide spinner + re-enable buttons
$("#ticketSending").addClass("d-none");
$(".btnSubmit, .btnCancel").prop("disabled", false);
});
});
});
+106
View File
@@ -0,0 +1,106 @@
// ==============
// Add Attachment
// ==============
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
$("input[name = 'uploadCSVFile_object']", "#uploadCSVFile").val($sessionStorage.uploadCSVFile_object);
$("input[name = 'uploadCSVFile_serial']", "#uploadCSVFile").val($sessionStorage.uploadCSVFile_serial);
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", function () {
$sessionStorage.action = "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// ----------------------------
// Process Attachmet File Input
// ----------------------------
// Disable standard Drag/Drop processing.
$("html").on("dragenter dragover dragleave", function (e) {
e.preventDefault();
e.stopPropagation();
});
// Allow Drop only on the file input
$("html").on("drop", function (e) {
if (e.target.type === "file") {
return;
}
e.preventDefault();
e.stopPropagation();
});
// Process a Selection or Drop.
$(".file-input").on("change", function (e) {
if ((e.target.files.length === 0) || (e.target.files[0].type !== "text/csv")) {
return false;
}
var documentName = $(this).val().split("\\").pop(),
extension = documentName.substr((documentName.lastIndexOf(".") + 1), documentName.length).toLowerCase();
if (extension !== "csv") {
return false;
}
$(".btnUpload").attr("disabled", false);
});
// -------------
// Upload Button
// -------------
$(".btnUpload").on("click", function (e) {
$("#spinner-dialog").modal("show");
e.preventDefault();
var uploadCSVFile_form = new FormData($("#uploadCSVFile")[0]);
$.ajax({
url: "./",
method: "POST",
data: uploadCSVFile_form,
async: true,
processData: false,
contentType: false
})
.done(function () {
$sessionStorage.action = "";
$sessionStorage.toast = "RDI Records Imported";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
});
+53
View File
@@ -0,0 +1,53 @@
// ==================
// User Subscriptions
// ==================
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -------------------
// Subscriptions Table
// -------------------
$("#usersubscription-table tbody").on("click touch", "tr", function (e) {
e.preventDefault();
let subscription_status = $(this).find("td.usersubscription_status").text().trim(); // Adjust class as needed
if (subscription_status === "EXPIRED") {
$("#continue-dialog .modal-header")
.removeClass()
.addClass("modal-header bg-danger p-1 ps-3")
.html('<i class="bi bi-cone-striped text-white me-2"></i> <span class="text-white">Subscription Expired</span>');
$("#continue-dialog .btnClose")
.removeClass("btn-primary")
.addClass("btn-danger");
$("#continue-dialog")
.removeClass()
.addClass("modal confirm-delete-note")
.find(".modal-title").html("Subscription Expired").end()
.find(".modal-body").html("This subscription has expired. Please contact sales to renew.").end()
.modal("show");
return;
}
$("#spinner-dialog").modal("show");
$sessionStorage.action = "Subscriptions.goToSubscription";
$sessionStorage.subscription_serial = $(this).data("subscription-serial");
$sessionStorage.userSubscriptions = "Subscriptions.userSubscriptions";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
+283
View File
@@ -0,0 +1,283 @@
// ============
// User Summary
// ============
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
var default_tab = "Subscriptions";
var user_role = $("#USER_ROLE").val();
//
// --------------
// 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});
// -----------
// Input Masks
// -----------
$(".date-mask").inputmask({alias: "datetime",
inputFormat: "mm/dd/yyyy",
placeholder: "MM/DD/YYYY",
showMaskOnHover: false});
$(".numeric-mask").inputmask("9{0,9}", {showMaskOnHover: false});
$(".numeric-2-mask").inputmask({alias: "numeric",
showMaskOnHover: false,
placeholder: "0",
groupSeparator: ",",
allowMinus: false,
digitsOptional: false,
digits: 2});
// ------------
// Date Pickers
// ------------
$("#user_completed").datepicker({format: "mm-dd-yyyy",
container: "div.user_completed",
keyboardNavigation: false,
showOnFocus: false,
autoclose: true,
endDate: "0d",
orientation: "left bottom",
todayBtn: "linked",
todayHighlight: true});
// Disable standard Drag/Drop processing.
$("html").on("dragenter dragover dragleave drop", function (e) {
e.preventDefault();
});
// ---------------------------
// Set and Show the Active Tab
// --------------------------
$sessionStorage.userSummary_tab = $sessionStorage.userSummary_tab || default_tab;
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
$("#tab-" + ($sessionStorage.userSummary_tab || default_tab)).tab("show");
// --------------------
// Capture a Tab Change
// --------------------
$(".nav-tabs a[data-bs-toggle='tab']").on("shown.bs.tab", function (e) {
$sessionStorage.userSummary_tab = $(e.target).attr("data-tab");
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
});
// ----------------------
// Active Status Dropdown
// ----------------------
$("#user_active").on("change", function () {
formPost({action: "Users.updateActiveStatus", user_serial: $sessionStorage.user_serial, user_active: $(this).val()});
location.reload();
});
// --------------------
// Reset Users Password
// ---------------------
$(".btnResetPassword").on("click", function () {
formPost({action: "Users.resetPassword", user_serial: $sessionStorage.user_serial});
$sessionStorage.toast = "Passsword Reset";
location.reload();
});
// ==============
// Action Buttons
// ==============
// -----------
// Done Button
// -----------
$(".btnDone").on("click", function () {
$sessionStorage.action = $sessionStorage.userSummary || "";
formSubmit($sessionStorage);
});
// -----------
// Edit Button
// -----------
$(".btnEdit").on("click", function () {
if (user_role === "Guest") {
return false;
}
$sessionStorage.action = "Users.editUser";
$sessionStorage.editUser = "Users.userSummary";
$sessionStorage.deleteUser = "Users.setupUsers";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// ------------
// Print Button
// ------------
$(".btnPrint").on("click", function (e) {
e.preventDefault();
window.open("", "PrintTab");
$("input[name = 'user_serial']", "#PrintUserSummaryForm").val($sessionStorage.user_serial);
$("#PrintUserSummaryForm").submit();
});
// -------------
// Delete Button
// -------------
$(".btnDelete").on("click", function () {
$("#confirm-dialog").removeClass().addClass("modal confirm-delete-user")
.find(".modal-title").html("Confirm Delete User").end()
.find(".modal-body").html("Are you sure you wish to delete this User?").end()
.modal("show");
});
$("body").on("click", ".confirm-delete-user .btnConfirmDialogConfirm", function () {
$.post("./", {action: "Users.deleteUser", user_serial: $sessionStorage.user_serial})
.done(function () {
$sessionStorage.action = $sessionStorage.deleteUser || "";
$sessionStorage.toast = "User was Deleted";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
// =========
// Notes Tab
// =========
// ---------------
// Add Note Button
// ---------------
$(".btnAddNote").on("click", function () {
$sessionStorage.action = "Notes.addNote";
$sessionStorage.note_type = "User";
$sessionStorage.note_reference = $sessionStorage.user_serial;
$sessionStorage.addNote = "Users.userSummary";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// ---------
// Edit Note
// ---------
$("#notes-table tbody").on("click touch", "tr", function (e) {
e.preventDefault();
if (user_role === "Guest") {
return false;
}
$sessionStorage.action = "Notes.editNote";
$sessionStorage.note_serial = $(this).data("note-serial");
$sessionStorage.editNote = "Users.userSummary";
$sessionStorage.deleteNote = "Users.userSummary";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// =================
// Subscriptions Tab
// =================
// -------------------------------
// Add Subscription to User Button
// -------------------------------
$(".btnAddSubscription").on("click", function () {
$sessionStorage.action = "Subscriptions.addSubscriptionToUser";
$sessionStorage.user_reference = $sessionStorage.user_serial;
$sessionStorage.addSubscriptionToUser = "Users.userSummary";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// --------------------------------
// Edit Subscription to User Button
// --------------------------------
$("#usersubscriptions-table tbody").on("click touch", "tr", function (e) {
e.preventDefault();
if (user_role === "Guest") {
return false;
}
$sessionStorage.action = "Subscriptions.editUsersSubscription";
$sessionStorage.usersubscription_serial = $(this).data("usersubscription-serial");
$sessionStorage.editUsersSubscription = "Users.userSummary";
$sessionStorage.deleteUsersSubscription = "Users.userSummary";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
+187
View File
@@ -0,0 +1,187 @@
// ============
// View Journal
// ============
$(document).ready(function() {
var $application = "ATLHOUSINGREPORT",
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -----------
// Find Button
// -----------
$(".btnFind").on("click", function() {
$sessionStorage.action = "Journal.viewJournal";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
$("#spinner-dialog").modal("show");
formSubmit($sessionStorage);
});
$("#find_journal").on("keyup", function(e) {
if (e.key === "Enter") {
$(".btnFind").trigger("click");
}
});
// -----------------
// Clear Find Button
// -----------------
$(".btnClearFind").on("click", function() {
$("#find_journal").val("").trigger("change");
$sessionStorage.action = "Journal.viewJournal";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
$("#spinner-dialog").modal("show");
formSubmit($sessionStorage);
});
// ------------------
// Pagination Buttons
// ------------------
$(".btnPagination").on("click", function() {
$sessionStorage.action = "Journal.viewJournal";
$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));
});
// -----------
// Done Button
// -----------
$(".btnDone").on("click", function() {
formSubmit({ action : "" });
});
// --------------
// Refresh Button
// --------------
$(".btnRefresh").on("click", function() {
window.location.reload();
});
// ---------------------
// Clear Journal Button.
// ---------------------
$(".btnClear").on("click", function() {
$("#confirm-dialog").removeClass().addClass("modal confirm-clear-journal")
.find(".modal-title").html("Confirm Clear Journal").end()
.find(".modal-body").html("Are you sure you wish to Clear the Journal?").end()
.modal("show");
});
$("body").on("click", ".confirm-clear-journal .btnConfirmDialogConfirm", function() {
$.post("./", { action : "Journal.clearJournal" })
.done(function() {
$sessionStorage.toast = "Journal was Cleared";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
window.location.reload();
});
});
// -------------------
// 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
// -----------------
$("#journals_per_page").on("change", function() {
$(".btnFind").trigger("click");
});
});
+379
View File
@@ -0,0 +1,379 @@
// ======================
// Manage Support Tickets
// ======================
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// --------------------
// Initialize Dropdowns
// --------------------
$("#supporttickets_per_page").val($sessionStorage.supporttickets_per_page || "20");
// -----------
// Find Button
// -----------
$(".btnFind").on("click", function () {
$sessionStorage.action = "SupportTickets.viewSupportTickets";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
$("#spinner-dialog").modal("show");
formSubmit($sessionStorage);
});
$("#find_supportticket").on("keyup", function (e) {
if (e.key === "Enter") {
$(".btnFind").trigger("click");
}
});
// -----------------
// Clear Find Button
// -----------------
$(".btnClearFind").on("click", function () {
$("#find_supportticket").val("").trigger("change");
$sessionStorage.action = "SupportTickets.viewSupportTickets";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
$("#spinner-dialog").modal("show");
formSubmit($sessionStorage);
});
// ---------------
// Per Page Change
// ---------------
$("#supporttickets_per_page").on("change", function () {
$sessionStorage.supporttickets_per_page = $(this).val();
$sessionStorage.action = "SupportTickets.viewSupportTickets";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
$("#spinner-dialog").modal("show");
formSubmit($sessionStorage);
});
// ------------------
// Pagination Buttons
// ------------------
$(".btnPagination").on("click", function () {
$sessionStorage.action = "SupportTickets.viewSupportTickets";
$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));
});
// ----------
// Add Button
// ----------
$(".btnAdd").on("click", function () {
$sessionStorage.action = "SupportTickets.addSupportTicket";
$sessionStorage.addRDI = "SupportTickets.viewSupportTickets";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -----------
// Done Button
// -----------
$(".btnDone").on("click", function () {
formSubmit({action: ""});
});
// --------------
// Refresh Button
// --------------
$(".btnRefresh").on("click", function () {
$sessionStorage.action = "SupportTickets.viewSupportTickets";
$sessionStorage.pagination = "first";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
$("#spinner-dialog").modal("show");
formSubmit($sessionStorage);
});
// ----------------------
// Support Ticket Summary
// ----------------------
$("#supporttickets-table tbody td:not('.selection-checkboxes')").on("click touch", function (e) {
e.preventDefault();
$sessionStorage.action = "SupportTickets.viewSupportTicketSummary";
$sessionStorage.supportticket_serial = $(e.target).closest("tr").data("supportticket-serial");
$sessionStorage.supportTicketSummary = "SupportTickets.viewSupportTickets";
$sessionStorage.editSupportTicket = "SupportTickets.viewSupportTickets";
$sessionStorage.deleteSupportTicket = "SupportTickets.viewSupportTickets";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// -------------------
// Column Heading Sort
// -------------------
if (($sessionStorage.supporttickets_order_by || "") !== "") {
$("th[data-order-by = '" + ($sessionStorage.supporttickets_order_by || "") + "']").append('<i class="' + ($sessionStorage.supporttickets_order_icon || "") + ' text-danger ms-1 me-0"/>');
}
$("th.sortable").on("click", function (e) {
if ($(e.target).data("order-by") !== ($sessionStorage.supporttickets_order_by || "")) { // New Column
$sessionStorage.supporttickets_order_by = $(e.target).data("order-by");
$sessionStorage.supporttickets_order_direction = "asc";
$sessionStorage.supporttickets_order_icon = "bi bi-arrow-up";
} else {
switch ($sessionStorage.supporttickets_order_direction) {
case "" :
$sessionStorage.supporttickets_order_by = $(e.target).data("order-by");
$sessionStorage.supporttickets_order_direction = "asc";
$sessionStorage.supporttickets_order_icon = "bi bi-arrow-up";
break;
case "asc" :
$sessionStorage.supporttickets_order_by = $(e.target).data("order-by");
$sessionStorage.supporttickets_order_direction = "desc";
$sessionStorage.supporttickets_order_icon = "bi bi-arrow-down";
break;
case "desc" :
$sessionStorage.supporttickets_order_by = "";
$sessionStorage.supporttickets_order_direction = "";
$sessionStorage.supporttickets_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, .btnPrintSelected").removeClass("d-none");
});
// -------------------
// Deselect All Button
// -------------------
$(".btnDeselectAll").on("click", function (e) {
e.preventDefault();
$(".selection-checkbox:input:checkbox").prop("checked", false);
$(".btnDeselectAll, .btnPrintSelected").addClass("d-none");
});
// ------------------------
// Toggle a Select Checkbox
// ------------------------
$(".supportticket-row").on("click touch", function (e) {
if (!($(e.target).hasClass("selection-area"))) {
return false;
}
;
e.preventDefault();
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, .btnPrintSelected").addClass("d-none");
} else {
$(".btnDeselectAll, .btnPrintSelected").removeClass("d-none");
}
});
// ---------------------------------
// Print Selected Work Orders 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']", "#PrintRDIForm").val("print");
$("input[name = 'selected_supporttickets']", "#PrintRDIForm").val(selected);
$("#PrintRDIForm").submit();
});
// -------------------
// 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
// -----------------
$("#supporttickets_per_page").on("change", function () {
$(".btnFind").trigger("click");
});
});