Skip to content

Commit

Permalink
[ADD] LEAVE: An alert message at time of leave request creation if em…
Browse files Browse the repository at this point in the history
…ployee have a scheduled interview in the requesting date range and an indication for the request
  • Loading branch information
horilla-opensource committed May 3, 2024
1 parent 5f68045 commit 3c32335
Show file tree
Hide file tree
Showing 13 changed files with 524 additions and 96 deletions.
12 changes: 12 additions & 0 deletions leave/templates/leave/leave_request/group_by.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,18 @@
</div>
</div>
<div class="oh-sticky-table__td">
{% if leave_request in leave_requests_with_interview %}
<div class="d-flex" style="flex-direction: row-reverse; margin-bottom:-25px;">
<span class="tooltip">
<span class="material-symbols-outlined d-flex" style="flex-direction: row-reverse;color:#ff9146;">
warning
</span>
<span class="tooltiptext fw-bold">
{{leave_request.employee_id}}&nbsp {% trans "has an interview in this requested date range." %}
</span>
</span>
</div>
{% endif %}
<div class="oh-profile oh-profile--md">
<div class="oh-profile__avatar mr-1">
<img src="{{leave_request.employee_id.get_avatar}}" class="oh-profile__image"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</div>
<div class="oh-modal__dialog-body">
<form
hx-post="{% url 'request-creation' %}?{{pd}}"
hx-post="{% url 'request-creation' %}?confirm={{confirm}}&{{pd}}"
hx-encoding="multipart/form-data"
hx-target="#objectCreateModalTarget"
>
Expand Down
14 changes: 14 additions & 0 deletions leave/templates/leave/leave_request/leave_requests.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,20 @@
</div>
{% endif %}
<div class="oh-sticky-table__td">

{% if leave_request in leave_requests_with_interview %}
<div class="d-flex" style="flex-direction: row-reverse; margin-bottom:-25px;">
<span class="tooltip">
<span class="material-symbols-outlined" style="flex-direction: row-reverse;color:#ff9146;">
warning
</span>
<span class="tooltiptext fw-bold">
{{leave_request.employee_id}}&nbsp {% trans "has an interview in this requested date range." %}
</span>
</span>
</div>
{% endif %}

<div class="oh-profile oh-profile--md">
<div class="oh-profile__avatar mr-1">
<img src="{{leave_request.employee_id.get_avatar}}" class="oh-profile__image"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h2 class="oh-modal__dialog-title" id="objectUpdateModalLabel">
</div>
<div class="oh-modal__dialog-body">
<form
hx-post="{% url 'request-update' id %}"
hx-post="{% url 'request-update' id %}?confirm={{confirm}}"
hx-encoding="multipart/form-data"
hx-target="#objectUpdateModalTarget"
>
Expand Down
56 changes: 44 additions & 12 deletions leave/templates/leave/leave_request/request_view.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,52 @@
{% extends 'index.html' %} {% block content %} {% load static %} {% load i18n %} {% load basefilters %}
<style>
.diff-cell {
background: #d7d7d7 !important;
background: #d7d7d7 !important;
}
.oh-modal_close--custom {
border: none;
background: none;
font-size: 1.5rem;
opacity: 0.7;
position: absolute;
top: 25px;
right: 15px;
}
.oh-sticky-table__th {
width:180px;
}
.oh-modal_close--custom {
border: none;
background: none;
font-size: 1.5rem;
opacity: 0.7;
position: absolute;
top: 25px;
right: 15px;

.tooltip {
position: relative;
display: inline-block; /* Ensures that the tooltip container doesn't stretch to the full width */
}

.tooltip .tooltiptext {
visibility: hidden;
width: auto; /* Allow the tooltip width to adjust based on content */
max-width: auto; /* Limit the maximum width of the tooltip to prevent it from overflowing */
background-color: hsl(8,77%,56%);
color: white;
text-align: center;
border-radius: 6px;
padding: 5px;
position: absolute;
z-index: 1;
bottom: 5%;
left: 50%;
transform: translateX(5%);
opacity: 0;
transition: opacity 0.3s;
white-space: nowrap; /* Prevents the text from wrapping */
overflow: hidden; /* Hides any overflowed content */
font-size:15px;
}
.oh-sticky-table__th {
width:180px;
}

.tooltip:hover .tooltiptext {
visibility: visible;
opacity: 1;
}

</style>

<section class="oh-wrapper oh-main__topbar" x-data="{searchShow: false}">
Expand Down
13 changes: 13 additions & 0 deletions leave/templates/leave/user_leave/group_by.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,19 @@
</div>
</div>
<div class="oh-sticky-table__td">

{% if leave_request in leave_requests_with_interview %}
<div class="d-flex" style="flex-direction: row-reverse; margin-bottom:-30px;">
<span class="tooltip">
<span class="material-symbols-outlined" style="flex-direction: row-reverse;color:#ff9146;">
warning
</span>
<span class="tooltiptext fw-bold">
You have an interview in this requested date range.
</span>
</span>
</div>
{% endif %}
<div class="oh-profile oh-profile--md">
<div class="oh-profile__avatar mr-1">
<img src="{{leave_request.leave_type_id.get_avatar}}" class="oh-profile__image"
Expand Down
2 changes: 1 addition & 1 deletion leave/templates/leave/user_leave/request_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h2 class="oh-modal__dialog-title" id="editDialogDialog">
</div>
<div class="oh-modal__dialog-body">
<form
hx-post="{% url 'leave-request-create' %}?{{pd}}"
hx-post="{% url 'leave-request-create' %}?confirm={{confirm}}&{{pd}}"
hx-target="#objectCreateModalTarget"
hx-encoding="multipart/form-data"
>
Expand Down
120 changes: 120 additions & 0 deletions leave/templates/leave/user_leave/user_leave_confirm.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
{% load i18n %}
<div
class="oh-modal oh-modal--show"
role="dialog"
id="confirmModal"
aria-labelledby="confirmModalLabel"
aria-hidden="true"
>
<div
class="oh-modal__dialog oh-modal__dialog--confirm"
style="max-width: 512px; border-radius:25px;"
>
<p class="swal2-close"></p>
<ul class="swal2-progress-steps" style="display: none"></ul>
<div class="swal2-icon swal2-info swal2-icon-show" style="display: flex">
<div class="swal2-icon-content">!</div>
</div>
<h2 class="swal2-title" id="swal2-title">{{title}}</h2>
<div
class="swal2-html-container"
id="swal2-html-container"
style="display: block"
>
<p style="font-size:18px;">{{employee.employee_id}} {% trans "has interview in the requested date." %}</p>
</div>

<div class="ms-5">
{% for i in interview %}
<div class="d-flex">
<span class="d-flex" style="font-size:16px;">{{forloop.counter}}.</span> &nbsp<p style="font-size:16px;">{{i}}</p>
</div>
{% endfor %}
</div>

<h2 class="swal2-title" style="font-size:22px;" id="swal2-title">{% trans "Are you sure want to proceed with the request ?" %}</h2>
<div class="swal2-actions" style="display: flex">
<div class="swal2-loader"></div>
{% if admin %}
<button
class="swal2-deny swal2-styled mb-4"
data-toggle="oh-modal-toggle"
data-target="#objectCreateModal"
hx-get="{% url 'request-creation' %}?confirm=True"
hx-target="#objectCreateModalTarget"
style="display: inline-block;background-color:#008000;"
>
{% trans "Yes" %}
</button>
{% elif update_admin %}
<button
class="swal2-deny swal2-styled mb-4"
data-toggle="oh-modal-toggle"
data-target="#objectUpdateModal" hx-get="{% url 'request-update' id %}?confirm=True"
hx-target="#objectUpdateModalTarget"
style="display: inline-block;background-color:#008000;"
>
{% trans "Yes" %}
</button>
{% elif update %}
<button
class="swal2-deny swal2-styled mb-4"
data-toggle="oh-modal-toggle"
data-target="#objectUpdateModal" hx-get="{% url 'user-request-update' id %}?confirm=True"
hx-target="#objectUpdateModalTarget"
style="display: inline-block;background-color:#008000;"
>
{% trans "Yes" %}
</button>
{% elif id %}
<button
class="swal2-deny swal2-styled mb-4"
data-toggle="oh-modal-toggle"
data-target="#objectCreateModal"
hx-get="{% url 'user-request' id %}?confirm=True"
hx-target="#objectCreateModalTarget"
style="display: inline-block;background-color:#008000;"
>
{% trans "Yes" %}
</button>
{% else %}
<button
class="swal2-deny swal2-styled mb-4"
data-toggle="oh-modal-toggle"
data-target="#objectCreateModal"
hx-get="{% url 'leave-request-create' %}?confirm=True"
hx-target="#objectCreateModalTarget"
style="display: inline-block;background-color:#008000;"
>
{% trans "Yes" %}
</button>
{% endif %}
<button
type="button"
class="swal2-confirm swal2-styled oh-modal__cancel mb-4"
aria-label=""
style="display: inline-block;background-color:#d33;"
>
{% trans "No" %}
</button>
</div>
</div>
</div>
<script>
$(document).ready(function (e) {
$("#replaceEmployeeForm").submit(function (e) {
var empId = $("#replaceEmployeeForm").attr("data-id");
$(".manager-select").each(function () {
var selectElement = $(this);
var managerId = selectElement.val();
var errorElementId = selectElement.data("error");
if (empId === managerId) {
$("#" + errorElementId).css("display", "inline-flex");
event.preventDefault();
} else {
$("#" + errorElementId).css("display", "none");
}
});
});
});
</script>
2 changes: 1 addition & 1 deletion leave/templates/leave/user_leave/user_request_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</button>
</div>
<form
hx-post="{% url 'user-request' id %}?{{pd}}"
hx-post="{% url 'user-request' id %}?confirm={{confirm}}&{{pd}}"
hx-target="#objectCreateModalTarget"
hx-encoding="multipart/form-data"
>
Expand Down
2 changes: 1 addition & 1 deletion leave/templates/leave/user_leave/user_request_update.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</div>
<div class="oh-modal__dialog-body">
<form
hx-post="{% url 'user-request-update' id %}?{{pd}}"
hx-post="{% url 'user-request-update' id %}?confirm={{confirm}}&{{pd}}"
hx-encoding="multipart/form-data"
hx-target="#objectUpdateModalTarget"
>
Expand Down
33 changes: 32 additions & 1 deletion leave/templates/leave/user_leave/user_request_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,37 @@
.diff-cell {
background: rgba(255, 166, 0, 0.158);
}
.tooltip {
position: relative;
display: inline-block; /* Ensures that the tooltip container doesn't stretch to the full width */
}

.tooltip .tooltiptext {
visibility: hidden;
width: auto; /* Allow the tooltip width to adjust based on content */
max-width: auto; /* Limit the maximum width of the tooltip to prevent it from overflowing */
background-color: hsl(8,77%,56%);
color: white;
text-align: center;
border-radius: 6px;
padding: 5px;
position: absolute;
z-index: 1;
bottom: 5%;
left: 50%;
transform: translateX(5%);
opacity: 0;
transition: opacity 0.3s;
white-space: nowrap; /* Prevents the text from wrapping */
overflow: hidden; /* Hides any overflowed content */
font-size:15px;
}

.tooltip:hover .tooltiptext {
visibility: visible;
opacity: 1;
}

</style>

<section class="oh-wrapper oh-main__topbar" x-data="{searchShow: false}">
Expand Down Expand Up @@ -218,7 +249,7 @@ <h1 class="oh-main__titlebar-title fw-bold">
class="oh-btn oh-btn--secondary oh-btn--shadow"
data-toggle="oh-modal-toggle"
data-target="#objectCreateModal"
hx-get="{% url 'leave-request-create' %}"
hx-get="{% url 'leave-request-create' %}?confirm={{confirm}}"
hx-target="#objectCreateModalTarget"
>
<ion-icon
Expand Down
14 changes: 14 additions & 0 deletions leave/templates/leave/user_leave/user_requests.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,20 @@
</div>
</div>
<div class="oh-sticky-table__td">

{% if leave_request in leave_requests_with_interview %}
<div class="d-flex" style="flex-direction: row-reverse; margin-bottom:-30px;">
<span class="tooltip">
<span class="material-symbols-outlined" style="flex-direction: row-reverse;color:#ff9146;">
warning
</span>
<span class="tooltiptext fw-bold">
{% trans "You have an interview in this requested date range." %}
</span>
</span>
</div>
{% endif %}

<div class="oh-profile oh-profile--md">
<div class="oh-profile__avatar mr-1">
<img src="{{leave_request.leave_type_id.get_avatar}}" class="oh-profile__image"
Expand Down
Loading

0 comments on commit 3c32335

Please sign in to comment.