[UPDT] EMPLOYEE: Conditional script in creation of action
This commit is contained in:
@@ -264,6 +264,11 @@ def create_actions(request):
|
||||
"""
|
||||
form = DisciplinaryActionForm()
|
||||
employees = []
|
||||
dynamic = (
|
||||
request.GET.get("dynamic") if request.GET.get("dynamic") != "None" else None
|
||||
)
|
||||
if request.GET:
|
||||
form = DisciplinaryActionForm(request.GET)
|
||||
|
||||
if request.method == "POST":
|
||||
form = DisciplinaryActionForm(request.POST, request.FILES)
|
||||
@@ -311,7 +316,9 @@ def create_actions(request):
|
||||
icon="chatbox-ellipses",
|
||||
)
|
||||
|
||||
return render(request, "disciplinary_actions/form.html", {"form": form})
|
||||
return render(
|
||||
request, "disciplinary_actions/form.html", {"form": form, "dynamic": dynamic}
|
||||
)
|
||||
|
||||
|
||||
@login_required
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__tbody">
|
||||
{% for i in data %}
|
||||
{% for i in data reversed %}
|
||||
<div class="oh-sticky-table__tr oh-permission-table__tr oh-permission-table--collapsed">
|
||||
<div class="oh-sticky-table__sd oh-permission-table--toggle" data-toggle-count>
|
||||
<div class="d-flex align-items-center">
|
||||
|
||||
@@ -9,9 +9,15 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
<script>
|
||||
setTimeout(function () {
|
||||
$(".oh-modal__close").click();
|
||||
}, 1000);
|
||||
{% if dynamic %}
|
||||
setTimeout(function () {
|
||||
$('#dynamicCreateModal').removeClass('oh-modal--show');
|
||||
}, 1000);
|
||||
{% else %}
|
||||
setTimeout(function () {
|
||||
$('.oh-modal__close').click();
|
||||
}, 1000);
|
||||
{% endif %}
|
||||
</script>
|
||||
{% endif %}
|
||||
<div class="oh-modal__dialog-header">
|
||||
@@ -23,7 +29,7 @@
|
||||
aria-label="Close"
|
||||
hx-get="{% url 'disciplinary-filter-view' %}"
|
||||
hx-target="#actionContainer"
|
||||
>
|
||||
>
|
||||
<ion-icon name="close-outline"></ion-icon>
|
||||
</button>
|
||||
</div>
|
||||
@@ -34,7 +40,7 @@
|
||||
method="post"
|
||||
hx-encoding="multipart/form-data"
|
||||
id="disciplinaryActionForm"
|
||||
>
|
||||
>
|
||||
{% csrf_token %} {{form.as_p}}
|
||||
</form>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user