mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-21 05:43:19 -07:00
Resolved #7
This commit is contained in:
parent
15d1b9f525
commit
67ecbbf178
7 changed files with 112 additions and 16 deletions
|
@ -90,6 +90,34 @@ $(".theSaveButton").click(function (e) {
|
|||
});
|
||||
});
|
||||
|
||||
// Note Modal click
|
||||
$(".theNoteSaveButton").click(function (e) {
|
||||
var comment = $("#noteArea").val();
|
||||
e.preventDefault();
|
||||
|
||||
var $form = $("#noteForm");
|
||||
var data = $form.serialize();
|
||||
|
||||
|
||||
$.ajax({
|
||||
type: $form.prop("method"),
|
||||
url: $form.prop("action"),
|
||||
data: data,
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
if (checkJsonResponse(response)) {
|
||||
generateNotify("Success! Added Note.", "success");
|
||||
$("#myModal").modal("hide");
|
||||
$('#adminNotesArea').html("<div>Note from Admin: " + comment + "</div>");
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e);
|
||||
generateNotify("Something went wrong!", "danger");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Update the modal
|
||||
$('#myModal').on('show.bs.modal', function (event) {
|
||||
var button = $(event.relatedTarget); // Button that triggered the modal
|
||||
|
@ -101,6 +129,17 @@ $('#myModal').on('show.bs.modal', function (event) {
|
|||
requestField.val(id); // Add ID to the hidden field
|
||||
});
|
||||
|
||||
// Update the note modal
|
||||
$('#noteModal').on('show.bs.modal', function (event) {
|
||||
var button = $(event.relatedTarget); // Button that triggered the modal
|
||||
var id = button.data('identifier'); // Extract info from data-* attributes
|
||||
|
||||
var modal = $(this);
|
||||
modal.find('.theNoteSaveButton').val(id); // Add ID to the button
|
||||
var requestField = modal.find('input');
|
||||
requestField.val(id); // Add ID to the hidden field
|
||||
});
|
||||
|
||||
// Delete
|
||||
$(document).on("click", ".delete", function (e) {
|
||||
e.preventDefault();
|
||||
|
@ -268,7 +307,8 @@ function buildRequestContext(result, type) {
|
|||
admin: result.admin,
|
||||
issues: result.issues,
|
||||
otherMessage: result.otherMessage,
|
||||
requestId: result.id
|
||||
requestId: result.id,
|
||||
adminNote: result.adminNotes
|
||||
};
|
||||
|
||||
return context;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue