mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-04-04 04:01:27 +00:00
feat: Configuration des compétences par cycle [#16]
This commit is contained in:
@ -22,6 +22,7 @@ import {
|
||||
fetchTuitionPaymentPlans,
|
||||
fetchRegistrationPaymentModes,
|
||||
fetchTuitionPaymentModes,
|
||||
fetchEstablishmentCompetencies,
|
||||
} from '@/app/actions/schoolAction';
|
||||
import { fetchProfiles } from '@/app/actions/authAction';
|
||||
import SidebarTabs from '@/components/SidebarTabs';
|
||||
@ -30,6 +31,7 @@ import { fetchRegistrationSchoolFileMasters } from '@/app/actions/registerFileGr
|
||||
import logger from '@/utils/logger';
|
||||
import { useEstablishment } from '@/context/EstablishmentContext';
|
||||
import { PlanningProvider, PlanningModes } from '@/context/PlanningContext';
|
||||
import CompetenciesList from '@/components/Structure/Competencies/CompetenciesList';
|
||||
|
||||
export default function Page() {
|
||||
const [specialities, setSpecialities] = useState([]);
|
||||
@ -45,6 +47,9 @@ export default function Page() {
|
||||
const [registrationPaymentModes, setRegistrationPaymentModes] = useState([]);
|
||||
const [tuitionPaymentModes, setTuitionPaymentModes] = useState([]);
|
||||
const [profiles, setProfiles] = useState([]);
|
||||
const [establishmentCompetencies, setEstablishmentCompetencies] = useState(
|
||||
[]
|
||||
);
|
||||
|
||||
const csrfToken = useCsrfToken();
|
||||
const { selectedEstablishmentId } = useEstablishment();
|
||||
@ -98,9 +103,22 @@ export default function Page() {
|
||||
.catch((error) => {
|
||||
logger.error('Error fetching profileRoles:', error);
|
||||
});
|
||||
|
||||
// Fetch data for establishment competencies
|
||||
handleEstablishmentCompetencies();
|
||||
}
|
||||
}, [selectedEstablishmentId]);
|
||||
|
||||
const handleEstablishmentCompetencies = (cycle = 1) => {
|
||||
fetchEstablishmentCompetencies(selectedEstablishmentId, cycle)
|
||||
.then((data) => {
|
||||
setEstablishmentCompetencies(data);
|
||||
})
|
||||
.catch((error) =>
|
||||
logger.error('Error fetching setEstablishmentCompetencies:', error)
|
||||
);
|
||||
};
|
||||
|
||||
const handleSpecialities = () => {
|
||||
fetchSpecialities(selectedEstablishmentId)
|
||||
.then((data) => {
|
||||
@ -339,6 +357,18 @@ export default function Page() {
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
id: 'Competencies',
|
||||
label: 'Compétences',
|
||||
content: (
|
||||
<div className="h-full overflow-y-auto p-4">
|
||||
<CompetenciesList
|
||||
establishmentCompetencies={establishmentCompetencies}
|
||||
onChangeCycle={handleEstablishmentCompetencies}
|
||||
/>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user