[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 %}
|
||||
<div class="oh-modal__dialog-header pb-0">
|
||||
<h5 class="oh-modal__dialog-title" id="objectCreateModalLabel">
|
||||
{% trans "Document Request" %}
|
||||
</h5>
|
||||
<button class="oh-modal__close" aria-label="Close">
|
||||
<ion-icon name="close-outline"></ion-icon>
|
||||
</button>
|
||||
<h5 class="oh-modal__dialog-title" id="objectCreateModalLabel">
|
||||
{{form.verbose_name}}
|
||||
</h5>
|
||||
<button class="oh-modal__close" aria-label="Close">
|
||||
<ion-icon name="close-outline"></ion-icon>
|
||||
</button>
|
||||
</div>
|
||||
<div class="oh-modal__dialog-body">
|
||||
<form
|
||||
id="file-form"
|
||||
{% if document_request %}
|
||||
hx-post="{% url 'document-request-update' document_request.id %}"
|
||||
{% else %}
|
||||
{% if form.candidate_id %}
|
||||
hx-post = "{% url 'candidate-document-request' %}"
|
||||
{% else %}
|
||||
hx-post="{% url 'document-request-create' %}"
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
hx-target="#objectCreateModalTarget"
|
||||
hx-encoding="multipart/form-data"
|
||||
class="oh-profile-section pt-3"
|
||||
>
|
||||
{{form.errors}}
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||
<div class="oh-input-group">
|
||||
<label class="oh-label" for="{{form.title.id_for_label}}"
|
||||
>{% trans "Title" %}</label
|
||||
>
|
||||
{{form.title}}
|
||||
</div>
|
||||
</div>
|
||||
{% if form.employee_id %}
|
||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||
<div class="oh-input-group">
|
||||
<label class="oh-label" for="{{form.employee_id.id_for_label}}"
|
||||
>{% trans "Employees" %}</label
|
||||
>
|
||||
{{form.employee_id}}
|
||||
</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}}
|
||||
<form id="file-form"
|
||||
{% if document_request %}
|
||||
hx-post="{% url 'document-request-update' document_request.id %}"
|
||||
{% else %}
|
||||
{% if form.candidate_id %}
|
||||
hx-post="{% url 'candidate-document-request' %}"
|
||||
{% else %}
|
||||
hx-post="{% url 'document-request-create' %}"
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
hx-target="#objectCreateModalTarget"
|
||||
hx-encoding="multipart/form-data" class="oh-profile-section pt-3">
|
||||
{{form.errors}}
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||
<div class="oh-input-group">
|
||||
<label class="oh-label" for="{{form.title.id_for_label}}">{{form.title.label}}</label>
|
||||
{{form.title}}
|
||||
</div>
|
||||
</div>
|
||||
{% if form.employee_id %}
|
||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||
<div class="oh-input-group">
|
||||
<label class="oh-label" for="{{form.employee_id.id_for_label}}">{{form.employee_id.label}}</label>
|
||||
{{form.employee_id}}
|
||||
</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}}">{{form.candidate_id.label}}</label>
|
||||
{{form.candidate_id}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% 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}}
|
||||
{% endif %}
|
||||
</div>
|
||||
</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}}"
|
||||
>{% trans "Max size (in MB)" %}</label
|
||||
>
|
||||
{{form.max_size}}
|
||||
<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}}">{{form.format.label}}</label>
|
||||
{{form.format}}
|
||||
</div>
|
||||
</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 class="col-sm-12 col-md-12 col-lg-12">
|
||||
<div class="oh-input-group">
|
||||
<label class="oh-label" for="{{form.description.id_for_label}}"
|
||||
>{% trans "Description" %}</label
|
||||
>
|
||||
{{form.description}}
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||
<div class="oh-input-group">
|
||||
<label class="oh-label" for="{{form.description.id_for_label}}">{{form.description.label}}</label>
|
||||
{{form.description}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-modal__dialog-footer p-0 mt-3">
|
||||
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow">
|
||||
{% trans "Save" %}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<div class="oh-modal__dialog-footer p-0 mt-3">
|
||||
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow">
|
||||
{% trans "Save" %}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{% load i18n %} {% load widget_tweaks %}
|
||||
<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"
|
||||
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>
|
||||
@@ -43,7 +43,7 @@
|
||||
<div class="col-12 col-sm-12 col-md-4 col-lg-6">
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label" for="{{form.expiry_date.id_for_label}}">
|
||||
{% trans "Expiry Date" %}
|
||||
{{ form.expiry_date.label }}
|
||||
</label>
|
||||
{{ form.expiry_date }}
|
||||
{{ form.expiry_date.errors }}
|
||||
|
||||
@@ -256,9 +256,9 @@
|
||||
{% if work_type_request.approved == False and not work_type_request.canceled %}
|
||||
<a
|
||||
hx-get="{% url 'work-type-request-update' work_type_request.id %}"
|
||||
hx-target="#workTypeRequestUpdateModalBody"
|
||||
hx-target="#objectUpdateModalTarget"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#workTypeRequestUpdateModal"
|
||||
data-target="#objectUpdateModal"
|
||||
class="oh-btn oh-btn--light-bkg w-50"
|
||||
title="{% trans 'Edit' %}"
|
||||
><ion-icon
|
||||
@@ -1069,36 +1069,6 @@
|
||||
<div class="oh-modal__dialog" id="rotatingWorkTypeAssignDetail"></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
|
||||
class="oh-modal"
|
||||
id="shiftRequestModalUpdate"
|
||||
|
||||
@@ -52,8 +52,6 @@ class DocumentRequestForm(ModelForm):
|
||||
class DocumentForm(ModelForm):
|
||||
"""form to create a new Document"""
|
||||
|
||||
verbose_name = "Document"
|
||||
|
||||
class Meta:
|
||||
model = Document
|
||||
fields = "__all__"
|
||||
@@ -80,8 +78,6 @@ class DocumentForm(ModelForm):
|
||||
class DocumentUpdateForm(ModelForm):
|
||||
"""form to Update a Document"""
|
||||
|
||||
verbose_name = "Document"
|
||||
|
||||
class Meta:
|
||||
model = Document
|
||||
fields = "__all__"
|
||||
|
||||
@@ -42,15 +42,27 @@ def document_create(instance):
|
||||
|
||||
|
||||
class DocumentRequest(HorillaModel):
|
||||
title = models.CharField(max_length=100)
|
||||
employee_id = models.ManyToManyField(Employee)
|
||||
format = models.CharField(choices=FORMATS, max_length=10)
|
||||
max_size = models.IntegerField(blank=True, null=True)
|
||||
description = models.TextField(blank=True, null=True, max_length=255)
|
||||
title = models.CharField(max_length=100, verbose_name=_("Title"))
|
||||
employee_id = models.ManyToManyField(Employee, verbose_name=_("Employees"))
|
||||
format = models.CharField(choices=FORMATS, max_length=10, verbose_name=_("Format"))
|
||||
max_size = models.IntegerField(
|
||||
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(
|
||||
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):
|
||||
return self.title
|
||||
|
||||
@@ -66,12 +78,18 @@ def document_request_m2m_changed(sender, instance, action, **kwargs):
|
||||
|
||||
class Document(HorillaModel):
|
||||
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(
|
||||
DocumentRequest, on_delete=models.PROTECT, null=True
|
||||
)
|
||||
document = models.FileField(upload_to="employee/documents", null=True)
|
||||
status = models.CharField(choices=STATUS, max_length=10, default="requested")
|
||||
document = models.FileField(
|
||||
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)
|
||||
issue_date = models.DateField(null=True, blank=True, verbose_name=_("Issue 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"
|
||||
)
|
||||
|
||||
class Meta:
|
||||
"""
|
||||
Meta class to add additional options
|
||||
"""
|
||||
|
||||
verbose_name = _("Document")
|
||||
verbose_name_plural = _("Documents")
|
||||
|
||||
def __str__(self) -> str:
|
||||
return f"{self.title}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user