<!DOCTYPE html>
<html lang="en">


<!-- Mirrored from akademi.dexignlab.com/codeigniter/demo/student by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 06 Mar 2024 10:51:33 GMT -->
<!-- Added by HTTrack -->
<meta http-equiv="content-type" content="text/html;charset=UTF-8" /><!-- /Added by HTTrack -->

<head>

    <!-- Title -->
    <title>Completed List</title>
    <!-- Meta -->



</head>

<body>


  

    <div class="content-body">
        <div class=" justify-content-between ">
            <div style="margin-top:-20px !important;margin-left:25px;">
                <h3 class="tx-24 mg-b-5"><strong><?= $page; ?> </strong></h4>
            </div>

        </div>

        <!-- row -->
        <div class="container-fluid">
            <!-- Row -->
            <div class="row">
                <div class="col-xl-12">
                    <div class="row">
                        <div class="col-xl-12">
                            <div class="page-title flex-wrap">
                                <div class="input-group search-area mb-md-0 mb-3">
                                    <input type="text" class="form-control" placeholder="Search here...">
                                    <span class="input-group-text"><a href="javascript:void(0)">
                                            <svg width="15" height="15" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
                                                <path d="M17.5605 15.4395L13.7527 11.6317C14.5395 10.446 15 9.02625 15 7.5C15 3.3645 11.6355 0 7.5 0C3.3645 0 0 3.3645 0 7.5C0 11.6355 3.3645 15 7.5 15C9.02625 15 10.446 14.5395 11.6317 13.7527L15.4395 17.5605C16.0245 18.1462 16.9755 18.1462 17.5605 17.5605C18.1462 16.9747 18.1462 16.0252 17.5605 15.4395V15.4395ZM2.25 7.5C2.25 4.605 4.605 2.25 7.5 2.25C10.395 2.25 12.75 4.605 12.75 7.5C12.75 10.395 10.395 12.75 7.5 12.75C4.605 12.75 2.25 10.395 2.25 7.5V7.5Z" fill="#01A3FF" />
                                            </svg>
                                        </a></span>
                                </div>
                                <div>

                                </div>
                            </div>
                        </div>
                        <!--column-->
                        <div class="col-xl-12 wow fadeInUp" data-wow-delay="1.5s">

                            <div class="card-header ">
                                <div class="row d-flex justify-content-start">
                                    <!-- <div class='col-md-2'>
                                        <select name="courseId" id="courseId" class="form-control  filtercourse select2 ">
                                            <option value="">-- Filter Course --</option>
                                            <?php foreach ($courses as $row) { ?>
                                                <option value="<?php echo $row->short_name ?>"> <?php echo $row->short_name ?></option>
                                            <?php } ?>
                                        </select>
                                    </div>

                                    <div class='col-md-4'>
                                        <input type="checkbox" id="demandDraft" name="demandDraft" class="ml-2"><label class="mt-2"> &nbsp; Demand Draft</label>
                                        <input type="checkbox" id="scst" name="scst" class="ml-2"><label class="mt-2"> &nbsp; SC/ST</label>
                                    </div>
                                    <div class='col-md-4'></div>
                                    <div>
                                            <button type="button" class="btn btn-primary waves-effect waves-light" onclick="exportReportToExcel(this)">Export to Excel</button>
                                    </div> -->

                                    <div>
                                            <button type="button" class="btn btn-primary waves-effect waves-light" onclick="getCheckedId(this)">Assing Test</button>
                                    </div>
                                </div>

                            </div>
                            <div class="table-responsive full-data">
                                <table class="table-responsive-lg table display dataTablesCard student-tab dataTable no-footer" id="example-student">
                                    <thead>

                                    <tr>
                                    <th class="wd-20p">S.No</th>
                                    <th class="wd-20p">Ref.No</th>
                                    <th class="wd-25p">Application No.</th>
                                    <th class="wd-15p">Course Name</th>
                                    <th class="wd-15p"> Name</th>
                                    <th class="wd-15p">Mobile No.</th>
                                    <th class="wd-15p">Gender</th>
                                    <th class="wd-15p">DOB</th>
                                    <th class="wd-15p">Address</th>
                                    <th class="wd-15p">City</th>
                                    <th class="wd-15p">Pincode</th>
                                    <th class="wd-15p">State</th>
                                    <th class="wd-15p">Country</th>
                                    <th class="wd-15p">Nationality</th>
                                    <th class="wd-15p">Email ID</th>
                                    <th class="wd-15p">Father Name</th>
                                    <th class="wd-15p">Father Occupation</th>
                                    <th class="wd-15p">Father Address</th>
                                    <th class="wd-15p">Father Mobile</th>
                                    <th class="wd-15p">Father Email</th>
                                    <th class="wd-15p">Mother Name</th>
                                    <th class="wd-15p">Mother Occupation</th>
                                    <th class="wd-15p">Annual Income in INR</th>
                                    <th class="wd-15p">Annual Income in Words</th>
                                    <th class="wd-15p">Application staus</th>
                                    <th class="wd-15p">Payment Mode</th>
                                    <th class="wd-15p">Payment Status</th>
                                    <th class="wd-15p">Submitted Date</th>
                                    <th class="wd-15p">Email</th>
                                    <th class="wd-15p">Action</th>
                                </tr>
                                    </thead>
                                    <tbody>
                                        <?php
                                        foreach ($records as $i => $row) { ?>
                                            <tr>
                                            <td><input type="checkbox" class="checkbox mr-2 shortList  " data-userId = "<?= $row->user_id?> "name="short_list[]" id="short_list<?= $i; ?>" value="<?= $row->appid; ?>"> <?= $i + 1 ?></td>
                                        <td><?= $row->reference_no ?></td>
                                        <td> <?= $row->application_no ?> </td>
                                        <td> <?php foreach ($courses as $course){  if($row->course_id == $course->id){ echo $course->short_name?>
                                       <?php } } ?></td>
                                       <td> <?= $row->first_name. ' ' .$row->middle_name.' ' .$row->last_name?></td>
                                        <td><?= $row->mobile ?></td>
                                        <td><?= $row->gender ?></td>
                                        <td><?= $row->dob ?></td>
                                        <td><?= $row->communication_address ?></td>
                                        <td><?= $row->city ?></td>
                                        <td><?= $row->pincode ?></td>
                                        <td><?= $row->state ?></td>
                                        <td><?= $row->cuntry ?></td>
                                        <td><?= $row->nationality ?></td>
                                        <td><?= $row->email ?></td>
                                        <td><?= $row->father_name ?></td>
                                        <td><?= $row->father_occupation ?></td>
                                        <td><?= $row->father_home_address ?></td>
                                        <td><?= $row->father_home_mobile ?></td>
                                        <td><?= $row->father_home_email ?></td>
                                        <td><?= $row->mother_name ?></td>
                                        <td><?= $row->mother_occupation ?></td>
                                        <td><?= $row->annual_income_rs ?></td>
                                        <td><?= $row->annual_income_words ?></td>
                                        <td><?= $row->status==1? 'Submitted': 'Drafted'; ?></td>
                                        <td><?= $row->payment_mode ==1? 'Online': 'Demand Draft'; ?></td>
                                        <td><?= $row->payment_status==2? 'Paid': 'Not Paid'; ?></td>
                                        <td><?=date('d-m-Y', strtotime($row->created_at)) ?></td>

                                                <td>
                                                    
                                                    <a href="<?= base_url('ApplicationController/mailSendOnCompletedList/' . $row->appid) ?>" data-toggle="tooltip" id="email" data-placement="top" title="Send Mail" data-original-title="Send Mail" class="btn btn-sm btn-secondary"><i class="ti ti-email"></i></a>

                                                </td>

                                                <td>
                                                    <a href="<?= base_url('ApplicationController/viewApplication/' . $row->user_id) ?>" data-toggle="tooltip" id="preview" data-placement="top" title="Preview" data-original-title="Preview" class="btn btn-sm btn-primary"><i class="ti ti-eye"></i></a>

                                                    <a href="<?= base_url('ApplicationController/applicationedit/' . $row->appid) ?>" data-toggle="tooltip" id="edit" data-placement="top" title="Edit" data-original-title="Edit" class="btn btn-sm btn-info"><i class="ti ti-pencil"></i></a>

                                                </td>
                                            </tr>
                                        <?php  }
                                        ?>
                                    </tbody>
                                </table>
                            </div>
                        </div>

                    </div>
                </div>
            </div>

        </div>
    </div>
    <div class="modal fade" id="assignModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-dialog-center">
            <div class="modal-content">
                <div class="modal-header">
                    <h1 class="modal-title fs-5" id="exampleModalLabel">Assign Test</h1>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <form method="POST" id="feesForm" action="<?php echo base_url('ApplicationController/addEditFees'); ?>">
                        <input type="hidden" id='id' name='id[]'>


                        <div class="form-group col-md-12">
                                <label class="tx-medium">Question Category <span class="text-danger">*</span> </label>

                                <select name="question_category" id="question_category" class="form-control select2 modal-select">
                                    <option value="">--Select--</option>
                                    <?php foreach ($question_category as $row) { ?>
                                        <option value="<?php echo $row->id ?>"> <?php echo $row->question_category ?></option>

                                    <?php } ?>
                                </select>

                            </div>

                            <div class="form-group col-md-12">
                                <label class="tx-medium">Exam Schedule <span class="text-danger">*</span> </label>

                                <select name="schedule" id="schedule" class="form-control select2 modal-select">
                                    <option value="">--Select--</option>
                                    <?php foreach ($schedule as $row) { ?>
                                        <option value="<?php echo $row->id ?>"> <?php echo $row->exam_schedule ?></option>

                                    <?php } ?>
                                </select>

                            </div>

                            <div id="selectedAppIds" style="display:none;"></div>



                        <div class="modal-footer">
                            <button type="submit" class="btn ripple btn-primary" id="save">Assign</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

</body>

</html>

<script>
    function mailSend() {
        $('#mailsed').submit();
    }

    $(document).ready(function() {
        // When a link with the class "open-in-new-tab" is clicked
        $(".open-in-new-tab").click(function(event) {
            // Prevent the default behavior (opening the link in the current tab)
            event.preventDefault();

            // Get the URL from the href attribute of the clicked link
            var url = $(this).attr("href");

            // Open the URL in a new tab/window
            window.open(url, "_blank");
        });
    });

    function shortlist() {
        var checkedValues = [];
        $('.shortList:checked').each(function() {
            checkedValues.push($(this).val());
        });
        // alert(checkedValues);
        if (checkedValues) {
            $.ajax({
                type: "POST",
                url: "<?php echo base_url('ApplicationController/shortList'); ?>", // Corrected URL
                data: {
                    id: checkedValues
                },
                success: function(respose) {
                    // alert('fggh');
                    window.location.reload();
                    // loadCourses(); // Reload the course list
                },
                error: function(error) {
                    console.error(error);
                }
            });
        }
    }
    $(document).ready(function() {
        $('#dmstable').DataTable();
        // Add checkbox click event
        $('#dmstable tbody').on('click', 'input.checkbox', function() {
            var tr = $(this).closest('tr');
            if ($(this).prop('checked')) {
                tr.addClass('selected');
            } else {
                tr.removeClass('selected');
            }
        });

        $(".filtercourse").on("change", function() {
            // alert($(this).val());
            var columnIndex = 3;
            var filterValue = $(this).val();
            $('#dmstable').DataTable().column(columnIndex).search(filterValue).draw();
        });

        $(".filter").on("change", function() {
            // alert($(this).val());
            var columnIndex = 7;
            var filterValue = $(this).val();
            //    console.log("Column Index:", $(this).data("column"));
            // table.column(columnIndex).search(filterValue).draw();
            $('#dmstable').DataTable().column(columnIndex).search(filterValue).draw();

            // table.columns(7).search($(this).val()).draw();
            // dataTable.column($(this).data("column")).search(this.value).draw();
        });
        // table.buttons().container().appendTo("#dmstable .col-md-6:eq(0)");

    });

    function openPayment(appid, userId, paymentMode) {
        // alert(appid+' - '+userId+' - '+paymentMode)
        $("#tutionModal").show();
        $('#appid').val(appid);
        $('#userid').val(userId);
        $('#paymentmode').val(paymentMode);
        //         console.log("App ID:", appid);
        // console.log("User ID:", userId);
        // console.log("Payment Mode:", paymentMode);

    }
    $("#closemodel").click(function() {
        $('#tution_name_err').text(' ')
        $("#tutionModal").hide();
    });
    $(document).ready(function() {
        $('#tutionForm').validate({
            rules: {
                name: {
                    required: true
                },
                bankname: {
                    required: true
                },
                transaction: {
                    required: true
                },
                date: {
                    required: true
                },
                amount: {
                    required: true,
                    number: true
                }
            },
            messages: {
                name: {
                    required: "Please enter your name"
                },
                bankname: {
                    required: "Please enter bank name"
                },
                transaction: {
                    required: "Please enter transaction number"
                },
                date: {
                    required: "Please enter date"
                },
                amount: {
                    required: "Please enter amount",
                    number: "Please enter a valid number"
                }
            },
            errorClass: "error",
            submitHandler: function(form) {
                form.submit();
            }
        });
    });


    //         function exportReportToExcel(elem) {
    //     $("#dmstable").table2excel({
    //         exclude: ".noExl",
    //         filename: "PendingReport",
    //         fileext: ".xls",
    //     });
    // }

    function exportReportToExcel(elem) {
        // Store the current pagination setting
        var oldPageLength = $('#dmstable').DataTable().page.len();
        // Set pagination to show all records
        $('#dmstable').DataTable().page.len(-1).draw();

        // Perform the export
        $("#dmstable").table2excel({
            exclude: ".noExl",
            filename: "PendingReport",
            fileext: ".xls",
            onAfterExport: function() {
                // Revert to the original pagination setting
                $('#dmstable').DataTable().page.len(oldPageLength).draw();
            }
        });
    }

    function getCheckedId(){

        $('#assignModal').modal('show');

    }

    $(document).ready(function() {
    $('#feesForm').submit(function(e) {
        e.preventDefault(); 

        $('#selectedAppIds').empty(); 

        $('input[name="short_list[]"]:checked').each(function() {
            var userId = $(this).data('userid'); 
            $('#selectedAppIds').append('<input type="hidden" name="user_ids[]" value="' + userId + '">');
        });

        var formData = $(this).serialize(); 

        $.ajax({
            url: '<?= base_url('ApplicationController/assingExam') ?>', 
            type: 'POST',
            data: formData,
            success: function(response) {
               
                $('#assignModal').modal('hide');
                // alert('Successfully test assigned');
                window.location.href = '<?= base_url("ApplicationController/completedformdetails") ?>';
              
            },
            error: function(xhr, status, error) {
                alert("An error occurred: " + error);
            }
        });
    });
});
</script>