mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 10:36:54 -07:00
parent
c24652a89f
commit
31615ff69c
4 changed files with 84 additions and 18 deletions
|
@ -182,6 +182,50 @@ $(document).on("click", ".clear", function (e) {
|
|||
|
||||
});
|
||||
|
||||
//change
|
||||
|
||||
// Change Availability
|
||||
$(document).on("click", ".change", function (e) {
|
||||
e.preventDefault();
|
||||
var buttonId = e.target.id;
|
||||
|
||||
var availablity = $("button[custom-availibility='" + buttonId + "']").val();
|
||||
var $form = $('#change' + buttonId);
|
||||
var data = $form.serialize();
|
||||
data = data + "&Available=" + availablity;
|
||||
|
||||
$.ajax({
|
||||
type: $form.prop('method'),
|
||||
url: $form.prop('action'),
|
||||
data: data,
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
|
||||
if (checkJsonResponse(response)) {
|
||||
generateNotify("Success! Availibility changed.", "info");
|
||||
var button = $("button[custom-availibility='" + buttonId + "']");
|
||||
var icon = $('#availableIcon'+buttonId);
|
||||
|
||||
if (response.available) {
|
||||
button.text("Mark Unavailable");
|
||||
button.val("false");
|
||||
button.prop("class", "btn btn-sm btn-info-outline change");
|
||||
icon.prop("class", "fa fa-check");
|
||||
} else {
|
||||
button.text("Mark Available");
|
||||
button.prop("class", "btn btn-sm btn-success-outline change");
|
||||
icon.prop("class", "fa fa-times");
|
||||
button.val("true");
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e);
|
||||
generateNotify("Something went wrong!", "danger");
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function movieLoad() {
|
||||
$("#movieList").html("");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue