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

@ -7,7 +7,6 @@ import CheckBox from '@/components/Form/CheckBox';
import Button from '@/components/Form/Button';
import { useEstablishment } from '@/context/EstablishmentContext';
import {
fetchEstablishmentCompetencies,
createEstablishmentCompetencies,
deleteEstablishmentCompetencies,
} from '@/app/actions/schoolAction';
@ -44,7 +43,7 @@ export default function CompetenciesList({
3: false,
4: false,
});
const { selectedEstablishmentId } = useEstablishment();
const { selectedEstablishmentId, profileRole } = useEstablishment();
const csrfToken = useCsrfToken();
const { showNotification } = useNotification();
@ -280,17 +279,19 @@ export default function CompetenciesList({
</div>
{/* Bouton submit centré en bas */}
<div className="flex justify-center mb-2 mt-6">
<Button
text="Sauvegarder"
className={`px-6 py-2 rounded-md shadow ${
!hasSelection
? 'bg-gray-300 text-gray-500 cursor-not-allowed'
: 'bg-emerald-500 text-white hover:bg-emerald-600'
}`}
onClick={handleSubmit}
primary
disabled={!hasSelection}
/>
{profileRole !== 0 && (
<Button
text="Sauvegarder"
className={`px-6 py-2 rounded-md shadow ${
!hasSelection
? 'bg-gray-300 text-gray-500 cursor-not-allowed'
: 'bg-emerald-500 text-white hover:bg-emerald-600'
}`}
onClick={handleSubmit}
primary
disabled={!hasSelection}
/>
)}
</div>
{/* Légende en dessous du bouton, alignée à gauche */}
<div className="flex flex-row items-center gap-4 mb-4">