delegation flash msg fixes : ps

This commit is contained in:
VE10-Sanjeev 2024-03-18 19:01:13 +05:30
parent a4647abf86
commit a19d955513
2 changed files with 38 additions and 4 deletions

View File

@ -68,8 +68,19 @@ public function Assign_Delecation()
$this->notification->sendNotificationForDelegation($Delecation_id, $code, $type);
}
$this->session->set_flashdata('Success', 'Delegation Assigned Successfully');
if($Delecation_id){
$this->session->set_flashdata('FlashMsg', '<div class="alert alert-success alert-dismissible fade show" role="alert">Delegation Assigned Successfully
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>');
}else{
$this->session->set_flashdata('FlashMsg', '<div class="alert alert-success alert-dismissible fade show" role="alert">Something Wents Wrong, Delegation Unable To Assigned!
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>');
}
redirect('Delegation/Delegation_list');
}
@ -100,7 +111,20 @@ public function Edit_Create_Delecation()
$table="delegation";
$Delecation = $this->MY_Model->edit_option($action, $id, $table);
$this->session->set_flashdata('Success', 'Delegation Updated Successfully');
if($Delecation){
$this->session->set_flashdata('FlashMsg', '<div class="alert alert-success alert-dismissible fade show" role="alert">Delegation Updated Successfully
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>');
}else{
$this->session->set_flashdata('FlashMsg', '<div class="alert alert-success alert-dismissible fade show" role="alert">Something Wents Wrong, Delegation Unable To Updated!
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>');
}
redirect('Delegation/Delegation_list');
}

View File

@ -33,7 +33,7 @@
<div class="col-md-12 col-sm-12 ">
<div class="x_panel">
<div class="x_title">
<?= $this->session->flashdata('FlashMsg'); ?>
<?php if ($this->session->userdata('Success')): ?>
<div class="alert-success flash-message" id="customPrompt" style="text-align: right;">
@ -122,6 +122,16 @@
});
});
</script>
<script>
// Automatically close both success and error messages after 5 seconds (5000 milliseconds)
setTimeout(function() {
document.querySelectorAll('.alert').forEach(function(alert) {
alert.classList.add('d-none');
});
}, 5000); // Adjust the time (in milliseconds) as needed
</script>