<?php $__env->startSection('title'); ?>
    All Receipts - Hotel Management System
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
    <!-- Breadcrumb -->
    <div class="bg-white shadow-sm border-b border-gray-200 px-6 py-4">
        <div class="flex items-center justify-between">
            <div class="flex items-center text-sm text-gray-600">
                <i class="fas fa-home mr-2"></i>
                <span>/ All Receipts</span>
            </div>
        </div>
    </div>

    <!-- Content -->
    <div class="p-6">
        <?php if(session('success')): ?>
            <div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded mb-4">
                <?php echo e(session('success')); ?>

            </div>
        <?php endif; ?>

        <?php if(session('error')): ?>
            <div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-4">
                <?php echo e(session('error')); ?>

            </div>
        <?php endif; ?>

        <!-- Filters and Search -->
        <div class="bg-white rounded-lg shadow-md mb-6">
            <div class="px-6 py-4 border-b border-gray-200">
                <h2 class="text-xl font-semibold text-gray-800">Search & Filter Receipts</h2>
            </div>
            
            <div class="p-6">
                <form method="GET" action="<?php echo e(route('receipts.index')); ?>" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
                    <!-- Search -->
                    <div>
                        <label class="block text-sm font-medium text-gray-700 mb-2">Search</label>
                        <input type="text" 
                               name="search" 
                               value="<?php echo e(request('search')); ?>"
                               placeholder="Receipt number, customer, room..."
                               class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
                    </div>

                    <!-- Status Filter -->
                    <div>
                        <label class="block text-sm font-medium text-gray-700 mb-2">Status</label>
                        <select name="status" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
                            <option value="">All Status</option>
                            <option value="Paid" <?php echo e(request('status') == 'Paid' ? 'selected' : ''); ?>>Paid</option>
                            <option value="Partial" <?php echo e(request('status') == 'Partial' ? 'selected' : ''); ?>>Partial</option>
                            <option value="Pending" <?php echo e(request('status') == 'Pending' ? 'selected' : ''); ?>>Pending</option>
                        </select>
                    </div>

                    <!-- Date From -->
                    <div>
                        <label class="block text-sm font-medium text-gray-700 mb-2">From Date</label>
                        <input type="date" 
                               name="date_from" 
                               value="<?php echo e(request('date_from')); ?>"
                               class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
                    </div>

                    <!-- Date To -->
                    <div>
                        <label class="block text-sm font-medium text-gray-700 mb-2">To Date</label>
                        <input type="date" 
                               name="date_to" 
                               value="<?php echo e(request('date_to')); ?>"
                               class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
                    </div>
                </form>
            </div>
        </div>

        <!-- Receipts Table -->
        <div class="bg-white rounded-lg shadow-md">
            <div class="overflow-x-auto">
                <table class="min-w-full divide-y divide-gray-200">
                    <thead class="bg-gray-50">
                        <tr>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
                                Receipt Info
                            </th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
                                Customer Details
                            </th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
                                Booking Info
                            </th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
                                Payment Details
                            </th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
                                Status
                            </th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
                                Actions
                            </th>
                        </tr>
                    </thead>
                    <tbody class="bg-white divide-y divide-gray-200">
                        <?php $__empty_1 = true; $__currentLoopData = $receipts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $receipt): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <tr class="hover:bg-gray-50">
                                <td class="px-6 py-4 whitespace-nowrap">
                                    <div class="text-sm font-medium text-gray-900">#<?php echo e($receipt->receipt_number); ?></div>
                                    <div class="text-xs text-gray-500"><?php echo e($receipt->issued_at->format('M d, Y H:i')); ?></div>
                                    <div class="text-xs text-gray-500">Booking #<?php echo e($receipt->booking->booking_id); ?></div>
                                </td>
                                <td class="px-6 py-4">
                                    <?php if($receipt->booking->primaryCustomer): ?>
                                        <div class="text-sm font-medium text-gray-900">
                                            <?php echo e($receipt->booking->primaryCustomer->full_name); ?>

                                        </div>
                                        <div class="text-xs text-gray-500">
                                            <?php echo e($receipt->booking->primaryCustomer->document_type); ?>: <?php echo e($receipt->booking->primaryCustomer->document_number); ?>

                                        </div>
                                        <div class="text-xs text-gray-500">
                                            <?php echo e($receipt->booking->primaryCustomer->nationality); ?>

                                        </div>
                                    <?php else: ?>
                                        <div class="text-sm text-gray-500">No customer data</div>
                                    <?php endif; ?>
                                </td>
                                <td class="px-6 py-4 whitespace-nowrap">
                                    <div class="text-sm font-medium text-gray-900"><?php echo e($receipt->booking->room->room_no); ?></div>
                                    <div class="text-xs text-gray-500"><?php echo e($receipt->booking->room->roomType->room_type); ?></div>
                                    <div class="text-xs text-gray-500">
                                        <?php echo e(\Carbon\Carbon::parse($receipt->booking->check_in)->format('M d')); ?> - <?php echo e(\Carbon\Carbon::parse($receipt->booking->check_out)->format('M d, Y')); ?>

                                    </div>
                                    <div class="text-xs text-gray-500"><?php echo e($receipt->booking->number_of_nights); ?> night(s)</div>
                                </td>
                                <td class="px-6 py-4 whitespace-nowrap">
                                    <div class="text-sm font-medium text-gray-900">$<?php echo e(number_format($receipt->total_amount, 2)); ?></div>
                                    <div class="text-xs text-green-600">
                                        Paid: $<?php echo e(number_format($receipt->advance_payment, 2)); ?>

                                    </div>
                                    <div class="text-xs text-red-600">
                                        Due: $<?php echo e(number_format($receipt->due_amount, 2)); ?>

                                    </div>
                                    <div class="text-xs text-gray-500">
                                        <?php echo e($receipt->payment_method ?? 'Not specified'); ?>

                                    </div>
                                </td>
                                <td class="px-6 py-4 whitespace-nowrap">
                                    <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium <?php echo e($receipt->getStatusBadgeColor()); ?>">
                                        <?php echo e($receipt->status); ?>

                                    </span>
                                </td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
                                    <div class="flex space-x-2">
                                        <a href="<?php echo e(route('receipts.show', $receipt)); ?>" 
                                           class="inline-flex items-center justify-center px-3 py-1 bg-blue-100 text-blue-600 rounded-lg hover:bg-blue-200 transition-colors text-sm">
                                            <i class="fas fa-eye mr-1"></i>View Details
                                        </a>
                                        <a href="<?php echo e(route('receipts.thermal', $receipt)); ?>" 
                                           target="_blank"
                                           class="inline-flex items-center justify-center px-3 py-1 bg-orange-100 text-orange-600 rounded-lg hover:bg-orange-200 transition-colors text-sm">
                                            <i class="fas fa-receipt mr-1"></i>Thermal
                                        </a>
                                    </div>
                                </td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <tr>
                                <td colspan="6" class="px-6 py-4 text-center text-gray-500">
                                    <div class="py-8">
                                        <i class="fas fa-receipt text-4xl text-gray-300 mb-4"></i>
                                        <p>No receipts found.</p>
                                    </div>
                                </td>
                            </tr>
                        <?php endif; ?>
                    </tbody>
                </table>
            </div>
            
            <!-- Pagination -->
            <?php if($receipts->hasPages()): ?>
                <div class="px-6 py-4 border-t border-gray-200">
                    <?php echo e($receipts->links()); ?>

                </div>
            <?php endif; ?>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('backend.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH D:\laragon\www\HotelMS\resources\views/backend/receipts/index.blade.php ENDPATH**/ ?>