<?php $__env->startSection('title', 'ছাত্র/ছাত্রীর বিস্তারিত তথ্য'); ?>

<?php $__env->startSection('content'); ?>
<div class="container">
    <!-- Back Button -->
    <div class="row mb-3">
        <div class="col-12">
            <a href="<?php echo e(route('students.index')); ?>" class="btn btn-secondary">
                <i class="fa fa-arrow-left"></i> তালিকায় ফিরে যান
            </a>
        </div>
    </div>
    
    <!-- Student Profile Header - NESCO Style -->
    <div class="row">
        <div class="col-12">
            <div class="card text-center" style="border-color: #1e4a6d;">
                <div class="card-body" style="background-color: #e8f4f8;">
                    <div class="row">
                        <div class="col-md-2">
                            <?php if($student->photo): ?>
                                <img src="<?php echo e(asset($student->photo)); ?>" alt="ছবি" 
                                     style="width: 150px; height: 150px; border-radius: 50%; border: 3px solid #1e4a6d;">
                            <?php else: ?>
                                <div style="width: 150px; height: 150px; border-radius: 50%; background-color: #1e4a6d; 
                                            color: white; font-size: 60px; line-height: 150px; margin: 0 auto;">
                                    <i class="fa fa-user-graduate"></i>
                                </div>
                            <?php endif; ?>
                        </div>
                        <div class="col-md-8 text-left">
                            <h2><?php echo e($student->name_bn); ?></h2>
                            <h5 class="text-muted"><?php echo e($student->name_en); ?></h5>
                            <p>
                                <i class="fa fa-id-card"></i> আইডি: <?php echo e($student->student_id); ?> |
                                <i class="fa fa-layer-group"></i> শ্রেণি: <?php echo e($student->class->class_name_bn ?? ''); ?> <?php echo e($student->section); ?> |
                                <i class="fa fa-hashtag"></i> রোল: <?php echo e($student->roll_number); ?>

                            </p>
                            <p>
                                <?php if($student->status): ?>
                                    <span class="badge badge-success p-2">সক্রিয়</span>
                                <?php else: ?>
                                    <span class="badge badge-danger p-2">নিষ্ক্রিয়</span>
                                <?php endif; ?>
                            </p>
                        </div>
                        <div class="col-md-2">
                            <a href="<?php echo e(route('students.edit', $student->id)); ?>" class="btn btn-warning btn-block mb-2">
                                <i class="fa fa-edit"></i> এডিট
                            </a>
                            <a href="<?php echo e(route('students.id-card', $student->id)); ?>" class="btn btn-info btn-block mb-2" target="_blank">
                                <i class="fa fa-id-card"></i> আইডি কার্ড
                            </a>
                            <button type="button" class="btn btn-danger btn-block" onclick="deleteStudent()">
                                <i class="fa fa-trash"></i> ডিলিট
                            </button>
                            
                            <form id="delete-form" action="<?php echo e(route('students.destroy', $student->id)); ?>" method="POST" style="display: none;">
                                <?php echo csrf_field(); ?>
                                <?php echo method_field('DELETE'); ?>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <!-- Personal Information Card -->
    <div class="row mt-4">
        <div class="col-12">
            <div class="card card-primary" style="border-color: #1e4a6d;">
                <div class="card-header" style="background-color: #1e4a6d; color: white;">
                    <h5 class="mb-0"><i class="fa fa-user"></i> ব্যক্তিগত তথ্য</h5>
                </div>
                <div class="card-body">
                    <div class="row">
                        <div class="col-md-3">
                            <label>পিতার নাম</label>
                            <input type="text" class="form-control" value="<?php echo e($student->father_name); ?>" readonly>
                        </div>
                        <div class="col-md-3">
                            <label>মাতার নাম</label>
                            <input type="text" class="form-control" value="<?php echo e($student->mother_name); ?>" readonly>
                        </div>
                        <div class="col-md-2">
                            <label>জন্ম তারিখ</label>
                            <input type="text" class="form-control" value="<?php echo e($student->date_of_birth->format('d-m-Y')); ?>" readonly>
                        </div>
                        <div class="col-md-2">
                            <label>বয়স</label>
                            <input type="text" class="form-control" value="<?php echo e($student->age); ?> বছর" readonly>
                        </div>
                        <div class="col-md-2">
                            <label>রক্তের গ্রুপ</label>
                            <input type="text" class="form-control" value="<?php echo e($student->blood_group ?? 'N/A'); ?>" readonly>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <!-- Contact Information -->
    <div class="row mt-3">
        <div class="col-12">
            <div class="card card-primary" style="border-color: #1e4a6d;">
                <div class="card-header" style="background-color: #1e4a6d; color: white;">
                    <h5 class="mb-0"><i class="fa fa-address-book"></i> যোগাযোগের তথ্য</h5>
                </div>
                <div class="card-body">
                    <div class="row">
                        <div class="col-md-3">
                            <label>মোবাইল নম্বর</label>
                            <input type="text" class="form-control" value="<?php echo e($student->phone); ?>" readonly>
                        </div>
                        <div class="col-md-3">
                            <label>ইমেইল</label>
                            <input type="text" class="form-control" value="<?php echo e($student->email ?? 'N/A'); ?>" readonly>
                        </div>
                        <div class="col-md-6">
                            <label>ঠিকানা</label>
                            <textarea class="form-control" rows="2" readonly><?php echo e($student->address); ?></textarea>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <!-- Fee Summary -->
    <div class="row mt-3">
        <div class="col-12">
            <div class="card card-primary" style="border-color: #1e4a6d;">
                <div class="card-header" style="background-color: #1e4a6d; color: white;">
                    <h5 class="mb-0"><i class="fa fa-money-bill"></i> ফি/বিল সামারি</h5>
                </div>
                <div class="card-body">
                    <div class="row">
                        <div class="col-md-4">
                            <div class="small-box bg-info">
                                <div class="inner">
                                    <h3><?php echo e(number_format($totalFees, 2)); ?></h3>
                                    <p>মোট ফি (টাকা)</p>
                                </div>
                                <div class="icon">
                                    <i class="fa fa-calculator"></i>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="small-box bg-success">
                                <div class="inner">
                                    <h3><?php echo e(number_format($totalPaid, 2)); ?></h3>
                                    <p>পরিশোধিত (টাকা)</p>
                                </div>
                                <div class="icon">
                                    <i class="fa fa-check-circle"></i>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="small-box bg-danger">
                                <div class="inner">
                                    <h3><?php echo e(number_format($totalDue, 2)); ?></h3>
                                    <p>বকেয়া (টাকা)</p>
                                </div>
                                <div class="icon">
                                    <i class="fa fa-exclamation-triangle"></i>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <?php if($totalDue > 0): ?>
                    <div class="alert alert-danger mt-3">
                        <i class="fa fa-bell"></i> 
                        <strong>বকেয়া নোটিশ:</strong> আপনার মোট বকেয়ার পরিমাণ 
                        <b><?php echo e(number_format($totalDue, 2)); ?> টাকা</b>। 
                        যেকোনো সময় নাম কর্তন এড়াতে এখনই বকেয়া পরিশোধ করুন।
                    </div>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>
    
    <!-- Recent Fees -->
    <?php if($student->fees->count() > 0): ?>
    <div class="row mt-3">
        <div class="col-12">
            <div class="card card-primary" style="border-color: #1e4a6d;">
                <div class="card-header" style="background-color: #1e4a6d; color: white;">
                    <h5 class="mb-0"><i class="fa fa-history"></i> সাম্প্রতিক ফি/বিল</h5>
                </div>
                <div class="card-body">
                    <div class="table-responsive">
                        <table class="table table-bordered table-striped">
                            <thead class="bg-primary text-white text-center">
                                <tr>
                                    <th>ফি নম্বর</th>
                                    <th>মাস/বছর</th>
                                    <th>মোট ফি</th>
                                    <th>পরিশোধিত</th>
                                    <th>বকেয়া</th>
                                    <th>স্ট্যাটাস</th>
                                    <th>একশন</th>
                                </tr>
                            </thead>
                            <tbody class="text-center">
                                <?php $__currentLoopData = $student->fees; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $fee): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td><?php echo e($fee->fee_no); ?></td>
                                    <td><?php echo e(date('F Y', strtotime($fee->month_year))); ?></td>
                                    <td><?php echo e(number_format($fee->payable_amount, 2)); ?></td>
                                    <td><?php echo e(number_format($fee->paid_amount, 2)); ?></td>
                                    <td class="<?php echo e($fee->due_amount > 0 ? 'text-danger font-weight-bold' : ''); ?>">
                                        <?php echo e(number_format($fee->due_amount, 2)); ?>

                                    </td>
                                    <td>
                                        <?php if($fee->payment_status == 'paid'): ?>
                                            <span class="badge badge-success">পরিশোধিত</span>
                                        <?php elseif($fee->payment_status == 'partial'): ?>
                                            <span class="badge badge-warning">আংশিক</span>
                                        <?php else: ?>
                                            <span class="badge badge-danger">বকেয়া</span>
                                        <?php endif; ?>
                                    </td>
                                    <td>
                                        <?php if($fee->due_amount > 0): ?>
                                            <a href="<?php echo e(route('fees.pay', $fee->id)); ?>" class="btn btn-sm btn-success">
                                                <i class="fa fa-credit-card"></i> পরিশোধ
                                            </a>
                                        <?php else: ?>
                                            <a href="#" class="btn btn-sm btn-info" target="_blank">
                                                <i class="fa fa-download"></i> রশিদ
                                            </a>
                                        <?php endif; ?>
                                    </td>
                                </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <?php endif; ?>
</div>

<!-- Delete Confirmation Modal -->
<div class="modal fade" id="deleteModal" tabindex="-1">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header bg-danger text-white">
                <h5 class="modal-title">নিশ্চিতকরণ</h5>
                <button type="button" class="close" data-dismiss="modal">&times;</button>
            </div>
            <div class="modal-body">
                <p>আপনি কি সত্যিই এই ছাত্র/ছাত্রীকে মুছে ফেলতে চান?</p>
                <p class="text-danger"><strong>সতর্কতা:</strong> এই একশন অপরিবর্তনীয়!</p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">বাতিল</button>
                <button type="button" class="btn btn-danger" onclick="confirmDelete()">মুছে ফেলুন</button>
            </div>
        </div>
    </div>
</div>

<?php $__env->startSection('scripts'); ?>
<script>
    function deleteStudent() {
        $('#deleteModal').modal('show');
    }
    
    function confirmDelete() {
        $('#delete-form').submit();
    }
</script>
<?php $__env->stopSection(); ?>
<?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/show.blade.php ENDPATH**/ ?>