[ADD]leave tab on employee individual views

This commit is contained in:
Horilla
2023-09-05 12:29:06 +05:30
parent 7af4618eae
commit d3afa9fcfa
3 changed files with 57 additions and 5 deletions

View File

@@ -5,8 +5,7 @@
<div class="oh-card mt-4 mb-5">
<div class="d-flex flex-row-reverse " >
<a href="{% url 'edit-profile' %}" class="">
<ion-icon name="pencil" ></ion-icon>
</a>
<img src="/static/images/ui/edit_btn.png" style="width: 25px; height: auto;" title="Edit"> </a>
</div>
<div class="row">
<div class="col-12 col-sm-12 col-md-12 col-lg-4">
@@ -485,7 +484,7 @@
class="oh-general__tab-target oh-profile__info-tab mb-4 d-none"
id="leave"
>
<!-- #2 -->
{% include 'leave-tab.html' %}
</div>
<div
class="oh-general__tab-target oh-profile__info-tab mb-4 d-none"

View File

@@ -484,12 +484,11 @@
</div>
</div>
<div
class="oh-general__tab-target oh-profile__info-tab mb-4 d-none"
id="leave"
>
<!-- #2 -->
{% include "leave-tab.html" %}
</div>
<div
class="oh-general__tab-target oh-profile__info-tab mb-4 d-none"

View File

@@ -0,0 +1,54 @@
{% load i18n %}
<style>
.row-status--orange {
border-left: 4px solid orange;
border-radius: 5px;
}
.row-status--gray {
border-left: 4px solid gray;
border-radius: 5px;
}
.row-status--yellow {
border-left: 4px solid yellowgreen;
border-radius: 5px;
}
</style>
<div class="oh-sticky-table mt-4">
<div class="oh-sticky-table__table oh-table--sortable">
<div class="oh-sticky-table__thead">
<div class="oh-sticky-table__tr">
<div class="oh-sticky-table__th">{% trans "Leave Type" %}</div>
<div class="oh-sticky-table__th">{% trans "Start Date" %}</div>
<div class="oh-sticky-table__th">{% trans "End Date" %}</div>
<div class="oh-sticky-table__th">{% trans "Requested days" %}</div>
<div class="oh-sticky-table__th">{% trans "Status" %}</div>
</div>
</div>
<div class="oh-sticky-table__tbody">
{% for leave_request in employee.leaverequest_set.all %}
<div class="oh-sticky-table__tr" draggable="true">
<div class="oh-sticky-table__sd {% if leave_request.status == "requested" %}row-status--orange {% elif leave_request.status == "cancelled" %} row-status--gray {% elif leave_request.status == "approved" %} row-status--yellow{% endif %}" data-toggle="oh-modal-toggle" data-target="#tableTimeOff"
hx-get="{% url 'user-request-one' leave_request.id %}" hx-target="#userRequestView">
<div class="oh-profile oh-profile--md">
<div class="oh-profile__avatar mr-1">
{% if leave_request.leave_type_id.icon %}
<img src="{{leave_request.leave_type_id.icon.url}}" class="oh-profile__image"
alt="Leave Type Icon" />
{% else%}
<img src="https://ui-avatars.com/api/?name={{leave_request.leave_type_id}}&background=random"
class="oh-profile__image" alt="Leave type icon" />
{% endif %}
</div>
<span class="oh-profile__name oh-text--dark">{{leave_request.leave_type_id}}</span>
</div>
</div>
<div class="oh-sticky-table__td">{{leave_request.start_date}}</div>
<div class="oh-sticky-table__td">{{leave_request.end_date}}</div>
<div class="oh-sticky-table__td">{{leave_request.requested_days}}</div>
<div class="oh-sticky-table__td">{{leave_request.get_status_display}}</div>
</div>
{% endfor %}
</div>
</div>
</div>