[UPDT] HELPDESK: Normal employee permission
This commit is contained in:
@@ -6,54 +6,57 @@
|
||||
<div class="oh-faq-card">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<h3 class="oh-faq-card__title">{{category.title}}</h3>
|
||||
{% if perms.helpdesk.change_faqcategory %}
|
||||
<div class="oh-dropdown" x-data="{open: false}">
|
||||
<button
|
||||
class="oh-btn oh-stop-prop oh-btn--transparent oh-accordion-meta__btn"
|
||||
@click="open = !open"
|
||||
@click.outside="open = false"
|
||||
title="Actions"
|
||||
>
|
||||
<ion-icon
|
||||
name="ellipsis-vertical"
|
||||
role="img"
|
||||
class="md hydrated"
|
||||
aria-label="ellipsis vertical"
|
||||
></ion-icon>
|
||||
</button>
|
||||
{% if perms.helpdesk.change_faqcategory or perms.helpdesk.delete_faqcategory %}
|
||||
<div class="oh-dropdown" x-data="{open: false}">
|
||||
<button
|
||||
class="oh-btn oh-stop-prop oh-btn--transparent oh-accordion-meta__btn"
|
||||
@click="open = !open"
|
||||
@click.outside="open = false"
|
||||
title="Actions"
|
||||
>
|
||||
<ion-icon
|
||||
name="ellipsis-vertical"
|
||||
role="img"
|
||||
class="md hydrated"
|
||||
aria-label="ellipsis vertical"
|
||||
></ion-icon>
|
||||
</button>
|
||||
|
||||
<div class="oh-dropdown__menu oh-dropdown__menu--right" x-show="open">
|
||||
<ul class="oh-dropdown__items">
|
||||
<li class="oh-dropdown__item">
|
||||
<a
|
||||
hx-get="{% url 'faq-category-update' category.id %}"
|
||||
hx-target="#objectCreateModalTarget"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#objectCreateModal"
|
||||
role="button"
|
||||
class="oh-dropdown__link"
|
||||
>{% trans "Edit" %}</a
|
||||
>
|
||||
</li>
|
||||
|
||||
<li class="oh-dropdown__item">
|
||||
<form
|
||||
action="{% url 'faq-category-delete' category.id %}"
|
||||
onsubmit="return confirm('Are you sure you want to delete this FAQ Category?');"
|
||||
method="post"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<button
|
||||
type="submit"
|
||||
class="oh-dropdown__link oh-dropdown__link--danger"
|
||||
>
|
||||
{% trans "Delete" %}
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="oh-dropdown__menu oh-dropdown__menu--right" x-show="open">
|
||||
<ul class="oh-dropdown__items">
|
||||
{% if perms.helpdesk.change_faqcategory %}
|
||||
<li class="oh-dropdown__item">
|
||||
<a
|
||||
hx-get="{% url 'faq-category-update' category.id %}"
|
||||
hx-target="#objectCreateModalTarget"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#objectCreateModal"
|
||||
role="button"
|
||||
class="oh-dropdown__link"
|
||||
>{% trans "Edit" %}</a
|
||||
>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if perms.helpdesk.delete_faqcategory %}
|
||||
<li class="oh-dropdown__item">
|
||||
<form
|
||||
action="{% url 'faq-category-delete' category.id %}"
|
||||
onsubmit="return confirm('Are you sure you want to delete this FAQ Category?');"
|
||||
method="post"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<button
|
||||
type="submit"
|
||||
class="oh-dropdown__link oh-dropdown__link--danger"
|
||||
>
|
||||
{% trans "Delete" %}
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -14,42 +14,44 @@
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% if perms.helpdesk.change_faq %}
|
||||
<div class="oh-faq__item-header__right">
|
||||
<button
|
||||
class="oh-btn oh-btn--sq oh-btn--transparent"
|
||||
title="{% trans 'Edit' %}"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#objectCreateModal"
|
||||
hx-get="{% url 'faq-update' faq.id %}"
|
||||
hx-target="#objectCreateModalTarget"
|
||||
onclick='event.stopPropagation()'
|
||||
>
|
||||
<ion-icon name="create-outline"></ion-icon>
|
||||
</button>
|
||||
<form
|
||||
action="{% url 'faq-delete' faq.id %}"
|
||||
class="w-50"
|
||||
onsubmit="return confirm('{% trans "Are you sure you want to delete this FAQ?" %}');"
|
||||
method="post"
|
||||
onclick="event.stopPropagation()"
|
||||
>
|
||||
{% csrf_token %}
|
||||
{% if perms.helpdesk.change_faq %}
|
||||
<button
|
||||
type="submit"
|
||||
class="oh-btn oh-btn--sq oh-btn--danger-text oh-btn--transparent"
|
||||
title="{% trans 'Delete' %}"
|
||||
class="oh-btn oh-btn--sq oh-btn--transparent"
|
||||
title="{% trans 'Edit' %}"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#objectCreateModal"
|
||||
hx-get="{% url 'faq-update' faq.id %}"
|
||||
hx-target="#objectCreateModalTarget"
|
||||
onclick='event.stopPropagation()'
|
||||
>
|
||||
<ion-icon
|
||||
class="me-1 md hydrated"
|
||||
name="trash-outline"
|
||||
role="img"
|
||||
aria-label="trash outline"
|
||||
></ion-icon>
|
||||
<ion-icon name="create-outline"></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% if perms.helpdesk.delete_faq %}
|
||||
<form
|
||||
action="{% url 'faq-delete' faq.id %}"
|
||||
class="w-50"
|
||||
onsubmit="return confirm('{% trans "Are you sure you want to delete this FAQ?" %}');"
|
||||
method="post"
|
||||
onclick="event.stopPropagation()"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<button
|
||||
type="submit"
|
||||
class="oh-btn oh-btn--sq oh-btn--danger-text oh-btn--transparent"
|
||||
title="{% trans 'Delete' %}"
|
||||
>
|
||||
<ion-icon
|
||||
class="me-1 md hydrated"
|
||||
name="trash-outline"
|
||||
role="img"
|
||||
aria-label="trash outline"
|
||||
></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="oh-faq__item-body">{{faq.answer}}</div>
|
||||
</li>
|
||||
|
||||
@@ -464,7 +464,7 @@
|
||||
>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if perms.helpdesk.delete_ticket or request.user.employee_get|is_department_manager:ticket %}
|
||||
{% if perms.helpdesk.change_ticket or request.user.employee_get|is_department_manager:ticket %}
|
||||
{% if ticket.is_active %}
|
||||
<li
|
||||
class="oh-dropdown__item"
|
||||
@@ -788,7 +788,7 @@
|
||||
>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if perms.helpdesk.delete_ticket or request.user.employee_get|is_department_manager:ticket %}
|
||||
{% if perms.helpdesk.change_ticket or request.user.employee_get|is_department_manager:ticket %}
|
||||
{% if ticket.is_active %}
|
||||
<li
|
||||
class="oh-dropdown__item"
|
||||
|
||||
@@ -253,20 +253,24 @@
|
||||
<textarea class="bg-transparent border-0 w-100 comment_input" data-comment-id = "{{item.comment.id}}" >{{item.comment.comment}}</textarea>
|
||||
<p class="">{{item.comment.comment}}</p>
|
||||
<div class="oh-btn-group" style="border:none">
|
||||
{% if request.user.employee_get|is_department_manager:ticket or perms.helpdesk.change_comment or request.user.employee_get == item.comment.employee_id %}
|
||||
<a
|
||||
class="oh-btn p-3 edit_comment"
|
||||
title="{% trans 'Edit' %}"
|
||||
|
||||
>
|
||||
<ion-icon name="pencil-outline"></ion-icon>
|
||||
</a>
|
||||
<ion-icon name="pencil-outline"></ion-icon>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if perms.helpdesk.delete_comment %}
|
||||
<a
|
||||
href="{% url "comment-delete" item.comment.id %}"
|
||||
type="button" title="{% trans 'View' %}"
|
||||
type="button" title="{% trans 'Delete' %}"
|
||||
class="oh-btn p-3"
|
||||
>
|
||||
<ion-icon name="trash-outline"></ion-icon>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-scrollable-container">
|
||||
@@ -336,45 +340,47 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- start of comment box. -->
|
||||
<div class="oh-helpdesk__chatbox">
|
||||
<form name="comment-form" action="{% url 'comment-create' ticket.id %}" method="POST" enctype="multipart/form-data" class="oh-chat oh-chat__input-wrapper">
|
||||
{% csrf_token %}
|
||||
<input name="file" multiple="True" type="file" id="fileUpload" class="d-none" />
|
||||
<label
|
||||
aria-role="button"
|
||||
for="fileUpload"
|
||||
aria-label="Attach Files"
|
||||
class="oh-btn oh-btn--chat oh-btn--chat-attachments"
|
||||
>
|
||||
<!-- The file count badge -->
|
||||
<span id="fileCount" style="
|
||||
position: absolute;
|
||||
top: -6px; /* Adjust the top position */
|
||||
right: -6px; /* Adjust the right position */
|
||||
background-color: red;
|
||||
color: white;
|
||||
font-size: 12px;
|
||||
border-radius: 50%;
|
||||
padding: 2px 6px;
|
||||
min-width: 16px;
|
||||
text-align: center;
|
||||
display: none; /* Initially hidden */
|
||||
">
|
||||
</span>
|
||||
</label>
|
||||
{% if perms.helpdesk.add_comment or request.user.employee_get == ticket.employee_id %}
|
||||
<div class="oh-helpdesk__chatbox">
|
||||
<form name="comment-form" action="{% url 'comment-create' ticket.id %}" method="POST" enctype="multipart/form-data" class="oh-chat oh-chat__input-wrapper">
|
||||
{% csrf_token %}
|
||||
<input name="file" multiple="True" type="file" id="fileUpload" class="d-none" />
|
||||
<label
|
||||
aria-role="button"
|
||||
for="fileUpload"
|
||||
aria-label="Attach Files"
|
||||
class="oh-btn oh-btn--chat oh-btn--chat-attachments"
|
||||
>
|
||||
<!-- The file count badge -->
|
||||
<span id="fileCount" style="
|
||||
position: absolute;
|
||||
top: -6px; /* Adjust the top position */
|
||||
right: -6px; /* Adjust the right position */
|
||||
background-color: red;
|
||||
color: white;
|
||||
font-size: 12px;
|
||||
border-radius: 50%;
|
||||
padding: 2px 6px;
|
||||
min-width: 16px;
|
||||
text-align: center;
|
||||
display: none; /* Initially hidden */
|
||||
">
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<textarea
|
||||
name="comment"
|
||||
class="oh-helpdesk__chat-input oh-chat__main-input ps-5"
|
||||
placeholder="Type something..."
|
||||
></textarea>
|
||||
<button
|
||||
class="oh-btn oh-btn--chat oh-btn--chat-send"
|
||||
type="submit"
|
||||
onclick="validateComment(event)"
|
||||
aria-label="Send Message"></button>
|
||||
</form>
|
||||
</div>
|
||||
<textarea
|
||||
name="comment"
|
||||
class="oh-helpdesk__chat-input oh-chat__main-input ps-5"
|
||||
placeholder="Type something..."
|
||||
></textarea>
|
||||
<button
|
||||
class="oh-btn oh-btn--chat oh-btn--chat-send"
|
||||
type="submit"
|
||||
onclick="validateComment(event)"
|
||||
aria-label="Send Message"></button>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
<!-- end of comment box. -->
|
||||
</div>
|
||||
<!-- start of right side contents. -->
|
||||
@@ -488,35 +494,36 @@
|
||||
</div>
|
||||
|
||||
<div class="oh-helpdesk__subcard">
|
||||
<div class="oh-helpdesk__subcard-header">
|
||||
<span class="oh-helpdesk__subcard-title">{% trans "Assigned to" %}</span>
|
||||
{% if perms.helpdesk.change_ticket or request.user.employee_get|is_department_manager:ticket %}
|
||||
<div class="oh-btn-group">
|
||||
{% if perms.helpdesk.view_claimrequest or perms.helpdesk.change_ticket or request.user.employee_get|is_department_manager:ticket or perms.helpdesk.change_claimrequest %}
|
||||
<div class="oh-helpdesk__subcard-header">
|
||||
<span class="oh-helpdesk__subcard-title">{% trans "Assigned to" %}</span>
|
||||
{% if perms.helpdesk.change_ticket or request.user.employee_get|is_department_manager:ticket or perms.helpdesk.change_claimrequest %}
|
||||
<div class="oh-btn-group">
|
||||
|
||||
<button
|
||||
hx-get = "{% url "view-ticket-claim-request" ticket.id %}"
|
||||
hx-target="#objectDetailsModalTarget"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#objectDetailsModal"
|
||||
class="oh-btn oh-btn--info p-3 w-100"
|
||||
title = "{% trans "Claim Requests" %}"
|
||||
>
|
||||
<ion-icon name="eye-outline"></ion-icon>
|
||||
<button
|
||||
hx-get = "{% url "view-ticket-claim-request" ticket.id %}"
|
||||
hx-target="#objectDetailsModalTarget"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#objectDetailsModal"
|
||||
class="oh-btn oh-btn--info p-3 w-100"
|
||||
title = "{% trans "Claim Requests" %}"
|
||||
>
|
||||
<ion-icon name="eye-outline"></ion-icon>
|
||||
|
||||
</button>
|
||||
<button
|
||||
class="oh-btn oh-btn--light-bkg p-3 w-100"
|
||||
hx-get="{% url 'ticket-change-assignees' ticket.id %}"
|
||||
data-target ="#addTagModal"
|
||||
hx-target="#addTagTarget"
|
||||
title="{% trans 'Edit' %}"
|
||||
|
||||
><ion-icon name="create-outline"></ion-icon>
|
||||
</button>
|
||||
<button
|
||||
class="oh-btn oh-btn--light-bkg p-3 w-100"
|
||||
hx-get="{% url 'ticket-change-assignees' ticket.id %}"
|
||||
data-target ="#addTagModal"
|
||||
hx-target="#addTagTarget"
|
||||
title="{% trans 'Edit' %}"
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
><ion-icon name="create-outline"></ion-icon>
|
||||
</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
<div class="align-items-center d-flex" style="min-height: 40px;">
|
||||
<div class="d-flex justify-content-between custom-scroll">
|
||||
<div class="avatars" id="avatarsContainer">
|
||||
@@ -531,6 +538,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -359,7 +359,9 @@
|
||||
<div data-cell-index="16" data-cell-title='{% trans "Status" %}' class="oh-sticky-table__th">{% trans "Status" %}</div>
|
||||
<div data-cell-index="17" data-cell-title='{% trans "Priority" %}' class="oh-sticky-table__th">{% trans "Priority" %}</div>
|
||||
<div data-cell-index="18" data-cell-title='{% trans "Tags" %}' class="oh-sticky-table__th">{% trans "Tags" %}</div>
|
||||
<div class="oh-sticky-table__th oh-sticky-table__right" style="width:200px;">{% trans "Actions" %}</div>
|
||||
{% if perms.helpdesk.change_ticket or perms.helpdesk.delete_ticket or request.user.employee_get|is_department_manager:ticket or perms.helpdesk.change_claimrequest %}
|
||||
<div class="oh-sticky-table__th oh-sticky-table__right" style="width:200px;">{% trans "Actions" %}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__tbody">
|
||||
@@ -492,111 +494,126 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
<div data-cell-index="18" class="oh-sticky-table__td">{{ticket.tags.all|join:" , "}}</div>
|
||||
<div class="oh-sticky-table__td oh-sticky-table__right" onclick="event.stopPropagation()">
|
||||
<div class="oh-btn-group" style="border:none">
|
||||
{% if perms.helpdesk.change_ticket or request.user.employee_get|is_department_manager:ticket %}
|
||||
<button
|
||||
hx-get = "{% url "view-ticket-claim-request" ticket.id %}"
|
||||
hx-target="#objectDetailsModalTarget"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#objectDetailsModal"
|
||||
class="oh-btn oh-btn--light-bkg p-3 w-100"
|
||||
title = "{% trans "Claim Requests" %}"
|
||||
>
|
||||
<ion-icon name="eye-outline"></ion-icon>
|
||||
|
||||
</button>
|
||||
{% else %}
|
||||
{% if ticket|calim_request_exists:request.user.employee_get or request.user.employee_get in ticket.assigned_to.all %}
|
||||
<a
|
||||
{% if request.user.employee_get in ticket.assigned_to.all %}
|
||||
style="background-color:rgb(74, 238, 60);"
|
||||
{% endif %}
|
||||
href="#"
|
||||
class="oh-btn oh-btn--info w-100 oh-btn--disabled"
|
||||
title="{% trans 'Claim' %}"
|
||||
>
|
||||
<ion-icon name="checkmark-done-outline"></ion-icon>
|
||||
</a>
|
||||
{% else %}
|
||||
<a
|
||||
type="submit"
|
||||
href = "{% url 'claim-ticket' ticket.id %}"
|
||||
class="oh-btn oh-btn--info w-100"
|
||||
title="{% trans 'Claim' %}"
|
||||
>
|
||||
<ion-icon name="checkmark-done-outline"></ion-icon>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if perms.helpdesk.change_ticket or request.user.employee_get|is_department_manager:ticket %}
|
||||
<button
|
||||
class="oh-btn oh-btn--light-bkg p-3 w-50"
|
||||
title="{% trans 'Edit' %}"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#objectCreateModal"
|
||||
hx-get="{% url 'ticket-update' ticket.id %}"
|
||||
hx-target="#objectCreateModalTarget"
|
||||
>
|
||||
<ion-icon name="create-outline"></ion-icon>
|
||||
</button>
|
||||
{% endif %}
|
||||
{% if perms.helpdesk.delete_ticket or request.user.employee_get|is_department_manager:ticket %}
|
||||
{% if ticket.is_active %}
|
||||
<form
|
||||
action="{% url 'ticket-archive' ticket.id %}"
|
||||
class="w-50"
|
||||
onsubmit="event.stopPropagation();return confirm('{% trans "Do you want to archive this ticket?" %}');"
|
||||
method="post"
|
||||
style="display: contents"
|
||||
{% if perms.helpdesk.change_ticket or perms.helpdesk.delete_ticket or request.user.employee_get|is_department_manager:ticket or perms.helpdesk.change_claimrequest %}
|
||||
<div class="oh-sticky-table__td oh-sticky-table__right" onclick="event.stopPropagation()">
|
||||
<div class="oh-btn-group" style="border:none">
|
||||
{% if perms.helpdesk.change_ticket or perms.helpdesk.change_claimrequest or request.user.employee_get|is_department_manager:ticket %}
|
||||
<button
|
||||
hx-get = "{% url "view-ticket-claim-request" ticket.id %}"
|
||||
hx-target="#objectDetailsModalTarget"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#objectDetailsModal"
|
||||
class="oh-btn oh-btn--light-bkg p-3 w-100"
|
||||
title = "{% trans "Claim Requests" %}"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<button
|
||||
class="oh-btn oh-btn--danger-outline p-3 w-50"
|
||||
title="{% trans 'Archive' %}"
|
||||
>
|
||||
<ion-icon
|
||||
name="archive-sharp"
|
||||
role="img"
|
||||
class="md hydrated"
|
||||
aria-label="archive sharp"
|
||||
></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
<ion-icon name="eye-outline"></ion-icon>
|
||||
|
||||
</button>
|
||||
{% else %}
|
||||
<form
|
||||
{% if ticket|calim_request_exists:request.user.employee_get or request.user.employee_get in ticket.assigned_to.all %}
|
||||
<a
|
||||
{% if request.user.employee_get in ticket.assigned_to.all %}
|
||||
style="background-color:rgb(74, 238, 60);"
|
||||
{% endif %}
|
||||
href="#"
|
||||
class="oh-btn oh-btn--info w-100 oh-btn--disabled"
|
||||
title="{% trans 'Claim' %}"
|
||||
>
|
||||
<ion-icon name="checkmark-done-outline"></ion-icon>
|
||||
</a>
|
||||
{% else %}
|
||||
<a
|
||||
type="submit"
|
||||
href = "{% url 'claim-ticket' ticket.id %}"
|
||||
class="oh-btn oh-btn--info w-100"
|
||||
title="{% trans 'Claim' %}"
|
||||
>
|
||||
<ion-icon name="checkmark-done-outline"></ion-icon>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if perms.helpdesk.change_ticket or request.user.employee_get|is_department_manager:ticket %}
|
||||
<button
|
||||
class="oh-btn oh-btn--light-bkg p-3 w-50"
|
||||
title="{% trans 'Edit' %}"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#objectCreateModal"
|
||||
hx-get="{% url 'ticket-update' ticket.id %}"
|
||||
hx-target="#objectCreateModalTarget"
|
||||
>
|
||||
<ion-icon name="create-outline"></ion-icon>
|
||||
</button>
|
||||
{% endif %}
|
||||
{% if perms.helpdesk.change_ticket or request.user.employee_get|is_department_manager:ticket %}
|
||||
{% if ticket.is_active %}
|
||||
<form
|
||||
action="{% url 'ticket-archive' ticket.id %}"
|
||||
class="w-50"
|
||||
onsubmit="event.stopPropagation();return confirm('{% trans "Do you want to un-archive this ticket?" %}');"
|
||||
method="post"
|
||||
style="display: contents"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<button
|
||||
class="oh-btn oh-btn--danger-outline p-3 w-50"
|
||||
title="{% trans 'Un-archive' %}"
|
||||
onsubmit="event.stopPropagation();return confirm('{% trans "Do you want to archive this ticket?" %}');"
|
||||
method="post"
|
||||
style="display: contents"
|
||||
>
|
||||
<ion-icon
|
||||
name="archive-sharp"
|
||||
role="img"
|
||||
class="md hydrated"
|
||||
aria-label="archive sharp"
|
||||
></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% csrf_token %}
|
||||
<button
|
||||
class="oh-btn oh-btn--danger-outline p-3 w-50"
|
||||
title="{% trans 'Archive' %}"
|
||||
>
|
||||
<ion-icon
|
||||
name="archive-sharp"
|
||||
role="img"
|
||||
class="md hydrated"
|
||||
aria-label="archive sharp"
|
||||
></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<form
|
||||
action="{% url 'ticket-archive' ticket.id %}"
|
||||
class="w-50"
|
||||
onsubmit="event.stopPropagation();return confirm('{% trans "Do you want to un-archive this ticket?" %}');"
|
||||
method="post"
|
||||
style="display: contents"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<button
|
||||
class="oh-btn oh-btn--danger-outline p-3 w-50"
|
||||
title="{% trans 'Un-archive' %}"
|
||||
>
|
||||
<ion-icon
|
||||
name="archive-sharp"
|
||||
role="img"
|
||||
class="md hydrated"
|
||||
aria-label="archive sharp"
|
||||
></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if perms.helpdesk.delete_ticket %}
|
||||
{% if ticket.status == 'new' %}
|
||||
<form
|
||||
action="{% url 'ticket-delete' ticket.id %}"
|
||||
class="w-50"
|
||||
onsubmit="return confirm('{% trans 'Are you sure you want to delete this Ticket?' %}');"
|
||||
method='post' onclick="event.stopPropagation()" >
|
||||
{% csrf_token %}
|
||||
{% if perms.helpdesk.delete_ticket %}
|
||||
{% if ticket.status == 'new' %}
|
||||
<form
|
||||
action="{% url 'ticket-delete' ticket.id %}"
|
||||
class="w-50"
|
||||
onsubmit="return confirm('{% trans 'Are you sure you want to delete this Ticket?' %}');"
|
||||
method='post' onclick="event.stopPropagation()" >
|
||||
{% csrf_token %}
|
||||
<button
|
||||
type="submit"
|
||||
class="oh-btn oh-btn--danger-outline oh-btn--light-bkg p-3 w-100"
|
||||
title="{% trans 'Delete' %}"
|
||||
>
|
||||
<ion-icon
|
||||
class="me-1 md hydrated"
|
||||
name="trash-outline"
|
||||
role="img"
|
||||
aria-label="trash outline"
|
||||
></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<button
|
||||
type="submit"
|
||||
class="oh-btn oh-btn--danger-outline oh-btn--light-bkg p-3 w-100"
|
||||
disabled
|
||||
title="{% trans 'Delete' %}"
|
||||
>
|
||||
<ion-icon
|
||||
@@ -606,24 +623,11 @@
|
||||
aria-label="trash outline"
|
||||
></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<button
|
||||
class="oh-btn oh-btn--danger-outline oh-btn--light-bkg p-3 w-100"
|
||||
disabled
|
||||
title="{% trans 'Delete' %}"
|
||||
>
|
||||
<ion-icon
|
||||
class="me-1 md hydrated"
|
||||
name="trash-outline"
|
||||
role="img"
|
||||
aria-label="trash outline"
|
||||
></ion-icon>
|
||||
</button>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
@@ -747,7 +751,7 @@
|
||||
<div data-cell-index="26" data-cell-title='{% trans "Status" %}' class="oh-sticky-table__th">{% trans "Status" %}</div>
|
||||
<div data-cell-index="27" data-cell-title='{% trans "Priority" %}' class="oh-sticky-table__th">{% trans "Priority" %}</div>
|
||||
<div data-cell-index="28" data-cell-title='{% trans "Tags" %}' class="oh-sticky-table__th">{% trans "Tags" %}</div>
|
||||
{% if perms.helpdesk.change_ticket or perms.helpdesk.delete_ticket or request.user.employee_get|is_department_manager:ticket %}
|
||||
{% if perms.helpdesk.change_ticket or perms.helpdesk.delete_ticket or request.user.employee_get|is_department_manager:ticket or perms.helpdesk.change_claimrequest %}
|
||||
<div class="oh-sticky-table__th oh-sticky-table__right">{% trans "Actions" %}</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -874,10 +878,10 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
<div data-cell-index="28" class="oh-sticky-table__td">{{ticket.tags.all|join:" , "}}</div>
|
||||
{% if perms.helpdesk.change_ticket or perms.helpdesk.delete_ticket or request.user.employee_get|is_department_manager:ticket %}
|
||||
{% if perms.helpdesk.change_ticket or perms.helpdesk.delete_ticket or request.user.employee_get|is_department_manager:ticket or perms.helpdesk.change_claimrequest %}
|
||||
<div class="oh-sticky-table__td oh-sticky-table__right" onclick="event.stopPropagation()">
|
||||
<div class="oh-btn-group">
|
||||
{% if perms.helpdesk.change_ticket or request.user.employee_get|is_department_manager:ticket %}
|
||||
{% if perms.helpdesk.change_ticket or request.user.employee_get|is_department_manager:ticket or perms.helpdesk.change_claimrequest %}
|
||||
<button
|
||||
hx-get = "{% url "view-ticket-claim-request" ticket.id %}"
|
||||
hx-target="#objectDetailsModalTarget"
|
||||
@@ -902,7 +906,7 @@
|
||||
<ion-icon name="create-outline"></ion-icon>
|
||||
</button>
|
||||
{% endif %}
|
||||
{% if perms.helpdesk.delete_ticket or request.user.employee_get|is_department_manager:ticket %}
|
||||
{% if perms.helpdesk.change_ticket or request.user.employee_get|is_department_manager:ticket %}
|
||||
{% if ticket.is_active %}
|
||||
<form
|
||||
action="{% url 'ticket-archive' ticket.id %}"
|
||||
|
||||
@@ -89,7 +89,7 @@ def faq_category_view(request):
|
||||
|
||||
@login_required
|
||||
@hx_request_required
|
||||
@permission_required("helpdesk_addfaqcategory")
|
||||
@permission_required("helpdesk.add_faqcategory")
|
||||
def faq_category_create(request):
|
||||
"""
|
||||
This function is responsible for creating the FAQ Category.
|
||||
@@ -117,7 +117,7 @@ def faq_category_create(request):
|
||||
|
||||
@login_required
|
||||
@hx_request_required
|
||||
@permission_required("helpdesk_changefaqcategory")
|
||||
@permission_required("helpdesk.change_faqcategory")
|
||||
def faq_category_update(request, id):
|
||||
"""
|
||||
This function is responsible for updating the FAQ.
|
||||
@@ -137,7 +137,7 @@ def faq_category_update(request, id):
|
||||
form = FAQCategoryForm(request.POST, instance=faq_category)
|
||||
if form.is_valid():
|
||||
form.save()
|
||||
messages.info(request, _("The FAQ category updated successfully."))
|
||||
messages.success(request, _("The FAQ category updated successfully."))
|
||||
return HttpResponse("<script>window.location.reload()</script>")
|
||||
context = {
|
||||
"form": form,
|
||||
@@ -147,7 +147,7 @@ def faq_category_update(request, id):
|
||||
|
||||
|
||||
@login_required
|
||||
@permission_required("helpdesk_deletefaq")
|
||||
@permission_required("helpdesk.delete_faqcategory")
|
||||
def faq_category_delete(request, id):
|
||||
try:
|
||||
faq = FAQCategory.objects.get(id=id)
|
||||
@@ -208,7 +208,7 @@ def faq_view(request, cat_id, **kwargs):
|
||||
|
||||
@login_required
|
||||
@hx_request_required
|
||||
@permission_required("helpdesk_addfaq")
|
||||
@permission_required("helpdesk.add_faq")
|
||||
def create_faq(request, cat_id):
|
||||
"""
|
||||
This function is responsible for creating the FAQ.
|
||||
@@ -237,7 +237,7 @@ def create_faq(request, cat_id):
|
||||
|
||||
@login_required
|
||||
@hx_request_required
|
||||
@permission_required("helpdesk_changefaq")
|
||||
@permission_required("helpdesk.change_faq")
|
||||
def faq_update(request, id):
|
||||
"""
|
||||
This function is responsible for updating the FAQ.
|
||||
@@ -257,7 +257,7 @@ def faq_update(request, id):
|
||||
form = FAQForm(request.POST, instance=faq)
|
||||
if form.is_valid():
|
||||
form.save()
|
||||
messages.info(request, _("The FAQ updated successfully."))
|
||||
messages.success(request, _("The FAQ updated successfully."))
|
||||
return HttpResponse("<script>window.location.reload()</script>")
|
||||
context = {
|
||||
"form": form,
|
||||
@@ -355,7 +355,7 @@ def faq_suggestion(request):
|
||||
|
||||
|
||||
@login_required
|
||||
@permission_required("helpdesk_deletefaq")
|
||||
@permission_required("helpdesk.delete_faq")
|
||||
def faq_delete(request, id):
|
||||
try:
|
||||
faq = FAQ.objects.get(id=id)
|
||||
@@ -389,8 +389,10 @@ def ticket_view(request):
|
||||
created_by=request.user
|
||||
)
|
||||
all_tickets = []
|
||||
if is_reportingmanager(request) or request.user.has_perm("helpdesk.view_ticket"):
|
||||
if is_reportingmanager(request):
|
||||
all_tickets = filtersubordinates(request, tickets, "helpdesk.view_ticket")
|
||||
if request.user.has_perm("helpdesk.view_ticket"):
|
||||
all_tickets = tickets
|
||||
allocated_tickets = []
|
||||
ticket_list = tickets.filter(is_active=True)
|
||||
user = request.user.employee_get
|
||||
@@ -558,7 +560,7 @@ def ticket_archive(request, ticket_id):
|
||||
|
||||
# Check if the user has permission or is the employee or their reporting manager
|
||||
if (
|
||||
request.user.has_perm("helpdesk.delete_ticket")
|
||||
request.user.has_perm("helpdesk.change_ticket")
|
||||
or ticket.employee_id == request.user.employee_get
|
||||
or is_department_manager(request, ticket)
|
||||
):
|
||||
@@ -755,11 +757,6 @@ def ticket_filter(request):
|
||||
allocated_page_number = request.GET.get("allocated_page")
|
||||
tickets_items1 = Ticket.objects.none()
|
||||
tickets_items2 = Ticket.objects.none()
|
||||
print("<<<<<<<<<>>>>>>>>>>>>>>")
|
||||
print("<<<<<<<<<>>>>>>>>>>>>>>")
|
||||
print(request.GET.get("view"))
|
||||
print("<<<<<<<<<>>>>>>>>>>>>>>")
|
||||
print("<<<<<<<<<>>>>>>>>>>>>>>")
|
||||
|
||||
my_tickets = tickets.filter(employee_id=request.user.employee_get) | tickets.filter(
|
||||
created_by=request.user
|
||||
@@ -767,6 +764,8 @@ def ticket_filter(request):
|
||||
|
||||
all_tickets = tickets.filter(is_active=True)
|
||||
all_tickets = filtersubordinates(request, tickets, "helpdesk.add_tickets")
|
||||
if request.user.has_perm("helpdesk.view_ticket"):
|
||||
all_tickets = tickets
|
||||
|
||||
allocated_tickets = Ticket.objects.none()
|
||||
user = request.user.employee_get
|
||||
@@ -789,9 +788,6 @@ def ticket_filter(request):
|
||||
tickets_items3 = ticket_list.filter(raised_on=user.id, assigning_type="individual")
|
||||
|
||||
template = "helpdesk/ticket/ticket_list.html"
|
||||
print("========================")
|
||||
print(request.GET.get("view"))
|
||||
print("========================")
|
||||
|
||||
if request.GET.get("view") == "card":
|
||||
template = "helpdesk/ticket/ticket_card.html"
|
||||
@@ -939,8 +935,10 @@ def ticket_individual_view(request, ticket_id):
|
||||
@login_required
|
||||
def view_ticket_claim_request(request, ticket_id):
|
||||
ticket = Ticket.objects.filter(id=ticket_id).first()
|
||||
if request.user.has_perm("helpdesk.change_ticket") or is_department_manager(
|
||||
request, ticket
|
||||
if (
|
||||
request.user.has_perm("helpdesk.change_claimrequest")
|
||||
or request.user.has_perm("helpdesk.change_ticket")
|
||||
or is_department_manager(request, ticket)
|
||||
):
|
||||
claim_requests = ticket.claimrequest_set.all()
|
||||
context = {
|
||||
@@ -1226,11 +1224,10 @@ def comment_edit(request):
|
||||
|
||||
|
||||
@login_required
|
||||
@permission_required("helpdesk.delete_comment")
|
||||
def comment_delete(request, comment_id):
|
||||
comment = Comment.objects.filter(id=comment_id).first()
|
||||
employee = comment.employee_id
|
||||
if not request.user.has_perm("helpdesk.delete_comment"):
|
||||
comment = comment.filter(employee_id__employee_user_id=request.user)
|
||||
comment.delete()
|
||||
messages.success(
|
||||
request, _("{}'s comment has been deleted successfully.").format(employee)
|
||||
|
||||
Reference in New Issue
Block a user