add billing system

This commit is contained in:
LathanDevers
2026-07-12 10:28:02 +02:00
parent ef8f4a96b4
commit eb48f506cf
12 changed files with 743 additions and 118 deletions
+7 -5
View File
@@ -1,7 +1,7 @@
import { useState, useEffect, useCallback } from 'react';
import { getMyServices, getHostingServiceDetails } from '../../services/api';
import { useVPC } from '../../services/useVPC';
import { Server, Globe, Folder, Trash2, Loader, Plus, AlertCircle } from 'lucide-react';
import { Server, Globe, Folder, Trash2, Loader, Plus, AlertCircle, X } from 'lucide-react';
// Importation de tes nouveaux composants modulaires !
import NotificationModal from '../../components/ui/NotificationModal';
@@ -30,7 +30,7 @@ export default function Services() {
const detailedServices = await Promise.all(data.list.map(async (order) => {
let hDetails = null;
if (order.status === 'active' && (order.plugin === 'hosting' || (order.title || '').toLowerCase().includes('vps'))) {
try { hDetails = await getHostingServiceDetails(order.id); } catch (e) {}
try { hDetails = await getHostingServiceDetails(order.id); } catch (e) { }
}
return { ...order, hostingDetails: hDetails };
}));
@@ -43,7 +43,7 @@ export default function Services() {
});
setServices(filteredServices);
}
} catch (err) { setError(err.message || "Impossible de charger la télémétrie."); }
} catch (err) { setError(err.message || "Impossible de charger la télémétrie."); }
finally { setIsLoading(false); }
}, []);
@@ -68,7 +68,7 @@ export default function Services() {
const freshDetails = await getHostingServiceDetails(service.id);
setActiveServiceModal({ type: isVPS ? 'vps' : 'web', data: service, details: freshDetails });
}
} catch (err) { triggerAlert("Erreur", err.message, "error"); }
} catch (err) { triggerAlert("Erreur", err.message, "error"); }
finally { setIsConnecting(null); }
};
@@ -132,7 +132,9 @@ export default function Services() {
<h3 className="text-xl font-bold text-white tracking-wider flex items-center gap-3">
{activeServiceModal.type === 'vps' ? <><Server className="w-6 h-6 text-cyan-400" /> GESTION VPS</> : <><Globe className="w-6 h-6 text-emerald-400" /> GESTION WEB</>}
</h3>
<button onClick={() => setActiveServiceModal(null)} className="text-gray-400 hover:text-white transition text-xl"></button>
<button onClick={() => setActiveServiceModal(null)} className="p-2 text-gray-500 hover:text-white bg-gray-900 hover:bg-gray-800 rounded-lg transition-colors">
<X className="w-5 h-5" />
</button>
</div>
{activeServiceModal.type === 'vps' ? (
activeServiceModal.details?.ip && activeServiceModal.details.ip !== '127.0.0.1' ? <VpsManager details={activeServiceModal.details} orderId={activeServiceModal.data.id} onRefresh={fetchServices} onAlert={triggerAlert} /> : <VpsDeployer serviceId={activeServiceModal.data.id} onDeploySuccess={() => { setActiveServiceModal(null); fetchServices(); }} onAlert={triggerAlert} />