[UPDT] HORILLA DOCUMENTS: Updated documents app by adding verbose name for model and fields
This commit is contained in:
@@ -1,91 +1,76 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
<div class="oh-modal__dialog-header pb-0">
|
<div class="oh-modal__dialog-header pb-0">
|
||||||
<h5 class="oh-modal__dialog-title" id="objectCreateModalLabel">
|
<h5 class="oh-modal__dialog-title" id="objectCreateModalLabel">
|
||||||
{% trans "Document Request" %}
|
{{form.verbose_name}}
|
||||||
</h5>
|
</h5>
|
||||||
<button class="oh-modal__close" aria-label="Close">
|
<button class="oh-modal__close" aria-label="Close">
|
||||||
<ion-icon name="close-outline"></ion-icon>
|
<ion-icon name="close-outline"></ion-icon>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="oh-modal__dialog-body">
|
<div class="oh-modal__dialog-body">
|
||||||
<form
|
<form id="file-form"
|
||||||
id="file-form"
|
{% if document_request %}
|
||||||
{% if document_request %}
|
hx-post="{% url 'document-request-update' document_request.id %}"
|
||||||
hx-post="{% url 'document-request-update' document_request.id %}"
|
{% else %}
|
||||||
{% else %}
|
{% if form.candidate_id %}
|
||||||
{% if form.candidate_id %}
|
hx-post="{% url 'candidate-document-request' %}"
|
||||||
hx-post = "{% url 'candidate-document-request' %}"
|
{% else %}
|
||||||
{% else %}
|
hx-post="{% url 'document-request-create' %}"
|
||||||
hx-post="{% url 'document-request-create' %}"
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
hx-target="#objectCreateModalTarget"
|
||||||
hx-target="#objectCreateModalTarget"
|
hx-encoding="multipart/form-data" class="oh-profile-section pt-3">
|
||||||
hx-encoding="multipart/form-data"
|
{{form.errors}}
|
||||||
class="oh-profile-section pt-3"
|
<div class="row">
|
||||||
>
|
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||||
{{form.errors}}
|
<div class="oh-input-group">
|
||||||
<div class="row">
|
<label class="oh-label" for="{{form.title.id_for_label}}">{{form.title.label}}</label>
|
||||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
{{form.title}}
|
||||||
<div class="oh-input-group">
|
</div>
|
||||||
<label class="oh-label" for="{{form.title.id_for_label}}"
|
</div>
|
||||||
>{% trans "Title" %}</label
|
{% if form.employee_id %}
|
||||||
>
|
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||||
{{form.title}}
|
<div class="oh-input-group">
|
||||||
</div>
|
<label class="oh-label" for="{{form.employee_id.id_for_label}}">{{form.employee_id.label}}</label>
|
||||||
</div>
|
{{form.employee_id}}
|
||||||
{% if form.employee_id %}
|
</div>
|
||||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
</div>
|
||||||
<div class="oh-input-group">
|
{% elif form.candidate_id %}
|
||||||
<label class="oh-label" for="{{form.employee_id.id_for_label}}"
|
<div class="col-sm-12 col-md-12 col-lg-12 {% if form.candidate_id.initial %}d-none{% endif %}">
|
||||||
>{% trans "Employees" %}</label
|
<div class="oh-input-group">
|
||||||
>
|
<label class="oh-label" for="{{form.candidate_id.id_for_label}}">{{form.candidate_id.label}}</label>
|
||||||
{{form.employee_id}}
|
{{form.candidate_id}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
{% elif form.candidate_id %}
|
|
||||||
<div class="col-sm-12 col-md-12 col-lg-12 {% if form.candidate_id.initial %}d-none{% endif %}">
|
|
||||||
<div class="oh-input-group">
|
|
||||||
<label class="oh-label" for="{{form.candidate_id.id_for_label}}"
|
|
||||||
>{% trans "candidate" %}</label
|
|
||||||
>
|
|
||||||
{{form.candidate_id}}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
|
||||||
<div class="oh-input-group">
|
|
||||||
<label class="oh-label" for="{{form.format.id_for_label}}"
|
|
||||||
>{% trans "Format" %}</label
|
|
||||||
>
|
|
||||||
{{form.format}}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="row">
|
||||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||||
<div class="oh-input-group">
|
<div class="oh-input-group">
|
||||||
<label class="oh-label" for="{{form.max_size.id_for_label}}"
|
<label class="oh-label" for="{{form.format.id_for_label}}">{{form.format.label}}</label>
|
||||||
>{% trans "Max size (in MB)" %}</label
|
{{form.format}}
|
||||||
>
|
</div>
|
||||||
{{form.max_size}}
|
</div>
|
||||||
|
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||||
|
<div class="oh-input-group">
|
||||||
|
<label class="oh-label" for="{{form.max_size.id_for_label}}">{{form.max_size.label}}</label>
|
||||||
|
{{form.max_size}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="row">
|
||||||
</div>
|
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||||
<div class="row">
|
<div class="oh-input-group">
|
||||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
<label class="oh-label" for="{{form.description.id_for_label}}">{{form.description.label}}</label>
|
||||||
<div class="oh-input-group">
|
{{form.description}}
|
||||||
<label class="oh-label" for="{{form.description.id_for_label}}"
|
</div>
|
||||||
>{% trans "Description" %}</label
|
</div>
|
||||||
>
|
|
||||||
{{form.description}}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="oh-modal__dialog-footer p-0 mt-3">
|
||||||
</div>
|
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow">
|
||||||
<div class="oh-modal__dialog-footer p-0 mt-3">
|
{% trans "Save" %}
|
||||||
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow">
|
</button>
|
||||||
{% trans "Save" %}
|
</div>
|
||||||
</button>
|
</form>
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{% load i18n %} {% load widget_tweaks %}
|
{% load i18n %} {% load widget_tweaks %}
|
||||||
<div class="oh-modal__dialog-header pb-0">
|
<div class="oh-modal__dialog-header pb-0">
|
||||||
<span class="oh-modal__dialog-title" id="uploadFileModalLabel">{% trans "Upload File" %}</span>
|
<span class="oh-modal__dialog-title" id="uploadFileModalLabel">{% trans "Upload" %} {{form.verbose_name}}</span>
|
||||||
<button class="oh-modal__close--custom" aria-label="Close"
|
<button class="oh-modal__close--custom" aria-label="Close"
|
||||||
onclick="event.stopPropagation();event.preventDefault();$(this).closest('.oh-modal--show').removeClass('oh-modal--show');">
|
onclick="event.stopPropagation();event.preventDefault();$(this).closest('.oh-modal--show').removeClass('oh-modal--show');">
|
||||||
<ion-icon name="close-outline" role="img" class="md hydrated" aria-label="close outline"></ion-icon>
|
<ion-icon name="close-outline" role="img" class="md hydrated" aria-label="close outline"></ion-icon>
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
<div class="col-12 col-sm-12 col-md-4 col-lg-6">
|
<div class="col-12 col-sm-12 col-md-4 col-lg-6">
|
||||||
<div class="oh-input__group">
|
<div class="oh-input__group">
|
||||||
<label class="oh-input__label" for="{{form.expiry_date.id_for_label}}">
|
<label class="oh-input__label" for="{{form.expiry_date.id_for_label}}">
|
||||||
{% trans "Expiry Date" %}
|
{{ form.expiry_date.label }}
|
||||||
</label>
|
</label>
|
||||||
{{ form.expiry_date }}
|
{{ form.expiry_date }}
|
||||||
{{ form.expiry_date.errors }}
|
{{ form.expiry_date.errors }}
|
||||||
|
|||||||
@@ -256,9 +256,9 @@
|
|||||||
{% if work_type_request.approved == False and not work_type_request.canceled %}
|
{% if work_type_request.approved == False and not work_type_request.canceled %}
|
||||||
<a
|
<a
|
||||||
hx-get="{% url 'work-type-request-update' work_type_request.id %}"
|
hx-get="{% url 'work-type-request-update' work_type_request.id %}"
|
||||||
hx-target="#workTypeRequestUpdateModalBody"
|
hx-target="#objectUpdateModalTarget"
|
||||||
data-toggle="oh-modal-toggle"
|
data-toggle="oh-modal-toggle"
|
||||||
data-target="#workTypeRequestUpdateModal"
|
data-target="#objectUpdateModal"
|
||||||
class="oh-btn oh-btn--light-bkg w-50"
|
class="oh-btn oh-btn--light-bkg w-50"
|
||||||
title="{% trans 'Edit' %}"
|
title="{% trans 'Edit' %}"
|
||||||
><ion-icon
|
><ion-icon
|
||||||
@@ -1069,36 +1069,6 @@
|
|||||||
<div class="oh-modal__dialog" id="rotatingWorkTypeAssignDetail"></div>
|
<div class="oh-modal__dialog" id="rotatingWorkTypeAssignDetail"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
|
||||||
class="oh-modal"
|
|
||||||
id="workTypeRequestUpdateModal"
|
|
||||||
role="dialog"
|
|
||||||
aria-labelledby="workTypeRequestUpdateModal"
|
|
||||||
aria-hidden="true"
|
|
||||||
>
|
|
||||||
<div class="oh-modal__dialog">
|
|
||||||
<div class="oh-modal__dialog-header">
|
|
||||||
<h5
|
|
||||||
class="oh-modal__dialog-title"
|
|
||||||
id="workTypeRequestUpdateModalLabel"
|
|
||||||
>
|
|
||||||
{% trans "Work type Request" %}
|
|
||||||
</h5>
|
|
||||||
<button
|
|
||||||
class="oh-modal_close--custom"
|
|
||||||
onclick="event.stopPropagation(); var modalElement = this.closest('.oh-modal'); modalElement.classList.toggle('oh-modal--show');"
|
|
||||||
>
|
|
||||||
<ion-icon name="close-outline"></ion-icon>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
|
||||||
class="oh-modal__dialog-body"
|
|
||||||
id="workTypeRequestUpdateModalBody"
|
|
||||||
></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="oh-modal"
|
class="oh-modal"
|
||||||
id="shiftRequestModalUpdate"
|
id="shiftRequestModalUpdate"
|
||||||
|
|||||||
@@ -52,8 +52,6 @@ class DocumentRequestForm(ModelForm):
|
|||||||
class DocumentForm(ModelForm):
|
class DocumentForm(ModelForm):
|
||||||
"""form to create a new Document"""
|
"""form to create a new Document"""
|
||||||
|
|
||||||
verbose_name = "Document"
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Document
|
model = Document
|
||||||
fields = "__all__"
|
fields = "__all__"
|
||||||
@@ -80,8 +78,6 @@ class DocumentForm(ModelForm):
|
|||||||
class DocumentUpdateForm(ModelForm):
|
class DocumentUpdateForm(ModelForm):
|
||||||
"""form to Update a Document"""
|
"""form to Update a Document"""
|
||||||
|
|
||||||
verbose_name = "Document"
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Document
|
model = Document
|
||||||
fields = "__all__"
|
fields = "__all__"
|
||||||
|
|||||||
@@ -42,15 +42,27 @@ def document_create(instance):
|
|||||||
|
|
||||||
|
|
||||||
class DocumentRequest(HorillaModel):
|
class DocumentRequest(HorillaModel):
|
||||||
title = models.CharField(max_length=100)
|
title = models.CharField(max_length=100, verbose_name=_("Title"))
|
||||||
employee_id = models.ManyToManyField(Employee)
|
employee_id = models.ManyToManyField(Employee, verbose_name=_("Employees"))
|
||||||
format = models.CharField(choices=FORMATS, max_length=10)
|
format = models.CharField(choices=FORMATS, max_length=10, verbose_name=_("Format"))
|
||||||
max_size = models.IntegerField(blank=True, null=True)
|
max_size = models.IntegerField(
|
||||||
description = models.TextField(blank=True, null=True, max_length=255)
|
blank=True, null=True, verbose_name=_("Max size (In MB)")
|
||||||
|
)
|
||||||
|
description = models.TextField(
|
||||||
|
blank=True, null=True, max_length=255, verbose_name=_("Description")
|
||||||
|
)
|
||||||
objects = HorillaCompanyManager(
|
objects = HorillaCompanyManager(
|
||||||
related_company_field="employee_id__employee_work_info__company_id"
|
related_company_field="employee_id__employee_work_info__company_id"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
"""
|
||||||
|
Meta class to add additional options
|
||||||
|
"""
|
||||||
|
|
||||||
|
verbose_name = _("Document Request")
|
||||||
|
verbose_name_plural = _("Document Requests")
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.title
|
return self.title
|
||||||
|
|
||||||
@@ -66,12 +78,18 @@ def document_request_m2m_changed(sender, instance, action, **kwargs):
|
|||||||
|
|
||||||
class Document(HorillaModel):
|
class Document(HorillaModel):
|
||||||
title = models.CharField(max_length=250)
|
title = models.CharField(max_length=250)
|
||||||
employee_id = models.ForeignKey(Employee, on_delete=models.PROTECT)
|
employee_id = models.ForeignKey(
|
||||||
|
Employee, on_delete=models.PROTECT, verbose_name=_("Employee")
|
||||||
|
)
|
||||||
document_request_id = models.ForeignKey(
|
document_request_id = models.ForeignKey(
|
||||||
DocumentRequest, on_delete=models.PROTECT, null=True
|
DocumentRequest, on_delete=models.PROTECT, null=True
|
||||||
)
|
)
|
||||||
document = models.FileField(upload_to="employee/documents", null=True)
|
document = models.FileField(
|
||||||
status = models.CharField(choices=STATUS, max_length=10, default="requested")
|
upload_to="employee/documents", null=True, verbose_name=_("Document")
|
||||||
|
)
|
||||||
|
status = models.CharField(
|
||||||
|
choices=STATUS, max_length=10, default="requested", verbose_name=_("Status")
|
||||||
|
)
|
||||||
reject_reason = models.TextField(blank=True, null=True, max_length=255)
|
reject_reason = models.TextField(blank=True, null=True, max_length=255)
|
||||||
issue_date = models.DateField(null=True, blank=True, verbose_name=_("Issue Date"))
|
issue_date = models.DateField(null=True, blank=True, verbose_name=_("Issue Date"))
|
||||||
expiry_date = models.DateField(null=True, blank=True, verbose_name=_("Expiry Date"))
|
expiry_date = models.DateField(null=True, blank=True, verbose_name=_("Expiry Date"))
|
||||||
@@ -85,6 +103,14 @@ class Document(HorillaModel):
|
|||||||
related_company_field="employee_id__employee_work_info__company_id"
|
related_company_field="employee_id__employee_work_info__company_id"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
"""
|
||||||
|
Meta class to add additional options
|
||||||
|
"""
|
||||||
|
|
||||||
|
verbose_name = _("Document")
|
||||||
|
verbose_name_plural = _("Documents")
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
return f"{self.title}"
|
return f"{self.title}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user