<?php $__template->layout('Layout.main'); ?>

<?php $__template->section('title'); ?>تحصيل دفعة<?php $__template->endSection(); ?>

<?php $__template->section('content'); ?>
<div style="max-width:600px;margin:0 auto;">
    <div class="card">
        <div style="padding:15px 20px;border-bottom:1px solid #E5E7EB;font-weight:600;">تحصيل دفعة</div>
        <div style="padding:20px;">
            <!-- Payment Details -->
            <div style="background:#F9FAFB;border-radius:8px;padding:15px;margin-bottom:20px;">
                <div style="display:grid;grid-template-columns:1fr 1fr;gap:10px;font-size:14px;">
                    <div><span style="color:#6B7280;">رقم الطلب:</span></div>
                    <div style="font-weight:600;font-family:monospace;"><?= e($pr['request_number']) ?></div>

                    <div><span style="color:#6B7280;">العضو:</span></div>
                    <div style="font-weight:600;"><?= e($pr['member_name'] ?? '—') ?></div>

                    <div><span style="color:#6B7280;">رقم الاستمارة:</span></div>
                    <div><?= e($pr['form_number'] ?? '—') ?></div>

                    <div><span style="color:#6B7280;">نوع الدفعة:</span></div>
                    <div><?= e(\App\Modules\Cashier\Services\PaymentRequestService::getPaymentTypeLabel($pr['payment_type'])) ?></div>

                    <div><span style="color:#6B7280;">المبلغ:</span></div>
                    <div style="font-size:20px;font-weight:700;color:#059669;"><?= money($pr['amount']) ?></div>
                </div>
                <?php if (!empty($pr['description_ar'])): ?>
                    <div style="margin-top:10px;padding-top:10px;border-top:1px solid #E5E7EB;font-size:13px;color:#4B5563;">
                        <?= e($pr['description_ar']) ?>
                    </div>
                <?php endif; ?>
            </div>

            <!-- Payment Form -->
            <form method="POST" action="/treasury/queue/<?= (int) $pr['id'] ?>/collect">
                <?= csrf_field() ?>
                <div style="margin-bottom:15px;">
                    <label class="form-label">طريقة الدفع</label>
                    <select name="payment_method" class="form-select" required>
                        <option value="cash">نقدي</option>
                        <option value="visa">فيزا</option>
                        <option value="bank_transfer">تحويل بنكي</option>
                    </select>
                </div>
                <div style="display:flex;gap:10px;">
                    <button type="submit" class="btn btn-primary" style="flex:1;" onclick="return confirm('تأكيد تحصيل <?= money($pr['amount']) ?>؟')">
                        تحصيل الدفعة
                    </button>
                    <a href="/treasury/queue" class="btn btn-outline">رجوع</a>
                </div>
            </form>
        </div>
    </div>
</div>
<?php $__template->endSection(); ?>
