<?php require dirname(__DIR__) . '/layouts/app.php'; ?>

<section class="page-heading">
    <div>
        <p class="eyebrow">Paiement #<?= (int) $payment['id'] ?></p>
        <h1><?= number_format((float) $payment['amount'], 2, ',', ' ') ?></h1>
    </div>
    <div class="heading-actions">
        <a class="button-link secondary" href="<?= url('/payments/receipt?id=' . $payment['id']) ?>">Recu</a>
        <?php if (Auth::can('payments.edit')): ?>
            <a class="button-link" href="<?= url('/payments/edit?id=' . $payment['id']) ?>">Modifier</a>
        <?php endif; ?>
        <a class="button-link secondary" href="<?= url('/payments') ?>">Retour</a>
    </div>
</section>

<section class="detail-layout">
    <article class="detail-panel">
        <span class="status-pill payment-<?= e($payment['status']) ?>">
            <?= e(payment_statuses()[$payment['status']] ?? $payment['status']) ?>
        </span>
        <dl>
            <dt>Reservation</dt>
            <dd>#<?= (int) $payment['reservation_id'] ?> - <?= e($payment['start_date'] . ' - ' . $payment['end_date']) ?></dd>
            <dt>Bien</dt>
            <dd><?= e($payment['property_title']) ?></dd>
            <dt>Client</dt>
            <dd><?= e($payment['first_name'] . ' ' . $payment['last_name']) ?></dd>
            <dt>Telephone</dt>
            <dd><?= e($payment['phone'] ?: '-') ?></dd>
            <dt>Email</dt>
            <dd><?= e($payment['email'] ?: '-') ?></dd>
            <dt>Montant reservation</dt>
            <dd><?= number_format((float) $payment['total_amount'], 2, ',', ' ') ?></dd>
            <dt>Montant paiement</dt>
            <dd><?= number_format((float) $payment['amount'], 2, ',', ' ') ?></dd>
            <dt>Mode</dt>
            <dd><?= e(payment_methods()[$payment['payment_method']] ?? $payment['payment_method']) ?></dd>
            <dt>Date paiement</dt>
            <dd><?= e($payment['payment_date'] ?: '-') ?></dd>
        </dl>
    </article>

    <article class="detail-panel">
        <h2>Notes</h2>
        <p><?= nl2br(e($payment['notes'] ?: 'Aucune note.')) ?></p>
    </article>
</section>

<?php require dirname(__DIR__) . '/layouts/app_footer.php'; ?>
