feat: Page Structure : suppression de la possibilité de faire des actions d'admin [N3WTS-8]

This commit is contained in:
N3WT DE COMPET
2026-02-15 18:40:14 +01:00
parent 195579e217
commit 05c68ebfaa
7 changed files with 145 additions and 112 deletions

View File

@ -1,4 +1,4 @@
import React, { useState, useEffect, useRef } from 'react';
import React, { useState, useEffect } from 'react';
import {
Edit,
Trash2,
@ -192,8 +192,8 @@ function SimpleList({
export default function FilesGroupsManagement({
csrfToken,
selectedEstablishmentId,
profileRole
}) {
const [showFilePreview, setShowFilePreview] = useState(false);
const [schoolFileMasters, setSchoolFileMasters] = useState([]);
const [parentFiles, setParentFileMasters] = useState([]);
const [groups, setGroups] = useState([]);
@ -211,7 +211,6 @@ export default function FilesGroupsManagement({
const [selectedGroupId, setSelectedGroupId] = useState(null);
const [showHelp, setShowHelp] = useState(false);
const { showNotification } = useNotification();
const [isFileUploadOpen, setIsFileUploadOpen] = useState(false);
const [isParentFileModalOpen, setIsParentFileModalOpen] = useState(false);
const [editingParentFile, setEditingParentFile] = useState(null);
@ -819,13 +818,15 @@ export default function FilesGroupsManagement({
<div className="flex items-center mb-4">
<SectionTitle title="Liste des dossiers d'inscriptions" />
<div className="flex-1" />
<button
className="flex items-center justify-center bg-emerald-500 hover:bg-emerald-600 text-white px-3 py-2 rounded-lg shadow transition text-base font-semibold"
onClick={() => setIsGroupModalOpen(true)}
title="Créer un nouveau dossier"
>
<Plus className="w-5 h-5" />
</button>
{profileRole !== 0 && (
<button
className="flex items-center justify-center bg-emerald-500 hover:bg-emerald-600 text-white px-3 py-2 rounded-lg shadow transition text-base font-semibold"
onClick={() => setIsGroupModalOpen(true)}
title="Créer un nouveau dossier"
>
<Plus className="w-5 h-5" />
</button>
)}
</div>
<SimpleList
items={groups}
@ -865,52 +866,54 @@ export default function FilesGroupsManagement({
<div className="flex flex-col w-2/3">
<div className="flex items-center mb-4">
<SectionTitle title="Liste des documents" />
<div className="flex-1" />
<DropdownMenu
buttonContent={
<span className="flex items-center">
<Plus className="w-5 h-5" />
<ChevronDown className="w-4 h-4 ml-1" />
</span>
}
items={[
{
type: 'item',
label: (
<div className="flex-1" />
{profileRole !== 0 && (
<DropdownMenu
buttonContent={
<span className="flex items-center">
<Star className="w-5 h-5 mr-2 text-yellow-600" />
Formulaire personnalisé
<Plus className="w-5 h-5" />
<ChevronDown className="w-4 h-4 ml-1" />
</span>
),
onClick: () => handleDocDropdownSelect('formulaire'),
},
{
type: 'item',
label: (
<span className="flex items-center">
<FileText className="w-5 h-5 mr-2 text-gray-600" />
Formulaire existant
</span>
),
onClick: () => handleDocDropdownSelect('formulaire_existant'),
},
{
type: 'item',
label: (
<span className="flex items-center">
<Plus className="w-5 h-5 mr-2 text-orange-500" />
Pièce à fournir
</span>
),
onClick: () => handleDocDropdownSelect('parent'),
},
]}
buttonClassName="flex items-center justify-center bg-emerald-500 hover:bg-emerald-600 text-white px-3 py-2 rounded-lg shadow transition text-base font-semibold"
menuClassName="absolute right-0 mt-2 w-56 bg-white border border-gray-200 rounded shadow-lg z-20"
dropdownOpen={isDocDropdownOpen}
setDropdownOpen={setIsDocDropdownOpen}
/>
</div>
}
items={[
{
type: 'item',
label: (
<span className="flex items-center">
<Star className="w-5 h-5 mr-2 text-yellow-600" />
Formulaire personnalisé
</span>
),
onClick: () => handleDocDropdownSelect('formulaire'),
},
{
type: 'item',
label: (
<span className="flex items-center">
<FileText className="w-5 h-5 mr-2 text-gray-600" />
Formulaire existant
</span>
),
onClick: () => handleDocDropdownSelect('formulaire_existant'),
},
{
type: 'item',
label: (
<span className="flex items-center">
<Plus className="w-5 h-5 mr-2 text-orange-500" />
Pièce à fournir
</span>
),
onClick: () => handleDocDropdownSelect('parent'),
},
]}
buttonClassName="flex items-center justify-center bg-emerald-500 hover:bg-emerald-600 text-white px-3 py-2 rounded-lg shadow transition text-base font-semibold"
menuClassName="absolute right-0 mt-2 w-56 bg-white border border-gray-200 rounded shadow-lg z-20"
dropdownOpen={isDocDropdownOpen}
setDropdownOpen={setIsDocDropdownOpen}
/>
)}
</div>
{!selectedGroupId ? (
<div className="flex items-center justify-center h-40 text-gray-400 text-lg italic border border-gray-200 rounded bg-white">
Sélectionner un dossier d&apos;inscription