<div class="wraper responsive-width"> <main class="" id="main"> <div class="from-group adding-class form-group_lng"> <a href="<?= base_url(); ?>admin/add-edit-batch/0"><button type="button" class="btn btn-success btn-sm">Add New Batch</button></a> </div> <div class="admin_tempblock"> <div class="admin_tempsec"> <div class="admin_sec"> <div class="subsec_sec"> <div class="subject_r subject_r_lng"> <div class="subject_lsec"> <div class="subject_lhead">Batches List <p id="success" style="color:green;"></p> </div> <?php if ($this->session->flashdata('success')) { ?> <div class="alert alert-success alert-dismissible fade show" role="alert"> <p><?php echo $this->session->flashdata('success') ?></p> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <?php } ?> <?php if ($this->session->flashdata('danger')) { ?> <div class="alert alert-danger alert-dismissible fade show" role="alert"> <p><?php echo $this->session->flashdata('danger') ?></p> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <?php } ?> <table id="tbl" class="display table-responsive"> <thead> <tr> <th class="textCenter">Sl No</th> <th class="textCenter">Batch Name</th> <th class="textCenter">Start Date</th> <th class="textCenter">End Date</th> <th class="textCenter">Is Active</th> <th class="textCenter">Action</th> </tr> </thead> <tbody> <?php $i = 1; foreach ($batch as $bt) { ?> <tr> <td class="textCenter"> <?php echo $i; ?></td> <td class="textCenter"><div class="name_width"><?php echo $bt['b_name']; ?></div></td> <td class="textCenter"><div class="width_control"><?php echo date(MY_DATE_FORMAT, strtotime($bt['b_from'])); ?></div></td> <td class="textCenter"><div class="width_control"><?php echo date(MY_DATE_FORMAT, strtotime($bt['b_end'])); ?></div></td> <td class="textCenter"><?php echo $bt['is_active']; ?></td> <td> <div class="sub_tabbtnsec"> <a href="<?php echo base_url(); ?>admin/add-edit-batch/<?php echo $bt['id']; ?>"> <div><i class="fas fa-pencil-alt"></i></div> </a> <a data-toggle="modal" onclick="confirm_delete_batch(<?php echo $bt['id']; ?>)"> <div class="sub_delbtn"> <i class="fa fa-trash" aria-hidden="true"></i> </div> </a> </div> </td> </tr> <?php $i++; } ?> </tbody> </table> </div> </div> </div> </div> </div> </div> </main> </div> <div class="viewDoc delete-modal-wrap"> <div class="modal fade" id="confirmDeleteBatchModal" role="dialog"> <div class="modal-dialog"> <div class="modal-content"> <button type="button" class="close" data-dismiss="modal">×</button> <div class="delete-modal"> <i class="far fa-times-circle"></i> <input type="hidden" id="del_batch_id" id="del_batch_id" /> <h4>Are you sure?</h4> <p>you want to delete this Batch?</p> <div class="delete-modal-btn"> <button type="button" class="subject_addbtn subject_addbtn_red" onclick="delete_batch($('#del_batch_id').val());">Delete</button> <button type="button" class="subject_addbtn subject_addbtn_cancel" data-dismiss="modal">Cancel</button> </div> </div> </div> </div> </div> <script> $(document).ready(function() { //table js $('#tbl').DataTable({ "lengthMenu": [ [25, 50, 100, 150, -1], [25, 50, 100, 150, "All"] ] }); //table js end }); </script> <script type="text/javascript"> function confirm_delete_batch(batchId) { $('#del_batch_id').val(batchId); $('#confirmDeleteBatchModal').modal('show'); } function cancel_delete_batch(batchId) { $('#del_batch_id').val(''); $('#confirmDeleteBatchModal').modal('hide'); } function delete_batch(delId) { window.location.replace('<?php echo base_url() ?>' + 'admin/delete_batch/' + delId); } $(document).ready(function() { // show the alert setTimeout(function() { $(".alert").alert('close'); <?php unset($_SESSION['success']); ?> <?php unset($_SESSION['danger']); ?> }, 15000); }); </script>