diff --git a/src/App.tsx b/src/App.tsx index 884606d..c400e5d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -115,6 +115,7 @@ export default function App() { const [selectedEditPricePlan, setSelectedEditPricePlan] = useState(null); const [editPriceInr, setEditPriceInr] = useState(''); const [editPriceUsd, setEditPriceUsd] = useState(''); + const [editPriceEur, setEditPriceEur] = useState(''); const [editPlanName, setEditPlanName] = useState(''); const [editPlanDesc, setEditPlanDesc] = useState(''); const [editPlanBadge, setEditPlanBadge] = useState(''); @@ -134,6 +135,7 @@ export default function App() { const [createPlanDuration, setCreatePlanDuration] = useState('yearly'); const [createPlanPriceInr, setCreatePlanPriceInr] = useState(''); const [createPlanPriceUsd, setCreatePlanPriceUsd] = useState(''); + const [createPlanPriceEur, setCreatePlanPriceEur] = useState(''); const [createPlanModuleIds, setCreatePlanModuleIds] = useState([]); const [createPlanSaving, setCreatePlanSaving] = useState(false); const [createPlanError, setCreatePlanError] = useState(null); @@ -595,6 +597,7 @@ export default function App() { setSelectedEditPricePlan(plan); setEditPriceInr(String(plan.price_inr ?? '')); setEditPriceUsd(String(plan.price_usd ?? '')); + setEditPriceEur(String(plan.price_eur ?? plan.price_usd ?? '')); setEditPlanName(plan.name || ''); setEditPlanDesc(plan.description || ''); setEditPlanBadge(plan.badge_text || ''); @@ -607,7 +610,8 @@ export default function App() { if (!selectedEditPricePlan || !userToken) return; const inrVal = parseFloat(editPriceInr); const usdVal = parseFloat(editPriceUsd); - if (isNaN(inrVal) || inrVal < 0 || isNaN(usdVal) || usdVal < 0) { + const eurVal = editPriceEur.trim() ? parseFloat(editPriceEur) : usdVal; + if (isNaN(inrVal) || inrVal < 0 || isNaN(usdVal) || usdVal < 0 || isNaN(eurVal) || eurVal < 0) { alert('Please enter valid positive pricing values.'); return; } @@ -618,6 +622,7 @@ export default function App() { { price_inr: inrVal, price_usd: usdVal, + price_eur: eurVal, name: editPlanName.trim() || undefined, description: editPlanDesc.trim() || undefined, badge_text: editPlanBadge.trim() || undefined, @@ -638,6 +643,7 @@ export default function App() { subtitle: editPlanSubtitle.trim() || selectedEditPricePlan.subtitle, price_inr: inrVal, price_usd: usdVal, + price_eur: eurVal, } : p ) @@ -665,6 +671,7 @@ export default function App() { setCreatePlanDuration('yearly'); setCreatePlanPriceInr(''); setCreatePlanPriceUsd(''); + setCreatePlanPriceEur(''); setCreatePlanModuleIds([]); setCreatePlanError(null); setShowCreatePlanModal(true); @@ -679,8 +686,9 @@ export default function App() { } const inrVal = parseFloat(createPlanPriceInr); const usdVal = parseFloat(createPlanPriceUsd); - if (isNaN(inrVal) || inrVal < 0 || isNaN(usdVal) || usdVal < 0) { - setCreatePlanError('Please provide valid positive prices for INR and USD.'); + const eurVal = createPlanPriceEur.trim() ? parseFloat(createPlanPriceEur) : usdVal; + if (isNaN(inrVal) || inrVal < 0 || isNaN(usdVal) || usdVal < 0 || isNaN(eurVal) || eurVal < 0) { + setCreatePlanError('Please provide valid positive prices for INR, USD, and EUR.'); return; } if (createPlanModuleIds.length === 0) { @@ -703,6 +711,7 @@ export default function App() { billing_period: createPlanDuration, price_inr: inrVal, price_usd: usdVal, + price_eur: eurVal, module_ids: createPlanModuleIds, is_featured: false, }, @@ -1257,6 +1266,7 @@ export default function App() { duration={createPlanDuration} priceInr={createPlanPriceInr} priceUsd={createPlanPriceUsd} + priceEur={createPlanPriceEur} selectedModuleIds={createPlanModuleIds} allModules={adminModulesList} saving={createPlanSaving} @@ -1270,7 +1280,13 @@ export default function App() { onTypeChange={setCreatePlanType} onDurationChange={setCreatePlanDuration} onPriceInrChange={setCreatePlanPriceInr} - onPriceUsdChange={setCreatePlanPriceUsd} + onPriceUsdChange={(v) => { + setCreatePlanPriceUsd(v); + if (!createPlanPriceEur || createPlanPriceEur === createPlanPriceUsd) { + setCreatePlanPriceEur(v); + } + }} + onPriceEurChange={setCreatePlanPriceEur} onToggleModule={(id) => setCreatePlanModuleIds((prev) => prev.includes(id) ? prev.filter((x) => x !== id) : [...prev, id] @@ -1291,6 +1307,7 @@ export default function App() { subtitle={editPlanSubtitle} priceInr={editPriceInr} priceUsd={editPriceUsd} + priceEur={editPriceEur} saving={editPriceSaving} onNameChange={setEditPlanName} onDescChange={setEditPlanDesc} @@ -1299,6 +1316,7 @@ export default function App() { onSubtitleChange={setEditPlanSubtitle} onPriceInrChange={setEditPriceInr} onPriceUsdChange={setEditPriceUsd} + onPriceEurChange={setEditPriceEur} onSave={handleSavePlanPrice} onClose={() => setSelectedEditPricePlan(null)} /> diff --git a/src/components/plans/CreatePlanModal.tsx b/src/components/plans/CreatePlanModal.tsx index 35df59b..18e2091 100644 --- a/src/components/plans/CreatePlanModal.tsx +++ b/src/components/plans/CreatePlanModal.tsx @@ -14,6 +14,7 @@ interface CreatePlanModalProps { duration: string; priceInr: string; priceUsd: string; + priceEur: string; selectedModuleIds: string[]; allModules: any[]; saving: boolean; @@ -28,6 +29,7 @@ interface CreatePlanModalProps { onDurationChange: (v: string) => void; onPriceInrChange: (v: string) => void; onPriceUsdChange: (v: string) => void; + onPriceEurChange: (v: string) => void; onToggleModule: (id: string) => void; onSelectAllModules: () => void; onClearAllModules: () => void; @@ -47,6 +49,7 @@ export const CreatePlanModal: React.FC = ({ duration, priceInr, priceUsd, + priceEur, selectedModuleIds, allModules, saving, @@ -61,6 +64,7 @@ export const CreatePlanModal: React.FC = ({ onDurationChange, onPriceInrChange, onPriceUsdChange, + onPriceEurChange, onToggleModule, onSelectAllModules, onClearAllModules, @@ -193,8 +197,8 @@ export const CreatePlanModal: React.FC = ({ - {/* Dual Currency Pricing */} -
+ {/* Multi-Currency Pricing (INR / USD / EUR) */} +
@@ -227,6 +231,21 @@ export const CreatePlanModal: React.FC = ({ />
+
+ +
+ € + onPriceEurChange(e.target.value)} + className="w-full bg-slate-50 border border-slate-200 rounded-xl pl-7 pr-3 py-2 text-xs font-bold text-slate-800 focus:outline-none focus:border-indigo-500" + /> +
+
{/* Module Selection */} diff --git a/src/components/plans/EditPriceModal.tsx b/src/components/plans/EditPriceModal.tsx index 78e6282..e32e4f8 100644 --- a/src/components/plans/EditPriceModal.tsx +++ b/src/components/plans/EditPriceModal.tsx @@ -10,6 +10,7 @@ interface EditPriceModalProps { subtitle: string; priceInr: string; priceUsd: string; + priceEur: string; saving: boolean; onNameChange: (v: string) => void; onDescChange: (v: string) => void; @@ -18,6 +19,7 @@ interface EditPriceModalProps { onSubtitleChange: (v: string) => void; onPriceInrChange: (v: string) => void; onPriceUsdChange: (v: string) => void; + onPriceEurChange: (v: string) => void; onSave: (e: React.FormEvent) => void; onClose: () => void; } @@ -31,6 +33,7 @@ export const EditPriceModal: React.FC = ({ subtitle, priceInr, priceUsd, + priceEur, saving, onNameChange, onDescChange, @@ -39,6 +42,7 @@ export const EditPriceModal: React.FC = ({ onSubtitleChange, onPriceInrChange, onPriceUsdChange, + onPriceEurChange, onSave, onClose, }) => { @@ -114,7 +118,7 @@ export const EditPriceModal: React.FC = ({
-
+
@@ -146,6 +150,22 @@ export const EditPriceModal: React.FC = ({ />
+ +
+ +
+ € + onPriceEurChange(e.target.value)} + className="w-full bg-slate-50 border border-slate-200 rounded-xl pl-7 pr-3 py-2 text-xs font-bold text-slate-800 focus:outline-none focus:border-indigo-500" + /> +
+
diff --git a/src/components/plans/PlansTab.tsx b/src/components/plans/PlansTab.tsx index 283a55f..9d0738d 100644 --- a/src/components/plans/PlansTab.tsx +++ b/src/components/plans/PlansTab.tsx @@ -139,7 +139,7 @@ export const PlansTab: React.FC = ({ Plan Details Type & Duration Included Modules - Live Pricing (INR / USD) + Live Pricing (INR / USD / EUR) Subscribers Status Actions @@ -260,7 +260,11 @@ export const PlansTab: React.FC = ({

₹{plan.price_inr ?? '—'}

-

${plan.price_usd ?? '—'}

+
+ ${plan.price_usd ?? '—'} + • + €{plan.price_eur ?? plan.price_usd ?? '—'} +