From 41f74a6cc1c9536eccbeb2df4c600dd58bf8d312 Mon Sep 17 00:00:00 2001 From: Horilla Date: Thu, 15 Feb 2024 16:39:17 +0530 Subject: [PATCH] [UPDT] PAYROLL: Dashboard alignment, contract form help text and design updates --- payroll/models/models.py | 20 ++++----- payroll/static/payroll/dashboard.js | 6 ++- payroll/templates/contract_form.html | 53 +++++++++++++++++------- payroll/templates/payroll/dashboard.html | 3 +- 4 files changed, 54 insertions(+), 28 deletions(-) diff --git a/payroll/models/models.py b/payroll/models/models.py index b25d00ac1..3759acc20 100644 --- a/payroll/models/models.py +++ b/payroll/models/models.py @@ -139,7 +139,7 @@ class Contract(models.Model): ) contract_name = models.CharField( - max_length=250, help_text=_("Contract Title"), verbose_name=_("Contract") + max_length=250, help_text=_("Contract Title."), verbose_name=_("Contract") ) employee_id = models.ForeignKey( Employee, @@ -221,8 +221,16 @@ class Contract(models.Model): ) contract_document = models.FileField(upload_to="uploads/", null=True, blank=True) is_active = models.BooleanField(default=True) + deduct_leave_from_basic_pay = models.BooleanField( + default=True, verbose_name=_("Deduct From Basic Pay"), help_text=_("Take all the deduction from basic pay.") + ) + notice_period_in_month = models.IntegerField( + default=3, + help_text="Notice period in total months.", + validators=[min_zero], + ) calculate_daily_leave_amount = models.BooleanField( - default=True, verbose_name=_("Calculate Daily Leave Amount") + default=True, verbose_name=_("Calculate Daily Leave Amount"), help_text=_("Leave amount will be calculated by dividing the basic pay by number of working days.") ) deduction_for_one_leave_amount = models.FloatField( null=True, @@ -230,14 +238,6 @@ class Contract(models.Model): default=0, verbose_name=_("Deduction For One Leave Amount"), ) - deduct_leave_from_basic_pay = models.BooleanField( - default=True, verbose_name=_("Deduct From Basic Pay") - ) - notice_period_in_month = models.IntegerField( - default=3, - help_text="Notice period in total months", - validators=[min_zero], - ) note = models.TextField(null=True, blank=True,max_length=255) created_at = models.DateTimeField(auto_now_add=True, null=True) diff --git a/payroll/static/payroll/dashboard.js b/payroll/static/payroll/dashboard.js index 4374ede19..03cbf9851 100644 --- a/payroll/static/payroll/dashboard.js +++ b/payroll/static/payroll/dashboard.js @@ -235,13 +235,17 @@ $(document).ready(function () { department_total = response.department_total; if (department_total.length != 0) { $("#department_total").html(""); + $("#department_total").show() + $("#department_total_empty").hide() $.each(department_total, function (key, value) { $("#department_total").append( `
  • ${value["department"]}: ${value["amount"]}
  • ` ); }); } else { - $("#department_total").html( + $("#department_total").hide() + $("#department_total_empty").show() + $("#department_total_empty").html( `
    diff --git a/payroll/templates/contract_form.html b/payroll/templates/contract_form.html index 07ec4ac7c..a299aa8d0 100644 --- a/payroll/templates/contract_form.html +++ b/payroll/templates/contract_form.html @@ -19,23 +19,44 @@
    {% for field in form.visible_fields %} - {% if field.name != 'contract_status' %} -
    -
    - - {% if field.help_text != "" %} - - + + {% if field.name != 'contract_status' %} + + {% if field.name == 'note' %} +
    +
    + + {% if field.help_text != "" %} + + + {% endif %} +
    + {% if field.field.widget.input_type == "checkbox" %} {{ field.errors }} +
    + {{ field|add_class:"oh-switch__checkbox" }} +
    + {% else %} {{ field|add_class:"form-control" }} {% endif %} + {{field.errors}} +
    + {% else %} +
    +
    + + {% if field.help_text != "" %} + + + {% endif %} +
    + {% if field.field.widget.input_type == "checkbox" %} {{ field.errors }} +
    + {{ field|add_class:"oh-switch__checkbox" }} +
    + {% else %} {{ field|add_class:"form-control" }} {% endif %} + {{field.errors}} +
    {% endif %} -
    - {% if field.field.widget.input_type == "checkbox" %} {{ field.errors }} -
    - {{ field|add_class:"oh-switch__checkbox" }} -
    - {% else %} {{ field|add_class:"form-control" }} {% endif %} - {{field.errors}} -
    - {% endif %} + + {% endif %} {% endfor %}
    diff --git a/payroll/templates/payroll/dashboard.html b/payroll/templates/payroll/dashboard.html index f3497e047..f4e56ce5e 100644 --- a/payroll/templates/payroll/dashboard.html +++ b/payroll/templates/payroll/dashboard.html @@ -147,7 +147,8 @@
    {% trans "Total Amount :" %} {{currency}}
    {% trans "Department Total Amount" %}

    - + +