From 5258871866d7744cae8fe6017abf7783a8eedd22 Mon Sep 17 00:00:00 2001 From: Horilla Date: Mon, 20 Oct 2025 17:36:17 +0530 Subject: [PATCH] Merge master --- base/cbv/holidays.py | 51 +++--- base/forms.py | 4 +- .../cbv/holidays/detail_view_actions.html | 55 ++++--- .../cbv/holidays/holidays_actions.html | 42 +++-- .../cbv/holidays/holidays_export.html | 152 +++++++++--------- base/templates/holiday/holiday_form.html | 10 +- .../horilla_widgets/select_option.html | 2 +- .../candidate/candidate_rejection_form.html | 2 +- 8 files changed, 167 insertions(+), 151 deletions(-) diff --git a/base/cbv/holidays.py b/base/cbv/holidays.py index b8ea7b722..da950e371 100644 --- a/base/cbv/holidays.py +++ b/base/cbv/holidays.py @@ -58,8 +58,7 @@ class HolidayListView(HorillaListView): ] header_attrs = { - "name": """ style="width:200px !important;" - """, + "name": """ style="width:200px !important;" """, } sortby_mapping = [ @@ -69,13 +68,11 @@ class HolidayListView(HorillaListView): ] row_attrs = """ - hx-get='{detail_view}?instance_ids={ordered_ids}' - hx-target="#genericModalBody" - data-target="#genericModal" - data-toggle="oh-modal-toggle" - """ - - records_per_page = 10 + hx-get='{detail_view}?instance_ids={ordered_ids}' + hx-target="#genericModalBody" + data-target="#genericModal" + data-toggle="oh-modal-toggle" + """ @method_decorator(login_required, name="dispatch") @@ -98,31 +95,26 @@ class HolidayNavView(HorillaNavView): { "action": _("Import"), "attrs": """ - onclick=" - importHolidays(); - " - data-toggle = "oh-modal-toggle" - data-target = "#holidayImport - " - style="cursor: pointer;" - """, + onclick="importHolidays();" + data-toggle = "oh-modal-toggle" + data-target = "#holidayImport" + style="cursor: pointer;" + """, }, { "action": _("Export"), "attrs": f""" - data-toggle = "oh-modal-toggle" - data-target = "#genericModal" - hx-target="#genericModalBody" - hx-get ="{reverse('holiday-nav-export')}" - style="cursor: pointer;" - """, + data-toggle = "oh-modal-toggle" + data-target = "#genericModal" + hx-target="#genericModalBody" + hx-get ="{reverse('holiday-nav-export')}" + style="cursor: pointer;" + """, }, { "action": _("Delete"), "attrs": """ - onclick=" - bulkDeleteHoliday(); - " + onclick="bulkDeleteHoliday();" data-action ="delete" style="cursor: pointer; color:red !important" """, @@ -146,12 +138,13 @@ class HolidayDetailView(HorillaDetailedView): title = _("Details") header = {"title": "name", "subtitle": "", "avatar": "get_avatar"} - body = { + body = [ (_("Holiday Name"), "name"), (_("Start Date"), "start_date"), (_("End Date"), "end_date"), (_("Recurring"), "get_recurring_status"), - } + (_("Company"), "company_id"), + ] action_method = "detail_view_actions" @@ -179,7 +172,7 @@ class HolidayExport(TemplateView): @method_decorator(login_required, name="dispatch") -@method_decorator(permission_required("leave.add_holiday"), name="dispatch") +@method_decorator(permission_required("leave.add_holidays"), name="dispatch") class HolidayFormView(HorillaFormView): """ form view for create button diff --git a/base/forms.py b/base/forms.py index 4115f8d7b..cae8b47d3 100644 --- a/base/forms.py +++ b/base/forms.py @@ -3118,8 +3118,6 @@ class CompanyLeaveForm(ModelForm): - exclude: A list of fields to exclude from the form (is_active). """ - cols = {"based_on_week": 12, "based_on_week_day": 12} - class Meta: """ Meta class for additional options @@ -3134,6 +3132,8 @@ class CompanyLeaveForm(ModelForm): Custom initialization to configure the 'based_on' field. """ super().__init__(*args, **kwargs) + choices = [("", "All")] + list(self.fields["based_on_week"].choices[1:]) + self.fields["based_on_week"].choices = choices self.fields["based_on_week"].widget.option_template_name = ( "horilla_widgets/select_option.html" ) diff --git a/base/templates/cbv/holidays/detail_view_actions.html b/base/templates/cbv/holidays/detail_view_actions.html index 20d820dd1..059d9bf30 100644 --- a/base/templates/cbv/holidays/detail_view_actions.html +++ b/base/templates/cbv/holidays/detail_view_actions.html @@ -1,26 +1,33 @@ -{% load basefilters %} -{% load i18n %} -{% if perms.leave.change_holiday %} - - - -{% endif %} -{% if perms.leave.delete_holiday %} -
-{% csrf_token %} - +{% load basefilters i18n %} +
+ {% if perms.leave.change_holiday %} + + + {% trans 'Edit' %} + + {% endif %} - -{% endif %} + {% if perms.leave.delete_holiday %} + + + {% trans 'Delete' %} + + {% endif %} +
diff --git a/base/templates/cbv/holidays/holidays_actions.html b/base/templates/cbv/holidays/holidays_actions.html index cad00ce60..0e2b2c0f2 100644 --- a/base/templates/cbv/holidays/holidays_actions.html +++ b/base/templates/cbv/holidays/holidays_actions.html @@ -2,26 +2,38 @@
{% if perms.leave.change_holiday %} + {% endif %} + {% if perms.leave.change_holiday %} + {% endif %} {% if perms.leave.delete_holiday %} - + {% endif %} -
+ diff --git a/base/templates/cbv/holidays/holidays_export.html b/base/templates/cbv/holidays/holidays_export.html index e5b184444..50eb0d89f 100644 --- a/base/templates/cbv/holidays/holidays_export.html +++ b/base/templates/cbv/holidays/holidays_export.html @@ -1,80 +1,84 @@ -{% load static %} -{% load i18n %} -{% load i18n %} -
-

- {% trans "Export Holidays" %} -

- +{% load static i18n %} + +
+

+ {% trans "Export Holidays" %} +

+
- - {% csrf_token %} -
-
-
{% trans "Excel columns" %}
-
-
- {% for field in export_column.selected_fields %} -
-
- -
+ + {% csrf_token %} +
+
+
+ {% trans "Excel columns" %} +
+
+
+ {% for field in export_column.selected_fields %} +
+
+ +
+
+ {% endfor %} +
+
+
+
+
{% trans "Holiday" %}
+
+
+
+
+ + {{export_filter.form.from_date}} +
+
+
+
+ + {{export_filter.form.to_date}} +
+
+
+
+ + {{export_filter.form.recurring}} +
+
+
+
- {% endfor %} -
-
-
-
{% trans "Holiday" %}
-
-
-
-
- - {{export_filter.form.from_date}} -
-
-
-
- - {{export_filter.form.to_date}} -
-
-
-
- - {{export_filter.form.recurring}} -
-
-
+ -
-
- - +
diff --git a/base/templates/holiday/holiday_form.html b/base/templates/holiday/holiday_form.html index 23de31db8..baf6dcc61 100644 --- a/base/templates/holiday/holiday_form.html +++ b/base/templates/holiday/holiday_form.html @@ -5,8 +5,8 @@ }, 1000);"> {% endif %} -
- {% trans "Create" %} {{ form.verbose_name }} +
+ {% if duplicate %}{% trans "Duplicate" %}{% else %}{% trans "Create" %} {{ form.verbose_name }}{% endif %} @@ -21,7 +21,7 @@
-
-
-