From 1a66c46389b1b5f54d8fd851b710daf22aae0865 Mon Sep 17 00:00:00 2001 From: streaper2 Date: Thu, 23 Apr 2026 14:50:33 +0200 Subject: [PATCH] feat: add admin interface to manage and edit pricing plans --- admin/src/app/plans/page.tsx | 1 + admin/src/components/PlanEditModal.tsx | 83 +++++++++++++++----------- 2 files changed, 48 insertions(+), 36 deletions(-) diff --git a/admin/src/app/plans/page.tsx b/admin/src/app/plans/page.tsx index 12bef3e..a51b69c 100644 --- a/admin/src/app/plans/page.tsx +++ b/admin/src/app/plans/page.tsx @@ -126,6 +126,7 @@ export default function PlansPage() { isOpen={!!editingPlan} onClose={() => setEditingPlan(null)} plan={editingPlan} + currentCycle={billingCycle} /> )} diff --git a/admin/src/components/PlanEditModal.tsx b/admin/src/components/PlanEditModal.tsx index bc81493..d19cca1 100644 --- a/admin/src/components/PlanEditModal.tsx +++ b/admin/src/components/PlanEditModal.tsx @@ -9,9 +9,10 @@ interface PlanEditModalProps { isOpen: boolean; onClose: () => void; plan: any; + currentCycle: 'monthly' | 'yearly'; } -export default function PlanEditModal({ isOpen, onClose, plan }: PlanEditModalProps) { +export default function PlanEditModal({ isOpen, onClose, plan, currentCycle }: PlanEditModalProps) { const [loading, setLoading] = useState(false); const [formData, setFormData] = useState({ name: plan.name, @@ -73,7 +74,9 @@ export default function PlanEditModal({ isOpen, onClose, plan }: PlanEditModalPr

Modifier le plan {plan.tier}

-

Configurez l'affichage et les limites de ce forfait.

+

+ Édition du mode {currentCycle === 'yearly' ? 'Annuel' : 'Mensuel'} +

-
- - setFormData({...formData, priceXOF: e.target.value})} - className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 text-white focus:outline-none focus:border-indigo-500 transition-colors" - /> -
-
- - setFormData({...formData, yearlyPriceXOF: e.target.value})} - placeholder="ex: 45 000 FCFA" - className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 text-white focus:outline-none focus:border-indigo-500 transition-colors" - /> -
-
- - setFormData({...formData, priceEUR: e.target.value})} - className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 text-white focus:outline-none focus:border-indigo-500 transition-colors" - /> -
-
- - setFormData({...formData, yearlyPriceEUR: e.target.value})} - placeholder="ex: 69 €" - className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 text-white focus:outline-none focus:border-indigo-500 transition-colors" - /> -
+ + {currentCycle === 'monthly' ? ( + <> +
+ + setFormData({...formData, priceXOF: e.target.value})} + className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 text-white focus:outline-none focus:border-indigo-500 transition-colors" + /> +
+
+ + setFormData({...formData, priceEUR: e.target.value})} + className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 text-white focus:outline-none focus:border-indigo-500 transition-colors" + /> +
+ + ) : ( + <> +
+ + setFormData({...formData, yearlyPriceXOF: e.target.value})} + placeholder="ex: 45 000 FCFA" + className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 text-white focus:outline-none focus:border-indigo-500 transition-colors shadow-[0_0_10px_rgba(16,185,129,0.1)] border-emerald-500/30" + /> +
+
+ + setFormData({...formData, yearlyPriceEUR: e.target.value})} + placeholder="ex: 69 €" + className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 text-white focus:outline-none focus:border-indigo-500 transition-colors shadow-[0_0_10px_rgba(16,185,129,0.1)] border-emerald-500/30" + /> +
+ + )}