
<?php $__env->startSection('content'); ?>
    <!-- begin::main content -->
    <main class="main-content">
        <div class="container">
            <!-- begin::page header -->
            <div class="page-header">
                <h3><?php echo e($student->fullname); ?> - Change/Promote</h3>
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="<?php echo e(asset('dashboard')); ?>">Dashboard</a></li>
                        <li class="breadcrumb-item"><a href="<?php echo e(asset('student/promote')); ?>">student</a></li>
                        <li class="breadcrumb-item active" aria-current="page">Promote</li>
                    </ol>
                </nav>
            </div>
            <!-- end::page header -->
            <?php if (isset($component)) { $__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74 = $component; } ?>
<?php $component = $__env->getContainer()->make(App\View\Components\FlashMessage::class, []); ?>
<?php $component->withName('flashMessage'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74)): ?>
<?php $component = $__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74; ?>
<?php unset($__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74); ?>
<?php endif; ?>
            <div class="card">
                <div class="card-header">
                    <form action="<?php echo e(asset('student/promote/' . $student->user_unique_id)); ?>" method="post">
                        <?php echo csrf_field(); ?>
                        <div class="form row">
                            <div class="col-md-6">
                                
                                <div class="form-group">
                                    <label for="class">Class<span class="text-danger">*</span></label>
                                    <select class="form-control select2" name="class" id="class">
                                        <?php if(!empty($classes)): ?>
                                            <option value="">--select-class--</option>
                                            <?php $__currentLoopData = $classes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $class): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option data-code="<?php echo e($class->code); ?>" value="<?php echo e($class->id); ?>">
                                                    <?php echo e($class->class); ?></option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        <?php endif; ?>
                                    </select>
                                    <?php if($errors->has('class')): ?>
                                        <div class="text-danger">
                                            <?php echo e($errors->first('class')); ?>

                                        </div>
                                    <?php endif; ?>
                                </div>
                            </div>
                            <div class="col-md-6">
                                
                                <div class="form-group">
                                    <label for="section">Section</label>
                                    <select class="form-control select2" name="section" id="section">
                                    </select>
                                    <?php if($errors->has('section')): ?>
                                        <div class="text-danger">
                                            <?php echo e($errors->first('section')); ?>

                                        </div>
                                    <?php endif; ?>
                                </div>
                            </div>

                            <div class="col-md-12">
                                <a href="<?php echo e(asset('student/promote/' . $student->user_unique_id)); ?>"
                                    class="btn btn-primary btn-square pull-right reset text-white">
                                    <i class="fa fa-recycle pr-1"></i>Reset
                                </a>
                                <button type="submit" class="btn btn-dark btn-square pull-left mr-2">
                                    <i class="fa fa-plus-circle pr-1"></i>Add
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="card-body">
                    <div class="message"></div>
                    <?php if(!empty($student)): ?>
                        <div class="table-responsive font-size-12">
                            <table class="table table-bordered table-striped">
                                <thead>
                                    <tr>
                                        <th>Class</th>
                                        <th>Section</th>
                                        <th>Date</th>
                                        <th>Action</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php $__currentLoopData = $student->section()->orderBy('id', 'desc')->get(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ss): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr>

                                            <td><?php echo e($ss->class->class); ?></td>
                                            <td><?php echo e($ss->section); ?></td>
                                            <td><?php echo e($ss->created_at->format('l, d M Y')); ?></td>
                                            <td>
                                                <a link="<?php echo e(asset('student/promote/delete/' . $student->user_unique_id . '/' . $ss->class->id)); ?>"
                                                    href="javascript:;"
                                                    class="btn btn-danger bth-sm btn-square delete-confirm">
                                                    <i class="fa fa-trash-o text-white"></i>
                                                </a>
                                            </td>
                                        </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </tbody>
                            </table>
                        </div>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </main>
    <!-- end::main content -->
<?php $__env->stopSection(); ?>
<?php $__env->startPush('footer-script'); ?>
    <!-- begin::dataTable -->
    <script src="<?php echo e(asset('public/admin/vendors/dataTable/jquery.dataTables.min.js')); ?>"></script>
    <script src="<?php echo e(asset('public/admin/vendors/dataTable/dataTables.bootstrap4.min.js')); ?>"></script>
    <script src="<?php echo e(asset('public/admin/vendors/dataTable/dataTables.responsive.min.js')); ?>"></script>
    <script>
        $(document).ready(function() {
            $('#collectfees').DataTable({
                "ordering": false,
            });
        });
    </script>

    <script>
        $(document).ready(function() {
            toastr.options = {
                timeOut: 0,
                extendedTimeOut: 0,
                tapToDismiss: true
            }

            $("#checkAll").click(function() {
                $('.student').not(this).prop('checked', this.checked);
            });
            // Get Section
            $("#class").on('change', function() {
                var URL = "<?php echo e(asset('admission/get-section/')); ?>" + "/" + $(this).val();
                $.ajax({
                    type: "GET",
                    url: URL,
                    dataType: "JSON",
                    beforeSend: function() {
                        $("#section").empty();
                        $("#section").append("<option value=''>--select-section--</option>");
                    },
                    success: function(data) {
                        $.map(data, function(item) {
                            $("#section").append("<option data-code='" + item.code +
                                "' value='" + item.id + "'>" + item.text +
                                "</option>");
                        });
                    },
                    complete: function() {
                        $('#section').val("<?php echo e(Request::get('section')); ?>").trigger('change');
                    }
                });
            });
            $('#class').val("<?php echo e(Request::get('class')); ?>").trigger('change');
        });
    </script>

		<?php if(!empty(Request::has('school'))): ?>
		<script>
				$('#schools').val("<?php echo e(Request::get('school')); ?>").trigger('change');
		</script>
		<?php endif; ?>
    <?php if(!empty(Request::has('gender'))): ?>
        <script>
            $('#gender').val("<?php echo e(Request::get('gender')); ?>").trigger('change');
        </script>
    <?php endif; ?>
    <script>
        $(document).ready(function() {

            $('#allotment').on('click', function() {
                var students = $(".student:checked").map(function() {
                    return $(this).val();
                }).get();

                var feesmasters = $(".feesmaster:checked").map(function() {
                    return $(this).val();
                }).get();

                $.ajax({
                    type: "POST",
                    url: "<?php echo e(asset('fees_master/assign')); ?>",
                    dataType: "JSON",
                    headers: {
                        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                    },
                    data: {
                        students: students,
                        feesmasters: feesmasters,
                        class: $('#class').val(),
                        section: $('#section').val(),
                    },
                    beforeSend: function() {
                        $('#allotment').prop('disabled', true);
                        $('#allotment').html(
                            '<i class="spinner-border spinner-border-sm mr-2"></i> Loading');
                    },
                    success: function(data) {
                        if (data.status) {
                            toastr.success(data.message);
                            $('.message').html('<div class="alert alert-success">' + data
                                .message + '</div>');

                        } else {
                            toastr.error(data.message);
                        }
                    },
                    complete: function() {
                        $('#allotment').prop('disabled', false);
                        $('#allotment').html(
                            '<i class="fa fa-share-square-o mr-1"></i>Allotment');
                    }
                });


            });
        });
    </script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH F:\xampp\htdocs\school_saas_erp\resources\views/students/promote-single-student.blade.php ENDPATH**/ ?>