Initial comming of full program to main branch
This commit is contained in:
@@ -0,0 +1,120 @@
|
||||
|
||||
// ========================
|
||||
// Add Subscription To User
|
||||
// ========================
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// -----------
|
||||
// Input Masks
|
||||
// -----------
|
||||
|
||||
$(".date-mask").inputmask({alias: "datetime",
|
||||
inputFormat: "mm/dd/yyyy",
|
||||
placeholder: "MM/DD/YYYY",
|
||||
showMaskOnHover: false});
|
||||
|
||||
// --------------
|
||||
// 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});
|
||||
|
||||
// ------------
|
||||
// Date Pickers
|
||||
// ------------
|
||||
|
||||
$("#subscription_stop_date").datepicker({format: "mm-dd-yyyy",
|
||||
container: "div.subscription_stop_date",
|
||||
keyboardNavigation: false,
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
orientation: "left bottom",
|
||||
todayBtn: "linked",
|
||||
todayHighlight: true});
|
||||
|
||||
// ---------------------
|
||||
// Show Calendar Buttons
|
||||
// ---------------------
|
||||
|
||||
$(".btnSubscriptionStopDateCalendar").on("click", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$("#subscription_stop_date").focus().datepicker("show");
|
||||
|
||||
});
|
||||
|
||||
// -----------
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$("#addSubscriptionToUser").submit();
|
||||
|
||||
});
|
||||
|
||||
// --------------
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addSubscriptionToUser || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#addSubscriptionToUser").submit(function (e) {
|
||||
|
||||
var subscription_title = $("#subscription_serial"), subscription_stop_date = $("#subscription_stop_date");
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
if ($("option:selected", subscription_title).val() === "") {
|
||||
createInputError(subscription_title, "Subscription is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isBlank(subscription_stop_date)) {
|
||||
createInputError(subscription_stop_date, "Date is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addSubscriptionToUser || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user