[UPDT] LEAVE: Group by select issue in assigned leave and filter form reloading

This commit is contained in:
Horilla
2024-02-16 16:43:37 +05:30
parent 23ee1ea5ab
commit 11dc624785
8 changed files with 62 additions and 32 deletions

View File

@@ -11,20 +11,20 @@
<ion-icon name="search-outline" class="oh-main__titlebar-serach-icon"></ion-icon>
</a>
</div>
<div class="oh-main__titlebar oh-main__titlebar--right">
{% if company_leaves %}
<div class="oh-input-group oh-input__search-group" :class="searchShow ? 'oh-input__search-group--show' : ''">
<ion-icon name="search-outline" class="oh-input-group__icon oh-input-group__icon--left"></ion-icon>
<input type="text" class="oh-input oh-input__icon" aria-label="Search Input"
placeholder="{% trans 'Search' %}" name="search" hx-get="{% url 'company-leave-filter' %}"
hx-trigger="keyup" hx-target="#companyLeave" id="search" />
</div>
<div class="oh-main__titlebar-button-container">
<div class="oh-dropdown" x-data="{open: false}">
<button class="oh-btn ml-2" @click="open = !open">
<ion-icon name="filter" class="mr-1"></ion-icon>{% trans "Filter" %}<div id="filterCount"></div>
</button>
<form hx-get="{% url 'company-leave-filter' %}" hx-target="#companyLeave" id="filterForm">
<form hx-get="{% url 'company-leave-filter' %}" hx-target="#companyLeave" id="filterForm" onsubmit="event.preventDefault()">
<div class="oh-main__titlebar oh-main__titlebar--right">
{% if company_leaves %}
<div class="oh-input-group oh-input__search-group" :class="searchShow ? 'oh-input__search-group--show' : ''">
<ion-icon name="search-outline" class="oh-input-group__icon oh-input-group__icon--left"></ion-icon>
<input type="text" class="oh-input oh-input__icon" aria-label="Search Input"
placeholder="{% trans 'Search' %}" name="search" onkeyup="$('.filterButton').click()" id="search" />
</div>
<div class="oh-main__titlebar-button-container">
<div class="oh-dropdown" x-data="{open: false}">
<button class="oh-btn ml-2" @click="open = !open" onclick="event.preventDefault()">
<ion-icon name="filter" class="mr-1"></ion-icon>{% trans "Filter" %}<div id="filterCount"></div>
</button>
<div class="oh-dropdown__menu oh-dropdown__menu--right oh-dropdown__filter p-4" x-show="open"
@click.outside="open = false" style="display: none;">
<div class="oh-dropdown__filter-body">
@@ -48,30 +48,29 @@
</div>
</div>
</div>
<div class="oh-dropdown__filter-footer">
<button class="oh-btn oh-btn--secondary oh-btn--small w-100 filterButton" type="submit">{% trans "Filter" %}</button>
</div>
</div>
</form>
</div>
{% endif %}
{% if perms.leave.add_companyleave %}
<div class="oh-btn-group ml-2">
<div class="oh-dropdown" x-data="{open: false}">
<button class="oh-btn oh-btn--secondary oh-btn--shadow" data-toggle="oh-modal-toggle"
data-target="#editModal1" hx-get="{% url 'company-leave-creation' %}"
hx-target="#companyLeaveForm">
<ion-icon name="add-outline" class="me-1"></ion-icon>
{% trans "Create" %}
</button>
</div>
</div>
{% endif %}
{% endif %}
{% if perms.leave.add_companyleave %}
<div class="oh-btn-group ml-2">
<div class="oh-dropdown" x-data="{open: false}">
<button class="oh-btn oh-btn--secondary oh-btn--shadow" data-toggle="oh-modal-toggle"
data-target="#editModal1" hx-get="{% url 'company-leave-creation' %}"
hx-target="#companyLeaveForm">
<ion-icon name="add-outline" class="me-1"></ion-icon>
{% trans "Create" %}
</button>
</div>
</div>
{% endif %}
</div>
</div>
</div>
</form>
</section>
<div class="oh-wrapper" id="companyLeave">

View File

@@ -1,5 +1,5 @@
{% load i18n %}
<form hx-get="{% url 'holiday-filter' %}" hx-target="#holidays" id="filterForm">
<form hx-get="{% url 'holiday-filter' %}" hx-target="#holidays" id="filterForm" onsubmit="event.preventDefault()">
<div
class="oh-dropdown__menu oh-dropdown__menu--right oh-dropdown__filter p-4"
x-show="open"

View File

@@ -55,6 +55,7 @@
hx-target="#view-container"
id="filterForm"
class="d-flex"
onsubmit="event.preventDefault()"
>
<div
class="oh-input-group oh-input__search-group"

View File

@@ -124,6 +124,7 @@
hx-target="#assignedLeaves"
id="filterForm"
class="d-flex"
onsubmit="event.preventDefault()"
>
{% if available_leaves %}
<div

View File

@@ -208,4 +208,21 @@
</nav>
</div>
</div>
<script>
$(document).ready(function () {
tickLeaveCheckboxes();
$(".all-assigned-leaves-row").change(function () {
addingAssignedLeaveIds();
});
$(".all-assigned-leaves").change(function () {
$(this).closest(".oh-sticky-table__tr").removeClass("highlight-selected");
if ($(this).is(":checked")) {
$(this).closest(".oh-sticky-table__tr").addClass("highlight-selected");
}
addingAssignedLeaveIds();
});
});
</script>

View File

@@ -42,6 +42,7 @@
hx-target="#leaveRequest"
id="filterForm"
class="d-flex"
onsubmit = "event.preventDefault()"
>
<div
class="oh-input-group oh-input__search-group"
@@ -146,6 +147,14 @@
style="display: none"
>
<ul class="oh-dropdown__items">
<li class="oh-dropdown__item">
<a
href="#"
class="oh-dropdown__link"
id="leaveRequestsBulkApprove"
>{% trans "Bulk Approve" %}</a
>
</li>
<li class="oh-dropdown__item">
<a
href="#"
@@ -199,6 +208,7 @@
>
{% trans "Selected Requests" %}
</div>
<span id="bulkApproveSpan" hx-post="{% url 'leave-requests-bulk-approve' %}" hx-target="#leaveRequest"></span>
<div class="oh-wrapper" id="leaveRequest">
{% if leave_requests %}

View File

@@ -34,6 +34,7 @@
hx-target="#leaveTypes"
id="filterForm"
class="d-flex"
onsubmit = "event.preventDefault()"
>
<div
class="oh-input-group oh-input__search-group"

View File

@@ -30,6 +30,7 @@
hx-target="#userRequest"
id="filterForm"
class="d-flex"
onsubmit="event.preventDefault()"
>
<div
class="oh-input-group oh-input__search-group"