git commit all base code
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
|
||||
// ================
|
||||
// Add Subscription
|
||||
// ================
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// --------------
|
||||
// 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});
|
||||
|
||||
// -----------
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$("#addSubscription").submit();
|
||||
|
||||
});
|
||||
|
||||
// --------------
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addSubscription || "";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#addSubscription").submit(function (e) {
|
||||
|
||||
var subscription_title = $("#subscription_title"),
|
||||
subscription_description = $("#subscription_description"),
|
||||
subscription_project_type = $("#subscription_projecttype"),
|
||||
subscription_area = $("#subscription_area");
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
subscription_title.val(subscription_title.val().replace(/\s+/g, " ").trim());
|
||||
subscription_title.val(subscription_title.val().replace(/\s+/g, " ").trim());
|
||||
|
||||
if (isBlank(subscription_title)) {
|
||||
createInputError(subscription_title, "Title is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isBlank(subscription_description)) {
|
||||
createInputError(subscription_description, "Description is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($("option:selected", subscription_project_type).val() === "") {
|
||||
createInputError(subscription_project_type, "Project Type is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($("option:selected", subscription_area).val() === "") {
|
||||
createInputError(subscription_area, "Area is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addSubscription || "";
|
||||
$sessionStorage.toast = "Subscription was Added";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user