[UPDT] BASE: Employee account block and unblock option form submission updated to htmx attributes

This commit is contained in:
Horilla
2024-12-25 12:04:48 +05:30
parent 736619ea5a
commit caae8ff3a9
3 changed files with 46 additions and 37 deletions

View File

@@ -3,16 +3,18 @@
<div class="oh-inner-sidebar-content__header mt-4">
<h2 class="oh-inner-sidebar-content__title">{% trans 'Employee Account Block/Unblock' %}</h2>
</div>
<form action="{% url 'enable-account-block-unblock' %}" method="post">
<form hx-post="{% url 'enable-account-block-unblock' %}" hx-swap="none" hx-trigger="change from:#enableBlockUnblock"
hx-on-htmx-after-request="setTimeout(() => { reloadMessage(); }, 70);">
{% csrf_token %}
<div class="oh-label__info" for="enable_block_unblock">
<label class="oh-label" for="enable_block_unblock">{% trans "Restrict Login Account" %}</label>
<span class="oh-info mr-2" title="{% trans "By enabling this feature, you can block or unblock an employee's account." %}">
</span>
</div>
<div class="oh-switch p-3">
<input type="checkbox"class="oh-switch__checkbox" name="enable_block_account" onchange="$(this).closest('form').find('input[type=submit]').click()" {% if enabled_block_unblock %} checked{% endif %} />
</div>
<input type="submit" hidden />
<div class="oh-label__info" for="enable_block_unblock">
<label class="oh-label" for="enable_block_unblock">{% trans "Restrict Login Account" %}</label>
<span class="oh-info mr-2" title="{% trans 'By enabling this feature, you can block or unblock an employee account.' %}">
</span>
</div>
<div class="oh-switch p-3">
<input type="checkbox" class="oh-switch__checkbox" name="enable_block_account" id="enableBlockUnblock"
{% if enabled_block_unblock %} checked {% endif %} />
</div>
<input type="submit" hidden />
</form>
<div class="oh-inner-sidebar-content__footer"></div>

View File

@@ -1,22 +1,21 @@
{% load i18n %}
<form action="{% url 'pagination-settings-view' %}" class='settings-label mb-1' method="post">
{% csrf_token %}
<div class="oh-inner-sidebar-content__header mt-4">
<h2 class="oh-inner-sidebar-content__title">{% trans "Default Records Per Page" %}</h2>
</div>
<div class="oh-label__info" for="pagination">
<label class="oh-label" for="pagination">{% trans "Pagination" %}</label>
<span class="oh-info mr-2" title='{% trans "Default pagination for all views." %}'>
</span>
</div>
<input type="number" name="pagination" value="{{pagination_form.instance.pagination}}" class="oh-input w-25" placeholder="Pagination" required="" id="id_pagination">
<button
style="display: inline;margin-left: 10px;"
type="submit"
class="oh-btn oh-btn--secondary mt-2 mr-0 oh-btn--w-100-resp"
>
{% trans "Save Changes" %}
</button>
<div class="oh-inner-sidebar-content__footer"></div>
<form hx-post="{% url 'pagination-settings-view' %}" class='settings-label mb-1' hx-swap="none"
hx-on-htmx-after-request="setTimeout(() => { reloadMessage(); }, 100);">
{% csrf_token %}
<div class="oh-inner-sidebar-content__header mt-4">
<h2 class="oh-inner-sidebar-content__title">{% trans "Default Records Per Page" %}</h2>
</div>
<div class="oh-label__info" for="pagination">
<label class="oh-label" for="pagination">{% trans "Pagination" %}</label>
<span class="oh-info mr-2" title='{% trans "Default pagination for all views." %}'>
</span>
</div>
<input type="number" name="pagination" value="{{pagination_form.instance.pagination}}" class="oh-input w-25"
placeholder="Pagination" required="" id="id_pagination">
<button style="display: inline;margin-left: 10px;" type="submit"
class="oh-btn oh-btn--secondary mt-2 mr-0 oh-btn--w-100-resp">
{% trans "Save Changes" %}
</button>
<div class="oh-inner-sidebar-content__footer"></div>
</form>