<%= t('collector.role','Kolektor') %>: <%= session.collectorName || t('collector.fallback_name','Penagih') %>
<%= company %> · v<%= appVersion %> (<%= appVersionName %>) <% if (session.collectorArea) { %> <%= t('collector.col_area_short','Area:') %> <%= session.collectorArea %> <% } else { %> <%= t('collector.filter_all_area','Semua Area') %> <% } %>
<%- include('../partials/service-notice') %> <% if (msg) { %>
<%- msg.text %>
<% } %>
<%= t('collector.bill_list','Daftar Tagihan') %>
<%= t('collector.read_only','Read Only') %>
<%= t('collector.count_prefix','Menampilkan maks 500 tagihan periode') %><%= String(month).padStart(2,'0') %>/<%= year %>.
<%= t('collector.data_title','Data Pelanggan & Tagihan Area') %> (<%= (invoices || []).length %>)
<% if (!invoices || invoices.length === 0) { %>
<%= t('collector.no_data','Tidak ada data pelanggan untuk filter ini.') %>
<% } else { %>
<% invoices.forEach(inv => { const invId = inv.invoice_id; const isPaid = String(inv.invoice_status||'').toLowerCase()==='paid'; const reqRow = pendingMap && pendingMap.get ? (pendingMap.get('inv_' + invId) || pendingMap.get('cust_' + inv.customer_id)) : null; const reqStatus = reqRow ? String(reqRow.status||'') : ''; const isPending = reqStatus === 'pending'; const noInvoice = !invId; const amount = Number(inv.invoice_amount || inv.package_price || 0); %>
<%= inv.customer_name || '-' %> <%= inv.customer_phone ? '('+inv.customer_phone+')' : '' %> <% if (inv.customer_status === 'suspended') { %> <%= t('collector.status_isolir','ISOLIR') %> <% } else if (inv.customer_status === 'active') { %> <%= t('collector.status_active','Aktif') %> <% } else { %> <%= inv.customer_status %> <% } %>
<%= inv.package_name || 'Internet' %> <%= invId ? ('• Invoice #' + invId) : '• Belum Ada Invoice' %>
Rp <%= amount.toLocaleString('id-ID') %>
<% if (isPaid) { %> <%= t('collector.status_lunas','LUNAS') %> <% } else if (isPending) { %> <%= t('collector.waiting_approval','MENUNGGU APPROVAL') %> <% } else if (noInvoice) { %> <%= t('collector.status_belum_tagihan','BELUM TAGIHAN') %> <% } else { %> <%= t('collector.status_belum_bayar','BELUM BAYAR') %> <% } %>
<%= t('collector.col_period','Periode') %><%= month %>/<%= year %>
<%= t('collector.col_area','Area / Wilayah') %><%= inv.customer_area || '-' %>
<%= t('collector.col_due','Jatuh Tempo') %><%= inv.isolate_day ? ('Tgl ' + inv.isolate_day) : '-' %>
<%= t('collector.col_cust_id','ID Pelanggan') %>#<%= inv.customer_id %>
<%= t('collector.col_pppoe','PPPoE') %><%= inv.pppoe_username ? inv.pppoe_username : '-' %>
<%= t('collector.col_onu_tag','Tag ONU') %><%= inv.genieacs_tag ? inv.genieacs_tag : '-' %>
<%= t('collector.col_address','Alamat') %><%= inv.customer_address ? inv.customer_address : '-' %>
<% if (inv.lat && inv.lng) { %> <%= t('collector.map','Map') %> <% } %> <% if (isPaid && inv.invoice_id) { %> <%= t('collector.print_receipt','Cetak Struk (Thermal)') %> PDF <% } else if (!isPaid && !isPending) { %>
<% } %>
<% }) %>
<% } %>
<%= t('collector.request_history','Riwayat Pengajuan Saya') %>
<%= (myReqs || []).length %>
<% if (!myReqs || myReqs.length === 0) { %>
<%= t('collector.no_requests','Belum ada pengajuan.') %>
<% } else { %>
<% myReqs.forEach(r => { %> <% const st = String(r.status||''); %> <% }) %>
<%= t('collector.col_time','Waktu') %> <%= t('collector.customer','Pelanggan') %> <%= t('collector.col_period','Periode') %> <%= t('collector.col_amount','Nominal') %> <%= t('collector.col_status_action','Status / Aksi') %>
<%= r.created_at ? new Date(r.created_at).toLocaleString('id-ID') : '-' %> <%= r.customer_name || '-' %> <%= r.customer_phone ? '('+r.customer_phone+')' : '' %> <%= r.period_month %>/<%= r.period_year %> Rp <%= Number(r.amount||0).toLocaleString('id-ID') %> <% if (st === 'approved') { %> <%= t('collector.approved','APPROVED') %> <%= t('collector.struk','Struk') %> <% } else if (st === 'rejected') { %> <%= t('collector.rejected','REJECTED') %> <% } else { %> <%= t('collector.status_pending','PENDING') %> <% } %>
<%= t('collector.total_requests','Total pengajuan (halaman ini)') %> Rp <%= (myReqs || []).reduce((s, r) => s + (Number(r.amount||0) || 0), 0).toLocaleString('id-ID') %>
<% } %>
<% const qsBase = { month: String(month), year: String(year), search: String(search || '') }; const qsAll = new URLSearchParams({ ...qsBase, status: String(status || 'all'), scope: '' }).toString(); const qsToday = new URLSearchParams({ ...qsBase, status: 'unpaid', scope: 'today' }).toString(); const qsUnpaid = new URLSearchParams({ ...qsBase, status: 'unpaid', scope: 'unpaid' }).toString(); const qsIsolir = new URLSearchParams({ ...qsBase, status: 'unpaid', scope: 'isolir' }).toString(); const qsMulti = new URLSearchParams({ ...qsBase, status: 'unpaid', scope: 'multi' }).toString(); const activeScope = String(scope || ''); const activeStatus = String(status || ''); %>
<%= t('collector.filter_all','Semua') %> <%= t('collector.today','Hari Ini') %> <%= t('collector.btn_belum','Belum') %> <%= t('collector.btn_isolir','Isolir') %> >1 <%= t('collector.month_short','Bln') %> <%= t('collector.absensi','Absensi') %>