104 lines
2.7 KiB
JavaScript
104 lines
2.7 KiB
JavaScript
|
|
|
||
|
|
// ========================
|
||
|
|
// Edit Subscription City
|
||
|
|
// ========================
|
||
|
|
|
||
|
|
$(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();
|
||
|
|
|
||
|
|
$("#editSubscriptionCity").submit();
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
// --------------
|
||
|
|
// Cancel Button.
|
||
|
|
// --------------
|
||
|
|
|
||
|
|
$(".btnCancel").on("click", function () {
|
||
|
|
|
||
|
|
$sessionStorage.action = $sessionStorage.editSubscriptionCity || "";
|
||
|
|
|
||
|
|
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||
|
|
|
||
|
|
formSubmit($sessionStorage);
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
// -------------
|
||
|
|
// Delete Button
|
||
|
|
// -------------
|
||
|
|
|
||
|
|
$(".btnDelete").on("click", function () {
|
||
|
|
|
||
|
|
$("#confirm-dialog").removeClass().addClass("modal confirm-delete-subscriptioncity")
|
||
|
|
.find(".modal-title").html("Confirm Delete Subscription City").end()
|
||
|
|
.find(".modal-body").html("Are you sure you wish to delete this Subscriptions City?").end()
|
||
|
|
.modal("show");
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
$("body").on("click", ".confirm-delete-subscriptioncity .btnConfirmDialogConfirm", function () {
|
||
|
|
|
||
|
|
$.post("./", {action: "Subscriptions.deleteSubscriptionCity", subscriptioncity_serial: $sessionStorage.subscriptioncity_serial})
|
||
|
|
.done(function () {
|
||
|
|
$sessionStorage.action = $sessionStorage.deleteSubscriptionCity || "";
|
||
|
|
formSubmit($sessionStorage);
|
||
|
|
});
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
// ---------------
|
||
|
|
// Validate Inputs
|
||
|
|
// ---------------
|
||
|
|
|
||
|
|
$("#editSubscriptionCity").submit(function (e) {
|
||
|
|
|
||
|
|
var city_name = $("#city_serial");
|
||
|
|
|
||
|
|
clearInputErrors();
|
||
|
|
|
||
|
|
if ($("option:selected", city_name).val() === "") {
|
||
|
|
createInputError(city_name, "Please select a city");
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
e.preventDefault();
|
||
|
|
|
||
|
|
$.post("./", $(this).serialize())
|
||
|
|
|
||
|
|
.done(function () {
|
||
|
|
|
||
|
|
$sessionStorage.action = $sessionStorage.editSubscriptionCity || "";
|
||
|
|
|
||
|
|
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||
|
|
|
||
|
|
formSubmit($sessionStorage);
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
});
|