fix: Ajout du mode Visu

This commit is contained in:
N3WT DE COMPET
2025-05-04 14:32:06 +02:00
parent 4ecf25a6ab
commit e1c607308c
29 changed files with 531 additions and 414 deletions

View File

@ -17,7 +17,6 @@ import { useCsrfToken } from '@/context/CsrfContext';
export default function ParentHomePage() {
const [children, setChildren] = useState([]);
const [userId, setUserId] = useState(null);
const { user, selectedEstablishmentId } = useEstablishment();
const [uploadingStudentId, setUploadingStudentId] = useState(null); // ID de l'étudiant pour l'upload
const [uploadedFile, setUploadedFile] = useState(null); // Fichier uploadé
@ -29,7 +28,6 @@ export default function ParentHomePage() {
useEffect(() => {
if (user !== null) {
const userIdFromSession = user.user_id;
setUserId(userIdFromSession);
fetchChildren(userIdFromSession, selectedEstablishmentId).then((data) => {
setChildren(data);
});
@ -40,14 +38,14 @@ export default function ParentHomePage() {
function handleView(eleveId) {
logger.debug(`View dossier for student id: ${eleveId}`);
router.push(
`${FE_PARENTS_EDIT_INSCRIPTION_URL}?id=${userId}&studentId=${eleveId}&view=true`
`${FE_PARENTS_EDIT_INSCRIPTION_URL}?studentId=${eleveId}&enabled=false`
);
}
function handleEdit(eleveId) {
logger.debug(`Edit dossier for student id: ${eleveId}`);
router.push(
`${FE_PARENTS_EDIT_INSCRIPTION_URL}?id=${userId}&studentId=${eleveId}`
`${FE_PARENTS_EDIT_INSCRIPTION_URL}?studentId=${eleveId}&enabled=true`
);
}
@ -176,6 +174,19 @@ export default function ParentHomePage() {
</button>
</>
)}
{row.status === 5 && (
<button
className="text-purple-500 hover:text-purple-700"
onClick={(e) => {
e.stopPropagation();
handleView(row.student.id);
}}
aria-label="Visualiser le dossier"
>
<Eye className="h-5 w-5" />
</button>
)}
</div>
),
},