diff --git a/Front-End/src/app/[locale]/admin/subscriptions/page.js b/Front-End/src/app/[locale]/admin/subscriptions/page.js index 7abf408..d5a1c68 100644 --- a/Front-End/src/app/[locale]/admin/subscriptions/page.js +++ b/Front-End/src/app/[locale]/admin/subscriptions/page.js @@ -80,7 +80,6 @@ export default function Page({ params: { locale } }) { const [currentSchoolHistoricalYearPage, setCurrentSchoolHistoricalYearPage] = useState(1); const [searchTerm, setSearchTerm] = useState(''); - const [alertPage, setAlertPage] = useState(false); const [isLoading, setIsLoading] = useState(false); const [activeTab, setActiveTab] = useState('currentYear'); const [totalCurrentYear, setTotalCurrentYear] = useState(0); @@ -666,234 +665,156 @@ export default function Page({ params: { locale } }) { }, ]; - const columnsSubscribed = [ - { name: t('studentName'), transform: (row) => row.student.last_name }, - { name: t('studentFistName'), transform: (row) => row.student.first_name }, - { - name: t('lastUpdateDate'), - transform: (row) => row.updated_date_formated, - }, - { name: t('class'), transform: (row) => row.student.first_name }, - { - name: t('registrationFileStatus'), - transform: (row) => ( -
- - updateStatusAction(row.student.id, newStatus) - } - showDropdown={false} - /> -
- ), - }, - { - name: 'Actions', - transform: (row) => ( - - } - items={[ - { - label: ( - <> - Rattacher - - ), - onClick: () => openModalAssociationEleve(row.student), - }, - { - label: ( - <> - Archiver - - ), - onClick: () => - archiveFicheInscription( - row.student.id, - row.student.last_name, - row.student.first_name - ), - }, - ]} - buttonClassName="text-gray-400 hover:text-gray-600" - menuClassName="absolute right-0 mt-2 w-48 bg-white border border-gray-200 rounded-md shadow-lg z-10 flex flex-col items-center" - /> - ), - }, - ]; - if (isLoading) { return ; - } else { - if ( - registrationForms.length === 0 && - registrationFormsDataHistorical.length === 0 && - alertPage - ) { - return ( -
- +
+
+ {/* Tab pour l'année scolaire en cours */} + + {currentSchoolYear} + + ({totalCurrentYear}) + + + } + active={activeTab === 'currentYear'} + onClick={() => setActiveTab('currentYear')} + /> + + {/* Tab pour l'année scolaire prochaine */} + + {nextSchoolYear} + + ({totalNextYear}) + + + } + active={activeTab === 'nextYear'} + onClick={() => setActiveTab('nextYear')} + /> + + {/* Tab pour l'historique */} + + {t('historical')} + + ({totalHistorical}) + + + } + active={activeTab === 'historical'} + onClick={() => setActiveTab('historical')} />
- ); - } else { - return ( -
-
-
- {/* Tab pour l'année scolaire en cours */} - - {currentSchoolYear} - - ({totalCurrentYear}) - - - } - active={activeTab === 'currentYear'} - onClick={() => setActiveTab('currentYear')} - /> +
- {/* Tab pour l'année scolaire prochaine */} - - {nextSchoolYear} - - ({totalNextYear}) - - - } - active={activeTab === 'nextYear'} - onClick={() => setActiveTab('nextYear')} - /> +
+ {activeTab === 'currentYear' || + activeTab === 'nextYear' || + activeTab === 'historical' ? ( + +
+
+ + +
+ +
- {/* Tab pour l'historique */} - - {t('historical')} - - ({totalHistorical}) - - +
+ + setActiveTab('historical')} + columns={columns} + itemsPerPage={itemsPerPage} + currentPage={ + activeTab === 'currentYear' + ? currentSchoolYearPage + : activeTab === 'nextYear' + ? currentSchoolNextYearPage + : currentSchoolHistoricalYearPage + } + totalPages={ + activeTab === 'currentYear' + ? totalCurrentSchoolYearPages + : activeTab === 'nextYear' + ? totalNextSchoolYearPages + : totalHistoricalPages + } + onPageChange={handlePageChange} /> - + + ) : null} + + setPopupVisible(false)} + uniqueConfirmButton={true} + /> + setConfirmPopupVisible(false)} + /> -
- {activeTab === 'currentYear' || - activeTab === 'nextYear' || - activeTab === 'historical' ? ( - -
-
- - -
- -
- -
- -
- - - ) : null} - - setPopupVisible(false)} - uniqueConfirmButton={true} - /> - setConfirmPopupVisible(false)} - /> - - {isSepaUploadModalOpen && ( - ( - - handleSepaFileUpload(file, selectedRowForUpload) - } - /> - )} + {isSepaUploadModalOpen && ( + ( + + handleSepaFileUpload(file, selectedRowForUpload) + } /> )} - {isFilesModalOpen && ( - - )} - - ); - } - } + /> + )} + {isFilesModalOpen && ( + + )} + + ); }