[UPDT] PAYROLL: Owner access to contract

This commit is contained in:
Horilla
2024-04-03 10:51:13 +05:30
parent d4734ba67f
commit f718914224
2 changed files with 31 additions and 27 deletions

View File

@@ -145,32 +145,36 @@
<span class="oh-timeoff-modal__stat-count">{{contract.get_contract_status_display}}</span>
</div>
</div>
{% if dashboard != "dashboard" %}
<div class="oh-modal__button-container text-center">
<div class="oh-btn-group">
<a href="{% url 'update-contract' contract.id %}" class="oh-btn oh-btn--info" style="width: 50%;">
<ion-icon
name="create-outline"
role="img"
class="md hydrated"
aria-label="create outline"
></ion-icon>{% trans "Edit" %}
</a>
<a
class="oh-btn oh-btn--danger"style="width: 50%;"
hx-confirm="{% trans 'Do you want to delete this Contract?' %}"
hx-post="{% url 'delete-contract-modal' contract.id %}?{{pd}}"
hx-target="{{delete_hx_target}}"
>
<ion-icon
name="trash-outline"
role="img"
class="md hydrated"
aria-label="create outline"
></ion-icon>{% trans "Delete" %}
</a>
{% if dashboard != "dashboard" and perms.payroll.delete_contract or perms.payroll.change_contract %}
<div class="oh-modal__button-container text-center">
<div class="oh-btn-group">
{% if perms.payroll.change_contract %}
<a href="{% url 'update-contract' contract.id %}" class="oh-btn oh-btn--info" style="width: 50%;">
<ion-icon
name="create-outline"
role="img"
class="md hydrated"
aria-label="create outline"
></ion-icon>{% trans "Edit" %}
</a>
{% endif %}
{% if perms.payroll.delete_contract %}
<a
class="oh-btn oh-btn--danger"style="width: 50%;"
hx-confirm="{% trans 'Do you want to delete this Contract?' %}"
hx-post="{% url 'delete-contract-modal' contract.id %}?{{pd}}"
hx-target="{{delete_hx_target}}"
>
<ion-icon
name="trash-outline"
role="img"
class="md hydrated"
aria-label="create outline"
></ion-icon>{% trans "Delete" %}
</a>
{% endif %}
</div>
</div>
</div>
{% endif %}
</div>
</div>

View File

@@ -18,7 +18,7 @@ from django.db.models import Q, ProtectedError
from attendance.methods.group_by import group_by_queryset
from notifications.signals import notify
from base.models import Company
from horilla.decorators import login_required, permission_required
from horilla.decorators import login_required, owner_can_enter, permission_required
from base.methods import export_data, generate_colors, get_key_instances, sortby
from employee.models import Employee, EmployeeWorkInformation
from base.methods import closest_numbers
@@ -256,7 +256,7 @@ def contract_view(request):
@login_required
@permission_required("payroll.view_contract")
@owner_can_enter("payroll.view_contract", Contract)
def view_single_contract(request, contract_id):
"""
Renders a single contract view page.