diff --git a/index.html b/index.html index 76a954d..03d0a95 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - GISE Nexus | Portail d'Infrastructure Centralisée + NEXUS by gise | Portail d'Infrastructure Centralisée diff --git a/src/pages/app/BillingHistory.jsx b/src/pages/app/BillingHistory.jsx index 908a12d..3e9bf6b 100644 --- a/src/pages/app/BillingHistory.jsx +++ b/src/pages/app/BillingHistory.jsx @@ -9,7 +9,7 @@ export default function BillingHistory() { const [error, setError] = useState(null); const [customAlert, setCustomAlert] = useState(null); - // 🎯 NOUVEL ÉTAT : La facture actuellement ouverte dans la modale + // NOUVEL ÉTAT : La facture actuellement ouverte dans la modale const [selectedInvoice, setSelectedInvoice] = useState(null); const triggerAlert = (title, message, type) => { @@ -26,7 +26,6 @@ export default function BillingHistory() { throw new Error("Impossible de vérifier votre identité ou session expirée."); } const invoicesData = await getInvoicesHistory(profileData.id); - // On s'assure de bien cibler le tableau (correction précédente) setInvoices(invoicesData.data || []); } catch (err) { setError(err.message || "Problème de connexion avec le serveur."); @@ -43,12 +42,14 @@ export default function BillingHistory() { switch (status?.toLowerCase()) { case 'paid': + if (isNegative) { + return { label: 'REMBOURSÉE', css: 'bg-blue-500/10 text-blue-400 border-blue-500/20', icon: }; + } return { label: 'PAYÉE', css: 'bg-emerald-500/10 text-emerald-400 border-emerald-500/20', icon: }; case 'refunded': - // 🎯 NOUVEAU STATUT : REMBOURSÉE - return { label: 'REMBOURSÉE', css: 'bg-blue-500/10 text-blue-400 border-blue-500/20', icon: }; + // NOUVEAU STATUT : REMBOURSÉE case 'unpaid': - // 🎯 SI IMPAYÉE MAIS NÉGATIVE = EN COURS DE TRAITEMENT + // SI IMPAYÉE MAIS NÉGATIVE = EN COURS DE TRAITEMENT if (isNegative) { return { label: 'REMBOURSEMENT EN COURS', css: 'bg-amber-500/10 text-amber-400 border-amber-500/20', icon: }; } @@ -118,7 +119,7 @@ export default function BillingHistory() { {invoices.map((invoice) => { - const badge = getStatusBadge(invoice.status); + const badge = getStatusBadge(invoice.status, invoice.total); return ( @@ -168,8 +169,7 @@ export default function BillingHistory() { )} {/* ========================================== */} - {/* 🌟 LA MODALE DE DÉTAILS DE FACTURE */} - {/* ========================================== */} + {/* LA MODALE DE DÉTAILS DE FACTURE */} {selectedInvoice && (
@@ -211,7 +211,7 @@ export default function BillingHistory() {

Détail des prestations

{(() => { - // 🎯 FILTRE : On ne garde que les items dont le prix est strictement supérieur à 0 + // FILTRE : On ne garde que les items dont le prix est strictement supérieur à 0 const validItems = selectedInvoice.items ? selectedInvoice.items.filter(item => parseFloat(item.price) > 0) : []; @@ -246,7 +246,7 @@ export default function BillingHistory() {
- {/* 🧠 CALCULS MATHÉMATIQUES (EXTRACTION TVA DEPUIS LE TTC) */} + {/* CALCULS (EXTRACTION TVA DEPUIS LE TTC) */} {(() => { // Le total récupéré de la BDD est considéré comme le PRIX FINAL (TTC) const totalTTC = parseFloat(selectedInvoice.total) || 0;