[UPDT] PAYROLL: Card and list view for loan, advance salary and fine individual tabs

This commit is contained in:
Horilla
2024-02-29 18:36:14 +05:30
parent 60ca0b968a
commit 276cf4c3f8
8 changed files with 1389 additions and 78 deletions

View File

@@ -4,12 +4,37 @@
<h1 class="oh-main__titlebar-title fw-bold">{% trans 'Loan / Advanced Salary' %}</h1>
</div>
<form hx-get="{% url 'search-loan' %}" hx-target="#loanContainer">
<form hx-get="{% url 'search-loan' %}" hx-target="#loanContainer" onsubmit="event.stopPropagation()">
<div class="oh-main__titlebar oh-main__titlebar--right oh-d-flex-column--resp oh-mb-3--small">
<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 type="text" id="pipelineSearch" placeholder="Search" style="margin-right:10px" onkeyup="$('.filterButton').click()" name="search" class="oh-input oh-input__icon mr-3" aria-label="Search Input" />
</div>
<input type="hidden" name="view" value="{{request.GET.view}}" id="loanViewType">
<ul class="oh-view-types ml-2" style="margin-bottom: 0">
<li class="oh-view-type employee-view-type" data-view="list">
<a
id="list"
onclick="$('#loanViewType').val('list');setTimeout(() => {
$('.filterButton')[0].click();
}, 10);$('.oh-btn--view-active').removeClass('oh-btn--view-active'); $(this).addClass('oh-btn--view-active'); "
class="oh-btn oh-btn--view {% if request.GET.view == 'list' %} oh-btn--view-active {% endif %}"
title='{% trans "List" %}'
><ion-icon name="list-outline"></ion-icon
></a>
</li>
<li class="oh-view-type employee-view-type" data-view="card">
<a
id="card"
onclick="$('#loanViewType').val('card');setTimeout(() => {
$('.filterButton')[0].click();
}, 10);$('.oh-btn--view-active').removeClass('oh-btn--view-active'); $(this).addClass('oh-btn--view-active');"
class="oh-btn oh-btn--view {% if request.GET.view != 'list' %} oh-btn--view-active {% endif %}"
title='{% trans "Card" %}'
><ion-icon name="grid-outline"></ion-icon
></a>
</li>
</ul>
{% include 'payroll/loan/filter.html' %}
{% if perms.payroll.add_loanaccount %}
<div class="oh-main__titlebar-button-container">

View File

@@ -0,0 +1,373 @@
{% load i18n %} {% load static %}{% include "filter_tags.html" %}
<div class="oh-tabs oh-wrapper">
<ul class="oh-tabs__tablist">
<li class="oh-tabs__tab" data-target="#reimbursement_tab">
{% trans "Loan" %}
</li>
<!-- normal user can't view all objective -->
<li class="oh-tabs__tab" data-target="#leave_encashment_tab">
{% trans "Advanced Salary" %}
</li>
<li class="oh-tabs__tab" data-target="#bonus_encashment_tab">
{% trans "Fine" %}
</li>
</ul>
<div>
<div class="oh-tabs__contents">
<!-- Loan-->
<div class="oh-tabs__content" id="reimbursement_tab">
{% if loan %}
<div class="oh-wrapper oh-faq-cards" >
{% for record in loan %}
<div class="oh-faq-card" >
<div class="d-flex justify-content-between">
<div class="loan-type">{{ record.get_type_display }}</div>
<div>
{% if perms.payroll.change_loanaccount or request.user %}
<a class="mr-2" hx-get="{% url 'create-loan' %}?instance_id={{ record.id }}" hx-target="#loanModalBody" data-toggle="oh-modal-toggle" data-target="#loanModal" title='{% trans "Edit" %}'><ion-icon class="text-dark" name="create-outline"></ion-icon></a>
{% endif %}
{% if perms.payroll.delete_loanaccount %}
<a href="{% url 'delete-loan' %}?ids={{ record.id }}" onclick="return confirm('Do you want to delete this record?')" title='{% trans "Delete" %}'><ion-icon class="text-danger" name="trash-outline"></ion-icon></a>
{% endif %}
</div>
</div>
<div class="oh-timeoff-modal__profile-content">
<div class="oh-profile mb-2">
<div class="oh-profile__avatar">
<img src="{{ record.employee_id.get_avatar }}" class="oh-profile__image me-2" alt="Mary Magdalene" />
</div>
<div class="oh-timeoff-modal__profile-info">
<span class="oh-timeoff-modal__user m-0 fw-bold">{{ record.employee_id }}</span>
<span class="oh-timeoff-modal__user m-0" style="font-size: 12px; color: #4d4a4a">{{ record.employee_id.get_department }} /{{ record.employee_id.get_job_position }}</span>
<span class="oh-timeoff-modal__user m-0" style="font-size: 12px; color: #4d4a4a">{{ record.provided_date }}</span>
</div>
</div>
</div>
<h3 class="oh-faq-card__title">{{ record.title }}</h3>
<div class="oh-recuritment__progress-bar">
<div class="oh-progress-bar__state" role="progressbar" aria-valuemax="100" style="width:{{ record.installment_ratio }}%"></div>
</div>
<p class="oh-faq-card__desc">{{ record.description }}.</p>
<a hx-get="{% url 'view-installments' %}?loan_id={{ record.id }}" hx-target="#viewInstallmentModalBody" data-target="#viewInstallmentModal" data-toggle="oh-modal-toggle" class="oh-btn oh-btn--secondary oh-btn--block">{% trans 'Installments' %}</a>
</div>
{% endfor %}
</div>
<div class="oh-wrapper w-100">
<div class="oh-pagination">
<span class="oh-pagination__page" data-toggle="modal" data-target="#addEmployeeModal">{% trans 'Page' %} {{ loan.number }} {% trans 'of' %} {{ loan.paginator.num_pages }}.</span>
<nav class="oh-pagination__nav">
<div class="oh-pagination__input-container me-3">
<span class="oh-pagination__label me-1">{% trans 'Page' %}</span>
<input type="number" name="page" class="oh-pagination__input" value="{{ loan.number }}" hx-get="{% url 'search-loan' %}?{{ pd }}" hx-target="#loanContainer" min="1" />
<span class="oh-pagination__label">{% trans 'of' %} {{ loan.paginator.num_pages }}</span>
</div>
<ul class="oh-pagination__items">
{% if loan.has_previous %}
<li class="oh-pagination__item oh-pagination__item--wide">
<a hx-target="#loanContainer" hx-get="{% url 'search-loan' %}?{{ pd }}&lpage=1" class="oh-pagination__link">{% trans 'First' %}</a>
</li>
<li class="oh-pagination__item oh-pagination__item--wide">
<a hx-target="#loanContainer" hx-get="{% url 'search-loan' %}?{{ pd }}&lpage={{ loan.previous_page_number }}" class="oh-pagination__link">{% trans 'Previous' %}</a>
</li>
{% endif %}
{% if loan.has_next %}
<li class="oh-pagination__item oh-pagination__item--wide">
<a hx-target="#loanContainer" hx-get="{% url 'search-loan' %}?{{ pd }}&lpage={{ loan.next_page_number }}" class="oh-pagination__link">{% trans 'Next' %}</a>
</li>
<li class="oh-pagination__item oh-pagination__item--wide">
<a hx-target="#loanContainer" hx-get="{% url 'search-loan' %}?{{ pd }}&lpage={{ loan.paginator.num_pages }}" class="oh-pagination__link">{% trans 'Last' %}</a>
</li>
{% endif %}
</ul>
</nav>
</div>
</div>
{% else %}
<!-- start of empty page -->
<div style="display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%;" >
<img
style="width: 150px; height: 150px"
src="{% static 'images/ui/no-results.png' %}"
class="oh-404__image mb-4"
/>
<h5 class="oh-404__subtitle">
{% trans "No search result found!" %}
</h5>
</div>
<!-- end of empty page -->
{% endif %}
</div>
<!-- Advanced Salary -->
<div class="oh-tabs__content" id="leave_encashment_tab">
{% if adv_salary %}
<div class="oh-wrapper oh-faq-cards" >
{% for record in adv_salary %}
<div class="oh-faq-card" >
<div class="d-flex justify-content-between">
<div class="loan-type">{{ record.get_type_display }}</div>
<div>
<a class="mr-2" hx-get="{% url 'create-loan' %}?instance_id={{ record.id }}" hx-target="#loanModalBody" data-toggle="oh-modal-toggle" data-target="#loanModal" title='{% trans "Edit" %}'><ion-icon class="text-dark" name="create-outline"></ion-icon></a>
<a href="{% url 'delete-loan' %}?ids={{ record.id }}" onclick="return confirm('Do you want to delete this record?')" title='{% trans "Delete" %}'><ion-icon class="text-danger" name="trash-outline"></ion-icon></a>
</div>
</div>
<div class="oh-timeoff-modal__profile-content">
<div class="oh-profile mb-2">
<div class="oh-profile__avatar">
<img src="{{ record.employee_id.get_avatar }}" class="oh-profile__image me-2" alt="Mary Magdalene" />
</div>
<div class="oh-timeoff-modal__profile-info">
<span class="oh-timeoff-modal__user m-0 fw-bold">{{ record.employee_id }}</span>
<span class="oh-timeoff-modal__user m-0" style="font-size: 12px; color: #4d4a4a">{{ record.employee_id.get_department }} /{{ record.employee_id.get_job_position }}</span>
<span class="oh-timeoff-modal__user m-0" style="font-size: 12px; color: #4d4a4a">{{ record.provided_date }}</span>
</div>
</div>
</div>
<h3 class="oh-faq-card__title">{{ record.title }}</h3>
<div class="oh-recuritment__progress-bar">
<div class="oh-progress-bar__state" role="progressbar" aria-valuemax="100" style="width:{{ record.installment_ratio }}%"></div>
</div>
<p class="oh-faq-card__desc">{{ record.description }}.</p>
<a hx-get="{% url 'view-installments' %}?loan_id={{ record.id }}" hx-target="#viewInstallmentModalBody" data-target="#viewInstallmentModal" data-toggle="oh-modal-toggle" class="oh-btn oh-btn--secondary oh-btn--block">{% trans 'Installments' %}</a>
</div>
{% endfor %}
</div>
<div class="oh-wrapper w-100">
<div class="oh-pagination">
<span class="oh-pagination__page" data-toggle="modal" data-target="#addEmployeeModal">{% trans 'Page' %} {{ adv_salary.number }} {% trans 'of' %} {{ adv_salary.paginator.num_pages }}.</span>
<nav class="oh-pagination__nav">
<div class="oh-pagination__input-container me-3">
<span class="oh-pagination__label me-1">{% trans 'Page' %}</span>
<input type="number" name="page" class="oh-pagination__input" value="{{ adv_salary.number }}" hx-get="{% url 'search-loan' %}?{{ pd }}" hx-target="#loanContainer" min="1" />
<span class="oh-pagination__label">{% trans 'of' %} {{ adv_salary.paginator.num_pages }}</span>
</div>
<ul class="oh-pagination__items">
{% if adv_salary.has_previous %}
<li class="oh-pagination__item oh-pagination__item--wide">
<a hx-target="#loanContainer" hx-get="{% url 'search-loan' %}?{{ pd }}&apage=1" class="oh-pagination__link">{% trans 'First' %}</a>
</li>
<li class="oh-pagination__item oh-pagination__item--wide">
<a hx-target="#loanContainer" hx-get="{% url 'search-loan' %}?{{ pd }}&apage={{ adv_salary.previous_page_number }}" class="oh-pagination__link">{% trans 'Previous' %}</a>
</li>
{% endif %}
{% if adv_salary.has_next %}
<li class="oh-pagination__item oh-pagination__item--wide">
<a hx-target="#loanContainer" hx-get="{% url 'search-loan' %}?{{ pd }}&apage={{ adv_salary.next_page_number }}" class="oh-pagination__link">{% trans 'Next' %}</a>
</li>
<li class="oh-pagination__item oh-pagination__item--wide">
<a hx-target="#loanContainer" hx-get="{% url 'search-loan' %}?{{ pd }}&apage={{ adv_salary.paginator.num_pages }}" class="oh-pagination__link">{% trans 'Last' %}</a>
</li>
{% endif %}
</ul>
</nav>
</div>
</div>
{% else %}
<!-- start of empty page -->
<div style="display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%;" >
<img
style="width: 150px; height: 150px"
src="{% static 'images/ui/no-results.png' %}"
class="oh-404__image mb-4"
/>
<h5 class="oh-404__subtitle">
{% trans "No search result found!" %}
</h5>
</div>
<!-- end of empty page -->
{% endif %}
</div>
<!-- Penalty / Fine Tab-->
<div class="oh-tabs__content" id="bonus_encashment_tab">
{% if fine %}
<div class="oh-wrapper oh-faq-cards" >
{% for record in fine %}
<div class="oh-faq-card" >
<div class="d-flex justify-content-between">
<div class="loan-type">{{ record.get_type_display }}</div>
<div>
{% if perms.payroll.change_loanaccount or request.user %}
<a class="mr-2" hx-get="{% url 'create-loan' %}?instance_id={{ record.id }}" hx-target="#loanModalBody" data-toggle="oh-modal-toggle" data-target="#loanModal" title='{% trans "Edit" %}'><ion-icon class="text-dark" name="create-outline"></ion-icon></a>
{% endif %}
{% if perms.payroll.delete_loanaccount %}
<a href="{% url 'delete-loan' %}?ids={{ record.id }}" onclick="return confirm('Do you want to delete this record?')" title='{% trans "Delete" %}'><ion-icon class="text-danger" name="trash-outline"></ion-icon></a>
{% endif %}
</div>
</div>
<div class="oh-timeoff-modal__profile-content">
<div class="oh-profile mb-2">
<div class="oh-profile__avatar">
<img src="{{ record.employee_id.get_avatar }}" class="oh-profile__image me-2" alt="Mary Magdalene" />
</div>
<div class="oh-timeoff-modal__profile-info">
<span class="oh-timeoff-modal__user m-0 fw-bold">{{ record.employee_id }}</span>
<span class="oh-timeoff-modal__user m-0" style="font-size: 12px; color: #4d4a4a">{{ record.employee_id.get_department }} /{{ record.employee_id.get_job_position }}</span>
<span class="oh-timeoff-modal__user m-0" style="font-size: 12px; color: #4d4a4a">{{ record.provided_date }}</span>
</div>
</div>
</div>
<h3 class="oh-faq-card__title">{{ record.title }}</h3>
<div class="oh-recuritment__progress-bar">
<div class="oh-progress-bar__state" role="progressbar" aria-valuemax="100" style="width:{{ record.installment_ratio }}%"></div>
</div>
<p class="oh-faq-card__desc">{{ record.description }}.</p>
<a hx-get="{% url 'view-installments' %}?loan_id={{ record.id }}" hx-target="#viewInstallmentModalBody" data-target="#viewInstallmentModal" data-toggle="oh-modal-toggle" class="oh-btn oh-btn--secondary oh-btn--block">{% trans 'Installments' %}</a>
</div>
{% endfor %}
</div>
<div class="oh-wrapper w-100">
<div class="oh-pagination">
<span class="oh-pagination__page" data-toggle="modal" data-target="#addEmployeeModal">{% trans 'Page' %} {{ fine.number }} {% trans 'of' %} {{ fine.paginator.num_pages }}.</span>
<nav class="oh-pagination__nav">
<div class="oh-pagination__input-container me-3">
<span class="oh-pagination__label me-1">{% trans 'Page' %}</span>
<input type="number" name="page" class="oh-pagination__input" value="{{ fine.number }}" hx-get="{% url 'search-loan' %}?{{ pd }}" hx-target="#loanContainer" min="1" />
<span class="oh-pagination__label">{% trans 'of' %} {{ fine.paginator.num_pages }}</span>
</div>
<ul class="oh-pagination__items">
{% if fine.has_previous %}
<li class="oh-pagination__item oh-pagination__item--wide">
<a hx-target="#loanContainer" hx-get="{% url 'search-loan' %}?{{ pd }}&fpage=1" class="oh-pagination__link">{% trans 'First' %}</a>
</li>
<li class="oh-pagination__item oh-pagination__item--wide">
<a hx-target="#loanContainer" hx-get="{% url 'search-loan' %}?{{ pd }}&fpage={{ fine.previous_page_number }}" class="oh-pagination__link">{% trans 'Previous' %}</a>
</li>
{% endif %}
{% if fine.has_next %}
<li class="oh-pagination__item oh-pagination__item--wide">
<a hx-target="#loanContainer" hx-get="{% url 'search-loan' %}?{{ pd }}&fpage={{ fine.next_page_number }}" class="oh-pagination__link">{% trans 'Next' %}</a>
</li>
<li class="oh-pagination__item oh-pagination__item--wide">
<a hx-target="#loanContainer" hx-get="{% url 'search-loan' %}?{{ pd }}&fpage={{ fine.paginator.num_pages }}" class="oh-pagination__link">{% trans 'Last' %}</a>
</li>
{% endif %}
</ul>
</nav>
</div>
</div>
{% else %}
<!-- start of empty page -->
<div style="display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%;" >
<img
style="width: 150px; height: 150px"
src="{% static 'images/ui/no-results.png' %}"
class="oh-404__image mb-4"
/>
<h5 class="oh-404__subtitle">
{% trans "No search result found!" %}
</h5>
</div>
<!-- end of empty page -->
{% endif %}
</div>
</div>
</div>
<!-- start of comment modal -->
<div
class="oh-modal"
id="shiftcommentModal"
role="dialog"
aria-labelledby="emptagModal"
aria-hidden="true"
>
<div class="oh-modal__dialog">
<div class="oh-modal__dialog-header">
<h2 class="oh-modal__dialog-title" id="createModalTitle">
{% trans "Add Comment" %}
</h2>
<button class="oh-modal__close" aria-label="Close">
<ion-icon name="close-outline"></ion-icon>
</button>
</div>
<div
class="oh-modal__dialog-body"
id="shiftRequestCommentForm"
></div>
</div>
</div>
<!-- end of comment modal -->
<div
class="oh-modal"
style="z-index: 60"
id="shiftRequestDetailModal"
role="dialog"
aria-labelledby="shiftRequestDetailModal"
aria-hidden="true"
>
<div class="oh-modal__dialog">
<div class="oh-modal__dialog-header">
<h2 class="oh-modal__dialog-title" id="">
{% trans "Details" %}
</h2>
<button class="oh-modal__close" aria-label="Close">
<ion-icon name="close-outline"></ion-icon>
</button>
</div>
<div
class="oh-modal__dialog-body oh-modal__dialog-relative"
id="shiftRequestDetailTarget"
></div>
</div>
</div>
<script>
function reimbursementConfirm(params, target, approve = false) {
Swal.fire({
text: params,
icon: "question",
showCancelButton: true,
confirmButtonColor: "#008000",
cancelButtonColor: "#d33",
confirmButtonText: "Confirm",
cancelButtonText: "Close",
}).then((result) => {
if (result.isConfirmed) {
if (approve) {
$(`${target} [name=amount]`).attr("required", true);
}
$(target + "Button").click();
if (event.target.tagName.toLowerCase() === "form") {
event.target.submit();
} else if (event.target.tagName.toLowerCase() === "a") {
window.location.href = event.target.href;
}
} else {
}
});
}
$(document).ready(function () {
var activeTab = localStorage.getItem("activeTabReimbursment");
if (activeTab != null) {
var tab = $(`[data-target="${activeTab}"]`);
var tabContent = $(activeTab);
$(tab).addClass( "oh-tabs__tab--active");
$(tabContent).addClass( "oh-tabs__content--active");
} else {
$('[data-target="#reimbursement_tab"]').attr(
"class",
"oh-tabs__tab oh-tabs__tab--active"
);
$("#reimbursement_tab").attr("class", "oh-tabs__content oh-tabs__content--active");
}
$(".oh-tabs__tab").click(function (e) {
var activeTab = $(this).attr("data-target");
$(".oh-tabs__content--active").toggleClass('oh-tabs__content--active');
$(".oh-tabs__tab--active").toggleClass('oh-tabs__tab--active');
$(`[data-target="${activeTab}"]`).toggleClass("oh-tabs__tab--active");
$(activeTab).toggleClass("oh-tabs__content--active");
localStorage.setItem("activeTabReimbursment", activeTab);
});
});
</script>
</div>

View File

@@ -0,0 +1,879 @@
{% load i18n %} {% load static %}{% include "filter_tags.html" %}
<div class="oh-tabs oh-wrapper">
<ul class="oh-tabs__tablist">
<li class="oh-tabs__tab" data-target="#reimbursement_tab">
{% trans "Loan" %}
</li>
<!-- normal user can't view all objective -->
<li class="oh-tabs__tab" data-target="#leave_encashment_tab">
{% trans "Advanced Salary" %}
</li>
<li class="oh-tabs__tab" data-target="#bonus_encashment_tab">
{% trans "Fine" %}
</li>
</ul>
<!-- start of tabs -->
<div class="oh-tabs__contents">
<!--start of Loan tab-->
<div class="oh-tabs__content" id="reimbursement_tab">
{% if loan %}
<!-- start of column toggle button-->
<div class="oh-table_sticky--wrapper">
<div class="oh-sticky-dropdown--header">
<div class="oh-dropdown" x-data="{open: false}">
<button class="oh-sticky-dropdown_btn " @click="open = !open"><ion-icon name="ellipsis-vertical-sharp"
role="img" class="md hydrated" aria-label="ellipsis vertical sharp"></ion-icon></button>
<div class="oh-dropdown__menu oh-sticky-table_dropdown" x-show="open" @click.outside="open = false">
<ul class="oh-dropdown__items" id="ReimbursementCells">
</ul>
</div>
</div>
</div>
</div>
<!-- end of column toggle button-->
<div id="reimbursement-table" data-table-name="reimbursement_table">
<!-- start of sticky table -->
<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">
{% comment %} <div class="oh-sticky-table__th" style="width: 20px">
<input
type="checkbox"
title='{% trans "Select All" %}'
class="oh-input oh-input__checkbox mt-1 mr-2 all-attendances"
style="margin-left: -5px"
/>
</div> {% endcomment %}
<div
class="oh-sticky-table__th {% if request.sort_option.order == '-employee_id' %}arrow-up {% elif request.sort_option.order == 'employee_id' %}arrow-down {% else %}arrow-up-down {% endif %}"
hx-get="{% url 'search-loan' %}?{{pd}}&sortby=employee_id"
hx-target="#loanContainer"
>
{% trans "Employee" %}
</div>
<div data-cell-index="1" data-cell-title='{% trans "Title" %}' class="oh-sticky-table__th">{% trans "Title" %}</div>
<div data-cell-index="2" data-cell-title='{% trans "Provided Date" %}'
class="oh-sticky-table__th {% if request.sort_option.order == '-provided_date' %}arrow-up {% elif request.sort_option.order == 'provided_date' %}arrow-down {% else %}arrow-up-down {% endif %}"
hx-get="{% url 'search-loan' %}?{{pd}}&sortby=provided_date"
hx-target="#loanContainer"
>
{% trans "Provided Date" %}
</div>
<div data-cell-index="3" data-cell-title='{% trans "Installment Start Date" %}'
class="oh-sticky-table__th {% if request.sort_option.order == '-installment_start_date' %}arrow-up {% elif request.sort_option.order == 'installment_start_date' %}arrow-down {% else %}arrow-up-down {% endif %}"
hx-get="{% url 'search-loan' %}?{{pd}}&sortby=installment_start_date"
hx-target="#loanContainer"
>
{% trans "Installment Start Date" %}
</div>
<div data-cell-index="4" data-cell-title='{% trans "Total Installments" %}'
class="oh-sticky-table__th {% if request.sort_option.order == '-installments' %}arrow-up {% elif request.sort_option.order == 'installments' %}arrow-down {% else %}arrow-up-down {% endif %}"
hx-get="{% url 'search-loan' %}?{{pd}}&sortby=installments"
hx-target="#loanContainer"
>
{% trans "Total Installments" %}
</div>
<div data-cell-index="5" data-cell-title='{% trans "Amount" %}'
class="oh-sticky-table__th {% if request.sort_option.order == '-loan_amount' %}arrow-up {% elif request.sort_option.order == 'loan_amount' %}arrow-down {% else %}arrow-up-down {% endif %}"
hx-get="{% url 'search-loan' %}?{{pd}}&sortby=loan_amount"
hx-target="#loanContainer"
>{% trans "Amount" %}
</div>
<div
data-cell-index="6" data-cell-title='{% trans "Description" %}' class="oh-sticky-table__th" style="width:200px"
>
{% trans "Description" %}
</div>
<div class="oh-sticky-table__th"> {% trans "Actions" %} </div>
</div>
</div>
<div class="oh-sticky-table__tbody">
{% for req in loan %}
<div class="oh-sticky-table__tr"
hx-get="{% url 'view-installments' %}?loan_id={{ req.id }}" hx-target="#viewInstallmentModalBody" data-target="#viewInstallmentModal" data-toggle="oh-modal-toggle">
{% comment %} <div class="oh-sticky-table__sd" onclick="event.stopPropagation();">
<input
type="checkbox"
id="{{attendance.id}}"
class="oh-input attendance-checkbox oh-input__checkbox mt-2 mr-2 all-attendance-row"
/>
</div> {% endcomment %}
<div class="oh-sticky-table__sd">
<div class="d-flex">
<div class="oh-profile oh-profile--md">
<div class="oh-profile__avatar mr-1">
<img
src="{{req.employee_id.get_avatar}}"
class="oh-profile__image"
alt=""
/>
</div>
<span class="oh-profile__name oh-text--dark">{{req.employee_id}}</span>
</div>
</div>
</div>
<div data-cell-index="1" class="oh-sticky-table__td">
{{req.title|truncatechars:20 }}
</div>
<div data-cell-index="2" class="oh-sticky-table__td dateformat_changer">
{{req.provided_date|date:"F j, Y"}}
</div>
<div data-cell-index="3" class="oh-sticky-table__td dateformat_changer">
{{req.installment_start_date|date:"F j, Y"}}
</div>
<div data-cell-index="4" class="oh-sticky-table__td">
{{req.installments}}
</div>
<div data-cell-index="5" class="oh-sticky-table__td">
{{req.loan_amount}}
</div>
<div data-cell-index="6" class="oh-sticky-table__td">
{{req.description}}
</div>
<div class="oh-sticky-table__td" onclick="event.stopPropagation()">
<div class="oh-btn-group">
{% if perms.payroll.change_loanaccount or request.user %}
<a class="oh-btn oh-btn--light-bkg w-100" hx-get="{% url 'create-loan' %}?instance_id={{ req.id }}" hx-target="#loanModalBody" data-toggle="oh-modal-toggle" data-target="#loanModal" title='{% trans "Edit" %}'>
<ion-icon class="text-dark" name="create-outline"></ion-icon></a>
{% endif %}
{% if perms.payroll.delete_loanaccount %}
<a class="oh-btn oh-btn--light-bkg w-100" href="{% url 'delete-loan' %}?ids={{ req.id }}" onclick="return confirm('Do you want to delete this record?')" title='{% trans "Delete" %}'>
<ion-icon class="text-danger" name="trash-outline"></ion-icon></a>
{% endif %}
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
<!-- end of sticky table -->
<!-- start of pagination -->
<div class="oh-wrapper w-100">
<div class="oh-pagination">
<span
class="oh-pagination__page"
data-toggle="modal"
data-target="#addEmployeeModal"
>{% trans 'Page' %} {{ loan.number }} {% trans 'of' %} {{ loan.paginator.num_pages }}.</span
>
<nav class="oh-pagination__nav">
<div class="oh-pagination__input-container me-3">
<span class="oh-pagination__label me-1"
>{% trans 'Page' %}</span
>
<input
type="number"
name="page"
class="oh-pagination__input"
value="{{ loan.number }}"
hx-get="{% url 'search-loan' %}?{{ pd }}"
hx-target="#loanContainer"
min="1"
/>
<span class="oh-pagination__label"
>{% trans 'of' %} {{ loan.paginator.num_pages }}</span
>
</div>
<ul class="oh-pagination__items">
{% if loan.has_previous %}
<li
class="oh-pagination__item oh-pagination__item--wide"
>
<a
hx-target="#loanContainer"
hx-get="{% url 'search-loan' %}?{{ pd }}&lpage=1"
class="oh-pagination__link"
>{% trans 'First' %}</a
>
</li>
<li
class="oh-pagination__item oh-pagination__item--wide"
>
<a
hx-target="#loanContainer"
hx-get="{% url 'search-loan' %}?{{ pd }}&lpage={{ loan.previous_page_number }}"
class="oh-pagination__link"
>{% trans 'Previous' %}</a
>
</li>
{% endif %} {% if loan.has_next %}
<li
class="oh-pagination__item oh-pagination__item--wide"
>
<a
hx-target="#loanContainer"
hx-get="{% url 'search-loan' %}?{{ pd }}&lpage={{ loan.next_page_number }}"
class="oh-pagination__link"
>{% trans 'Next' %}</a
>
</li>
<li
class="oh-pagination__item oh-pagination__item--wide"
>
<a
hx-target="#loanContainer"
hx-get="{% url 'search-loan' %}?{{ pd }}&lpage={{ loan.paginator.num_pages }}"
class="oh-pagination__link"
>{% trans 'Last' %}</a
>
</li>
{% endif %}
</ul>
</nav>
</div>
</div>
<!-- end of pagination -->
</div>
{% else %}
<!-- start of empty page -->
<div style="display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%;" >
<img
style="width: 150px; height: 150px"
src="{% static 'images/ui/no-results.png' %}"
class="oh-404__image mb-4"
/>
<h5 class="oh-404__subtitle">
{% trans "No search result found!" %}
</h5>
</div>
<!-- end of empty page -->
{% endif %}
</div>
<!--end of Reimbursement tab-->
<!-- start of Advanced Salary-->
<div class="oh-tabs__content" id="leave_encashment_tab">
{% if adv_salary %}
<!-- start of column toggle button-->
<div class="oh-table_sticky--wrapper">
<div class="oh-sticky-dropdown--header">
<div class="oh-dropdown" x-data="{open: false}">
<button class="oh-sticky-dropdown_btn " @click="open = !open"><ion-icon name="ellipsis-vertical-sharp"
role="img" class="md hydrated" aria-label="ellipsis vertical sharp"></ion-icon></button>
<div class="oh-dropdown__menu oh-sticky-table_dropdown" x-show="open" @click.outside="open = false">
<ul class="oh-dropdown__items" id="LeaveEncashmentCells">
</ul>
</div>
</div>
</div>
</div>
<!-- end of column toggle button-->
<div id="leave-encashment-table" data-table-name="leave_encashment_table">
<!-- start of sticky table -->
<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">
{% comment %} <div class="oh-sticky-table__th" style="width: 20px">
<input
type="checkbox"
title='{% trans "Select All" %}'
class="oh-input oh-input__checkbox mt-1 mr-2 all-attendances"
style="margin-left: -5px"
/>
</div> {% endcomment %}
<div
class="oh-sticky-table__th {% if request.sort_option.order == '-employee_id' %}arrow-up {% elif request.sort_option.order == 'employee_id' %}arrow-down {% else %}arrow-up-down {% endif %}"
hx-get="{% url 'search-loan' %}?{{pd}}&sortby=employee_id"
hx-target="#loanContainer"
>
{% trans "Employee" %}
</div>
<div data-cell-index="1" data-cell-title='{% trans "Title" %}' class="oh-sticky-table__th">{% trans "Title" %}</div>
<div data-cell-index="2" data-cell-title='{% trans "Provided Date" %}'
class="oh-sticky-table__th {% if request.sort_option.order == '-provided_date' %}arrow-up {% elif request.sort_option.order == 'provided_date' %}arrow-down {% else %}arrow-up-down {% endif %}"
hx-get="{% url 'search-loan' %}?{{pd}}&sortby=provided_date"
hx-target="#loanContainer"
>
{% trans "Provided Date" %}
</div>
<div data-cell-index="3" data-cell-title='{% trans "Installment Start Date" %}'
class="oh-sticky-table__th {% if request.sort_option.order == '-installment_start_date' %}arrow-up {% elif request.sort_option.order == 'installment_start_date' %}arrow-down {% else %}arrow-up-down {% endif %}"
hx-get="{% url 'search-loan' %}?{{pd}}&sortby=installment_start_date"
hx-target="#loanContainer"
>
{% trans "Installment Start Date" %}
</div>
<div data-cell-index="4" data-cell-title='{% trans "Total Installments" %}'
class="oh-sticky-table__th {% if request.sort_option.order == '-installments' %}arrow-up {% elif request.sort_option.order == 'installments' %}arrow-down {% else %}arrow-up-down {% endif %}"
hx-get="{% url 'search-loan' %}?{{pd}}&sortby=installments"
hx-target="#loanContainer"
>
{% trans "Total Installments" %}
</div>
<div data-cell-index="5" data-cell-title='{% trans "Amount" %}'
class="oh-sticky-table__th {% if request.sort_option.order == '-loan_amount' %}arrow-up {% elif request.sort_option.order == 'loan_amount' %}arrow-down {% else %}arrow-up-down {% endif %}"
hx-get="{% url 'search-loan' %}?{{pd}}&sortby=loan_amount"
hx-target="#loanContainer"
>{% trans "Amount" %}
</div>
<div
data-cell-index="6" data-cell-title='{% trans "Description" %}' class="oh-sticky-table__th" style="width:200px"
>
{% trans "Description" %}
</div>
<div class="oh-sticky-table__th"> {% trans "Actions" %} </div>
</div>
</div>
<div class="oh-sticky-table__tbody">
{% for req in adv_salary %}
<div class="oh-sticky-table__tr"
hx-get="{% url 'view-installments' %}?loan_id={{ req.id }}" hx-target="#viewInstallmentModalBody" data-target="#viewInstallmentModal" data-toggle="oh-modal-toggle">
{% comment %} <div class="oh-sticky-table__sd" onclick="event.stopPropagation();">
<input
type="checkbox"
id="{{attendance.id}}"
class="oh-input attendance-checkbox oh-input__checkbox mt-2 mr-2 all-attendance-row"
/>
</div> {% endcomment %}
<div class="oh-sticky-table__sd">
<div class="d-flex">
<div class="oh-profile oh-profile--md">
<div class="oh-profile__avatar mr-1">
<img
src="{{req.employee_id.get_avatar}}"
class="oh-profile__image"
alt=""
/>
</div>
<span class="oh-profile__name oh-text--dark">{{req.employee_id}}</span>
</div>
</div>
</div>
<div data-cell-index="1" class="oh-sticky-table__td">
{{req.title|truncatechars:20 }}
</div>
<div data-cell-index="2" class="oh-sticky-table__td dateformat_changer">
{{req.provided_date|date:"F j, Y"}}
</div>
<div data-cell-index="3" class="oh-sticky-table__td dateformat_changer">
{{req.installment_start_date|date:"F j, Y"}}
</div>
<div data-cell-index="4" class="oh-sticky-table__td">
{{req.installments}}
</div>
<div data-cell-index="5" class="oh-sticky-table__td">
{{req.loan_amount}}
</div>
<div data-cell-index="6" class="oh-sticky-table__td">
{{req.description}}
</div>
<div class="oh-sticky-table__td" onclick="event.stopPropagation()">
<div class="oh-btn-group">
{% if perms.payroll.change_loanaccount or request.user %}
<a class="oh-btn oh-btn--light-bkg w-100" hx-get="{% url 'create-loan' %}?instance_id={{ req.id }}" hx-target="#loanModalBody" data-toggle="oh-modal-toggle" data-target="#loanModal" title='{% trans "Edit" %}'>
<ion-icon class="text-dark" name="create-outline"></ion-icon></a>
{% endif %}
{% if perms.payroll.delete_loanaccount %}
<a class="oh-btn oh-btn--light-bkg w-100" href="{% url 'delete-loan' %}?ids={{ req.id }}" onclick="return confirm('Do you want to delete this record?')" title='{% trans "Delete" %}'>
<ion-icon class="text-danger" name="trash-outline"></ion-icon></a>
{% endif %}
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
<!-- end of sticky table -->
<!-- start of pagination -->
<div class="oh-wrapper w-100">
<div class="oh-pagination">
<span
class="oh-pagination__page"
data-toggle="modal"
data-target="#addEmployeeModal"
>{% trans 'Page' %} {{ adv_salary.number }} {% trans 'of' %} {{ adv_salary.paginator.num_pages }}.</span
>
<nav class="oh-pagination__nav">
<div class="oh-pagination__input-container me-3">
<span class="oh-pagination__label me-1"
>{% trans 'Page' %}</span
>
<input
type="number"
name="page"
class="oh-pagination__input"
value="{{ adv_salary.number }}"
hx-get="{% url 'search-loan' %}?{{ pd }}"
hx-target="#loanContainer"
min="1"
/>
<span class="oh-pagination__label"
>{% trans 'of' %} {{ adv_salary.paginator.num_pages }}</span
>
</div>
<ul class="oh-pagination__items">
{% if adv_salary.has_previous %}
<li
class="oh-pagination__item oh-pagination__item--wide"
>
<a
hx-target="#loanContainer"
hx-get="{% url 'search-loan' %}?{{ pd }}&apage=1"
class="oh-pagination__link"
>{% trans 'First' %}</a
>
</li>
<li
class="oh-pagination__item oh-pagination__item--wide"
>
<a
hx-target="#loanContainer"
hx-get="{% url 'search-loan' %}?{{ pd }}&apage={{ adv_salary.previous_page_number }}"
class="oh-pagination__link"
>{% trans 'Previous' %}</a
>
</li>
{% endif %} {% if adv_salary.has_next %}
<li
class="oh-pagination__item oh-pagination__item--wide"
>
<a
hx-target="#loanContainer"
hx-get="{% url 'search-loan' %}?{{ pd }}&apage={{ adv_salary.next_page_number }}"
class="oh-pagination__link"
>{% trans 'Next' %}</a
>
</li>
<li
class="oh-pagination__item oh-pagination__item--wide"
>
<a
hx-target="#loanContainer"
hx-get="{% url 'search-loan' %}?{{ pd }}&apage={{ adv_salary.paginator.num_pages }}"
class="oh-pagination__link"
>{% trans 'Last' %}</a
>
</li>
{% endif %}
</ul>
</nav>
</div>
</div>
<!-- end of pagination -->
</div>
{% else %}
<!-- start of empty page -->
<div style="display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%;" >
<img
style="width: 150px; height: 150px"
src="{% static 'images/ui/no-results.png' %}"
class="oh-404__image mb-4"
/>
<h5 class="oh-404__subtitle">
{% trans "No search result found!" %}
</h5>
</div>
<!-- end of empty page -->
{% endif %}
</div>
<!-- end of Leave Encashments-->
<!-- start of Bonus Encashments-->
<div class="oh-tabs__content" id="bonus_encashment_tab">
{% if fine %}
<!-- start of column toggle button-->
<div class="oh-table_sticky--wrapper">
<div class="oh-sticky-dropdown--header">
<div class="oh-dropdown" x-data="{open: false}">
<button class="oh-sticky-dropdown_btn " @click="open = !open"><ion-icon name="ellipsis-vertical-sharp"
role="img" class="md hydrated" aria-label="ellipsis vertical sharp"></ion-icon></button>
<div class="oh-dropdown__menu oh-sticky-table_dropdown" x-show="open" @click.outside="open = false">
<ul class="oh-dropdown__items" id="BonusEncashmentCells">
</ul>
</div>
</div>
</div>
</div>
<!-- end of column toggle button-->
<div id="bonus-encashment-table" data-table-name="bonus_encashment_table">
<!-- start of sticky table -->
<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">
{% comment %} <div class="oh-sticky-table__th" style="width: 20px">
<input
type="checkbox"
title='{% trans "Select All" %}'
class="oh-input oh-input__checkbox mt-1 mr-2 all-attendances"
style="margin-left: -5px"
/>
</div> {% endcomment %}
<div
class="oh-sticky-table__th {% if request.sort_option.order == '-employee_id' %}arrow-up {% elif request.sort_option.order == 'employee_id' %}arrow-down {% else %}arrow-up-down {% endif %}"
hx-get="{% url 'search-loan' %}?{{pd}}&sortby=employee_id"
hx-target="#loanContainer"
>
{% trans "Employee" %}
</div>
<div data-cell-index="1" data-cell-title='{% trans "Title" %}' class="oh-sticky-table__th">{% trans "Title" %}</div>
<div data-cell-index="2" data-cell-title='{% trans "Provided Date" %}'
class="oh-sticky-table__th {% if request.sort_option.order == '-provided_date' %}arrow-up {% elif request.sort_option.order == 'provided_date' %}arrow-down {% else %}arrow-up-down {% endif %}"
hx-get="{% url 'search-loan' %}?{{pd}}&sortby=provided_date"
hx-target="#loanContainer"
>
{% trans "Provided Date" %}
</div>
<div data-cell-index="3" data-cell-title='{% trans "Installment Start Date" %}'
class="oh-sticky-table__th {% if request.sort_option.order == '-installment_start_date' %}arrow-up {% elif request.sort_option.order == 'installment_start_date' %}arrow-down {% else %}arrow-up-down {% endif %}"
hx-get="{% url 'search-loan' %}?{{pd}}&sortby=installment_start_date"
hx-target="#loanContainer"
>
{% trans "Installment Start Date" %}
</div>
<div data-cell-index="4" data-cell-title='{% trans "Total Installments" %}'
class="oh-sticky-table__th {% if request.sort_option.order == '-installments' %}arrow-up {% elif request.sort_option.order == 'installments' %}arrow-down {% else %}arrow-up-down {% endif %}"
hx-get="{% url 'search-loan' %}?{{pd}}&sortby=installments"
hx-target="#loanContainer"
>
{% trans "Total Installments" %}
</div>
<div data-cell-index="5" data-cell-title='{% trans "Amount" %}'
class="oh-sticky-table__th {% if request.sort_option.order == '-loan_amount' %}arrow-up {% elif request.sort_option.order == 'loan_amount' %}arrow-down {% else %}arrow-up-down {% endif %}"
hx-get="{% url 'search-loan' %}?{{pd}}&sortby=loan_amount"
hx-target="#loanContainer"
>{% trans "Amount" %}
</div>
<div
data-cell-index="6" data-cell-title='{% trans "Description" %}' class="oh-sticky-table__th" style="width:200px"
>
{% trans "Description" %}
</div>
<div class="oh-sticky-table__th"> {% trans "Actions" %} </div>
</div>
</div>
<div class="oh-sticky-table__tbody">
{% for req in fine %}
<div class="oh-sticky-table__tr"
hx-get="{% url 'view-installments' %}?loan_id={{ req.id }}" hx-target="#viewInstallmentModalBody" data-target="#viewInstallmentModal" data-toggle="oh-modal-toggle">
{% comment %} <div class="oh-sticky-table__sd" onclick="event.stopPropagation();">
<input
type="checkbox"
id="{{attendance.id}}"
class="oh-input attendance-checkbox oh-input__checkbox mt-2 mr-2 all-attendance-row"
/>
</div> {% endcomment %}
<div class="oh-sticky-table__sd">
<div class="d-flex">
<div class="oh-profile oh-profile--md">
<div class="oh-profile__avatar mr-1">
<img
src="{{req.employee_id.get_avatar}}"
class="oh-profile__image"
alt=""
/>
</div>
<span class="oh-profile__name oh-text--dark">{{req.employee_id}}</span>
</div>
</div>
</div>
<div data-cell-index="1" class="oh-sticky-table__td">
{{req.title|truncatechars:20 }}
</div>
<div data-cell-index="2" class="oh-sticky-table__td dateformat_changer">
{{req.provided_date|date:"F j, Y"}}
</div>
<div data-cell-index="3" class="oh-sticky-table__td dateformat_changer">
{{req.installment_start_date|date:"F j, Y"}}
</div>
<div data-cell-index="4" class="oh-sticky-table__td">
{{req.installments}}
</div>
<div data-cell-index="5" class="oh-sticky-table__td">
{{req.loan_amount}}
</div>
<div data-cell-index="6" class="oh-sticky-table__td">
{{req.description}}
</div>
<div class="oh-sticky-table__td" onclick="event.stopPropagation()">
<div class="oh-btn-group">
{% if perms.payroll.change_loanaccount or request.user %}
<a class="oh-btn oh-btn--light-bkg w-100" hx-get="{% url 'create-loan' %}?instance_id={{ req.id }}" hx-target="#loanModalBody" data-toggle="oh-modal-toggle" data-target="#loanModal" title='{% trans "Edit" %}'>
<ion-icon class="text-dark" name="create-outline"></ion-icon></a>
{% endif %}
{% if perms.payroll.delete_loanaccount %}
<a class="oh-btn oh-btn--light-bkg w-100" href="{% url 'delete-loan' %}?ids={{ req.id }}" onclick="return confirm('Do you want to delete this record?')" title='{% trans "Delete" %}'>
<ion-icon class="text-danger" name="trash-outline"></ion-icon></a>
{% endif %}
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
<!-- end of sticky table -->
<!-- start of pagination -->
<div class="oh-wrapper w-100">
<div class="oh-pagination">
<span
class="oh-pagination__page"
data-toggle="modal"
data-target="#addEmployeeModal"
>{% trans 'Page' %} {{ fine.number }} {% trans 'of' %} {{ fine.paginator.num_pages }}.</span
>
<nav class="oh-pagination__nav">
<div class="oh-pagination__input-container me-3">
<span class="oh-pagination__label me-1"
>{% trans 'Page' %}</span
>
<input
type="number"
name="page"
class="oh-pagination__input"
value="{{ fine.number }}"
hx-get="{% url 'search-loan' %}?{{ pd }}"
hx-target="#loanContainer"
min="1"
/>
<span class="oh-pagination__label"
>{% trans 'of' %} {{ fine.paginator.num_pages }}</span
>
</div>
<ul class="oh-pagination__items">
{% if fine.has_previous %}
<li
class="oh-pagination__item oh-pagination__item--wide"
>
<a
hx-target="#loanContainer"
hx-get="{% url 'search-loan' %}?{{ pd }}&fpage=1"
class="oh-pagination__link"
>{% trans 'First' %}</a
>
</li>
<li
class="oh-pagination__item oh-pagination__item--wide"
>
<a
hx-target="#loanContainer"
hx-get="{% url 'search-loan' %}?{{ pd }}&fpage={{ fine.previous_page_number }}"
class="oh-pagination__link"
>{% trans 'Previous' %}</a
>
</li>
{% endif %} {% if fine.has_next %}
<li
class="oh-pagination__item oh-pagination__item--wide"
>
<a
hx-target="#loanContainer"
hx-get="{% url 'search-loan' %}?{{ pd }}&fpage={{ fine.next_page_number }}"
class="oh-pagination__link"
>{% trans 'Next' %}</a
>
</li>
<li
class="oh-pagination__item oh-pagination__item--wide"
>
<a
hx-target="#loanContainer"
hx-get="{% url 'search-loan' %}?{{ pd }}&fpage={{ fine.paginator.num_pages }}"
class="oh-pagination__link"
>{% trans 'Last' %}</a
>
</li>
{% endif %}
</ul>
</nav>
</div>
</div>
<!-- end of pagination -->
</div>
{% else %}
<!-- start of empty page -->
<div style="display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%;" >
<img
style="width: 150px; height: 150px"
src="{% static 'images/ui/no-results.png' %}"
class="oh-404__image mb-4"
/>
<h5 class="oh-404__subtitle">
{% trans "No search result found!" %}
</h5>
</div>
<!-- end of empty page -->
{% endif %}
</div>
<!-- end of Bonus Encashments-->
</div>
<!-- end of tabs -->
<!-- start of comment modal -->
<div
class="oh-modal"
id="shiftcommentModal"
role="dialog"
aria-labelledby="emptagModal"
aria-hidden="true"
>
<div class="oh-modal__dialog">
<div class="oh-modal__dialog-header">
<h2 class="oh-modal__dialog-title" id="createModalTitle">
{% trans "Add Comment" %}
</h2>
<button class="oh-modal__close" aria-label="Close">
<ion-icon name="close-outline"></ion-icon>
</button>
</div>
<div
class="oh-modal__dialog-body"
id="shiftRequestCommentForm"
></div>
</div>
</div>
<!-- end of comment modal -->
<div
class="oh-modal"
style="z-index: 60"
id="shiftRequestDetailModal"
role="dialog"
aria-labelledby="shiftRequestDetailModal"
aria-hidden="true"
>
<div class="oh-modal__dialog">
<div class="oh-modal__dialog-header">
<h2 class="oh-modal__dialog-title" id="">
{% trans "Details" %}
</h2>
<button class="oh-modal__close" aria-label="Close">
<ion-icon name="close-outline"></ion-icon>
</button>
</div>
<div
class="oh-modal__dialog-body oh-modal__dialog-relative"
id="shiftRequestDetailTarget"
></div>
</div>
</div>
<div class="oh-modal" id="loanModal" role="dialog" aria-hidden="true">
<div class="oh-modal__dialog" style="max-width: 550px">
<div class="oh-modal__dialog-header">
<button type="button" class="oh-modal__close" aria-label="Close"><ion-icon name="close-outline"></ion-icon></button>
</div>
<div class="oh-modal__dialog-body" id="loanModalBody"></div>
</div>
</div>
<div class="oh-modal" id="viewInstallmentModal" role="dialog" aria-hidden="true">
<div class="oh-modal__dialog" style="max-width: 550px">
<div class="oh-modal__dialog-header">
<button type="button" class="oh-modal__close" aria-label="Close"><ion-icon name="close-outline"></ion-icon></button>
</div>
<div class="oh-modal__dialog-body" id="viewInstallmentModalBody"></div>
</div>
</div>
<script>
function reimbursementConfirm(params, target, approve = false) {
Swal.fire({
text: params,
icon: "question",
showCancelButton: true,
confirmButtonColor: "#008000",
cancelButtonColor: "#d33",
confirmButtonText: "Confirm",
cancelButtonText: "Close",
}).then((result) => {
if (result.isConfirmed) {
if (approve) {
$(`${target} [name=amount]`).attr("required", true);
}
$(target + "Button").click();
if (event.target.tagName.toLowerCase() === "form") {
event.target.submit();
} else if (event.target.tagName.toLowerCase() === "a") {
window.location.href = event.target.href;
}
} else {
}
});
}
$(document).ready(function () {
var activeTab = localStorage.getItem("activeTabReimbursment");
if (activeTab != null) {
var tab = $(`[data-target="${activeTab}"]`);
var tabContent = $(activeTab);
$(tab).addClass( "oh-tabs__tab--active");
$(tabContent).addClass( "oh-tabs__content--active");
} else {
$('[data-target="#reimbursement_tab"]').attr(
"class",
"oh-tabs__tab oh-tabs__tab--active"
);
$("#reimbursement_tab").attr("class", "oh-tabs__content oh-tabs__content--active");
}
$(".oh-tabs__tab").click(function (e) {
var activeTab = $(this).attr("data-target");
$(".oh-tabs__content--active").toggleClass('oh-tabs__content--active');
$(".oh-tabs__tab--active").toggleClass('oh-tabs__tab--active');
$(`[data-target="${activeTab}"]`).toggleClass("oh-tabs__tab--active");
$(activeTab).toggleClass("oh-tabs__content--active");
localStorage.setItem("activeTabReimbursment", activeTab);
});
});
// toggle colums //
//Reiumbursement
toggleColumns("reimbursement-table","ReimbursementCells")
localStorageReimbursementCells = localStorage.getItem("reimbursement_table")
if (!localStorageReimbursementCells) {
$("#ReimbursementCells").find("[type=checkbox]").prop("checked",true)
}
$("[type=checkbox]").change()
//Leave encashments
toggleColumns("leave-encashment-table","LeaveEncashmentCells")
localStorageLeaveEncashmentCells = localStorage.getItem("leave_encashment_table")
if (!localStorageLeaveEncashmentCells) {
$("#LeaveEncashmentCells").find("[type=checkbox]").prop("checked",true)
}
$("[type=checkbox]").change()
//Bonus encashments
toggleColumns("bonus-encashment-table","BonusEncashmentCells")
localStorageBonusEncashmentCells = localStorage.getItem("bonus_encashment_table")
if (!localStorageBonusEncashmentCells) {
$("#BonusEncashmentCells").find("[type=checkbox]").prop("checked",true)
}
$("[type=checkbox]").change()
</script>
</div>

View File

@@ -15,7 +15,7 @@
{% include 'payroll/loan/nav.html' %}
<div id="loanContainer">
{% if records %}
{% include 'payroll/loan/records.html' %}
{% include 'payroll/loan/records_card.html' %}
{% else %}
{% include 'filter_tags.html' %}
<main :class="sidebarOpen ? 'oh-main__sidebar-visible' : ''">

View File

@@ -4,7 +4,7 @@
<h1 class="oh-main__titlebar-title fw-bold">{% trans 'Reimbursements' %}</h1>
</div>
<form hx-get="{% url 'search-reimbursement' %}" hx-target="#reimbursementContainer">
<form hx-get="{% url 'search-reimbursement' %}" hx-target="#reimbursementContainer" onsubmit="event.stopPropagation()">
<div class="oh-main__titlebar oh-main__titlebar--right oh-d-flex-column--resp oh-mb-3--small">
<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>

View File

@@ -162,7 +162,7 @@
</div>
<div class="oh-sticky-table__td">
<div class="oh-btn-group">
{% if perms.attendance.change_attendance or request.user %}
{% if perms.payroll.change_reimbursement or request.user %}
<a
onclick="event.stopPropagation()"
hx-get="{% url 'create-reimbursement' %}?instance_id={{ req.id }}"
@@ -175,9 +175,9 @@
<ion-icon name="create-outline"></ion-icon>
</a>
{% endif %}
{% if perms.attendance.delete_attendance %}
{% if perms.payroll.delete_reimbursement %}
<a href="{% url "delete-reimbursement" %}?ids={{req.id}}" onclick="return confirm('Do you want to delete this record?')"
class='w-100 oh-btn oh-btn--danger-outline oh-btn--light-bkg'>
class='w-100 oh-btn oh-btn--danger-outline oh-btn--light-bkg' title='{% trans "Delete" %}'>
<ion-icon name="trash-outline"></ion-icon>
</a>
@@ -235,7 +235,7 @@
class="oh-pagination__page"
data-toggle="modal"
data-target="#addEmployeeModal"
>{% trans 'Page' %} {{ requests.number }} {% trans 'of' %} {{ requests.paginator.num_pages }}.</span
>{% trans 'Page' %} {{ reimbursements.number }} {% trans 'of' %} {{ reimbursements.paginator.num_pages }}.</span
>
<nav class="oh-pagination__nav">
@@ -248,24 +248,24 @@
type="number"
name="page"
class="oh-pagination__input"
value="{{ requests.number }}"
value="{{ reimbursements.number }}"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}"
hx-target="#reimbursementContainer"
min="1"
/>
<span class="oh-pagination__label"
>{% trans 'of' %} {{ requests.paginator.num_pages }}</span
>{% trans 'of' %} {{ reimbursements.paginator.num_pages }}</span
>
</div>
<ul class="oh-pagination__items">
{% if requests.has_previous %}
{% if reimbursements.has_previous %}
<li
class="oh-pagination__item oh-pagination__item--wide"
>
<a
hx-target="#reimbursementContainer"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&page=1"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&rpage=1"
class="oh-pagination__link"
>{% trans 'First' %}</a
>
@@ -275,18 +275,18 @@
>
<a
hx-target="#reimbursementContainer"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&rpage={{ requests.previous_page_number }}"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&rpage={{ reimbursements.previous_page_number }}"
class="oh-pagination__link"
>{% trans 'Previous' %}</a
>
</li>
{% endif %} {% if requests.has_next %}
{% endif %} {% if reimbursements.has_next %}
<li
class="oh-pagination__item oh-pagination__item--wide"
>
<a
hx-target="#reimbursementContainer"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&rpage={{ requests.next_page_number }}"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&rpage={{ reimbursements.next_page_number }}"
class="oh-pagination__link"
>{% trans 'Next' %}</a
>
@@ -296,7 +296,7 @@
>
<a
hx-target="#reimbursementContainer"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&page={{ requests.paginator.num_pages }}"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&rpage={{ reimbursements.paginator.num_pages }}"
class="oh-pagination__link"
>{% trans 'Last' %}</a
>
@@ -458,22 +458,22 @@
</div>
<div class="oh-sticky-table__td">
<div class="oh-btn-group">
{% if perms.attendance.change_attendance or request.user %}
{% if perms.payroll.change_reimbursement or request.user %}
<a
onclick="event.stopPropagation()"
hx-get="{% url 'create-reimbursement' %}?instance_id={{ req.id }}"
hx-target="#reimbursementModalBody"
data-toggle="oh-modal-toggle"
data-target="#reimbursementModal"
class="oh-btn oh-btn--light-bkg w-50"
class="oh-btn oh-btn--light-bkg w-100"
title="{% trans 'Edit' %}"
>
<ion-icon name="create-outline"></ion-icon>
>
<ion-icon name="create-outline"></ion-icon>
</a>
{% endif %}
{% if perms.attendance.delete_attendance %}
{% if perms.payroll.delete_reimbursement %}
<a href="{% url "delete-reimbursement" %}?ids={{req.id}}" onclick="return confirm('Do you want to delete this record?')"
class='w-50 oh-btn oh-btn--danger-outline oh-btn--light-bkg'>
class='w-100 oh-btn oh-btn--danger-outline oh-btn--light-bkg' title='{% trans "Delete" %}'>
<ion-icon name="trash-outline"></ion-icon>
</a>
@@ -530,8 +530,8 @@
class="oh-pagination__page"
data-toggle="modal"
data-target="#addEmployeeModal"
>{% trans 'Page' %} {{ requests.number }} {% trans 'of' %}
{{ requests.paginator.num_pages }}.</span
>{% trans 'Page' %} {{ leave_encashments.number }} {% trans 'of' %}
{{ leave_encashments.paginator.num_pages }}.</span
>
<nav class="oh-pagination__nav">
@@ -544,24 +544,24 @@
type="number"
name="page"
class="oh-pagination__input"
value="{{ requests.number }}"
value="{{ leave_encashments.number }}"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}"
hx-target="#reimbursementContainer"
min="1"
/>
<span class="oh-pagination__label"
>{% trans 'of' %} {{ requests.paginator.num_pages }}</span
>{% trans 'of' %} {{ leave_encashments.paginator.num_pages }}</span
>
</div>
<ul class="oh-pagination__items">
{% if requests.has_previous %}
{% if leave_encashments.has_previous %}
<li
class="oh-pagination__item oh-pagination__item--wide"
>
<a
hx-target="#reimbursementContainer"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&page=1"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&lpage=1"
class="oh-pagination__link"
>{% trans 'First' %}</a
>
@@ -571,18 +571,18 @@
>
<a
hx-target="#reimbursementContainer"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&lpage={{ requests.previous_page_number }}"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&lpage={{ leave_encashments.previous_page_number }}"
class="oh-pagination__link"
>{% trans 'Previous' %}</a
>
</li>
{% endif %} {% if requests.has_next %}
{% endif %} {% if leave_encashments.has_next %}
<li
class="oh-pagination__item oh-pagination__item--wide"
>
<a
hx-target="#reimbursementContainer"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&lpage={{ requests.next_page_number }}"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&lpage={{ leave_encashments.next_page_number }}"
class="oh-pagination__link"
>{% trans 'Next' %}</a
>
@@ -592,7 +592,7 @@
>
<a
hx-target="#reimbursementContainer"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&page={{ requests.paginator.num_pages }}"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&lpage={{ leave_encashments.paginator.num_pages }}"
class="oh-pagination__link"
>{% trans 'Last' %}</a
>
@@ -742,21 +742,23 @@
</div>
<div class="oh-sticky-table__td">
<div class="oh-btn-group">
{% if perms.attendance.change_attendance or request.user %}
{% if perms.payroll.change_reimbursement or request.user %}
<a
onclick="event.stopPropagation()"
hx-get="{% url 'create-reimbursement' %}?instance_id={{ req.id }}"
hx-target="#reimbursementModalBody"
data-toggle="oh-modal-toggle"
data-target="#reimbursementModal"
class="oh-btn oh-btn--light-bkg w-50"
class="oh-btn oh-btn--light-bkg w-100"
title="{% trans 'Edit' %}"
>
<ion-icon name="create-outline"></ion-icon>
>
<ion-icon name="create-outline"></ion-icon>
</a>
{% endif %}
{% if perms.attendance.delete_attendance %}
{% if perms.payroll.delete_reimbursement %}
<a href="{% url "delete-reimbursement" %}?ids={{req.id}}" onclick="return confirm('Do you want to delete this record?')"
class='w-50 oh-btn oh-btn--danger-outline oh-btn--light-bkg'>
class='w-100 oh-btn oh-btn--danger-outline oh-btn--light-bkg' title='{% trans "Delete" %}'>
<ion-icon name="trash-outline"></ion-icon>
</a>
{% endif %}
@@ -813,7 +815,7 @@
class="oh-pagination__page"
data-toggle="modal"
data-target="#addEmployeeModal"
>{% trans 'Page' %} {{ requests.number }} {% trans 'of' %} {{ requests.paginator.num_pages }}.</span
>{% trans 'Page' %} {{ bonus_encashments.number }} {% trans 'of' %} {{ bonus_encashments.paginator.num_pages }}.</span
>
<nav class="oh-pagination__nav">
@@ -826,24 +828,24 @@
type="number"
name="page"
class="oh-pagination__input"
value="{{ requests.number }}"
value="{{ bonus_encashments.number }}"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}"
hx-target="#reimbursementContainer"
min="1"
/>
<span class="oh-pagination__label"
>{% trans 'of' %} {{ requests.paginator.num_pages }}</span
>{% trans 'of' %} {{ bonus_encashments.paginator.num_pages }}</span
>
</div>
<ul class="oh-pagination__items">
{% if requests.has_previous %}
{% if bonus_encashments.has_previous %}
<li
class="oh-pagination__item oh-pagination__item--wide"
>
<a
hx-target="#reimbursementContainer"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&page=1"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&bpage=1"
class="oh-pagination__link"
>{% trans 'First' %}</a
>
@@ -853,18 +855,18 @@
>
<a
hx-target="#reimbursementContainer"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&page={{ requests.previous_page_number }}"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&bpage={{ bonus_encashments.previous_page_number }}"
class="oh-pagination__link"
>{% trans 'Previous' %}</a
>
</li>
{% endif %} {% if requests.has_next %}
{% endif %} {% if bonus_encashments.has_next %}
<li
class="oh-pagination__item oh-pagination__item--wide"
>
<a
hx-target="#reimbursementContainer"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&bpage={{ requests.next_page_number }}"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&bpage={{ bonus_encashments.next_page_number }}"
class="oh-pagination__link"
>{% trans 'Next' %}</a
>
@@ -874,7 +876,7 @@
>
<a
hx-target="#reimbursementContainer"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&bpage={{ requests.paginator.num_pages }}"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&bpage={{ bonus_encashments.paginator.num_pages }}"
class="oh-pagination__link"
>{% trans 'Last' %}</a
>

View File

@@ -59,7 +59,7 @@
<div class="oh-faq-card" id="requestCard{{ req.id }}">
<div class="d-flex justify-content-between">
<div style="margin-bottom: 10px">
<div class="loan-type" style="display: inline">
<div class="loan-type" style="display: inline; background:hsl(58.85deg 100% 80.93%);">
{{ req.get_type_display }}
</div>
<div class="loan-type"
@@ -261,7 +261,7 @@
class="oh-pagination__page"
data-toggle="modal"
data-target="#addEmployeeModal"
>{% trans 'Page' %} {{ requests.number }} {% trans 'of' %} {{ requests.paginator.num_pages }}.</span
>{% trans 'Page' %} {{ reimbursements.number }} {% trans 'of' %} {{ reimbursements.paginator.num_pages }}.</span
>
<nav class="oh-pagination__nav">
@@ -274,24 +274,24 @@
type="number"
name="page"
class="oh-pagination__input"
value="{{ requests.number }}"
value="{{ reimbursements.number }}"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}"
hx-target="#reimbursementContainer"
min="1"
/>
<span class="oh-pagination__label"
>{% trans 'of' %} {{ requests.paginator.num_pages }}</span
>{% trans 'of' %} {{ reimbursements.paginator.num_pages }}</span
>
</div>
<ul class="oh-pagination__items">
{% if requests.has_previous %}
{% if reimbursements.has_previous %}
<li
class="oh-pagination__item oh-pagination__item--wide"
>
<a
hx-target="#reimbursementContainer"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&page=1"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&rpage=1"
class="oh-pagination__link"
>{% trans 'First' %}</a
>
@@ -301,18 +301,18 @@
>
<a
hx-target="#reimbursementContainer"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&rpage={{ requests.previous_page_number }}"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&rpage={{ reimbursements.previous_page_number }}"
class="oh-pagination__link"
>{% trans 'Previous' %}</a
>
</li>
{% endif %} {% if requests.has_next %}
{% endif %} {% if reimbursements.has_next %}
<li
class="oh-pagination__item oh-pagination__item--wide"
>
<a
hx-target="#reimbursementContainer"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&rpage={{ requests.next_page_number }}"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&rpage={{ reimbursements.next_page_number }}"
class="oh-pagination__link"
>{% trans 'Next' %}</a
>
@@ -322,7 +322,7 @@
>
<a
hx-target="#reimbursementContainer"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&page={{ requests.paginator.num_pages }}"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&rpage={{ reimbursements.paginator.num_pages }}"
class="oh-pagination__link"
>{% trans 'Last' %}</a
>
@@ -355,7 +355,7 @@
<div class="oh-faq-card" id="requestCard{{ req.id }}">
<div class="d-flex justify-content-between">
<div style="margin-bottom: 10px">
<div class="loan-type" style="display: inline">
<div class="loan-type" style="display: inline; background:hsl(58.85deg 100% 80.93%);">
{{ req.get_type_display }}
</div>
<div class="loan-type"
@@ -553,8 +553,8 @@
class="oh-pagination__page"
data-toggle="modal"
data-target="#addEmployeeModal"
>{% trans 'Page' %} {{ requests.number }} {% trans 'of' %}
{{ requests.paginator.num_pages }}.</span
>{% trans 'Page' %} {{ leave_encashments.number }} {% trans 'of' %}
{{ leave_encashments.paginator.num_pages }}.</span
>
<nav class="oh-pagination__nav">
@@ -567,24 +567,24 @@
type="number"
name="page"
class="oh-pagination__input"
value="{{ requests.number }}"
value="{{ leave_encashments.number }}"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}"
hx-target="#reimbursementContainer"
min="1"
/>
<span class="oh-pagination__label"
>{% trans 'of' %} {{ requests.paginator.num_pages }}</span
>{% trans 'of' %} {{ leave_encashments.paginator.num_pages }}</span
>
</div>
<ul class="oh-pagination__items">
{% if requests.has_previous %}
{% if leave_encashments.has_previous %}
<li
class="oh-pagination__item oh-pagination__item--wide"
>
<a
hx-target="#reimbursementContainer"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&page=1"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&lpage=1"
class="oh-pagination__link"
>{% trans 'First' %}</a
>
@@ -594,18 +594,18 @@
>
<a
hx-target="#reimbursementContainer"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&lpage={{ requests.previous_page_number }}"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&lpage={{ leave_encashments.previous_page_number }}"
class="oh-pagination__link"
>{% trans 'Previous' %}</a
>
</li>
{% endif %} {% if requests.has_next %}
{% endif %} {% if leave_encashments.has_next %}
<li
class="oh-pagination__item oh-pagination__item--wide"
>
<a
hx-target="#reimbursementContainer"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&lpage={{ requests.next_page_number }}"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&lpage={{ leave_encashments.next_page_number }}"
class="oh-pagination__link"
>{% trans 'Next' %}</a
>
@@ -615,7 +615,7 @@
>
<a
hx-target="#reimbursementContainer"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&page={{ requests.paginator.num_pages }}"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&lpage={{ leave_encashments.paginator.num_pages }}"
class="oh-pagination__link"
>{% trans 'Last' %}</a
>
@@ -648,7 +648,7 @@
<div class="oh-faq-card" id="requestCard{{ req.id }}">
<div class="d-flex justify-content-between">
<div style="margin-bottom: 10px">
<div class="loan-type" style="display: inline">
<div class="loan-type" style="display: inline; background:hsl(58.85deg 100% 80.93%);">
{{ req.get_type_display }}
</div>
<div class="loan-type"
@@ -847,7 +847,7 @@
class="oh-pagination__page"
data-toggle="modal"
data-target="#addEmployeeModal"
>{% trans 'Page' %} {{ requests.number }} {% trans 'of' %} {{ requests.paginator.num_pages }}.</span
>{% trans 'Page' %} {{ bonus_encashments.number }} {% trans 'of' %} {{ bonus_encashments.paginator.num_pages }}.</span
>
<nav class="oh-pagination__nav">
@@ -860,24 +860,24 @@
type="number"
name="page"
class="oh-pagination__input"
value="{{ requests.number }}"
value="{{ bonus_encashments.number }}"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}"
hx-target="#reimbursementContainer"
min="1"
/>
<span class="oh-pagination__label"
>{% trans 'of' %} {{ requests.paginator.num_pages }}</span
>{% trans 'of' %} {{ bonus_encashments.paginator.num_pages }}</span
>
</div>
<ul class="oh-pagination__items">
{% if requests.has_previous %}
{% if bonus_encashments.has_previous %}
<li
class="oh-pagination__item oh-pagination__item--wide"
>
<a
hx-target="#reimbursementContainer"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&page=1"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&bpage=1"
class="oh-pagination__link"
>{% trans 'First' %}</a
>
@@ -887,18 +887,18 @@
>
<a
hx-target="#reimbursementContainer"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&page={{ requests.previous_page_number }}"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&bpage={{ bonus_encashments.previous_page_number }}"
class="oh-pagination__link"
>{% trans 'Previous' %}</a
>
</li>
{% endif %} {% if requests.has_next %}
{% endif %} {% if bonus_encashments.has_next %}
<li
class="oh-pagination__item oh-pagination__item--wide"
>
<a
hx-target="#reimbursementContainer"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&bpage={{ requests.next_page_number }}"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&bpage={{ bonus_encashments.next_page_number }}"
class="oh-pagination__link"
>{% trans 'Next' %}</a
>
@@ -908,7 +908,7 @@
>
<a
hx-target="#reimbursementContainer"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&bpage={{ requests.paginator.num_pages }}"
hx-get="{% url 'search-reimbursement' %}?{{ pd }}&bpage={{ bonus_encashments.paginator.num_pages }}"
class="oh-pagination__link"
>{% trans 'Last' %}</a
>

View File

@@ -1045,12 +1045,25 @@ def view_loans(request):
This method is used to render template to disply all the loan records
"""
records = LoanAccount.objects.all()
loan = records.filter(type="loan")
adv_salary = records.filter(type="advanced_salary")
fine = records.filter(type="fine")
loan = sortby(request, loan, "sortby")
adv_salary = sortby(request, adv_salary, "sortby")
fine = sortby(request, fine, "sortby")
filter_instance = LoanAccountFilter()
return render(
request,
"payroll/loan/view_loan.html",
{
"records": paginator_qry(records, request.GET.get("page")),
"loan": paginator_qry(loan, request.GET.get("lpage")),
"adv_salary": paginator_qry(
adv_salary, request.GET.get("apage")
),
"fine": paginator_qry(
fine, request.GET.get("fpage")
),
"f": filter_instance,
},
)
@@ -1115,13 +1128,32 @@ def search_loan(request):
Search loan method
"""
records = LoanAccountFilter(request.GET).qs
loan = records.filter(type="loan")
adv_salary = records.filter(type="advanced_salary")
fine = records.filter(type="fine")
loan = sortby(request, loan, "sortby")
adv_salary = sortby(request, adv_salary, "sortby")
fine = sortby(request, fine, "sortby")
data_dict = parse_qs(request.GET.urlencode())
get_key_instances(LoanAccount, data_dict)
view = request.GET.get("view")
template = "payroll/loan/records_card.html"
if view == "list":
template = "payroll/loan/records_list.html"
return render(
request,
"payroll/loan/records.html",
template,
{
"records": paginator_qry(records, request.GET.get("page")),
"loan": paginator_qry(loan, request.GET.get("lpage")),
"adv_salary": paginator_qry(
adv_salary, request.GET.get("apage")
),
"fine": paginator_qry(
fine, request.GET.get("fpage")
),
"filter_dict": data_dict,
"pd": request.GET.urlencode(),
},