Update Flazz card history parsing

This commit is contained in:
2026-05-01 21:44:59 +07:00
parent 102a5c4eb7
commit 1dc293c697
5 changed files with 285 additions and 362 deletions

View File

@ -385,10 +385,15 @@ private struct TransactionRow: View {
}
private var dateText: String {
guard let date = riwayat.getTransationTime() else { return "" }
let fmt = DateFormatter()
fmt.dateFormat = "MMM d, yyyy · HH:mm"
return fmt.string(from: date)
if let date = riwayat.getTransationTime() {
let fmt = DateFormatter()
fmt.dateFormat = "MMM d, yyyy · HH:mm"
return fmt.string(from: date)
}
if let raw = riwayat.getDesk(), !raw.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
return raw
}
return ""
}
private var statusText: String { isCredit ? L10n.topup : L10n.payment }
@ -660,8 +665,10 @@ final class HistoryHostingController: UIViewController {
y += 10
// Table Header
// Cek apakah ada data lokasi di seluruh list
let hasLocation = list.contains {
let normalizedCardLabel = cardLabel.lowercased()
let hideLocationForPdf = normalizedCardLabel.contains("flazz")
|| normalizedCardLabel.contains("mandiri e-money")
let hasLocation = !hideLocationForPdf && list.contains {
let loc = $0.getLocationName()?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
return !loc.isEmpty
}
@ -707,7 +714,9 @@ final class HistoryHostingController: UIViewController {
width: colW + 8, height: rowHeight)).fill()
}
let dateStr = rw.getTransationTime().map { dateFmt.string(from: $0) } ?? ""
let dateStr = rw.getTransationTime().map { dateFmt.string(from: $0) }
?? rw.getDesk()
?? ""
let typeStr = rw.getProsesTipe() == 0 ? "Top up" : "Payment"
let amtStr = numFmt.string(for: rw.getAmount()) ?? "Rp 0"
let amtColor: UIColor = rw.getProsesTipe() == 0