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:
@@ -21,7 +21,7 @@ export interface PledgeData {
|
||||
donorEmail: string
|
||||
donorPhone: string
|
||||
giftAid: boolean
|
||||
fundType?: string
|
||||
isZakat: boolean
|
||||
// Scheduling
|
||||
scheduleMode: "now" | "date" | "installments"
|
||||
dueDate?: string
|
||||
@@ -38,8 +38,7 @@ interface EventInfo {
|
||||
paymentMode: "self" | "external"
|
||||
externalUrl: string | null
|
||||
externalPlatform: string | null
|
||||
zakatEnabled: boolean
|
||||
fundAllocation: string | null
|
||||
zakatEligible: boolean
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -66,6 +65,7 @@ export default function PledgePage() {
|
||||
donorEmail: "",
|
||||
donorPhone: "",
|
||||
giftAid: false,
|
||||
isZakat: false,
|
||||
scheduleMode: "now",
|
||||
})
|
||||
const [pledgeResult, setPledgeResult] = useState<{
|
||||
@@ -137,7 +137,7 @@ export default function PledgePage() {
|
||||
}
|
||||
|
||||
// Submit pledge (from identity step, or card/DD steps)
|
||||
const submitPledge = async (identity: { donorName: string; donorEmail: string; donorPhone: string; giftAid: boolean; fundType?: string }) => {
|
||||
const submitPledge = async (identity: { donorName: string; donorEmail: string; donorPhone: string; giftAid: boolean; isZakat?: boolean }) => {
|
||||
const finalData = { ...pledgeData, ...identity }
|
||||
setPledgeData(finalData)
|
||||
|
||||
@@ -149,7 +149,7 @@ export default function PledgePage() {
|
||||
...finalData,
|
||||
eventId: eventInfo?.id,
|
||||
qrSourceId: eventInfo?.qrSourceId,
|
||||
fundType: finalData.fundType || undefined,
|
||||
isZakat: finalData.isZakat || false,
|
||||
}),
|
||||
})
|
||||
const result = await res.json()
|
||||
@@ -209,7 +209,7 @@ export default function PledgePage() {
|
||||
0: <AmountStep onSelect={handleAmountSelected} eventName={eventInfo?.name || ""} eventId={eventInfo?.id} />,
|
||||
1: <ScheduleStep amount={pledgeData.amountPence} onSelect={handleScheduleSelected} />,
|
||||
2: <PaymentStep onSelect={handleRailSelected} amount={pledgeData.amountPence} />,
|
||||
3: <IdentityStep onSubmit={submitPledge} amount={pledgeData.amountPence} zakatEnabled={eventInfo?.zakatEnabled} fundAllocation={eventInfo?.fundAllocation} />,
|
||||
3: <IdentityStep onSubmit={submitPledge} amount={pledgeData.amountPence} zakatEligible={eventInfo?.zakatEligible} />,
|
||||
4: pledgeResult && <BankInstructionsStep pledge={pledgeResult} amount={pledgeData.amountPence} eventName={eventInfo?.name || ""} donorPhone={pledgeData.donorPhone} />,
|
||||
5: pledgeResult && (
|
||||
<ConfirmationStep
|
||||
|
||||
Reference in New Issue
Block a user