feat: Ajout de la photo pour le dossier de l'élève + correction

sauvegarde des datas des responsables
This commit is contained in:
N3WT DE COMPET
2025-05-01 14:59:19 +02:00
parent d37e6c384d
commit 5851341235
12 changed files with 187 additions and 86 deletions

View File

@ -5,7 +5,7 @@ import InscriptionFormShared from '@/components/Inscription/InscriptionFormShare
import { FE_ADMIN_SUBSCRIPTIONS_URL } from '@/utils/Url';
import { useCsrfToken } from '@/context/CsrfContext';
import { useEstablishment } from '@/context/EstablishmentContext';
import { editRegisterForm } from '@/app/actions/subscriptionAction';
import { editRegisterFormWithBinaryFile } from '@/app/actions/subscriptionAction';
import logger from '@/utils/logger';
import Loader from '@/components/Loader';
@ -21,7 +21,7 @@ export default function Page() {
const handleSubmit = (data) => {
setIsLoading(true);
editRegisterForm(studentId, data, csrfToken)
editRegisterFormWithBinaryFile(studentId, data, csrfToken)
.then((result) => {
setIsLoading(false);
logger.debug('Success:', result);

View File

@ -60,6 +60,7 @@ import { fetchProfiles } from '@/app/actions/authAction';
import {
FE_ADMIN_SUBSCRIPTIONS_EDIT_URL,
FE_ADMIN_SUBSCRIPTIONS_VALIDATE_URL,
BASE_URL,
} from '@/utils/Url';
import DjangoCSRFToken from '@/components/DjangoCSRFToken';
@ -743,17 +744,6 @@ export default function Page({ params: { locale } }) {
const getActionsByStatus = (row) => {
const actions = {
1: [
{
icon: (
<span title="Editer le dossier">
<Edit className="w-5 h-5 text-blue-500 hover:text-blue-700" />
</span>
),
onClick: () =>
router.push(
`${FE_ADMIN_SUBSCRIPTIONS_EDIT_URL}?studentId=${row.student.id}`
),
},
{
icon: (
<span title="Envoyer le dossier">
@ -865,6 +855,33 @@ export default function Page({ params: { locale } }) {
};
const columns = [
{
name: t('photo'),
transform: (row) => (
<div className="flex justify-center items-center">
{row.student.photo ? (
<a
href={`${BASE_URL}${row.student.photo}`} // Lien vers la photo
target="_blank"
rel="noopener noreferrer"
>
<img
src={`${BASE_URL}${row.student.photo}`}
alt={`${row.student.first_name} ${row.student.last_name}`}
className="w-10 h-10 object-cover transition-transform duration-200 hover:scale-125 cursor-pointer"
/>
</a>
) : (
<div className="w-10 h-10 flex items-center justify-center bg-gray-200 rounded-full">
<span className="text-gray-500 text-sm font-semibold">
{row.student.first_name[0]}
{row.student.last_name[0]}
</span>
</div>
)}
</div>
),
},
{ name: t('studentName'), transform: (row) => row.student.last_name },
{ name: t('studentFistName'), transform: (row) => row.student.first_name },
{