generated from jric11/baseProject
Chat's updates for security, db and workflow
Security and workflow regressions / regression (push) Has been cancelled
Security and workflow regressions / regression (push) Has been cancelled
This commit is contained in:
+10
-9
@@ -94,22 +94,22 @@ $(document).ready(function () {
|
||||
// Show Calendar Buttons
|
||||
// ---------------------
|
||||
|
||||
$(".btnAlertStartDateCalendar").on("click", function (e) {
|
||||
$(".btnAlertStartDateCalendar").on("click", async function (e) {
|
||||
e.preventDefault();
|
||||
$("#alert_starts_date").focus().datepicker("show");
|
||||
});
|
||||
|
||||
$(".btnAlertExpiresDateCalendar").on("click", function (e) {
|
||||
$(".btnAlertExpiresDateCalendar").on("click", async function (e) {
|
||||
e.preventDefault();
|
||||
$("#alert_expires_date").focus().datepicker("show");
|
||||
});
|
||||
|
||||
|
||||
$("#alert_starts_date").on("blur", function () {
|
||||
$("#alert_starts_date").on("blur", async function () {
|
||||
$("#alert_starts_time").focus();
|
||||
});
|
||||
|
||||
$("#alert_expires_date").on("blur", function () {
|
||||
$("#alert_expires_date").on("blur", async function () {
|
||||
$("#alert_expires_time").focus();
|
||||
});
|
||||
|
||||
@@ -117,7 +117,7 @@ $(document).ready(function () {
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function (e) {
|
||||
$(".btnSave").on("click", async function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
@@ -129,7 +129,7 @@ $(document).ready(function () {
|
||||
// Cancel Button
|
||||
// -------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
$(".btnCancel").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addAlert || "";
|
||||
|
||||
@@ -143,7 +143,8 @@ $(document).ready(function () {
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#addAlert").submit(function (e) {
|
||||
$("#addAlert").submit(async function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var alert_title = $("#alert_title"),
|
||||
alert_starts_date = $("#alert_starts_date"),
|
||||
@@ -162,7 +163,7 @@ $(document).ready(function () {
|
||||
}
|
||||
|
||||
|
||||
if ((!isBlank(alert_starts_date)) && (!isDate(alert_starts_date))) {
|
||||
if ((!isBlank(alert_starts_date)) && (!await isDate(alert_starts_date))) {
|
||||
createInputError(alert_starts_date, "Date is invalid");
|
||||
return false;
|
||||
}
|
||||
@@ -182,7 +183,7 @@ $(document).ready(function () {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((!isBlank(alert_expires_date)) && (!isDate(alert_expires_date))) {
|
||||
if ((!isBlank(alert_expires_date)) && (!await isDate(alert_expires_date))) {
|
||||
createInputError(alert_expires_date, "Date is invalid");
|
||||
return false;
|
||||
}
|
||||
|
||||
+5
-4
@@ -12,7 +12,7 @@ $(document).ready(function () {
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function (e) {
|
||||
$(".btnSave").on("click", async function (e) {
|
||||
e.preventDefault();
|
||||
$("#addDropdown").submit();
|
||||
});
|
||||
@@ -21,7 +21,7 @@ $(document).ready(function () {
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
$(".btnCancel").on("click", async function () {
|
||||
formSubmit({action: $sessionStorage.addDropdown});
|
||||
});
|
||||
|
||||
@@ -29,7 +29,8 @@ $(document).ready(function () {
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#addDropdown").submit(function (e) {
|
||||
$("#addDropdown").submit(async function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var dropdowntype_serial = $("#dropdowntype_serial").val(),
|
||||
dropdown_value = $("#dropdown_value");
|
||||
@@ -43,7 +44,7 @@ $(document).ready(function () {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (formPost({action: "Dropdowns.dropdownExists", dropdowntype_serial: dropdowntype_serial, dropdown_serial: 0, dropdown_value: dropdown_value.val()}) === true) {
|
||||
if (await 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;
|
||||
}
|
||||
|
||||
+8
-17
@@ -3,7 +3,7 @@
|
||||
// Add Dropdowntype
|
||||
// ================
|
||||
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
@@ -12,7 +12,7 @@ $(document).ready(function() {
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function(e) {
|
||||
$(".btnSave").on("click", async function (e) {
|
||||
e.preventDefault();
|
||||
$("#addDropdowntype").submit();
|
||||
});
|
||||
@@ -21,7 +21,7 @@ $(document).ready(function() {
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function() {
|
||||
$(".btnCancel").on("click", async function () {
|
||||
formSubmit({ action : $sessionStorage.addDropdowntype });
|
||||
});
|
||||
|
||||
@@ -29,7 +29,8 @@ $(document).ready(function() {
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#addDropdowntype").submit( function(e) {
|
||||
$("#addDropdowntype").submit( async function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var dropdowntype_name = $("#dropdowntype_name"),
|
||||
dropdowntype_title = $("#dropdowntype_title"),
|
||||
@@ -48,7 +49,7 @@ $(document).ready(function() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (formPost({ action : "Dropdowns.dropdowntypeExists", dropdowntype_serial : 0, dropdowntype_name : dropdowntype_name.val() }) === true) {
|
||||
if (await formPost({ action : "Dropdowns.dropdowntypeExists", dropdowntype_serial : 0, dropdowntype_name : dropdowntype_name.val() }) === true) {
|
||||
createInputError(dropdowntype_name, "Name already exists");
|
||||
return false;
|
||||
}
|
||||
@@ -58,26 +59,16 @@ $(document).ready(function() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (formPost({ action : "Dropdowns.dropdowntypetitleExists", dropdowntype_serial : 0, dropdowntype_title : dropdowntype_title.val() }) === true) {
|
||||
if (await 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() {
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addDropdowntype || "";
|
||||
$sessionStorage.toast = "Dropdown Type was Added";
|
||||
|
||||
+4
-3
@@ -12,7 +12,7 @@ $(document).ready(function () {
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function (e) {
|
||||
$(".btnSave").on("click", async function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
@@ -24,7 +24,7 @@ $(document).ready(function () {
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
$(".btnCancel").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addNote || "";
|
||||
|
||||
@@ -38,7 +38,8 @@ $(document).ready(function () {
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#addNote").submit(function (e) {
|
||||
$("#addNote").submit(async function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var note_text = $("#note_text");
|
||||
|
||||
|
||||
+5
-4
@@ -59,7 +59,7 @@ $(document).ready(function () {
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function (e) {
|
||||
$(".btnSave").on("click", async function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
@@ -71,7 +71,7 @@ $(document).ready(function () {
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
$(".btnCancel").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addPopover || "";
|
||||
|
||||
@@ -85,7 +85,8 @@ $(document).ready(function () {
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#addPopover").submit(function (e) {
|
||||
$("#addPopover").submit(async function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var popover_name = $("#popover_name"),
|
||||
popover_title = $("#popover_title"),
|
||||
@@ -101,7 +102,7 @@ $(document).ready(function () {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (formPost({action: "Popovers.popoverExists", popover_serial: 0, popover_name: popover_name.val()}) === true) {
|
||||
if (await formPost({action: "Popovers.popoverExists", popover_serial: 0, popover_name: popover_name.val()}) === true) {
|
||||
createInputError(popover_name, "Name already exists");
|
||||
return false;
|
||||
}
|
||||
|
||||
+5
-4
@@ -12,7 +12,7 @@ $(document).ready(function () {
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function (e) {
|
||||
$(".btnSave").on("click", async function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
@@ -24,7 +24,7 @@ $(document).ready(function () {
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
$(".btnCancel").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addReport || "";
|
||||
|
||||
@@ -38,7 +38,8 @@ $(document).ready(function () {
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#addReport").submit(function (e) {
|
||||
$("#addReport").submit(async function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var report_name = $("#report_name"),
|
||||
report_class = $("#report_class"),
|
||||
@@ -59,7 +60,7 @@ $(document).ready(function () {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (formPost({action: "Reports.reportExists", report_serial: 0, report_class: report_class.val()}) === true) {
|
||||
if (await formPost({action: "Reports.reportExists", report_serial: 0, report_class: report_class.val()}) === true) {
|
||||
createInputError(report_class, "Class already exists");
|
||||
return false;
|
||||
}
|
||||
|
||||
+7
-6
@@ -3,7 +3,7 @@
|
||||
// Add Status
|
||||
// ==========
|
||||
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
@@ -12,7 +12,7 @@ $(document).ready(function() {
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function(e) {
|
||||
$(".btnSave").on("click", async function (e) {
|
||||
e.preventDefault();
|
||||
$("#addStatus").submit();
|
||||
});
|
||||
@@ -21,7 +21,7 @@ $(document).ready(function() {
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function() {
|
||||
$(".btnCancel").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addStatus || "";
|
||||
|
||||
@@ -35,7 +35,8 @@ $(document).ready(function() {
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#addStatus").submit( function(e) {
|
||||
$("#addStatus").submit( async function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var status_name = $("#status_name"),
|
||||
status_classes = $("#status_classes");
|
||||
@@ -50,7 +51,7 @@ $(document).ready(function() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (formPost({ action : "Statuses.statusExists", status_serial : 0, status_name : status_name.val() }) === true) {
|
||||
if (await formPost({ action : "Statuses.statusExists", status_serial : 0, status_name : status_name.val() }) === true) {
|
||||
createInputError(status_name, "Name already exists");
|
||||
return false;
|
||||
}
|
||||
@@ -59,7 +60,7 @@ $(document).ready(function() {
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
|
||||
.done(function() {
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addStatus || "";
|
||||
$sessionStorage.toast = "Status was Added";
|
||||
|
||||
+13
-9
@@ -27,11 +27,11 @@ $(document).ready(function () {
|
||||
// Get the User Information
|
||||
// ------------------------
|
||||
|
||||
$("#user_name").on("change", function () {
|
||||
$("#user_name").on("change", async function () {
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
let user = formPost({action: "Users.getUser_AJAX", user_name: $(this).val()});
|
||||
let user = await formPost({action: "Users.getUser_AJAX", user_name: $(this).val()});
|
||||
|
||||
if (user.exists === true) {
|
||||
createInputError($(this), "User ID already exists");
|
||||
@@ -44,7 +44,7 @@ $(document).ready(function () {
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function (e) {
|
||||
$(".btnSave").on("click", async function (e) {
|
||||
e.preventDefault();
|
||||
$("#addUser").submit();
|
||||
});
|
||||
@@ -53,7 +53,7 @@ $(document).ready(function () {
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
$(".btnCancel").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addUser || "";
|
||||
|
||||
@@ -66,7 +66,7 @@ $(document).ready(function () {
|
||||
// Toggle Show Password
|
||||
// --------------------
|
||||
|
||||
$("#togglePassword").click(function () {
|
||||
$("#togglePassword").click(async function () {
|
||||
var passwordField = $("#user_password");
|
||||
var type = passwordField.attr("type") === "password" ? "text" : "password";
|
||||
passwordField.attr("type", type);
|
||||
@@ -80,7 +80,8 @@ $(document).ready(function () {
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#addUser").submit(function (e) {
|
||||
$("#addUser").submit(async function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var user_name = $("#user_name"),
|
||||
user_first_name = $("#user_first_name"),
|
||||
@@ -96,7 +97,7 @@ $(document).ready(function () {
|
||||
return false;
|
||||
}
|
||||
|
||||
let user = formPost({action: "Users.getUser_AJAX", user_name: user_name.val()});
|
||||
let user = await formPost({action: "Users.getUser_AJAX", user_name: user_name.val()});
|
||||
|
||||
if (user.valid === false) {
|
||||
createInputError(user_name, "User Name is invalid");
|
||||
@@ -109,7 +110,7 @@ $(document).ready(function () {
|
||||
}
|
||||
|
||||
if (isBlank(user_first_name)) {
|
||||
createInputError(user_first_name, "Client Name is required");
|
||||
createInputError(user_first_name, "First name is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -118,6 +119,7 @@ $(document).ready(function () {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isBlank($('#user_last_name'))) { createInputError($('#user_last_name'),'Last name is required');return false; }
|
||||
if ($("option:selected", user_role).val() === "") {
|
||||
createInputError(user_role, "Role is required");
|
||||
return false;
|
||||
@@ -127,7 +129,9 @@ $(document).ready(function () {
|
||||
e.preventDefault();
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
.done(function () {
|
||||
.done(function (result) {
|
||||
$sessionStorage.toast=result.warning || 'Account created and invitation sent.';
|
||||
sessionStorage.setItem($application,JSON.stringify($sessionStorage));
|
||||
formSubmit({action: $sessionStorage.addUser});
|
||||
});
|
||||
|
||||
|
||||
+2
-2
@@ -17,10 +17,10 @@ function resetLogoutTimer() {
|
||||
startLogoutTimer();
|
||||
}
|
||||
|
||||
function logoutUser() {
|
||||
async function logoutUser() {
|
||||
|
||||
// Redirect to a PHP logout script
|
||||
formPost({action: "signout"});
|
||||
await formPost({action: "signout"});
|
||||
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
+9
-83
@@ -1,84 +1,10 @@
|
||||
|
||||
// =====================
|
||||
// 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));
|
||||
|
||||
$(function(){
|
||||
const application=$('#APPLICATION_MNEMONIC').val();if(!application)return;
|
||||
const key=application+':autosave:'+window.location.pathname;
|
||||
let saved={};try{saved=JSON.parse(sessionStorage.getItem(key)||'{}');}catch(error){sessionStorage.removeItem(key);}
|
||||
$('.autosave').filter(':not([type="password"]):not([type="hidden"])').each(function(){
|
||||
if(Object.prototype.hasOwnProperty.call(saved,this.name)){
|
||||
if(this.type==='checkbox')$(this).prop('checked',!!saved[this.name]);else $(this).val(saved[this.name]);
|
||||
}
|
||||
}).on('change',function(){saved[this.name]=this.type==='checkbox'?this.checked:$(this).val();sessionStorage.setItem(key,JSON.stringify(saved));});
|
||||
});
|
||||
|
||||
// ----------------
|
||||
// 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");
|
||||
+44
-96
@@ -109,48 +109,16 @@ function isURL(object) {
|
||||
// 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;
|
||||
|
||||
async function getZipCodeDetail(zipcode) {
|
||||
return await formPost({action:'getZipcode',zip_code:zipcode});
|
||||
}
|
||||
|
||||
// -----------------------------
|
||||
// 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;
|
||||
|
||||
async function isDate(date) {
|
||||
return await formPost({action:'validateDate',date:date.val()});
|
||||
}
|
||||
|
||||
// ---------------------------------------------
|
||||
@@ -208,71 +176,44 @@ function trimString(string) {
|
||||
// -------------------
|
||||
|
||||
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;
|
||||
|
||||
return $.ajax({url:'./',type:'POST',dataType:'json',data:inputs});
|
||||
}
|
||||
|
||||
// --------------
|
||||
// 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 = "") {
|
||||
const form=$("#formSubmit");
|
||||
form.prop('target',target);
|
||||
form.find('input').not('[name="csrf_token"]').remove();
|
||||
Object.entries(inputs).forEach(([name,value])=>{
|
||||
if(name!=='csrf_token' && value!==undefined && value!==null)$('<input>',{type:'hidden',name:name,value:String(value)}).appendTo(form);
|
||||
});
|
||||
form.get(0).submit();
|
||||
}
|
||||
|
||||
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).ajaxError(function(event,xhr){
|
||||
const message=(xhr.responseJSON && xhr.responseJSON.error) || (xhr.status===401?'Your session has expired. Reload the page to sign in.':'The request failed. Please try again.');
|
||||
showRequestMessage(message,'danger');
|
||||
});
|
||||
$(document).ajaxStart(function(){
|
||||
$('.btnSave,.btnConfirmDialogConfirm').filter(':enabled').addClass('request-busy').prop('disabled',true).attr('aria-busy','true');
|
||||
}).ajaxStop(function(){
|
||||
$('.request-busy').prop('disabled',false).removeClass('request-busy').removeAttr('aria-busy');
|
||||
});
|
||||
// jQuery reports these failures through ajaxError above. Stop the rejected event
|
||||
// handler without also producing an unhandled promise error in the browser.
|
||||
window.addEventListener('unhandledrejection',function(event){
|
||||
if(event.reason && typeof event.reason.status==='number')event.preventDefault();
|
||||
});
|
||||
function showRequestMessage(message,kind='info'){
|
||||
let box=$('#request-message');
|
||||
let target=$('.modal.show .modal-body').first();
|
||||
if(!target.length)target=$('.hr-workspace,main,body').first();
|
||||
if(!box.length)box=$('<div>',{id:'request-message',role:'alert',tabindex:'-1'});
|
||||
box.prependTo(target);
|
||||
box.attr('class','alert alert-'+kind).text(message).trigger('focus');
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
@@ -283,8 +224,15 @@ $(document).ready(function () {
|
||||
// Enable Tooltips and Popovers
|
||||
// ----------------------------
|
||||
|
||||
$("[data-bs-toggle=tooltip]").tooltip({trigger: "hover", container: "body"});
|
||||
$("[data-bs-toggle=popover]").popover({trigger: "focus", container: "body"});
|
||||
document.querySelectorAll('[data-bs-toggle="tooltip"]').forEach(element=>{
|
||||
const title=element.getAttribute('data-bs-title')||element.getAttribute('title')||'';
|
||||
if(title)bootstrap.Tooltip.getOrCreateInstance(element,{title:title,trigger:'hover',container:'body'});
|
||||
});
|
||||
document.querySelectorAll('[data-bs-toggle="popover"]').forEach(element=>{
|
||||
const title=element.getAttribute('data-bs-title')||element.getAttribute('title')||'';
|
||||
const content=element.getAttribute('data-bs-content')||'';
|
||||
if(title||content)bootstrap.Popover.getOrCreateInstance(element,{title:title,content:content,trigger:'focus',container:'body'});
|
||||
});
|
||||
|
||||
// -------------
|
||||
// Display Toast
|
||||
@@ -294,7 +242,7 @@ $(document).ready(function () {
|
||||
|
||||
if (toast !== "") {
|
||||
|
||||
$(".toast-body").html(toast);
|
||||
$(".toast-body").text(toast);
|
||||
|
||||
$("#toast-message").toast("show");
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
if (/msie\s|trident/i.test(window.navigator.userAgent)) {
|
||||
window.location.href = 'html/unsupported.html';
|
||||
}
|
||||
document.addEventListener('click', function (event) {
|
||||
if (event.target.closest('[data-app-return]')) window.location.href = 'main.php';
|
||||
});
|
||||
+14
-129
@@ -11,81 +11,6 @@ $(document).ready(function () {
|
||||
// Navbar Links
|
||||
// ============
|
||||
|
||||
// ------------
|
||||
// Manage Links
|
||||
// ------------
|
||||
|
||||
$(".user-subscriptions").on("click", function () {
|
||||
|
||||
$sessionStorage.action = "StripePayments.checkout";
|
||||
|
||||
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
|
||||
// =============
|
||||
@@ -94,7 +19,7 @@ $(document).ready(function () {
|
||||
// Select Report
|
||||
// -------------
|
||||
|
||||
$(".select-report").on("click", function () {
|
||||
$(".select-report").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Reports.selectReport";
|
||||
$sessionStorage.pagination = "first";
|
||||
@@ -110,26 +35,11 @@ $(document).ready(function () {
|
||||
// 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 () {
|
||||
$(".setup-users").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Users.setupUsers";
|
||||
$sessionStorage.pagination = "first";
|
||||
@@ -141,27 +51,11 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
// -------------
|
||||
// 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 () {
|
||||
$(".setup-dropdowns").on("click", async function () {
|
||||
|
||||
sessionStorage.removeItem($application);
|
||||
|
||||
@@ -178,9 +72,9 @@ $(document).ready(function () {
|
||||
// Toggle Dark/Light Theme
|
||||
// -----------------------
|
||||
|
||||
$(".toggle-theme").on("click", function () {
|
||||
$(".toggle-theme").on("click", async function () {
|
||||
|
||||
formPost({action: "toggleTheme"});
|
||||
await formPost({action: "toggleTheme"});
|
||||
|
||||
if (document.documentElement.getAttribute("data-bs-theme") === "dark") {
|
||||
document.documentElement.setAttribute("data-bs-theme", "light");
|
||||
@@ -194,9 +88,9 @@ $(document).ready(function () {
|
||||
// Sign out system
|
||||
// ---------------
|
||||
|
||||
$(".sign-out").on("click", function () {
|
||||
$(".sign-out").on("click", async function () {
|
||||
|
||||
formPost({action: "signout"});
|
||||
await formPost({action: "signout"});
|
||||
|
||||
window.location.reload();
|
||||
|
||||
@@ -206,7 +100,7 @@ $(document).ready(function () {
|
||||
// Setup Dropdown Types
|
||||
// --------------------
|
||||
|
||||
$(".setup-dropdowntypes").on("click", function () {
|
||||
$(".setup-dropdowntypes").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Dropdowns.setupDropdowntypes";
|
||||
$sessionStorage.pagination = "first";
|
||||
@@ -221,7 +115,7 @@ $(document).ready(function () {
|
||||
// View Journal
|
||||
// ------------
|
||||
|
||||
$(".view-journal").on("click", function () {
|
||||
$(".view-journal").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Journal.viewJournal";
|
||||
$sessionStorage.pagination = "first";
|
||||
@@ -237,22 +131,13 @@ $(document).ready(function () {
|
||||
// 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 () {
|
||||
$(".setup-popovers").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Popovers.setupPopovers";
|
||||
$sessionStorage.pagination = "first";
|
||||
@@ -268,7 +153,7 @@ $(document).ready(function () {
|
||||
// Setup Alerts
|
||||
// --------------
|
||||
|
||||
$(".setup-alerts").on("click", function () {
|
||||
$(".setup-alerts").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Alerts.setupAlerts";
|
||||
$sessionStorage.pagination = "first";
|
||||
@@ -285,7 +170,7 @@ $(document).ready(function () {
|
||||
// Setup Reports
|
||||
// -------------
|
||||
|
||||
$(".setup-reports").on("click", function () {
|
||||
$(".setup-reports").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Reports.setupReports";
|
||||
$sessionStorage.pagination = "first";
|
||||
@@ -301,7 +186,7 @@ $(document).ready(function () {
|
||||
// Setup Statuses
|
||||
// --------------
|
||||
|
||||
$(".setup-statuses").on("click", function () {
|
||||
$(".setup-statuses").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Statuses.setupStatuses";
|
||||
$sessionStorage.pagination = "first";
|
||||
@@ -317,7 +202,7 @@ $(document).ready(function () {
|
||||
// Setup Statuses
|
||||
// --------------
|
||||
|
||||
$(".run-developer-stub").on("click", function () {
|
||||
$(".run-developer-stub").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "testing";
|
||||
|
||||
|
||||
+10
-9
@@ -94,22 +94,22 @@ $(document).ready(function () {
|
||||
// Show Calendar Buttons
|
||||
// ---------------------
|
||||
|
||||
$(".btnAlertStartDateCalendar").on("click", function (e) {
|
||||
$(".btnAlertStartDateCalendar").on("click", async function (e) {
|
||||
e.preventDefault();
|
||||
$("#alert_starts_date").focus().datepicker("show");
|
||||
});
|
||||
|
||||
$(".btnAlertExpiresDateCalendar").on("click", function (e) {
|
||||
$(".btnAlertExpiresDateCalendar").on("click", async function (e) {
|
||||
e.preventDefault();
|
||||
$("#alert_expires_date").focus().datepicker("show");
|
||||
});
|
||||
|
||||
|
||||
$("#alert_starts_date").on("blur", function () {
|
||||
$("#alert_starts_date").on("blur", async function () {
|
||||
$("#alert_starts_time").focus();
|
||||
});
|
||||
|
||||
$("#alert_expires_date").on("blur", function () {
|
||||
$("#alert_expires_date").on("blur", async function () {
|
||||
$("#alert_expires_time").focus();
|
||||
});
|
||||
|
||||
@@ -117,7 +117,7 @@ $(document).ready(function () {
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function (e) {
|
||||
$(".btnSave").on("click", async function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
@@ -129,7 +129,7 @@ $(document).ready(function () {
|
||||
// Cancel Button
|
||||
// -------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
$(".btnCancel").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editAlert || "";
|
||||
|
||||
@@ -143,7 +143,8 @@ $(document).ready(function () {
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#editAlert").submit(function (e) {
|
||||
$("#editAlert").submit(async function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var alert_title = $("#alert_title"),
|
||||
alert_starts_date = $("#alert_starts_date"),
|
||||
@@ -162,7 +163,7 @@ $(document).ready(function () {
|
||||
}
|
||||
|
||||
|
||||
if ((!isBlank(alert_starts_date)) && (!isDate(alert_starts_date))) {
|
||||
if ((!isBlank(alert_starts_date)) && (!await isDate(alert_starts_date))) {
|
||||
createInputError(alert_starts_date, "Date is invalid");
|
||||
return false;
|
||||
}
|
||||
@@ -182,7 +183,7 @@ $(document).ready(function () {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((!isBlank(alert_expires_date)) && (!isDate(alert_expires_date))) {
|
||||
if ((!isBlank(alert_expires_date)) && (!await isDate(alert_expires_date))) {
|
||||
createInputError(alert_expires_date, "Date is invalid");
|
||||
return false;
|
||||
}
|
||||
|
||||
+11
-10
@@ -3,7 +3,7 @@
|
||||
// Edit Dropdown
|
||||
// =============
|
||||
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
@@ -12,7 +12,7 @@ $(document).ready(function() {
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function(e) {
|
||||
$(".btnSave").on("click", async function (e) {
|
||||
e.preventDefault();
|
||||
$("#editDropdown").submit();
|
||||
});
|
||||
@@ -21,7 +21,7 @@ $(document).ready(function() {
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function() {
|
||||
$(".btnCancel").on("click", async function () {
|
||||
formSubmit({ action : $sessionStorage.editDropdown });
|
||||
});
|
||||
|
||||
@@ -29,9 +29,9 @@ $(document).ready(function() {
|
||||
// Delete Button
|
||||
// -------------
|
||||
|
||||
$(".btnDelete").on("click", function() {
|
||||
$(".btnDelete").on("click", async function () {
|
||||
|
||||
if (formPost({ action : "Dropdowns.dropdownActive", dropdown_serial : $sessionStorage.dropdown_serial }) === true) {
|
||||
if (await 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()
|
||||
@@ -48,11 +48,11 @@ $(document).ready(function() {
|
||||
|
||||
});
|
||||
|
||||
$("body").on("click", ".confirm-delete-dropdown .btnConfirmDialogConfirm", function() {
|
||||
$("body").on("click", ".confirm-delete-dropdown .btnConfirmDialogConfirm", async function () {
|
||||
|
||||
$.post("./", { action : "Dropdowns.deleteDropdown", dropdown_serial : $sessionStorage.dropdown_serial })
|
||||
|
||||
.done(function() {
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editDropdown || "";
|
||||
$sessionStorage.toast = "Dropdown was Deleted";
|
||||
@@ -69,7 +69,8 @@ $(document).ready(function() {
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#editDropdown").submit( function(e) {
|
||||
$("#editDropdown").submit( async function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var dropdowntype_serial = $("#dropdowntype_serial").val(),
|
||||
dropdown_serial = $("#dropdown_serial").val(),
|
||||
@@ -84,7 +85,7 @@ $(document).ready(function() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (formPost({ action : "Dropdowns.dropdownExists", dropdowntype_serial : dropdowntype_serial, dropdown_serial : dropdown_serial, dropdown_value : dropdown_value.val() }) === true) {
|
||||
if (await 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;
|
||||
}
|
||||
@@ -93,7 +94,7 @@ $(document).ready(function() {
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
|
||||
.done(function() {
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editDropdown || "";
|
||||
$sessionStorage.toast = "Dropdown was Saved";
|
||||
|
||||
+12
-21
@@ -3,7 +3,7 @@
|
||||
// Edit Dropdowntype
|
||||
// =================
|
||||
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
@@ -12,7 +12,7 @@ $(document).ready(function() {
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function(e) {
|
||||
$(".btnSave").on("click", async function (e) {
|
||||
e.preventDefault();
|
||||
$("#editDropdowntype").submit();
|
||||
});
|
||||
@@ -21,7 +21,7 @@ $(document).ready(function() {
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function() {
|
||||
$(".btnCancel").on("click", async function () {
|
||||
formSubmit({ action : $sessionStorage.editDropdowntype });
|
||||
});
|
||||
|
||||
@@ -29,9 +29,9 @@ $(document).ready(function() {
|
||||
// Delete Button
|
||||
// -------------
|
||||
|
||||
$(".btnDelete").on("click", function() {
|
||||
$(".btnDelete").on("click", async function () {
|
||||
|
||||
if (formPost({ action : "Dropdowns.dropdowntypeActive", dropdowntype_serial : $sessionStorage.dropdowntype_serial }) === true) {
|
||||
if (await 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()
|
||||
@@ -48,11 +48,11 @@ $(document).ready(function() {
|
||||
|
||||
});
|
||||
|
||||
$("body").on("click", ".confirm-delete-dropdowntype .btnConfirmDialogConfirm", function() {
|
||||
$("body").on("click", ".confirm-delete-dropdowntype .btnConfirmDialogConfirm", async function () {
|
||||
|
||||
$.post("./", { action : "Dropdowns.deleteDropdowntype", dropdowntype_serial : $sessionStorage.dropdowntype_serial })
|
||||
|
||||
.done(function() {
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editDropdowntype || "";
|
||||
$sessionStorage.toast = "Dropdown Type was Deleted";
|
||||
@@ -69,7 +69,8 @@ $(document).ready(function() {
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#editDropdowntype").submit( function(e) {
|
||||
$("#editDropdowntype").submit( async function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var dropdowntype_serial = $("#dropdowntype_serial"),
|
||||
dropdowntype_name = $("#dropdowntype_name"),
|
||||
@@ -89,7 +90,7 @@ $(document).ready(function() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (formPost({ action : "Dropdowns.dropdowntypeExists", dropdowntype_serial : dropdowntype_serial.val(), dropdowntype_name : dropdowntype_name.val() }) === true) {
|
||||
if (await formPost({ action : "Dropdowns.dropdowntypeExists", dropdowntype_serial : dropdowntype_serial.val(), dropdowntype_name : dropdowntype_name.val() }) === true) {
|
||||
createInputError(dropdowntype_name, "Name already exists");
|
||||
return false;
|
||||
}
|
||||
@@ -99,26 +100,16 @@ $(document).ready(function() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (formPost({ action : "Dropdowns.dropdowntypetitleExists", dropdowntype_serial : dropdowntype_serial.val(), dropdowntype_title : dropdowntype_title.val() }) === true) {
|
||||
if (await 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() {
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editDropdowntype || "";
|
||||
$sessionStorage.toast = "Dropdown Type was Saved";
|
||||
|
||||
+6
-5
@@ -12,7 +12,7 @@ $(document).ready(function () {
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function (e) {
|
||||
$(".btnSave").on("click", async function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
@@ -24,7 +24,7 @@ $(document).ready(function () {
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
$(".btnCancel").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editNote || "";
|
||||
|
||||
@@ -38,7 +38,7 @@ $(document).ready(function () {
|
||||
// Delete Button
|
||||
// -------------
|
||||
|
||||
$(".btnDelete").on("click", function () {
|
||||
$(".btnDelete").on("click", async function () {
|
||||
|
||||
$("#confirm-dialog").removeClass().addClass("modal confirm-delete-note")
|
||||
.find(".modal-title").html("Confirm Delete Note").end()
|
||||
@@ -47,7 +47,7 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
$("body").on("click", ".confirm-delete-note .btnConfirmDialogConfirm", function () {
|
||||
$("body").on("click", ".confirm-delete-note .btnConfirmDialogConfirm", async function () {
|
||||
|
||||
$.post("./", {action: "Notes.deleteNote", note_serial: $sessionStorage.note_serial})
|
||||
.done(function () {
|
||||
@@ -61,7 +61,8 @@ $(document).ready(function () {
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#editNote").submit(function (e) {
|
||||
$("#editNote").submit(async function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var note_text = $("#note_text");
|
||||
|
||||
|
||||
+7
-6
@@ -59,7 +59,7 @@ $(document).ready(function () {
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function (e) {
|
||||
$(".btnSave").on("click", async function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
@@ -71,7 +71,7 @@ $(document).ready(function () {
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
$(".btnCancel").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editPopover;
|
||||
|
||||
@@ -85,7 +85,7 @@ $(document).ready(function () {
|
||||
// Delete Button
|
||||
// -------------
|
||||
|
||||
$(".btnDelete").on("click", function () {
|
||||
$(".btnDelete").on("click", async function () {
|
||||
|
||||
$("#confirm-dialog").removeClass().addClass("modal confirm-delete-popover")
|
||||
.find(".modal-title").html("Confirm Delete Popover").end()
|
||||
@@ -94,7 +94,7 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
$("body").on("click", ".confirm-delete-popover .btnConfirmDialogConfirm", function () {
|
||||
$("body").on("click", ".confirm-delete-popover .btnConfirmDialogConfirm", async function () {
|
||||
|
||||
$.post("./", {action: "Popovers.deletePopover", popover_serial: $sessionStorage.popover_serial})
|
||||
|
||||
@@ -114,7 +114,8 @@ $(document).ready(function () {
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#editPopover").submit(function (e) {
|
||||
$("#editPopover").submit(async function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var popover_serial = $("#popover_serial"),
|
||||
popover_name = $("#popover_name"),
|
||||
@@ -131,7 +132,7 @@ $(document).ready(function () {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (formPost({action: "Popovers.popoverExists", popover_serial: popover_serial.val(), popover_name: popover_name.val()}) === true) {
|
||||
if (await formPost({action: "Popovers.popoverExists", popover_serial: popover_serial.val(), popover_name: popover_name.val()}) === true) {
|
||||
createInputError(popover_name, "Name already exists");
|
||||
return false;
|
||||
}
|
||||
|
||||
+7
-6
@@ -12,7 +12,7 @@ $(document).ready(function () {
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function (e) {
|
||||
$(".btnSave").on("click", async function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
@@ -24,7 +24,7 @@ $(document).ready(function () {
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
$(".btnCancel").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editReport || "";
|
||||
|
||||
@@ -38,7 +38,7 @@ $(document).ready(function () {
|
||||
// Delete Button
|
||||
// -------------
|
||||
|
||||
$(".btnDelete").on("click", function () {
|
||||
$(".btnDelete").on("click", async function () {
|
||||
|
||||
$("#confirm-dialog").removeClass().addClass("modal confirm-delete-report")
|
||||
.find(".modal-title").html("Confirm Delete Report").end()
|
||||
@@ -47,7 +47,7 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
$("body").on("click", ".confirm-delete-report .btnConfirmDialogConfirm", function () {
|
||||
$("body").on("click", ".confirm-delete-report .btnConfirmDialogConfirm", async function () {
|
||||
|
||||
$.post("./", {action: "Reports.deleteReport", report_serial: $sessionStorage.report_serial})
|
||||
|
||||
@@ -68,7 +68,8 @@ $(document).ready(function () {
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#editReport").submit(function (e) {
|
||||
$("#editReport").submit(async function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var report_name = $("#report_name"),
|
||||
report_serial = $("#report_serial"),
|
||||
@@ -90,7 +91,7 @@ $(document).ready(function () {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (formPost({action: "Reports.reportExists", report_serial: report_serial.val(), report_class: report_class.val()}) === true) {
|
||||
if (await formPost({action: "Reports.reportExists", report_serial: report_serial.val(), report_class: report_class.val()}) === true) {
|
||||
createInputError(report_class, "Class already exists");
|
||||
return false;
|
||||
}
|
||||
|
||||
+11
-10
@@ -3,7 +3,7 @@
|
||||
// Edit Status
|
||||
// ===========
|
||||
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
@@ -12,7 +12,7 @@ $(document).ready(function() {
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function(e) {
|
||||
$(".btnSave").on("click", async function (e) {
|
||||
e.preventDefault();
|
||||
$("#editStatus").submit();
|
||||
});
|
||||
@@ -21,7 +21,7 @@ $(document).ready(function() {
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function() {
|
||||
$(".btnCancel").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editStatus || "";
|
||||
|
||||
@@ -35,9 +35,9 @@ $(document).ready(function() {
|
||||
// Delete Button
|
||||
// -------------
|
||||
|
||||
$(".btnDelete").on("click", function() {
|
||||
$(".btnDelete").on("click", async function () {
|
||||
|
||||
if (formPost({ action : "Statuses.statusActive", status_serial : $sessionStorage.status_serial }) === true) {
|
||||
if (await 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()
|
||||
@@ -54,10 +54,10 @@ $(document).ready(function() {
|
||||
|
||||
});
|
||||
|
||||
$("body").on("click", ".confirm-delete-status .btnConfirmDialogConfirm", function() {
|
||||
$("body").on("click", ".confirm-delete-status .btnConfirmDialogConfirm", async function () {
|
||||
|
||||
$.post("./", { action : "Statuses.deleteStatus", status_serial : $sessionStorage.status_serial })
|
||||
.done(function() {
|
||||
.done(function () {
|
||||
formSubmit({ action : $sessionStorage.deleteStatus });
|
||||
});
|
||||
|
||||
@@ -67,7 +67,8 @@ $(document).ready(function() {
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#editStatus").submit( function(e) {
|
||||
$("#editStatus").submit( async function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var status_serial = $("#status_serial"),
|
||||
status_name = $("#status_name"),
|
||||
@@ -83,7 +84,7 @@ $(document).ready(function() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (formPost({ action : "Statuses.statusExists", status_serial : status_serial.val(), status_name : status_name.val() }) === true) {
|
||||
if (await formPost({ action : "Statuses.statusExists", status_serial : status_serial.val(), status_name : status_name.val() }) === true) {
|
||||
createInputError(status_name, "Name already exists");
|
||||
return false;
|
||||
}
|
||||
@@ -92,7 +93,7 @@ $(document).ready(function() {
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
|
||||
.done(function() {
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editStatus || "";
|
||||
$sessionStorage.toast = "Status was Saved";
|
||||
|
||||
+10
-8
@@ -26,7 +26,7 @@ $(document).ready(function () {
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function (e) {
|
||||
$(".btnSave").on("click", async function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
@@ -38,7 +38,7 @@ $(document).ready(function () {
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
$(".btnCancel").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editUser || "";
|
||||
|
||||
@@ -52,9 +52,9 @@ $(document).ready(function () {
|
||||
// Delete Button
|
||||
// -------------
|
||||
|
||||
$(".btnDelete").on("click", function () {
|
||||
$(".btnDelete").on("click", async function () {
|
||||
|
||||
if (formPost({action: "Users.userActive", user_serial: $sessionStorage.user_serial}) === true) {
|
||||
if (await 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()
|
||||
@@ -71,7 +71,7 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
$("body").on("click", ".confirm-delete-user .btnConfirmDialogConfirm", function () {
|
||||
$("body").on("click", ".confirm-delete-user .btnConfirmDialogConfirm", async function () {
|
||||
|
||||
$.post("./", {action: "Users.deleteUser", user_serial: $sessionStorage.user_serial})
|
||||
|
||||
@@ -92,7 +92,8 @@ $(document).ready(function () {
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#editUser").submit(function (e) {
|
||||
$("#editUser").submit(async function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var user_name = $("#user_name"),
|
||||
user_email = $("#user_email"),
|
||||
@@ -101,7 +102,7 @@ $(document).ready(function () {
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
user_name.val(titleCase(user_name.val()));
|
||||
user_name.val(trimString(user_name.val()));
|
||||
user_email.val(trimString(user_email.val()));
|
||||
|
||||
if (isBlank(user_name)) {
|
||||
@@ -115,10 +116,11 @@ $(document).ready(function () {
|
||||
}
|
||||
|
||||
if (isBlank(user_first_name)) {
|
||||
createInputError(user_first_name, "Client Name is required");
|
||||
createInputError(user_first_name, "First name is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isBlank($('#user_last_name'))) { createInputError($('#user_last_name'),'Last name is required');return false; }
|
||||
if ($("option:selected", user_role).val() === "") {
|
||||
createInputError(user_role, "Role is required");
|
||||
return false;
|
||||
|
||||
Vendored
-4
File diff suppressed because one or more lines are too long
Vendored
+2
File diff suppressed because one or more lines are too long
+12
-12
@@ -3,7 +3,7 @@
|
||||
// Select Report
|
||||
// =============
|
||||
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
@@ -12,7 +12,7 @@ $(document).ready(function() {
|
||||
// Find Button
|
||||
// -----------
|
||||
|
||||
$(".btnFind").on("click", function() {
|
||||
$(".btnFind").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Reports.selectReport";
|
||||
$sessionStorage.pagination = "first";
|
||||
@@ -25,7 +25,7 @@ $(document).ready(function() {
|
||||
|
||||
});
|
||||
|
||||
$("#select_report").on("keyup", function(e) {
|
||||
$("#select_report").on("keyup", async function (e) {
|
||||
if (e.key === "Enter") {
|
||||
$(".btnFind").trigger("click");
|
||||
}
|
||||
@@ -35,7 +35,7 @@ $(document).ready(function() {
|
||||
// Clear Find Button
|
||||
// -----------------
|
||||
|
||||
$(".btnClearFind").on("click", function() {
|
||||
$(".btnClearFind").on("click", async function () {
|
||||
|
||||
$("#select_report").val("").trigger("change");
|
||||
|
||||
@@ -54,7 +54,7 @@ $(document).ready(function() {
|
||||
// Show Per Page Change
|
||||
// --------------------
|
||||
|
||||
$("#reports_per_page").on("change", function() {
|
||||
$("#reports_per_page").on("change", async function () {
|
||||
|
||||
$sessionStorage.alerts_per_page = $(this).val();
|
||||
$sessionStorage.action = "Reports.selectReport";
|
||||
@@ -72,7 +72,7 @@ $(document).ready(function() {
|
||||
// Pagination Buttons
|
||||
// ------------------
|
||||
|
||||
$(".btnPagination").on("click", function() {
|
||||
$(".btnPagination").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Reports.selectReport";
|
||||
$sessionStorage.pagination = $(this).data("pagination");
|
||||
@@ -93,7 +93,7 @@ $(document).ready(function() {
|
||||
// Done Button
|
||||
// -----------
|
||||
|
||||
$(".btnDone").on("click", function() {
|
||||
$(".btnDone").on("click", async function () {
|
||||
|
||||
formSubmit({ action : "" });
|
||||
|
||||
@@ -103,7 +103,7 @@ $(document).ready(function() {
|
||||
// Process the selected Report
|
||||
// ---------------------------
|
||||
|
||||
$("#reports-table tbody").on("click touch", "tr", function(e) {
|
||||
$("#reports-table tbody").on("click touch", "tr", async function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
@@ -166,7 +166,7 @@ $(document).ready(function() {
|
||||
// Save Changed Inputs
|
||||
// -------------------
|
||||
|
||||
$(".autosave").on("change", function(e) {
|
||||
$(".autosave").on("change", async function (e) {
|
||||
|
||||
switch (e.target.type) {
|
||||
|
||||
@@ -188,9 +188,9 @@ $(document).ready(function() {
|
||||
// Initalize Inputs
|
||||
// ----------------
|
||||
|
||||
$.each($sessionStorage, function(name, value) {
|
||||
$.each($sessionStorage, function (name, value) {
|
||||
|
||||
var $input = $(":input").filter("[name='" + name + "']");
|
||||
var $input = $(":input.autosave").not('[type="hidden"],[type="password"]').filter(function(){return this.name===name;});
|
||||
|
||||
if ($input.length > 0) {
|
||||
|
||||
@@ -220,7 +220,7 @@ $(document).ready(function() {
|
||||
// Per Page Dropdown
|
||||
// -----------------
|
||||
|
||||
$("#reports_per_page").on("change", function() {
|
||||
$("#reports_per_page").on("change", async function () {
|
||||
|
||||
$(".btnFind").trigger("click");
|
||||
|
||||
|
||||
+10
-10
@@ -12,7 +12,7 @@ $(document).ready(function () {
|
||||
// Find Button
|
||||
// -----------
|
||||
|
||||
$(".btnFind").on("click", function () {
|
||||
$(".btnFind").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Alerts.setupAlerts";
|
||||
$sessionStorage.pagination = "first";
|
||||
@@ -25,7 +25,7 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
$("#find_alert").on("keyup", function (e) {
|
||||
$("#find_alert").on("keyup", async function (e) {
|
||||
if (e.key === "Enter") {
|
||||
$(".btnFind").trigger("click");
|
||||
}
|
||||
@@ -35,7 +35,7 @@ $(document).ready(function () {
|
||||
// Clear Find Button
|
||||
// -----------------
|
||||
|
||||
$(".btnClearFind").on("click", function () {
|
||||
$(".btnClearFind").on("click", async function () {
|
||||
|
||||
$("#find_alert").val("").trigger("change");
|
||||
|
||||
@@ -54,7 +54,7 @@ $(document).ready(function () {
|
||||
// Pagination Buttons
|
||||
// ------------------
|
||||
|
||||
$(".btnPagination").on("click", function () {
|
||||
$(".btnPagination").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Alerts.setupAlerts";
|
||||
$sessionStorage.pagination = $(this).data("pagination");
|
||||
@@ -75,7 +75,7 @@ $(document).ready(function () {
|
||||
// Add Button
|
||||
// ----------
|
||||
|
||||
$(".btnAdd").on("click", function () {
|
||||
$(".btnAdd").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Alerts.addAlert";
|
||||
$sessionStorage.addAlert = "Alerts.setupAlerts";
|
||||
@@ -90,7 +90,7 @@ $(document).ready(function () {
|
||||
// Done Button
|
||||
// -----------
|
||||
|
||||
$(".btnDone").on("click", function () {
|
||||
$(".btnDone").on("click", async function () {
|
||||
|
||||
formSubmit({action: ""});
|
||||
|
||||
@@ -100,7 +100,7 @@ $(document).ready(function () {
|
||||
// Edit
|
||||
// ----
|
||||
|
||||
$("#alerts-table tbody").on("click touch", "tr", function (e) {
|
||||
$("#alerts-table tbody").on("click touch", "tr", async function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
@@ -118,7 +118,7 @@ $(document).ready(function () {
|
||||
// Save Changed Inputs
|
||||
// -------------------
|
||||
|
||||
$(".autosave").on("change", function (e) {
|
||||
$(".autosave").on("change", async function (e) {
|
||||
|
||||
switch (e.target.type) {
|
||||
|
||||
@@ -154,7 +154,7 @@ $(document).ready(function () {
|
||||
|
||||
$.each($sessionStorage, function (name, value) {
|
||||
|
||||
var $input = $(":input").filter("[name='" + name + "']");
|
||||
var $input = $(":input.autosave").not('[type="hidden"],[type="password"]').filter(function(){return this.name===name;});
|
||||
|
||||
if ($input.length > 0) {
|
||||
|
||||
@@ -196,7 +196,7 @@ $(document).ready(function () {
|
||||
// Per Page Dropdown
|
||||
// -----------------
|
||||
|
||||
$("#alerts_per_page").on("change", function () {
|
||||
$("#alerts_per_page").on("change", async function () {
|
||||
|
||||
$(".btnFind").trigger("click");
|
||||
|
||||
|
||||
+20
-33
@@ -3,7 +3,7 @@
|
||||
// Setup Dropdowns
|
||||
// ===============
|
||||
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
@@ -26,11 +26,11 @@ $(document).ready(function() {
|
||||
// Save open Accordion
|
||||
// -------------------
|
||||
|
||||
$("#dropdown-accordion").on("shown.bs.collapse hidden.bs.collapse", function(e) {
|
||||
$("#dropdown-accordion").on("shown.bs.collapse hidden.bs.collapse", async function (e) {
|
||||
|
||||
const open = new Array();
|
||||
|
||||
$(".collapse.show").each(function() {
|
||||
$(".collapse.show").each(function () {
|
||||
open.push($(this).attr("id"));
|
||||
});
|
||||
|
||||
@@ -43,7 +43,7 @@ $(document).ready(function() {
|
||||
// Add Button
|
||||
// ----------
|
||||
|
||||
$(".btnAdd").on("click", function() {
|
||||
$(".btnAdd").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Dropdowns.addDropdown";
|
||||
$sessionStorage.dropdowntype_serial = $(this).data("dropdowntype-serial");
|
||||
@@ -59,7 +59,7 @@ $(document).ready(function() {
|
||||
// Done Button
|
||||
// -----------
|
||||
|
||||
$(".btnDone").on("click", function() {
|
||||
$(".btnDone").on("click", async function () {
|
||||
|
||||
formSubmit({ action : "" });
|
||||
|
||||
@@ -69,7 +69,7 @@ $(document).ready(function() {
|
||||
// Edit
|
||||
// ----
|
||||
|
||||
$(".dropdown-table tbody td:not('.dropdown_default, .dropdown_active')").on("click touch", function(e) {
|
||||
$(".dropdown-table tbody td:not('.dropdown_default, .dropdown_active')").on("click touch", async function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
@@ -87,40 +87,27 @@ $(document).ready(function() {
|
||||
// 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});
|
||||
|
||||
const savedDefaults=new Map();
|
||||
$('input[name="dropdown_default"]').each(function(){savedDefaults.set($(this).closest('tr').data('dropdown-serial'),this.checked);});
|
||||
$('input[name="dropdown_default"]').on('change',async function(){
|
||||
const box=$(this),row=box.closest('tr'),id=row.data('dropdown-serial'),type=row.data('dropdown-dropdowntype'),checked=this.checked;
|
||||
box.prop('disabled',true);
|
||||
try{
|
||||
await formPost({action:'Dropdowns.updateDropdownDefault',dropdown_serial:id,dropdown_dropdowntype:type,dropdown_checked:checked});
|
||||
$('input[name="dropdown_default"]').each(function(){
|
||||
const parent=$(this).closest('tr');if(parent.data('dropdown-dropdowntype')===type){const selected=parent.data('dropdown-serial')===id?checked:false;$(this).prop('checked',selected);savedDefaults.set(parent.data('dropdown-serial'),selected);}
|
||||
});
|
||||
}catch(error){$('input[name="dropdown_default"]').each(function(){$(this).prop('checked',!!savedDefaults.get($(this).closest('tr').data('dropdown-serial')));});}
|
||||
finally{box.prop('disabled',false);}
|
||||
});
|
||||
|
||||
// ---------------------------
|
||||
// Process the Active Checkbox
|
||||
// ---------------------------
|
||||
|
||||
$("input[name='dropdown_active']").on("change", function(e) {
|
||||
$("input[name='dropdown_active']").on("change", async function (e) {
|
||||
|
||||
formPost({ action : "Dropdowns.updateDropdownActive", dropdown_serial : $(this).data("dropdown-serial"), dropdown_checked: $(this).prop("checked") });
|
||||
try { await formPost({ action : "Dropdowns.updateDropdownActive", dropdown_serial : $(this).data("dropdown-serial"), dropdown_checked: $(this).prop("checked") }); } catch(error) { $(this).prop("checked", !$(this).prop("checked")); }
|
||||
|
||||
});
|
||||
|
||||
|
||||
+12
-12
@@ -3,7 +3,7 @@
|
||||
// Setup Dropdowntypes
|
||||
// ===================
|
||||
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
@@ -12,7 +12,7 @@ $(document).ready(function() {
|
||||
// Find Button
|
||||
// -----------
|
||||
|
||||
$(".btnFind").on("click", function() {
|
||||
$(".btnFind").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Dropdowns.setupDropdowntypes";
|
||||
$sessionStorage.pagination = "first";
|
||||
@@ -25,7 +25,7 @@ $(document).ready(function() {
|
||||
|
||||
});
|
||||
|
||||
$("#find_dropdowntype").on("keyup", function(e) {
|
||||
$("#find_dropdowntype").on("keyup", async function (e) {
|
||||
if (e.key === "Enter") {
|
||||
$(".btnFind").trigger("click");
|
||||
}
|
||||
@@ -35,7 +35,7 @@ $(document).ready(function() {
|
||||
// Clear Find Button
|
||||
// -----------------
|
||||
|
||||
$(".btnClearFind").on("click", function() {
|
||||
$(".btnClearFind").on("click", async function () {
|
||||
|
||||
$("#find_dropdowntype").val("").trigger("change");
|
||||
|
||||
@@ -54,7 +54,7 @@ $(document).ready(function() {
|
||||
// Pagination Buttons
|
||||
// ------------------
|
||||
|
||||
$(".btnPagination").on("click", function() {
|
||||
$(".btnPagination").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Dropdowns.setupDropdowntypes";
|
||||
$sessionStorage.pagination = $(this).data("pagination");
|
||||
@@ -75,7 +75,7 @@ $(document).ready(function() {
|
||||
// Add Button
|
||||
// ----------
|
||||
|
||||
$(".btnAdd").on("click", function() {
|
||||
$(".btnAdd").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Dropdowns.addDropdowntype";
|
||||
$sessionStorage.addDropdowntype = "Dropdowns.setupDropdowntypes";
|
||||
@@ -90,7 +90,7 @@ $(document).ready(function() {
|
||||
// Done Button
|
||||
// -----------
|
||||
|
||||
$(".btnDone").on("click", function() {
|
||||
$(".btnDone").on("click", async function () {
|
||||
|
||||
formSubmit({ action : "" });
|
||||
|
||||
@@ -100,7 +100,7 @@ $(document).ready(function() {
|
||||
// Edit
|
||||
// ----
|
||||
|
||||
$("#dropdowntypes-table tbody").on("click touch", "tr", function(e) {
|
||||
$("#dropdowntypes-table tbody").on("click touch", "tr", async function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
@@ -118,7 +118,7 @@ $(document).ready(function() {
|
||||
// Save Changed Inputs
|
||||
// -------------------
|
||||
|
||||
$(".autosave").on("change", function(e) {
|
||||
$(".autosave").on("change", async function (e) {
|
||||
|
||||
switch (e.target.type) {
|
||||
|
||||
@@ -140,9 +140,9 @@ $(document).ready(function() {
|
||||
// Initalize Inputs
|
||||
// ----------------
|
||||
|
||||
$.each($sessionStorage, function(name, value) {
|
||||
$.each($sessionStorage, function (name, value) {
|
||||
|
||||
var $input = $(":input").filter("[name='" + name + "']");
|
||||
var $input = $(":input.autosave").not('[type="hidden"],[type="password"]').filter(function(){return this.name===name;});
|
||||
|
||||
if ($input.length > 0) {
|
||||
|
||||
@@ -172,7 +172,7 @@ $(document).ready(function() {
|
||||
// Per Page Dropdown
|
||||
// -----------------
|
||||
|
||||
$("#dropdowntypes_per_page").on("change", function() {
|
||||
$("#dropdowntypes_per_page").on("change", async function () {
|
||||
|
||||
$(".btnFind").trigger("click");
|
||||
|
||||
|
||||
+10
-10
@@ -12,7 +12,7 @@ $(document).ready(function () {
|
||||
// Find Button
|
||||
// -----------
|
||||
|
||||
$(".btnFind").on("click", function () {
|
||||
$(".btnFind").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Popovers.setupPopovers";
|
||||
$sessionStorage.pagination = "first";
|
||||
@@ -25,7 +25,7 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
$("#find_popover").on("keyup", function (e) {
|
||||
$("#find_popover").on("keyup", async function (e) {
|
||||
if (e.key === "Enter") {
|
||||
$(".btnFind").trigger("click");
|
||||
}
|
||||
@@ -35,7 +35,7 @@ $(document).ready(function () {
|
||||
// Clear Find Button
|
||||
// -----------------
|
||||
|
||||
$(".btnClearFind").on("click", function () {
|
||||
$(".btnClearFind").on("click", async function () {
|
||||
|
||||
$("#find_popover").val("").trigger("change");
|
||||
|
||||
@@ -54,7 +54,7 @@ $(document).ready(function () {
|
||||
// Pagination Buttons
|
||||
// ------------------
|
||||
|
||||
$(".btnPagination").on("click", function () {
|
||||
$(".btnPagination").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Popovers.setupPopovers";
|
||||
$sessionStorage.pagination = $(this).data("pagination");
|
||||
@@ -75,7 +75,7 @@ $(document).ready(function () {
|
||||
// Add Button
|
||||
// ----------
|
||||
|
||||
$(".btnAdd").on("click", function () {
|
||||
$(".btnAdd").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Popovers.addPopover";
|
||||
$sessionStorage.addPopover = "Popovers.setupPopovers";
|
||||
@@ -90,7 +90,7 @@ $(document).ready(function () {
|
||||
// Done Button
|
||||
// -----------
|
||||
|
||||
$(".btnDone").on("click", function () {
|
||||
$(".btnDone").on("click", async function () {
|
||||
|
||||
formSubmit({action: ""});
|
||||
|
||||
@@ -100,7 +100,7 @@ $(document).ready(function () {
|
||||
// Edit
|
||||
// ----
|
||||
|
||||
$("#popovers-table tbody").on("click touch", "tr", function (e) {
|
||||
$("#popovers-table tbody").on("click touch", "tr", async function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
@@ -118,7 +118,7 @@ $(document).ready(function () {
|
||||
// Save Changed Inputs
|
||||
// -------------------
|
||||
|
||||
$(".autosave").on("change", function (e) {
|
||||
$(".autosave").on("change", async function (e) {
|
||||
|
||||
switch (e.target.type) {
|
||||
|
||||
@@ -154,7 +154,7 @@ $(document).ready(function () {
|
||||
|
||||
$.each($sessionStorage, function (name, value) {
|
||||
|
||||
var $input = $(":input").filter("[name='" + name + "']");
|
||||
var $input = $(":input.autosave").not('[type="hidden"],[type="password"]').filter(function(){return this.name===name;});
|
||||
|
||||
if ($input.length > 0) {
|
||||
|
||||
@@ -196,7 +196,7 @@ $(document).ready(function () {
|
||||
// Per Page Dropdown
|
||||
// -----------------
|
||||
|
||||
$("#popovers_per_page").on("change", function () {
|
||||
$("#popovers_per_page").on("change", async function () {
|
||||
|
||||
$(".btnFind").trigger("click");
|
||||
|
||||
|
||||
+12
-12
@@ -3,7 +3,7 @@
|
||||
// Setup Reports
|
||||
// =============
|
||||
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
@@ -12,7 +12,7 @@ $(document).ready(function() {
|
||||
// Find Button
|
||||
// -----------
|
||||
|
||||
$(".btnFind").on("click", function() {
|
||||
$(".btnFind").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Reports.setupReports";
|
||||
$sessionStorage.pagination = "first";
|
||||
@@ -23,7 +23,7 @@ $(document).ready(function() {
|
||||
|
||||
});
|
||||
|
||||
$("#find_report").on("keyup", function(e) {
|
||||
$("#find_report").on("keyup", async function (e) {
|
||||
if (e.key === "Enter") {
|
||||
$(".btnFind").trigger("click");
|
||||
}
|
||||
@@ -33,7 +33,7 @@ $(document).ready(function() {
|
||||
// Clear Find Button
|
||||
// -----------------
|
||||
|
||||
$(".btnClearFind").on("click", function() {
|
||||
$(".btnClearFind").on("click", async function () {
|
||||
|
||||
$("#find_report").val("").trigger("change");
|
||||
|
||||
@@ -50,7 +50,7 @@ $(document).ready(function() {
|
||||
// Pagination Buttons
|
||||
// ------------------
|
||||
|
||||
$(".btnPagination").on("click", function() {
|
||||
$(".btnPagination").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Reports.setupReports";
|
||||
$sessionStorage.pagination = $(this).data("pagination");
|
||||
@@ -69,7 +69,7 @@ $(document).ready(function() {
|
||||
// Add Button
|
||||
// ----------
|
||||
|
||||
$(".btnAdd").on("click", function() {
|
||||
$(".btnAdd").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Reports.addReport";
|
||||
$sessionStorage.addReport = "Reports.setupReports";
|
||||
@@ -84,7 +84,7 @@ $(document).ready(function() {
|
||||
// Done Button
|
||||
// -----------
|
||||
|
||||
$(".btnDone").on("click", function() {
|
||||
$(".btnDone").on("click", async function () {
|
||||
|
||||
formSubmit({ action : "" });
|
||||
|
||||
@@ -94,7 +94,7 @@ $(document).ready(function() {
|
||||
// Edit
|
||||
// ----
|
||||
|
||||
$("#reports-table tbody").on("click touch", "tr", function(e) {
|
||||
$("#reports-table tbody").on("click touch", "tr", async function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
@@ -112,7 +112,7 @@ $(document).ready(function() {
|
||||
// Save Changed Inputs
|
||||
// -------------------
|
||||
|
||||
$(".autosave").on("change", function(e) {
|
||||
$(".autosave").on("change", async function (e) {
|
||||
|
||||
switch (e.target.type) {
|
||||
|
||||
@@ -134,9 +134,9 @@ $(document).ready(function() {
|
||||
// Initalize Inputs
|
||||
// ----------------
|
||||
|
||||
$.each($sessionStorage, function(name, value) {
|
||||
$.each($sessionStorage, function (name, value) {
|
||||
|
||||
var $input = $(":input").filter("[name='" + name + "']");
|
||||
var $input = $(":input.autosave").not('[type="hidden"],[type="password"]').filter(function(){return this.name===name;});
|
||||
|
||||
if ($input.length > 0) {
|
||||
|
||||
@@ -166,7 +166,7 @@ $(document).ready(function() {
|
||||
// Per Page Dropdown
|
||||
// -----------------
|
||||
|
||||
$("#reports_per_page").on("change", function() {
|
||||
$("#reports_per_page").on("change", async function () {
|
||||
|
||||
$(".btnFind").trigger("click");
|
||||
|
||||
|
||||
+10
-9
@@ -12,7 +12,7 @@ $(document).ready(function () {
|
||||
// Find Button
|
||||
// -----------
|
||||
|
||||
$(".btnFind").on("click", function () {
|
||||
$(".btnFind").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Statuses.setupStatuses";
|
||||
$sessionStorage.pagination = "first";
|
||||
@@ -23,7 +23,7 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
$("#find_status").on("keyup", function (e) {
|
||||
$("#find_status").on("keyup", async function (e) {
|
||||
if (e.key === "Enter") {
|
||||
$(".btnFind").trigger("click");
|
||||
}
|
||||
@@ -33,7 +33,7 @@ $(document).ready(function () {
|
||||
// Clear Find Button
|
||||
// -----------------
|
||||
|
||||
$(".btnClearFind").on("click", function () {
|
||||
$(".btnClearFind").on("click", async function () {
|
||||
|
||||
$("#find_status").val("").trigger("change");
|
||||
|
||||
@@ -50,7 +50,7 @@ $(document).ready(function () {
|
||||
// Pagination Buttons
|
||||
// ------------------
|
||||
|
||||
$(".btnPagination").on("click", function () {
|
||||
$(".btnPagination").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Statuses.setupStatuses";
|
||||
$sessionStorage.pagination = $(this).data("pagination");
|
||||
@@ -69,7 +69,7 @@ $(document).ready(function () {
|
||||
// Add Button
|
||||
// ----------
|
||||
|
||||
$(".btnAdd").on("click", function () {
|
||||
$(".btnAdd").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Statuses.addStatus";
|
||||
$sessionStorage.addStatus = "Statuses.setupStatuses";
|
||||
@@ -84,7 +84,7 @@ $(document).ready(function () {
|
||||
// Done Button
|
||||
// -----------
|
||||
|
||||
$(".btnDone").on("click", function () {
|
||||
$(".btnDone").on("click", async function () {
|
||||
|
||||
formSubmit({action: ""});
|
||||
|
||||
@@ -94,7 +94,7 @@ $(document).ready(function () {
|
||||
// Edit
|
||||
// ----
|
||||
|
||||
$("#statuses-table tbody").on("click touch", "tr", function (e) {
|
||||
$("#statuses-table tbody").on("click touch", "tr", async function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
@@ -113,7 +113,7 @@ $(document).ready(function () {
|
||||
// Save Changed Inputs
|
||||
// -------------------
|
||||
|
||||
$(".autosave").on("change", function (e) {
|
||||
$(".autosave").on("change", async function (e) {
|
||||
|
||||
switch (e.target.type) {
|
||||
|
||||
@@ -149,7 +149,7 @@ $(document).ready(function () {
|
||||
|
||||
$.each($sessionStorage, function (name, value) {
|
||||
|
||||
var $input = $(":input").filter("[name='" + name + "']");
|
||||
var $input = $(":input.autosave").not('[type="hidden"],[type="password"]').filter(function(){return this.name===name;});
|
||||
|
||||
if ($input.length > 0) {
|
||||
|
||||
@@ -187,4 +187,5 @@ $(document).ready(function () {
|
||||
|
||||
$("input[type=radio]:checked").trigger("change");
|
||||
|
||||
$('#statuses_per_page').on('change',function(){$('.btnFind').trigger('click');});
|
||||
});
|
||||
+11
-11
@@ -11,7 +11,7 @@ $(document).ready(function () {
|
||||
// Find Button
|
||||
// -----------
|
||||
|
||||
$(".btnFind").on("click", function () {
|
||||
$(".btnFind").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Users.setupUsers";
|
||||
$sessionStorage.pagination = "first";
|
||||
@@ -24,7 +24,7 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
$("#find_user").on("keyup", function (e) {
|
||||
$("#find_user").on("keyup", async function (e) {
|
||||
if (e.key === "Enter") {
|
||||
$(".btnFind").trigger("click");
|
||||
}
|
||||
@@ -34,7 +34,7 @@ $(document).ready(function () {
|
||||
// Clear Find Button
|
||||
// -----------------
|
||||
|
||||
$(".btnClearFind").on("click", function () {
|
||||
$(".btnClearFind").on("click", async function () {
|
||||
|
||||
$("#find_user").val("").trigger("change");
|
||||
|
||||
@@ -53,7 +53,7 @@ $(document).ready(function () {
|
||||
// Pagination Buttons
|
||||
// ------------------
|
||||
|
||||
$(".btnPagination").on("click", function () {
|
||||
$(".btnPagination").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Users.setupUsers";
|
||||
$sessionStorage.pagination = $(this).data("pagination");
|
||||
@@ -74,7 +74,7 @@ $(document).ready(function () {
|
||||
// Add User Button
|
||||
// ---------------
|
||||
|
||||
$(".btnAdd").on("click", function () {
|
||||
$(".btnAdd").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Users.addUser";
|
||||
$sessionStorage.addUser = "Users.setupUsers";
|
||||
@@ -89,7 +89,7 @@ $(document).ready(function () {
|
||||
// Done Button
|
||||
// -----------
|
||||
|
||||
$(".btnDone").on("click", function () {
|
||||
$(".btnDone").on("click", async function () {
|
||||
|
||||
formSubmit({action: ""});
|
||||
|
||||
@@ -99,7 +99,7 @@ $(document).ready(function () {
|
||||
// Edit
|
||||
// ----
|
||||
|
||||
// $("#users-table tbody").on("click touch", "tr", function (e) {
|
||||
// $("#users-table tbody").on("click touch", "tr", async function (e) {
|
||||
//
|
||||
// e.preventDefault();
|
||||
//
|
||||
@@ -117,7 +117,7 @@ $(document).ready(function () {
|
||||
// User Summary
|
||||
// ------------
|
||||
|
||||
$("#users-table tbody").on("click touch", "tr", function (e) {
|
||||
$("#users-table tbody").on("click touch", "tr", async function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
@@ -136,7 +136,7 @@ $(document).ready(function () {
|
||||
// Save Changed Inputs
|
||||
// -------------------
|
||||
|
||||
$(".autosave").on("change", function (e) {
|
||||
$(".autosave").on("change", async function (e) {
|
||||
|
||||
switch (e.target.type) {
|
||||
|
||||
@@ -172,7 +172,7 @@ $(document).ready(function () {
|
||||
|
||||
$.each($sessionStorage, function (name, value) {
|
||||
|
||||
var $input = $(":input").filter("[name='" + name + "']");
|
||||
var $input = $(":input.autosave").not('[type="hidden"],[type="password"]').filter(function(){return this.name===name;});
|
||||
|
||||
if ($input.length > 0) {
|
||||
|
||||
@@ -214,7 +214,7 @@ $(document).ready(function () {
|
||||
// Per Page Dropdown
|
||||
// -----------------
|
||||
|
||||
$("#users_per_page").on("change", function () {
|
||||
$("#users_per_page").on("change", async function () {
|
||||
|
||||
$(".btnFind").trigger("click");
|
||||
|
||||
|
||||
+15
-283
@@ -1,283 +1,15 @@
|
||||
|
||||
// ============
|
||||
// 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);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
$(function(){
|
||||
const id=$('#summary_user_serial').val(), application=$('#APPLICATION_MNEMONIC').val();
|
||||
function summaryReturn(action,extra={}){
|
||||
const state={action:action,user_serial:id,userSummary:'Users.setupUsers',addNote:'Users.userSummary',editNote:'Users.userSummary',deleteNote:'Users.userSummary',editUser:'Users.userSummary',deleteUser:'Users.setupUsers',...extra};
|
||||
sessionStorage.setItem(application,JSON.stringify(state));formSubmit(state);
|
||||
}
|
||||
$('.summary-edit').on('click',()=>summaryReturn('Users.editUser'));
|
||||
$('.summary-back').on('click',()=>formSubmit({action:'Users.setupUsers'}));
|
||||
$('.summary-add-note').on('click',()=>summaryReturn('Notes.addNote',{note_type:'User',note_reference:id}));
|
||||
$('.summary-edit-note').on('click',function(){summaryReturn('Notes.editNote',{note_serial:$(this).data('note')});});
|
||||
$('.summary-invite').on('click',async function(){
|
||||
const button=$(this);button.prop('disabled',true);
|
||||
try{const result=await formPost({action:'Users.resetPassword',user_serial:id});showRequestMessage(result.message||'Password setup link sent.');}catch(error){}finally{button.prop('disabled',false);}
|
||||
});
|
||||
});
|
||||
|
||||
+11
-40
@@ -3,7 +3,7 @@
|
||||
// View Journal
|
||||
// ============
|
||||
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
@@ -12,7 +12,7 @@ $(document).ready(function() {
|
||||
// Find Button
|
||||
// -----------
|
||||
|
||||
$(".btnFind").on("click", function() {
|
||||
$(".btnFind").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Journal.viewJournal";
|
||||
$sessionStorage.pagination = "first";
|
||||
@@ -25,7 +25,7 @@ $(document).ready(function() {
|
||||
|
||||
});
|
||||
|
||||
$("#find_journal").on("keyup", function(e) {
|
||||
$("#find_journal").on("keyup", async function (e) {
|
||||
if (e.key === "Enter") {
|
||||
$(".btnFind").trigger("click");
|
||||
}
|
||||
@@ -35,7 +35,7 @@ $(document).ready(function() {
|
||||
// Clear Find Button
|
||||
// -----------------
|
||||
|
||||
$(".btnClearFind").on("click", function() {
|
||||
$(".btnClearFind").on("click", async function () {
|
||||
|
||||
$("#find_journal").val("").trigger("change");
|
||||
|
||||
@@ -54,7 +54,7 @@ $(document).ready(function() {
|
||||
// Pagination Buttons
|
||||
// ------------------
|
||||
|
||||
$(".btnPagination").on("click", function() {
|
||||
$(".btnPagination").on("click", async function () {
|
||||
|
||||
$sessionStorage.action = "Journal.viewJournal";
|
||||
$sessionStorage.pagination = $(this).data("pagination");
|
||||
@@ -75,7 +75,7 @@ $(document).ready(function() {
|
||||
// Done Button
|
||||
// -----------
|
||||
|
||||
$(".btnDone").on("click", function() {
|
||||
$(".btnDone").on("click", async function () {
|
||||
|
||||
formSubmit({ action : "" });
|
||||
|
||||
@@ -85,46 +85,17 @@ $(document).ready(function() {
|
||||
// Refresh Button
|
||||
// --------------
|
||||
|
||||
$(".btnRefresh").on("click", function() {
|
||||
$(".btnRefresh").on("click", async 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) {
|
||||
$(".autosave").on("change", async function (e) {
|
||||
|
||||
switch (e.target.type) {
|
||||
|
||||
@@ -146,9 +117,9 @@ $(document).ready(function() {
|
||||
// Initalize Inputs
|
||||
// ----------------
|
||||
|
||||
$.each($sessionStorage, function(name, value) {
|
||||
$.each($sessionStorage, function (name, value) {
|
||||
|
||||
var $input = $(":input").filter("[name='" + name + "']");
|
||||
var $input = $(":input.autosave").not('[type="hidden"],[type="password"]').filter(function(){return this.name===name;});
|
||||
|
||||
if ($input.length > 0) {
|
||||
|
||||
@@ -178,7 +149,7 @@ $(document).ready(function() {
|
||||
// Per Page Dropdown
|
||||
// -----------------
|
||||
|
||||
$("#journals_per_page").on("change", function() {
|
||||
$("#journals_per_page").on("change", async function () {
|
||||
|
||||
$(".btnFind").trigger("click");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user