first commit
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
|
||||
// =============
|
||||
// Add Race Code
|
||||
// =============
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// -----------
|
||||
// Input Masks
|
||||
// -----------
|
||||
|
||||
$("#racecode_code").inputmask("9{0,9}", {showMaskOnHover: false});
|
||||
|
||||
// -----------
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$("#editRaceCode").submit();
|
||||
});
|
||||
|
||||
// --------------
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
formSubmit({action: $sessionStorage.addRaceCode});
|
||||
});
|
||||
|
||||
// -------------
|
||||
// Delete Button
|
||||
// -------------
|
||||
|
||||
$(".btnDelete").on("click", function () {
|
||||
|
||||
$("#confirm-dialog").removeClass().addClass("modal confirm-delete-race-code")
|
||||
.find(".modal-title").html("Confirm Delete Status").end()
|
||||
.find(".modal-body").html("Are you sure you wish to delete this Status?").end()
|
||||
.modal("show");
|
||||
|
||||
});
|
||||
|
||||
$("body").on("click", ".confirm-delete-race-code .btnConfirmDialogConfirm", function () {
|
||||
|
||||
$.post("./", {action: "RaceCodes.deleteRaceCode", racecode_serial: $sessionStorage.racecode_serial})
|
||||
.done(function () {
|
||||
formSubmit({action: $sessionStorage.deleteRaceCode});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#editRaceCode").submit(function (e) {
|
||||
|
||||
var racecode_code = $("#racecode_code"), racecode_description = $("#racecode_description");
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
if (isBlank(racecode_code)) {
|
||||
createInputError(racecode_code, "Code is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isBlank(racecode_description)) {
|
||||
createInputError(racecode_description, "Description is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.editRaceCode || "";
|
||||
$sessionStorage.toast = "Race Code updated";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user