<?php $__env->startSection('title', 'শ্রেণি ভিত্তিক ছাত্র তালিকা - <?php echo e($class->class_name_bn); ?>'); ?>

<?php $__env->startSection('content'); ?>
<div class="container-fluid">
    <!-- Header -->
    <div class="row mb-3">
        <div class="col-12">
            <div class="card card-primary">
                <div class="card-header bg-primary text-white">
                    <h5 class="mb-0"><i class="fa fa-users"></i> <?php echo e($class->class_name_bn); ?> <?php echo e($class->section); ?> - ছাত্র তালিকা (মোট: <?php echo e($students->count()); ?> জন)</h5>
                </div>
                <div class="card-body">
                    <a href="<?php echo e(route('students.index')); ?>" class="btn btn-secondary">
                        <i class="fa fa-arrow-left"></i> তালিকায় ফিরে যান
                    </a>
                    <a href="#" class="btn btn-success" onclick="window.print()">
                        <i class="fa fa-print"></i> প্রিন্ট
                    </a>
                    <a href="#" class="btn btn-info" onclick="exportToExcel()">
                        <i class="fa fa-file-excel"></i> এক্সেল
                    </a>
                </div>
            </div>
        </div>
    </div>

    <!-- Students List -->
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-body">
                    <?php if($students->isEmpty()): ?>
                        <div class="alert alert-warning text-center">
                            <i class="fa fa-exclamation-triangle fa-2x"></i>
                            <h5>এই শ্রেণিতে কোনো ছাত্র/ছাত্রী নেই</h5>
                        </div>
                    <?php else: ?>
                        <div class="table-responsive">
                            <table class="table table-bordered table-striped table-hover" id="studentTable">
                                <thead class="bg-secondary text-white">
                                    <tr>
                                        <th>ক্রমিক</th>
                                        <th>ছাত্র আইডি</th>
                                        <th>নাম (বাংলা)</th>
                                        <th>নাম (ইংরেজি)</th>
                                        <th>পিতার নাম</th>
                                        <th>মাতার নাম</th>
                                        <th>রোল</th>
                                        <th>মোবাইল</th>
                                        <th>জন্ম তারিখ</th>
                                        <th>ঠিকানা</th>
                                        <th width="120">একশন</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php $__currentLoopData = $students; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $student): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr>
                                        <td class="text-center"><?php echo e($index + 1); ?></td>
                                        <td><?php echo e($student->student_id); ?></td>
                                        <td><?php echo e($student->name_bn); ?></td>
                                        <td><?php echo e($student->name_en); ?></td>
                                        <td><?php echo e($student->father_name); ?></td>
                                        <td><?php echo e($student->mother_name); ?></td>
                                        <td class="text-center"><?php echo e($student->roll_number); ?></td>
                                        <td><?php echo e($student->phone); ?></td>
                                        <td><?php echo e($student->date_of_birth ? $student->date_of_birth->format('d-m-Y') : '-'); ?></td>
                                        <td><?php echo e(Str::limit($student->present_address, 30)); ?></td>
                                        <td>
                                            <a href="<?php echo e(route('students.show', $student->id)); ?>" class="btn btn-sm btn-info" title="বিস্তারিত">
                                                <i class="fa fa-eye"></i>
                                            </a>
                                            <a href="<?php echo e(route('students.edit', $student->id)); ?>" class="btn btn-sm btn-warning" title="এডিট">
                                                <i class="fa fa-edit"></i>
                                            </a>
                                            <a href="<?php echo e(route('students.id-card', $student->id)); ?>" class="btn btn-sm btn-success" title="আইডি কার্ড" target="_blank">
                                                <i class="fa fa-id-card"></i>
                                            </a>
                                        </td>
                                    </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </tbody>
                            </table>
                        </div>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('scripts'); ?>
<script>
    $(document).ready(function() {
        $('#studentTable').DataTable({
            "language": {
                "search": "খুঁজুন:",
                "lengthMenu": "_MENU_ টি রেকর্ড দেখুন",
                "info": "মোট _TOTAL_ টির মধ্যে _START_ থেকে _END_ দেখানো হচ্ছে",
                "paginate": {
                    "first": "প্রথম",
                    "last": "শেষ",
                    "next": "পরবর্তী",
                    "previous": "পূর্ববর্তী"
                }
            },
            "order": [[6, 'asc']] // রোল অনুযায়ী সাজানো
        });
    });

    function exportToExcel() {
        var table = document.getElementById('studentTable');
        var html = table.outerHTML;
        var url = 'data:application/vnd.ms-excel,' + escape(html);
        var link = document.createElement('a');
        link.download = '<?php echo e($class->class_name_bn); ?>_<?php echo e($class->section); ?>_ছাত্র_তালিকা.xls';
        link.href = url;
        link.click();
    }
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/naowarin/school.naowarinternational.my.id/resources/views/students/class-list.blade.php ENDPATH**/ ?>