[UPDT] OFFBOARDING: Enable/ Disable resignation
This commit is contained in:
@@ -3,8 +3,16 @@
|
||||
.oh-general__tab{
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
|
||||
.reisgn-status {
|
||||
background: #73bbe12b;
|
||||
font-size: 0.8rem;
|
||||
padding: 4px 8px;
|
||||
border-radius: 10px;
|
||||
margin-bottom: 6px;
|
||||
font-weight: 600;
|
||||
color: #357579;
|
||||
}
|
||||
.enlarge-image-container {
|
||||
display: none;
|
||||
position: fixed;
|
||||
@@ -282,7 +290,7 @@
|
||||
<li data-cell-index="10" data-cell-title="{% trans "Bonus Points" %}" class="oh-general__tab">
|
||||
<a
|
||||
hx-get={% url 'bonus-points-tab' employee.id %}
|
||||
hx-target="#bonus_points_target"
|
||||
hx-target="#resignation_hx_target"
|
||||
data-action="general-tab"
|
||||
data-target="#bonus_points_target"
|
||||
class="oh-general__tab-link"
|
||||
@@ -290,6 +298,20 @@
|
||||
>{% trans "Bonus Points" %}</a
|
||||
>
|
||||
</li>
|
||||
{% if enabled_resignation_request %}
|
||||
<li data-cell-index="09" data-cell-title="{% trans "Resignation" %}" class="oh-general__tab">
|
||||
<a
|
||||
hx-get={% url 'search-resignation-request' %}
|
||||
hx-target="#resignation_hx_target"
|
||||
data-action="general-tab"
|
||||
data-target="#resignation_target"
|
||||
class="oh-general__tab-link"
|
||||
role="button"
|
||||
>{% trans "Resignation" %}</a
|
||||
>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
</ul>
|
||||
|
||||
<div
|
||||
@@ -312,12 +334,19 @@
|
||||
<div
|
||||
class="oh-general__tab-target oh-profile__info-tab mb-4 d-none"
|
||||
id="bonus_points_target"
|
||||
>
|
||||
>
|
||||
{% include "tabs/bonus_points.html" %}
|
||||
</div>
|
||||
<div
|
||||
class="oh-general__tab-target oh-profile__info-tab mb-4 d-none"
|
||||
id="allowance_deduction"
|
||||
class="oh-general__tab-target oh-profile__info-tab mt-3 mb-4 d-none"
|
||||
id="resignation_target"
|
||||
>
|
||||
{% include "tabs/resignation.html" %}
|
||||
<div id="resignation_hx_target"></div>
|
||||
</div>
|
||||
<div
|
||||
class="oh-general__tab-target oh-profile__info-tab mb-4 d-none"
|
||||
id="allowance_deduction"
|
||||
>
|
||||
</div>
|
||||
<div class="oh-general__tab-target oh-profile__info-tab mb-4 d-none"
|
||||
|
||||
17
employee/templates/tabs/resignation.html
Normal file
17
employee/templates/tabs/resignation.html
Normal file
@@ -0,0 +1,17 @@
|
||||
{% load i18n %}
|
||||
{% if enabled_resignation_request %}
|
||||
<div class="d-flex flex-row-reverse oh-wrapper">
|
||||
<a hx-get="{% url 'create-resignation-request' %}" hx-target="#resignationModalBody" data-toggle="oh-modal-toggle" data-target="#resignationModal" class="oh-btn oh-btn--secondary">
|
||||
<ion-icon name="add-outline"></ion-icon>
|
||||
{% trans 'Create' %}
|
||||
</a>
|
||||
</div>
|
||||
<div class="oh-modal" id="resignationModal" 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="resignationModalBody"></div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
@@ -6,7 +6,12 @@ This module is used to write custom authentication decorators for offboarding mo
|
||||
from django.contrib import messages
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from horilla.decorators import decorator_with_arguments
|
||||
from offboarding.models import Offboarding, OffboardingStage, OffboardingTask
|
||||
from offboarding.models import (
|
||||
Offboarding,
|
||||
OffboardingGeneralSetting,
|
||||
OffboardingStage,
|
||||
OffboardingTask,
|
||||
)
|
||||
|
||||
|
||||
@decorator_with_arguments
|
||||
@@ -61,3 +66,16 @@ def offboarding_or_stage_manager_can_enter(function, perm):
|
||||
return HttpResponse("<script>window.location.reload()</script>")
|
||||
|
||||
return _function
|
||||
|
||||
|
||||
@decorator_with_arguments
|
||||
def check_feature_endabled(function, feature_name):
|
||||
def _function(request, *args, **kwargs):
|
||||
general_setting = OffboardingGeneralSetting.objects.first()
|
||||
enabled = getattr(general_setting, feature_name, False)
|
||||
if enabled:
|
||||
return function(request, *args, **kwargs)
|
||||
messages.info(request, "Feature is not enabled on the settings")
|
||||
return HttpResponse("<script>window.location.reload()</script>")
|
||||
|
||||
return _function
|
||||
|
||||
@@ -9,6 +9,7 @@ from horilla.decorators import login_required, permission_required
|
||||
from base.views import paginator_qry
|
||||
from offboarding.decorators import (
|
||||
any_manager_can_enter,
|
||||
check_feature_endabled,
|
||||
offboarding_manager_can_enter,
|
||||
offboarding_or_stage_manager_can_enter,
|
||||
)
|
||||
@@ -478,6 +479,7 @@ def offboarding_individual_view(request, emp_id):
|
||||
|
||||
@login_required
|
||||
@permission_required("offboarding.view_resignationletter")
|
||||
@check_feature_endabled("resignation_request")
|
||||
def request_view(request):
|
||||
"""
|
||||
This method is used to view the resignation request
|
||||
@@ -499,6 +501,7 @@ def request_view(request):
|
||||
|
||||
|
||||
@login_required
|
||||
@check_feature_endabled("resignation_request")
|
||||
def search_resignation_request(request):
|
||||
"""
|
||||
This method is used to search/filter the letter
|
||||
@@ -522,6 +525,7 @@ def search_resignation_request(request):
|
||||
|
||||
|
||||
@login_required
|
||||
@check_feature_endabled("resignation_request")
|
||||
@permission_required("offboarding.delete_resignationletter")
|
||||
def delete_resignation_request(request):
|
||||
"""
|
||||
@@ -532,7 +536,8 @@ def delete_resignation_request(request):
|
||||
messages.success(request, "Resignation letter deleted")
|
||||
return redirect(request_view)
|
||||
|
||||
|
||||
@login_required
|
||||
@check_feature_endabled("resignation_request")
|
||||
def create_resignation_request(request):
|
||||
"""
|
||||
This method is used to render form to create resignation requests
|
||||
@@ -552,6 +557,7 @@ def create_resignation_request(request):
|
||||
|
||||
|
||||
@login_required
|
||||
@check_feature_endabled("resignation_request")
|
||||
@permission_required("offboarding.change_resignationletter")
|
||||
def update_status(request):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user