<?php $__env->startSection('header_title', 'Contratos e Faturas'); ?>
<?php $__env->startSection('header_subtitle', 'Consulte a vigência dos contratos e o estado dos pagamentos.'); ?>

<?php $__env->startSection('content'); ?>
    <div class="grid grid-cols-1 lg:grid-cols-3 gap-6 mb-8">
        <?php $__empty_1 = true; $__currentLoopData = $contracts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $contract): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
            <div class="bg-slate-900 border border-white/5 rounded-2xl p-6 shadow-xl">
                <div class="flex items-center justify-between mb-4">
                    <h3 class="text-white font-semibold">Contrato #<?php echo e($contract->id); ?></h3>
                    <span class="px-3 py-1 rounded-full text-xs font-semibold bg-blue-500/10 text-blue-400"><?php echo e($contract->status); ?></span>
                </div>
                <p class="text-sm text-slate-500 mb-3"><?php echo e($contract->installation->address ?? 'Sem instalação associada'); ?></p>
                <p class="text-2xl font-bold text-white"><?php echo e(number_format((float) $contract->monthly_fee, 2, ',', '.')); ?> Kz</p>
                <p class="text-xs text-slate-500 mt-2">
                    <?php echo e($contract->start_date->format('d/m/Y')); ?> até <?php echo e($contract->end_date?->format('d/m/Y') ?? 'sem data fim'); ?>

                </p>
            </div>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
            <div class="lg:col-span-3 p-10 rounded-2xl border border-dashed border-white/10 text-center">
                <p class="text-slate-500">Nenhum contrato associado à sua conta.</p>
            </div>
        <?php endif; ?>
    </div>

    <div class="bg-slate-900 border border-white/5 rounded-2xl overflow-hidden shadow-xl">
        <div class="px-6 py-5 border-b border-white/5">
            <h3 class="text-lg font-semibold text-white">Faturas</h3>
        </div>
        <div class="overflow-x-auto">
            <table class="w-full text-left border-collapse">
                <thead>
                    <tr class="bg-slate-950/50 border-b border-white/5 text-xs font-semibold uppercase tracking-wider text-slate-400">
                        <th class="px-6 py-4">Referência</th>
                        <th class="px-6 py-4">Valor</th>
                        <th class="px-6 py-4">Emissão</th>
                        <th class="px-6 py-4">Vencimento</th>
                        <th class="px-6 py-4">Estado</th>
                    </tr>
                </thead>
                <tbody class="divide-y divide-white/5 whitespace-nowrap text-sm text-slate-300">
                    <?php $__empty_1 = true; $__currentLoopData = $invoices; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $invoice): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <tr class="hover:bg-slate-800/50">
                            <td class="px-6 py-4 text-white">Fatura #<?php echo e($invoice->id); ?></td>
                            <td class="px-6 py-4"><?php echo e(number_format((float) $invoice->amount, 2, ',', '.')); ?> Kz</td>
                            <td class="px-6 py-4"><?php echo e($invoice->issue_date->format('d/m/Y')); ?></td>
                            <td class="px-6 py-4"><?php echo e($invoice->due_date?->format('d/m/Y') ?? '---'); ?></td>
                            <td class="px-6 py-4"><?php echo e($invoice->status); ?></td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <tr><td colspan="5" class="px-6 py-12 text-center text-slate-500">Nenhuma fatura registada.</td></tr>
                    <?php endif; ?>
                </tbody>
            </table>
        </div>
        <?php if($invoices->hasPages()): ?>
            <div class="px-6 py-4 border-t border-white/5 bg-slate-950/20"><?php echo e($invoices->links()); ?></div>
        <?php endif; ?>
    </div>
<?php $__env->stopSection(); ?>

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