<div class="wraper responsive-width"> <main class="long-tbl-main students_list_table" id="main"> <div class="from-group"> <a href="<?= base_url(); ?>admin/fee-course"><button type="button" class="btn btn-success btn-sm btn-dark">Back</button></a> </div> <!-- admin template section --> <div class="admin_tempblock"> <div class="admin_sec"> <?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('failed')) { ?> <div class="alert alert-danger alert-dismissible fade show" role="alert"> <p><?php echo $this->session->flashdata('failed') ?></p> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <?php } ?> <div class="subsec_sec"> <div class="subject_r subject_r_lng" > <div class="subject_lsec"> <div class="subject_lhead"><?php echo $title; ?></div> <div class="fee_table"> <table id="tbl1" class="display table-responsive dataTable no-footer"> <thead> <tr> <th>Student Name</th> <th>Reg No.</th> <!-- <th>ID No.</th> --> <th>Classroom</th> <th>Amount</th> <th>Amount Paid</th> <th>Status</th> <th>Action</th> </tr> </thead> <tbody> <?php if (!empty($course_fee_student)) { foreach ($course_fee_student as $key => $value) { ?> <tr> <td><?php echo $value['student_name']; ?></td> <td><?php echo $value['student_number']; ?></td> <!-- <td>0125</td> --> <td><?php echo $fees_details['course_name'] ?></td> <td><?php echo $fees_details['amount']; ?></td> <?php if ($value['status'] == 1) { ?> <?php $payment_date = json_decode($value['payment_details']); $flag =true; ?> <td> <?php foreach ($payment_date as $k => $v){ if ($v->payment_status == 'yes') echo $v->paid_amount.'<br>'; else echo "- <br>"; } ?> </td> <td> <?php $paid = ''; foreach ($payment_date as $k => $v){ if ($v->payment_status == 'yes') $paid = 'Paid'; else $paid = "Pending"; } if (empty($paid)) { echo $paid = "Pending"; }else{ echo $paid; } ?> </td> <td> <?php $i= 1; $view = ''; foreach ($payment_date as $k => $v){ if ($v->payment_status == 'yes') { $url = base_url().'admin/invoice/'.urlsafe_b64encode($value['student_number']).'/'.urlsafe_b64encode($value['txn_id']).'/'.urlsafe_b64encode($fees_details['course_fee_id']); $view = '<div class="sub_tabbtnsec"><a href="'.$url.'">View</a></div>'; } else{ if ($i == 1) { $view = '<div class="sub_tabbtnsec"><a class="actionPayBtn subject_addbtn" onclick ="coursedel('. $value["student_id"].','.$fees_details['course_fee_id'].','.$value['installment_type_id'] .','.$v->feeamount.')" data-toggle="modal" href="#payModal">Pay</a></div>'; $i++; } } } if (empty($view)) { echo $view = '<div class="sub_tabbtnsec"><a class="actionPayBtn subject_addbtn" onclick ="coursedel('. $value["student_id"].','.$fees_details['course_fee_id'].',1,'.$fees_details['amount'].')" data-toggle="modal" href="#payModal">Pay</a></div>'; }else{ echo $view; } ?> </td> <?php } else { ?> <td><?php echo $fees_details['amount']; ?></td> <td>Pending</td> <td> <div class="sub_tabbtnsec"> <a class="actionPayBtn subject_addbtn" data-toggle="modal" href="#payModal" onclick="coursedel(<?php echo $value['student_id'].','.$fees_details['course_fee_id'].',1,'.$fees_details['amount'] ?>)"> Pay </a> </div> </td> <?php } ?> </tr> <?php } } else { ?> <tr> <td> No Data found</td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> </div> </div> </div> <!-- admin template section end --> </main> <!--End right-top side--> </div> <div class="viewDoc delete-modal-wrap payModal"> <div class="modal fade" id="payModal" role="dialog"> <div class="modal-dialog"> <div class="modal-content"> <button type="button" class="close" data-dismiss="modal">×</button> <div class="delete-modal"> <h4>Fee Payment</h4> <form method="POST" action="<?= base_url(); ?>Admin/studentfeelistFromStudent" id="feecollectionForm"> <div class="form-group" style="text-align:left;" > <label for="">Payment type<span class="text-danger font-weight-bold">*</span></label> <select name="payment_method" class=" form-control" id="payment_method"> <option value="cash">Cash</option> <option value="bank-transfer">Bank Transfer</option> </select> </div> <input type = "hidden" id = "student_id" name="student_id" /> <input type = "hidden" id = "ft_id" name="fees_type_id"/> <input type = "hidden" name="installment_type_id" id="installment_type"> <input type = "hidden" name="amount" id="amount_paid"> <input type = "hidden" name="fees_type" value="<?php echo $title ?>"> <div class="form-group register-row description_section d-none" style="text-align:left;"> <label for="">Transaction ID<span class="text-danger font-weight-bold">*</span></label> <input type="text" name="transaction_id" class="form-control" placeholder="Type here" id="transaction_id"> </div> <p class="error" id="transaction_id-error"></p> <div class="delete-modal-btn"> <div class="delete-modal-btn"> <input type="submit" name="make_payment" class="text-white subject_addbtn" id="make_payment" value="Make Payment"> <button type="button" class="subject_addbtn subject_addbtn_cancel" data-dismiss="modal">Cancel</button> </div> </div> </form> </div> </div> </div> </div> <script> function coursedel(student_id, course_fee_id, installment_type,amount){ $('#student_id').val(student_id); $('#ft_id').val(course_fee_id); $('#installment_type').val(installment_type); $('#amount_paid').val(amount+'.00'); } $(document).ready(function(){ $('.user-drpdown').click(function(){ $('.drpdown-items').toggle(); }); //table js $('#tbl1').DataTable( { "lengthMenu": [[5,10, 25, 50, -1], [5,10, 25, 50, "All"]] } ); $('#tbl2').DataTable( { "lengthMenu": [[5,10, 25, 50, -1], [5,10, 25, 50, "All"]] } ); $('#tbl3').DataTable( { "lengthMenu": [[5,10, 25, 50, -1], [5,10, 25, 50, "All"]] } ); //table js end //multiple select js start $('select').selectpicker(); //multiple select js end }); $('#payment_method').change(function() { var payment = $('#payment_method :selected').val(); if (payment == 'bank-transfer') { $('.description_section').removeClass('d-none'); description_section_validation = true; } else { $('.description_section').addClass('d-none'); description_section_validation = false; } }); $(document).ready(function() { $("#feecollectionForm").validate({ ignore: "input[type='text']:hidden", rules: { payment_method: { required: true, } }, messages: { payment_method: { required: "Please Select Payment Method", } }, submitHandler: function(form) { var payment1 = $('#payment_method :selected').val(); var description_length = $("input#transaction_id").val().length; if (payment1 == 'bank-transfer') { if (description_length < 3) { $('#transaction_id-error').text('Length is short, minimum 3 Characters required.'); } else { form.submit(); } } else { form.submit(); } } }); }); </script> <script type="text/javascript"> function deletedata(id){ let url = window.location.pathname.split( '/' ); let postUrl = url[1] +'/'+ url[2]; // console.log('admin/delete-section/'+postUrl + id); window.location.replace('<?php echo base_url() ?>' + 'admin//' + id); } $('#tbl').DataTable( { "lengthMenu": [[5,10, 25, 50, -1], [5,10, 25, 50, "All"]] } ); </script>