diff --git a/base/cbv/company.py b/base/cbv/company.py index dbd5357f7..af9056b4c 100644 --- a/base/cbv/company.py +++ b/base/cbv/company.py @@ -66,8 +66,7 @@ class CompanyListView(HorillaListView): model = Company filter_class = CompanyFilter - - bulk_template = "cbv/settings/company_bulk_update.html" + selected_instances_key_id = "selectedInstance" bulk_update_fields = ["country", "state", "city", "zip"] def get_bulk_form(self): @@ -161,7 +160,6 @@ class CompanyCreateForm(HorillaFormView): model = Company form_class = CompanyForm - template_name = "cbv/settings/company_inherit.html" new_display_title = _("Create Company") def get_form(self, form_class=None): diff --git a/base/templates/base/company/company.html b/base/templates/base/company/company.html index e3d842726..818003b04 100644 --- a/base/templates/base/company/company.html +++ b/base/templates/base/company/company.html @@ -1,34 +1,9 @@ {% extends 'settings.html' %} {% load i18n %} {% block settings %}{% load static %} {% include "generic/components.html" %} - +
- {% if perms.base.view_company %} -
-

{{model.get_verbose_name}}

- {% if perms.base.add_company %} - - {% endif %} -
- {% if companies %} - {% include 'base/company/company_view.html' %} - {% else %} -
- Page not found. 404. -
{% trans "There is no companies at this moment." %}
-
- {% endif %} - {% endif %} +
+
{% endblock settings %} diff --git a/base/templates/base/company/company_view.html b/base/templates/base/company/company_view.html index c34851761..627436809 100644 --- a/base/templates/base/company/company_view.html +++ b/base/templates/base/company/company_view.html @@ -1,61 +1,3 @@ {% load i18n %} -
-
-
-
-
{% trans "Company" %}
-
{% trans "Is Hq" %}
-
{% trans "Address" %}
-
{% trans "Country" %}
-
{% trans "State" %}
-
{% trans "City" %}
-
{% trans "Zip" %}
- {% if perms.base.change_company or perms.base.delete_company %} -
{% trans "Actions" %}
- {% endif %} -
-
-
- {% for company in companies %} -
-
-
- Username{{company.company}} -
-
-
{{company.hq}}
-
{{company.address}}
-
{{company.country}}
-
{{company.state}}
-
{{company.city}}
-
{{company.zip}}
- {% if perms.base.change_company or perms.base.delete_company %} -
-
- {% if perms.base.change_company %} - - {% endif %} - {% if perms.base.delete_company %} -
- {% csrf_token %} - -
- {% endif %} -
-
- {% endif %} -
- {% endfor %} -
-
+
diff --git a/base/templates/cbv/dashboard/job_position_field.html b/base/templates/cbv/dashboard/job_position_field.html index 4e54e8375..deacc53fd 100644 --- a/base/templates/cbv/dashboard/job_position_field.html +++ b/base/templates/cbv/dashboard/job_position_field.html @@ -3,16 +3,8 @@ class="oh-label" for="id_{{ form.job_position_id.title }}" title="{{ form.job_position_id.help_text|safe }}" - >{% trans form.job_position_id.label %}{% trans form.job_position_id.label %} New
{{form.job_position_id}}
- diff --git a/base/templates/cbv/dashboard/job_role_field.html b/base/templates/cbv/dashboard/job_role_field.html index c5ed4dc90..1847af648 100644 --- a/base/templates/cbv/dashboard/job_role_field.html +++ b/base/templates/cbv/dashboard/job_role_field.html @@ -8,11 +8,3 @@
{{form.job_role_id}}
- diff --git a/base/templates/cbv/multiple_approval_condition/form.html b/base/templates/cbv/multiple_approval_condition/form.html index 7febbf6e1..e13f0a43b 100644 --- a/base/templates/cbv/multiple_approval_condition/form.html +++ b/base/templates/cbv/multiple_approval_condition/form.html @@ -3,25 +3,17 @@ {% include "generic/components.html" %}
{% include "generic/horilla_form.html" %} - - +
- - - -{% comment %} {% endcomment %} diff --git a/base/templates/cbv/multiple_approval_condition/form_edit.html b/base/templates/cbv/multiple_approval_condition/form_edit.html index 9a256d785..14bedcac2 100644 --- a/base/templates/cbv/multiple_approval_condition/form_edit.html +++ b/base/templates/cbv/multiple_approval_condition/form_edit.html @@ -12,7 +12,7 @@ role="button" id = "addmangerButton" style="color: green" - >{% trans "Add more managers.." %} + >{% trans "Add more managers.. 321" %}
diff --git a/base/templates/shift_request/htmx/shift_reallocate_employees.html b/base/templates/shift_request/htmx/shift_reallocate_employees.html index 6175fd896..f2e6a8a79 100644 --- a/base/templates/shift_request/htmx/shift_reallocate_employees.html +++ b/base/templates/shift_request/htmx/shift_reallocate_employees.html @@ -8,11 +8,3 @@
{{form.reallocate_to}}
- diff --git a/biometric/templates/biometric/biometric_device_form.html b/biometric/templates/biometric/biometric_device_form.html index f96613783..383edb23c 100644 --- a/biometric/templates/biometric/biometric_device_form.html +++ b/biometric/templates/biometric/biometric_device_form.html @@ -175,4 +175,4 @@ } }); }); - \ No newline at end of file + diff --git a/dynamic_fields/templates/dynamic_fields/common/form.html b/dynamic_fields/templates/dynamic_fields/common/form.html index 1ff4984f2..dd12dd593 100644 --- a/dynamic_fields/templates/dynamic_fields/common/form.html +++ b/dynamic_fields/templates/dynamic_fields/common/form.html @@ -83,11 +83,3 @@ - diff --git a/employee/templates/cbv/allocations/employee/form_structure.html b/employee/templates/cbv/allocations/employee/form_structure.html index d97880e0e..51e4d9e4f 100644 --- a/employee/templates/cbv/allocations/employee/form_structure.html +++ b/employee/templates/cbv/allocations/employee/form_structure.html @@ -1,57 +1,53 @@ -
- - + + + -{% load widget_tweaks %} {% load i18n %} -{% load generic_template_filters %} - - + {% load widget_tweaks %} {% load i18n %} + {% load generic_template_filters %} + + -
-
-
-
{{ form.non_field_errors }}
- {% for field in form.visible_fields %} -
-
- - {% if field.help_text != '' %} - - {% endif %} -
+
+
+
+
{{ form.non_field_errors }}
+ {% for field in form.visible_fields %} +
+
+ + {% if field.help_text != '' %} + + {% endif %} +
- {% if field.field.widget.input_type == 'checkbox' %} -
- {{ field|add_class:'oh-switch__checkbox' }} -
- {% else %} -
- {{ field|add_class:'form-control' }} - {{ field.errors }} -
- {% endif %} + {% if field.field.widget.input_type == 'checkbox' %} +
+ {{ field|add_class:'oh-switch__checkbox' }} +
+ {% elif field.name == "country" or field.name == "state" %} +
+ + {{ field.errors }} +
+ {% else %} +
+ {{ field|add_class:'form-control' }} + {{ field.errors }} +
+ {% endif %} +
+ {% endfor %} +
+ {% for field in form.hidden_fields %} {{ field }} {% endfor %}
- {% endfor %} -
- - {% for field in form.hidden_fields %} {{ field }} {% endfor %}
-
- diff --git a/employee/templates/cbv/document/notify_field.html b/employee/templates/cbv/document/notify_field.html index ece6fd3c9..5992cee42 100644 --- a/employee/templates/cbv/document/notify_field.html +++ b/employee/templates/cbv/document/notify_field.html @@ -6,10 +6,3 @@ >{% trans form.notify_before.label %} {{form.notify_before}} -{% comment %} {% endcomment %} diff --git a/employee/templates/cbv/employees_view/bulk_update_page.html b/employee/templates/cbv/employees_view/bulk_update_page.html index b824f36f9..78683fba5 100644 --- a/employee/templates/cbv/employees_view/bulk_update_page.html +++ b/employee/templates/cbv/employees_view/bulk_update_page.html @@ -122,7 +122,3 @@ }); }); - - diff --git a/employee/templates/cbv/employees_view/filter_employee.html b/employee/templates/cbv/employees_view/filter_employee.html index 09a25b1ec..71a4ab8a9 100644 --- a/employee/templates/cbv/employees_view/filter_employee.html +++ b/employee/templates/cbv/employees_view/filter_employee.html @@ -2,116 +2,117 @@ {% load static %} {% load horillafilters %} -
+
-
{% trans "Employee" %}
-
-
-
-
- - {{form.employee_first_name}} -
-
- - {{form.email}} -
-
- - -
-
-
-
- - {{form.employee_last_name}} -
-
- - {{form.phone}} -
-
- - {{form.gender}} -
-
-
-
-
-
-
{% trans "Work Info" %}
-
-
-
-
- - {{form.employee_work_info__company_id}} -
-
- - {{form.employee_work_info__department_id}} -
-
- - {{form.employee_work_info__shift_id}} -
-
- - {{form.employee_work_info__tags}} -
+
{% trans "Employee" %}
+
+
+
+
+ + {{form.employee_first_name}} +
+
+ + {{form.email}} +
+
+ + +
+
-
-
-
- - {{form.employee_work_info__reporting_manager_id}} -
-
- - {{form.employee_work_info__job_position_id}} -
-
- - {{form.employee_work_info__work_type_id}} -
- {% if "attendance"|app_installed %} -
- - {{form.working_today}} -
- {% endif %} -
-
-
-
-
-
{% trans "Advanced" %}
-
-
-
-
-
- - {{form.employee_user_id__groups}} +
+
+ + {{form.employee_last_name}} +
+
+ + {{form.phone}} +
+
+ + {{form.gender}} +
+
+
+
+
+ +
+
{% trans "Work Info" %}
+
+
+
+
+ + {{form.employee_work_info__company_id}} +
+
+ + {{form.employee_work_info__department_id}} +
+
+ + {{form.employee_work_info__shift_id}} +
+
+ + {{form.employee_work_info__tags}} +
+
+ +
+
+ + {{form.employee_work_info__reporting_manager_id}} +
+
+ + {{form.employee_work_info__job_position_id}} +
+
+ + {{form.employee_work_info__work_type_id}} +
+ {% if "attendance"|app_installed %} +
+ + {{form.working_today}} +
+ {% endif %} +
+
+
+
+ +
+
{% trans "Advanced" %}
+
+
+
+
+
+ + {{form.employee_user_id__groups}} +
+
+ + {{form.is_active}} +
+
+
+ +
+
+ + {{form.employee_user_id__user_permissions}} +
+
-
- - {{form.is_active}} -
-
-
-
- - {{form.employee_user_id__user_permissions}} -
-
-
-
- diff --git a/horilla_api/api_serializers/attendance/serializers.py b/horilla_api/api_serializers/attendance/serializers.py index 9c10d5598..853a2c656 100644 --- a/horilla_api/api_serializers/attendance/serializers.py +++ b/horilla_api/api_serializers/attendance/serializers.py @@ -210,3 +210,15 @@ class MailTemplateSerializer(serializers.ModelSerializer): class Meta: model = HorillaMailTemplate fields = "__all__" + + +class UserAttendanceListSerializer(serializers.ModelSerializer): + class Meta: + model = Attendance + fields = [ + "id", + "attendance_date", + "attendance_clock_in", + "attendance_clock_out", + "attendance_worked_hour", + ] diff --git a/horilla_api/api_urls/attendance/urls.py b/horilla_api/api_urls/attendance/urls.py index 012c1484e..00bc37e4b 100644 --- a/horilla_api/api_urls/attendance/urls.py +++ b/horilla_api/api_urls/attendance/urls.py @@ -55,4 +55,6 @@ urlpatterns = [ path("offline-employee-mail-send", OfflineEmployeeMailsend.as_view()), path("converted-mail-template", ConvertedMailTemplateConvert.as_view()), path("mail-templates", MailTemplateView.as_view()), + path("my-attendance/", UserAttendanceView.as_view()), + path("attendance-type-check/", AttendanceTypeAccessCheck.as_view()), ] diff --git a/horilla_api/api_urls/employee/urls.py b/horilla_api/api_urls/employee/urls.py index 6496c6663..19a74b950 100644 --- a/horilla_api/api_urls/employee/urls.py +++ b/horilla_api/api_urls/employee/urls.py @@ -3,7 +3,7 @@ from django.urls import path from ...api_views.employee import views as views urlpatterns = [ - path("employees/", views.EmployeeAPIView.as_view(), name="api-employees-list"), + # path('employees/', views.EmployeeAPIView.as_view(), name='api-employees-list'), path( "employees//", views.EmployeeAPIView.as_view(), diff --git a/horilla_api/api_views/attendance/views.py b/horilla_api/api_views/attendance/views.py index cc451889b..631f47edf 100644 --- a/horilla_api/api_views/attendance/views.py +++ b/horilla_api/api_views/attendance/views.py @@ -7,6 +7,7 @@ from django.db.models import Case, CharField, F, Value, When from django.http import QueryDict from django.shortcuts import get_object_or_404 from django.utils.decorators import method_decorator +from rest_framework import status from rest_framework.pagination import PageNumberPagination from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response @@ -38,6 +39,7 @@ from ...api_serializers.attendance.serializers import ( AttendanceRequestSerializer, AttendanceSerializer, MailTemplateSerializer, + UserAttendanceListSerializer, ) # Create your views here. @@ -65,7 +67,6 @@ class ClockInAPIView(APIView): permission_classes = [IsAuthenticated] def post(self, request): - print("========", request.user.employee_get.check_online()) if not request.user.employee_get.check_online(): try: if request.user.employee_get.get_company().geo_fencing.start: @@ -158,7 +159,6 @@ class ClockOutAPIView(APIView): except: pass if request.user.employee_get.check_online(): - print("----------------") current_date = date.today() current_time = datetime.now().time() current_datetime = datetime.now() @@ -722,6 +722,7 @@ class OfflineEmployeesCountView(APIView): permission_classes = [IsAuthenticated] + @method_decorator(permission_required("employee.view_employee")) def get(self, request): count = ( EmployeeFilter({"not_in_yet": date.today()}) @@ -742,6 +743,7 @@ class OfflineEmployeesListView(APIView): permission_classes = [IsAuthenticated] + @method_decorator(permission_required("employee.view_employee")) def get(self, request): queryset = ( EmployeeFilter({"not_in_yet": date.today()}) @@ -972,3 +974,46 @@ class OfflineEmployeeMailsend(APIView): return Response(f"Email not set for {employee.get_full_name()}") except Exception as e: return Response("Something went wrong") + + +class UserAttendanceView(APIView): + permission_classes = [IsAuthenticated] + serializer_class = UserAttendanceListSerializer + + def get(self, request): + employee_id = request.user.employee_get.id + + attendance_queryset = Attendance.objects.filter( + employee_id=employee_id + ).order_by("-id") + + paginator = PageNumberPagination() + paginator.page_size = 20 + page = paginator.paginate_queryset(attendance_queryset, request) + + serializer = self.serializer_class(page, many=True) + return paginator.get_paginated_response(serializer.data) + + +class AttendanceTypeAccessCheck(APIView): + permission_classes = [IsAuthenticated] + + def get(self, request): + user = request.user + employee_id = user.employee_get.id + + if user.has_perm("attendance.view_attendance"): + return Response(status=200) + + is_manager = ( + EmployeeWorkInformation.objects.filter(reporting_manager_id=employee_id) + .only("id") + .exists() + ) + + if is_manager: + return Response(status=200) + + return Response( + {"error": "Permission denied"}, status=status.HTTP_403_FORBIDDEN + ) diff --git a/horilla_api/api_views/employee/views.py b/horilla_api/api_views/employee/views.py index 3cc68bc57..fe29c3682 100644 --- a/horilla_api/api_views/employee/views.py +++ b/horilla_api/api_views/employee/views.py @@ -93,49 +93,61 @@ class EmployeeTypeAPIView(APIView): class EmployeeAPIView(APIView): """ Handles CRUD operations for employees. - - Methods: - get(request, pk=None): - - Retrieves a single employee by pk if provided. - - Retrieves and filters all employees if pk is not provided. - - post(request): - - Creates a new employee if the user has the 'employee.change_employee' permission. - - put(request, pk): - - Updates an existing employee if the user is the employee, a manager, or has 'employee.change_employee' permission. - - delete(request, pk): - - Deletes an employee if the user has the 'employee.delete_employee' permission. """ filter_backends = [DjangoFilterBackend] filterset_class = EmployeeFilter permission_classes = [IsAuthenticated] - def get(self, request, pk=None): - if pk: - try: - employee = Employee.objects.get(pk=pk) - except Employee.DoesNotExist: - return Response( - {"error": "Employee does not exist"}, - status=status.HTTP_404_NOT_FOUND, - ) + def get(self, request, pk): + user = request.user + try: + employee = Employee.objects.only( + "id", + "employee_first_name", + "employee_last_name", # include only needed fields + ).get(pk=pk) + except Employee.DoesNotExist: + return Response( + {"error": "Employee does not exist"}, status=status.HTTP_404_NOT_FOUND + ) + + # If user has global view permission + if user.has_perm("employee.view_employee"): serializer = EmployeeSerializer(employee) return Response(serializer.data) - paginator = PageNumberPagination() - employees_queryset = Employee.objects.all() - employees_filter_queryset = self.filterset_class( - request.GET, queryset=employees_queryset - ).qs - field_name = request.GET.get("groupby_field", None) - if field_name: - url = request.build_absolute_uri() - return groupby_queryset(request, url, field_name, employees_filter_queryset) - page = paginator.paginate_queryset(employees_filter_queryset, request) - serializer = EmployeeSerializer(page, many=True) - return paginator.get_paginated_response(serializer.data) + + # If employee is in user's subordinates + subordinates = user.employee_get.get_subordinate_employees() + if subordinates.filter(pk=pk).exists(): + serializer = EmployeeSerializer(employee) + return Response(serializer.data) + + # If requesting own data + if employee.pk == user.employee_get.id: + serializer = EmployeeSerializer(employee) + return Response(serializer.data) + + return Response( + {"error": "Permission denied"}, status=status.HTTP_403_FORBIDDEN + ) + + # paginator = PageNumberPagination() + # if request.user.has_perm('employee.view_employee'): + # employees_queryset = Employee.objects.all() + # elif request.user.employee_get.get_subordinate_employees(): + # employees_queryset = request.user.employee_get.get_subordinate_employees() + # else: + # employees_queryset = [request.user.employee_get] + # employees_filter_queryset = self.filterset_class( + # request.GET, queryset=employees_queryset).qs + # field_name = request.GET.get("groupby_field", None) + # if field_name: + # url = request.build_absolute_uri() + # return groupby_queryset(request, url, field_name, employees_filter_queryset) + # page = paginator.paginate_queryset(employees_filter_queryset, request) + # serializer = EmployeeSerializer(page, many=True) + # return paginator.get_paginated_response(serializer.data) @method_decorator(permission_required("employee.add_employee")) def post(self, request): @@ -176,27 +188,42 @@ class EmployeeAPIView(APIView): class EmployeeListAPIView(APIView): """ Retrieves a paginated list of employees with optional search functionality. - - Methods: - get(request): - - Returns a paginated list of employees. - - Optionally filters employees based on a search query in the first or last name. """ permission_classes = [IsAuthenticated] def get(self, request): - paginator = PageNumberPagination() - paginator.page_size = 13 - search = request.query_params.get("search", None) + user = request.user + search = request.query_params.get("search") + + # Start with a base queryset with only required fields + employees_queryset = Employee.objects.only( + "id", "employee_first_name", "employee_last_name" + ) + + # Permission-based filtering + if user.has_perm("employee.view_employee"): + pass # employees_queryset is already all employees + else: + subordinate_qs = user.employee_get.get_subordinate_employees() + if subordinate_qs.exists(): + employees_queryset = subordinate_qs.only( + "id", "employee_first_name", "employee_last_name" + ) + else: + employees_queryset = employees_queryset.filter(id=user.employee_get.id) + + # Apply search filter if provided if search: - employees_queryset = Employee.objects.filter( + employees_queryset = employees_queryset.filter( Q(employee_first_name__icontains=search) | Q(employee_last_name__icontains=search) ) - else: - employees_queryset = Employee.objects.all() + + # Paginate + paginator = PageNumberPagination() page = paginator.paginate_queryset(employees_queryset, request) + serializer = EmployeeListSerializer(page, many=True) return paginator.get_paginated_response(serializer.data) @@ -386,14 +413,14 @@ class EmployeeWorkInfoImportView(APIView): class EmployeeBulkUpdateView(APIView): """ - Endpoint for bulk updating employee and work information. + Endpoint for bulk updating employee and work information. - Permissions: - - Requires authentication and "change_employee" permission. - 0 - Methods: - put(request): - - Updates multiple employees and their work information. + Permissions: + - Requires authentication and "change_employee" permission. + + Methods: + put(request): + - Updates multiple employees and their work information. """ permission_classes = [IsAuthenticated] diff --git a/horilla_automations/forms.py b/horilla_automations/forms.py index a6ea475ea..60eb90476 100644 --- a/horilla_automations/forms.py +++ b/horilla_automations/forms.py @@ -33,6 +33,8 @@ class AutomationForm(ModelForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) + + # --- Field: also_sent_to --- self.fields["also_sent_to"] = HorillaMultiSelectField( queryset=Employee.objects.all(), required=False, @@ -46,41 +48,57 @@ class AutomationForm(ModelForm): label="Also Sent to", help_text=_("The employees selected here will receive the email as Cc."), ) - if not self.data: - mail_to = [] - initial = [] - mail_details_choice = [] - if self.instance.pk: - mail_to = generate_choices(self.instance.model)[0] - mail_details_choice = generate_choices(self.instance.model)[1] - self.fields["mail_to"] = forms.MultipleChoiceField(choices=mail_to) - self.fields["mail_details"] = forms.ChoiceField( - choices=mail_details_choice, - help_text="Fill mail template details(reciever/instance, `self` will be the person who trigger the automation)", - ) - self.fields["mail_to"].initial = initial - attrs = self.fields["mail_to"].widget.attrs - attrs["class"] = "oh-select oh-select-2 w-100" - attrs = self.fields["model"].widget.attrs - self.fields["model"].choices = [("", "Select model")] + list(set(MODEL_CHOICES)) - attrs["onchange"] = "getToMail($(this))" + # --- Determine model for generate_choices --- + model = getattr(self.instance, "model", None) or self.data.get("model") + mail_to, mail_details_choice = [], [] + + if model: + choices = generate_choices(model) + mail_to, mail_details_choice = choices[0], choices[1] + + # --- Field: mail_to --- + self.fields["mail_to"] = forms.MultipleChoiceField( + choices=mail_to, + initial=self.data.get("mail_to"), + widget=forms.SelectMultiple(attrs={"class": "oh-select oh-select-2 w-100"}), + ) + + # --- Field: mail_details --- + self.fields["mail_details"] = forms.ChoiceField( + choices=mail_details_choice, + help_text=_( + "Fill mail template details (receiver/instance, `self` will be the person who triggers the automation)" + ), + ) + self.fields["mail_details"].widget.attrs = { + "class": "oh-select oh-select-2 w-100" + } + + # --- Field: model --- + self.fields["model"].choices = [("", "Select model")] + sorted( + set(MODEL_CHOICES) + ) + self.fields["model"].widget.attrs["onchange"] = "getToMail($(this))" + + # --- Field: mail_template --- self.fields["mail_template"].empty_label = "----------" - attrs = attrs.copy() - del attrs["onchange"] - self.fields["mail_details"].widget.attrs = attrs + + # --- Instance condition fields --- if self.instance.pk: self.fields["condition"].initial = self.instance.condition_html self.fields["condition_html"].initial = self.instance.condition_html self.fields["condition_querystring"].initial = ( self.instance.condition_querystring ) - for _field_name, field in self.fields.items(): + + # --- Apply option template name for all select fields --- + for field in self.fields.values(): if isinstance(field.widget, forms.Select): field.widget.option_template_name = default_select_option_template - is_active_field = self.fields.pop("is_active") - self.fields["is_active"] = is_active_field + # --- Re-insert is_active field to ensure order --- + self.fields["is_active"] = self.fields.pop("is_active") def clean(self): cleaned_data = super().clean() diff --git a/horilla_views/generic/cbv/views.py b/horilla_views/generic/cbv/views.py index a93a5d3c8..2732498c4 100644 --- a/horilla_views/generic/cbv/views.py +++ b/horilla_views/generic/cbv/views.py @@ -1896,6 +1896,7 @@ class HorillaFormView(FormView): context["form_class_path"] = self.form_class_path context["view_id"] = self.view_id context["hx_confirm"] = self.hx_confirm + context["hx_target"] = self.request.META.get("HTTP_HX_TARGET", "this") pk = None if self.form.instance: pk = self.form.instance.pk diff --git a/horilla_views/templates/generic/form.html b/horilla_views/templates/generic/form.html index b6efea7d2..bb3947304 100644 --- a/horilla_views/templates/generic/form.html +++ b/horilla_views/templates/generic/form.html @@ -1,93 +1,81 @@ {% load widget_tweaks %} {% load i18n %} {% load generic_template_filters %} + {% if form.verbose_name %} -
-

- {{form.verbose_name}} -

- -
-{% endif %} -
- {% if form.instance_ids %} -
- - - -
- {% endif %} -
-
-
-
{{ form.non_field_errors }}
- {% for field in form.visible_fields %} -
-
- - {% if field.help_text != '' %} - - {% endif %} -
- - {% if field.field.widget.input_type == 'checkbox' %} -
- {{ field|add_class:'oh-switch__checkbox' }} -
- {% else %} -
- {{ field|add_class:'form-control' }} - {{ field.errors }} -
- {% endif %} -
- {% endfor %} -
- - {% for field in form.hidden_fields %} {{ field }} {% endfor %} - -
- -
-
+{% endif %} + +
+ {% if form.instance_ids %} +
+ + + +
+ {% endif %} +
+
+
+
{{ form.non_field_errors }}
+ {% for field in form.visible_fields %} +
+
+ + {% if field.help_text != '' %} + + {% endif %} +
+ + {% if field.field.widget.input_type == 'checkbox' %} +
+ {{ field|add_class:'oh-switch__checkbox' }} +
+ {% elif field.name == "country" or field.name == "state" %} +
+ + {{ field.errors }} +
+ {% else %} +
+ {{ field|add_class:'form-control' }} + {{ field.errors }} +
+ {% endif %} +
+ {% endfor %} +
+ + {% for field in form.hidden_fields %} {{ field }} {% endfor %} + +
+ +
+
+
- diff --git a/horilla_views/templates/generic/horilla_form.html b/horilla_views/templates/generic/horilla_form.html index 1c921f97f..c39f9e47b 100644 --- a/horilla_views/templates/generic/horilla_form.html +++ b/horilla_views/templates/generic/horilla_form.html @@ -1,80 +1,74 @@ {% load generic_template_filters %} -
- {% for field_tuple in dynamic_create_fields %} - -
- {% endfor %} -
{{form.structured}}
- {% for field_tuple in dynamic_create_fields %} -
- - - {% endfor %}
+ +
+ {{ form.structured }} +
+ +{% for field_tuple in dynamic_create_fields %} +
+ + + + + +
+{% endfor %} diff --git a/leave/templates/cbv/leave_requests/form/inherit.html b/leave/templates/cbv/leave_requests/form/inherit.html index d73ab4b16..82468157b 100644 --- a/leave/templates/cbv/leave_requests/form/inherit.html +++ b/leave/templates/cbv/leave_requests/form/inherit.html @@ -4,13 +4,6 @@
-{% comment %} {% endcomment %} diff --git a/recruitment/templates/cbv/candidates/filter.html b/recruitment/templates/cbv/candidates/filter.html index f06152ccb..7724b6283 100644 --- a/recruitment/templates/cbv/candidates/filter.html +++ b/recruitment/templates/cbv/candidates/filter.html @@ -2,183 +2,180 @@ {% load static %}
-
-
- {% trans 'Candidates' %} -
-
-
-
-
- - {{ form.mobile }} -
-
- - {{ form.hired_date }} -
-
- - -
-
- - {{ form.hired }} -
-
-
- - {{form.rejected_candidate__reject_reason_id}} +
+
+ {% trans 'Candidates' %} +
+
+
+
+
+ + {{ form.mobile }} +
+
+ + {{ form.hired_date }} +
+
+ + +
+
+ + {{ form.hired }} +
+
+
+ + {{form.rejected_candidate__reject_reason_id}} +
+
+
+
+
+ + {{ form.email }} +
+ +
+ + {{ form.gender }} +
+ +
+ + +
+ +
+ + {{ form.canceled }} +
+
+
+ + {{form.offer_letter_status}} +
+
+
-
-
-
- - {{ form.email }} -
+
+
+
+ {% trans 'Recruitment' %} +
+
+
+
+
+ + {{ form.recruitment_id }} +
-
- - {{ form.gender }} -
+
+ + {{ form.job_position_id }} +
-
- - -
+
+ + {{ form.start_date }} +
+
+ + {{ form.recruitment_id__closed }} +
-
- - {{ form.canceled }} -
-
-
- - {{form.offer_letter_status}} +
+ + {{ form.stage_id__stage_type }} +
+
+ + {{ form.stage_id__stage_managers }} +
+
+
+
+ + {{ form.stage_id }} +
+
+ + {{ form.job_position_id__department_id }} +
+ +
+ + {{ form.recruitment_id__company_id }} +
+ +
+ + {{ form.recruitment_id__recruitment_managers }} +
+
+ + {{ form.end_date }} +
+
+ + {{ form.skillzonecandidate_set__skill_zone_id }} +
+
-
-
-
-
-
- {% trans 'Recruitment' %} -
-
-
-
-
- - {{ form.recruitment_id }} -
- -
- - {{ form.job_position_id }} -
- -
- - {{ form.start_date }} -
-
- - {{ form.recruitment_id__closed }} -
- -
- - {{ form.stage_id__stage_type }} -
-
- - {{ form.stage_id__stage_managers }} -
+
+
+ {% trans 'Survey' %}
-
-
- - {{ form.stage_id }} -
-
- - {{ form.job_position_id__department_id }} -
+
+
+
+
+ + {{ form.survey_answer_by }} +
+
+ {% comment %}
+
+ + {{ form.survey_response }} +
+
{% endcomment %} +
+
+
-
- - {{ form.recruitment_id__company_id }} -
- -
- - {{ form.recruitment_id__recruitment_managers }} -
-
- - {{ form.end_date }} -
-
- - {{ form.skillzonecandidate_set__skill_zone_id }} -
+
+
+ {% trans 'Advanced' %}
-
-
-
-
-
- {% trans 'Survey' %} -
-
-
-
-
- - {{ form.survey_answer_by }} -
+
+
+
+
+ + {{ form.scheduled_from }} +
+
+ + {{ form.is_active }} +
+
+
+
+ + {{ form.scheduled_till }} +
+
+
- {% comment %}
-
- - {{ form.survey_response }} -
-
{% endcomment %} -
-
- -
-
- {% trans 'Advanced' %} -
-
-
-
-
- - {{ form.scheduled_from }} -
-
- - {{ form.is_active }} -
-
-
-
- - {{ form.scheduled_till }} -
-
-
-
-
- diff --git a/recruitment/templates/cbv/interview/forms/form_hx.html b/recruitment/templates/cbv/interview/forms/form_hx.html index fdfabc238..30de53f6e 100644 --- a/recruitment/templates/cbv/interview/forms/form_hx.html +++ b/recruitment/templates/cbv/interview/forms/form_hx.html @@ -1,8 +1 @@ {{form.employee_id}} - diff --git a/recruitment/templates/cbv/pipeline/pipeline_filter.html b/recruitment/templates/cbv/pipeline/pipeline_filter.html index cc2a7fb6a..46614d5a8 100644 --- a/recruitment/templates/cbv/pipeline/pipeline_filter.html +++ b/recruitment/templates/cbv/pipeline/pipeline_filter.html @@ -1,171 +1,128 @@ {% load i18n %} {% load static %}
-
-
{% trans 'Recruitment' %}
-
-
-
-
- - {{ form.recruitment_managers }} -
-
- - {{ form.start_date }} -
-
- - {{ form.start_from }} -
-
- - {{ form.closed }} -
-
+
+
{% trans 'Recruitment' %}
+
+
+
+
+ + {{ form.recruitment_managers }} +
+
+ + {{ form.start_date }} +
+
+ + {{ form.start_from }} +
+
+ + {{ form.closed }} +
+
-
-
- - {{ form.company_id }} -
-
- - {{ form.end_date }} -
-
- - {{ form.end_till }} -
-
- - {{ form.is_published }} -
+
+
+ + {{ form.company_id }} +
+
+ + {{ form.end_date }} +
+
+ + {{ form.end_till }} +
+
+ + {{ form.is_published }} +
+
+
-
-
-
-
{% trans 'Stage' %}
-
-
-
-
- - {{ stage_filter_obj.form.recruitment_id }} -
-
- - {{ stage_filter_obj.form.stage_type }} -
-
+
+
{% trans 'Stage' %}
+
+
+
+
+ + {{ stage_filter_obj.form.recruitment_id }} +
+
+ + {{ stage_filter_obj.form.stage_type }} +
+
-
-
- - {{ stage_filter_obj.form.stage_managers }} -
+
+
+ + {{ stage_filter_obj.form.stage_managers }} +
+
+
-
-
-
-
{% trans 'Candidates' %}
-
-
-
-
- - -
-
-
- - {{ candidate_filter_obj.form.rejected_candidate__reject_reason_id }} +
+
{% trans 'Candidates' %}
+
+
+
+
+ + +
+
+
+ + {{ candidate_filter_obj.form.rejected_candidate__reject_reason_id }} +
+
+ + {{ candidate_filter_obj.form.hired }} +
+
+ + {{ candidate_filter_obj.form.gender }} +
+
+ + {{ candidate_filter_obj.form.job_position_id }} +
+
+
+
+
+ + +
+
+ + {{ candidate_filter_obj.form.offer_letter_status }} +
+
+ + {{ candidate_filter_obj.form.canceled }} +
+
+ + {{ candidate_filter_obj.form.candidate_rating__rating }} +
+
+ + {{ candidate_filter_obj.form.job_position_id__department_id }} +
+
-
- - {{ candidate_filter_obj.form.hired }} -
-
- - {{ candidate_filter_obj.form.gender }} -
-
- - {{ candidate_filter_obj.form.job_position_id }} -
-
-
-
- - -
-
- - {{ candidate_filter_obj.form.offer_letter_status }} -
-
- - {{ candidate_filter_obj.form.canceled }} -
-
- - {{ candidate_filter_obj.form.candidate_rating__rating }} -
-
- - {{ candidate_filter_obj.form.job_position_id__department_id }} -
-
-
-
- diff --git a/static/images/ui/company_avatar.jpg b/static/images/ui/company_avatar.jpg new file mode 100644 index 000000000..dcb842229 Binary files /dev/null and b/static/images/ui/company_avatar.jpg differ diff --git a/static/index/country.js b/static/index/country.js index b58f67196..6ae5fc3de 100644 --- a/static/index/country.js +++ b/static/index/country.js @@ -750,5 +750,3 @@ document.addEventListener("DOMContentLoaded", function () { document.body.addEventListener("htmx:afterSettle", function (event) { initCountryStateDropdowns(); }); - -