Merge master
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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"
|
||||
)
|
||||
|
||||
@@ -1,26 +1,33 @@
|
||||
{% load basefilters %}
|
||||
{% load i18n %}
|
||||
{% if perms.leave.change_holiday %}
|
||||
<a hx-get="{% url 'holiday-update' instance.id %}?{{pd}}"
|
||||
hx-target='#genericModalBody'
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target='#genericModal'
|
||||
class="oh-btn oh-btn--info w-50" title="{% trans 'Edit' %}">
|
||||
<ion-icon name="create-outline"></ion-icon>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if perms.leave.delete_holiday %}
|
||||
<form
|
||||
hx-post="{% url 'holiday-delete' instance.id %}"
|
||||
hx-target = "#holidaydelete"
|
||||
hx-confirm="{% trans "Are you sure you want to delete?" %}"
|
||||
method="post"
|
||||
style="display: contents;width:100%">
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="oh-btn oh-btn--secondary w-50" title="{% trans 'Delete' %}">
|
||||
<ion-icon name="trash-outline" role="img" class="md hydrated" aria-label="trash outline"></ion-icon>
|
||||
</button>
|
||||
{% load basefilters i18n %}
|
||||
|
||||
<div class="oh-btn-group w-100">
|
||||
{% if perms.leave.change_holiday %}
|
||||
<a
|
||||
hx-get="{% url 'holiday-update' instance.id %}?{{pd}}"
|
||||
hx-target="#genericModalBody"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#genericModal"
|
||||
class="oh-btn oh-btn--info flex-fill"
|
||||
>
|
||||
<ion-icon name="create-outline"></ion-icon>
|
||||
{% trans 'Edit' %}
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% endif %}
|
||||
{% if perms.leave.delete_holiday %}
|
||||
<a
|
||||
hx-post="{% url 'holiday-delete' instance.id %}"
|
||||
hx-target="#holidaydelete"
|
||||
hx-confirm="{% trans 'Are you sure you want to delete?' %}"
|
||||
class="oh-btn oh-btn--danger flex-fill"
|
||||
>
|
||||
<ion-icon
|
||||
name="trash-outline"
|
||||
role="img"
|
||||
class="md hydrated"
|
||||
aria-label="trash outline"
|
||||
></ion-icon>
|
||||
{% trans 'Delete' %}
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
@@ -2,26 +2,38 @@
|
||||
<div onclick="event.stopPropagation();" class="oh-btn-group">
|
||||
{% if perms.leave.change_holiday %}
|
||||
<button
|
||||
class="oh-btn oh-btn--light-bkg w-100"
|
||||
title="{% trans 'Edit' %}"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#genericModal"
|
||||
hx-get="{% url 'holiday-update' instance.id %}?{{pd}}&instance_ids={{instance.ordered_ids}}"
|
||||
hx-target="#genericModalBody"
|
||||
class="oh-btn oh-btn--light-bkg w-100"
|
||||
title="{% trans 'Edit' %}"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#genericModal"
|
||||
hx-get="{% url 'holiday-update' instance.id %}?{{pd}}&instance_ids={{instance.ordered_ids}}"
|
||||
hx-target="#genericModalBody"
|
||||
>
|
||||
<ion-icon name="create-outline"></ion-icon>
|
||||
<ion-icon name="create-outline"></ion-icon>
|
||||
</button>
|
||||
{% endif %}
|
||||
{% if perms.leave.change_holiday %}
|
||||
<button
|
||||
class="oh-btn oh-btn--light-bkg w-100"
|
||||
title="{% trans 'Duplicate' %}"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#genericModal"
|
||||
hx-get="{% url 'duplicate-holiday' instance.id %}?{{pd}}&instance_ids={{instance.ordered_ids}}"
|
||||
hx-target="#genericModalBody"
|
||||
>
|
||||
<ion-icon name="copy-outline"></ion-icon>
|
||||
</button>
|
||||
{% endif %}
|
||||
{% if perms.leave.delete_holiday %}
|
||||
<a
|
||||
class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100"
|
||||
id="delete-link"
|
||||
hx-confirm="{% trans 'Are you sure you want to delete?' %}"
|
||||
hx-post="{% url 'holiday-delete' instance.id %}"
|
||||
hx-target="#listContainer"
|
||||
title="{% trans 'Delete' %}"
|
||||
class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100"
|
||||
id="delete-link"
|
||||
hx-confirm="{% trans 'Are you sure you want to delete?' %}"
|
||||
hx-post="{% url 'holiday-delete' instance.id %}"
|
||||
hx-target="#listContainer"
|
||||
title="{% trans 'Delete' %}"
|
||||
>
|
||||
<ion-icon name="trash-outline"></ion-icon>
|
||||
<ion-icon name="trash-outline"></ion-icon>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,80 +1,84 @@
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
{% load i18n %}
|
||||
<div class="oh-modal__dialog-header pb-0">
|
||||
<h2 class="oh-modal__dialog-title" id="holidayExportLavel">
|
||||
{% trans "Export Holidays" %}
|
||||
</h2>
|
||||
<button class="oh-modal__close" aria-label="Close">
|
||||
<ion-icon name="close-outline"></ion-icon>
|
||||
</button>
|
||||
{% load static i18n %}
|
||||
|
||||
<div class="oh-modal__dialog-header">
|
||||
<h2 class="oh-modal__dialog-title" id="holidayExportLavel">
|
||||
{% trans "Export Holidays" %}
|
||||
</h2>
|
||||
<button class="oh-modal__close" aria-label="Close">
|
||||
<ion-icon name="close-outline"></ion-icon>
|
||||
</button>
|
||||
</div>
|
||||
<div class="oh-modal__dialog-body" id="holidayExportModalBody">
|
||||
<form
|
||||
action="{%url 'holiday-info-export' %}"
|
||||
method="get"
|
||||
onsubmit="event.stopPropagation();$(this).parents().find('.oh-modal--show').last().toggleClass('oh-modal--show');"
|
||||
id="holidayExportForm"
|
||||
class="oh-profile-section pt-0"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<div class="oh-dropdown__filter-body">
|
||||
<div class="oh-accordion">
|
||||
<div class="oh-accordion-header">{% trans "Excel columns" %}</div>
|
||||
<div class="oh-accordion-body">
|
||||
<div class="row">
|
||||
{% for field in export_column.selected_fields %}
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
<div class="oh-input-group">
|
||||
<label class="oh-label"> {{ field }} </label>
|
||||
</div>
|
||||
<form
|
||||
action="{% url 'holiday-info-export' %}"
|
||||
method="get"
|
||||
onsubmit="event.stopPropagation();$(this).parents().find('.oh-modal--show').last().toggleClass('oh-modal--show');"
|
||||
id="holidayExportForm"
|
||||
class="oh-profile-section"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<div class="oh-dropdown__filter-body">
|
||||
<div class="oh-accordion">
|
||||
<div class="oh-accordion-header">
|
||||
{% trans "Excel columns" %}
|
||||
</div>
|
||||
<div class="oh-accordion-body">
|
||||
<div class="row">
|
||||
{% for field in export_column.selected_fields %}
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
<div class="oh-input-group">
|
||||
<label class="oh-label"> {{ field }} </label>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-accordion">
|
||||
<div class="oh-accordion-header">{% trans "Holiday" %}</div>
|
||||
<div class="oh-accordion-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
<div class="oh-input-group">
|
||||
<label
|
||||
class="oh-label"
|
||||
for="{{ export_filter.form.from_date.id_for_label }}"
|
||||
>{% trans "From Date" %}</label
|
||||
>
|
||||
{{export_filter.form.from_date}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
<div class="oh-input-group">
|
||||
<label
|
||||
class="oh-label"
|
||||
for="{{ export_filter.form.to_date.id_for_label }}"
|
||||
>{% trans "To Date" %}</label
|
||||
>
|
||||
{{export_filter.form.to_date}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12">
|
||||
<div class="oh-input-group">
|
||||
<label
|
||||
class="oh-label"
|
||||
for="{{ export_filter.form.recurring.id_for_label }}"
|
||||
>{% trans "Recurring" %}</label
|
||||
>
|
||||
{{export_filter.form.recurring}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-accordion">
|
||||
<div class="oh-accordion-header">{% trans "Holiday" %}</div>
|
||||
<div class="oh-accordion-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
<div class="oh-input-group">
|
||||
<label
|
||||
class="oh-label"
|
||||
for="{{ export_filter.form.from_date.id_for_label }}"
|
||||
>{% trans "From Date" %}</label
|
||||
>
|
||||
{{export_filter.form.from_date}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
<div class="oh-input-group">
|
||||
<label
|
||||
class="oh-label"
|
||||
for="{{ export_filter.form.to_date.id_for_label }}"
|
||||
>{% trans "To Date" %}</label
|
||||
>
|
||||
{{export_filter.form.to_date}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12">
|
||||
<div class="oh-input-group">
|
||||
<label
|
||||
class="oh-label"
|
||||
for="{{ export_filter.form.recurring.id_for_label }}"
|
||||
>{% trans "Recurring" %}</label
|
||||
>
|
||||
{{export_filter.form.recurring}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-modal__dialog-footer p-0 mt-3">
|
||||
<button
|
||||
type="submit"
|
||||
class="oh-btn oh-btn--secondary oh-btn--shadow"
|
||||
>
|
||||
{% trans "Export" %}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-modal__dialog-footer p-0 mt-3">
|
||||
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow">
|
||||
{% trans "Export" %}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
}, 1000);">
|
||||
</span>
|
||||
{% endif %}
|
||||
<div class="oh-modal__dialog-header pb-0">
|
||||
<span class="oh-modal__dialog-title" id="editDialogDialog">{% trans "Create" %} {{ form.verbose_name }}</span>
|
||||
<div class="oh-modal__dialog-header font-semibold">
|
||||
<span class="oh-modal__dialog-title" id="editDialogDialog">{% if duplicate %}{% trans "Duplicate" %}{% else %}{% trans "Create" %} {{ form.verbose_name }}{% endif %}</span>
|
||||
<button class="oh-modal__close" aria-label="Close">
|
||||
<ion-icon name="close-outline"></ion-icon>
|
||||
</button>
|
||||
@@ -21,7 +21,7 @@
|
||||
<div class="row">
|
||||
<div class="col-12 col-sm-12 col-md-6 col-lg-6">
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label" for="{{form.start_date.id_for_label}}">
|
||||
<label class="oh-label" for="{{form.start_date.id_for_label}}">
|
||||
{{form.start_date.label}}
|
||||
</label>
|
||||
{{ form.start_date }} {{ form.start_date.errors }}
|
||||
@@ -29,7 +29,7 @@
|
||||
</div>
|
||||
<div class="col-12 col-sm-12 col-md-6 col-lg-6">
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label" for="{{form.end_date.id_for_label}}">
|
||||
<label class="oh-label" for="{{form.end_date.id_for_label}}">
|
||||
{{form.end_date.label}}
|
||||
</label>
|
||||
{{ form.end_date }} {{ form.end_date.errors }}
|
||||
@@ -37,7 +37,7 @@
|
||||
</div>
|
||||
<div class="col-12 col-sm-12 col-md-6 col-lg-6">
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label" for="{{form.company_id.id_for_label}}">
|
||||
<label class="oh-label" for="{{form.company_id.id_for_label}}">
|
||||
{{form.company_id.label}}
|
||||
</label>
|
||||
{{ form.company_id }} {{ form.company_id.errors }}
|
||||
|
||||
@@ -1 +1 @@
|
||||
<option value="{{ widget.value|stringformat:'s' }}" {% include "horilla_widgets/attr.html" %}>{{ widget.label }}</option>
|
||||
<option value="{{ widget.value|stringformat:'s' }}" {% include "horilla_widgets/attr.html" %} {% if widget.selected %} selected="selected"{% endif %} >{{ widget.label }}</option>
|
||||
|
||||
@@ -20,4 +20,4 @@
|
||||
$('#{{ view_id }}Form div.flex-row-reverse').append(button_container);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user