<%= t('customer.public_voucher.title', 'Voucher Hotspot') %>

<%= settings.company_header || 'OPEN-ISP' %> — <%= t('customer.public_voucher.subtitle', 'beli & kirim ke WhatsApp') %>
<% if (error) { %>
<%= error %>
<% } %> <% if (info) { %>
<%= info %>
<% } %> <% if (order) { %>
<%= t('customer.public_voucher.order_status', 'Status Pesanan') %>
Order #<%= order.id %> • WA: <%= order.buyer_phone %>
<% const st = String(order.status || 'pending'); %> <% if (st === 'fulfilled') { %> <%= t('customer.public_voucher.st_done', 'Selesai') %> <% } else if (st === 'paid') { %> <%= t('customer.public_voucher.st_process', 'Diproses') %> <% } else { %> <%= t('customer.public_voucher.st_wait', 'Menunggu') %><% } %>
<%= t('customer.public_voucher.pkg', 'Paket') %>: <%= order.profile_name %> • <%= t('customer.public_voucher.duration', 'Durasi') %>: <%= order.validity || '-' %> • <%= t('customer.public_voucher.price', 'Harga') %>: Rp <%= Number(order.price || 0).toLocaleString('id-ID') %>
<% if (String(order.status) === 'fulfilled' && order.voucher_code) { %>
<%= t('customer.public_voucher.ready', 'Voucher Siap') %>
User<%= order.voucher_code %>
Pass<%= order.voucher_password %>
<% if (Number(order.wa_sent || 0) === 1) { %>
<%= t('customer.public_voucher.sent_wa', 'Voucher berhasil dikirim ke WhatsApp pembeli.') %>
<% } else if (order.wa_error) { %>
<%= t('customer.public_voucher.wa_fail', 'WhatsApp gagal terkirim') %>: <%= order.wa_error %>
<%= t('customer.public_voucher.backup', 'Cadangan: simpan kode voucher yang tampil di halaman ini.') %>
<% } else { %>
<%= t('customer.public_voucher.fallback', 'Jika WhatsApp gagal terkirim, kode voucher tetap tampil di halaman ini.') %>
<% } %>
<% } else if (String(order.status) === 'paid') { %>
<%= t('customer.public_voucher.paid_processing', 'Pembayaran berhasil — voucher sedang dibuat di MikroTik. Halaman ini diperbarui otomatis.') %>
<% } else if (String(order.status) === 'pending' && (String(order.payment_gateway || '') === 'qris_static' || order.qris_amount_unique)) { %> <% if (orderToken) { %> <%= t('customer.public_voucher.open_qris', 'Buka QRIS Statis') %> <% } else { %>
<%= t('customer.public_voucher.qris_na', 'Link QRIS tidak tersedia.') %>
<% } %> <% } else if (String(order.status) === 'pending' && order.payment_link) { %> <%= t('customer.public_voucher.continue_pay', 'Lanjutkan Pembayaran') %> <% } %>

<% } %>
<%= t('customer.public_voucher.pkg_label', 'Paket Voucher') %> <% if (!profiles || profiles.length === 0) { %>
<%= t('customer.public_voucher.no_profile', 'Belum ada profile voucher (metadata Mikhmon) di MikroTik.') %>
<% } else { %>
<% (profiles || []).forEach(function(p, idx){ %> > <% }); %>
<% } %>
<%= t('customer.public_voucher.pay_method', 'Metode Pembayaran') %> <% const hasStaticQris = (String(settings.qris_static_qr_url || '').trim() || String(settings.qris_static_payload || '').trim()) && (settings.qris_static_enabled !== false && settings.qris_static_enabled !== 'false' && settings.qris_static_enabled !== 0 && settings.qris_static_enabled !== '0'); %> <% if (true) { %>
<%= t('customer.check_billing.pay_method', 'QRIS / Transfer Bank / E-Wallet') %> <%= t('customer.check_billing.pay_note', 'Metode dipilih di halaman pembayaran') %>
<% } else { %>
<% if (hasStaticQris) { %> <% } %> <% paymentChannels.forEach(function(ch, idx){ const code = String(ch.code || '').toUpperCase(); const name = ch.name || code; const group = String(ch.group || '').toLowerCase(); let icon = 'bi-wallet2'; const c = code.toLowerCase(); if (c.includes('qris')) icon = 'bi-qr-code-scan'; else if (c.includes('va') || group.includes('virtual') || c.includes('bank')) icon = 'bi-bank'; else if (c.includes('snap') || c.includes('xendit') || c.includes('duitku')) icon = 'bi-credit-card'; const feeFlat = Number(ch.total_fee && ch.total_fee.flat || 0); %> <% }); %>
<% } %>
<%= t('customer.public_voucher.buyer_wa', 'Nomor WhatsApp Pembeli') %>
<%= t('customer.public_voucher.buyer_note', 'Kode voucher akan dikirim ke nomor ini.') %>
© <%= new Date().getFullYear() %> <%= settings.company_header || '' %>
<% if (order && (String(order.status) === 'paid' || String(order.status) === 'pending') && !order.voucher_code) { %> <% } %>