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

@@ -105,7 +105,7 @@ export async function POST(request: NextRequest) {
)
}
const { amountPence, rail, donorName, donorEmail, donorPhone, giftAid, fundType, eventId, qrSourceId, scheduleMode, dueDate, installmentCount, installmentDates } = parsed.data
const { amountPence, rail, donorName, donorEmail, donorPhone, giftAid, isZakat, eventId, qrSourceId, scheduleMode, dueDate, installmentCount, installmentDates } = parsed.data
// Get event + org
const event = await prisma.event.findUnique({
@@ -161,7 +161,7 @@ export async function POST(request: NextRequest) {
donorEmail: donorEmail || null,
donorPhone: donorPhone || null,
giftAid,
fundType: fundType || null,
isZakat: isZakat || false,
eventId,
qrSourceId: qrSourceId || null,
organizationId: org.id,
@@ -231,7 +231,7 @@ export async function POST(request: NextRequest) {
donorEmail: donorEmail || null,
donorPhone: donorPhone || null,
giftAid,
fundType: fundType || null,
isZakat: isZakat || false,
eventId,
qrSourceId: qrSourceId || null,
organizationId: org.id,