first commit
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
|
||||
// ================
|
||||
// Add History Code
|
||||
// ================
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// -----------
|
||||
// Input Masks
|
||||
// -----------
|
||||
|
||||
$('#historycode_code').inputmask({
|
||||
regex: "[A-Za-z]*"
|
||||
});
|
||||
|
||||
// -----------
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$("#addHistoryCode").submit();
|
||||
});
|
||||
|
||||
// --------------
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
formSubmit({action: $sessionStorage.addHistoryCode});
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#addHistoryCode").submit(function (e) {
|
||||
|
||||
var historycode_code = $("#historycode_code"),
|
||||
historycode_description = $("#historycode_description");
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
|
||||
if (isBlank(historycode_code)) {
|
||||
createInputError(historycode_code, "Code is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isBlank(historycode_description)) {
|
||||
createInputError(historycode_description, "Description is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addHistoryCode || "";
|
||||
$sessionStorage.toast = "History Code was Added";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user