EVOLUTION-NINJA
Edit File: add_student_batch.php
<?php echo view('includes/home_sidebar');?> <style> #leftDiv { height: 960px !important; } .checkmark { display: block; width: 30px; height: 30px; background-color: #ddd; border-radius: 10px; position: relative; transition: background-color 0.4s; overflow: hidden; cursor: pointer; } .check:checked~.checkmark { background-color: #08bb68; } .checkmark::after { content: ""; position: absolute; width: 5px; height: 10px; border-right: 3px solid #fff; border-bottom: 3px solid #fff; top: 44%; left: 50%; transform: translate(-50%, -50%) rotateZ(40deg) scale(10); opacity: 0; transition: all 0.4s; } .check:checked~.checkmark::after { opacity: 1; transform: translate(-50%, -50%) rotateZ(40deg) scale(1); } .new-btn{ background-color: rgba(0, 72, 76, 1); padding: 10px; border-radius: 10px; color: white; border: 0px; /* float: right; */ margin-top: 25px; } #datatable thead tr { /* background-color: #9191a1 !important; */ background-color: #053F5E !important; color: white; } </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);">Add 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"> <form id="selectstudent"> <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>Balance</th> --> <th>Select</th> </tr> </thead> <tbody> </tbody> </table> <div class="row"> <div class="col-sm-10"></div> <div class="col-sm-2"> <button type="submit" id="add-btn" class="new-btn">Add students</button> </div> </div> </form> <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("students-for-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> $(document).ready(function () { var table = $('#datatable').DataTable({ ajax: { url: '<?php echo base_url("student-list-data-batch"); ?>', 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" > <label class="checkbox-wrapper"> <input type="checkbox" class='check' id="check-${row.id}" value='${row.id}' name='students[${row.id}]' hidden=""> <label for="check-${row.id}" class="checkmark"></label> </label> </div>`; } } ], rowCallback: function (row, data, index) { $('td:eq(0)', row).html(index + 1); }, language: { emptyTable: "No data available" } }); }); </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'); ?>