fix: activation flow - generate invoice on install, block prepaid if unpaid, activate sub on resolve; sub type/status badges

This commit is contained in:
Nemo
2026-03-24 15:26:09 +08:00
parent 5123d8c114
commit c778d14a13
2 changed files with 113 additions and 116 deletions

View File

@@ -268,11 +268,33 @@ export default function ClientDetailScreen() {
<Text style={{ fontSize: 15, color: '#94A3B8' }}>No active subscription</Text>
</View>
) : (
{/* Plan type badge */}
{sub.type && (
<View style={{ flexDirection: 'row', marginBottom: 12, gap: 8 }}>
<View style={{
borderRadius: 20, paddingHorizontal: 14, paddingVertical: 6,
backgroundColor: sub.type === 'PREPAID' ? '#FEF3C7' : '#ECFEFF',
}}>
<Text style={{
fontSize: 13, fontWeight: '800',
color: sub.type === 'PREPAID' ? '#D97706' : '#0891B2',
}}>{sub.type}</Text>
</View>
<View style={{
borderRadius: 20, paddingHorizontal: 14, paddingVertical: 6,
backgroundColor: sub.status === 'ACTIVE' ? '#DCFCE7' : sub.status === 'SUSPENDED' ? '#FEF3C7' : sub.status === 'PENDING' ? '#F0F9FF' : '#F1F5F9',
}}>
<Text style={{
fontSize: 13, fontWeight: '700',
color: sub.status === 'ACTIVE' ? '#166534' : sub.status === 'SUSPENDED' ? '#D97706' : sub.status === 'PENDING' ? '#0891B2' : '#6B7280',
}}>{sub.status}</Text>
</View>
</View>
)}
<View style={{ backgroundColor: '#FFF', borderRadius: 20, borderWidth: 1, borderColor: '#F1F5F9', overflow: 'hidden' }}>
<InfoRow label="Plan" value={sub.plan?.name} />
<InfoRow label="Speed" value={sub.plan?.speed ? `${sub.plan.speed} Mbps` : null} />
<InfoRow label="Monthly" value={sub.plan?.price ? `${Number(sub.plan.price).toLocaleString()}` : null} />
<InfoRow label="Status" value={sub.status} />
<InfoRow label="Speed" value={sub.plan?.speedDownMbps ? `${sub.plan.speedDownMbps} Mbps` : null} />
<InfoRow label="Monthly" value={sub.monthlyPrice ? `${Number(sub.monthlyPrice).toLocaleString()}` : null} />
<InfoRow label="Start Date" value={sub.startDate ? new Date(sub.startDate).toLocaleDateString('en-PH', { year: 'numeric', month: 'long', day: 'numeric' }) : null} />
<InfoRow label="Billing Day" value={sub.billingDay ? `Day ${sub.billingDay}` : null} isLast />
</View>