[UPDT] BASE: Department form style updates

This commit is contained in:
Horilla
2025-02-25 12:11:38 +05:30
parent 294b8e55d6
commit d902b8d08f
5 changed files with 85 additions and 96 deletions

View File

@@ -1,51 +1,26 @@
{% extends 'settings.html' %} {% load i18n %} {% block settings %} {% load static %}
<div class="oh-inner-sidebar-content">
{% if perms.base.view_department %}
<div
class="oh-inner-sidebar-content__header d-flex justify-content-between align-items-center"
>
<h2 class="oh-inner-sidebar-content__title">{% trans "Department" %}</h2>
{% if perms.base.add_department %}
<button
class="oh-btn oh-btn--secondary oh-btn--shadow"
data-toggle="oh-modal-toggle"
data-target="#departmentModal"
hx-get="{% url 'department-creation' %}"
hx-target="#departmentForm"
>
<ion-icon name="add-outline" class="me-1"></ion-icon>
{% trans "Create" %}
</button>
{% if perms.base.view_department %}
<div class="oh-inner-sidebar-content__header d-flex justify-content-between align-items-center">
<h2 class="oh-inner-sidebar-content__title">{% trans "Department" %}</h2>
{% if perms.base.add_department %}
<button class="oh-btn oh-btn--secondary oh-btn--shadow" data-toggle="oh-modal-toggle"
data-target="#objectCreateModal" hx-get="{% url 'department-creation' %}"
hx-target="#objectCreateModalTarget">
<ion-icon name="add-outline" class="me-1"></ion-icon>
{% trans "Create" %}
</button>
{% endif %}
</div>
{% if departments %}
{% include 'base/department/department_view.html' %}
{% else %}
<div style="display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%;">
<img style="display: block; width: 15%; margin: 20px auto; filter: opacity(0.5);"
src="{% static 'images/ui/connection.png' %}" class="" alt="Page not found. 404." />
<h5 class="oh-404__subtitle">{% trans "There is no department at this moment." %}</h5>
</div>
{% endif %}
{% endif %}
</div>
{% if departments %}
{% include 'base/department/department_view.html' %}
{% else %}
<div style="display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%;">
<img style="display: block; width: 15%; margin: 20px auto; filter: opacity(0.5);" src="{% static 'images/ui/connection.png' %}" class="" alt="Page not found. 404." />
<h5 class="oh-404__subtitle">{% trans "There is no department at this moment." %}</h5>
</div>
{% endif %}
{% endif %}
</div>
<div
class="oh-modal"
id="departmentModal"
role="dialog"
aria-labelledby="departmentModalLabel"
aria-hidden="true"
>
<div class="oh-modal__dialog" id="departmentForm"></div>
</div>
<div
class="oh-modal"
id="departmentEditModal"
role="dialog"
aria-labelledby="departmentEditModal"
aria-hidden="true"
>
<div class="oh-modal__dialog" id="departmentEditForm"></div>
</div>
{% endblock settings %}

View File

@@ -1,31 +1,19 @@
{% load i18n %}
<div class="oh-modal__dialog-header pb-0">
<span class="oh-modal__dialog-title" id="createModalLabel">
{% if department.id %}
{% trans "Update Department" %}
{% else %}
{% trans "Create Department" %}
{% endif %}
</span>
<button class="oh-modal__close" aria-label="Close">
<ion-icon name="close-outline"></ion-icon>
</button>
<span class="oh-modal__dialog-title" id="createModalLabel">
{% if department.id %} {% trans "Update" %}{% else %} {% trans "Create" %} {% endif %} {% trans "Department" %}
</span>
<button class="oh-modal__close" aria-label="Close">
<ion-icon name="close-outline"></ion-icon>
</button>
</div>
<div class="oh-modal__dialog-body">
<form
{% if department.id %}
hx-post="{% url 'department-update' department.id %}"
{% else %}
hx-post="{% url 'department-creation' %}?dynamic={{dynamic}}"
{% endif %}
class="oh-profile-section"
>
{% csrf_token %} {{form.non_field_errors}}
{{form.as_p}}
<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>
<form hx-post="{{ request.get_full_path }}" class="oh-profile-section">
{% csrf_token %} {{form.non_field_errors}} {{form.as_p}}
<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>

View File

@@ -17,8 +17,8 @@
<div class="oh-sticky-table__td">
<div class="oh-btn-group">
{% if perms.base.change_department %}
<a hx-get="{% url 'department-update' dep.id %}" hx-target="#departmentEditForm"
data-toggle="oh-modal-toggle" data-target="#departmentEditModal" type="button"
<a hx-get="{% url 'department-update' dep.id %}" hx-target="#objectUpdateModalTarget"
data-toggle="oh-modal-toggle" data-target="#objectUpdateModal" type="button"
class="oh-btn oh-btn--light-bkg w-50" title="{% trans 'Edit' %}">
<ion-icon name="create-outline"></ion-icon></a>
{% endif %}