[UPDT] EMPLOYEE: Employee document count

This commit is contained in:
Horilla
2024-01-30 19:12:13 +05:30
parent aa069f3741
commit 4dd3652b44
5 changed files with 99 additions and 110 deletions

View File

@@ -79,6 +79,7 @@
>{% trans "Job Position" %}</label
>
{{f.form.employee_id__employee_work_info__job_position_id}}
</div>
<div class="oh-input-group">
<label class="oh-label" for="{{f.form.employee_id__employee_work_info__shift_id.id_for_label}}">{% trans "Shift" %}</label>

View File

@@ -1,64 +1,54 @@
{% load i18n %}
<form
id="file-form"
{% if document_request %}
hx-post="{% url 'document-request-update' document_request.id %}"
{% else %}
hx-post="{% url 'document-request-create' %}"
{% endif %}
hx-target="#documentRequestCreateForm"
hx-encoding="multipart/form-data"
id="file-form"
{% if document_request %}
hx-post="{% url 'document-request-update' document_request.id %}"
{% else %}
hx-post="{% url 'document-request-create' %}"
{% endif %}
hx-target="#documentRequestCreateForm"
hx-encoding="multipart/form-data"
>
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group">
<label class="oh-label"
>{% trans "Title" %}</label
>
{{form.title}}
</div>
</div>
<div class="col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group">
<label class="oh-label"
>{% trans "Employees" %}</label
>
{{form.employee_id}}
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group">
<label class="oh-label"
>{% trans "Format" %}</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"
>{% trans "Max size (in MB)" %}</label
>
{{form.max_size}}
</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"
>{% trans "Description" %}</label
>
{{form.description}}
</div>
</div>
</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.title.id_for_label}}">{% trans "Title" %}</label>
{{form.title}}
</div>
</div>
<div class="col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group">
<label class="oh-label" for="{{form.employee_id.id_for_label}}">{% trans "Employees" %}</label>
{{form.employee_id}}
</div>
</div>
</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 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>
</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>
</div>
</div>
<div class="d-flex justify-content-between w-100 align-items-center mt-4">
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow">
{% trans "Save" %}
</button>
</div>
<div class="d-flex justify-content-between w-100 align-items-center mt-4">
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow">
{% trans "Save" %}
</button>
</div>
</form>

View File

@@ -32,7 +32,7 @@
role="dialog"
aria-labelledby="uploadFileModal"
aria-hidden="true"
>
>
<div class="oh-modal__dialog">
<div class="oh-modal__dialog-header">
<span class="oh-modal__dialog-title" id="uploadFileModalLabel"
@@ -85,17 +85,14 @@
<div class="oh-accordion-meta__item">
<div
class="oh-accordion-meta__header"
>
>
<span class="oh-accordion-meta__title pt-3 pb-3">
<div class="oh-tabs__input-badge-container">
<input type="checkbox" name="select_all" onclick="event.stopPropagation()" class="oh-input payslip-checkbox oh-input__checkbox select_all me-3">
<span
class="oh-badge oh-badge--secondary oh-badge--small oh-badge--round mr-1"
>
{{document_list.list|length}}
</span>
{{document_list.grouper}}
{{document_list.grouper}}
<div class="oh-checkpoint-badge oh-checkpoint-badge--secondary" style="margin-left: 20px;" title="{% trans 'Uploaded / Requested' %}">
{{document_list.list.0.upload_documents_count}} / {{document_list.list|length}}
</div>
</div>
</span>
@@ -151,45 +148,45 @@
>
<div class="oh-navbar__user-photo oh-user_permission--profile">
{% if document.document %}
{% if document.status == "approved" %}
<span
class="oh-badge oh-badge--secondary oh-badge--small oh-badge--round ms-2 mr-2 file-upload"
onclick="event.stopPropagation()"
>
<ion-icon name="checkmark"></ion-icon>
{% elif document.status == 'rejected' %}
<span
class="oh-badge oh-badge--secondary oh-badge--small oh-badge--round ms-2 mr-2 file-upload"
onclick="event.stopPropagation()"
>
<ion-icon name="alert"></ion-icon>
</span>
{% if document.status == "approved" %}
<span
class="oh-badge oh-badge--secondary oh-badge--small oh-badge--round ms-2 mr-2 file-upload"
title="{% trans 'Approved' %}"
>
<ion-icon name="checkmark"></ion-icon>
{% elif document.status == 'rejected' %}
<span
class="oh-badge oh-badge--secondary oh-badge--small oh-badge--round ms-2 mr-2 file-upload"
title="{% trans 'Rejected' %}"
>
<ion-icon name="alert"></ion-icon>
</span>
{% else %}
<span
class="oh-badge oh-badge--secondary oh-badge--small oh-badge--round ms-2 mr-2 file-upload"
title="{% trans 'File Uploaded' %}"
>
<ion-icon name="image-outline"></ion-icon>
</span>
{% endif %}
{% else %}
<span
class="oh-badge oh-badge--secondary oh-badge--small oh-badge--round ms-2 mr-2 file-upload"
onclick="event.stopPropagation()"
>
<ion-icon name="image-outline"></ion-icon>
</span>
{% endif %}
{% else %}
<span
class="oh-badge oh-badge--secondary oh-badge--small oh-badge--round ms-2 mr-2 file-upload"
hx-get="{% url 'file-upload' document.id %}"
hx-target="#uploadFileForm"
data-document-id="{{ document.id }}"
data-toggle="oh-modal-toggle"
data-target="#uploadFileModal"
onclick="event.stopPropagation()"
>
<ion-icon
class="md hydrated"
name="add-outline"
role="img"
aria-label="add outline"
></ion-icon>
</span>
<span
class="oh-badge oh-badge--secondary oh-badge--small oh-badge--round ms-2 mr-2 file-upload"
hx-get="{% url 'file-upload' document.id %}"
hx-target="#uploadFileForm"
data-document-id="{{ document.id }}"
data-toggle="oh-modal-toggle"
data-target="#uploadFileModal"
onclick="event.stopPropagation()"
title="{% trans 'Upload' %}"
>
<ion-icon
class="md hydrated"
name="add-outline"
role="img"
aria-label="add outline"
></ion-icon>
</span>
{% endif %}
</div>
<div class="oh-feedback-card__name-container ms-1">

View File

@@ -14,7 +14,7 @@
{% if document.document %}
{% if perms.horilla_document.change_documentrequest %}
{% if document.status == "approved" %}
<a class="oh-btn oh-btn--success w-100 oh-btn--disabled">
<a class="oh-btn oh-btn--success w-100 oh-btn--disabled" title="{% trans 'Approved' %}">
<ion-icon class="me-1" name="checkmark-outline"></ion-icon>
</a>
{% else %}
@@ -29,7 +29,7 @@
</a>
{% endif %}
{% if document.status == "rejected" %}
<a class="oh-btn oh-btn--danger w-100 oh-btn--disabled">
<a class="oh-btn oh-btn--danger w-100 oh-btn--disabled" title="{% trans 'Rejected' %}">
<ion-icon class="me-1" name="close-circle-outline"></ion-icon>
</a>
{% else %}
@@ -50,6 +50,7 @@
href="data:{{ content_type }};base64,{{ file_content|base64_encode }}"
class="oh-btn oh-btn--info w-100"
download="{{document.title}}"
title="{% trans 'Download' %}"
><ion-icon class="me-1" name="download-outline"></ion-icon
></a>
{% endif %}

View File

@@ -510,7 +510,7 @@ def document_request_view(request):
f = DocumentRequestFilter()
document_requests = DocumentRequest.objects.all()
documents = Document.objects.filter(document_request_id__isnull=False).order_by(
"document_request_id"
"-document_request_id"
)
documents = filtersubordinates(
request=request,
@@ -535,7 +535,7 @@ def document_filter_view(request):
previous_data = request.GET.urlencode()
documents = DocumentRequestFilter(request.GET).qs
documents = documents.exclude(document_request_id__isnull=True).order_by(
"document_request_id"
"-document_request_id"
)
data_dict = parse_qs(previous_data)
get_key_instances(Document, data_dict)