EVOLUTION-NINJA
Edit File: remove_student_batch.php
<?php echo view('includes/home_sidebar');?> <style> #leftDiv { height: 960px !important; } #datatable thead tr { /* background-color: #9191a1 !important; */ background-color: #053F5E !important; color: white; } .rm-student{ background-color: #962f2f; color: white; padding: 4px 8px; border-radius: 10px ; border: none; } </style> <main id="rightDiv"> <div class="container-fluid"> <div class="row"> <div class="col-sm-12"> <!-- -------FEE STRUCTURE AND BACK BUTTON---------- --> <section class="fee-structure"> <h3 style="color: rgba(0, 72, 76, 1);">Remove Students - <span><?php echo $batch_no;?></span></h3> <button class="btn back-butt" onclick="goBack()"><i class="fa fa-arrow-left" aria-hidden="true"></i> Back</button> </section> <div class="table-div"> <input type="hidden" name="batch_id" value="<?php echo $id;?>" id=""> <table id="datatable" class="display" style="width:100%"> <thead> <tr> <th>SL no</th> <th>ID</th> <th>Admission No</th> <th>Name</th> <th>Mobile No</th> <th>Header</th> <th>Value Name</th> <th>Total Fees</th> <th>Paid </th> <th>Remove</th> </tr> </thead> <tbody> </tbody> </table> <br /> <div id="resultID"></div> </div> </div> </div> </div> </main> </section> <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.10.8/dist/sweetalert2.all.min.js"></script> <link href="https://cdn.jsdelivr.net/npm/sweetalert2@11.10.8/dist/sweetalert2.min.css" rel="stylesheet"> <script> // header form $(document).ready(function () { $('#selectstudent').submit(function (e) { e.preventDefault(); var formdata = new FormData($(this)[0]); $('#add-btn').text('Creating'); $('#add-btn').attr('disabled', 'disabled'); $.ajax({ type: 'post', url: '<?php echo base_url("remove-from-batch");?>', data: formdata, contentType: false, processData: false, success: function (response) { if (response.result == 1) { Swal.fire({ icon: "success", title: response.message, showConfirmButton: false, timer: 2000 }); $('#datatable').DataTable().ajax.reload(); // $('#header_form')[0].reset(); } else { Swal.fire({ icon: "error", title: response.message, showConfirmButton: false, timer: 1000 }); } $('#add-btn').removeAttr('disabled').text("Add students"); }, error: function (xhr, textStatus, errorThrown) { console.error(xhr.responseText); Swal.fire({ icon: "error", title: "An error occurred", showConfirmButton: false, timer: 1000 }); }, complete: function () { $('#add-btn').removeAttr('disabled').text("Add students"); } }); }); }); </script> <script> var batch_id='<?php echo $id;?>'; $(document).ready(function () { var table = $('#datatable').DataTable({ ajax: { url: '<?php echo base_url("students-from-batch"); ?>?id='+batch_id, dataSrc: '' }, columns: [ { data: null }, { data: 'id', visible: false }, { data: 'admission_no' }, { data: 'first_name' }, { data: 'mobile_no' }, { data: 'header' }, { data: 'value' }, { data: 'total_fees' }, { data: 'paid_fees' }, { data: null, render: function (data, type, row) { return `<div class="check-box-div" > <button class="rm-student" onclick='remove(${row.id})'> - Remove</button> </div>`; } } ], rowCallback: function (row, data, index) { $('td:eq(0)', row).html(index + 1); }, language: { emptyTable: "No data available" } }); }); function remove(id){ Swal.fire({ title: "Are you sure?", text: "You won't be able to revert this!", icon: "warning", showCancelButton: true, confirmButtonColor: "#3085d6", cancelButtonColor: "#d33", confirmButtonText: "Yes, Remove it!" }).then((result) => { if (result.isConfirmed) { $.ajax({ type: 'post', url: '<?php echo base_url("remove-from-batch");?>?id=' + id, contentType: false, processData: false, success: function (response) { if (response.result == 1) { Swal.fire({ title: "Removed!", text: "Student has been Removed.", icon: "success", }).then(function () { $('#datatable').DataTable().ajax.reload(); }) } } }) } }); } </script> <script> window.onload = function () { const leftDiv = document.getElementById('leftDiv'); const rightDiv = document.getElementById('rightDiv'); const rightDivHeight = rightDiv.offsetHeight; leftDiv.style.height = rightDivHeight + 'px'; }; </script> <!-- BACK BUTTON SCRIPT --> <script> function goBack() { window.location.href = "<?php echo base_url('add-batch');?>"; } </script> <?php echo view('includes/footer'); ?>