Files
ihrm/helpdesk/static/tickets/tickets.js
Ashwanth Balakrishnan 58be33a8d7 Added Pre-Commit Hooks (#175)
* Added pre commit hook

* Run pre commit hook on all files

---------

Co-authored-by: Horilla <131998600+horilla-opensource@users.noreply.github.com>
2024-05-07 12:23:36 +05:30

38 lines
1.2 KiB
JavaScript

$(`.change-ticket`).mouseup(function (e) {
if (!$(e.target).hasClass('action-button')){
e.preventDefault()
setTimeout(() => {
var status = $(this).parent().attr("data-ticket-id");
var ticket = $(e.target).parents(".change-ticket").last();
var ticketID = ticket.attr("data-ticket-id");
if (ticketID != null) {
$.ajax({
type: "post",
url: `/helpdesk/change-ticket-status/${ticketID}/`,
data: {
csrfmiddlewaretoken: getCookie("csrftoken"),
"status": status,
},
success: function (response) {
var duration = 0;
if (response.type != "noChange") {
$("#ohMessages").append(`
<div class="oh-alert-container">
<div class="oh-alert oh-alert--animated oh-alert--${response.type}">
${response.message}
</div>
</div>`);
duration = 1500;
}
// countSequence(false);
},
error: () => {
console.log("error")
},
});
}
}, 200);
}
});