diff --git a/employee/templates/tabs/document_tab.html b/employee/templates/tabs/document_tab.html index e5d625ed3..3f6d28e3d 100644 --- a/employee/templates/tabs/document_tab.html +++ b/employee/templates/tabs/document_tab.html @@ -71,29 +71,19 @@ {% endif %}
-
- + + {% trans "Title needs to be more than 3 letters" %} - +
- + {{document.document_request_id.description|truncatechars:60}} + {% if document.issue_date %} + + {% trans "Issue Date" %} : {{ document.issue_date }} + + {% endif %}
@@ -130,28 +120,30 @@ {% endif %} {% endif %} -
- {% csrf_token %} - -
+ + + + {% endif %}
diff --git a/employee/templates/tabs/htmx/document_create_form.html b/employee/templates/tabs/htmx/document_create_form.html index ac5139af9..7c6650f36 100644 --- a/employee/templates/tabs/htmx/document_create_form.html +++ b/employee/templates/tabs/htmx/document_create_form.html @@ -5,8 +5,7 @@
-
+ {{form.errors}} {{form.as_p}}
diff --git a/employee/templates/tabs/htmx/document_form.html b/employee/templates/tabs/htmx/document_form.html index 3628bbf6f..1155e5f5a 100644 --- a/employee/templates/tabs/htmx/document_form.html +++ b/employee/templates/tabs/htmx/document_form.html @@ -1,100 +1,79 @@ {% load i18n %} {% load widget_tweaks %}
- {% trans "Upload File" %} -
-
+ {% csrf_token %} {% if form.employee_id %} - + {% elif form.candidate_id %} - + {% endif %} - - - {{form.non_field_errors}} {{form.document}} {{form.document.errors}} + + + {{ form.non_field_errors }} +
- - {{form.expiry_date |attr:"type:date" }} - {{form.expiry_date.errors }} + {{ form.document.errors }} + + {{ form.document }}
- {% if not model == "CandidateDocument" %} -
+
- - {{form.notify_before}} {{form.notify_before.errors}} + + {{ form.issue_date }} + {{ form.issue_date.errors }}
+
+
+
+
+ + {{ form.expiry_date }} + {{ form.expiry_date.errors }} +
+
+ {% if not model == "CandidateDocument" %} +
+
+ + {{ form.notify_before }} {{ form.notify_before.errors }} +
+
{% endif %}
  • - {% trans "Upload " %}{{form.instance.document_request_id.format}} + {% trans "Upload " %}{{ form.instance.document_request_id.format }} {% trans "file" %}
  • {% trans "Max size of the file" %} - {{form.instance.document_request_id.max_size}} MB + {{ form.instance.document_request_id.max_size }} MB
@@ -104,7 +83,7 @@ ") + return HttpResponse("") @login_required diff --git a/horilla_documents/forms.py b/horilla_documents/forms.py index a3fc5d9ce..64e618626 100644 --- a/horilla_documents/forms.py +++ b/horilla_documents/forms.py @@ -52,11 +52,6 @@ def __init__(self, *args, **kwargs): class DocumentForm(ModelForm): """form to create a new Document""" - expiry_date = forms.DateField( - widget=forms.DateInput(attrs={"type": "date"}), - required=False, - ) - verbose_name = "Document" class Meta: @@ -65,6 +60,12 @@ class Meta: exclude = ["document_request_id", "status", "reject_reason", "is_active"] widgets = { "employee_id": forms.HiddenInput(), + "issue_date": forms.DateInput( + attrs={"type": "date", "class": "oh-input w-100"} + ), + "expiry_date": forms.DateInput( + attrs={"type": "date", "class": "oh-input w-100"} + ), } def as_p(self): @@ -80,15 +81,19 @@ class DocumentUpdateForm(ModelForm): """form to Update a Document""" verbose_name = "Document" - expiry_date = forms.DateField( - widget=forms.DateInput(attrs={"type": "date"}), - required=False, - ) class Meta: model = Document fields = "__all__" exclude = ["is_active"] + widgets = { + "issue_date": forms.DateInput( + attrs={"type": "date", "class": "oh-input w-100"} + ), + "expiry_date": forms.DateInput( + attrs={"type": "date", "class": "oh-input w-100"} + ), + } class DocumentRejectForm(ModelForm): diff --git a/horilla_documents/models.py b/horilla_documents/models.py index a12499211..72fdce326 100644 --- a/horilla_documents/models.py +++ b/horilla_documents/models.py @@ -73,9 +73,14 @@ class Document(HorillaModel): document = models.FileField(upload_to="employee/documents", null=True) status = models.CharField(choices=STATUS, max_length=10, default="requested") reject_reason = models.TextField(blank=True, null=True, max_length=255) - expiry_date = models.DateField(null=True, blank=True) - notify_before = models.IntegerField(default=1, null=True) - is_digital_asset = models.BooleanField(default=False) + issue_date = models.DateField(null=True, blank=True, verbose_name=_("Issue Date")) + expiry_date = models.DateField(null=True, blank=True, verbose_name=_("Expiry Date")) + notify_before = models.IntegerField( + default=1, null=True, verbose_name=_("Notify Before") + ) + is_digital_asset = models.BooleanField( + default=False, verbose_name=_("Is Digital Asset") + ) objects = HorillaCompanyManager( related_company_field="employee_id__employee_work_info__company_id" )