/** * Licenses Tab Component * * Manages user licenses within the organization */ 'use client'; import { useState } from 'react'; import { useQuery } from '@tanstack/react-query'; import { getSubscriptionOverview } from '@/lib/api/subscriptions'; import Link from 'next/link'; import { UserPlus } from 'lucide-react'; export default function LicensesTab() { const [error, setError] = useState(''); const [success, setSuccess] = useState(''); const { data: subscription, isLoading } = useQuery({ queryKey: ['subscription'], queryFn: getSubscriptionOverview, }); if (isLoading) { return (
Licences utilisées
{subscription?.usedLicenses || 0}
Hors ADMIN (illimité)
Licences disponibles
{subscription?.availableLicenses === -1 ? 'Illimité' : subscription?.availableLicenses || 0}
Licences totales
{subscription?.maxLicenses === -1 ? 'Illimité' : subscription?.maxLicenses || 0}
| Utilisateur | Rôle | Assignée le | Licence | |
|---|---|---|---|---|
|
{license.userName}
|
{license.userEmail}
|
{license.userRole} |
{new Date(license.assignedAt).toLocaleDateString('fr-FR', {
day: 'numeric',
month: 'long',
year: 'numeric',
})}
|
{isAdmin ? ( Illimité ) : ( Active )} |
| Utilisateur | Rôle | Assignée le | Révoquée le | Statut | |
|---|---|---|---|---|---|
|
{license.userName}
|
{license.userEmail}
|
{license.userRole} |
{new Date(license.assignedAt).toLocaleDateString('fr-FR', {
day: 'numeric',
month: 'long',
year: 'numeric',
})}
|
{license.revokedAt
? new Date(license.revokedAt).toLocaleDateString('fr-FR', {
day: 'numeric',
month: 'long',
year: 'numeric',
})
: '-'}
|
Révoquée |