[FIX] EMPLOYEE: Dynamic modal shows on the update disciplinary option form

This commit is contained in:
Horilla
2024-02-17 14:36:25 +05:30
parent f0b2c0f4b4
commit b4a5ff7b28
2 changed files with 13 additions and 13 deletions

View File

@@ -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);
}

View File

@@ -21,5 +21,5 @@
</form>
<script>
$("#id_action").change()
$("#announcementUpdate #id_action").change()
</script>