import React, { useState } from 'react';
import { Helmet } from 'react-helmet';
import { useNavigate } from 'react-router-dom';
import { ArrowLeft, Check, Wallet, ShieldCheck, CreditCard } from 'lucide-react';
import { toast } from '@/components/ui/use-toast';
import { motion } from 'framer-motion';
import { useSignature } from '@/contexts/SignatureContext';
const CreditPackage = ({ credits, price, savings, popular, onSelect, loading }) => (
{popular && (
Recommandé
)}
{price}€
HT
{(price / credits).toFixed(2)}€ / signature
{savings && (
Économisez {savings}%
)}
-
Signature certifiée eIDAS
-
Horodatage qualifié
-
Archivage 10 ans
);
const SignatureCreditPurchase = () => {
const navigate = useNavigate();
const { stats, purchaseCredits } = useSignature();
const [loading, setLoading] = useState(false);
const handlePurchase = async (amount, price) => {
setLoading(true);
// Simulate payment processing
setTimeout(async () => {
const success = await purchaseCredits(amount);
setLoading(false);
if (success) {
toast({
title: "Achat confirmé",
description: `${amount} crédits ont été ajoutés à votre solde.`,
variant: "success"
});
navigate('/home/signature/dashboard');
}
}, 1500);
};
return (
<>
Achat de crédits - Signature - Bijou ERP
Recharger mon compte
Choisissez le pack adapté à vos besoins
Solde actuel :
{stats?.credits.remaining || 0} crédits
handlePurchase(10, 15)}
loading={loading}
/>
handlePurchase(25, 35)}
loading={loading}
/>
handlePurchase(50, 65)}
loading={loading}
/>
handlePurchase(100, 120)}
loading={loading}
/>
Paiement 100% sécurisé
Transactions chiffrées via Stripe. Facture disponible immédiatement.
{/* Simple representation of payment methods */}
>
);
};
export default SignatureCreditPurchase;