simplify: zakat yes/no per campaign, remove 5 fund types, add I've Donated button for external pledges

- Event.zakatEligible (boolean) replaces Organization.zakatEnabled + 5 fund types
- Pledge.isZakat (boolean) replaces Pledge.fundType enum
- Removed fundAllocation from Event (campaign IS the allocation)
- Identity step: simple checkbox instead of 5-option grid
- Campaign creation: Zakat toggle + optional external URL for self-payment
- External redirect step: 'I've Donated' button calls /api/pledges/[id]/mark-initiated
- Landing page: simplified Zakat section (toggle preview, not 5 fund descriptions)
- Settings: removed org-level Zakat toggle (it's per campaign now)
- Migration: ALTER TABLE adds zakatEligible/isZakat, drops fundAllocation
This commit is contained in:
2026-03-03 07:19:52 +08:00
parent f87aec7beb
commit fc80a43a89
14 changed files with 131 additions and 179 deletions

View File

@@ -10,7 +10,7 @@ export const createEventSchema = z.object({
paymentMode: z.enum(['self', 'external']).default('self'),
externalUrl: z.string().url().max(1000).optional(),
externalPlatform: z.enum(['launchgood', 'enthuse', 'justgiving', 'gofundme', 'other']).optional(),
fundAllocation: z.string().max(200).optional(),
zakatEligible: z.boolean().default(false),
})
export const createQrSourceSchema = z.object({
@@ -26,7 +26,7 @@ export const createPledgeSchema = z.object({
donorEmail: z.string().max(200).optional().default(''),
donorPhone: z.string().max(20).optional().default(''),
giftAid: z.boolean().default(false),
fundType: z.enum(['general', 'zakat', 'sadaqah', 'lillah', 'fitrana']).optional(),
isZakat: z.boolean().default(false),
eventId: z.string(),
qrSourceId: z.string().nullable().optional(),
// Payment scheduling