added alert classes and supporting functions
This commit is contained in:
+58
-58
@@ -3,66 +3,66 @@
|
||||
// Add Dropdown
|
||||
// ============
|
||||
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = "ATLHOUSINGREPORT",
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// -----------
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function(e) {
|
||||
e.preventDefault();
|
||||
$("#addDropdown").submit();
|
||||
});
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(),
|
||||
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// --------------
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
// -----------
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnCancel").on("click", function() {
|
||||
formSubmit({ action : $sessionStorage.addDropdown });
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#addDropdown").submit( function(e) {
|
||||
|
||||
var dropdowntype_serial = $("#dropdowntype_serial").val(),
|
||||
dropdown_value = $("#dropdown_value");
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
dropdown_value.val(trimString(dropdown_value.val()));
|
||||
|
||||
if (isBlank(dropdown_value)) {
|
||||
createInputError(dropdown_value, "Value is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (formPost({ action : "Dropdowns.dropdownExists", dropdowntype_serial : dropdowntype_serial, dropdown_serial : 0, dropdown_value : dropdown_value.val() }) === true) {
|
||||
createInputError(dropdown_value, "Value already exists");
|
||||
return false;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
|
||||
.done(function() {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addDropdown || "";
|
||||
$sessionStorage.toast = "Dropdown was Added";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
$(".btnSave").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$("#addDropdown").submit();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
// --------------
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
formSubmit({action: $sessionStorage.addDropdown});
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#addDropdown").submit(function (e) {
|
||||
|
||||
var dropdowntype_serial = $("#dropdowntype_serial").val(),
|
||||
dropdown_value = $("#dropdown_value");
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
dropdown_value.val(trimString(dropdown_value.val()));
|
||||
|
||||
if (isBlank(dropdown_value)) {
|
||||
createInputError(dropdown_value, "Value is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (formPost({action: "Dropdowns.dropdownExists", dropdowntype_serial: dropdowntype_serial, dropdown_serial: 0, dropdown_value: dropdown_value.val()}) === true) {
|
||||
createInputError(dropdown_value, "Value already exists");
|
||||
return false;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addDropdown || "";
|
||||
$sessionStorage.toast = "Dropdown was Added";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user