First git push to github
This commit is contained in:
+255
@@ -0,0 +1,255 @@
|
||||
|
||||
// =========
|
||||
// Add Alert
|
||||
// =========
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}"), $CKEditor;
|
||||
|
||||
// ----------------------
|
||||
// Initialize the Editor.
|
||||
// ----------------------
|
||||
|
||||
ClassicEditor
|
||||
.create(document.querySelector('#alert_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);
|
||||
});
|
||||
|
||||
|
||||
// ------------
|
||||
// Date Pickers
|
||||
// ------------
|
||||
|
||||
$("#alert_starts_date").datepicker({format: "yyyy-mm-dd",
|
||||
container: "div.starts-date",
|
||||
keyboardNavigation: false,
|
||||
autoclose: true,
|
||||
orientation: "bottom",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true});
|
||||
|
||||
$("#alert_expires_date").datepicker({format: "yyyy-mm-dd",
|
||||
container: "div.expires-date",
|
||||
keyboardNavigation: false,
|
||||
autoclose: true,
|
||||
orientation: "bottom",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true});
|
||||
|
||||
$("#alert_starts_time").inputmask({alias: "datetime",
|
||||
placeholder: "HH:MM",
|
||||
inputFormat: "HH:MM",
|
||||
insertMode: false,
|
||||
showMaskOnHover: false,
|
||||
hourFormat: 24
|
||||
});
|
||||
|
||||
$("#alert_expires_time").inputmask({alias: "datetime",
|
||||
placeholder: "HH:MM",
|
||||
inputFormat: "HH:MM",
|
||||
insertMode: false,
|
||||
showMaskOnHover: false,
|
||||
hourFormat: 24
|
||||
});
|
||||
|
||||
// ---------------------
|
||||
// Show Calendar Buttons
|
||||
// ---------------------
|
||||
|
||||
$(".btnAlertStartDateCalendar").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$("#alert_starts_date").focus().datepicker("show");
|
||||
});
|
||||
|
||||
$(".btnAlertExpiresDateCalendar").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$("#alert_expires_date").focus().datepicker("show");
|
||||
});
|
||||
|
||||
|
||||
$("#alert_starts_date").on("blur", function () {
|
||||
$("#alert_starts_time").focus();
|
||||
});
|
||||
|
||||
$("#alert_expires_date").on("blur", function () {
|
||||
$("#alert_expires_time").focus();
|
||||
});
|
||||
|
||||
// -----------
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$("#addAlert").submit();
|
||||
|
||||
});
|
||||
|
||||
// -------------
|
||||
// Cancel Button
|
||||
// -------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addAlert || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#addAlert").submit(function (e) {
|
||||
|
||||
var alert_title = $("#alert_title"),
|
||||
alert_starts_date = $("#alert_starts_date"),
|
||||
alert_starts_time = $("#alert_starts_time"),
|
||||
alert_expires_date = $("#alert_expires_date"),
|
||||
alert_expires_time = $("#alert_expires_time"),
|
||||
alert_message = $("#alert_message");
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
alert_title.val(alert_title.val().replace(/\s+/g, " ").trim());
|
||||
|
||||
if (isBlank(alert_title)) {
|
||||
createInputError(alert_title, "Title is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if ((!isBlank(alert_starts_date)) && (!isDate(alert_starts_date))) {
|
||||
createInputError(alert_starts_date, "Date is invalid");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isBlank(alert_starts_time)) {
|
||||
createInputError(alert_starts_time, "Please enter a Time");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!alert_starts_time.inputmask("isComplete")) {
|
||||
createInputError(alert_starts_time, "Please enter a Time");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isBlank(alert_expires_date)) {
|
||||
createInputError(alert_expires_date, "Please enter a Date");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((!isBlank(alert_expires_date)) && (!isDate(alert_expires_date))) {
|
||||
createInputError(alert_expires_date, "Date is invalid");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isBlank(alert_expires_time)) {
|
||||
createInputError(alert_expires_time, "Please enter a Time");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!alert_expires_time.inputmask("isComplete")) {
|
||||
createInputError(alert_expires_time, "Please enter a Time");
|
||||
return false;
|
||||
}
|
||||
|
||||
// if (isBlank(alert_message)) {
|
||||
// createInputError(alert_message, "Please enter a Message");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
if (!checkDateTime(alert_starts_date, alert_starts_time, alert_expires_date, alert_expires_time)) {
|
||||
createInputError(alert_expires_time, "Cannot be prior to Start");
|
||||
return false;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$CKEditor.updateSourceElement();
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addAlert || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// -----------------------------------------------------
|
||||
// Expires date/time cannot be prior to Start date/time.
|
||||
// -----------------------------------------------------
|
||||
|
||||
function checkDateTime(alert_starts_date, alert_starts_time, alert_expires_date, alert_expires_time) {
|
||||
|
||||
var starts_date_parts = alert_starts_date.val().split("-"),
|
||||
starts_time_parts = alert_starts_time.val().split(":"),
|
||||
expires_date_parts = alert_expires_date.val().split("-"),
|
||||
expires_time_parts = alert_expires_time.val().split(":"),
|
||||
starts_date,
|
||||
expires_date;
|
||||
|
||||
starts_date = new Date(starts_date_parts[0], parseInt(starts_date_parts[1], 10) - 1, starts_date_parts[2]);
|
||||
expires_date = new Date(expires_date_parts[0], parseInt(expires_date_parts[1], 10) - 1, expires_date_parts[2]);
|
||||
|
||||
starts_date.setHours(starts_time_parts[0], starts_time_parts[1], 0, 0);
|
||||
expires_date.setHours(expires_time_parts[0], expires_time_parts[1], 0, 0);
|
||||
|
||||
if (expires_date.getTime() < starts_date.getTime()) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
|
||||
// ==========
|
||||
// Add City
|
||||
// ==========
|
||||
|
||||
$(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();
|
||||
$("#addCity").submit();
|
||||
});
|
||||
|
||||
// --------------
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addCity || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#addCity").submit(function (e) {
|
||||
|
||||
var city_name = $("#city_name"), city_area = $("#city_area");
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
city_name.val(trimString(city_name.val()));
|
||||
|
||||
if (isBlank(city_name)) {
|
||||
createInputError(city_name, "Name is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (formPost({action: "Cities.cityExists", city_serial: 0, city_name: city_name.val()}) === true) {
|
||||
createInputError(city_name, "Name already exists");
|
||||
return false;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
.done(function () {
|
||||
formSubmit({action: $sessionStorage.addCity});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,82 @@
|
||||
|
||||
// ========================
|
||||
// Add City to 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();
|
||||
|
||||
$("#addCityToSubscription").submit();
|
||||
|
||||
});
|
||||
|
||||
// --------------
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addCityToSubscription || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#addCityToSubscription").submit(function (e) {
|
||||
|
||||
var city_name = $("#city_serial");
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
if ($("option:selected", city_name).val() === "") {
|
||||
createInputError(city_name, "Please select a city");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addCityToSubscription || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,78 @@
|
||||
|
||||
// ==========
|
||||
// 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;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
.done(function () {
|
||||
formSubmit({action: $sessionStorage.addCounty});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,82 @@
|
||||
|
||||
// =========================
|
||||
// Add County toSubscription
|
||||
// =========================
|
||||
|
||||
$(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();
|
||||
|
||||
$("#addCountyToSubscription").submit();
|
||||
|
||||
});
|
||||
|
||||
// --------------
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addCountyToSubscription || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#addCountyToSubscription").submit(function (e) {
|
||||
|
||||
var county_name = $("#county_serial");
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
if ($("option:selected", county_name).val() === "") {
|
||||
createInputError(county_name, "Please select a county");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addCountyToSubscription || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,68 @@
|
||||
|
||||
// ============
|
||||
// Add Dropdown
|
||||
// ============
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$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);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,93 @@
|
||||
|
||||
// ================
|
||||
// Add Dropdowntype
|
||||
// ================
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$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);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -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);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -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);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,78 @@
|
||||
|
||||
// ==========
|
||||
// Add ProjectType
|
||||
// ==========
|
||||
|
||||
$(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();
|
||||
$("#addProjectType").submit();
|
||||
});
|
||||
|
||||
// --------------
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addProjectType || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#addProjectType").submit(function (e) {
|
||||
|
||||
var projecttype_name = $("#projecttype_name"), projecttype_area = $("#projecttype_area");
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
projecttype_name.val(trimString(projecttype_name.val()));
|
||||
|
||||
if (isBlank(projecttype_name)) {
|
||||
createInputError(projecttype_name, "Name is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (formPost({action: "ProjectTypes.projecttypeExists", projecttype_serial: 0, projecttype_name: projecttype_name.val()}) === true) {
|
||||
createInputError(projecttype_name, "Name already exists");
|
||||
return false;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
.done(function () {
|
||||
formSubmit({action: $sessionStorage.addProjectType});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -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);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,82 @@
|
||||
|
||||
// ============
|
||||
// Add SIC Code
|
||||
// ============
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// -----------
|
||||
// Input Masks
|
||||
// -----------
|
||||
|
||||
$("#siccode_code").inputmask("9{1,5}"); //mask with dynamic syntax
|
||||
|
||||
// -----------
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$("#addSICCode").submit();
|
||||
});
|
||||
|
||||
// -------------
|
||||
// Cancel Button
|
||||
// -------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addSICCode || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#addSICCode").submit(function (e) {
|
||||
|
||||
var siccode_code = $("#siccode_code"), siccode_description = $("#siccode_description");
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
siccode_code.val(trimString(siccode_code.val()));
|
||||
siccode_description.val(trimString(siccode_description.val()));
|
||||
|
||||
if (isBlank(siccode_code)) {
|
||||
createInputError(siccode_code, "Code is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (formPost({action: "SICCodes.siccodeExists", siccode_serial: 0, siccode_code: siccode_code.val()}) === true) {
|
||||
createInputError(siccode_code, "Code already exists");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isBlank(siccode_description)) {
|
||||
createInputError(siccode_description, "Description is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addSICCode || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,75 @@
|
||||
|
||||
// ==========
|
||||
// Add Status
|
||||
// ==========
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$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);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,91 @@
|
||||
|
||||
// ================
|
||||
// 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_project_type = $("#subscription_service_level");
|
||||
|
||||
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 ($("option:selected", subscription_project_type).val() === "") {
|
||||
createInputError(subscription_project_type, "Service Level 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);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,233 @@
|
||||
|
||||
// ========================
|
||||
// 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-start-date").each(function () {
|
||||
$(this).datepicker({
|
||||
format: "mm/dd/yyyy",
|
||||
container: $(this).closest(".subscription_start_date"),
|
||||
keyboardNavigation: false,
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
orientation: "bottom left",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true
|
||||
});
|
||||
});
|
||||
|
||||
$(".subscription-end-date").each(function () {
|
||||
$(this).datepicker({
|
||||
format: "mm/dd/yyyy",
|
||||
container: $(this).closest(".subscription_end_date"),
|
||||
keyboardNavigation: false,
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
orientation: "bottom left",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// ---------------------
|
||||
// Show Calendar Buttons
|
||||
// ---------------------
|
||||
|
||||
$(".btnSubscriptionStartDateCalendar").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
let start_date = $(this).siblings(".subscription-start-date");
|
||||
|
||||
if (!start_date.prop("disabled")) {
|
||||
start_date.focus().datepicker("show");
|
||||
}
|
||||
});
|
||||
|
||||
$(".btnSubscriptionEndDateCalendar").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
let end_date = $(this).siblings(".subscription-end-date");
|
||||
|
||||
if (!end_date.prop("disabled")) {
|
||||
end_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);
|
||||
|
||||
});
|
||||
|
||||
function setSubscriptionDateState(subscription_checkbox) {
|
||||
|
||||
let row = subscription_checkbox.closest("tr");
|
||||
let checked = subscription_checkbox.prop("checked");
|
||||
|
||||
row.find(".subscription-start-date, .subscription-end-date").prop("disabled", !checked);
|
||||
row.find(".btnSubscriptionStartDateCalendar, .btnSubscriptionEndDateCalendar").prop("disabled", !checked);
|
||||
|
||||
}
|
||||
|
||||
function parseSubscriptionDate(date_value) {
|
||||
|
||||
let parts = date_value.split("/");
|
||||
|
||||
return new Date(parts[2], parts[0] - 1, parts[1]);
|
||||
|
||||
}
|
||||
|
||||
$(".subscription-checkbox").each(function () {
|
||||
setSubscriptionDateState($(this));
|
||||
});
|
||||
|
||||
$(".subscription-checkbox").on("change", function () {
|
||||
|
||||
let totalSubscriptions = $(".subscription-checkbox").length;
|
||||
let checkedSubscriptions = $(".subscription-checkbox:checked").length;
|
||||
|
||||
$("#selectAllSubscriptions").prop("checked", totalSubscriptions === checkedSubscriptions);
|
||||
setSubscriptionDateState($(this));
|
||||
|
||||
});
|
||||
|
||||
$("#selectAllSubscriptions").on("change", function () {
|
||||
|
||||
$(".subscription-checkbox").prop("checked", $(this).prop("checked")).each(function () {
|
||||
setSubscriptionDateState($(this));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#addSubscriptionToUser").submit(function (e) {
|
||||
|
||||
let receiving_user = $("#receiving_user_serial");
|
||||
let checkedSubscriptions = $(".subscription-checkbox:checked");
|
||||
|
||||
clearInputErrors();
|
||||
$("#subscriptions_errors").addClass("d-none");
|
||||
|
||||
// Validate at least one subscription selected
|
||||
if (checkedSubscriptions.length === 0) {
|
||||
e.preventDefault();
|
||||
$("#subscriptions_errors").removeClass("d-none");
|
||||
return false;
|
||||
}
|
||||
|
||||
for (let i = 0; i < checkedSubscriptions.length; i++) {
|
||||
|
||||
let row = checkedSubscriptions.eq(i).closest("tr");
|
||||
let start_date = row.find(".subscription-start-date");
|
||||
let end_date = row.find(".subscription-end-date");
|
||||
|
||||
if (isBlank(start_date)) {
|
||||
createInputError(start_date, "Date is required");
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((!isBlank(start_date)) && (!start_date.inputmask("isComplete"))) {
|
||||
createInputError(start_date, "Date is incomplete");
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isBlank(end_date)) {
|
||||
createInputError(end_date, "Date is required");
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((!isBlank(end_date)) && (!end_date.inputmask("isComplete"))) {
|
||||
createInputError(end_date, "Date is incomplete");
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (parseSubscriptionDate(end_date.val()) < parseSubscriptionDate(start_date.val())) {
|
||||
createInputError(start_date, "Date is after End Date");
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Validate receiving user
|
||||
if (receiving_user.val() === "") {
|
||||
createInputError(receiving_user, "Receiving user is required");
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addSubscriptionToUser || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
+136
@@ -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});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -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);
|
||||
@@ -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");
|
||||
+439
@@ -0,0 +1,439 @@
|
||||
|
||||
// ==============
|
||||
// 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();
|
||||
|
||||
}
|
||||
|
||||
// ---------------------------------------------
|
||||
// Clear Subscription Specific Session Variables
|
||||
// ---------------------------------------------
|
||||
|
||||
function clearSubscriptionSessionVariableFilters(sessionObj = {}) {
|
||||
|
||||
const serial = parseInt(sessionObj.subscription_serial, 10);
|
||||
|
||||
const BUSINESSFACT_KEYS = [
|
||||
'businessfact_company',
|
||||
'businessfact_zip',
|
||||
'businessfact_city',
|
||||
'businessfact_county',
|
||||
'businessfact_business_class',
|
||||
'businessfact_action',
|
||||
'businessfact_sic_code',
|
||||
'businessfact_home_based_business',
|
||||
'businessfact_employee_count_from',
|
||||
'businessfact_employee_count_to',
|
||||
'businessfact_entry_date_from',
|
||||
'businessfact_entry_date_to',
|
||||
'businessfact_lease_end_from',
|
||||
'businessfact_lease_end_to',
|
||||
'pagination'
|
||||
];
|
||||
|
||||
const PERMITFACT_KEYS = [
|
||||
'permitfact_company',
|
||||
'permitfact_project_name',
|
||||
'permitfact_project_zip',
|
||||
'permitfact_project_city',
|
||||
'permitfact_county',
|
||||
'permitfact_project_type',
|
||||
'permitfact_work_type',
|
||||
'permitfact_building_type',
|
||||
'permitfact_size_from',
|
||||
'permitfact_size_to',
|
||||
'permitfact_value_from',
|
||||
'permitfact_value_to',
|
||||
'permitfact_permit_date_from',
|
||||
'permitfact_permit_date_to',
|
||||
'permitfact_entry_date_from',
|
||||
'permitfact_entry_date_to',
|
||||
'pagination'
|
||||
];
|
||||
|
||||
const PZFACT_KEYS = [
|
||||
'pzfact_project_name',
|
||||
'pzfact_in_city_limit',
|
||||
'pzfact_project_city',
|
||||
'pzfact_county',
|
||||
'pzfact_project_type',
|
||||
'pzfact_action_code',
|
||||
'pzfact_acres_from',
|
||||
'pzfact_acres_to',
|
||||
'pzfact_entry_date_from',
|
||||
'pzfact_entry_date_to',
|
||||
'pagination'
|
||||
];
|
||||
|
||||
const BASIC_KEYS = [
|
||||
'week_start',
|
||||
'week_end'
|
||||
];
|
||||
|
||||
let keysToClear = [];
|
||||
|
||||
if ([7, 10].includes(serial)) {
|
||||
keysToClear = BUSINESSFACT_KEYS;
|
||||
} else if ([1, 2, 3, 4].includes(serial)) {
|
||||
keysToClear = PERMITFACT_KEYS;
|
||||
} else if ([6, 8].includes(serial)) {
|
||||
keysToClear = BASIC_KEYS;
|
||||
} else if ([5].includes(serial)) {
|
||||
keysToClear = PZFACT_KEYS;
|
||||
} else {
|
||||
return sessionObj;
|
||||
}
|
||||
|
||||
keysToClear.forEach(k => sessionObj[k] = '');
|
||||
|
||||
return sessionObj;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function clearSubsciptionSessionVariableFilters(sessionObj = {}) {
|
||||
|
||||
const keysToClear = SUBSCRIPTION_FILTER_KEYS[sessionObj.subscription_serial];
|
||||
|
||||
if (!keysToClear)
|
||||
return sessionObj;
|
||||
|
||||
keysToClear.forEach(k => sessionObj[k] = '');
|
||||
|
||||
return sessionObj;
|
||||
}
|
||||
|
||||
$(document).on('keydown', function (e) {
|
||||
|
||||
// Ctrl + Shift + F
|
||||
// if (e.ctrlKey && e.shiftKey && e.key.toLowerCase() === 'f') {
|
||||
if (e.ctrlKey && e.key.toLowerCase() === 'f') {
|
||||
|
||||
e.preventDefault(); // stop browser find
|
||||
|
||||
const $filter = $('#filter');
|
||||
|
||||
if ($filter.length) {
|
||||
$filter.focus().select(); // focus + highlight text
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(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));
|
||||
|
||||
}
|
||||
|
||||
// run once on load, then every minute
|
||||
checkExports();
|
||||
setInterval(checkExports, 10 * 1000);
|
||||
|
||||
});
|
||||
|
||||
let toastsShown = false;
|
||||
|
||||
function checkExports() {
|
||||
|
||||
let exports = formPost({action: "Export.checkUsersCompletedExports_AJAX"});
|
||||
|
||||
if (exports.notify === true) {
|
||||
|
||||
if (!toastsShown) {
|
||||
$(".toast-body").html("Exports Completed");
|
||||
$("#toast-message").toast("show");
|
||||
toastsShown = true;
|
||||
|
||||
const audio = new Audio('./assets/new-notification.mp3');
|
||||
|
||||
console.log(audio);
|
||||
|
||||
audio.volume = 1;
|
||||
audio.play().catch(() => {
|
||||
// ignored: autoplay restriction or tab not focused
|
||||
});
|
||||
}
|
||||
|
||||
$(".notify-flag").removeClass("d-none");
|
||||
}
|
||||
|
||||
}
|
||||
Vendored
+1
File diff suppressed because one or more lines are too long
Vendored
+3
File diff suppressed because one or more lines are too long
Vendored
+2039
File diff suppressed because it is too large
Load Diff
Vendored
+8
File diff suppressed because one or more lines are too long
Vendored
+3630
File diff suppressed because it is too large
Load Diff
Vendored
+7
File diff suppressed because one or more lines are too long
Vendored
+6294
File diff suppressed because it is too large
Load Diff
Vendored
+6
File diff suppressed because one or more lines are too long
Vendored
+4418
File diff suppressed because it is too large
Load Diff
Vendored
+6
File diff suppressed because one or more lines are too long
@@ -0,0 +1,43 @@
|
||||
|
||||
// ====================
|
||||
// Business Facts Basic
|
||||
// ====================
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// -------------
|
||||
// Cancel Button
|
||||
// -------------
|
||||
|
||||
$(".btnDone").on("click", function () {
|
||||
|
||||
$sessionStorage = clearSubscriptionSessionVariableFilters($sessionStorage);
|
||||
$sessionStorage.action = "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ------------------------
|
||||
// Run Business Facts Basic
|
||||
// ------------------------
|
||||
|
||||
$("[data-week-start][data-week-end]").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "BusinessFacts.businessFactsBasic";
|
||||
$sessionStorage.step = "results";
|
||||
|
||||
$sessionStorage.week_start = $(this).data("week-start");
|
||||
$sessionStorage.week_end = $(this).data("week-end");
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
@@ -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: "./"});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
Vendored
+13
File diff suppressed because one or more lines are too long
@@ -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);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
Vendored
+6
File diff suppressed because one or more lines are too long
+302
@@ -0,0 +1,302 @@
|
||||
// ============
|
||||
// Content Page
|
||||
// ============
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// ============
|
||||
// Navbar Links
|
||||
// ============
|
||||
|
||||
// ------------
|
||||
// Subscriptions
|
||||
// ------------
|
||||
|
||||
$(".user-subscriptions").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Subscriptions.usersSubscriptions";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
console.log($sessionStorage);
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// -------------
|
||||
// Users Exports
|
||||
// -------------
|
||||
|
||||
$(".user-exports").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Export.usersExports";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
console.log($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);
|
||||
|
||||
});
|
||||
|
||||
// ------
|
||||
// Cities
|
||||
// ------
|
||||
|
||||
$(".setup-cities").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Cities.setupCities";
|
||||
$sessionStorage.pagination = "first";
|
||||
$sessionStorage.find_city = "";
|
||||
|
||||
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);
|
||||
|
||||
});
|
||||
|
||||
// --------------
|
||||
// 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 Alerts
|
||||
// --------------
|
||||
|
||||
$(".setup-alerts").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Alerts.setupAlerts";
|
||||
$sessionStorage.pagination = "first";
|
||||
$sessionStorage.find_alert = "";
|
||||
|
||||
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 SIC Codes
|
||||
// ---------------
|
||||
|
||||
$(".setup-sic-codes").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "SICCodes.setupSICCodes";
|
||||
$sessionStorage.pagination = "first";
|
||||
$sessionStorage.find_siccode = "";
|
||||
|
||||
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);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
+227
@@ -0,0 +1,227 @@
|
||||
|
||||
// =========
|
||||
// Copy 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-start-date").each(function () {
|
||||
$(this).datepicker({
|
||||
format: "mm/dd/yyyy",
|
||||
container: $(this).closest(".subscription_start_date"),
|
||||
keyboardNavigation: false,
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
orientation: "bottom left",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true
|
||||
});
|
||||
});
|
||||
|
||||
$(".subscription-end-date").each(function () {
|
||||
$(this).datepicker({
|
||||
format: "mm/dd/yyyy",
|
||||
container: $(this).closest(".subscription_end_date"),
|
||||
keyboardNavigation: false,
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
orientation: "bottom left",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// ---------------------
|
||||
// Show Calendar Buttons
|
||||
// ---------------------
|
||||
|
||||
$(".btnSubscriptionStartDateCalendar").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
let start_date = $(this).siblings(".subscription-start-date");
|
||||
|
||||
if (!start_date.prop("disabled")) {
|
||||
start_date.focus().datepicker("show");
|
||||
}
|
||||
});
|
||||
|
||||
$(".btnSubscriptionEndDateCalendar").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
let end_date = $(this).siblings(".subscription-end-date");
|
||||
|
||||
if (!end_date.prop("disabled")) {
|
||||
end_date.focus().datepicker("show");
|
||||
}
|
||||
});
|
||||
|
||||
// ----------------------
|
||||
// Copy Privileges Button
|
||||
// ----------------------
|
||||
|
||||
$(".btnSave").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$("#copyUser").submit();
|
||||
});
|
||||
|
||||
// --------------
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.copyUser || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
function setSubscriptionDateState(subscription_checkbox) {
|
||||
|
||||
let row = subscription_checkbox.closest("tr");
|
||||
let checked = subscription_checkbox.prop("checked");
|
||||
|
||||
row.find(".subscription-start-date, .subscription-end-date").prop("disabled", !checked);
|
||||
row.find(".btnSubscriptionStartDateCalendar, .btnSubscriptionEndDateCalendar").prop("disabled", !checked);
|
||||
|
||||
}
|
||||
|
||||
function parseSubscriptionDate(date_value) {
|
||||
|
||||
let parts = date_value.split("/");
|
||||
|
||||
return new Date(parts[2], parts[0] - 1, parts[1]);
|
||||
|
||||
}
|
||||
|
||||
$(".subscription-checkbox").each(function () {
|
||||
setSubscriptionDateState($(this));
|
||||
});
|
||||
|
||||
$(".subscription-checkbox").on("change", function () {
|
||||
|
||||
let totalSubscriptions = $(".subscription-checkbox").length;
|
||||
let checkedSubscriptions = $(".subscription-checkbox:checked").length;
|
||||
|
||||
$("#selectAllSubscriptions").prop("checked", totalSubscriptions === checkedSubscriptions);
|
||||
setSubscriptionDateState($(this));
|
||||
|
||||
});
|
||||
|
||||
$("#selectAllSubscriptions").on("change", function () {
|
||||
|
||||
$(".subscription-checkbox").prop("checked", $(this).prop("checked")).each(function () {
|
||||
setSubscriptionDateState($(this));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#copyUser").on("submit", function (e) {
|
||||
|
||||
let receiving_user = $("#receiving_user_serial");
|
||||
let checkedSubscriptions = $(".subscription-checkbox:checked");
|
||||
|
||||
clearInputErrors();
|
||||
$("#subscriptions_errors").addClass("d-none");
|
||||
|
||||
// Validate at least one subscription selected
|
||||
if (checkedSubscriptions.length === 0) {
|
||||
e.preventDefault();
|
||||
$("#subscriptions_errors").removeClass("d-none");
|
||||
return false;
|
||||
}
|
||||
|
||||
for (let i = 0; i < checkedSubscriptions.length; i++) {
|
||||
|
||||
let row = checkedSubscriptions.eq(i).closest("tr");
|
||||
let start_date = row.find(".subscription-start-date");
|
||||
let end_date = row.find(".subscription-end-date");
|
||||
|
||||
if (isBlank(start_date)) {
|
||||
createInputError(start_date, "Date is required");
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((!isBlank(start_date)) && (!start_date.inputmask("isComplete"))) {
|
||||
createInputError(start_date, "Date is incomplete");
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isBlank(end_date)) {
|
||||
createInputError(end_date, "Date is required");
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((!isBlank(end_date)) && (!end_date.inputmask("isComplete"))) {
|
||||
createInputError(end_date, "Date is incomplete");
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (parseSubscriptionDate(end_date.val()) < parseSubscriptionDate(start_date.val())) {
|
||||
createInputError(start_date, "Date is after End Date");
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Validate receiving user
|
||||
if (receiving_user.val() === "") {
|
||||
createInputError(receiving_user, "Receiving user is required");
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.copyUser || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
Vendored
+1
File diff suppressed because one or more lines are too long
Vendored
+1
File diff suppressed because one or more lines are too long
+257
@@ -0,0 +1,257 @@
|
||||
|
||||
// ==========
|
||||
// Edit Alert
|
||||
// ==========
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}"), $CKEditor;
|
||||
|
||||
// ----------------------
|
||||
// Initialize the Editor.
|
||||
// ----------------------
|
||||
|
||||
ClassicEditor
|
||||
.create(document.querySelector('#alert_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);
|
||||
});
|
||||
|
||||
|
||||
// ------------
|
||||
// Date Pickers
|
||||
// ------------
|
||||
|
||||
$("#alert_starts_date").datepicker({format: "yyyy-mm-dd",
|
||||
container: "div.starts-date",
|
||||
keyboardNavigation: false,
|
||||
autoclose: true,
|
||||
orientation: "bottom",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true});
|
||||
|
||||
$("#alert_expires_date").datepicker({format: "yyyy-mm-dd",
|
||||
container: "div.expires-date",
|
||||
keyboardNavigation: false,
|
||||
autoclose: true,
|
||||
orientation: "bottom",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true});
|
||||
|
||||
$("#alert_starts_time").inputmask({alias: "datetime",
|
||||
placeholder: "HH:MM",
|
||||
inputFormat: "HH:MM",
|
||||
insertMode: false,
|
||||
showMaskOnHover: false,
|
||||
hourFormat: 24
|
||||
});
|
||||
|
||||
$("#alert_expires_time").inputmask({alias: "datetime",
|
||||
placeholder: "HH:MM",
|
||||
inputFormat: "HH:MM",
|
||||
insertMode: false,
|
||||
showMaskOnHover: false,
|
||||
hourFormat: 24
|
||||
});
|
||||
|
||||
// ---------------------
|
||||
// Show Calendar Buttons
|
||||
// ---------------------
|
||||
|
||||
$(".btnAlertStartDateCalendar").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$("#alert_starts_date").focus().datepicker("show");
|
||||
});
|
||||
|
||||
$(".btnAlertExpiresDateCalendar").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$("#alert_expires_date").focus().datepicker("show");
|
||||
});
|
||||
|
||||
|
||||
$("#alert_starts_date").on("blur", function () {
|
||||
$("#alert_starts_time").focus();
|
||||
});
|
||||
|
||||
$("#alert_expires_date").on("blur", function () {
|
||||
$("#alert_expires_time").focus();
|
||||
});
|
||||
|
||||
// -----------
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$("#editAlert").submit();
|
||||
|
||||
});
|
||||
|
||||
console.log($sessionStorage);
|
||||
|
||||
// -------------
|
||||
// Cancel Button
|
||||
// -------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editAlert || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#editAlert").submit(function (e) {
|
||||
|
||||
var alert_title = $("#alert_title"),
|
||||
alert_starts_date = $("#alert_starts_date"),
|
||||
alert_starts_time = $("#alert_starts_time"),
|
||||
alert_expires_date = $("#alert_expires_date"),
|
||||
alert_expires_time = $("#alert_expires_time"),
|
||||
alert_message = $("#alert_message");
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
alert_title.val(alert_title.val().replace(/\s+/g, " ").trim());
|
||||
|
||||
if (isBlank(alert_title)) {
|
||||
createInputError(alert_title, "Title is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if ((!isBlank(alert_starts_date)) && (!isDate(alert_starts_date))) {
|
||||
createInputError(alert_starts_date, "Date is invalid");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isBlank(alert_starts_time)) {
|
||||
createInputError(alert_starts_time, "Please enter a Time");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!alert_starts_time.inputmask("isComplete")) {
|
||||
createInputError(alert_starts_time, "Please enter a Time");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isBlank(alert_expires_date)) {
|
||||
createInputError(alert_expires_date, "Please enter a Date");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((!isBlank(alert_expires_date)) && (!isDate(alert_expires_date))) {
|
||||
createInputError(alert_expires_date, "Date is invalid");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isBlank(alert_expires_time)) {
|
||||
createInputError(alert_expires_time, "Please enter a Time");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!alert_expires_time.inputmask("isComplete")) {
|
||||
createInputError(alert_expires_time, "Please enter a Time");
|
||||
return false;
|
||||
}
|
||||
|
||||
// if (isBlank(alert_message)) {
|
||||
// createInputError(alert_message, "Please enter a Message");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
if (!checkDateTime(alert_starts_date, alert_starts_time, alert_expires_date, alert_expires_time)) {
|
||||
createInputError(alert_expires_time, "Cannot be prior to Start");
|
||||
return false;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$CKEditor.updateSourceElement();
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editAlert || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// -----------------------------------------------------
|
||||
// Expires date/time cannot be prior to Start date/time.
|
||||
// -----------------------------------------------------
|
||||
|
||||
function checkDateTime(alert_starts_date, alert_starts_time, alert_expires_date, alert_expires_time) {
|
||||
|
||||
var starts_date_parts = alert_starts_date.val().split("-"),
|
||||
starts_time_parts = alert_starts_time.val().split(":"),
|
||||
expires_date_parts = alert_expires_date.val().split("-"),
|
||||
expires_time_parts = alert_expires_time.val().split(":"),
|
||||
starts_date,
|
||||
expires_date;
|
||||
|
||||
starts_date = new Date(starts_date_parts[0], parseInt(starts_date_parts[1], 10) - 1, starts_date_parts[2]);
|
||||
expires_date = new Date(expires_date_parts[0], parseInt(expires_date_parts[1], 10) - 1, expires_date_parts[2]);
|
||||
|
||||
starts_date.setHours(starts_time_parts[0], starts_time_parts[1], 0, 0);
|
||||
expires_date.setHours(expires_time_parts[0], expires_time_parts[1], 0, 0);
|
||||
|
||||
if (expires_date.getTime() < starts_date.getTime()) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
|
||||
// ===========
|
||||
// Edit City
|
||||
// ===========
|
||||
|
||||
$(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();
|
||||
$("#editCity").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();
|
||||
$("#editCity").submit();
|
||||
});
|
||||
|
||||
// --------------
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editCity || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// -------------
|
||||
// Delete Button
|
||||
// -------------
|
||||
|
||||
$(".btnDelete").on("click", function () {
|
||||
|
||||
if (formPost({action: "Cities.cityActive", city_serial: $sessionStorage.city_serial}) === true) {
|
||||
|
||||
$("#continue-dialog").find(".modal-title").html("Cannot Delete City").end()
|
||||
.find(".modal-body").html("This City is in use and cannot be deleted.").end()
|
||||
.modal("show");
|
||||
|
||||
} else {
|
||||
|
||||
$("#confirm-dialog").removeClass().addClass("modal confirm-delete-city")
|
||||
.find(".modal-title").html("Confirm Delete City").end()
|
||||
.find(".modal-body").html("Are you sure you wish to delete this City?").end()
|
||||
.modal("show");
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$("body").on("click", ".confirm-delete-city .btnConfirmDialogConfirm", function () {
|
||||
|
||||
$.post("./", {action: "Cities.deleteCity", city_serial: $sessionStorage.city_serial})
|
||||
.done(function () {
|
||||
formSubmit({action: $sessionStorage.deleteCity});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#editCity").submit(function (e) {
|
||||
|
||||
var city_serial = $("#city_serial"),
|
||||
city_name = $("#city_name"),
|
||||
city_area = $("#city_area");
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
city_name.val(trimString(city_name.val()));
|
||||
|
||||
if (isBlank(city_name)) {
|
||||
createInputError(city_name, "Name is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (formPost({action: "Cities.cityExists", city_serial: city_serial.val(), city_name: city_name.val()}) === true) {
|
||||
createInputError(city_name, "Name already exists");
|
||||
return false;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
.done(function () {
|
||||
formSubmit({action: $sessionStorage.editCity});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -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});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,109 @@
|
||||
|
||||
// =============
|
||||
// Edit Dropdown
|
||||
// =============
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$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);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,134 @@
|
||||
|
||||
// =================
|
||||
// Edit Dropdowntype
|
||||
// =================
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$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);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -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);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,162 @@
|
||||
|
||||
// ============
|
||||
// Edit 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();
|
||||
|
||||
$("#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);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,123 @@
|
||||
|
||||
// =================
|
||||
// Edit Project Type
|
||||
// =================
|
||||
|
||||
$(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();
|
||||
$("#editProjectType").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();
|
||||
$("#editProjectType").submit();
|
||||
});
|
||||
|
||||
// --------------
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editProjectType || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// -------------
|
||||
// Delete Button
|
||||
// -------------
|
||||
|
||||
$(".btnDelete").on("click", function () {
|
||||
|
||||
if (formPost({action: "ProjectTypes.cityActive", city_serial: $sessionStorage.city_serial}) === true) {
|
||||
|
||||
$("#continue-dialog").find(".modal-title").html("Cannot Delete Project Type").end()
|
||||
.find(".modal-body").html("This ProjectType is in use and cannot be deleted.").end()
|
||||
.modal("show");
|
||||
|
||||
} else {
|
||||
|
||||
$("#confirm-dialog").removeClass().addClass("modal confirm-delete-city")
|
||||
.find(".modal-title").html("Confirm Delete ProjectType").end()
|
||||
.find(".modal-body").html("Are you sure you wish to delete this ProjectType?").end()
|
||||
.modal("show");
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$("body").on("click", ".confirm-delete-city .btnConfirmDialogConfirm", function () {
|
||||
|
||||
$.post("./", {action: "ProjectTypes.deleteProjectType", city_serial: $sessionStorage.city_serial})
|
||||
.done(function () {
|
||||
formSubmit({action: $sessionStorage.deleteProjectType});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#editProjectType").submit(function (e) {
|
||||
|
||||
var city_serial = $("#city_serial"),
|
||||
city_name = $("#city_name"),
|
||||
city_area = $("#city_area");
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
city_name.val(trimString(city_name.val()));
|
||||
|
||||
if (isBlank(city_name)) {
|
||||
createInputError(city_name, "Name is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (formPost({action: "ProjectTypes.cityExists", city_serial: city_serial.val(), city_name: city_name.val()}) === true) {
|
||||
createInputError(city_name, "Name already exists");
|
||||
return false;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
.done(function () {
|
||||
formSubmit({action: $sessionStorage.editProjectType});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -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);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,99 @@
|
||||
|
||||
// =============
|
||||
// Edit SIC Code
|
||||
// =============
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// -----------
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$("#editSICCode").submit();
|
||||
});
|
||||
|
||||
// --------------
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editSICCode || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// -------------
|
||||
// Delete Button
|
||||
// -------------
|
||||
|
||||
$(".btnDelete").on("click", function () {
|
||||
|
||||
if (formPost({action: "SICCodes.siccodeActive", siccode_serial: $sessionStorage.siccode_serial}) === true) {
|
||||
|
||||
$("#continue-dialog").find(".modal-title").html("Cannot Delete SIC Code").end()
|
||||
.find(".modal-body").html("This SIC Code is in use and cannot be deleted.").end()
|
||||
.modal("show");
|
||||
|
||||
} else {
|
||||
|
||||
$("#confirm-dialog").removeClass().addClass("modal confirm-delete-siccode")
|
||||
.find(".modal-title").html("Confirm Delete SIC Code").end()
|
||||
.find(".modal-body").html("Are you sure you wish to delete this SIC Code?").end()
|
||||
.modal("show");
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$("body").on("click", ".confirm-delete-siccode .btnConfirmDialogConfirm", function () {
|
||||
|
||||
$.post("./", {action: "SICCodes.deleteSICCode", siccode_serial: $sessionStorage.siccode_serial})
|
||||
.done(function () {
|
||||
formSubmit({action: $sessionStorage.deleteSICCode});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#editSICCode").submit(function (e) {
|
||||
|
||||
var siccode_serial = $("#siccode_serial"),
|
||||
siccode_description = $("#siccode_description"),
|
||||
siccode_code = $("#siccode_code");
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
siccode_description.val(trimString(siccode_description.val()));
|
||||
siccode_code.val(trimString(siccode_code.val()));
|
||||
|
||||
if (formPost({action: "SICCodes.siccodeExists", siccode_serial: siccode_serial.val(), siccode_description: siccode_description.val()}) === true) {
|
||||
createInputError(siccode_description, "Name already exists");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isBlank(siccode_description)) {
|
||||
createInputError(siccode_description, "Name is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
.done(function () {
|
||||
formSubmit({action: $sessionStorage.editSICCode});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,108 @@
|
||||
|
||||
// ===========
|
||||
// Edit Status
|
||||
// ===========
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$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);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,121 @@
|
||||
|
||||
// =================
|
||||
// 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_service_level = $("#subscription_service_level"),
|
||||
subscription_project_type = $("#subscription_market");
|
||||
|
||||
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 ($("option:selected", subscription_service_level).val() === "") {
|
||||
createInputError(subscription_service_level, "Service Level is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editSubscription || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,104 @@
|
||||
|
||||
// ========================
|
||||
// Edit Subscription City
|
||||
// ========================
|
||||
|
||||
$(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();
|
||||
|
||||
$("#editSubscriptionCity").submit();
|
||||
|
||||
});
|
||||
|
||||
// --------------
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editSubscriptionCity || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// -------------
|
||||
// Delete Button
|
||||
// -------------
|
||||
|
||||
$(".btnDelete").on("click", function () {
|
||||
|
||||
$("#confirm-dialog").removeClass().addClass("modal confirm-delete-subscriptioncity")
|
||||
.find(".modal-title").html("Confirm Delete Subscription City").end()
|
||||
.find(".modal-body").html("Are you sure you wish to delete this Subscriptions City?").end()
|
||||
.modal("show");
|
||||
|
||||
});
|
||||
|
||||
$("body").on("click", ".confirm-delete-subscriptioncity .btnConfirmDialogConfirm", function () {
|
||||
|
||||
$.post("./", {action: "Subscriptions.deleteSubscriptionCity", subscriptioncity_serial: $sessionStorage.subscriptioncity_serial})
|
||||
.done(function () {
|
||||
$sessionStorage.action = $sessionStorage.deleteSubscriptionCity || "";
|
||||
formSubmit($sessionStorage);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#editSubscriptionCity").submit(function (e) {
|
||||
|
||||
var city_name = $("#city_serial");
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
if ($("option:selected", city_name).val() === "") {
|
||||
createInputError(city_name, "Please select a city");
|
||||
return false;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editSubscriptionCity || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,104 @@
|
||||
|
||||
// ========================
|
||||
// Edit Subscription County
|
||||
// ========================
|
||||
|
||||
$(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();
|
||||
|
||||
$("#editSubscriptionCounty").submit();
|
||||
|
||||
});
|
||||
|
||||
// --------------
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editSubscriptionCounty || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// -------------
|
||||
// Delete Button
|
||||
// -------------
|
||||
|
||||
$(".btnDelete").on("click", function () {
|
||||
|
||||
$("#confirm-dialog").removeClass().addClass("modal confirm-delete-subscriptioncounty")
|
||||
.find(".modal-title").html("Confirm Delete Subscription County").end()
|
||||
.find(".modal-body").html("Are you sure you wish to delete this Subscriptions County?").end()
|
||||
.modal("show");
|
||||
|
||||
});
|
||||
|
||||
$("body").on("click", ".confirm-delete-subscriptioncounty .btnConfirmDialogConfirm", function () {
|
||||
|
||||
$.post("./", {action: "Subscriptions.deleteSubscriptionCounty", subscriptioncounty_serial: $sessionStorage.subscriptioncounty_serial})
|
||||
.done(function () {
|
||||
$sessionStorage.action = $sessionStorage.deleteSubscriptionCounty || "";
|
||||
formSubmit($sessionStorage);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#editSubscriptionCounty").submit(function (e) {
|
||||
|
||||
var county_name = $("#county_serial");
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
if ($("option:selected", county_name).val() === "") {
|
||||
createInputError(county_name, "Please select a county");
|
||||
return false;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editSubscriptionCounty || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
+144
@@ -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);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,147 @@
|
||||
|
||||
// =======================
|
||||
// Edit Users Subscription
|
||||
// =======================
|
||||
|
||||
$(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});
|
||||
|
||||
// ------------
|
||||
// Date Pickers
|
||||
// ------------
|
||||
|
||||
$("#subscription_start_date").datepicker({format: "mm-dd-yyyy",
|
||||
container: "div.subscription_start_date",
|
||||
keyboardNavigation: false,
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
orientation: "left bottom",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true});
|
||||
|
||||
$("#subscription_end_date").datepicker({format: "mm-dd-yyyy",
|
||||
container: "div.subscription_end_date",
|
||||
keyboardNavigation: false,
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
orientation: "left bottom",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true});
|
||||
|
||||
|
||||
// ---------------------
|
||||
// Show Calendar Buttons
|
||||
// ---------------------
|
||||
|
||||
$(".btnSubscriptionStartDateCalendar").on("click", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$("#subscription_start_date").focus().datepicker("show");
|
||||
|
||||
});
|
||||
|
||||
// ---------------------
|
||||
// Show Calendar Buttons
|
||||
// ---------------------
|
||||
|
||||
$(".btnSubscriptionEndDateCalendar").on("click", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$("#subscription_end_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);
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#editUsersSubscription").submit(function (e) {
|
||||
|
||||
var start_date = $("#subscription_start_date"), end_date = $("#subscription_end_date");
|
||||
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
if (isBlank(start_date)) {
|
||||
createInputError(start_date, "Date is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((!isBlank(start_date)) && (!start_date.inputmask("isComplete"))) {
|
||||
createInputError(start_date, "Date is incomplete");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isBlank(end_date)) {
|
||||
createInputError(end_date, "Date is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((!isBlank(end_date)) && (!end_date.inputmask("isComplete"))) {
|
||||
createInputError(end_date, "Date is incomplete");
|
||||
return false;
|
||||
}
|
||||
|
||||
let startDate = new Date(start_date.val()),
|
||||
endDate = new Date(end_date.val());
|
||||
|
||||
if (startDate > endDate) {
|
||||
createInputError(start_date, "Date is after End Date");
|
||||
return false;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editUsersSubscription || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
Vendored
+4
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
Vendored
+8
File diff suppressed because one or more lines are too long
@@ -0,0 +1,29 @@
|
||||
|
||||
// ======
|
||||
// Notice
|
||||
// ======
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// ---------------
|
||||
// Continue Button
|
||||
// ---------------
|
||||
|
||||
$(".btnContinue").on("click", function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.userSubscriptions || "";
|
||||
|
||||
$sessionStorage = clearSubscriptionSessionVariableFilters($sessionStorage);
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
+286
@@ -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; })()
|
||||
};
|
||||
|
||||
}));
|
||||
Vendored
+20
@@ -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;})()};}));
|
||||
@@ -0,0 +1,43 @@
|
||||
|
||||
// ===========================
|
||||
// Planning/Zoning Facts Basic
|
||||
// ===========================
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// -------------
|
||||
// Cancel Button
|
||||
// -------------
|
||||
|
||||
$(".btnDone").on("click", function () {
|
||||
|
||||
$sessionStorage = clearSubscriptionSessionVariableFilters($sessionStorage);
|
||||
$sessionStorage.action = "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ------------------------
|
||||
// Run Business Facts Basic
|
||||
// ------------------------
|
||||
|
||||
$("[data-week-start][data-week-end]").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "PlanningAndZoningFacts.planningAndZoningFactsBasic";
|
||||
$sessionStorage.step = "results";
|
||||
|
||||
$sessionStorage.week_start = $(this).data("week-start");
|
||||
$sessionStorage.week_end = $(this).data("week-end");
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
@@ -0,0 +1,492 @@
|
||||
|
||||
// ==============
|
||||
// Business Facts
|
||||
// ==============
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// -----------
|
||||
// Input Masks
|
||||
// -----------
|
||||
|
||||
$(".zip-mask").inputmask("9{5}", {showMaskOnHover: false, removeMaskOnSubmit: true});
|
||||
|
||||
$(".date-mask").inputmask({alias: "datetime",
|
||||
inputFormat: "mm/dd/yyyy",
|
||||
placeholder: "MM/DD/YYYY",
|
||||
showMaskOnHover: false});
|
||||
|
||||
$(".numeric-mask").inputmask("9{0,9}", {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
|
||||
// ------------
|
||||
|
||||
$("#businessfact_entry_date_from").datepicker({format: "mm-dd-yyyy",
|
||||
container: "div.entry_date",
|
||||
keyboardNavigation: false,
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
// endDate: "0d",
|
||||
orientation: "left bottom",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true});
|
||||
|
||||
$("#businessfact_entry_date_to").datepicker({format: "mm-dd-yyyy",
|
||||
container: "div.entry_date",
|
||||
keyboardNavigation: false,
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
// endDate: "0d",
|
||||
orientation: "left bottom",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true});
|
||||
|
||||
$("#businessfact_lease_end_from").datepicker({format: "mm-dd-yyyy",
|
||||
container: "div.lease-end-date",
|
||||
keyboardNavigation: false,
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
// endDate: "0d",
|
||||
orientation: "left bottom",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true});
|
||||
|
||||
$("#businessfact_lease_end_to").datepicker({format: "mm-dd-yyyy",
|
||||
container: "div.lease-end-date",
|
||||
keyboardNavigation: false,
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
// endDate: "0d",
|
||||
orientation: "left bottom",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true});
|
||||
|
||||
// ---------------------
|
||||
// Show Calendar Buttons
|
||||
// ---------------------
|
||||
|
||||
$(".btnEntryDateFromCalendar").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$("#businessfact_entry_date_from").focus().datepicker("show");
|
||||
});
|
||||
$(".btnEntryDateToCalendar").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$("#businessfact_entry_date_to").focus().datepicker("show");
|
||||
});
|
||||
|
||||
$(".btnLeaseEndDateFromCalendar").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$("#businessfact_lease_end_from").focus().datepicker("show");
|
||||
});
|
||||
$(".btnLeaseEndDateToCalendar").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$("#businessfact_lease_end_to").focus().datepicker("show");
|
||||
});
|
||||
|
||||
$("#businessfacts_per_page").val($sessionStorage.businessfacts_per_page || "20");
|
||||
|
||||
// ---------------
|
||||
// Per Page Change
|
||||
// ---------------
|
||||
|
||||
$("#businessfacts_per_page").on("change", function () {
|
||||
|
||||
$sessionStorage.businessfacts_per_page = $(this).val();
|
||||
$sessionStorage.action = "BusinessFacts.searchBusinessFacts";
|
||||
$sessionStorage.pagination = "first";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ------------------
|
||||
// Pagination Buttons
|
||||
// ------------------
|
||||
|
||||
$(".btnPagination").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "BusinessFacts.searchBusinessFacts";
|
||||
$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));
|
||||
|
||||
});
|
||||
|
||||
// =================
|
||||
// Process Enter Key
|
||||
// =================
|
||||
|
||||
$(document).on('keypress', function (e) {
|
||||
if (e.which === 13) {
|
||||
e.preventDefault();
|
||||
$("#searchBusinessFacts").submit();
|
||||
}
|
||||
});
|
||||
|
||||
// -----------------------
|
||||
// Filter the Business Cards
|
||||
// -----------------------
|
||||
|
||||
$("#filter").on("keyup", function () {
|
||||
|
||||
const filter = $(this).val().toLowerCase().trim();
|
||||
|
||||
$(".businessfact-card").hide().filter(function () {
|
||||
return $(this).text().toLowerCase().indexOf(filter) > -1;
|
||||
}).show();
|
||||
|
||||
if ($(".businessfact-card:visible").length === 0) {
|
||||
$(".filter-error").removeClass("d-none");
|
||||
$(".print_page_buttons").addClass("d-none");
|
||||
} else {
|
||||
$(".filter-error").addClass("d-none");
|
||||
$(".print_page_buttons").removeClass("d-none");
|
||||
}
|
||||
});
|
||||
|
||||
// ----------------
|
||||
// Clear the filter
|
||||
// ----------------
|
||||
|
||||
$("#filter").on("keydown", function (e) {
|
||||
if (e.key === "Escape") {
|
||||
$(this).val("").trigger("keyup");
|
||||
}
|
||||
});
|
||||
|
||||
// -----------------------------
|
||||
// Export Business Facts - Excel
|
||||
// -----------------------------
|
||||
|
||||
$(".btnExportExcel").on("click", function (e) {
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
$sessionStorage.action = "Export_BusinessFactsToExcel.export";
|
||||
$sessionStorage.subscription_reference = $sessionStorage.subscription_serial;
|
||||
$sessionStorage.pagination = "off";
|
||||
|
||||
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 Business Facts - CSV
|
||||
// ---------------------------
|
||||
|
||||
$(".btnExportCSV").on("click", function (e) {
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
$sessionStorage.action = "Export_BusinessFactsToCSV.export";
|
||||
$sessionStorage.subscription_reference = $sessionStorage.subscription_serial;
|
||||
$sessionStorage.pagination = "off";
|
||||
|
||||
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 Business Facts - PDF
|
||||
// --------------------------
|
||||
|
||||
$(".btnPrintSearchResultsPDF").on("click", function (e) {
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
$sessionStorage.action = "Print_BusinessFactsPDF.print";
|
||||
$sessionStorage.subscription_reference = $sessionStorage.subscription_serial;
|
||||
$sessionStorage.pagination = "off";
|
||||
|
||||
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 Permit Facts - CSV
|
||||
// -----------------------------
|
||||
|
||||
$(".btnExportAllRecordsCSV").on("click", function (e) {
|
||||
|
||||
$sessionStorage.action = "Export.createExportRequest";
|
||||
$sessionStorage.subscription_reference = $sessionStorage.subscription_serial;
|
||||
$sessionStorage.userSubscriptions = "Export.usersExports";
|
||||
$sessionStorage.report_type = "csv";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
// -------------------------------
|
||||
// Export All Permit Facts - Excel
|
||||
// -------------------------------
|
||||
|
||||
$(".btnExportAllRecordsExcel").on("click", function (e) {
|
||||
|
||||
$sessionStorage.action = "Export.createExportRequest";
|
||||
$sessionStorage.subscription_reference = $sessionStorage.subscription_serial;
|
||||
$sessionStorage.userSubscriptions = "Export.usersExports";
|
||||
$sessionStorage.report_type = "xlsx";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
// -----------------------------
|
||||
// Export All Permit Facts - PDF
|
||||
// -----------------------------
|
||||
|
||||
$(".btnPrintAllRecordsPDF").on("click", function (e) {
|
||||
|
||||
$sessionStorage.action = "Export.createExportRequest";
|
||||
$sessionStorage.subscription_reference = $sessionStorage.subscription_serial;
|
||||
$sessionStorage.userSubscriptions = "Export.usersExports";
|
||||
$sessionStorage.report_type = "pdf";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
|
||||
// -------------
|
||||
// Search Button
|
||||
// -------------
|
||||
|
||||
$(".btnSearch").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$("#searchBusinessFacts").submit();
|
||||
});
|
||||
|
||||
// -----------
|
||||
// Home Button
|
||||
// -----------
|
||||
|
||||
$(".btnHome").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Subscriptions.usersSubscriptions";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// -------------------
|
||||
// Reset Search Button
|
||||
// -------------------
|
||||
|
||||
$(".btnReset").on("click", function () {
|
||||
|
||||
clearForm($('#searchBusinessFacts'));
|
||||
|
||||
$sessionStorage = clearSubscriptionSessionVariableFilters($sessionStorage);
|
||||
|
||||
$sessionStorage.action = "BusinessFacts.searchBusinessFacts";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#searchBusinessFacts").submit(function (e) {
|
||||
|
||||
var businessfact_company = $("#businessfact_company").val(),
|
||||
businessfact_zip = $("#businessfact_zip").val(),
|
||||
businessfact_city = $("#businessfact_city").val(),
|
||||
businessfact_county = $("#businessfact_county").val(),
|
||||
businessfact_business_class = $("#businessfact_business_class").val(),
|
||||
businessfact_action = $("#businessfact_action").val(),
|
||||
businessfact_sic_code = $("#businessfact_sic_code").val(),
|
||||
businessfact_home_based_business = $("#businessfact_home_based_business").val(),
|
||||
businessfact_employee_count_from = $("#businessfact_employee_count_from"),
|
||||
businessfact_employee_count_to = $("#businessfact_employee_count_to"),
|
||||
businessfact_entry_date_from = $("#businessfact_entry_date_from"),
|
||||
businessfact_entry_date_to = $("#businessfact_entry_date_to"),
|
||||
businessfact_lease_end_from = $("#businessfact_lease_end_from"),
|
||||
businessfact_lease_end_to = $("#businessfact_lease_end_to");
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
// Normalize values (strip $, commas, etc.)
|
||||
let minValue = parseFloat(businessfact_employee_count_from.val().replace(/[^0-9.-]/g, ''));
|
||||
let maxValue = parseFloat(businessfact_employee_count_to.val().replace(/[^0-9.-]/g, ''));
|
||||
|
||||
// Range validation
|
||||
if (!isNaN(minValue) && !isNaN(maxValue)) {
|
||||
if (minValue > maxValue) {
|
||||
createInputError(businessfact_employee_count_from, "Minimum amount is greater than maximum amount");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ((!isBlank(businessfact_entry_date_from)) && (!businessfact_entry_date_from.inputmask("isComplete"))) {
|
||||
createInputError(businessfact_entry_date_from, "Date is incomplete");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((!isBlank(businessfact_entry_date_to)) && (!businessfact_entry_date_to.inputmask("isComplete"))) {
|
||||
createInputError(businessfact_entry_date_to, "Date is incomplete");
|
||||
return false;
|
||||
}
|
||||
|
||||
let startDate = new Date(businessfact_entry_date_from.val()),
|
||||
endDate = new Date(businessfact_entry_date_to.val());
|
||||
|
||||
if (startDate > endDate) {
|
||||
createInputError(businessfact_entry_date_from, "Start Date is after End Date");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((!isBlank(businessfact_lease_end_from)) && (!businessfact_lease_end_from.inputmask("isComplete"))) {
|
||||
createInputError(businessfact_lease_end_from, "Date is incomplete");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((!isBlank(businessfact_lease_end_to)) && (!businessfact_lease_end_to.inputmask("isComplete"))) {
|
||||
createInputError(businessfact_lease_end_to, "Date is incomplete");
|
||||
return false;
|
||||
}
|
||||
|
||||
let lease_startDate = new Date(businessfact_lease_end_from.val()),
|
||||
lease_endDate = new Date(businessfact_lease_end_to.val());
|
||||
|
||||
if (lease_startDate > lease_endDate) {
|
||||
createInputError(businessfact_lease_end_from, "Start Date is after End Date");
|
||||
return false;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$sessionStorage.action = "BusinessFacts.searchBusinessFacts";
|
||||
$sessionStorage.pagination = "first";
|
||||
|
||||
$sessionStorage.businessfact_company = businessfact_company;
|
||||
$sessionStorage.businessfact_zip = businessfact_zip;
|
||||
$sessionStorage.businessfact_city = businessfact_city;
|
||||
$sessionStorage.businessfact_county = businessfact_county;
|
||||
$sessionStorage.businessfact_business_class = businessfact_business_class;
|
||||
$sessionStorage.businessfact_action = businessfact_action;
|
||||
$sessionStorage.businessfact_sic_code = businessfact_sic_code;
|
||||
$sessionStorage.businessfact_home_based_business = businessfact_home_based_business;
|
||||
$sessionStorage.businessfact_employee_count_from = businessfact_employee_count_from.val();
|
||||
$sessionStorage.businessfact_employee_count_to = businessfact_employee_count_to.val();
|
||||
$sessionStorage.businessfact_entry_date_from = businessfact_entry_date_from.val();
|
||||
$sessionStorage.businessfact_entry_date_to = businessfact_entry_date_to.val();
|
||||
|
||||
if (businessfact_lease_end_from.length) {
|
||||
$sessionStorage.businessfact_lease_end_from = businessfact_lease_end_from.val();
|
||||
$sessionStorage.businessfact_lease_end_to = businessfact_lease_end_to.val();
|
||||
}
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
function clearForm($form) {
|
||||
|
||||
// Clear text, number, masked inputs, and textareas
|
||||
$form.find('input:not([type=hidden]):not([type=checkbox]):not([type=radio]), textarea')
|
||||
.val('')
|
||||
.trigger('change');
|
||||
|
||||
// Clear checkboxes and radios
|
||||
$form.find('input[type=checkbox], input[type=radio]')
|
||||
.prop('checked', false)
|
||||
.trigger('change');
|
||||
|
||||
// Clear standard and multiple selects
|
||||
$form.find('select').each(function () {
|
||||
$(this).val($(this).prop('multiple') ? [] : '').trigger('change');
|
||||
});
|
||||
|
||||
// Refresh bootstrap-select (selectpicker)
|
||||
if ($.fn.selectpicker) {
|
||||
$form.find('select.multiple-dropdown, select.selectpicker').selectpicker('refresh');
|
||||
}
|
||||
|
||||
// Clear jQuery UI / Bootstrap datepickers
|
||||
$form.find('.date-mask').each(function () {
|
||||
if ($(this).data('datepicker')) {
|
||||
$(this).datepicker('clearDates');
|
||||
}
|
||||
$(this).val('').trigger('change');
|
||||
});
|
||||
}
|
||||
|
||||
function printElement(selector) {
|
||||
const content = document.querySelector(selector).innerHTML;
|
||||
const original = document.body.innerHTML;
|
||||
|
||||
document.body.innerHTML = content;
|
||||
window.print();
|
||||
document.body.innerHTML = original;
|
||||
location.reload(); // restores JS state
|
||||
}
|
||||
@@ -0,0 +1,450 @@
|
||||
|
||||
// ============================
|
||||
// Search Planning/Zoning Facts
|
||||
// ============================
|
||||
|
||||
$(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});
|
||||
|
||||
$(".numeric-mask").inputmask("9{0,9}", {showMaskOnHover: false});
|
||||
|
||||
$('.sqft-mask').inputmask('numeric', {
|
||||
groupSeparator: ',',
|
||||
autoGroup: true,
|
||||
digits: 0, // whole numbers only
|
||||
digitsOptional: false,
|
||||
allowMinus: false,
|
||||
rightAlign: false,
|
||||
removeMaskOnSubmit: true
|
||||
});
|
||||
|
||||
// --------------
|
||||
// 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});
|
||||
|
||||
$(".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
|
||||
// ------------
|
||||
|
||||
$("#pzfact_entry_date_from").datepicker({format: "mm-dd-yyyy",
|
||||
container: "div.entry_date",
|
||||
keyboardNavigation: false,
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
endDate: "0d",
|
||||
orientation: "left bottom",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true});
|
||||
|
||||
$("#pzfact_entry_date_to").datepicker({format: "mm-dd-yyyy",
|
||||
container: "div.entry_date",
|
||||
keyboardNavigation: false,
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
endDate: "0d",
|
||||
orientation: "left bottom",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true});
|
||||
|
||||
// ---------------------
|
||||
// Show Calendar Buttons
|
||||
// ---------------------
|
||||
|
||||
$(".btnEntryDateFromCalendar").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$("#pzfact_entry_date_from").focus().datepicker("show");
|
||||
});
|
||||
$(".btnEntryDateToCalendar").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$("#pzfact_entry_date_to").focus().datepicker("show");
|
||||
});
|
||||
|
||||
$("#pzfacts_per_page").val($sessionStorage.pzfacts_per_page || "20");
|
||||
|
||||
// ---------------
|
||||
// Per Page Change
|
||||
// ---------------
|
||||
|
||||
$("#pzfacts_per_page").on("change", function () {
|
||||
|
||||
$sessionStorage.pzfacts_per_page = $(this).val();
|
||||
$sessionStorage.action = "PlanningAndZoningFacts.searchPlanningAndZoningFacts";
|
||||
$sessionStorage.pagination = "first";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ------------------
|
||||
// Pagination Buttons
|
||||
// ------------------
|
||||
|
||||
$(".btnPagination").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "PlanningAndZoningFacts.searchPlanningAndZoningFacts";
|
||||
$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));
|
||||
|
||||
});
|
||||
|
||||
// =================
|
||||
// Process Enter Key
|
||||
// =================
|
||||
|
||||
$(document).on('keypress', function (e) {
|
||||
if (e.which === 13) {
|
||||
e.preventDefault();
|
||||
$("#searchPZFacts").submit();
|
||||
}
|
||||
});
|
||||
|
||||
// -------------------
|
||||
// Filter the PZ Cards
|
||||
// -------------------
|
||||
|
||||
$("#filter").on("keyup", function () {
|
||||
|
||||
const filter = $(this).val().toLowerCase().trim();
|
||||
|
||||
$(".pzfact-card").hide().filter(function () {
|
||||
return $(this).text().toLowerCase().indexOf(filter) > -1;
|
||||
}).show();
|
||||
|
||||
if ($(".pzfact-card:visible").length === 0) {
|
||||
$(".filter-error").removeClass("d-none");
|
||||
$(".print_page_buttons").addClass("d-none");
|
||||
} else {
|
||||
$(".filter-error").addClass("d-none");
|
||||
$(".print_page_buttons").removeClass("d-none");
|
||||
}
|
||||
});
|
||||
|
||||
// ----------------
|
||||
// Clear the filter
|
||||
// ----------------
|
||||
|
||||
$("#filter").on("keydown", function (e) {
|
||||
if (e.key === "Escape") {
|
||||
$(this).val("").trigger("keyup");
|
||||
}
|
||||
});
|
||||
|
||||
// -----------------------
|
||||
// Export PZ Facts - Excel
|
||||
// -----------------------
|
||||
|
||||
$(".btnExportExcel").on("click", function (e) {
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
$sessionStorage.action = "Export_PZFactsToExcel.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
|
||||
});
|
||||
|
||||
// -------------------------
|
||||
// Export PZ Facts - CSV
|
||||
// -------------------------
|
||||
|
||||
$(".btnExportCSV").on("click", function (e) {
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
$sessionStorage.action = "Export_PZFactsToCSV.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 PZ Facts - PDF
|
||||
// ------------------------
|
||||
|
||||
$(".btnPrintSearchResultsPDF").on("click", function (e) {
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
$sessionStorage.action = "Print_PZFactsPDF.print";
|
||||
$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 All Planning/Zoning Facts - CSV
|
||||
// --------------------------------------
|
||||
|
||||
$(".btnExportAllRecordsCSV").on("click", function (e) {
|
||||
|
||||
$sessionStorage.action = "Export.createExportRequest";
|
||||
$sessionStorage.subscription_reference = $sessionStorage.subscription_serial;
|
||||
$sessionStorage.userSubscriptions = "Export.usersExports";
|
||||
$sessionStorage.report_type = "csv";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
// -------------------------------
|
||||
// Export All Permit Facts - Excel
|
||||
// -------------------------------
|
||||
|
||||
$(".btnExportAllRecordsExcel").on("click", function (e) {
|
||||
|
||||
$sessionStorage.action = "Export.createExportRequest";
|
||||
$sessionStorage.subscription_reference = $sessionStorage.subscription_serial;
|
||||
$sessionStorage.userSubscriptions = "Export.usersExports";
|
||||
$sessionStorage.report_type = "xlsx";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
// -----------------------------
|
||||
// Export All Permit Facts - PDF
|
||||
// -----------------------------
|
||||
|
||||
$(".btnPrintAllRecordsPDF").on("click", function (e) {
|
||||
|
||||
$sessionStorage.action = "Export.createExportRequest";
|
||||
$sessionStorage.subscription_reference = $sessionStorage.subscription_serial;
|
||||
$sessionStorage.userSubscriptions = "Export.usersExports";
|
||||
$sessionStorage.report_type = "pdf";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// -----------
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSearch").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$("#searchPZFacts").submit();
|
||||
});
|
||||
|
||||
// -----------
|
||||
// Home Button
|
||||
// -----------
|
||||
|
||||
$(".btnHome").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Subscriptions.usersSubscriptions";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// -------------------
|
||||
// Reset Search Button
|
||||
// -------------------
|
||||
|
||||
$(".btnReset").on("click", function () {
|
||||
|
||||
clearForm($('#searchPZFacts'));
|
||||
|
||||
$sessionStorage = clearSubscriptionSessionVariableFilters($sessionStorage);
|
||||
|
||||
$sessionStorage.action = "PlanningAndZoningFacts.searchPlanningAndZoningFacts";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#searchPZFacts").submit(function (e) {
|
||||
|
||||
var pzfact_project_name = $("#pzfact_project_name").val(),
|
||||
pzfact_in_city_limit = $("#pzfact_in_city_limit").val(),
|
||||
pzfact_project_city = $("#pzfact_project_city").val(),
|
||||
pzfact_county = $("#pzfact_county").val(),
|
||||
pzfact_project_type = $("#pzfact_project_type").val(),
|
||||
pzfact_action_code = $("#pzfact_action_code").val(),
|
||||
pzfact_acres_from = $("#pzfact_acres_from"),
|
||||
pzfact_acres_to = $("#pzfact_acres_to"),
|
||||
pzfact_entry_date_from = $("#pzfact_entry_date_from"),
|
||||
pzfact_entry_date_to = $("#pzfact_entry_date_to");
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
/*
|
||||
* Normalize values (strip commas, spaces, etc.)
|
||||
*/
|
||||
let minSqft = parseInt(pzfact_acres_from.val().replace(/[^0-9]/g, ''), 10);
|
||||
let maxSqft = parseInt(pzfact_acres_to.val().replace(/[^0-9]/g, ''), 10);
|
||||
|
||||
/*
|
||||
* Range validation
|
||||
*/
|
||||
if (!isNaN(minSqft) && !isNaN(maxSqft)) {
|
||||
if (minSqft > maxSqft) {
|
||||
createInputError(pzfact_acres_from, "Min acreage is greater than Max acreage");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ((!isBlank(pzfact_entry_date_from)) && (!pzfact_entry_date_from.inputmask("isComplete"))) {
|
||||
createInputError(pzfact_entry_date_from, "Date is incomplete");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((!isBlank(pzfact_entry_date_to)) && (!pzfact_entry_date_to.inputmask("isComplete"))) {
|
||||
createInputError(pzfact_entry_date_to, "Date is incomplete");
|
||||
return false;
|
||||
}
|
||||
|
||||
let startDate2 = new Date(pzfact_entry_date_from.val()),
|
||||
endDate2 = new Date(pzfact_entry_date_to.val());
|
||||
|
||||
if (startDate2 > endDate2) {
|
||||
createInputError(pzfact_entry_date_from, "Date is after End Date");
|
||||
return false;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$sessionStorage.action = "PlanningAndZoningFacts.searchPlanningAndZoningFacts";
|
||||
$sessionStorage.pagination = "first";
|
||||
|
||||
$sessionStorage.pzfact_project_name = pzfact_project_name;
|
||||
$sessionStorage.pzfact_in_city_limit = pzfact_in_city_limit;
|
||||
$sessionStorage.pzfact_project_city = pzfact_project_city;
|
||||
$sessionStorage.pzfact_county = pzfact_county;
|
||||
$sessionStorage.pzfact_project_type = pzfact_project_type;
|
||||
$sessionStorage.pzfact_project_type = pzfact_project_type;
|
||||
$sessionStorage.pzfact_action_code = pzfact_action_code;
|
||||
$sessionStorage.pzfact_acres_from = pzfact_acres_from.val();
|
||||
$sessionStorage.pzfact_acres_to = pzfact_acres_to.val();
|
||||
$sessionStorage.pzfact_entry_date_from = pzfact_entry_date_from.val();
|
||||
$sessionStorage.pzfact_entry_date_to = pzfact_entry_date_to.val();
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
function clearForm($form) {
|
||||
|
||||
// Clear text, number, masked inputs, and textareas
|
||||
$form.find('input:not([type=checkbox]):not([type=radio]), textarea')
|
||||
.val('')
|
||||
.trigger('change');
|
||||
|
||||
// Clear checkboxes and radios
|
||||
$form.find('input[type=checkbox], input[type=radio]')
|
||||
.prop('checked', false)
|
||||
.trigger('change');
|
||||
|
||||
// Clear standard selects
|
||||
$form.find('select').val('').trigger('change');
|
||||
|
||||
// Refresh bootstrap-select (selectpicker)
|
||||
if ($.fn.selectpicker) {
|
||||
$form.find('.selectpicker').selectpicker('refresh');
|
||||
}
|
||||
|
||||
// Clear jQuery UI / Bootstrap datepickers
|
||||
$form.find('.date-mask').each(function () {
|
||||
if ($(this).data('datepicker')) {
|
||||
$(this).datepicker('clearDates');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function printElement(selector) {
|
||||
const content = document.querySelector(selector).innerHTML;
|
||||
const original = document.body.innerHTML;
|
||||
|
||||
document.body.innerHTML = content;
|
||||
window.print();
|
||||
document.body.innerHTML = original;
|
||||
location.reload(); // restores JS state
|
||||
}
|
||||
@@ -0,0 +1,601 @@
|
||||
|
||||
// ==========
|
||||
// Add County
|
||||
// ==========
|
||||
|
||||
$(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});
|
||||
|
||||
$(".numeric-mask").inputmask("9{0,9}", {showMaskOnHover: false});
|
||||
|
||||
$(".zip-mask").inputmask("9{5}", {showMaskOnHover: false, removeMaskOnSubmit: true});
|
||||
|
||||
$('.money-mask').inputmask('currency', {
|
||||
prefix: '$',
|
||||
groupSeparator: ',',
|
||||
digits: 0,
|
||||
digitsOptional: false,
|
||||
autoGroup: true,
|
||||
removeMaskOnSubmit: true
|
||||
});
|
||||
|
||||
$('.sqft-mask').inputmask('numeric', {
|
||||
groupSeparator: ',',
|
||||
autoGroup: true,
|
||||
digits: 0, // whole numbers only
|
||||
digitsOptional: false,
|
||||
allowMinus: false,
|
||||
rightAlign: false,
|
||||
removeMaskOnSubmit: true
|
||||
});
|
||||
|
||||
|
||||
// --------------
|
||||
// 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});
|
||||
|
||||
$(".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
|
||||
// ------------
|
||||
|
||||
$("#permitfact_permit_date_from").datepicker({format: "mm-dd-yyyy",
|
||||
container: "div.permit_date",
|
||||
keyboardNavigation: false,
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
endDate: "0d",
|
||||
orientation: "left bottom",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true});
|
||||
|
||||
$("#permitfact_permit_date_to").datepicker({format: "mm-dd-yyyy",
|
||||
container: "div.permit_date",
|
||||
keyboardNavigation: false,
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
endDate: "0d",
|
||||
orientation: "left bottom",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true});
|
||||
|
||||
$("#permitfact_entry_date_from").datepicker({format: "mm-dd-yyyy",
|
||||
container: "div.entry_date",
|
||||
keyboardNavigation: false,
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
endDate: "0d",
|
||||
orientation: "left bottom",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true});
|
||||
|
||||
$("#permitfact_entry_date_to").datepicker({format: "mm-dd-yyyy",
|
||||
container: "div.entry_date",
|
||||
keyboardNavigation: false,
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
endDate: "0d",
|
||||
orientation: "left bottom",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true});
|
||||
|
||||
// ---------------------
|
||||
// Show Calendar Buttons
|
||||
// ---------------------
|
||||
|
||||
$(".btnPermitDateFromCalendar").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$("#permitfact_permit_date_from").focus().datepicker("show");
|
||||
});
|
||||
$(".btnPermitDateToCalendar").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$("#permitfact_permit_date_to").focus().datepicker("show");
|
||||
});
|
||||
|
||||
$(".btnEntryDateFromCalendar").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$("#permitfact_entry_date_from").focus().datepicker("show");
|
||||
});
|
||||
$(".btnEntryDateToCalendar").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$("#permitfact_entry_date_to").focus().datepicker("show");
|
||||
});
|
||||
|
||||
$("#permitfacts_per_page").val($sessionStorage.permitfacts_per_page || "20");
|
||||
|
||||
// ---------------
|
||||
// Per Page Change
|
||||
// ---------------
|
||||
|
||||
$("#permitfacts_per_page").on("change", function () {
|
||||
|
||||
$sessionStorage.permitfacts_per_page = $(this).val();
|
||||
$sessionStorage.action = "PermitFacts.searchPermitFacts";
|
||||
$sessionStorage.pagination = "first";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ------------------
|
||||
// Pagination Buttons
|
||||
// ------------------
|
||||
|
||||
$(".btnPagination").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "PermitFacts.searchPermitFacts";
|
||||
$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));
|
||||
|
||||
});
|
||||
|
||||
// =================
|
||||
// Process Enter Key
|
||||
// =================
|
||||
|
||||
$(document).on('keypress', function (e) {
|
||||
if (e.which === 13) {
|
||||
e.preventDefault();
|
||||
$("#searchPermitFacts").submit();
|
||||
}
|
||||
});
|
||||
|
||||
// -----------------------
|
||||
// Filter the Permit Cards
|
||||
// -----------------------
|
||||
|
||||
$("#filter").on("keyup", function () {
|
||||
|
||||
const filter = $(this).val().toLowerCase().trim();
|
||||
|
||||
$(".permitfact-card").hide().filter(function () {
|
||||
return $(this).text().toLowerCase().indexOf(filter) > -1;
|
||||
}).show();
|
||||
|
||||
if ($(".permitfact-card:visible").length === 0) {
|
||||
$(".filter-error").removeClass("d-none");
|
||||
$(".print_page_buttons").addClass("d-none");
|
||||
} else {
|
||||
$(".filter-error").addClass("d-none");
|
||||
$(".print_page_buttons").removeClass("d-none");
|
||||
}
|
||||
});
|
||||
|
||||
// ----------------
|
||||
// Clear the filter
|
||||
// ----------------
|
||||
|
||||
$("#filter").on("keydown", function (e) {
|
||||
if (e.key === "Escape") {
|
||||
$(this).val("").trigger("keyup");
|
||||
}
|
||||
});
|
||||
|
||||
// ---------------------------
|
||||
// Export Permit Facts - Excel
|
||||
// ---------------------------
|
||||
|
||||
$(".btnExportExcel").on("click", function (e) {
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
$sessionStorage.action = "Export_PermitFactsToExcel.export";
|
||||
$sessionStorage.subscription_reference = $sessionStorage.subscription_serial;
|
||||
$sessionStorage.pagination = "off";
|
||||
|
||||
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 Permit Facts - CSV
|
||||
// -------------------------
|
||||
|
||||
$(".btnExportCSV").on("click", function (e) {
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
$sessionStorage.action = "Export_PermitFactsToExcel.export";
|
||||
$sessionStorage.subscription_reference = $sessionStorage.subscription_serial;
|
||||
$sessionStorage.pagination = "off";
|
||||
|
||||
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 Search Results - PDF
|
||||
// --------------------------
|
||||
|
||||
$(".btnPrintSearchResultsPDF").on("click", function (e) {
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
$sessionStorage.action = "Print_PermitFactsPDF.print";
|
||||
$sessionStorage.subscription_reference = $sessionStorage.subscription_serial;
|
||||
$sessionStorage.pagination = "off";
|
||||
|
||||
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 Permit Facts - CSV
|
||||
// -----------------------------
|
||||
|
||||
$(".btnExportAllRecordsCSV").on("click", function (e) {
|
||||
|
||||
$sessionStorage.action = "Export.createExportRequest";
|
||||
$sessionStorage.subscription_reference = $sessionStorage.subscription_serial;
|
||||
$sessionStorage.userSubscriptions = "Export.usersExports";
|
||||
$sessionStorage.report_type = "csv";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
// -------------------------------
|
||||
// Export All Permit Facts - Excel
|
||||
// -------------------------------
|
||||
|
||||
$(".btnExportAllRecordsExcel").on("click", function (e) {
|
||||
|
||||
$sessionStorage.action = "Export.createExportRequest";
|
||||
$sessionStorage.subscription_reference = $sessionStorage.subscription_serial;
|
||||
$sessionStorage.userSubscriptions = "Export.usersExports";
|
||||
$sessionStorage.report_type = "xlsx";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
// -----------------------------
|
||||
// Export All Permit Facts - PDF
|
||||
// -----------------------------
|
||||
|
||||
$(".btnPrintAllRecordsPDF").on("click", function (e) {
|
||||
|
||||
$sessionStorage.action = "Export.createExportRequest";
|
||||
$sessionStorage.subscription_reference = $sessionStorage.subscription_serial;
|
||||
$sessionStorage.userSubscriptions = "Export.usersExports";
|
||||
$sessionStorage.report_type = "pdf";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// -------------
|
||||
// Search Button
|
||||
// -------------
|
||||
|
||||
$(".btnSearch").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$("#searchPermitFacts").submit();
|
||||
});
|
||||
|
||||
// -----------
|
||||
// Home Button
|
||||
// -----------
|
||||
|
||||
$(".btnHome").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Subscriptions.usersSubscriptions";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// -------------------
|
||||
// Reset Search Button
|
||||
// -------------------
|
||||
|
||||
$(".btnReset").on("click", function () {
|
||||
|
||||
clearForm($('#searchPermitFacts'));
|
||||
|
||||
$sessionStorage = clearSubscriptionSessionVariableFilters($sessionStorage);
|
||||
|
||||
$sessionStorage.action = "PermitFacts.searchPermitFacts";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#searchPermitFacts").submit(function (e) {
|
||||
|
||||
var permitfact_size_from = $("#permitfact_size_from"),
|
||||
permitfact_size_to = $("#permitfact_size_to"),
|
||||
permitfact_value_from = $("#permitfact_value_from"),
|
||||
permitfact_value_to = $("#permitfact_value_to"),
|
||||
permitfact_permit_date_from = $("#permitfact_permit_date_from"),
|
||||
permitfact_permit_date_to = $("#permitfact_permit_date_to"),
|
||||
permitfact_entry_date_from = $("#permitfact_entry_date_from"),
|
||||
permitfact_entry_date_to = $("#permitfact_entry_date_to"),
|
||||
permitfact_company = $("#permitfact_company").val(),
|
||||
permitfact_project_name = $("#permitfact_project_name").val(),
|
||||
permitfact_project_zip = $("#permitfact_project_zip").val(),
|
||||
permitfact_project_city = $("#permitfact_project_city").val(),
|
||||
permitfact_county = $("#permitfact_county").val(),
|
||||
permitfact_project_type = $("#permitfact_project_type").val(),
|
||||
permitfact_work_type = $("#permitfact_work_type").val(),
|
||||
permitfact_building_type = $("#permitfact_building_type").val();
|
||||
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
if ((!isBlank(permitfact_size_from)) && (!permitfact_size_from.inputmask("isComplete"))) {
|
||||
createInputError(permitfact_size_from, "Square footage is incomplete");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((!isBlank(permitfact_size_to)) && (!permitfact_size_to.inputmask("isComplete"))) {
|
||||
createInputError(permitfact_size_to, "Square footage is incomplete");
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Normalize values (strip commas, spaces, etc.)
|
||||
*/
|
||||
let minSqft = parseInt(permitfact_size_from.val().replace(/[^0-9]/g, ''), 10);
|
||||
let maxSqft = parseInt(permitfact_size_to.val().replace(/[^0-9]/g, ''), 10);
|
||||
|
||||
/*
|
||||
* Range validation
|
||||
*/
|
||||
if (!isNaN(minSqft) && !isNaN(maxSqft)) {
|
||||
if (minSqft > maxSqft) {
|
||||
createInputError(permitfact_size_from, "Min Sq Ft is greater than Max Sq Ft");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ((!isBlank(permitfact_value_from)) && (!permitfact_value_from.inputmask("isComplete"))) {
|
||||
createInputError(permitfact_value_from, "Amount is incomplete");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((!isBlank(permitfact_value_to)) && (!permitfact_value_to.inputmask("isComplete"))) {
|
||||
createInputError(permitfact_value_to, "Amount is incomplete");
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Normalize values (strip $, commas, etc.)
|
||||
*/
|
||||
let minValue = parseFloat(
|
||||
permitfact_value_from.val().replace(/[^0-9.-]/g, '')
|
||||
);
|
||||
|
||||
let maxValue = parseFloat(
|
||||
permitfact_value_to.val().replace(/[^0-9.-]/g, '')
|
||||
);
|
||||
|
||||
/*
|
||||
* Range validation
|
||||
*/
|
||||
if (!isNaN(minValue) && !isNaN(maxValue)) {
|
||||
if (minValue > maxValue) {
|
||||
createInputError(permitfact_value_from, "Minimum amount is greater than maximum amount");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------
|
||||
// Date filter: issue OR entry
|
||||
// -----------------------------
|
||||
const hasPermitDate =
|
||||
!isBlank(permitfact_permit_date_from) || !isBlank(permitfact_permit_date_to);
|
||||
|
||||
const hasEntryDate =
|
||||
!isBlank(permitfact_entry_date_from) || !isBlank(permitfact_entry_date_to);
|
||||
|
||||
// Disallow using both
|
||||
if (hasPermitDate && hasEntryDate) {
|
||||
createInputError(permitfact_permit_date_from, "Use either Issue Date OR Entry Date (not both).");
|
||||
createInputError(permitfact_entry_date_from, "Use either Issue Date OR Entry Date (not both).");
|
||||
return false;
|
||||
}
|
||||
|
||||
// OPTIONAL (recommended): if they choose one, require both From + To for that one
|
||||
if (hasPermitDate) {
|
||||
if (isBlank(permitfact_permit_date_from) || isBlank(permitfact_permit_date_to)) {
|
||||
createInputError(permitfact_permit_date_from, "Please enter both Issue Date From and To.");
|
||||
createInputError(permitfact_permit_date_to, "Please enter both Issue Date From and To.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasEntryDate) {
|
||||
if (isBlank(permitfact_entry_date_from) || isBlank(permitfact_entry_date_to)) {
|
||||
createInputError(permitfact_entry_date_from, "Please enter both Entry Date From and To.");
|
||||
createInputError(permitfact_entry_date_to, "Please enter both Entry Date From and To.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ((!isBlank(permitfact_permit_date_from)) && (!permitfact_permit_date_from.inputmask("isComplete"))) {
|
||||
createInputError(permitfact_permit_date_from, "Date is incomplete");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((!isBlank(permitfact_permit_date_to)) && (!permitfact_permit_date_to.inputmask("isComplete"))) {
|
||||
createInputError(permitfact_permit_date_to, "Date is incomplete");
|
||||
return false;
|
||||
}
|
||||
|
||||
let startDate = new Date(permitfact_permit_date_from.val()),
|
||||
endDate = new Date(permitfact_permit_date_to.val());
|
||||
|
||||
if (startDate > endDate) {
|
||||
createInputError(permitfact_permit_date_from, "Date is after End Date");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((!isBlank(permitfact_entry_date_from)) && (!permitfact_entry_date_from.inputmask("isComplete"))) {
|
||||
createInputError(permitfact_entry_date_from, "Date is incomplete");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((!isBlank(permitfact_entry_date_to)) && (!permitfact_entry_date_to.inputmask("isComplete"))) {
|
||||
createInputError(permitfact_entry_date_to, "Date is incomplete");
|
||||
return false;
|
||||
}
|
||||
|
||||
let startDate2 = new Date(permitfact_entry_date_from.val()),
|
||||
endDate2 = new Date(permitfact_entry_date_to.val());
|
||||
|
||||
if (startDate2 > endDate2) {
|
||||
createInputError(permitfact_entry_date_from, "Date is after End Date");
|
||||
return false;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$sessionStorage.action = "PermitFacts.searchPermitFacts";
|
||||
$sessionStorage.pagination = "first";
|
||||
|
||||
$sessionStorage.permitfact_company = permitfact_company;
|
||||
$sessionStorage.permitfact_project_name = permitfact_project_name;
|
||||
$sessionStorage.permitfact_project_zip = permitfact_project_zip;
|
||||
$sessionStorage.permitfact_project_city = permitfact_project_city;
|
||||
$sessionStorage.permitfact_county = permitfact_county;
|
||||
$sessionStorage.permitfact_project_type = permitfact_project_type;
|
||||
$sessionStorage.permitfact_work_type = permitfact_work_type;
|
||||
$sessionStorage.permitfact_building_type = permitfact_building_type;
|
||||
$sessionStorage.permitfact_size_from = permitfact_size_from.val();
|
||||
$sessionStorage.permitfact_size_to = permitfact_size_to.val();
|
||||
$sessionStorage.permitfact_value_from = permitfact_value_from.val();
|
||||
$sessionStorage.permitfact_value_to = permitfact_value_to.val();
|
||||
$sessionStorage.permitfact_permit_date_from = permitfact_permit_date_from.val();
|
||||
$sessionStorage.permitfact_permit_date_to = permitfact_permit_date_to.val();
|
||||
$sessionStorage.permitfact_entry_date_from = permitfact_entry_date_from.val();
|
||||
$sessionStorage.permitfact_entry_date_to = permitfact_entry_date_to.val();
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
function clearForm($form) {
|
||||
|
||||
// Clear text, number, masked inputs, and textareas
|
||||
$form.find('input:not([type=checkbox]):not([type=radio]), textarea')
|
||||
.val('')
|
||||
.trigger('change');
|
||||
|
||||
// Clear checkboxes and radios
|
||||
$form.find('input[type=checkbox], input[type=radio]')
|
||||
.prop('checked', false)
|
||||
.trigger('change');
|
||||
|
||||
// Clear standard selects
|
||||
$form.find('select').val('').trigger('change');
|
||||
|
||||
// Refresh bootstrap-select (selectpicker)
|
||||
if ($.fn.selectpicker) {
|
||||
$form.find('.selectpicker').selectpicker('refresh');
|
||||
}
|
||||
|
||||
// Clear jQuery UI / Bootstrap datepickers
|
||||
$form.find('.date-mask').each(function () {
|
||||
if ($(this).data('datepicker')) {
|
||||
$(this).datepicker('clearDates');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function printElement(selector) {
|
||||
const content = document.querySelector(selector).innerHTML;
|
||||
const original = document.body.innerHTML;
|
||||
|
||||
document.body.innerHTML = content;
|
||||
window.print();
|
||||
document.body.innerHTML = original;
|
||||
location.reload(); // restores JS state
|
||||
}
|
||||
@@ -0,0 +1,229 @@
|
||||
|
||||
// =============
|
||||
// Select Report
|
||||
// =============
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$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");
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,205 @@
|
||||
|
||||
// ==============
|
||||
// Setup Alerts
|
||||
// ==============
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// -----------
|
||||
// Find Button
|
||||
// -----------
|
||||
|
||||
$(".btnFind").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Alerts.setupAlerts";
|
||||
$sessionStorage.pagination = "first";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
$("#find_alert").on("keyup", function (e) {
|
||||
if (e.key === "Enter") {
|
||||
$(".btnFind").trigger("click");
|
||||
}
|
||||
});
|
||||
|
||||
// -----------------
|
||||
// Clear Find Button
|
||||
// -----------------
|
||||
|
||||
$(".btnClearFind").on("click", function () {
|
||||
|
||||
$("#find_alert").val("").trigger("change");
|
||||
|
||||
$sessionStorage.action = "Alerts.setupAlerts";
|
||||
$sessionStorage.pagination = "first";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ------------------
|
||||
// Pagination Buttons
|
||||
// ------------------
|
||||
|
||||
$(".btnPagination").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Alerts.setupAlerts";
|
||||
$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 = "Alerts.addAlert";
|
||||
$sessionStorage.addAlert = "Alerts.setupAlerts";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// -----------
|
||||
// Done Button
|
||||
// -----------
|
||||
|
||||
$(".btnDone").on("click", function () {
|
||||
|
||||
formSubmit({action: ""});
|
||||
|
||||
});
|
||||
|
||||
// ----
|
||||
// Edit
|
||||
// ----
|
||||
|
||||
$("#alerts-table tbody").on("click touch", "tr", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$sessionStorage.action = "Alerts.editAlert";
|
||||
$sessionStorage.alert_serial = $(this).data("alert-serial");
|
||||
$sessionStorage.editAlert = "Alerts.setupAlerts";
|
||||
|
||||
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
|
||||
// -----------------
|
||||
|
||||
$("#alerts_per_page").on("change", function () {
|
||||
|
||||
$(".btnFind").trigger("click");
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,190 @@
|
||||
|
||||
// ============
|
||||
// Setup Cities
|
||||
// ============
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// -----------
|
||||
// Find Button
|
||||
// -----------
|
||||
|
||||
$(".btnFind").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Cities.setupCities";
|
||||
$sessionStorage.pagination = "first";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
$("#find_city").on("keyup", function (e) {
|
||||
if (e.key === "Enter") {
|
||||
$(".btnFind").trigger("click");
|
||||
}
|
||||
});
|
||||
|
||||
// -----------------
|
||||
// Clear Find Button
|
||||
// -----------------
|
||||
|
||||
$(".btnClearFind").on("click", function () {
|
||||
|
||||
$("#find_city").val("").trigger("change");
|
||||
|
||||
$sessionStorage.action = "Cities.setupCities";
|
||||
$sessionStorage.pagination = "first";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ------------------
|
||||
// Pagination Buttons
|
||||
// ------------------
|
||||
|
||||
$(".btnPagination").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Cities.setupCities";
|
||||
$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 = "Cities.addCity";
|
||||
$sessionStorage.addCity = "Cities.setupCities";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// -----------
|
||||
// Done Button
|
||||
// -----------
|
||||
|
||||
$(".btnDone").on("click", function () {
|
||||
|
||||
formSubmit({action: ""});
|
||||
|
||||
});
|
||||
|
||||
// ----
|
||||
// Edit
|
||||
// ----
|
||||
|
||||
$("#cities-table tbody").on("click touch", "tr", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$sessionStorage.action = "Cities.editCity";
|
||||
$sessionStorage.city_serial = $(this).data("city-serial");
|
||||
$sessionStorage.editCity = "Cities.setupCities";
|
||||
$sessionStorage.deleteCity = "Cities.setupCities";
|
||||
|
||||
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");
|
||||
|
||||
});
|
||||
@@ -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");
|
||||
|
||||
});
|
||||
@@ -0,0 +1,127 @@
|
||||
|
||||
// ===============
|
||||
// Setup Dropdowns
|
||||
// ===============
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$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")});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,181 @@
|
||||
|
||||
// ===================
|
||||
// Setup Dropdowntypes
|
||||
// ===================
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$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");
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,205 @@
|
||||
|
||||
// ==============
|
||||
// Setup Popovers
|
||||
// ==============
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$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");
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,190 @@
|
||||
|
||||
// ============
|
||||
// Setup ProjectTypes
|
||||
// ============
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// -----------
|
||||
// Find Button
|
||||
// -----------
|
||||
|
||||
$(".btnFind").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "ProjectTypes.setupProjectTypes";
|
||||
$sessionStorage.pagination = "first";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
$("#find_projecttype").on("keyup", function (e) {
|
||||
if (e.key === "Enter") {
|
||||
$(".btnFind").trigger("click");
|
||||
}
|
||||
});
|
||||
|
||||
// -----------------
|
||||
// Clear Find Button
|
||||
// -----------------
|
||||
|
||||
$(".btnClearFind").on("click", function () {
|
||||
|
||||
$("#find_projecttype").val("").trigger("change");
|
||||
|
||||
$sessionStorage.action = "ProjectTypes.setupProjectTypes";
|
||||
$sessionStorage.pagination = "first";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ------------------
|
||||
// Pagination Buttons
|
||||
// ------------------
|
||||
|
||||
$(".btnPagination").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "ProjectTypes.setupProjectTypes";
|
||||
$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 = "ProjectTypes.addProjectType";
|
||||
$sessionStorage.addProjectType = "ProjectTypes.setupProjectTypes";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// -----------
|
||||
// Done Button
|
||||
// -----------
|
||||
|
||||
$(".btnDone").on("click", function () {
|
||||
|
||||
formSubmit({action: ""});
|
||||
|
||||
});
|
||||
|
||||
// ----
|
||||
// Edit
|
||||
// ----
|
||||
|
||||
$("#cities-table tbody").on("click touch", "tr", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$sessionStorage.action = "ProjectTypes.editProjectType";
|
||||
$sessionStorage.projecttype_serial = $(this).data("projecttype-serial");
|
||||
$sessionStorage.editProjectType = "ProjectTypes.setupProjectTypes";
|
||||
$sessionStorage.deleteProjectType = "ProjectTypes.setupProjectTypes";
|
||||
|
||||
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");
|
||||
|
||||
});
|
||||
@@ -0,0 +1,175 @@
|
||||
|
||||
// =============
|
||||
// Setup Reports
|
||||
// =============
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$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");
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,215 @@
|
||||
|
||||
// ===============
|
||||
// Setup SIC Codes
|
||||
// ===============
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// --------------------
|
||||
// Initialize Dropdowns
|
||||
// --------------------
|
||||
|
||||
$("#siccodes_per_page").val($sessionStorage.contractors_per_page || "20");
|
||||
|
||||
|
||||
// -----------
|
||||
// Find Button
|
||||
// -----------
|
||||
|
||||
$(".btnFind").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "SICCodes.setupSICCodes";
|
||||
$sessionStorage.pagination = "first";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
$("#find_siccode").on("keyup", function (e) {
|
||||
if (e.key === "Enter") {
|
||||
$(".btnFind").trigger("click");
|
||||
}
|
||||
});
|
||||
|
||||
// -----------------
|
||||
// Clear Find Button
|
||||
// -----------------
|
||||
|
||||
$(".btnClearFind").on("click", function () {
|
||||
|
||||
$("#find_siccode").val("").trigger("change");
|
||||
|
||||
$sessionStorage.action = "SICCodes.setupSICCodes";
|
||||
$sessionStorage.pagination = "first";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ------------------
|
||||
// Pagination Buttons
|
||||
// ------------------
|
||||
|
||||
$(".btnPagination").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "SICCodes.setupSICCodes";
|
||||
$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 = "SICCodes.addSICCode";
|
||||
$sessionStorage.addSICCode = "SICCodes.setupSICCodes";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// -----------
|
||||
// Done Button
|
||||
// -----------
|
||||
|
||||
$(".btnDone").on("click", function () {
|
||||
|
||||
formSubmit({action: ""});
|
||||
|
||||
});
|
||||
|
||||
// -----------------
|
||||
// Per Page Dropdown
|
||||
// -----------------
|
||||
|
||||
$("#siccodes_per_page").on("change", function () {
|
||||
|
||||
$sessionStorage.siccodes_per_page = $(this).val();
|
||||
$sessionStorage.action = "SICCodes.setupSICCodes";
|
||||
$sessionStorage.pagination = "first";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
|
||||
// ----
|
||||
// Edit
|
||||
// ----
|
||||
|
||||
$("#siccodes-table tbody").on("click touch", "tr", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$sessionStorage.action = "SICCodes.editSICCode";
|
||||
$sessionStorage.siccode_serial = $(this).data("siccode-serial");
|
||||
$sessionStorage.editSICCode = "SICCodes.setupSICCodes";
|
||||
$sessionStorage.deleteSICCode = "SICCodes.setupSICCodes";
|
||||
|
||||
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");
|
||||
|
||||
});
|
||||
@@ -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");
|
||||
|
||||
});
|
||||
@@ -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: ""});
|
||||
|
||||
});
|
||||
|
||||
// --------------------
|
||||
// Subscription Summary
|
||||
// --------------------
|
||||
|
||||
$("#subscriptions-table tbody").on("click touch", "tr", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$sessionStorage.action = "Subscriptions.subscriptionSummary";
|
||||
$sessionStorage.subscription_serial = $(e.target).closest("tr").data("subscription-serial");
|
||||
$sessionStorage.subscriptionSummary = "Subscriptions.setupSubscriptions";
|
||||
$sessionStorage.subscriptionSummary_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");
|
||||
|
||||
});
|
||||
@@ -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");
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
+152
@@ -0,0 +1,152 @@
|
||||
|
||||
// =======
|
||||
// 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;
|
||||
|
||||
});
|
||||
|
||||
$(".btnForgot").on("click", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
$("#reset-password").submit();
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#reset-password").submit(function (e) {
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
var user_name = $("#user_name");
|
||||
|
||||
user_name.val(user_name.val().replace(/\s+/g, " ").trim());
|
||||
|
||||
if (isBlank(user_name)) {
|
||||
createInputError(user_name, "User Name/Email is required to reset password");
|
||||
return false;
|
||||
}
|
||||
|
||||
$("#reset_user_name").val(user_name.val());
|
||||
|
||||
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"
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,268 @@
|
||||
|
||||
// ====================
|
||||
// Subscription Summary
|
||||
// ====================
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
var default_tab = "Counties";
|
||||
|
||||
var subscription_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
|
||||
// ------------
|
||||
|
||||
$("#subscription_completed").datepicker({format: "mm-dd-yyyy",
|
||||
container: "div.subscription_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.subscriptionSummary_tab = $sessionStorage.subscriptionSummary_tab || default_tab;
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
$("#tab-" + ($sessionStorage.subscriptionSummary_tab || default_tab)).tab("show");
|
||||
|
||||
// --------------------
|
||||
// Capture a Tab Change
|
||||
// --------------------
|
||||
|
||||
$(".nav-tabs a[data-bs-toggle='tab']").on("shown.bs.tab", function (e) {
|
||||
|
||||
$sessionStorage.subscriptionSummary_tab = $(e.target).attr("data-tab");
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
});
|
||||
|
||||
// ----------------------
|
||||
// Active Status Dropdown
|
||||
// ----------------------
|
||||
|
||||
$("#subscription_active").on("change", function () {
|
||||
|
||||
formPost({action: "Subscriptions.updateActiveStatus", subscription_serial: $sessionStorage.subscription_serial, subscription_active: $(this).val()});
|
||||
|
||||
location.reload();
|
||||
});
|
||||
|
||||
// ==============
|
||||
// Action Buttons
|
||||
// ==============
|
||||
|
||||
// -----------
|
||||
// Done Button
|
||||
// -----------
|
||||
|
||||
$(".btnDone").on("click", function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.subscriptionSummary || "";
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// -----------
|
||||
// Edit Button
|
||||
// -----------
|
||||
|
||||
$(".btnEdit").on("click", function () {
|
||||
|
||||
if (subscription_role === "Guest") {
|
||||
return false;
|
||||
}
|
||||
|
||||
$sessionStorage.action = "Subscriptions.editSubscription";
|
||||
$sessionStorage.editSubscription = "Subscriptions.subscriptionSummary";
|
||||
$sessionStorage.deleteSubscription = "Subscriptions.setupSubscriptions";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// =========
|
||||
// Notes Tab
|
||||
// =========
|
||||
|
||||
// ---------------
|
||||
// Add Note Button
|
||||
// ---------------
|
||||
|
||||
$(".btnAddNote").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Notes.addNote";
|
||||
$sessionStorage.note_type = "Subscription";
|
||||
$sessionStorage.note_reference = $sessionStorage.subscription_serial;
|
||||
$sessionStorage.addNote = "Subscriptions.subscriptionSummary";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ---------
|
||||
// Edit Note
|
||||
// ---------
|
||||
|
||||
$("#notes-table tbody").on("click touch", "tr", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
if (subscription_role === "Guest") {
|
||||
return false;
|
||||
}
|
||||
|
||||
$sessionStorage.action = "Notes.editNote";
|
||||
$sessionStorage.note_serial = $(this).data("note-serial");
|
||||
$sessionStorage.editNote = "Subscriptions.subscriptionSummary";
|
||||
$sessionStorage.deleteNote = "Subscriptions.subscriptionSummary";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ============
|
||||
// Counties Tab
|
||||
// ============
|
||||
|
||||
// ---------------------------------
|
||||
// Add County to Subscription Button
|
||||
// ---------------------------------
|
||||
|
||||
$(".btnAddCountyToSubscription").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Subscriptions.addCountyToSubscription";
|
||||
$sessionStorage.subscription_reference = $sessionStorage.subscription_serial;
|
||||
$sessionStorage.addCountyToSubscription = "Subscriptions.subscriptionSummary";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ----------------------------------------
|
||||
// Edit Subscription to Subscription Button
|
||||
// ----------------------------------------
|
||||
|
||||
$("#subscriptioncounties-table tbody").on("click touch", "tr", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
if (subscription_role === "Guest") {
|
||||
return false;
|
||||
}
|
||||
|
||||
$sessionStorage.action = "Subscriptions.editSubscriptionCounty";
|
||||
$sessionStorage.subscriptioncounty_serial = $(this).data("subscriptioncounty-serial");
|
||||
$sessionStorage.editSubscriptionCounty = "Subscriptions.subscriptionSummary";
|
||||
$sessionStorage.deleteSubscriptionCounty = "Subscriptions.subscriptionSummary";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ==========
|
||||
// Cities Tab
|
||||
// ==========
|
||||
|
||||
// -------------------------------
|
||||
// Add City to Subscription Button
|
||||
// -------------------------------
|
||||
|
||||
$(".btnAddCityToSubscription").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Subscriptions.addCityToSubscription";
|
||||
$sessionStorage.subscription_reference = $sessionStorage.subscription_serial;
|
||||
$sessionStorage.addCityToSubscription = "Subscriptions.subscriptionSummary";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ----------------------------------------
|
||||
// Edit Subscription to Subscription Button
|
||||
// ----------------------------------------
|
||||
|
||||
$("#subscriptioncities-table tbody").on("click touch", "tr", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
if (subscription_role === "Guest") {
|
||||
return false;
|
||||
}
|
||||
|
||||
$sessionStorage.action = "Subscriptions.editSubscriptionCity";
|
||||
$sessionStorage.subscriptioncity_serial = $(this).data("subscriptioncity-serial");
|
||||
$sessionStorage.editSubscriptionCity = "Subscriptions.subscriptionSummary";
|
||||
$sessionStorage.deleteSubscriptionCity = "Subscriptions.subscriptionSummary";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,54 @@
|
||||
|
||||
// ==================
|
||||
// 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("usersubscription-subscription");
|
||||
$sessionStorage.usersubscription_serial = $(this).data("usersubscription-serial");
|
||||
$sessionStorage.userSubscriptions = "Subscriptions.userSubscriptions";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,303 @@
|
||||
|
||||
// ============
|
||||
// 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);
|
||||
|
||||
});
|
||||
|
||||
// ----------------
|
||||
// Copy User Button
|
||||
// ----------------
|
||||
|
||||
$(".btnCopy").on("click", function () {
|
||||
|
||||
if (user_role === "Guest") {
|
||||
return false;
|
||||
}
|
||||
|
||||
$sessionStorage.action = "Users.copyUser";
|
||||
$sessionStorage.copyUser_serial = $sessionStorage.user_serial;
|
||||
$sessionStorage.copyUser = "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);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,231 @@
|
||||
|
||||
// ============
|
||||
// View Exports
|
||||
// ============
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
setTimeout(() => {
|
||||
location.reload();
|
||||
}, 60_000); // 60 seconds
|
||||
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// -----------
|
||||
// Find Button
|
||||
// -----------
|
||||
|
||||
$(".btnFind").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Export.usersExports";
|
||||
$sessionStorage.pagination = "first";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
$("#find_exportjob").on("keyup", function (e) {
|
||||
if (e.key === "Enter") {
|
||||
$(".btnFind").trigger("click");
|
||||
}
|
||||
});
|
||||
|
||||
// -----------------
|
||||
// Clear Find Button
|
||||
// -----------------
|
||||
|
||||
$(".btnClearFind").on("click", function () {
|
||||
|
||||
$("#find_exportjob").val("").trigger("change");
|
||||
|
||||
$sessionStorage.action = "Export.usersExports";
|
||||
$sessionStorage.pagination = "first";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ------------------
|
||||
// Pagination Buttons
|
||||
// ------------------
|
||||
|
||||
$(".btnPagination").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Export.usersExports";
|
||||
$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));
|
||||
|
||||
});
|
||||
|
||||
|
||||
// -------------
|
||||
// Exports Table
|
||||
// -------------
|
||||
|
||||
$("#exportjobs-table tbody").on("click touch", ".btnDownload", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
const $row = $(this).closest("tr");
|
||||
const exportCode = $row.data("export-code");
|
||||
|
||||
if (!exportCode) {
|
||||
console.error("export code not found on row", $row);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$sessionStorage.action = "Export.downloadExport";
|
||||
$sessionStorage.export_code = exportCode;
|
||||
|
||||
|
||||
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
|
||||
|
||||
});
|
||||
|
||||
// -----------
|
||||
// Done Button
|
||||
// -----------
|
||||
|
||||
$(".btnDone").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "";
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// --------------
|
||||
// Refresh Button
|
||||
// --------------
|
||||
|
||||
$(".btnRefresh").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Export.usersExports";
|
||||
$sessionStorage.pagination = "first";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ------------------
|
||||
// Save preset Inputs
|
||||
// ------------------
|
||||
|
||||
$("input[type=radio]:checked").trigger("change");
|
||||
|
||||
// -----------------
|
||||
// Per Page Dropdown
|
||||
// -----------------
|
||||
|
||||
$("#exportjobs_per_page").on("change", function () {
|
||||
|
||||
$(".btnFind").trigger("click");
|
||||
|
||||
});
|
||||
|
||||
// -------------------
|
||||
// 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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,210 @@
|
||||
|
||||
// ============
|
||||
// View Journal
|
||||
// ============
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(), $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");
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user