[FIX] HELPDESK: Fixed ticket kanban button issue

This commit is contained in:
Horilla
2024-03-04 10:12:34 +05:30
parent d9a056ce88
commit 9143f523b4
4 changed files with 74 additions and 72 deletions

View File

@@ -1,34 +1,37 @@
$(`.change-ticket`).not('[data-container-list = "candidate"]').mouseup(function (e) {
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);
$(`.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);
}
});

View File

@@ -15,34 +15,33 @@
</div>
<div class="oh-modal__dialog-body" id="deparmentManagersForm">
{% if form.errors %}
<!-- form errors -->
<div class="oh-wrapper">
<div class="oh-alert-container">
{% for error in form.non_field_errors %}
<div class="oh-alert oh-alert--animated oh-alert--danger">
{{ error }}
<!-- form errors -->
<div class="oh-wrapper">
<div class="oh-alert-container">
{% for error in form.non_field_errors %}
<div class="oh-alert oh-alert--animated oh-alert--danger">
{{ error }}
</div>
{% endfor %}
</div>
</div>
{% endfor %}
</div>
</div>
{% endif %}
<form
{% if dep_id %}
hx-post="{% url 'department-manager-update' dep_id %}"
{% else %}
hx-post="{% url 'department-manager-create' %}"
{% endif %}
hx-target="#deparmentManagersForm"
method="post"
hx-encoding="multipart/form-data">
{% csrf_token %}
{{form.as_p}}
<button
type="submit"
class="oh-btn oh-btn--secondary mt-2 mr-0 oh-btn--w-100-resp"
>
{% trans "Save" %}
</button>
</form>
{% endif %}
<form
{% if dep_id %}
hx-post="{% url 'department-manager-update' dep_id %}"
{% else %}
hx-post="{% url 'department-manager-create' %}"
{% endif %}
hx-target="#deparmentManagersForm"
method="post"
hx-encoding="multipart/form-data">
{% csrf_token %}
{{form.as_p}}
<div class="d-flex flex-row-reverse mt-3">
<button type="submit" class="oh-btn oh-btn--secondary mt-2 mr-0 pl-4 pr-5 oh-btn--w-100-resp">
{% trans "Save" %}
</button>
</div>
</form>
</div>
</div>

View File

@@ -98,7 +98,7 @@
>
<button class="oh-btn oh-btn--small
oh-btn--transparent oh-kanban__btn
oh-kanban__dropdown-toggle"
oh-kanban__dropdown-toggle action-button"
title={% trans "Actions" %}
onclick="event.stopPropagation()">
<ion-icon
@@ -325,7 +325,7 @@
>
<button class="oh-btn oh-btn--small
oh-btn--transparent oh-kanban__btn
oh-kanban__dropdown-toggle"
oh-kanban__dropdown-toggle action-button"
title={% trans "Actions" %}
onclick="event.stopPropagation()">
<ion-icon
@@ -568,7 +568,7 @@
>
<button class="oh-btn oh-btn--small
oh-btn--transparent oh-kanban__btn
oh-kanban__dropdown-toggle"
oh-kanban__dropdown-toggle action-button"
title={% trans "Actions" %}
onclick="event.stopPropagation()">
<ion-icon

View File

@@ -98,7 +98,7 @@
<h2 class="oh-modal__dialog-title" id="editTitle">
{% trans "Create Ticket Type" %}
</h2>
<button class="oh-modal__close" aria-label="Close">
<button class="oh-modal__close--custom" onclick="$('#createTicketTypeModal').removeClass('oh-modal--show')" aria-label="Close">
<ion-icon name="close-outline"></ion-icon>
</button>
</div>
@@ -115,13 +115,13 @@
{{ t_type_form.type }}
<label class="oh-label">{% trans "Prefix" %}</label>
{{ t_type_form.prefix }}
<input type="checkbox" name="is_active" class="oh-switch__checkbox" id="id_ticket_type_is_active" checked style="display: none;">
<button
type="submit"
class="oh-btn oh-btn--secondary mt-2 mr-0 oh-btn--w-100-resp"
>
{% trans "Save" %}
</button>
<input type="checkbox" name="is_active" class="oh-switch__checkbox" id="id_ticket_type_is_active" checked style="display: none;">
<div class="d-flex flex-row-reverse">
<button type="submit" class="oh-btn oh-btn--secondary mt-2 mr-0 pl-4 pr-5 oh-btn--w-100-resp">
{% trans "Save" %}
</button>
</div>
</form>
</div>
</div>