mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 07:53:23 +00:00
feat: Gestion des rattachements de Guardian à des RF déjà existants
This commit is contained in:
@ -170,7 +170,7 @@ useEffect(() => {
|
||||
const fetchInitialData = () => {
|
||||
Promise.all([
|
||||
fetchClasses(selectedEstablishmentId),
|
||||
fetchStudents(selectedEstablishmentId) // Utiliser l'ID de l'établissement ici
|
||||
fetchStudents(selectedEstablishmentId)
|
||||
])
|
||||
.then(([classesData, studentsData]) => {
|
||||
setClasses(classesData);
|
||||
@ -374,11 +374,11 @@ useEffect(()=>{
|
||||
last_name: updatedData.studentLastName,
|
||||
first_name: updatedData.studentFirstName,
|
||||
guardians: updatedData.selectedGuardians.length !== 0 ? updatedData.selectedGuardians.map(guardianId => ({ id: guardianId })) : [{
|
||||
profile_role: {
|
||||
profile_role_data: {
|
||||
establishment: selectedEstablishmentId,
|
||||
role_type: 2,
|
||||
is_active: false,
|
||||
profile: {
|
||||
profile_data: {
|
||||
email: updatedData.guardianEmail,
|
||||
password: 'Provisoire01!',
|
||||
username: updatedData.guardianEmail,
|
||||
|
||||
@ -99,7 +99,7 @@ export const archiveRegisterForm = (id) => {
|
||||
}).then(requestResponseHandler)
|
||||
}
|
||||
|
||||
export const fetchStudents = (id=null, establishment) => {
|
||||
export const fetchStudents = (establishment, id=null) => {
|
||||
const url = (id)?`${BE_SUBSCRIPTION_STUDENTS_URL}/${id}`:`${BE_SUBSCRIPTION_STUDENTS_URL}?establishment_id=${establishment}`;
|
||||
const request = new Request(
|
||||
url,
|
||||
|
||||
@ -346,10 +346,10 @@ const InscriptionForm = ( { students, registrationDiscounts, tuitionDiscounts, r
|
||||
type="checkbox"
|
||||
checked={formData.selectedGuardians.includes(guardian.id)}
|
||||
className="form-checkbox h-5 w-5 text-emerald-600"
|
||||
onChange={() => handleResponsableSelection(guardian.id, guardian.email)}
|
||||
onChange={() => handleResponsableSelection(guardian.id, guardian.associated_profile_email)}
|
||||
/>
|
||||
<span className="text-gray-900">
|
||||
{guardian.last_name && guardian.first_name ? `${guardian.last_name} ${guardian.first_name}` : `${guardian.email}`}
|
||||
{guardian.last_name && guardian.first_name ? `${guardian.last_name} ${guardian.first_name}` : `${guardian.associated_profile_email}`}
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
@ -563,7 +563,7 @@ const InscriptionForm = ( { students, registrationDiscounts, tuitionDiscounts, r
|
||||
<tr key={guardian.id}>
|
||||
<td className="px-4 py-2 border">{guardian.last_name}</td>
|
||||
<td className="px-4 py-2 border">{guardian.first_name}</td>
|
||||
<td className="px-4 py-2 border">{guardian.email}</td>
|
||||
<td className="px-4 py-2 border">{guardian.associated_profile_email}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user