From b4a5ff7b28dd8fb449c1a9a3b5af2bdd6f5d3fc0 Mon Sep 17 00:00:00 2001 From: Horilla Date: Sat, 17 Feb 2024 14:36:25 +0530 Subject: [PATCH] [FIX] EMPLOYEE: Dynamic modal shows on the update disciplinary option form --- .../disciplinary_records.html | 24 +++++++++---------- .../disciplinary_actions/update_form.html | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/employee/templates/disciplinary_actions/disciplinary_records.html b/employee/templates/disciplinary_actions/disciplinary_records.html index c69023878..c20d3eec2 100644 --- a/employee/templates/disciplinary_actions/disciplinary_records.html +++ b/employee/templates/disciplinary_actions/disciplinary_records.html @@ -205,29 +205,29 @@ success: function (response) { // Check if the response.action_type is "suspension" - $("#id_unit_in").change(function (e) { + $("[id=id_unit_in]").change(function (e) { e.preventDefault(); if (this.value == "days") { - parentForm.find('#id_days').parent().show(); - parentForm.find('#id_hours').parent().hide(); + parentForm.find('[id=id_days]').parent().show(); + parentForm.find('[id=id_hours]').parent().hide(); parentForm.find('[name=days]').prop('required', true); }else{ - parentForm.find('#id_hours').parent().show(); - parentForm.find('#id_days').parent().hide(); + parentForm.find('[id=id_hours]').parent().show(); + parentForm.find('[id=id_days]').parent().hide(); parentForm.find('[name=days]').prop('required', false); } }); if (response.action_type === "suspension") { // Show the 'days' field - parentForm.find('#id_unit_in').parent().show(); - parentForm.find('#id_hours').parent().show(); - $("#id_unit_in").change() + parentForm.find('[id=id_unit_in]').parent().show(); + parentForm.find('[id=id_hours]').parent().show(); + $("[id=id_unit_in]").change() } else { // Hide the 'days' field - $("#id_unit_in").change() - parentForm.find('#id_days').parent().hide(); - parentForm.find('#id_unit_in').parent().hide(); - parentForm.find('#id_hours').parent().hide(); + $("[id=id_unit_in]").change() + parentForm.find('[id=id_days]').parent().hide(); + parentForm.find('[id=id_unit_in]').parent().hide(); + parentForm.find('[id=id_hours]').parent().hide(); parentForm.find('[name=days]').prop('required', false); } diff --git a/employee/templates/disciplinary_actions/update_form.html b/employee/templates/disciplinary_actions/update_form.html index c89a5f578..1608e18c3 100644 --- a/employee/templates/disciplinary_actions/update_form.html +++ b/employee/templates/disciplinary_actions/update_form.html @@ -21,5 +21,5 @@ \ No newline at end of file