From d70f36f42b3a81d7a1369fc6776e6cec08ca9d95 Mon Sep 17 00:00:00 2001 From: Horilla Date: Wed, 6 Nov 2024 09:32:21 +0530 Subject: [PATCH] [UPDT] BASE: More conditions for action columns in tables --- base/models.py | 4 +- .../templates/base/auth/permission_lines.html | 3 + .../templates/base/auth/permission_table.html | 3 +- base/templates/base/company/company_view.html | 59 +- .../base/employee_type/type_view.html | 4 +- .../rotating_shift_assign_view.html | 788 +++++---- .../rotating_shift/rotating_shift_view.html | 107 +- .../rotating_work_type_assign_view.html | 98 +- .../shift_request/htmx/requests.html | 1448 +++++++++-------- .../shift_request/htmx/shift_comment.html | 35 +- .../work_type_request/htmx/requests.html | 781 +++++---- .../htmx/work_type_comment.html | 38 +- .../htmx/work_type_request_single_view.html | 76 +- base/views.py | 47 +- .../templates/generic/group_by_table.html | 22 +- .../templates/generic/horilla_list_table.html | 12 +- load_data/base_data.json | 229 ++- 17 files changed, 1980 insertions(+), 1774 deletions(-) diff --git a/base/models.py b/base/models.py index 1aca096f4..5b63a8ef5 100644 --- a/base/models.py +++ b/base/models.py @@ -1546,7 +1546,9 @@ class DashboardEmployeeCharts(HorillaModel): from employee.models import Employee employee = models.ForeignKey(Employee, on_delete=models.CASCADE) - charts = models.JSONField(default=list, blank=True, null=True) + charts = models.JSONField( + verbose_name=_("Excluded Charts"), default=list, blank=True, null=True + ) def __str__(self): return f"{self.employee} - charts" diff --git a/base/templates/base/auth/permission_lines.html b/base/templates/base/auth/permission_lines.html index 82e6d8ab1..95ca441b8 100644 --- a/base/templates/base/auth/permission_lines.html +++ b/base/templates/base/auth/permission_lines.html @@ -62,6 +62,9 @@ {% endif %} diff --git a/base/templates/base/rotating_shift/rotating_shift_view.html b/base/templates/base/rotating_shift/rotating_shift_view.html index 0114fc6da..2227f4534 100644 --- a/base/templates/base/rotating_shift/rotating_shift_view.html +++ b/base/templates/base/rotating_shift/rotating_shift_view.html @@ -1,64 +1,55 @@ {% load i18n %}
-
-
-
-
{% trans "Title" %}
-
{% trans "Shift 1" %}
-
{% trans "Shift 2" %}
-
{% trans "Additional Shifts" %}
-
{% trans "Actions" %}
-
-
-
- {% for rshift in rshifts %} -
-
{{rshift.name}}
-
{{rshift.shift1}}
-
{{rshift.shift2}}
-
- {% if rshift.additional_shifts %} - {% for shift in rshift.additional_shifts %} - {{shift}}
- {% endfor %} - {% else %} - {{rshift.additional_shifts}} - {% endif %} +
+
+
+
{% trans "Title" %}
+
{% trans "Shift 1" %}
+
{% trans "Shift 2" %}
+
{% trans "Additional Shifts" %}
+ {% if perms.base.change_rotatingshift or perms.base.delete_rotatingshift %} +
{% trans "Actions" %}
+ {% endif %} +
- {% if perms.base.change_rotatingshift or perms.base.delete_rotatingshift %} -
-
- {% if perms.base.change_rotatingshift %} - - - {% endif %} {% if perms.base.delete_rotatingshift %} -
- {% csrf_token %} - -
- {% endif %} -
+
+ {% for rshift in rshifts %} +
+
{{rshift.name}}
+
{{rshift.shift1}}
+
{{rshift.shift2}}
+
+ {% if rshift.additional_shifts %} + {% for shift in rshift.additional_shifts %} + {{shift}}
+ {% endfor %} + {% else %} + {{rshift.additional_shifts}} + {% endif %} +
+ {% if perms.base.change_rotatingshift or perms.base.delete_rotatingshift %} +
+
+ {% if perms.base.change_rotatingshift %} + + + + {% endif %} + {% if perms.base.delete_rotatingshift %} +
+ {% csrf_token %} + +
+ {% endif %} +
+
+ {% endif %} +
+ {% endfor %}
- {% endif %} -
- {% endfor %}
-
diff --git a/base/templates/base/rotating_work_type/rotating_work_type_assign_view.html b/base/templates/base/rotating_work_type/rotating_work_type_assign_view.html index 13a8f2cdf..092afbca7 100644 --- a/base/templates/base/rotating_work_type/rotating_work_type_assign_view.html +++ b/base/templates/base/rotating_work_type/rotating_work_type_assign_view.html @@ -76,7 +76,9 @@ hx-target="#view-container" hx-get="{% url 'rotating-work-type-assign-view' %}?{{pd}}&orderby=next_change_date">{% trans "Next Switch" %}
{% trans "Next Work Type" %}
-
{% trans "Actions" %}
+ {% if perms.base.change_rotatingworktypeassign or request.user|is_reportingmanager or perms.base.delete_rotatingworktypeassign %} +
{% trans "Actions" %}
+ {% endif %}
@@ -127,57 +129,59 @@
{{rwork_type.next_change_date}}
{{rwork_type.next_work_type}}
-
-
- {% if perms.base.change_rotatingworktypeassign or request.user|is_reportingmanager %} - - - - - - - {% endif %} - {% if perms.base.change_rotatingworktypeassign or request.user|is_reportingmanager %} - {% if rwork_type.is_active %} -
+
+ {% if perms.base.change_rotatingworktypeassign or request.user|is_reportingmanager %} + + + + + + + {% endif %} + {% if perms.base.change_rotatingworktypeassign or request.user|is_reportingmanager %} + {% if rwork_type.is_active %} + + + + {% else %} +
+ +
+ {% endif %} + {% endif %} + {% if perms.base.delete_rotatingworktypeassign or request.user|is_reportingmanager %} +
- -
- {% else %} -
-
{% endif %} - {% endif %} - {% if perms.base.delete_rotatingworktypeassign or request.user|is_reportingmanager %} -
- {% csrf_token %} - -
- {% endif %} +
-
+ {% endif %}
{% endfor %} diff --git a/base/templates/shift_request/htmx/requests.html b/base/templates/shift_request/htmx/requests.html index 2421f9812..ed6631bc2 100755 --- a/base/templates/shift_request/htmx/requests.html +++ b/base/templates/shift_request/htmx/requests.html @@ -4,747 +4,771 @@ {% load i18n %} {% include 'filter_tags.html' %}
- -
- {% if data %} -
-
-
- -
-
    -
-
-
-
-
-
- -
-
-
-
-
-
- -
-
-
- {% trans "Employee" %} -
-
{% trans "Requested Shift" %}
-
{% trans "Previous/Current Shift" %}
-
{% trans "Requested Date" %}
-
{% trans "Requested Till" %}
-
{% trans "Status" %}
-
{% trans "Description" %}
-
{% trans "Comment" %}
-
{% trans "Actions" %}
- {% if perms.base.change_shiftrequest or request.user|is_reportingmanager %} -
{% trans "Confirmation" %}
- {% endif %} -
-
-
- {% for shift_request in data %} -
-
-
- -
-
-
-
-
- Username + +
+ {% if data %} +
+
+
+ +
+
    +
- {{shift_request.employee_id}} -
-
{{shift_request.shift_id}}
-
{{shift_request.previous_shift_id}}
-
{{shift_request.requested_date}}
-
{{shift_request.requested_till}}
-
{% if shift_request.approved %}{% trans "Approved" %}{% elif shift_request.canceled %}{% trans "Rejected" %}{% else %}{% trans "Requested" %}{% endif %}
-
{{shift_request.description|truncatechars:30}}
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+ {% trans "Employee" %} +
+
{% trans "Requested Shift" %}
+
{% trans "Previous/Current Shift" %}
+
{% trans "Requested Date" %}
+
{% trans "Requested Till" %}
+
+ {% trans "Status" %}
+
{% trans "Description" %}
+
{% trans "Comment" %}
+
{% trans "Actions" %}
+ {% if perms.base.change_shiftrequest or request.user|is_reportingmanager %} +
{% trans "Confirmation" %}
+ {% endif %} +
+
+
+ {% for shift_request in data %} +
+
+
+ +
+
+
+
+
+ Username +
+ {{shift_request.employee_id}} +
+
+
{{shift_request.shift_id}}
+
{{shift_request.previous_shift_id}} +
+
+ {{shift_request.requested_date}}
+
+ {{shift_request.requested_till}}
+
+ {% if shift_request.approved %} + {% trans "Approved" %} + {% elif shift_request.canceled %} + {% trans "Rejected" %} + {% else %} + {% trans "Requested" %} + {% endif %} +
-
+
+ {{shift_request.description|truncatechars:30}} +
- +
+ +
+
+ {% if request.user.employee_get == shift_request.employee_id or perms.base.change_shiftrequest or perms.base.add_shiftrequest or perms.base.delete_shiftrequest or request.user|is_reportingmanager %} +
+ {% if request.user.employee_get == shift_request.employee_id or perms.base.change_shiftrequest or request.user|is_reportingmanager %} + {% if shift_request.approved == False and not shift_request.canceled %} + + {% else %} + + {% endif %} + {% endif %} + {% if request.user.employee_get == shift_request.employee_id or perms.base.add_shiftrequest or request.user|is_reportingmanager %} + + + + {% endif %} + {% if request.user.employee_get == shift_request.employee_id or perms.base.delete_shiftrequest or request.user|is_reportingmanager %} + {% if shift_request.approved == False and shift_request.canceled == False %} +
+ {% csrf_token %} + +
+ {% elif perms.base.delete_shiftrequest or request.user|is_reportingmanager %} +
+ {% csrf_token %} + +
+ {% else %} + + {% endif %} + {% endif %} +
+ {% endif %} +
+ {% if perms.base.change_shiftrequest or request.user|is_reportingmanager %} +
+
+ {% if shift_request.approved == False and shift_request.canceled == False %} + + + + {% else %} + + + + {% endif %} + + {% if shift_request.canceled == False %} + + + + {% else %} + + + + {% endif %} +
+
+ {% endif %} +
+ {% endfor %} +
+
+ +
-
-
- {% if shift_request.approved == False and not shift_request.canceled %} - - {% else %} - + +
+ + {% trans "Page" %} {{ data.number }} {% trans "of" %} {{ data.paginator.num_pages }}. + +
-
- {% if perms.base.change_shiftrequest or request.user|is_reportingmanager %} -
-
- {% if shift_request.approved == False and shift_request.canceled == False %} - - - - {% else %} - - - - {% endif %} + + +
+ + {% else %} + +
+ +
+ {% trans "No search result found!" %} +
+
+ + {% endif %} +
+ - {% if shift_request.canceled == False %} - - - - {% else %} - - - + + +
+ {% if allocated_data %} +
+
+
+ +
+
    +
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+ {% trans "Employee" %} +
+
+ {% trans "Allocated Employee" %} +
+
{% trans "User Availability" %}
+
{% trans "Requested Shift" %}
+
{% trans "Previous/Current Shift" %}
+
{% trans "Requested Date" %}
+
{% trans "Requested Till" %}
+
{% trans "Description" %}
+
{% trans "Comment" %}
+
{% trans "Actions" %}
+ {% if perms.base.change_shiftrequest or request.user|is_reportingmanager %} +
{% trans "Confirmation" %}
{% endif %}
-
+
+
+ {% for shift_request in allocated_data %} +
+
+
+ +
+
+
+
+
+ Username +
+ {{shift_request.employee_id}} +
+
+
+
+
+ +
+ {{shift_request.reallocate_to}} +
+
+
+ {% if shift_request.reallocate_approved == True %} +
+ {% trans "Available" %} +
+ {% elif shift_request.reallocate_canceled == True %} +
+ {% trans "Not Available" %} +
+ {% else %} +
+ {% trans "Not Marked" %} +
+ {% endif %} +
+
{{shift_request.shift_id}}
+
{{shift_request.previous_shift_id}} +
+
+ {{shift_request.requested_date}}
+
+ {{shift_request.requested_till}}
+
+ {{shift_request.description|truncatechars:17}}
+ +
+ + + +
+ + {% if perms.base.change_shiftrequest or request.user|is_reportingmanager %} +
+
+ {% if shift_request.approved == False and not shift_request.canceled %} + + {% else %} + + {% endif %} + {% if shift_request.approved == False and shift_request.canceled == False %} +
+ {% csrf_token %} + +
+ {% elif perms.base.change_shiftrequest or request.user|is_reportingmanager %} +
+ {% csrf_token %} + +
+ {% else %} + + {% endif %} +
+
+ {% endif %} + +
+ +
+ + {% if request.user.employee_get == shift_request.reallocate_to and not request.user|is_reportingmanager %} + {% if shift_request.approved == True or shift_request.canceled == True or shift_request.reallocate_approved == True %} + + {% else %} + + + + {% endif %} + {% endif %} + + {% if perms.base.change_shiftrequest or request.user|is_reportingmanager %} + {% if shift_request.approved == False and shift_request.canceled == False %} + + + + {% else %} + + {% endif %} + {% endif %} + + {% if request.user.employee_get == shift_request.reallocate_to and not request.user|is_reportingmanager %} + {% if shift_request.reallocate_canceled == True or shift_request.approved == True %} + + {% else %} + + + + {% endif %} + {% endif %} + + {% if request.user.employee_get == shift_request.employee_id and not request.user|is_reportingmanager %} + + {% if shift_request.approved == False and not shift_request.canceled %} + + {% else %} + + {% endif %} + + {% if shift_request.approved == False and shift_request.canceled == False %} +
+ {% csrf_token %} + +
+ {% else %} + + {% endif %} + {% endif %} + + {% if request.user|is_reportingmanager %} + {% if shift_request.canceled == True %} + + {% else %} + + + + {% endif %} + {% endif %} +
+
+
+ {% endfor %} +
+
+
+ +
+ + +
+ + {% trans "Page" %} {{ allocated_data.number }} {% trans "of" %} {{ allocated_data.paginator.num_pages }}. + +
- {% endfor %} -
-
-
- -
- - -
- - {% trans "Page" %} {{ data.number }} {% trans "of" %} {{ data.paginator.num_pages }}. - - -
- - {% else %} - -
- -
- {% trans "No search result found!" %} -
-
- - {% endif %} -
- - - - -
- {% if allocated_data %} -
-
-
- -
-
    -
-
-
-
-
-
- -
-
-
-
-
-
- -
-
-
- {% trans "Employee" %} -
-
- {% trans "Allocated Employee" %} -
-
{% trans "User Availability" %}
-
{% trans "Requested Shift" %}
-
{% trans "Previous/Current Shift" %}
-
{% trans "Requested Date" %}
-
{% trans "Requested Till" %}
-
{% trans "Description" %}
-
{% trans "Comment" %}
-
{% trans "Actions" %}
- {% if perms.base.change_shiftrequest or request.user|is_reportingmanager %} -
{% trans "Confirmation" %}
- {% endif %} -
-
-
- {% for shift_request in allocated_data %} -
-
-
- -
-
-
-
-
- Username -
- {{shift_request.employee_id}} -
-
-
-
-
- -
- {{shift_request.reallocate_to}} -
-
-
- {% if shift_request.reallocate_approved == True %} -
- {% trans "Available" %} -
- {% elif shift_request.reallocate_canceled == True %} -
- {% trans "Not Available" %} -
- {% else %} -
- {% trans "Not Marked" %} -
- {% endif %} -
-
{{shift_request.shift_id}}
-
{{shift_request.previous_shift_id}}
-
{{shift_request.requested_date}}
-
{{shift_request.requested_till}}
-
{{shift_request.description|truncatechars:17}}
- -
- - - -
- - {% if perms.base.change_shiftrequest or request.user|is_reportingmanager %} -
-
- {% if shift_request.approved == False and not shift_request.canceled %} - - {% else %} - - {% endif %} - {% if shift_request.approved == False and shift_request.canceled == False %} -
- {% csrf_token %} - -
- {% elif perms.base.change_shiftrequest or request.user|is_reportingmanager %} -
- {% csrf_token %} - -
- {% else %} - - {% endif %} -
-
+ {% if allocated_data.has_next %} +
  • + {% trans "Next" %} +
  • +
  • + {% trans "Last" %} +
  • {% endif %} - -
    - -
    - - {% if request.user.employee_get == shift_request.reallocate_to and not request.user|is_reportingmanager %} - {% if shift_request.approved == True or shift_request.canceled == True or shift_request.reallocate_approved == True %} - - {% else %} - - - - {% endif %} - {% endif %} - - {% if perms.base.change_shiftrequest or request.user|is_reportingmanager %} - {% if shift_request.approved == False and shift_request.canceled == False %} - - - - - {% else %} - - {% endif %} - {% endif %} - - {% if request.user.employee_get == shift_request.reallocate_to and not request.user|is_reportingmanager %} - {% if shift_request.reallocate_canceled == True or shift_request.approved == True %} - - {% else %} - - - - {% endif %} - {% endif %} - - {% if request.user.employee_get == shift_request.employee_id and not request.user|is_reportingmanager %} - - {% if shift_request.approved == False and not shift_request.canceled %} - - {% else %} - - {% endif %} - {% if shift_request.approved == False and shift_request.canceled == False %} -
    - {% csrf_token %} - -
    - {% else %} - - {% endif %} - {% endif %} - - - {% if request.user|is_reportingmanager %} - {% if shift_request.canceled == True %} - - {% else %} - - - - {% endif %} - {% endif %} -
    - -
    - - -
    - {% endfor %} -
    -
    + +
    - -
    - - -
    - - {% trans "Page" %} {{ allocated_data.number }} {% trans "of" %} {{ allocated_data.paginator.num_pages }}. - - -
    - - {% else %} - -
    - -
    - {% trans "No search result found!" %} -
    -
    - - {% endif %} + + {% else %} + +
    + +
    + {% trans "No search result found!" %} +
    +
    + + {% endif %}
    - -