From 3779a474171d7df716e3b0d06a26f7f9b69356fa Mon Sep 17 00:00:00 2001 From: N3WT DE COMPET Date: Mon, 16 Feb 2026 17:54:20 +0100 Subject: [PATCH] feat: Ajout bouton de refus de dossier avec zone de saisie de motif [N3WTS-2] --- .../app/[locale]/admin/subscriptions/page.js | 60 +++++++++++++ .../validateSubscription/page.js | 26 ++++++ .../Inscription/RefuseSubscription.js | 69 ++++++++++++++ .../Inscription/ValidateSubscription.js | 89 ++++++++++--------- Front-End/src/components/Textarea.js | 23 +++++ 5 files changed, 223 insertions(+), 44 deletions(-) create mode 100644 Front-End/src/components/Inscription/RefuseSubscription.js create mode 100644 Front-End/src/components/Textarea.js diff --git a/Front-End/src/app/[locale]/admin/subscriptions/page.js b/Front-End/src/app/[locale]/admin/subscriptions/page.js index d59eaab..f73089e 100644 --- a/Front-End/src/app/[locale]/admin/subscriptions/page.js +++ b/Front-End/src/app/[locale]/admin/subscriptions/page.js @@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react'; import Table from '@/components/Table'; import Tab from '@/components/Tab'; +import Textarea from '@/components/Textarea'; import { useTranslations } from 'next-intl'; import StatusLabel from '@/components/StatusLabel'; import Popup from '@/components/Popup'; @@ -96,6 +97,38 @@ export default function Page({ params: { locale } }) { const [isSepaUploadModalOpen, setIsSepaUploadModalOpen] = useState(false); const [selectedRowForUpload, setSelectedRowForUpload] = useState(null); + // Refus popup state + const [isRefusePopupOpen, setIsRefusePopupOpen] = useState(false); + const [refuseReason, setRefuseReason] = useState(''); + const [rowToRefuse, setRowToRefuse] = useState(null); + // Ouvre la popup de refus + const openRefusePopup = (row) => { + setRowToRefuse(row); + setRefuseReason(''); + setIsRefusePopupOpen(true); + }; + + // Valide le refus + const handleRefuse = () => { + if (!refuseReason.trim()) { + showNotification('Merci de préciser la raison du refus.', 'error', 'Erreur'); + return; + } + editRegisterForm( + rowToRefuse.student.id, + { status: RegistrationFormStatus.STATUS_ARCHIVED, notes: refuseReason }, + csrfToken + ) + .then(() => { + showNotification('Le dossier a été refusé et archivé.', 'success', 'Succès'); + setReloadFetch(true); + setIsRefusePopupOpen(false); + }) + .catch(() => { + showNotification('Erreur lors du refus du dossier.', 'error', 'Erreur'); + }); + }; + const csrfToken = useCsrfToken(); const router = useRouter(); const { selectedEstablishmentId, profileRole } = useEstablishment(); @@ -491,6 +524,14 @@ export default function Page({ params: { locale } }) { router.push(`${url}`); }, }, + { + icon: ( + + + + ), + onClick: () => openRefusePopup(row), + }, ], // Etat "A relancer" - NON TESTE [RegistrationFormStatus.STATUS_TO_FOLLOW_UP]: [ @@ -852,6 +893,25 @@ export default function Page({ params: { locale } }) { onCancel={() => setConfirmPopupVisible(false)} /> + {/* Popup de refus de dossier */} + +
Veuillez indiquer la raison du refus :
+