[UPDT] HELPDESK: Change assignees,change raised on forms updated with error message
This commit is contained in:
@@ -1,44 +1,56 @@
|
||||
{% load i18n %}
|
||||
<section class="oh-wrapper oh-main__topbar" x-data="{searchShow: false}">
|
||||
<div class="oh-main__titlebar oh-main__titlebar--left">
|
||||
<h1 class="oh-main__titlebar-title fw-bold">{% trans "FAQ Categories" %}</h1>
|
||||
<a
|
||||
class="oh-main__titlebar-search-toggle"
|
||||
role="button"
|
||||
aria-label="Toggle Search"
|
||||
@click="searchShow = !searchShow"
|
||||
>
|
||||
<ion-icon
|
||||
name="search-outline"
|
||||
class="oh-main__titlebar-serach-icon"
|
||||
></ion-icon>
|
||||
</a>
|
||||
</div>
|
||||
<div class="oh-main__titlebar oh-main__titlebar--right oh-title_faq__main-header">
|
||||
|
||||
<div class="oh-input-group oh-input__search-group oh-faq__input-search"
|
||||
:class="searchShow ? 'oh-input__search-group--show' : ''">
|
||||
<ion-icon name="search-outline"
|
||||
class="oh-input-group__icon oh-input-group__icon--left md hydrated oh-faq_search--icon" role="img"
|
||||
aria-label="search outline"></ion-icon>
|
||||
<input
|
||||
type="text"
|
||||
class="oh-input oh-input__icon oh-search_input"
|
||||
aria-label="Search Input"
|
||||
name="search"
|
||||
placeholder="Search in FAQs..."
|
||||
hx-get="{% url 'faq-search' %}?category=true"
|
||||
hx-trigger="change delay:300ms"
|
||||
onkeyup='$("#suggestion_box").show();'
|
||||
hx-target="#faqCategoryList">
|
||||
<div class="oh-autocomplete-suggestions" style="display:block" id="suggestion_box"></div>
|
||||
</div>
|
||||
{% comment %} <select class="oh-select oh-select-faq oh-select--dropdown">
|
||||
<option value="1">{% trans "category" %}</option>
|
||||
<option value="2">{% trans "All FAQ" %}</option>
|
||||
</select> {% endcomment %}
|
||||
</div>
|
||||
<div class="oh-main__titlebar oh-main__titlebar--right">
|
||||
<div class="oh-main__titlebar oh-main__titlebar--left">
|
||||
<h1 class="oh-main__titlebar-title fw-bold">
|
||||
{% trans "FAQ Categories" %}
|
||||
</h1>
|
||||
<a
|
||||
class="oh-main__titlebar-search-toggle"
|
||||
role="button"
|
||||
aria-label="Toggle Search"
|
||||
@click="searchShow = !searchShow"
|
||||
>
|
||||
<ion-icon
|
||||
name="search-outline"
|
||||
class="oh-main__titlebar-serach-icon"
|
||||
></ion-icon>
|
||||
</a>
|
||||
</div>
|
||||
<div
|
||||
class="oh-main__titlebar oh-main__titlebar--right oh-title_faq__main-header"
|
||||
>
|
||||
<div
|
||||
class="oh-input-group oh-input__search-group oh-faq__input-search"
|
||||
:class="searchShow ? 'oh-input__search-group--show' : ''"
|
||||
>
|
||||
<ion-icon
|
||||
name="search-outline"
|
||||
class="oh-input-group__icon oh-input-group__icon--left md hydrated oh-faq_search--icon"
|
||||
role="img"
|
||||
aria-label="search outline"
|
||||
></ion-icon>
|
||||
<input
|
||||
type="text"
|
||||
class="oh-input oh-input__icon oh-search_input"
|
||||
aria-label="Search Input"
|
||||
name="search"
|
||||
placeholder="Search in FAQs..."
|
||||
hx-get="{% url 'faq-search' %}?category=true"
|
||||
hx-trigger="change delay:300ms"
|
||||
onkeyup='$("#suggestion_box").show(); if ($(this).val() == "") {$("#suggestion_box").hide()}'
|
||||
onfocusout = '$("#suggestion_box").hide()'
|
||||
hx-target="#faqCategoryList"
|
||||
/>
|
||||
<div class="oh-autocomplete-suggestions" id="suggestion_box"></div>
|
||||
</div>
|
||||
{% comment %}
|
||||
<select class="oh-select oh-select-faq oh-select--dropdown">
|
||||
<option value="1">{% trans "category" %}</option>
|
||||
<option value="2">{% trans "All FAQ" %}</option>
|
||||
</select>
|
||||
{% endcomment %}
|
||||
</div>
|
||||
<div class="oh-main__titlebar oh-main__titlebar--right">
|
||||
<form
|
||||
method="post"
|
||||
hx-get="{% url 'faq-category-search' %}"
|
||||
@@ -53,25 +65,25 @@
|
||||
>
|
||||
{% trans "Filter" %}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
{% if perms.helpdesk.add_faqcategory %}
|
||||
<div class="oh-main__titlebar-button-container">
|
||||
<div class="oh-btn-group ml-2">
|
||||
<div class="oh-dropdown" x-data="{open: false}">
|
||||
<button
|
||||
class="oh-btn oh-btn--secondary oh-btn--shadow"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#faqCategoryCreate"
|
||||
hx-get="{% url 'faq-category-create' %}"
|
||||
hx-target="#faqCategoryCreate"
|
||||
>
|
||||
<ion-icon name="add-outline" class="me-1"></ion-icon>
|
||||
{% trans "Create" %}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% if perms.helpdesk.add_faqcategory %}
|
||||
<div class="oh-main__titlebar-button-container">
|
||||
<div class="oh-btn-group ml-2">
|
||||
<div class="oh-dropdown" x-data="{open: false}">
|
||||
<button
|
||||
class="oh-btn oh-btn--secondary oh-btn--shadow"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#faqCategoryCreate"
|
||||
hx-get="{% url 'faq-category-create' %}"
|
||||
hx-target="#faqCategoryCreate"
|
||||
>
|
||||
<ion-icon name="add-outline" class="me-1"></ion-icon>
|
||||
{% trans "Create" %}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -6,10 +6,11 @@
|
||||
x-show="open"
|
||||
@click.outside="open = false"
|
||||
>
|
||||
<form action="{% url 'ticket-change-assignees' ticket_id %}" method="post" enctype="multipart/form-data">
|
||||
<form hx-post="{% url 'ticket-change-assignees' ticket_id %}" hx-target="#addTagTarget" hx-encoding="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
<div class="oh-input-group">
|
||||
<label for="id_name" class="oh-label">{% trans 'Assignees' %}</label>
|
||||
{{form.non_field_errors}}
|
||||
{{form.assigned_to}}
|
||||
</div>
|
||||
<button
|
||||
|
||||
@@ -6,10 +6,14 @@
|
||||
x-show="open"
|
||||
@click.outside="open = false"
|
||||
>
|
||||
<form action="{% url 'ticket-change-raised-on' ticket_id %}" method="post" enctype="multipart/form-data">
|
||||
<form hx-post="{% url 'ticket-change-raised-on' ticket_id %}" hx-target="#addTagTarget" hx-encoding="multipart/form-data">
|
||||
<div hidden id="cur_raised_on" value="{{form.instance.raised_on}}">
|
||||
{{form.instance.raised_on}}
|
||||
</div>
|
||||
{% csrf_token %}
|
||||
<div class="oh-input-group">
|
||||
<label for="id_name" class="oh-label">{% trans 'Responsibility' %}</label>
|
||||
{{form.non_field_errors}}
|
||||
<label class="oh-input__label" for="id_assigning_type">{% trans "Assigning type" %}</label>
|
||||
{{form.assigning_type}}
|
||||
<label class="oh-input__label" for="id_raised_on">{% trans "Raised on" %}</label>
|
||||
@@ -27,6 +31,38 @@
|
||||
|
||||
<script>
|
||||
$(document).ready( function(){
|
||||
var assigning_type = $('#id_assigning_type').find(":selected").val();
|
||||
if (assigning_type) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/helpdesk/get-raised-on",
|
||||
data: {
|
||||
'assigning_type': assigning_type,
|
||||
},
|
||||
success: function (response) {
|
||||
var raised_on = response.raised_on;
|
||||
var cur_raised_on = $("#cur_raised_on").attr("value");
|
||||
// Clear the existing options
|
||||
$("#id_raised_on").empty();
|
||||
var options = $('<option value="" >').text("---------");
|
||||
$("#id_raised_on").append(options);
|
||||
|
||||
$.each(raised_on, function (id, obj) {
|
||||
// looping all raised_on
|
||||
var options = $(
|
||||
'<option value="' +
|
||||
obj.id +
|
||||
'" ' +
|
||||
(obj.id == cur_raised_on
|
||||
? 'selected="selected"'
|
||||
: "") +
|
||||
">"
|
||||
).text(obj.name);
|
||||
$("#id_raised_on").append(options);
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
$('#id_assigning_type').change(function(){
|
||||
var assigning_type = $('#id_assigning_type').val()
|
||||
$.ajax({
|
||||
|
||||
@@ -337,7 +337,7 @@
|
||||
</div>
|
||||
<div class="oh-helpdesk__subcard-body">
|
||||
<ul class="oh-helpdesk__subcard-items">
|
||||
<li class="oh-helpdesk__subcard-item">{{ticket.get_raised_on}}</li>
|
||||
<li class="oh-helpdesk__subcard-item">{{ticket.get_raised_on_object}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user