git commit all base code
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,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,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,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,103 @@
|
||||
|
||||
// ================
|
||||
// Add Subscription
|
||||
// ================
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// --------------
|
||||
// Select Picker.
|
||||
// --------------
|
||||
|
||||
$(".search-dropdown").selectpicker({noneSelectedText: "",
|
||||
style: "",
|
||||
styleBase: "form-select form-select-sm",
|
||||
iconBase: "bi",
|
||||
virtualScroll: true,
|
||||
size: 10,
|
||||
selectOnTab: true,
|
||||
containter: "body",
|
||||
liveSearch: true});
|
||||
|
||||
// -----------
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$("#addSubscription").submit();
|
||||
|
||||
});
|
||||
|
||||
// --------------
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addSubscription || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#addSubscription").submit(function (e) {
|
||||
|
||||
var subscription_title = $("#subscription_title"),
|
||||
subscription_description = $("#subscription_description"),
|
||||
subscription_project_type = $("#subscription_projecttype"),
|
||||
subscription_area = $("#subscription_area");
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
subscription_title.val(subscription_title.val().replace(/\s+/g, " ").trim());
|
||||
subscription_title.val(subscription_title.val().replace(/\s+/g, " ").trim());
|
||||
|
||||
if (isBlank(subscription_title)) {
|
||||
createInputError(subscription_title, "Title is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isBlank(subscription_description)) {
|
||||
createInputError(subscription_description, "Description is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($("option:selected", subscription_project_type).val() === "") {
|
||||
createInputError(subscription_project_type, "Project Type is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($("option:selected", subscription_area).val() === "") {
|
||||
createInputError(subscription_area, "Area is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addSubscription || "";
|
||||
$sessionStorage.toast = "Subscription was Added";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
+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");
|
||||
+293
@@ -0,0 +1,293 @@
|
||||
|
||||
// ==============
|
||||
// Base Functions
|
||||
// ==============
|
||||
|
||||
// --------------------------------
|
||||
// Clear the Error State for Inputs
|
||||
// --------------------------------
|
||||
|
||||
function clearInputErrors() {
|
||||
|
||||
$(".is-invalid").removeClass("is-invalid");
|
||||
$(".invalid-feedback").remove();
|
||||
|
||||
}
|
||||
|
||||
// -----------------------------------
|
||||
// Create an Error State for an Input.
|
||||
// -----------------------------------
|
||||
|
||||
function createInputError(input, message = "", scroll = false) {
|
||||
|
||||
if ($(input).hasClass("search-dropdown")) { // Select Picker
|
||||
|
||||
$(input).closest(".bootstrap-select")
|
||||
.find("button").first()
|
||||
.addClass("is-invalid")
|
||||
.after("<div class='invalid-feedback fs-875'>" + message + "</div>")
|
||||
.focus();
|
||||
|
||||
} else {
|
||||
|
||||
$(input).focus().addClass("is-invalid");
|
||||
|
||||
if ($(input).is(":last-child")) {
|
||||
$(input).after("<div class='invalid-feedback'>" + message + "</div>");
|
||||
} else {
|
||||
$(input).siblings(":last").after("<div class='invalid-feedback'>" + message + "</div>");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (scroll === true) {
|
||||
|
||||
var element = document.getElementById(input.attr("id"));
|
||||
var header_offset = 130;
|
||||
var element_position = element.getBoundingClientRect().top;
|
||||
var offset_position = element_position + window.pageYOffset - header_offset;
|
||||
|
||||
window.scrollTo({
|
||||
top: offset_position,
|
||||
behavior: "smooth"
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ---------------------
|
||||
// Test for Blank Value.
|
||||
// ---------------------
|
||||
|
||||
function isBlank(object) {
|
||||
|
||||
if ($.trim(object.val()).length == 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// Verify an Email Address.
|
||||
// ------------------------
|
||||
|
||||
function isEmail(email) {
|
||||
|
||||
var valid = false;
|
||||
var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,6})+$/;
|
||||
|
||||
return regex.test(email.val());
|
||||
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// Validate a URL (syntax).
|
||||
// ------------------------
|
||||
|
||||
function isURL(object) {
|
||||
return /^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(object.val());
|
||||
}
|
||||
|
||||
// ---------------------------------
|
||||
// AJAX Call to Get Zip Code Detail.
|
||||
// ---------------------------------
|
||||
|
||||
function getZipCodeDetail(zipcode) {
|
||||
|
||||
var zipCodeDetail = null;
|
||||
|
||||
$.ajax({
|
||||
url: "./",
|
||||
type: "POST",
|
||||
async: false,
|
||||
data: {action: "get_zipcode_detail",
|
||||
zip_code: zipcode},
|
||||
dataType: "json",
|
||||
success: function (info) {
|
||||
zipCodeDetail = info;
|
||||
}
|
||||
});
|
||||
|
||||
return zipCodeDetail;
|
||||
|
||||
}
|
||||
|
||||
// -----------------------------
|
||||
// AJAX Call to Validate a Date.
|
||||
// -----------------------------
|
||||
|
||||
function isDate(date) {
|
||||
|
||||
var valid = false;
|
||||
|
||||
$.ajax({
|
||||
url: "./",
|
||||
type: "POST",
|
||||
async: false,
|
||||
data: {action: "validateDate",
|
||||
date: date.val()},
|
||||
dataType: "json",
|
||||
success: function (result) {
|
||||
valid = result;
|
||||
}
|
||||
});
|
||||
|
||||
return valid;
|
||||
|
||||
}
|
||||
|
||||
// ---------------------------------------------
|
||||
// Ending Date cannot be prior to Starting Date.
|
||||
// ---------------------------------------------
|
||||
|
||||
function checkEndingDate(startingDate, endingDate) {
|
||||
|
||||
var parts = startingDate.val().match(/(\d+)/g);
|
||||
var sDate = new Date(parts[0], parts[1] - 1, parts[2]);
|
||||
|
||||
parts = endingDate.val().match(/(\d+)/g);
|
||||
var eDate = new Date(parts[0], parts[1] - 1, parts[2]);
|
||||
|
||||
sDate.setHours(0, 0, 0, 0);
|
||||
eDate.setHours(0, 0, 0, 0);
|
||||
|
||||
// The Ending Date cannot be prior to the Starting Date.
|
||||
|
||||
if (eDate.getTime() < sDate.getTime()) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
// Convert a string to Title Case and remove extra spaces.
|
||||
// -------------------------------------------------------
|
||||
|
||||
function titleCase(string) {
|
||||
|
||||
string = string.replace(/([^\W_]+[^\s-]*) */g, function (s) {
|
||||
return s.charAt(0).toUpperCase() + s.slice(1);
|
||||
});
|
||||
string = string.replace(/\s+/g, " ").trim();
|
||||
|
||||
return string;
|
||||
|
||||
}
|
||||
|
||||
// ------------------------------------------
|
||||
// Trim a string and remove extra white space
|
||||
// ------------------------------------------
|
||||
|
||||
function trimString(string) {
|
||||
|
||||
return string.replace(/\s+/g, " ").trim();
|
||||
|
||||
}
|
||||
|
||||
// -------------------
|
||||
// Post a Form (AJAX).
|
||||
// -------------------
|
||||
|
||||
function formPost(inputs) {
|
||||
|
||||
var response = "";
|
||||
|
||||
$.ajax({
|
||||
url: "./",
|
||||
type: "POST",
|
||||
async: false,
|
||||
dataType: "json",
|
||||
data: inputs,
|
||||
success: function (results) {
|
||||
response = results;
|
||||
}, error: function (errorcode) {
|
||||
console.log(errorcode);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return response;
|
||||
|
||||
}
|
||||
|
||||
// --------------
|
||||
// Submit a Form.
|
||||
// --------------
|
||||
|
||||
//function formSubmit(inputs, target) {
|
||||
//
|
||||
// $('<form action="./" method="post" id="formSubmit"/>').appendTo("body");
|
||||
//
|
||||
// var form = $("#formSubmit");
|
||||
//
|
||||
// if (target === "_blank") {
|
||||
// form.prop("target", target);
|
||||
// }
|
||||
//
|
||||
// for (var name in inputs) {
|
||||
// form.append('<input type="hidden" name="' + name + '" value="' + inputs[name] + '"/>');
|
||||
// }
|
||||
//
|
||||
// console.log($('#formSubmit').html());
|
||||
//
|
||||
//// form.submit();
|
||||
//
|
||||
//}
|
||||
|
||||
// --------------
|
||||
// Submit a Form.
|
||||
// --------------
|
||||
|
||||
function formSubmit(inputs, target = "") {
|
||||
|
||||
var form = $("#formSubmit");
|
||||
|
||||
if (target === "_blank") {
|
||||
form.prop("target", target);
|
||||
} else {
|
||||
form.prop("target", "");
|
||||
}
|
||||
|
||||
for (var name in inputs) {
|
||||
form.append('<input type="hidden" name="' + name + '" value="' + inputs[name] + '"/>');
|
||||
}
|
||||
|
||||
form.submit();
|
||||
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// ----------------------------
|
||||
// Enable Tooltips and Popovers
|
||||
// ----------------------------
|
||||
|
||||
$("[data-bs-toggle=tooltip]").tooltip({trigger: "hover", container: "body"});
|
||||
$("[data-bs-toggle=popover]").popover({trigger: "focus", container: "body"});
|
||||
|
||||
// -------------
|
||||
// Display Toast
|
||||
// -------------
|
||||
|
||||
const toast = $sessionStorage.toast || "";
|
||||
|
||||
if (toast !== "") {
|
||||
|
||||
$(".toast-body").html(toast);
|
||||
|
||||
$("#toast-message").toast("show");
|
||||
|
||||
$sessionStorage.toast = "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
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,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
Vendored
+6
File diff suppressed because one or more lines are too long
+329
@@ -0,0 +1,329 @@
|
||||
// ============
|
||||
// Content Page
|
||||
// ============
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// ============
|
||||
// Navbar Links
|
||||
// ============
|
||||
|
||||
// ------------
|
||||
// Manage Links
|
||||
// ------------
|
||||
|
||||
$(".user-subscriptions").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Subscriptions.userSubscriptions";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
console.log($sessionStorage);
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// -------
|
||||
// Support
|
||||
// -------
|
||||
|
||||
$(".start-support-ticket").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "SupportTickets.startSupportTicket";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
console.log($sessionStorage);
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
$(".manage-permits").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Permits.managePermits";
|
||||
$sessionStorage.pagination = "first";
|
||||
$sessionStorage.find_permit = "";
|
||||
$sessionStorage.permits_order_by = "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// -------------
|
||||
// Consolidation
|
||||
// -------------
|
||||
|
||||
$(".rdi-consolidation").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Consolidation.consolidationSequence";
|
||||
$sessionStorage.step = "prompt";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// -----------------
|
||||
// Import Permit CSV
|
||||
// -----------------
|
||||
|
||||
$(".import-permit-csv").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Import.uploadCSVFile";
|
||||
$sessionStorage.step = "prompt";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// =============
|
||||
// Reports Links
|
||||
// =============
|
||||
|
||||
// -------------
|
||||
// Select Report
|
||||
// -------------
|
||||
|
||||
$(".select-report").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Reports.selectReport";
|
||||
$sessionStorage.pagination = "first";
|
||||
$sessionStorage.find_report = "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ===========
|
||||
// Setup Links
|
||||
// ===========
|
||||
|
||||
// --------
|
||||
// Counties
|
||||
// --------
|
||||
|
||||
$(".setup-counties").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Counties.setupCounties";
|
||||
$sessionStorage.pagination = "first";
|
||||
$sessionStorage.find_county = "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
// -----
|
||||
// Users
|
||||
// -----
|
||||
|
||||
$(".setup-users").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Users.setupUsers";
|
||||
$sessionStorage.pagination = "first";
|
||||
$sessionStorage.find_user = "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// -------------
|
||||
// Subscriptions
|
||||
// -------------
|
||||
|
||||
$(".setup-subscriptions").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Subscriptions.setupSubscriptions";
|
||||
$sessionStorage.pagination = "first";
|
||||
$sessionStorage.find_subscription = "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ---------
|
||||
// Dropdowns
|
||||
// ---------
|
||||
|
||||
$(".setup-dropdowns").on("click", function () {
|
||||
|
||||
sessionStorage.removeItem($application);
|
||||
|
||||
formSubmit({action: "Dropdowns.setupDropdowns"});
|
||||
|
||||
});
|
||||
|
||||
|
||||
// ===================
|
||||
// User Dropdown Links
|
||||
// ===================
|
||||
|
||||
// -----------------------
|
||||
// Toggle Dark/Light Theme
|
||||
// -----------------------
|
||||
|
||||
$(".toggle-theme").on("click", function () {
|
||||
|
||||
formPost({action: "toggleTheme"});
|
||||
|
||||
if (document.documentElement.getAttribute("data-bs-theme") === "dark") {
|
||||
document.documentElement.setAttribute("data-bs-theme", "light");
|
||||
} else {
|
||||
document.documentElement.setAttribute("data-bs-theme", "dark");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Sign out system
|
||||
// ---------------
|
||||
|
||||
$(".sign-out").on("click", function () {
|
||||
|
||||
formPost({action: "signout"});
|
||||
|
||||
window.location.reload();
|
||||
|
||||
});
|
||||
|
||||
// --------------------
|
||||
// Setup Dropdown Types
|
||||
// --------------------
|
||||
|
||||
$(".setup-dropdowntypes").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Dropdowns.setupDropdowntypes";
|
||||
$sessionStorage.pagination = "first";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ------------
|
||||
// View Journal
|
||||
// ------------
|
||||
|
||||
$(".view-journal").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Journal.viewJournal";
|
||||
$sessionStorage.pagination = "first";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
|
||||
// --------------------
|
||||
// View Support Tickets
|
||||
// --------------------
|
||||
|
||||
$(".view-support-tickets").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "SupportTickets.viewSupportTickets";
|
||||
$sessionStorage.pagination = "first";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// --------------
|
||||
// Setup Popovers
|
||||
// --------------
|
||||
|
||||
$(".setup-popovers").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Popovers.setupPopovers";
|
||||
$sessionStorage.pagination = "first";
|
||||
$sessionStorage.find_popover = "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// --------------
|
||||
// Setup 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 Statuses
|
||||
// --------------
|
||||
|
||||
$(".run-developer-stub").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "testing";
|
||||
|
||||
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
+255
@@ -0,0 +1,255 @@
|
||||
|
||||
// ==========
|
||||
// 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();
|
||||
|
||||
});
|
||||
|
||||
// -------------
|
||||
// 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.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,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,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,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,132 @@
|
||||
|
||||
// =================
|
||||
// Edit Subscription
|
||||
// =================
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// --------------
|
||||
// Select Picker.
|
||||
// --------------
|
||||
|
||||
$(".search-dropdown").selectpicker({noneSelectedText: "",
|
||||
style: "",
|
||||
styleBase: "form-select form-select-sm",
|
||||
iconBase: "bi",
|
||||
virtualScroll: true,
|
||||
size: 10,
|
||||
selectOnTab: true,
|
||||
containter: "body",
|
||||
liveSearch: true});
|
||||
|
||||
// -----------
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$("#editSubscription").submit();
|
||||
|
||||
});
|
||||
|
||||
// --------------
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editSubscription || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// -------------
|
||||
// Delete Button
|
||||
// -------------
|
||||
|
||||
$(".btnDelete").on("click", function () {
|
||||
|
||||
if (formPost({action: "Subscriptions.subscriptionActive", subscription_serial: $sessionStorage.subscription_serial}) === true) {
|
||||
|
||||
$("#continue-dialog").find(".modal-title").html("Cannot Delete Subscription").end()
|
||||
.find(".modal-body").html("This Subscription is in use and cannot be deleted.").end()
|
||||
.modal("show");
|
||||
|
||||
} else {
|
||||
|
||||
$("#confirm-dialog").removeClass().addClass("modal confirm-delete-subscription")
|
||||
.find(".modal-title").html("Confirm Delete Subscription").end()
|
||||
.find(".modal-body").html("Are you sure you wish to delete this Subscription?").end()
|
||||
.modal("show");
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$("body").on("click", ".confirm-delete-subscription .btnConfirmDialogConfirm", function () {
|
||||
|
||||
$.post("./", {action: "Subscriptions.deleteSubscription", subscription_serial: $sessionStorage.subscription_serial})
|
||||
.done(function () {
|
||||
formSubmit({action: $sessionStorage.deleteSubscription});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#editSubscription").submit(function (e) {
|
||||
|
||||
var subscription_title = $("#subscription_title"),
|
||||
subscription_description = $("#subscription_description"),
|
||||
subscription_project_type = $("subscription_projecttype"),
|
||||
subscription_area = $("#subscription_area");
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
subscription_title.val(subscription_title.val().replace(/\s+/g, " ").trim());
|
||||
subscription_title.val(subscription_title.val().replace(/\s+/g, " ").trim());
|
||||
|
||||
if (isBlank(subscription_title)) {
|
||||
createInputError(subscription_title, "Title is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isBlank(subscription_description)) {
|
||||
createInputError(subscription_description, "Description is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($("option:selected", subscription_project_type).val() === "") {
|
||||
createInputError(subscription_project_type, "Project Type is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($("option:selected", subscription_area).val() === "") {
|
||||
createInputError(subscription_area, "Area is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editSubscription || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
+144
@@ -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);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
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
+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,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,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,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,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: ""});
|
||||
|
||||
});
|
||||
|
||||
// ----
|
||||
// Edit
|
||||
// ----
|
||||
|
||||
$("#subscriptions-table tbody").on("click touch", "tr", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$sessionStorage.action = "Subscriptions.editSubscription";
|
||||
$sessionStorage.subscription_serial = $(this).data("subscription-serial");
|
||||
$sessionStorage.editSubscription = "Subscriptions.setupSubscriptions";
|
||||
$sessionStorage.deleteSubscription = "Subscriptions.setupSubscriptions";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// -------------------
|
||||
// Save Changed Inputs
|
||||
// -------------------
|
||||
|
||||
$(".autosave").on("change", function (e) {
|
||||
|
||||
switch (e.target.type) {
|
||||
|
||||
case "text" :
|
||||
$sessionStorage[e.target.name] = $(this).val();
|
||||
break;
|
||||
case "radio" :
|
||||
$sessionStorage[e.target.name] = $(this).val();
|
||||
break;
|
||||
case "checkbox" :
|
||||
$sessionStorage[e.target.name] = $(this).prop("checked");
|
||||
break;
|
||||
case "select-one" :
|
||||
$sessionStorage[e.target.name] = $(this).val();
|
||||
break;
|
||||
case "hidden" :
|
||||
$sessionStorage[e.target.name] = $(this).val();
|
||||
break;
|
||||
|
||||
default :
|
||||
$sessionStorage[e.target.name] = $(this).val();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
});
|
||||
|
||||
// ----------------
|
||||
// Initalize Inputs
|
||||
// ----------------
|
||||
|
||||
$.each($sessionStorage, function (name, value) {
|
||||
|
||||
var $input = $(":input").filter("[name=" + name + "]");
|
||||
|
||||
if ($input.length > 0) {
|
||||
|
||||
switch ($input.prop("type")) {
|
||||
|
||||
case "text" :
|
||||
$input.val(value);
|
||||
break;
|
||||
case "radio" :
|
||||
$input.filter("[value=" + value + "]").prop("checked", true);
|
||||
break;
|
||||
case "checkbox" :
|
||||
$input.prop("checked", value);
|
||||
break;
|
||||
case "select-one" :
|
||||
$input.val(value);
|
||||
break;
|
||||
case "hidden" :
|
||||
$input.val(value);
|
||||
break;
|
||||
|
||||
default :
|
||||
$input.val(value);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// ------------------
|
||||
// Save preset Inputs
|
||||
// ------------------
|
||||
|
||||
$("input[type=radio]:checked").trigger("change");
|
||||
|
||||
});
|
||||
@@ -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,283 @@
|
||||
|
||||
// ============
|
||||
// User Summary
|
||||
// ============
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
var default_tab = "Subscriptions";
|
||||
|
||||
var user_role = $("#USER_ROLE").val();
|
||||
|
||||
//
|
||||
// --------------
|
||||
// Select Picker.
|
||||
// --------------
|
||||
|
||||
$(".search-dropdown").selectpicker({noneSelectedText: "",
|
||||
style: "",
|
||||
styleBase: "form-select form-select-sm",
|
||||
iconBase: "bi",
|
||||
virtualScroll: true,
|
||||
size: 10,
|
||||
selectOnTab: true,
|
||||
containter: "body",
|
||||
liveSearch: true});
|
||||
|
||||
// -----------
|
||||
// Input Masks
|
||||
// -----------
|
||||
|
||||
$(".date-mask").inputmask({alias: "datetime",
|
||||
inputFormat: "mm/dd/yyyy",
|
||||
placeholder: "MM/DD/YYYY",
|
||||
showMaskOnHover: false});
|
||||
|
||||
$(".numeric-mask").inputmask("9{0,9}", {showMaskOnHover: false});
|
||||
|
||||
$(".numeric-2-mask").inputmask({alias: "numeric",
|
||||
showMaskOnHover: false,
|
||||
placeholder: "0",
|
||||
groupSeparator: ",",
|
||||
allowMinus: false,
|
||||
digitsOptional: false,
|
||||
digits: 2});
|
||||
|
||||
// ------------
|
||||
// Date Pickers
|
||||
// ------------
|
||||
|
||||
$("#user_completed").datepicker({format: "mm-dd-yyyy",
|
||||
container: "div.user_completed",
|
||||
keyboardNavigation: false,
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
endDate: "0d",
|
||||
orientation: "left bottom",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true});
|
||||
|
||||
// Disable standard Drag/Drop processing.
|
||||
|
||||
$("html").on("dragenter dragover dragleave drop", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
});
|
||||
|
||||
// ---------------------------
|
||||
// Set and Show the Active Tab
|
||||
// --------------------------
|
||||
|
||||
$sessionStorage.userSummary_tab = $sessionStorage.userSummary_tab || default_tab;
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
$("#tab-" + ($sessionStorage.userSummary_tab || default_tab)).tab("show");
|
||||
|
||||
// --------------------
|
||||
// Capture a Tab Change
|
||||
// --------------------
|
||||
|
||||
$(".nav-tabs a[data-bs-toggle='tab']").on("shown.bs.tab", function (e) {
|
||||
|
||||
$sessionStorage.userSummary_tab = $(e.target).attr("data-tab");
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
});
|
||||
|
||||
// ----------------------
|
||||
// Active Status Dropdown
|
||||
// ----------------------
|
||||
|
||||
$("#user_active").on("change", function () {
|
||||
|
||||
formPost({action: "Users.updateActiveStatus", user_serial: $sessionStorage.user_serial, user_active: $(this).val()});
|
||||
|
||||
location.reload();
|
||||
});
|
||||
|
||||
// --------------------
|
||||
// Reset Users Password
|
||||
// ---------------------
|
||||
|
||||
$(".btnResetPassword").on("click", function () {
|
||||
|
||||
formPost({action: "Users.resetPassword", user_serial: $sessionStorage.user_serial});
|
||||
|
||||
$sessionStorage.toast = "Passsword Reset";
|
||||
location.reload();
|
||||
|
||||
});
|
||||
|
||||
// ==============
|
||||
// Action Buttons
|
||||
// ==============
|
||||
|
||||
// -----------
|
||||
// Done Button
|
||||
// -----------
|
||||
|
||||
$(".btnDone").on("click", function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.userSummary || "";
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// -----------
|
||||
// Edit Button
|
||||
// -----------
|
||||
|
||||
$(".btnEdit").on("click", function () {
|
||||
|
||||
if (user_role === "Guest") {
|
||||
return false;
|
||||
}
|
||||
|
||||
$sessionStorage.action = "Users.editUser";
|
||||
$sessionStorage.editUser = "Users.userSummary";
|
||||
$sessionStorage.deleteUser = "Users.setupUsers";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ------------
|
||||
// Print Button
|
||||
// ------------
|
||||
|
||||
$(".btnPrint").on("click", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
window.open("", "PrintTab");
|
||||
|
||||
$("input[name = 'user_serial']", "#PrintUserSummaryForm").val($sessionStorage.user_serial);
|
||||
$("#PrintUserSummaryForm").submit();
|
||||
|
||||
});
|
||||
|
||||
// -------------
|
||||
// Delete Button
|
||||
// -------------
|
||||
|
||||
$(".btnDelete").on("click", function () {
|
||||
|
||||
$("#confirm-dialog").removeClass().addClass("modal confirm-delete-user")
|
||||
.find(".modal-title").html("Confirm Delete User").end()
|
||||
.find(".modal-body").html("Are you sure you wish to delete this User?").end()
|
||||
.modal("show");
|
||||
|
||||
});
|
||||
|
||||
$("body").on("click", ".confirm-delete-user .btnConfirmDialogConfirm", function () {
|
||||
|
||||
$.post("./", {action: "Users.deleteUser", user_serial: $sessionStorage.user_serial})
|
||||
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.deleteUser || "";
|
||||
$sessionStorage.toast = "User was Deleted";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// =========
|
||||
// Notes Tab
|
||||
// =========
|
||||
|
||||
// ---------------
|
||||
// Add Note Button
|
||||
// ---------------
|
||||
|
||||
$(".btnAddNote").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Notes.addNote";
|
||||
$sessionStorage.note_type = "User";
|
||||
$sessionStorage.note_reference = $sessionStorage.user_serial;
|
||||
$sessionStorage.addNote = "Users.userSummary";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ---------
|
||||
// Edit Note
|
||||
// ---------
|
||||
|
||||
$("#notes-table tbody").on("click touch", "tr", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
if (user_role === "Guest") {
|
||||
return false;
|
||||
}
|
||||
|
||||
$sessionStorage.action = "Notes.editNote";
|
||||
$sessionStorage.note_serial = $(this).data("note-serial");
|
||||
$sessionStorage.editNote = "Users.userSummary";
|
||||
$sessionStorage.deleteNote = "Users.userSummary";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
// =================
|
||||
// Subscriptions Tab
|
||||
// =================
|
||||
|
||||
// -------------------------------
|
||||
// Add Subscription to User Button
|
||||
// -------------------------------
|
||||
|
||||
$(".btnAddSubscription").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "Subscriptions.addSubscriptionToUser";
|
||||
$sessionStorage.user_reference = $sessionStorage.user_serial;
|
||||
$sessionStorage.addSubscriptionToUser = "Users.userSummary";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// --------------------------------
|
||||
// Edit Subscription to User Button
|
||||
// --------------------------------
|
||||
|
||||
$("#usersubscriptions-table tbody").on("click touch", "tr", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
if (user_role === "Guest") {
|
||||
return false;
|
||||
}
|
||||
|
||||
$sessionStorage.action = "Subscriptions.editUsersSubscription";
|
||||
$sessionStorage.usersubscription_serial = $(this).data("usersubscription-serial");
|
||||
$sessionStorage.editUsersSubscription = "Users.userSummary";
|
||||
$sessionStorage.deleteUsersSubscription = "Users.userSummary";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,187 @@
|
||||
|
||||
// ============
|
||||
// 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