<?php include app()->basePath('app/Views/partials/header.php'); ?>

<section class="payment-layout">
    <div class="panel">
        <p class="eyebrow">Pagamento manual</p>
        <h1><?= e($payment['course_title']) ?></h1>
        <p><?= e((string) $paymentInstructions) ?></p>

        <div class="detail-list">
            <div><span>Pedido</span><strong><?= e($payment['order_number']) ?></strong></div>
            <div><span>Referencia</span><strong><?= e($payment['reference']) ?></strong></div>
            <div><span>Valor</span><strong><?= e(money_mzn($payment['amount'])) ?></strong></div>
            <div><span>Estado</span><strong><?= e(payment_status_label($payment['status'])) ?></strong></div>
        </div>

        <section class="sub-panel">
            <h2>Dados para pagamento</h2>
            <div class="payment-methods">
                <?php foreach ($paymentMethods as $method): ?>
                    <div>
                        <strong><?= e($method['label']) ?></strong>
                        <span><?= e(implode(' - ', $method['lines'])) ?></span>
                    </div>
                <?php endforeach; ?>
            </div>
        </section>
    </div>

    <aside class="panel">
        <p class="eyebrow">Comprovativo</p>
        <h2>Enviar comprovativo</h2>
        <?php if (!empty($payment['proof'])): ?>
            <div class="alert success">Comprovativo enviado. Pode reenviar se precisar corrigir.</div>
        <?php endif; ?>
        <form method="post" action="/payments/proof" class="form" enctype="multipart/form-data">
            <?= csrf_field() ?>
            <input type="hidden" name="payment_id" value="<?= e((string) $payment['id']) ?>">
            <label>
                Ficheiro PDF, JPG ou PNG
                <input type="file" name="proof" accept="application/pdf,image/jpeg,image/png" required>
            </label>
            <label>
                Observacao
                <textarea name="student_note" rows="4" placeholder="Ex: Pago via M-Pesa as 14h30"></textarea>
            </label>
            <button class="button" type="submit">Enviar comprovativo</button>
        </form>
    </aside>
</section>

<?php include app()->basePath('app/Views/partials/footer.php'); ?>
