From df03cdc54e17b9dd1e2e905cec9b2fb45f1e9fd7 Mon Sep 17 00:00:00 2001 From: Horilla Date: Thu, 23 May 2024 14:29:29 +0530 Subject: [PATCH] [ADD] GENERAL: White labelling --- base/context_processors.py | 25 +++++++++++++++++++ .../base/auth/password_change_form.html | 4 +-- horilla/horilla_apps.py | 2 ++ horilla/horilla_context_processors.py | 3 +++ .../onboarding/employee_bank_details.html | 5 +++- .../onboarding/employee_creation.html | 5 +++- .../templates/onboarding/profile_view.html | 5 +++- .../templates/onboarding/user_creation.html | 5 +++- .../templates/onboarding/welcome_aboard.html | 5 +++- .../templates/candidate/application_form.html | 2 +- .../recruitment/open_recruitments.html | 5 +++- recruitment/views/dashboard.py | 2 +- templates/404.html | 5 +++- templates/forgot_password.html | 5 +++- templates/index.html | 12 ++++----- templates/login.html | 9 ++++--- templates/no_perm.html | 5 +++- templates/reset_password.html | 5 +++- templates/went_wrong.html | 5 +++- 19 files changed, 88 insertions(+), 26 deletions(-) diff --git a/base/context_processors.py b/base/context_processors.py index d7f2c25d1..d2a911f48 100644 --- a/base/context_processors.py +++ b/base/context_processors.py @@ -11,6 +11,7 @@ from attendance.models import AttendanceGeneralSetting from base.models import Company from base.urls import urlpatterns from employee.models import EmployeeGeneralSetting +from horilla import horilla_apps from offboarding.models import OffboardingGeneralSetting from payroll.models.models import PayrollGeneralSetting from recruitment.models import RecruitmentGeneralSetting @@ -99,6 +100,30 @@ urlpatterns.append( ) +def white_labelling_company(request): + white_labelling = getattr(horilla_apps, "WHITE_LABELLING", False) + if white_labelling: + hq = Company.objects.filter(hq=True).last() + try: + company = ( + request.user.employee_get.get_company() + if request.user.employee_get.get_company() + else hq + ) + except: + company = hq + + return { + "white_label_company_name": company.company if company else "Horilla", + "white_label_company": company, + } + else: + return { + "white_label_company_name": "Horilla", + "white_label_company": None, + } + + def resignation_request_enabled(request): """ Check weather resignation_request enabled of not in offboarding diff --git a/base/templates/base/auth/password_change_form.html b/base/templates/base/auth/password_change_form.html index 498a32070..902c45257 100644 --- a/base/templates/base/auth/password_change_form.html +++ b/base/templates/base/auth/password_change_form.html @@ -101,9 +101,7 @@ Horilla diff --git a/horilla/horilla_apps.py b/horilla/horilla_apps.py index eda747708..d0ee0350e 100644 --- a/horilla/horilla_apps.py +++ b/horilla/horilla_apps.py @@ -49,3 +49,5 @@ SIDEBARS = [ "asset", "helpdesk", ] + +WHITE_LABELLING = False diff --git a/horilla/horilla_context_processors.py b/horilla/horilla_context_processors.py index af7ab5779..8984ca0e6 100644 --- a/horilla/horilla_context_processors.py +++ b/horilla/horilla_context_processors.py @@ -12,6 +12,9 @@ TEMPLATES[0]["OPTIONS"]["context_processors"].append( TEMPLATES[0]["OPTIONS"]["context_processors"].append( "base.context_processors.get_companies", ) +TEMPLATES[0]["OPTIONS"]["context_processors"].append( + "base.context_processors.white_labelling_company", +) TEMPLATES[0]["OPTIONS"]["context_processors"].append( "base.context_processors.resignation_request_enabled", ) diff --git a/onboarding/templates/onboarding/employee_bank_details.html b/onboarding/templates/onboarding/employee_bank_details.html index f1cfd22da..74872d065 100644 --- a/onboarding/templates/onboarding/employee_bank_details.html +++ b/onboarding/templates/onboarding/employee_bank_details.html @@ -7,7 +7,10 @@ - Employee Onboarding - Horilla Dashboard + Employee Onboarding - {{white_label_company_name}} Dashboard + + + diff --git a/onboarding/templates/onboarding/employee_creation.html b/onboarding/templates/onboarding/employee_creation.html index d2c3df676..6ec8b677c 100644 --- a/onboarding/templates/onboarding/employee_creation.html +++ b/onboarding/templates/onboarding/employee_creation.html @@ -6,7 +6,10 @@ - Employee Onboarding - Horilla Dashboard + Employee Onboarding - {{white_label_company_name}} Dashboard + + + diff --git a/onboarding/templates/onboarding/profile_view.html b/onboarding/templates/onboarding/profile_view.html index 3bd31bb9b..a7d7e7871 100644 --- a/onboarding/templates/onboarding/profile_view.html +++ b/onboarding/templates/onboarding/profile_view.html @@ -6,7 +6,10 @@ - Employee Onboarding - Horilla Dashboard + Employee Onboarding - {{white_label_company_name}} Dashboard + + + diff --git a/onboarding/templates/onboarding/user_creation.html b/onboarding/templates/onboarding/user_creation.html index 438cb1487..a4c441654 100644 --- a/onboarding/templates/onboarding/user_creation.html +++ b/onboarding/templates/onboarding/user_creation.html @@ -7,7 +7,10 @@ - Employee Onboarding - Horilla Dashboard + Employee Onboarding - {{white_label_company_name}} Dashboard + + +