[UPDT] BASE: Updated action type CRUD operation permissions

This commit is contained in:
Horilla
2024-11-14 15:36:35 +05:30
parent 5a3e6488d0
commit ea07319d5f
15 changed files with 187 additions and 163 deletions

View File

@@ -17,7 +17,9 @@
{% endif %}
</div>
{% if action_types %}
{% include 'base/action_type/action_type_view.html' %}
<div id="actionTypes">
{% include 'base/action_type/action_type_view.html' %}
</div>
{% else %}
<div style="display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%;">
<img style="display: block; width: 15%; margin: 20px auto; filter: opacity(0.5);" src="{% static 'images/ui/legal.png' %}" class="" alt="Page not found. 404." />

View File

@@ -1,4 +1,9 @@
{% load i18n %}
{% if messages and not hx_vals %}
<script>reloadMessage();</script>
<span hx-on-htmx-after-request="setTimeout(() => {$('.oh-modal__close--custom').click();}, 500);" hx-target="#actionTypes" hx-trigger="load" hx-select=".oh-sticky-table"
hx-get="{% url 'action-type' %}"></span>
{% endif %}
<div class="oh-modal__dialog-header pb-0">
<h2 class="oh-modal__dialog-title" id="createModalTitle">
{% if act_id %}

View File

@@ -29,14 +29,14 @@
{% if perms.employee.change_actiontype %}
<a hx-get="{% url 'action-type-update' act.id %}" hx-target="#objectUpdateModalTarget"
data-toggle="oh-modal-toggle" data-target="#objectUpdateModal" type="button"
class="oh-btn oh-btn--light-bkg w-50" title="{% trans 'Edit' %}">
class="oh-btn oh-btn--light-bkg w-100" title="{% trans 'Edit' %}">
<ion-icon name="create-outline"></ion-icon></a>
{% endif %}
{% if perms.employee.delete_actiontype %}
<form hx-confirm="{% trans 'Are you sure you want to delete this action type?' %}"
hx-on-htmx-after-request="reloadMessage(this);"
hx-post="{% url 'action-type-delete' act.id %}" hx-target="#actionType{{act.id}}"
hx-swap="outerHTML" class="w-50">
hx-swap="outerHTML" class="w-100">
{% csrf_token %}
<button type="submit" class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100"
title="{% trans 'Remove' %}">

View File

@@ -1,41 +1,41 @@
{% load i18n %}
{% if messages %}
<script>reloadMessage();</script>
<span hx-on-htmx-after-request="setTimeout(() => {$('.oh-modal__close').click();}, 500);" hx-target="#employeeTags" hx-trigger="load" hx-select=".oh-sticky-table"
hx-get="{% url 'employee-tag-view' %}"></span>
{% endif %}
<div class="oh-modal__dialog-header pb-0">
<h2 class="oh-modal__dialog-title" id="createModalTitle">
{% if tag_id %} {% trans "Update Employee Tag" %} {% else %} {% trans "Create Employee Tag" %} {% endif %}
</h2>
<button class="oh-modal__close" aria-label="Close">
<ion-icon name="close-outline"></ion-icon>
</button>
<h2 class="oh-modal__dialog-title" id="createModalTitle">
{% if tag_id %} {% trans "Update Employee Tag" %} {% else %} {% trans "Create Employee Tag" %} {% endif %}
</h2>
<button class="oh-modal__close" aria-label="Close">
<ion-icon name="close-outline"></ion-icon>
</button>
</div>
<div class="oh-modal__dialog-body">
{% 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 }}
</div>
{% endfor %}
</div>
</div>
{% endif %}
<form
{% if tag_id %}
hx-post="{% url 'employee-tag-update' tag_id %}"
hx-target="#objectUpdateModalTarget"
{% else %}
hx-post="{% url 'employee-tag-create' %}"
hx-target="#objectCreateModalTarget"
{% 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 }}
</div>
{% endfor %}
</div>
</div>
{% endif %}
hx-encoding="multipart/form-data"
class="oh-profile-section"
>
{% csrf_token %} {{form.as_p}}
<div class="oh-modal__dialog-footer p-0 mt-3">
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow">
{% trans "Save" %}
</button>
</div>
</form>
<form {% if tag_id %}
hx-post="{% url 'employee-tag-update' tag_id %}" hx-target="#objectUpdateModalTarget"
{% else %}
hx-post="{% url 'employee-tag-create' %}" hx-target="#objectCreateModalTarget"
{% endif %}
hx-encoding="multipart/form-data" class="oh-profile-section">
{% csrf_token %} {{form.as_p}}
<div class="oh-modal__dialog-footer p-0 mt-3">
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow">
{% trans "Save" %}
</button>
</div>
</form>
</div>

View File

@@ -5,7 +5,7 @@
<div class="oh-sticky-table__tr">
<div class="oh-sticky-table__th">{% trans "Title" %}</div>
<div class="oh-sticky-table__th">{% trans "Color" %}</div>
{% if perms.employee.delete_employeetag or perms.employee.delete_employeetag %}
{% if perms.employee.change_employeetag or perms.employee.delete_employeetag %}
<div class="oh-sticky-table__th">{% trans "Actions" %}</div>
{% endif %}
</div>
@@ -21,23 +21,23 @@
border-radius: 50%;
display: inline-block;"></span>
</div>
{% if perms.employee.delete_employeetag or perms.employee.delete_employeetag %}
{% if perms.employee.change_employeetag or perms.employee.delete_employeetag %}
<div class="oh-sticky-table__td">
<div class="oh-btn-group">
{% if perms.employee.change_employeetag %}
<a hx-get="{% url 'employee-tag-update' tag.id %}" hx-target="#objectUpdateModalTarget"
data-toggle="oh-modal-toggle" data-target="#objectUpdateModal" type="button"
class="oh-btn oh-btn--light-bkg w-50" title="{% trans 'Edit' %}">
class="oh-btn oh-btn--light-bkg w-100" title="{% trans 'Edit' %}">
<ion-icon name="create-outline"></ion-icon>
</a>
{% endif %}
{% if perms.employee.delete_employeetag %}
<form hx-post="{% url 'employee-tag-delete' tag.id %}" hx-swap="outerHTML" class="w-50"
<form hx-post="{% url 'employee-tag-delete' tag.id %}" hx-swap="outerHTML" class="w-100"
hx-confirm="{% trans 'Are you sure you want to delete this employee tag ?'%}"
hx-target="#employeeTagTr{{tag.id}}" hx-on-htmx-after-request="reloadMessage(this);">
{% csrf_token %}
<button type="submit" class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100"
title="{% trans 'Remove' %}">
title="{% trans 'Delete' %}">
<ion-icon name="trash-outline"></ion-icon>
</button>
</form>

View File

@@ -22,7 +22,9 @@
{% endif %}
</div>
{% if employeetags %}
{% include 'base/employee_tag/employee_tag_view.html' %}
<div id="employeeTags">
{% include 'base/employee_tag/employee_tag_view.html' %}
</div>
{% else %}
<div style="display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%;">
<img style="display: block; width: 15%; margin: 20px auto; filter: opacity(0.5);" src="{% static 'images/ui/price-tag.png' %}" class="" alt="Page not found. 404." />

View File

@@ -853,6 +853,10 @@ class Actiontype(HorillaModel):
def __str__(self) -> str:
return f"{self.title}"
class Meta:
verbose_name = _("Action Type")
verbose_name_plural = _("Action Types")
class DisciplinaryAction(HorillaModel):
"""

View File

@@ -122,7 +122,7 @@ def delete_policies(request):
@login_required
@permission_required("employee.change_policy")
@permission_required("employee.add_policymultiplefile")
def add_attachment(request):
"""
This method is used to add attachment to policy
@@ -142,7 +142,7 @@ def add_attachment(request):
@login_required
@permission_required("employee.delete_policy")
@permission_required("employee.delete_policymultiplefile")
def remove_attachment(request):
"""
This method is used to remove the attachments
@@ -170,12 +170,16 @@ def disciplinary_actions(request):
This method is used to view all Disciplinaryaction
"""
employee = Employee.objects.filter(employee_user_id=request.user).first()
dis_actions = filtersubordinates(
request, DisciplinaryAction.objects.all(), "base.add_disciplinaryaction"
).distinct()
dis_actions = (
dis_actions | DisciplinaryAction.objects.filter(employee_id=employee).distinct()
)
if request.user.has_perm("employee.view_disciplinaryaction"):
dis_actions = DisciplinaryAction.objects.all()
else:
dis_actions = filtersubordinates(
request, DisciplinaryAction.objects.all(), "base.add_disciplinaryaction"
).distinct()
dis_actions = (
dis_actions
| DisciplinaryAction.objects.filter(employee_id=employee).distinct()
)
form = DisciplinaryActionFilter(request.GET, queryset=dis_actions)
page_number = request.GET.get("page")

View File

@@ -10,100 +10,101 @@
onsubmit="event.preventDefault()">
<div class="oh-main__titlebar oh-main__titlebar--right oh-d-flex-column--resp oh-mb-3--small">
{% if perms.employee.add_disciplinaryaction %}
{% if data %}
<div class="oh-main__titlebar-button-container">
<div class="oh-input-group oh-input__search-group mr-4">
<ion-icon name="search-outline" class="oh-input-group__icon oh-input-group__icon--left md hydrated"
role="img" aria-label="search outline"></ion-icon>
<input name="search" type="text" placeholder="Search" style="margin-right:10px"
class="oh-input oh-input__icon mr-3" autocomplete="false" aria-label="Search Input"
onkeyup="$('.filterButton')[0].click()" />
</div>
<div class="oh-dropdown" x-data="{open: false}">
<button class="oh-btn ml-2" @click="open = !open" onclick="event.preventDefault()">
<ion-icon name="filter" class="mr-1"></ion-icon>{% trans "Filter" %}
<div id="filterCount"></div>
</button>
<div class="oh-dropdown__menu oh-dropdown__menu--right oh-dropdown__filter p-4" x-show="open"
@click.outside="open = false" style="display: none">
<div class="oh-dropdown__filter-body">
<div class="oh-accordion">
<div class="oh-accordion-header">{% trans "Disciplinary Action" %}</div>
<div class="oh-accordion-body">
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-12">
<div class="oh-input-group">
<label class="oh-label" for="{{f.form.employee_id.id_for_label}}">{% trans "Employee" %}</label>
{{f.form.employee_id}}
</div>
<div class="oh-input-group">
<label class="oh-label" for="{{f.form.action.id_for_label}}">{% trans "Action Taken" %}</label>
{{f.form.action}}
</div>
<div class="oh-input-group">
<label class="oh-label" for="{{f.form.start_date.id_for_label}}">{% trans "Date" %}</label>
{{f.form.start_date}}
<div class="oh-main__titlebar-button-container">
<div class="oh-input-group oh-input__search-group mr-4">
<ion-icon name="search-outline" class="oh-input-group__icon oh-input-group__icon--left md hydrated"
role="img" aria-label="search outline"></ion-icon>
<input name="search" type="text" placeholder="Search" style="margin-right:10px"
class="oh-input oh-input__icon mr-3" autocomplete="false" aria-label="Search Input"
onkeyup="$('.filterButton')[0].click()" />
</div>
<div class="oh-dropdown" x-data="{open: false}">
<button class="oh-btn ml-2" @click="open = !open" onclick="event.preventDefault()">
<ion-icon name="filter" class="mr-1"></ion-icon>{% trans "Filter" %}
<div id="filterCount"></div>
</button>
<div class="oh-dropdown__menu oh-dropdown__menu--right oh-dropdown__filter p-4" x-show="open"
@click.outside="open = false" style="display: none">
<div class="oh-dropdown__filter-body">
<div class="oh-accordion">
<div class="oh-accordion-header">{% trans "Disciplinary Action" %}</div>
<div class="oh-accordion-body">
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-12">
<div class="oh-input-group">
<label class="oh-label" for="{{f.form.employee_id.id_for_label}}">{% trans "Employee" %}</label>
{{f.form.employee_id}}
</div>
<div class="oh-input-group">
<label class="oh-label" for="{{f.form.action.id_for_label}}">{% trans "Action Taken" %}</label>
{{f.form.action}}
</div>
<div class="oh-input-group">
<label class="oh-label" for="{{f.form.start_date.id_for_label}}">{% trans "Date" %}</label>
{{f.form.start_date}}
</div>
</div>
</div>
</div>
</div>
</div>
<div class="oh-accordion">
<div class="oh-accordion-header">{% trans "Work Information" %}</div>
<div class="oh-accordion-body">
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group">
<label class="oh-label" for="{{f.form.employee_id__employee_work_info__company_id.id_for_label}}">{% trans "Company" %}</label>
{{f.form.employee_id__employee_work_info__company_id}}
<div class="oh-accordion">
<div class="oh-accordion-header">{% trans "Work Information" %}</div>
<div class="oh-accordion-body">
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group">
<label class="oh-label" for="{{f.form.employee_id__employee_work_info__company_id.id_for_label}}">{% trans "Company" %}</label>
{{f.form.employee_id__employee_work_info__company_id}}
</div>
<div class="oh-input-group">
<label class="oh-label" for="{{f.form.employee_id__employee_work_info__department_id.id_for_label}}">{% trans "Department" %}</label>
{{f.form.employee_id__employee_work_info__department_id}}
</div>
<div class="oh-input-group">
<label class="oh-label" for="{{f.form.employee_id__employee_work_info__shift_id.id_for_label}}">{% trans "Shift" %}</label>
{{f.form.employee_id__employee_work_info__shift_id}}
</div>
</div>
<div class="oh-input-group">
<label class="oh-label" for="{{f.form.employee_id__employee_work_info__department_id.id_for_label}}">{% trans "Department" %}</label>
{{f.form.employee_id__employee_work_info__department_id}}
</div>
<div class="oh-input-group">
<label class="oh-label" for="{{f.form.employee_id__employee_work_info__shift_id.id_for_label}}">{% trans "Shift" %}</label>
{{f.form.employee_id__employee_work_info__shift_id}}
</div>
</div>
<div class="col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group">
<label class="oh-label" for="{{f.form.employee_id__employee_work_info__reporting_manager_id.id_for_label}}">{% trans "Reporting Manager" %}</label>
{{f.form.employee_id__employee_work_info__reporting_manager_id}}
<div class="col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group">
<label class="oh-label" for="{{f.form.employee_id__employee_work_info__reporting_manager_id.id_for_label}}">{% trans "Reporting Manager" %}</label>
{{f.form.employee_id__employee_work_info__reporting_manager_id}}
</div>
<div class="oh-input-group">
<label class="oh-label" for="{{f.form.employee_id__employee_work_info__job_position_id.id_for_label}}">{% trans "Job Position" %}</label>
{{f.form.employee_id__employee_work_info__job_position_id}}
</div>
<div class="oh-input-group">
<label class="oh-label" for="{{f.form.employee_id__employee_work_info__work_type_id.id_for_label}}">{% trans "Work Type" %}</label>
{{f.form.employee_id__employee_work_info__work_type_id}}
</div>
</div>
<div class="oh-input-group">
<label class="oh-label" for="{{f.form.employee_id__employee_work_info__job_position_id.id_for_label}}">{% trans "Job Position" %}</label>
{{f.form.employee_id__employee_work_info__job_position_id}}
</div>
<div class="oh-input-group">
<label class="oh-label" for="{{f.form.employee_id__employee_work_info__work_type_id.id_for_label}}">{% trans "Work Type" %}</label>
{{f.form.employee_id__employee_work_info__work_type_id}}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="oh-dropdown__filter-footer">
<button class="oh-btn oh-btn--secondary oh-btn--small w-100 filterButton">
{% trans "Filter" %}
</button>
<div class="oh-dropdown__filter-footer">
<button class="oh-btn oh-btn--secondary oh-btn--small w-100 filterButton">
{% trans "Filter" %}
</button>
</div>
</div>
</div>
{% endif %}
{% if perms.employee.add_disciplinaryaction %}
<div class="oh-main__titlebar-button-container">
<a hx-get="{% url 'create-actions' %}" hx-target="#objectCreateModalTarget"
data-toggle="oh-modal-toggle" data-target="#objectCreateModal" class="oh-btn oh-btn--secondary">
<ion-icon name="add-outline"></ion-icon>
{% trans 'Take An Action' %}
</a>
</div>
{% endif %}
</div>
{% endif %}
<div class="oh-main__titlebar-button-container">
<a hx-get="{% url 'create-actions' %}" hx-target="#objectCreateModalTarget"
data-toggle="oh-modal-toggle" data-target="#objectCreateModal" class="oh-btn oh-btn--secondary">
<ion-icon name="add-outline"></ion-icon>
{% trans 'Take An Action' %}
</a>
</div>
</div>
{% endif %}
</div>
</form>
</section>
@@ -115,20 +116,20 @@
hx-target="#dynamicCreateModalBody">
</span>
{% if data %}
<div class="oh-wrapper" id="actionContainer">
{% include 'disciplinary_actions/disciplinary_records.html' %}
</div>
{% else %}
<main :class="sidebarOpen ? 'oh-main__sidebar-visible' : ''">
<div class="oh-wrapper">
<div class="oh-404">
<img style=" width: 150px;height: 150px;" src="{% static 'images/ui/legal.png' %}"
class="oh-404__image mb-4" alt="Page not found. 404." />
<h5 class="oh-404__subtitle">{% trans "There are currently no disciplinary actions to consider." %}</h5>
</div>
<div class="oh-wrapper" id="actionContainer">
{% include 'disciplinary_actions/disciplinary_records.html' %}
</div>
</main>
{% else %}
<main :class="sidebarOpen ? 'oh-main__sidebar-visible' : ''">
<div class="oh-wrapper">
<div class="oh-404">
<img style=" width: 150px;height: 150px;" src="{% static 'images/ui/legal.png' %}"
class="oh-404__image mb-4" alt="Page not found. 404." />
<h5 class="oh-404__subtitle">{% trans "There are currently no disciplinary actions to consider." %}</h5>
</div>
</div>
</main>
{% endif %}
<script>

View File

@@ -44,7 +44,7 @@
<div data-cell-index="2" data-cell-title='{% trans "Action Date" %}' class="oh-sticky-table__th">{% trans "Action Date" %}</div>
<div data-cell-index="3" data-cell-title='{% trans "Attachments" %}' class="oh-sticky-table__th">{% trans "Attachments" %}</div>
<div data-cell-index="4" data-cell-title='{% trans "Description" %}' class="oh-sticky-table__th">{% trans "Description" %}</div>
{% if perms.payroll.change_disciplinaryaction or perms.payroll.delete_disciplinaryaction %}
{% if perms.employee.change_disciplinaryaction or perms.employee.delete_disciplinaryaction or perms.employee.add_disciplinaryaction %}
<div class="oh-sticky-table__th">{% trans "Actions" %}</div>
{% endif %}
</div>
@@ -80,11 +80,13 @@
</div>
<span class="oh-profile__name oh-text--dark" title="{{emp}}">{{emp.get_full_name}}</span>
</div>
<a title="{% trans 'Remove' %}" hx-confirm="{% trans 'Are you sure want to remove this employee from this action?' %}"
hx-post="{% url 'remove-employee-disciplinary-action' i.id emp.id %}" hx-target="#actionContainer"
class="oh-user-panel__remove" >
<ion-icon name="close-outline"></ion-icon>
</a>
{% if perms.employee.change_disciplinaryaction %}
<a title="{% trans 'Remove' %}" hx-confirm="{% trans 'Are you sure want to remove this employee from this action?' %}"
hx-post="{% url 'remove-employee-disciplinary-action' i.id emp.id %}" hx-target="#actionContainer"
class="oh-user-panel__remove" >
<ion-icon name="close-outline"></ion-icon>
</a>
{% endif %}
</span>
{% endfor %}
</div>
@@ -131,17 +133,17 @@
{% endif %}
<div data-cell-index="4" class="oh-sticky-table__td">{{ i.description|truncatechars:25}}</div>
{% if perms.payroll.change_disciplinaryaction or perms.payroll.delete_disciplinaryaction %}
{% if perms.employee.change_disciplinaryaction or perms.employee.delete_disciplinaryaction or perms.employee.add_disciplinaryaction %}
<div class="oh-sticky-table__td">
<div class="oh-btn-group">
{% if perms.payroll.change_disciplinaryaction %}
{% if perms.employee.change_disciplinaryaction %}
<a hx-get="{% url 'update-actions' i.id %}" hx-target='#objectUpdateModalTarget'
data-toggle='oh-modal-toggle' data-target="#objectUpdateModal"
class="oh-btn oh-btn--light-bkg w-50" title="{% trans 'Edit' %}">
class="oh-btn oh-btn--light-bkg w-100" title="{% trans 'Edit' %}">
<ion-icon name="create-outline"></ion-icon></a>
{% endif %}
{% if perms.payroll.add_disciplinaryaction %}
<a class="oh-btn oh-btn--light-bkg w-50" data-toggle="oh-modal-toggle"
{% if perms.employee.add_disciplinaryaction %}
<a class="oh-btn oh-btn--light-bkg w-100" data-toggle="oh-modal-toggle"
data-target="#objectCreateModal"
hx-get="{% url 'duplicate-disciplinary-actions' i.id %}?{{pg}}"
title="{% trans 'Duplicate' %}" hx-target="#objectCreateModalTarget"
@@ -149,9 +151,9 @@
<ion-icon name="copy-outline"></ion-icon>
</a>
{% endif %}
{% if perms.payroll.delete_disciplinaryaction %}
{% if perms.employee.delete_disciplinaryaction %}
<form hx-confirm="{% trans 'Are you sure you want to delete this disciplinary action?' %}"
hx-post="{% url 'delete-actions' i.id %}" hx-target="#actionContainer" class="w-50">
hx-post="{% url 'delete-actions' i.id %}" hx-target="#actionContainer" class="w-100">
{% csrf_token %}
<button type='submit' class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100"
title="{% trans 'Remove' %}"><ion-icon name="trash-outline"></ion-icon></button>

View File

@@ -2,7 +2,7 @@
<form hx-post="{% url 'add-attachment-policy' %}?policy_id={{policy.id}}" hx-target="#attachmentContainer" class="add-files-form d-flex" method="post"
hx-encoding="multipart/form-data">
{% for attachment in policy.attachments.all %}
{% if perms.employee.delete_policy %}
{% if perms.employee.delete_policymultiplefile %}
<a href="{{ attachment.attachment.url }}" rel="noopener noreferrer" target="_blank"><span
class="oh-file-icon oh-file-icon--pdf" onmouseover="enlargeImage('{{ attachment.attachment.url }}')"
style="width:40px;height:40px"><img src="{% static '/images/ui/minus-icon.png' %}"
@@ -21,7 +21,7 @@
{% endif %}
{% endfor %}
{% if perms.employee.add_policy %}
{% if perms.employee.add_policymultiplefile %}
{% csrf_token %}
<input type="file" name="files" class="d-none" multiple="true" id="addFile_18" onchange="submitForm(this)" />
<input type="submit" class="d-none add_more_submit" value="save" />

View File

@@ -10,7 +10,7 @@
<input hx-get="{% url 'search-policies' %}" name="search" hx-trigger="keyup changed delay:.2s" hx-target="#policyContainer" type="text" placeholder="Search" style="margin-right:10px" class="oh-input oh-input__icon mr-3" autocomplete="false" aria-label="Search Input" />
</div>
{% include 'policies/filter.html' %}
{% if perms.payroll.add_policyaccount %}
{% if perms.employee.add_policy %}
<div class="oh-main__titlebar-button-container">
<div class="oh-main__titlebar-button-container">
<a hx-get="{% url 'create-policy' %}" hx-target="#objectCreateModalTarget" data-toggle="oh-modal-toggle" data-target="#objectCreateModal" class="oh-btn oh-btn--secondary">

View File

@@ -13,7 +13,7 @@
{% endif %}
{{ policy.title }}</span>
<div>
{% if perms.employee.change_policiy %}
{% if perms.employee.change_policy %}
<a hx-get="{% url 'create-policy' %}?instance_id={{ policy.id }}" hx-target="#objectCreateModalTarget" data-toggle="oh-modal-toggle" data-target="#objectCreateModal" title="Edit" style="cursor: pointer;"><ion-icon name="create-outline" role="img" class="md hydrated" aria-label="copy outline"></ion-icon></a>
{% endif %}
{% if perms.employee.delete_policy %}

View File

@@ -19,8 +19,7 @@
<div class="oh-modal__dialog-body">
<p class="oh-card__footer--border-top"></p>
{{ policy.body|safe }}
<div id="attachmentContainer" class="d-flex" hx-get="{% url 'get-attachments-policy' %}?policy_id={{ policy.id }}"
hx-trigger="load"></div>
<div id="attachmentContainer" class="d-flex" hx-get="{% url 'get-attachments-policy' %}?policy_id={{ policy.id }}" hx-trigger="load"></div>
<div id="enlargeImageContainer"></div>
</div>

View File

@@ -497,6 +497,11 @@ function handleDownloadAndRefresh(event, url) {
}, 500); // Adjust the delay as needed
}
function toggleCommentButton(e) {
const $button = $(e).closest('form').find('#commentButton');
$button.toggle($(e).val().trim() !== '');
}
function updateUserPanelCount(e) {
var count = $(e).closest('.oh-sticky-table__tr').find('.oh-user-panel').length;
setTimeout(() => {