[UPDT] EMPLOYEE: Validate attendance tab to attendance tab of employee individual view

This commit is contained in:
Horilla
2023-10-12 10:27:18 +05:30
parent e2bad1a07a
commit 4cd489c4e2
12 changed files with 435 additions and 162 deletions

View File

@@ -126,15 +126,17 @@
<ul
class="oh-general__tabs oh-general__tabs--border oh-general__tabs--profile oh-general__tabs--no-grow oh-profile-section__tab mt-5"
>
<li class="oh-general__tab">
<a
href="#"
class="oh-general__tab-link oh-general__tab-link--active"
data-action="general-tab"
data-target="#personal"
>{% trans "About" %}</a
>
</li>
<li class="oh-general__tab">
<a
hx-get={% url 'contract-tab' employee.id %}
hx-target="#personal_target"
class="oh-general__tab-link oh-general__tab-link--active"
data-action="general-tab"
role="button"
data-target="#personal_target"
>{% trans "About" %}</a
>
</li>
<li class="oh-general__tab">
<a
hx-get="{% url 'shift-tab' employee.id %}?profile=true"
@@ -222,9 +224,9 @@
<div
class="oh-general__tab-target oh-profile__info-tab mb-4"
id="personal"
id="personal_target"
>
{% include 'tabs/personal-tab.html' %}
</div>
<div

View File

@@ -142,10 +142,12 @@
>
<li class="oh-general__tab">
<a
href="#"
hx-get={% url 'contract-tab' employee.id %}
hx-target="#personal_target"
class="oh-general__tab-link oh-general__tab-link--active"
data-action="general-tab"
data-target="#personal"
role="button"
data-target="#personal_target"
>{% trans "About" %}</a
>
</li>
@@ -233,9 +235,9 @@
<div
class="oh-general__tab-target oh-profile__info-tab mb-4"
id="personal"
id="personal_target"
>
{% include 'tabs/personal-tab.html' %}
</div>

View File

@@ -1,16 +1,21 @@
{% load i18n %}
{% load basefilters %}
{% load attendancefilters %}
<div class="oh-wrapper mt-4">
<div class="oh-tabs">
<ul class="oh-tabs__tablist">
<li class="oh-tabs__tab oh-tabs__tab--active" data-target="#tab_1">
<li class="oh-tabs__tab oh-tabs__tab--active" data-target="#attendance_tab_1">
{% trans "Requested Attendances" %}
</li>
<li class="oh-tabs__tab" data-target="#tab_2">
<li class="oh-tabs__tab" data-target="#attendance_tab_3">
{% trans "Validate Attendance" %}
</li>
<li class="oh-tabs__tab" data-target="#attendance_tab_2">
{% trans "Hour Account" %}
</li>
</ul>
<div class="oh-tabs__contents" id="view-container">
<div class="oh-tabs__content oh-tabs__content--active" id="tab_1">
<div class="oh-tabs__content oh-tabs__content--active" id="attendance_tab_1">
<!-- Sticky Table -->
{% if requests %}
<div class="oh-sticky-table">
@@ -121,7 +126,7 @@
</div>
{% endif %}
</div>
<div class="oh-tabs__content" id="tab_2">
<div class="oh-tabs__content" id="attendance_tab_2">
{% if accounts %}
<div class="oh-sticky-table" id='ot-table'>
<div class="oh-sticky-table__table oh-table--sortable">
@@ -180,6 +185,123 @@
</div>
{% endif %}
</div>
<div class="oh-tabs__content" id="attendance_tab_3">
<div class="oh-sticky-table">
<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" >
<div class="d-flex">
<div class="">
<input type="checkbox" title='{% trans "Select All" %}' class="oh-input oh-input__checkbox mt-1 mr-2 validate" />
</div>
<div hx-get="{% url 'attendance-search' %}?{{pd}}&sortby=employee_id__employee_first_name" hx-target="#tab_contents">
{% trans "Employee" %}
</div>
</div>
</div>
<div class="oh-sticky-table__th" hx-get="{% url 'attendance-search' %}?{{pd}}&sortby=attendance_date" hx-target="#tab_contents">{% trans "Date" %}</div>
<div class="oh-sticky-table__th">{% trans "Day" %}</div>
<div class="oh-sticky-table__th" >{% trans "Check-In" %}</div>
<div class="oh-sticky-table__th" hx-get="{% url 'attendance-search' %}?{{pd}}&sortby=attendance_clock_in_date" hx-target="#tab_contents">{% trans "In Date" %}</div>
<div class="oh-sticky-table__th">{% trans "Check-Out" %}</div>
<div class="oh-sticky-table__th" hx-get="{% url 'attendance-search' %}?{{pd}}&sortby=attendance_clock_out_date" hx-target="#tab_contents">{% trans "Out Date" %}</div>
<div class="oh-sticky-table__th">{% trans "Shift" %}</div>
<div class="oh-sticky-table__th">{% trans "Work Type" %}</div>
<div class="oh-sticky-table__th" >{% trans "Min Hour" %}</div>
<div class="oh-sticky-table__th" hx-get="{% url 'attendance-search' %}?{{pd}}&sortby=at_work_second" hx-target="#tab_contents">{% trans "At Work" %}</div>
<div class="oh-sticky-table__th" hx-get="{% url 'attendance-search' %}?{{pd}}&sortby=overtime_second" hx-target="#tab_contents">{% trans "Overtime" %}</div>
<div class="oh-sticky-table__th"></div>
<div class="oh-sticky-table__th"></div>
</div>
</div>
{% for attendance in validate_attendances %}
<div class="oh-sticky-table__tbody">
<div class="oh-sticky-table__tr"
draggable="false">
<div class="oh-sticky-table__sd">
<div class="d-flex">
<div class="">
<input type="checkbox" id="{{attendance.id}}" class="oh-input attendance-checkbox oh-input__checkbox mt-2 mr-2 validate-row" />
</div>
<div class="oh-profile oh-profile--md">
<div class="oh-profile__avatar mr-1">
<img
src="https://ui-avatars.com/api/?name={{attendance.employee_id.employee_first_name}}+{{attendance.employee_id.employee_last_name}}&background=random"
class="oh-profile__image"
alt="Mary Magdalene"
/>
</div>
<span class="oh-profile__name oh-text--dark"
>{{attendance.employee_id}}</span
>
</div>
</div>
</div>
<div class="oh-sticky-table__td">
{{attendance.attendance_date}}
</div>
<div class="oh-sticky-table__td">
{{attendance.attendance_day.get_day_display }}
</div>
<div class="oh-sticky-table__td">
{{attendance.attendance_clock_in}}
</div>
<div class="oh-sticky-table__td">
{{attendance.attendance_clock_in_date}}
</div>
<div class="oh-sticky-table__td">
{{attendance.attendance_clock_out}}
</div>
<div class="oh-sticky-table__td">
{{attendance.attendance_clock_out_date}}
</div>
<div class="oh-sticky-table__td">{{attendance.shift_id}}</div>
<div class="oh-sticky-table__td">
{{attendance.work_type_id}}
</div>
<div class="oh-sticky-table__td">
{{attendance.minimum_hour}}
</div>
<div class="oh-sticky-table__td">
{{attendance.attendance_worked_hour}}
</div>
<div class="oh-sticky-table__td">
{{attendance.attendance_overtime}}
</div>
<div class="oh-sticky-table__td">
<div class="oh-btn-group">
{% if perms.attendance.change_attendance or request.user|is_reportingmanager %}
<a hx-get="{% url 'attendance-update' attendance.id %}" hx-target='#updateAttendanceRequestModalBody' hx-swap='innerHTML' data-toggle='oh-modal-toggle' data-target='#updateAttendanceRequest' class="oh-btn oh-btn--light-bkg w-50" title="{% trans 'Edit' %}"><ion-icon name="create-outline"></ion-icon></a>
{% endif %}
{% if perms.attendance.delete_attendance %}
<form action="{% url 'attendance-delete' attendance.id %}" onsubmit="return confirm('{% trans "Are you sure want to delete this attendance?" %}')" hx-target="#tab_contents" method='post' class='w-50'>
{% 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>
</form>
{% endif %}
</div>
</div>
<div class="oh-sticky-table__td">
{% if request.user|is_reportingmanager or perms.attendance.change_attendance %}
<a
href = '{% url "validate-this-attendance" attendance.id %}'
hx-target='#updateAttendanceBody'
class="oh-btn oh-btn--info">
{% trans "Validate" %}
</a>
{% endif %}
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,81 @@
{% load onboardingfilters %} {% load i18n %}
<style>
.height-adj{
height:420px;
overflow-y:auto
}
</style>
{% if contracts %}
<div class="oh-sticky-table height-adj">
<div class="oh-sticky-table__table">
<div class="oh-sticky-table__thead">
<div class="oh-sticky-table__tr">
<div class="oh-sticky-table__th">{% trans "Contract" %}</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 "Wage Type" %}</div>
<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>
</div>
</div>
<div class="oh-sticky-table__tbody">
{% for contract in contracts %}
<div class="oh-sticky-table__tr" draggable="true" data-toggle="oh-modal-toggle" data-target = "#ContractModal" hx-get="{% url 'single-contract-view' contract.id %}" hx-target = "#OneContractTarget">
<div class="oh-sticky-table__sd {% if contract.contract_status == "active" %} row-status--yellow {% elif contract.contract_status == 'draft' %} row-status--purple {% elif contract.contract_status == 'expired' %} row-status--red {% elif contract.contract_status == 'terminated' %} row-status--black {% endif %}">{{ contract.contract_name }}</div>
<div class="oh-sticky-table__td">{{ contract.contract_start_date}}</div>
<div class="oh-sticky-table__td">
{% if contract.contract_end_date %}{{ contract.contract_end_date}}{% endif %}
</div>
<div class="oh-sticky-table__td">
{{ contract.get_wage_type_display}}
</div>
<div class="oh-sticky-table__td">{{ contract.wage}}</div>
<div class="oh-sticky-table__td">{{ contract.filing_status}}</div>
<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>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
{% else %}
<div class="d-flex justify-content-center align-items-center" style="height:40vh">
<h5 class="oh-404__subtitle">{% trans "There are no contracts at the moment." %}</h5>
</div>
{% endif %}

View File

@@ -133,128 +133,153 @@
</div>
<div class="col-sm-12 col-md-12 col-lg-8">
<div class="oh-card oh-card--margin">
<div class="oh-card__header">
<span class="oh-card__title oh-card__title--sm fw-bold me-2"
>{% trans "Work Information" %}</span
>
</div>
<div class="oh-card__body mt-4">
<div class="row">
<div class="col-12 col-sm-12 col-md-12 col-lg-6">
<ul class="oh-profile__card-info-list">
<li class="oh-profile__card-info-item">
<span class="oh-profile__info-label mb-1">
<ion-icon name="construct-outline"></ion-icon>
<span>{% trans "Department" %}</span>
</span>
<span class="oh-profile__info-value"
>{{employee.employee_work_info.department_id}}</span
>
</li>
<li class="oh-profile__card-info-item">
<span class="oh-profile__info-label mb-1">
<ion-icon name="time-outline"></ion-icon>
<span>{% trans "Shift Information" %}</span>
</span>
<span class="oh-profile__info-value"
>{{employee.employee_work_info.shift_id}}</span
>
</li>
<li class="oh-profile__card-info-item">
<span class="oh-profile__info-label mb-1">
<ion-icon name="briefcase-outline"></ion-icon>
<span>{% trans "Employee Type" %}</span>
</span>
<span class="oh-profile__info-value"
>{{employee.employee_work_info.employee_type_id}}</span
>
</li>
<div class="oh-tabs">
<ul class="oh-tabs__tablist">
<li class="oh-tabs__tab oh-tabs__tab--active" data-target="#tab_1">
{% trans "Work Information" %}
</li>
<li class="oh-tabs__tab" data-target="#tab_2">
{% trans "Contract details" %}
</li>
</ul>
<div class="oh-tabs__contents" id="view-container">
<div class="oh-tabs__content oh-tabs__content--active" id="tab_1">
<li class="oh-profile__card-info-item">
<span class="oh-profile__info-label mb-1">
<ion-icon name="person-circle-outline"></ion-icon>
<span>{% trans "Reporting Manager" %}</span>
</span>
<span class="oh-profile__info-value"
>{{employee.employee_work_info.reporting_manager_id}}</span
>
</li>
<li class="oh-profile__card-info-item">
<span class="oh-profile__info-label mb-1">
<ion-icon name="business-outline"></ion-icon>
<span>{% trans "Work Location" %}</span>
</span>
<span class="oh-profile__info-value"
>{{employee.employee_work_info.location}}</span
>
</li>
<li class="oh-profile__card-info-item">
<span class="oh-profile__info-label mb-1">
<ion-icon name="calendar-outline"></ion-icon>
<span>{% trans "End Date" %}</span>
</span>
<span class="oh-profile__info-value"
>{{employee.employee_work_info.contract_end_date}}</span
>
</li>
</ul>
<div class="oh-card__header">
<span class="oh-card__title oh-card__title--sm fw-bold me-2"
>{% trans "Work Information" %}</span
>
</div>
<div class="col-12 col-sm-12 col-md-12 col-lg-6">
<ul class="oh-profile__card-info-list">
<li class="oh-profile__card-info-item">
<span class="oh-profile__info-label mb-1">
<ion-icon name="briefcase-outline"></ion-icon>
<span>{% trans "Job Position" %}</span>
</span>
<span class="oh-profile__info-value"
>{{employee.employee_work_info.job_position_id}}</span
>
</li>
<li class="oh-profile__card-info-item">
<span class="oh-profile__info-label mb-1">
<ion-icon name="time-outline"></ion-icon>
<span>{% trans "Work Type" %}</span>
</span>
<span class="oh-profile__info-value"
>{{employee.employee_work_info.work_type_id}}</span
>
</li>
<li class="oh-profile__card-info-item">
<span class="oh-profile__info-label mb-1">
<ion-icon name="cash-outline"></ion-icon>
<span>{% trans "Salary" %}</span>
</span>
<span class="oh-profile__info-value"
>{{employee.employee_work_info.basic_salary}}</span
>
</li>
<li class="oh-profile__card-info-item">
<span class="oh-profile__info-label mb-1">
<ion-icon name="business-outline"></ion-icon>
<span>{% trans "Company" %}</span>
</span>
<span class="oh-profile__info-value"
>{{employee.employee_work_info.company_id}}</span
>
</li>
<li class="oh-profile__card-info-item">
<span class="oh-profile__info-label mb-1">
<ion-icon name="calendar-outline"></ion-icon>
<span>{% trans "Start Date" %}</span>
</span>
<span class="oh-profile__info-value"
>{{employee.employee_work_info.date_joining}}</span
>
</li>
</ul>
<div class="oh-card__body mt-4">
<div class="row">
<div class="col-12 col-sm-12 col-md-12 col-lg-6">
<ul class="oh-profile__card-info-list">
<li class="oh-profile__card-info-item">
<span class="oh-profile__info-label mb-1">
<ion-icon name="construct-outline"></ion-icon>
<span>{% trans "Department" %}</span>
</span>
<span class="oh-profile__info-value"
>{{employee.employee_work_info.department_id}}</span
>
</li>
<li class="oh-profile__card-info-item">
<span class="oh-profile__info-label mb-1">
<ion-icon name="time-outline"></ion-icon>
<span>{% trans "Shift Information" %}</span>
</span>
<span class="oh-profile__info-value"
>{{employee.employee_work_info.shift_id}}</span
>
</li>
<li class="oh-profile__card-info-item">
<span class="oh-profile__info-label mb-1">
<ion-icon name="briefcase-outline"></ion-icon>
<span>{% trans "Employee Type" %}</span>
</span>
<span class="oh-profile__info-value"
>{{employee.employee_work_info.employee_type_id}}</span
>
</li>
<li class="oh-profile__card-info-item">
<span class="oh-profile__info-label mb-1">
<ion-icon name="person-circle-outline"></ion-icon>
<span>{% trans "Reporting Manager" %}</span>
</span>
<span class="oh-profile__info-value"
>{{employee.employee_work_info.reporting_manager_id}}</span
>
</li>
<li class="oh-profile__card-info-item">
<span class="oh-profile__info-label mb-1">
<ion-icon name="business-outline"></ion-icon>
<span>{% trans "Work Location" %}</span>
</span>
<span class="oh-profile__info-value"
>{{employee.employee_work_info.location}}</span
>
</li>
<li class="oh-profile__card-info-item">
<span class="oh-profile__info-label mb-1">
<ion-icon name="calendar-outline"></ion-icon>
<span>{% trans "End Date" %}</span>
</span>
<span class="oh-profile__info-value"
>{{employee.employee_work_info.contract_end_date}}</span
>
</li>
</ul>
</div>
<div class="col-12 col-sm-12 col-md-12 col-lg-6">
<ul class="oh-profile__card-info-list">
<li class="oh-profile__card-info-item">
<span class="oh-profile__info-label mb-1">
<ion-icon name="briefcase-outline"></ion-icon>
<span>{% trans "Job Position" %}</span>
</span>
<span class="oh-profile__info-value"
>{{employee.employee_work_info.job_position_id}}</span
>
</li>
<li class="oh-profile__card-info-item">
<span class="oh-profile__info-label mb-1">
<ion-icon name="time-outline"></ion-icon>
<span>{% trans "Work Type" %}</span>
</span>
<span class="oh-profile__info-value"
>{{employee.employee_work_info.work_type_id}}</span
>
</li>
<li class="oh-profile__card-info-item">
<span class="oh-profile__info-label mb-1">
<ion-icon name="cash-outline"></ion-icon>
<span>{% trans "Salary" %}</span>
</span>
<span class="oh-profile__info-value"
>{{employee.employee_work_info.basic_salary}}</span
>
</li>
<li class="oh-profile__card-info-item">
<span class="oh-profile__info-label mb-1">
<ion-icon name="business-outline"></ion-icon>
<span>{% trans "Company" %}</span>
</span>
<span class="oh-profile__info-value"
>{{employee.employee_work_info.company_id}}</span
>
</li>
<li class="oh-profile__card-info-item">
<span class="oh-profile__info-label mb-1">
<ion-icon name="calendar-outline"></ion-icon>
<span>{% trans "Start Date" %}</span>
</span>
<span class="oh-profile__info-value"
>{{employee.employee_work_info.date_joining}}</span
>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="oh-tabs__content" id="tab_2">
{% include "tabs/contract-tab.html" %}
<div class="oh-modal" id="ContractModal" role="dialog" aria-labelledby="ContractModal" aria-hidden="true">
<div class="oh-modal__dialog" style="max-width: 550px" id="OneContractTarget"></div>
</div>
</div>
</div>
</div>
</div>
<div class="oh-card oh-card--margin">
<div class="oh-card__header">
<span class="oh-card__title oh-card__title--sm fw-bold me-2"
@@ -340,4 +365,18 @@
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function () {
$(".oh-tabs__tab[data-target]").click(function (e) {
e.preventDefault();
var newActiveTab = $(this).attr('data-target')
$(".oh-tabs__content--active").toggleClass('oh-tabs__content--active');
$(".oh-tabs__tab--active").toggleClass('oh-tabs__tab--active');
$(`[data-target="${newActiveTab}"]`).toggleClass("oh-tabs__tab--active");
$(newActiveTab).toggleClass("oh-tabs__content--active");
});
});
</script>

View File

@@ -1,24 +1,37 @@
{% load i18n %}
{% load static %}
{% load basefilters %}
{% load attendancefilters %}
<div class="oh-wrapper mt-4">
<div class="oh-tabs">
<ul class="oh-tabs__tablist">
<li class="oh-tabs__tab oh-tabs__tab--active" data-target="#tab_1">
{% trans "Work type request" %}
<li class="oh-tabs__tab oh-tabs__tab--active" data-target="#shift_tab_1">
<div>
<img src="{% static 'images/ui/work-from-home (1).png' %}" alt="" style="width: 25px; height: 25px; margin-right:3px">
{% trans "Work type request" %}
</div>
</li>
<li class="oh-tabs__tab" data-target="#tab_3">
{% trans "Rotating Work type" %}
<li class="oh-tabs__tab" data-target="#shift_tab_3">
<div>
<img src="{% static 'images/ui/work-from-home.png' %}" alt="" style="width: 25px; height: 25px; margin-right:3px">
{% trans "Rotating work type" %}
</div>
</li>
<li class="oh-tabs__tab oh-tabs__tab" data-target="#tab_4">
{% trans "Shift request" %}
<li class="oh-tabs__tab" data-target="#shift_tab_4">
<div>
<img src="{% static 'images/ui/time-management.png' %}" alt="" style="width: 25px; height: 25px; margin-right:3px">
{% trans "Shift request" %}
</div>
</li>
<li class="oh-tabs__tab" data-target="#tab_2">
{% trans "Rotating Shift" %}
<li class="oh-tabs__tab" data-target="#shift_tab_2">
<div>
<img src="{% static 'images/ui/shift.png' %}" alt="" style="width: 25px; height: 25px; margin-right:3px">
{% trans "Rotating Shift" %}
</div>
</li>
</ul>
<div class="oh-tabs__contents" id="view-container">
<div class="oh-tabs__content oh-tabs__content--active" id="tab_1">
<div class="oh-tabs__content oh-tabs__content--active" id="shift_tab_1">
<!-- Sticky Table -->
{% if work_data %}
<div class="oh-sticky-table">
@@ -116,7 +129,7 @@
</div>
{% endif %}
</div>
<div class="oh-tabs__content" id="tab_2">
<div class="oh-tabs__content" id="shift_tab_2">
{% if rshift_assign %}
<div class="oh-sticky-table">
<div class="oh-sticky-table__table oh-table--sortable">
@@ -238,7 +251,7 @@
</div>
{% endif %}
</div>
<div class="oh-tabs__content" id="tab_3">
<div class="oh-tabs__content" id="shift_tab_3">
{% if rwork_type_assign %}
<div class="oh-sticky-table">
<div class="oh-sticky-table__table oh-table--sortable">
@@ -362,7 +375,7 @@
{% endif %}
</div>
</div>
<div class="oh-tabs__content" id="tab_4">
<div class="oh-tabs__content" id="shift_tab_4">
{% if shift_data %}
<div class="oh-sticky-table">
<div class="oh-sticky-table__table oh-table--sortable">
@@ -499,7 +512,6 @@
id="rotatingWorkTypeAssignUpdateModalLabel"
></div>
<script>
$(document).ready(function () {
$(".oh-tabs__tab[data-target]").click(function (e) {

View File

@@ -162,4 +162,5 @@ urlpatterns = [
path("performance-tab/<int:emp_id>", views.performance_tab, name="performance-tab"),
path("attendance-tab/<int:emp_id>", views.attendance_tab, name="attendance-tab"),
path("shift-tab/<int:emp_id>", views.shift_tab, name="shift-tab"),
path("contract-tab/<int:obj_id>", views.contract_tab, name="contract-tab"),
]

View File

@@ -67,6 +67,7 @@ from employee.forms import (
excel_columns,
)
from employee.models import Employee, EmployeeWorkInformation, EmployeeBankDetails
from payroll.models.models import Contract
from pms.models import Feedback
from recruitment.models import Candidate
@@ -148,6 +149,25 @@ def employee_view_individual(request, obj_id):
request.META.get("HTTP_REFERER", "/employee/employee-view")
)
@login_required
@manager_can_enter("employee.view_employee")
def contract_tab(request, obj_id):
"""
This method is used to view profile of an employee.
"""
employee = Employee.objects.get(id=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")
)
@login_required
def asset_tab(request, emp_id):
assets_requests = AssetRequest.objects.filter(requested_employee_id=emp_id,asset_request_status="Requested")
@@ -195,16 +215,6 @@ def profile_attendance_tab(request):
}
return render(request,"tabs/profile-attendance-tab.html",context)
@login_required
def profile_attendance_tab(request):
user = request.user
employee = user.employee_get
employee_attendances = employee.employee_attendances.all()
context={
"attendances":employee_attendances,
}
return render(request,"tabs/profile-attendance-tab.html",context)
@login_required
@manager_can_enter("employee.view_employee")
def attendance_tab(request, emp_id):
@@ -212,11 +222,13 @@ def attendance_tab(request, emp_id):
requests = Attendance.objects.filter(
is_validate_request=True,employee_id=emp_id,
)
validate_attendances = Attendance.objects.filter(attendance_validated=False,employee_id=emp_id)
accounts = AttendanceOverTime.objects.filter(employee_id=emp_id)
context={
"requests":requests,
"accounts":accounts,
"validate_attendances":validate_attendances,
}
return render(request,"tabs/attendance-tab.html",context=context)
@@ -300,13 +312,14 @@ def employee_view(request):
"""
view_type = request.GET.get("view")
previous_data = request.GET.urlencode()
employees = Employee.objects.filter(is_active=True)
page_number = request.GET.get("page")
filter_obj = EmployeeFilter(queryset=employees)
filter_obj = EmployeeFilter(request.GET,queryset=Employee.objects.filter(is_active=True))
export_form = EmployeeExportExcelForm()
employees = filtersubordinatesemployeemodel(
request, filter_obj.qs, "employee.view_employee"
)
data_dict = parse_qs(previous_data)
get_key_instances(Employee, data_dict)
return render(
request,
"employee_personal_info/employee_view.html",
@@ -317,6 +330,8 @@ def employee_view(request):
"export_filter": EmployeeFilter(queryset=employees),
"export_form": export_form,
"view_type": view_type,
"filter_dict": data_dict,
},
)
@@ -1507,9 +1522,8 @@ def dashboard_employee_department(_):
labels = []
count = []
departments = Department.objects.all()
for i in departments:
labels.append(i.department)
for dept in departments:
labels.append(dept.department)
count.append(
len(
Employee.objects.filter(

BIN
static/images/ui/shift.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB