Files
ihrm/employee/templates/tabs/htmx/view_file.html

74 lines
3.2 KiB
HTML
Raw Normal View History

[IMP] Remove inter module dependency (#274) This commit introduces significant changes to the architecture of the Horilla HRMS system by decoupling interdependent modules. The following modifications were made: 1. **Module Independence**: Each module has been refactored to eliminate reliance on other modules, promoting a more modular and maintainable codebase. 2. **Refactored Imports and Dependencies**: Adjusted import statements and dependency injections to support independent module operation. 3. **Compatibility and Functionality**: Ensured that all modules are compatible with existing systems and maintain their intended functionality both independently and when integrated with other modules. These changes enhance the modularity, maintainability, and scalability of the Horilla HRMS, allowing developers to work on individual modules without affecting the entire system. Future development and deployment will be more efficient and less prone to issues arising from tightly coupled code. **NOTE** For existing Horilla users, if you face any issues during the migrations, please run the following command and try again the migrations. - `python3 manage.py makemigrations` - `python3 manage.py migrate base` - `python3 manage.py migrate` * [IMP] ASSET: Asset module dependency removal from other Horilla apps * [IMP] ATTENDANCE: Attendance module dependency removal from other Horilla apps * [IMP] BASE: Base module dependency removal from other Horilla apps * [IMP] EMPLOYEE: Employee module dependency removal from other Horilla apps * [IMP] HELPDESK: Helpdesk module dependency removal from other Horilla apps * [IMP] HORILLA AUDIT: Horilla Audit module dependency removal from other Horilla apps * [IMP] HORILLA CRUMBS: Horilla Crumbs module dependency removal from other Horilla apps * [IMP] HORILLA AUTOMATIONS: Horilla Automations module dependency removal from other Horilla apps * [IMP] HORILLA VIEWS: Horilla Views module dependency removal from other Horilla apps * [IMP] LEAVE: Leave module dependency removal from other Horilla apps * [IMP] OFFBOARDING: Offboarding module dependency removal from other Horilla apps * [IMP] ONBOARDING: Onboarding module dependency removal from other Horilla apps * [IMP] PMS: PMS module dependency removal from other Horilla apps * [IMP] PAYROLL: Payroll module dependency removal from other Horilla apps * [IMP] RECRUITMENT: Recruitment module dependency removal from other Horilla apps * [IMP] HORILLA: Dependency removal updates * [IMP] TEMPLATES: Dependency removal updates * [IMP] STATIC: Dependency removal updates * [IMP] HORILLA DOCUMENTS: Horilla Documents module dependency removal from other Horilla apps * [ADD] HORILLA: methods.py * [UPDT] HORILLA: Settings.py * [FIX] EMPLOYEE: About tab issue * Update horilla_settings.py * Remove dummy db init password
2024-08-05 14:22:44 +05:30
{% load i18n %} {% load horillafilters %} {% load static %}
<div class="d-flex justify-content-end">
<div class="oh-btn-group mb-4">
2025-10-01 13:54:44 +05:30
<a type="submit" hx-get="{% url 'file-upload' document.id %}" hx-target="#objectCreateModalTarget"
data-toggle="oh-modal-toggle" data-target="#objectCreateModal" title="Upload file"
class="oh-btn oh-btn--warning w-100">
<ion-icon name="attach-outline"></ion-icon>
</a>
{% if document.document %}
2025-10-01 13:54:44 +05:30
{% if perms.horilla_document.change_documentrequest %}
{% if document.status == "approved" %}
<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 %}
<a hx-get="{% url 'document-approve' document.id %}"
hx-vals='{
"refresh_url": "{% url "view-file" document.id %}",
"hx_target": "#viewFile"
}'
hx-on-htmx-after-request="reloadMessage(this);"
title="{% trans 'Approve' %}"
class="oh-btn oh-btn--success w-100">
<ion-icon class="me-1" name="checkmark-outline"></ion-icon>
</a>
{% endif %}
{% if document.status == "rejected" %}
<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 %}
<a type="submit" hx-get="{% url 'document-reject' document.id %}" hx-target="#rejectFileForm"
data-target="#rejectFileModal" data-toggle="oh-modal-toggle" title="{% trans 'Reject' %}"
class="oh-btn oh-btn--danger w-100">
<ion-icon class="me-1" name="close-circle-outline"></ion-icon>
</a>
{% endif %}
{% endif %}
2025-10-01 13:54:44 +05:30
<a 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 %}
</div>
</div>
{% if document.document %}
2025-10-01 13:54:44 +05:30
<div class="modal-body" {% if document.status == "rejected" %} style="border: 5px solid red;" {% endif %}>
<!-- Display the file content based on the file type -->
{% if file_extension == 'pdf' or file_extension == 'txt' or file_extension == 'docx' or file_extension == 'xlsx' %}
2025-10-01 13:54:44 +05:30
<embed src="data:{{ content_type }};base64,{{ file_content|base64_encode }}" type="{{ content_type }}" width="100%"
height="500px" />
{% elif file_extension == 'jpg' or file_extension == 'jpeg' or file_extension == 'png' or file_extension == 'webp' %}
2025-10-01 13:54:44 +05:30
<div class="container">
<img src="data:{{ content_type }};base64,{{ file_content|base64_encode }}" alt="File Preview" class="img-fluid"
style="display: block; width: 100%;height: 500px;" />
</div>
{% else %}
2025-10-01 13:54:44 +05:30
<p>{% trans "File format not supported for preview." %}</p>
{% endif %}
</div>
{% if document.status == 'rejected' %}
2025-10-01 13:54:44 +05:30
<h2 class="oh-label"> <b>{% trans "Reject Reason: " %}</b></h2>
<p class="ms-4">{{document.reject_reason}}</p>
{% endif %}
{% else %}
2025-10-01 13:54:44 +05:30
<div class="oh-not-found">
<img style="width: 150px; height: 150px;" src="{% static 'images/ui/document.png' %}" class="oh-404__image mb-4"
alt="Page not found. 404." />
<h3 class="oh-404__subtitle">
{% trans "No Document to view." %}
</h3>
</div>
{% endif %}