Allow directors to validate DLCs and fix validation button visibility

Correct the product status check for validation and grant 'directeur' role the ability to see the validate button in DlcPage.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: a3de0820-9397-41b2-b000-7931ee9c29de
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/a3de0820-9397-41b2-b000-7931ee9c29de/emyZ6I3
This commit is contained in:
michaelschal committed 2025-08-15 21:02:28 +00:00
1 parent 7e7b2ec9ea
commit ff414a16c7
2 files changed
+203 -2

No files matched your search

+3 -2
View File
@@ -282,7 +282,8 @@ export default function DlcPage() {
const daysUntilExpiry = Math.ceil((expiry.getTime() - today.getTime()) / (1000 * 60 * 60 * 24));
// Afficher le bouton si le produit expire dans 15 jours ou moins, ou est déjà expiré
return (daysUntilExpiry <= 15 && product.status !== "valide");
// ET si le produit n'est pas déjà validé
return (daysUntilExpiry <= 15 && product.status !== "valides");
};
const getStatusBadge = (status: string, dlcDate: string | null) => {
@@ -791,7 +792,7 @@ export default function DlcPage() {
>
<Edit className="w-4 h-4" />
</Button>
{shouldShowValidateButton(product) && (user?.role === 'admin' || user?.role === 'manager') && (
{shouldShowValidateButton(product) && (user?.role === 'admin' || user?.role === 'manager' || user?.role === 'directeur') && (
<Button
variant="default"
size="sm"