

<?php $__env->startSection('title', 'Accommodation'); ?>

<?php $__env->startPush('styles'); ?>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap" rel="stylesheet">
<style>
    body {
        font-family: 'Poppins', sans-serif;
    }
</style>
<?php $__env->stopPush(); ?>

<?php $__env->startSection('content'); ?>
<div class="container">
    <div class="card shadow-sm">
        <div class="card-header bg-primary text-white">
            <h5 class="mb-0">🏠 Accommodation Details</h5>
        </div>
        <div class="card-body">
            <?php if(session('success')): ?>
                <div class="alert alert-success"><?php echo e(session('success')); ?></div>
            <?php elseif(session('error')): ?>
                <div class="alert alert-danger"><?php echo e(session('error')); ?></div>
            <?php endif; ?>

            <p>Welcome to the student accommodation portal. Here, you can view your current room allocation and application status.</p>

            
            <table class="table table-bordered table-striped mt-4">
                <thead class="table-light">
                    <tr>
                        <th>#</th>
                        <th>Room Number</th>
                        <th>Campus</th>
                        <th>Block</th>
                        <th>Allocation Status</th>
                        <th>Check-In</th>
                        <th>Check-Out</th>
                        <th>Remarks</th>
                    </tr>
                </thead>
                <tbody>
                    <?php $__empty_1 = true; $__currentLoopData = $accommodation; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $record): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <tr>
                            <td><?php echo e($index + 1); ?></td>
                            <td><?php echo e($record->room_number ?? '-'); ?></td>
                            <td><?php echo e($record->campus); ?></td>
                            <td><?php echo e($record->block ?? '-'); ?></td>
                            <td>
                                <span class="badge bg-<?php echo e($record->allocation_status === 'Allocated' ? 'success' : 'warning text-dark'); ?>">
                                    <?php echo e($record->allocation_status); ?>

                                </span>
                            </td>
                            <td><?php echo e($record->check_in ? \Carbon\Carbon::parse($record->check_in)->format('Y-m-d') : '-'); ?></td>
                            <td><?php echo e($record->check_out ? \Carbon\Carbon::parse($record->check_out)->format('Y-m-d') : '-'); ?></td>
                            <td><?php echo e($record->remarks); ?></td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <tr>
                            <td colspan="8" class="text-center">No accommodation record found.</td>
                        </tr>
                    <?php endif; ?>
                </tbody>
            </table>

            
            <?php if($accommodation->isEmpty()): ?>
            <form method="POST" action="<?php echo e(route('student.accommodation.store')); ?>" class="mt-4">
                <?php echo csrf_field(); ?>
                <div class="row">
                    <div class="col-md-5 mb-3">
                        <label for="campus" class="form-label">Campus</label>
                        <select name="campus" id="campus" class="form-control" required>
                            <option value="">-- Select Campus --</option>
                            <option value="Main Campus">Main Campus</option>
                            <option value="City Campus">City Campus</option>
                        </select>
                    </div>
                    <div class="col-md-5 mb-3">
                        <label for="block" class="form-label">Block</label>
                        <input type="text" name="block" id="block" class="form-control" required>
                    </div>
                </div>
                <button class="btn btn-success">Apply for Accommodation</button>
            </form>
            <?php else: ?>
            <div class="mt-4">
                <a href="#" class="btn btn-outline-secondary">Download Allocation Letter</a>
            </div>
            <?php endif; ?>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.student', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\studentportal\resources\views/student/accommodation.blade.php ENDPATH**/ ?>