[FIX] EMPLOYEE: Employee profile tab permission for employees
This commit is contained in:
@@ -18,7 +18,9 @@
|
||||
<div class="oh-sticky-table__th">{% trans "Basic Salary" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Filing Status" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Status" %}</div>
|
||||
<div class="oh-sticky-table__th oh-sticky-table__right"></div>
|
||||
{% if perms.leave.change_contract %}
|
||||
<div class="oh-sticky-table__th oh-sticky-table__right"></div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__tbody">
|
||||
@@ -38,37 +40,39 @@
|
||||
<div class="oh-sticky-table__td">
|
||||
{{ contract.get_contract_status_display}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td oh-sticky-table__right">
|
||||
<div class="oh-btn-group">
|
||||
<a
|
||||
onclick="event.stopPropagation()"
|
||||
class="oh-btn oh-btn--light-bkg w-100"
|
||||
href="{% url 'update-contract' contract.id %}"
|
||||
title='{% trans "Update" %}'
|
||||
>
|
||||
<ion-icon
|
||||
name="create-outline"
|
||||
role="img"
|
||||
class="md hydrated"
|
||||
style="color: blue"
|
||||
aria-label="create outline"
|
||||
></ion-icon>
|
||||
</a>
|
||||
<a
|
||||
onclick = "event.preventDefault();event.stopPropagation(); confirm(`{% trans 'Do you want to delete this Contract?' %}`)"
|
||||
class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100"
|
||||
href="{% url 'delete-contract' contract.id %}"
|
||||
title='{% trans "Delete" %}'
|
||||
>
|
||||
<ion-icon
|
||||
name="trash-outline"
|
||||
role="img"
|
||||
class="md hydrated"
|
||||
aria-label="trash outline"
|
||||
></ion-icon>
|
||||
</a>
|
||||
{% if perms.leave.change_contract %}
|
||||
<div class="oh-sticky-table__td oh-sticky-table__right">
|
||||
<div class="oh-btn-group">
|
||||
<a
|
||||
onclick="event.stopPropagation()"
|
||||
class="oh-btn oh-btn--light-bkg w-100"
|
||||
href="{% url 'update-contract' contract.id %}"
|
||||
title='{% trans "Update" %}'
|
||||
>
|
||||
<ion-icon
|
||||
name="create-outline"
|
||||
role="img"
|
||||
class="md hydrated"
|
||||
style="color: blue"
|
||||
aria-label="create outline"
|
||||
></ion-icon>
|
||||
</a>
|
||||
<a
|
||||
onclick = "event.preventDefault();event.stopPropagation(); confirm(`{% trans 'Do you want to delete this Contract?' %}`)"
|
||||
class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100"
|
||||
href="{% url 'delete-contract' contract.id %}"
|
||||
title='{% trans "Delete" %}'
|
||||
>
|
||||
<ion-icon
|
||||
name="trash-outline"
|
||||
role="img"
|
||||
class="md hydrated"
|
||||
aria-label="trash outline"
|
||||
></ion-icon>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
@@ -270,7 +270,7 @@
|
||||
</div>
|
||||
<div class="oh-tabs__content" id="tab_2">
|
||||
{% include "tabs/contract-tab.html" %}
|
||||
|
||||
{% if perms.leave.view_contract %}
|
||||
<div
|
||||
class="oh-modal"
|
||||
id="ContractModal"
|
||||
@@ -284,6 +284,7 @@
|
||||
id="OneContractTarget"
|
||||
></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -151,7 +151,6 @@ def employee_view_individual(request, obj_id):
|
||||
|
||||
|
||||
@login_required
|
||||
@manager_can_enter("employee.view_employee")
|
||||
def contract_tab(request, obj_id):
|
||||
"""
|
||||
This method is used to view profile of an employee.
|
||||
@@ -160,13 +159,8 @@ def contract_tab(request, obj_id):
|
||||
employee_leaves = employee.available_leave.all()
|
||||
user = Employee.objects.filter(employee_user_id=request.user).first()
|
||||
contracts = Contract.objects.filter(employee_id=obj_id)
|
||||
if user.reporting_manager.filter(
|
||||
employee_id=employee
|
||||
).exists() or request.user.has_perm("employee.change_employee"):
|
||||
return render(request, "tabs/personal-tab.html", {"employee": employee,"employee_leaves":employee_leaves,"contracts":contracts,})
|
||||
return HttpResponseRedirect(
|
||||
request.META.get("HTTP_REFERER", "/employee/employee-view")
|
||||
)
|
||||
return render(request, "tabs/personal-tab.html", {"employee": employee,"employee_leaves":employee_leaves,"contracts":contracts,})
|
||||
|
||||
|
||||
@login_required
|
||||
def asset_tab(request, emp_id):
|
||||
|
||||
Reference in New Issue
Block a user