From 93d3256dc4f1276a295e38f6e07f2f4fe707482c Mon Sep 17 00:00:00 2001 From: Horilla Date: Thu, 25 Jan 2024 16:36:49 +0530 Subject: [PATCH] [UPDT] GENERAL: Context processors --- base/context_processors.py | 12 ++++++++++++ base/templates/base/general_settings.html | 1 + horilla/horilla_context_processors.py | 3 +++ templates/sidebar.html | 2 +- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/base/context_processors.py b/base/context_processors.py index 507cd2c18..2d4816fbf 100644 --- a/base/context_processors.py +++ b/base/context_processors.py @@ -7,6 +7,7 @@ from django.urls import path from django.http import HttpResponse from base.models import Company from base.urls import urlpatterns +from offboarding.models import OffboardingGeneralSetting class AllCompany: @@ -90,3 +91,14 @@ urlpatterns.append( name="update-selected-company", ) ) + + +def resignation_request_enabled(request): + """ + Check weather resignation_request enabled of not in offboarding + """ + first = OffboardingGeneralSetting.objects.first() + enabled_resignation_request = True + if first: + enabled_resignation_request = first.resignation_request + return {"enabled_resignation_request": enabled_resignation_request} diff --git a/base/templates/base/general_settings.html b/base/templates/base/general_settings.html index cba2dbae0..4022c2afc 100644 --- a/base/templates/base/general_settings.html +++ b/base/templates/base/general_settings.html @@ -2,5 +2,6 @@ {% include "announcement/expiry_day.html" %} +{% include "offboarding/settings/settings.html" %} {% endblock settings %} \ No newline at end of file diff --git a/horilla/horilla_context_processors.py b/horilla/horilla_context_processors.py index 2dd13736c..1e0f703ff 100644 --- a/horilla/horilla_context_processors.py +++ b/horilla/horilla_context_processors.py @@ -8,3 +8,6 @@ from horilla.settings import TEMPLATES TEMPLATES[0]["OPTIONS"]["context_processors"].append( "base.context_processors.get_companies", ) +TEMPLATES[0]["OPTIONS"]["context_processors"].append( + "base.context_processors.resignation_request_enabled", +) diff --git a/templates/sidebar.html b/templates/sidebar.html index 007d82b7f..74a592a3d 100755 --- a/templates/sidebar.html +++ b/templates/sidebar.html @@ -788,7 +788,7 @@ >{% trans "Pipeline" %} - {% if perms.offboarding.view_resignationletter %} + {% if perms.offboarding.view_resignationletter and enabled_resignation_request %}