added alert classes and supporting functions
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;
|
||||
}
|
||||
|
||||
}
|
||||
+58
-58
@@ -3,66 +3,66 @@
|
||||
// Add Dropdown
|
||||
// ============
|
||||
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = "ATLHOUSINGREPORT",
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// -----------
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function(e) {
|
||||
e.preventDefault();
|
||||
$("#addDropdown").submit();
|
||||
});
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// --------------
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
// -----------
|
||||
// Save 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);
|
||||
|
||||
$(".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);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var $application = "ATLHOUSINGREPORT",
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// -----------
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var $application = "ATLHOUSINGREPORT",
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// -----------
|
||||
|
||||
@@ -263,6 +263,23 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
// --------------
|
||||
// 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
|
||||
// -------------
|
||||
|
||||
+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;
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var $application = "ATLHOUSINGREPORT",
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// -----------
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var $application = "ATLHOUSINGREPORT",
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// -----------
|
||||
|
||||
+138
-138
@@ -3,160 +3,160 @@
|
||||
// Edit Popover
|
||||
// ============
|
||||
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = "ATLHOUSINGREPORT",
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}"),
|
||||
$CKEditor;
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}"),
|
||||
$CKEditor;
|
||||
|
||||
// ----------------------
|
||||
// Initialize the Editor.
|
||||
// ----------------------
|
||||
// ----------------------
|
||||
// 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();
|
||||
|
||||
});
|
||||
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://"
|
||||
|
||||
// --------------
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
}
|
||||
})
|
||||
.then(editor => {
|
||||
$CKEditor = editor;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('CK-Editor error...');
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
$(".btnCancel").on("click", function() {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editPopover || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
// -----------
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
$(".btnSave").on("click", function (e) {
|
||||
|
||||
// -------------
|
||||
// Delete Button
|
||||
// -------------
|
||||
e.preventDefault();
|
||||
|
||||
$(".btnDelete").on("click", function() {
|
||||
$("#editPopover").submit();
|
||||
|
||||
$("#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
|
||||
// ---------------
|
||||
// --------------
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$("#editPopover").submit( function(e) {
|
||||
$(".btnCancel").on("click", function () {
|
||||
|
||||
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.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);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var $application = "ATLHOUSINGREPORT",
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// -----------
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var $application = "ATLHOUSINGREPORT",
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// -----------
|
||||
|
||||
@@ -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");
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var $application = "ATLHOUSINGREPORT",
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// --------------------------------
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var $application = "ATLHOUSINGREPORT",
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// -----------
|
||||
|
||||
+170
-146
@@ -3,179 +3,203 @@
|
||||
// Setup Popovers
|
||||
// ==============
|
||||
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = "PARKS",
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// -----------
|
||||
// Find Button
|
||||
// -----------
|
||||
|
||||
$(".btnFind").on("click", function() {
|
||||
|
||||
$sessionStorage.action = "Popovers.setupPopovers";
|
||||
$sessionStorage.pagination = "first";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
$("#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 : "" });
|
||||
|
||||
});
|
||||
// -----------
|
||||
// Find Button
|
||||
// -----------
|
||||
|
||||
// ----
|
||||
// Edit
|
||||
// ----
|
||||
$(".btnFind").on("click", function () {
|
||||
|
||||
$("#popovers-table tbody").on("click touch", "tr", function(e) {
|
||||
$sessionStorage.action = "Popovers.setupPopovers";
|
||||
$sessionStorage.pagination = "first";
|
||||
|
||||
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);
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
});
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
// -------------------
|
||||
// Save Changed Inputs
|
||||
// -------------------
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
$(".autosave").on("change", function(e) {
|
||||
});
|
||||
|
||||
switch (e.target.type) {
|
||||
$("#find_popover").on("keyup", function (e) {
|
||||
if (e.key === "Enter") {
|
||||
$(".btnFind").trigger("click");
|
||||
}
|
||||
});
|
||||
|
||||
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;
|
||||
// -----------------
|
||||
// Clear Find Button
|
||||
// -----------------
|
||||
|
||||
default : $sessionStorage[e.target.name] = $(this).val(); break;
|
||||
$(".btnClearFind").on("click", function () {
|
||||
|
||||
}
|
||||
$("#find_popover").val("").trigger("change");
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
$sessionStorage.action = "Popovers.setupPopovers";
|
||||
$sessionStorage.pagination = "first";
|
||||
|
||||
});
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
// ----------------
|
||||
// Initalize Inputs
|
||||
// ----------------
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
$.each($sessionStorage, function(name, value) {
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
var $input = $(":input").filter("[name='" + name + "']");
|
||||
});
|
||||
|
||||
if ($input.length > 0) {
|
||||
// ------------------
|
||||
// Pagination Buttons
|
||||
// ------------------
|
||||
|
||||
switch ($input.prop("type")) {
|
||||
$(".btnPagination").on("click", function () {
|
||||
|
||||
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;
|
||||
$sessionStorage.action = "Popovers.setupPopovers";
|
||||
$sessionStorage.pagination = $(this).data("pagination");
|
||||
|
||||
default : $input.val(value); break;
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
}
|
||||
$("#spinner-dialog").modal("show");
|
||||
|
||||
}
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
delete $sessionStorage.pagination;
|
||||
|
||||
// ------------------
|
||||
// Save preset Inputs
|
||||
// ------------------
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
$("input[type=radio]:checked").trigger("change");
|
||||
});
|
||||
|
||||
// -----------------
|
||||
// Per Page Dropdown
|
||||
// -----------------
|
||||
// ----------
|
||||
// Add Button
|
||||
// ----------
|
||||
|
||||
$("#popovers_per_page").on("change", function() {
|
||||
$(".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");
|
||||
|
||||
});
|
||||
|
||||
$(".btnFind").trigger("click");
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var $application = "ATLHOUSINGREPORT",
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// -----------
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var $application = "ATLHOUSINGREPORT",
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// -----------
|
||||
|
||||
Reference in New Issue
Block a user