diff --git a/Back-End/School/models.py b/Back-End/School/models.py index a992eac..25967b2 100644 --- a/Back-End/School/models.py +++ b/Back-End/School/models.py @@ -68,6 +68,11 @@ class Planning(models.Model): def __str__(self): return f'Planning for {self.level} of {self.school_class.atmosphere_name}' +class PaymentOptions(models.IntegerChoices): + SINGLE_PAYMENT = 0, _('Paiement en une seule fois') + FOUR_TIME_PAYMENT = 1, _('Paiement en 4 fois') + TEN_TIME_PAYMENT = 2, _('Paiement en 10 fois') + class Discount(models.Model): name = models.CharField(max_length=255, unique=True) amount = models.DecimalField(max_digits=10, decimal_places=2) @@ -78,25 +83,23 @@ class Discount(models.Model): class Fee(models.Model): name = models.CharField(max_length=255, unique=True) - amount = models.DecimalField(max_digits=10, decimal_places=2) description = models.TextField(blank=True) + base_amount = models.DecimalField(max_digits=10, decimal_places=2, default=0) + currency = models.CharField(max_length=3, default='EUR') + discounts = models.ManyToManyField('Discount', blank=True) + payment_option = models.IntegerField(choices=PaymentOptions, default=PaymentOptions.SINGLE_PAYMENT) + is_active = models.BooleanField(default=True) + updated_at = models.DateTimeField(auto_now=True) def __str__(self): return self.name class TuitionFee(models.Model): - class PaymentOptions(models.IntegerChoices): - SINGLE_PAYMENT = 0, _('Paiement en une seule fois') - FOUR_TIME_PAYMENT = 1, _('Paiement en 4 fois') - TEN_TIME_PAYMENT = 2, _('Paiement en 10 fois') - name = models.CharField(max_length=255, unique=True) description = models.TextField(blank=True) - base_amount = models.DecimalField(max_digits=10, decimal_places=2) + base_amount = models.DecimalField(max_digits=10, decimal_places=2, default=0) currency = models.CharField(max_length=3, default='EUR') discounts = models.ManyToManyField('Discount', blank=True) - validity_start_date = models.DateField() - validity_end_date = models.DateField() payment_option = models.IntegerField(choices=PaymentOptions, default=PaymentOptions.SINGLE_PAYMENT) is_active = models.BooleanField(default=True) updated_at = models.DateTimeField(auto_now=True) @@ -107,16 +110,3 @@ class TuitionFee(models.Model): def clean(self): if self.validity_end_date <= self.validity_start_date: raise ValidationError(_('La date de fin de validité doit être après la date de début de validité.')) - - def calculate_final_amount(self): - amount = self.base_amount - - # Apply fees (supplements and taxes) - # for fee in self.fees.all(): - # amount += fee.amount - - # Apply discounts - for discount in self.discounts.all(): - amount -= discount.amount - - return amount diff --git a/Back-End/School/serializers.py b/Back-End/School/serializers.py index 2248861..08b5588 100644 --- a/Back-End/School/serializers.py +++ b/Back-End/School/serializers.py @@ -180,21 +180,48 @@ class DiscountSerializer(serializers.ModelSerializer): fields = '__all__' class FeeSerializer(serializers.ModelSerializer): + discounts = serializers.PrimaryKeyRelatedField(queryset=Discount.objects.all(), many=True) + class Meta: model = Fee fields = '__all__' + def create(self, validated_data): + discounts_data = validated_data.pop('discounts', []) + + # Create the Fee instance + fee = Fee.objects.create(**validated_data) + + # Add discounts if provided + fee.discounts.set(discounts_data) + + return fee + + def update(self, instance, validated_data): + discounts_data = validated_data.pop('discounts', []) + + # Update the Fee instance + instance.name = validated_data.get('name', instance.name) + instance.description = validated_data.get('description', instance.description) + instance.base_amount = validated_data.get('base_amount', instance.base_amount) + instance.currency = validated_data.get('currency', instance.currency) + instance.payment_option = validated_data.get('payment_option', instance.payment_option) + instance.is_active = validated_data.get('is_active', instance.is_active) + instance.updated_at = validated_data.get('updated_at', instance.updated_at) + instance.save() + + # Update discounts if provided + instance.discounts.set(discounts_data) + + return instance + class TuitionFeeSerializer(serializers.ModelSerializer): discounts = serializers.PrimaryKeyRelatedField(queryset=Discount.objects.all(), many=True) - final_amount = serializers.SerializerMethodField() class Meta: model = TuitionFee fields = '__all__' - def get_final_amount(self, obj): - return obj.calculate_final_amount() - def create(self, validated_data): discounts_data = validated_data.pop('discounts', []) @@ -202,8 +229,7 @@ class TuitionFeeSerializer(serializers.ModelSerializer): tuition_fee = TuitionFee.objects.create(**validated_data) # Add discounts if provided - for discount in discounts_data: - tuition_fee.discounts.add(discount) + tuition_fee.discounts.set(discounts_data) return tuition_fee @@ -215,14 +241,12 @@ class TuitionFeeSerializer(serializers.ModelSerializer): instance.description = validated_data.get('description', instance.description) instance.base_amount = validated_data.get('base_amount', instance.base_amount) instance.currency = validated_data.get('currency', instance.currency) - instance.validity_start_date = validated_data.get('validity_start_date', instance.validity_start_date) - instance.validity_end_date = validated_data.get('validity_end_date', instance.validity_end_date) instance.payment_option = validated_data.get('payment_option', instance.payment_option) instance.is_active = validated_data.get('is_active', instance.is_active) + instance.updated_at = validated_data.get('updated_at', instance.updated_at) instance.save() # Update discounts if provided - if discounts_data: - instance.discounts.set(discounts_data) + instance.discounts.set(discounts_data) return instance \ No newline at end of file diff --git a/Front-End/src/app/[locale]/admin/structure/page.js b/Front-End/src/app/[locale]/admin/structure/page.js index 2f111a2..4300560 100644 --- a/Front-End/src/app/[locale]/admin/structure/page.js +++ b/Front-End/src/app/[locale]/admin/structure/page.js @@ -99,7 +99,7 @@ export default function Page() { .catch(error => console.error('Error fetching tuition fees', error)); }; - const handleCreate = (url, newData, setDatas, setErrors) => { + const handleCreate = (url, newData, setDatas) => { return fetch(url, { method: 'POST', headers: { @@ -119,17 +119,15 @@ export default function Page() { }) .then(data => { setDatas(prevState => [...prevState, data]); - setErrors({}); return data; }) .catch(error => { - setErrors(error); console.error('Error creating data:', error); throw error; }); }; - const handleEdit = (url, id, updatedData, setDatas, setErrors) => { + const handleEdit = (url, id, updatedData, setDatas) => { return fetch(`${url}/${id}`, { method: 'PUT', headers: { @@ -149,18 +147,16 @@ export default function Page() { }) .then(data => { setDatas(prevState => prevState.map(item => item.id === id ? data : item)); - setErrors({}); return data; }) .catch(error => { - setErrors(error); console.error('Error editing data:', error); throw error; }); }; const handleDelete = (url, id, setDatas) => { - fetch(`${url}/${id}`, { + return fetch(`${url}/${id}`, { method: 'DELETE', headers: { 'Content-Type': 'application/json', @@ -168,12 +164,24 @@ export default function Page() { }, credentials: 'include' }) - .then(response => response.json()) + .then(response => { + if (!response.ok) { + return response.json().then(errorData => { + throw errorData; + }); + } + return response.json(); + }) .then(data => { setDatas(prevState => prevState.filter(item => item.id !== id)); + return data; }) - .catch(error => console.error('Error deleting data:', error)); + .catch(error => { + console.error('Error deleting data:', error); + throw error; + }); }; + const handleUpdatePlanning = (url, planningId, updatedData) => { fetch(`${url}/${planningId}`, { method: 'PUT', diff --git a/Front-End/src/components/InputTextIcon.js b/Front-End/src/components/InputTextIcon.js index 8b60ba2..25aeb94 100644 --- a/Front-End/src/components/InputTextIcon.js +++ b/Front-End/src/components/InputTextIcon.js @@ -1,7 +1,7 @@ export default function InputTextIcon({name, type, IconItem, label, value, onChange, errorMsg, placeholder, className}) { return ( <> -
+
diff --git a/Front-End/src/components/Structure/Configuration/DiscountsSection.js b/Front-End/src/components/Structure/Configuration/DiscountsSection.js index 57cbcdc..36d2271 100644 --- a/Front-End/src/components/Structure/Configuration/DiscountsSection.js +++ b/Front-End/src/components/Structure/Configuration/DiscountsSection.js @@ -4,7 +4,7 @@ import Table from '@/components/Table'; import InputTextIcon from '@/components/InputTextIcon'; import Popup from '@/components/Popup'; -const DiscountsSection = ({ discounts, handleCreate, handleEdit, handleDelete, errors }) => { +const DiscountsSection = ({ discounts, handleCreate, handleEdit, handleDelete }) => { const [editingDiscount, setEditingDiscount] = useState(null); const [newDiscount, setNewDiscount] = useState(null); const [formData, setFormData] = useState({}); @@ -17,7 +17,7 @@ const DiscountsSection = ({ discounts, handleCreate, handleEdit, handleDelete, e }; const handleRemoveDiscount = (id) => { - handleDelete(id); + handleDelete(id) }; const handleSaveNewDiscount = () => { diff --git a/Front-End/src/components/Structure/Configuration/FeesManagement.js b/Front-End/src/components/Structure/Configuration/FeesManagement.js index ef4ef98..7c733bc 100644 --- a/Front-End/src/components/Structure/Configuration/FeesManagement.js +++ b/Front-End/src/components/Structure/Configuration/FeesManagement.js @@ -2,41 +2,42 @@ import React, { useState } from 'react'; import FeesSection from './FeesSection'; import DiscountsSection from './DiscountsSection'; import TuitionFeesSection from './TuitionFeesSection'; -import { TuitionFeesProvider } from '@/context/TuitionFeesContext'; import { BE_SCHOOL_FEE_URL, BE_SCHOOL_DISCOUNT_URL, BE_SCHOOL_TUITION_FEE_URL } from '@/utils/Url'; -const FeesManagement = ({ fees, setFees, discounts, setDiscounts, setTuitionFees, handleCreate, handleEdit, handleDelete }) => { - const [errors, setErrors] = useState({}); +const FeesManagement = ({ fees, setFees, discounts, setDiscounts, tuitionFees, setTuitionFees, handleCreate, handleEdit, handleDelete }) => { return ( - -
-
- handleCreate(`${BE_SCHOOL_FEE_URL}`, newData, setFees, setErrors)} - handleEdit={(id, updatedData) => handleEdit(`${BE_SCHOOL_FEE_URL}`, id, updatedData, setFees, setErrors)} - handleDelete={(id) => handleDelete(`${BE_SCHOOL_FEE_URL}`, id, setFees)} - errors - /> -
-
- handleCreate(`${BE_SCHOOL_DISCOUNT_URL}`, newData, setDiscounts, setErrors)} - handleEdit={(id, updatedData) => handleEdit(`${BE_SCHOOL_DISCOUNT_URL}`, id, updatedData, setDiscounts, setErrors)} - handleDelete={(id) => handleDelete(`${BE_SCHOOL_DISCOUNT_URL}`, id, setDiscounts)} - /> -
-
- handleCreate(`${BE_SCHOOL_TUITION_FEE_URL}`, newData, setTuitionFees, setErrors)} - handleEdit={(id, updatedData) => handleEdit(`${BE_SCHOOL_TUITION_FEE_URL}`, id, updatedData, setTuitionFees, setErrors)} - handleDelete={(id) => handleDelete(`${BE_SCHOOL_TUITION_FEE_URL}`, id, setTuitionFees)} - /> -
+
+
+ handleCreate(`${BE_SCHOOL_DISCOUNT_URL}`, newData, setDiscounts)} + handleEdit={(id, updatedData) => handleEdit(`${BE_SCHOOL_DISCOUNT_URL}`, id, updatedData, setDiscounts)} + handleDelete={(id) => handleDelete(`${BE_SCHOOL_DISCOUNT_URL}`, id, setDiscounts)} + />
- +
+ handleCreate(`${BE_SCHOOL_FEE_URL}`, newData, setFees)} + handleEdit={(id, updatedData) => handleEdit(`${BE_SCHOOL_FEE_URL}`, id, updatedData, setFees)} + handleDelete={(id) => handleDelete(`${BE_SCHOOL_FEE_URL}`, id, setFees)} + /> +
+
+ handleCreate(`${BE_SCHOOL_TUITION_FEE_URL}`, newData, setTuitionFees)} + handleEdit={(id, updatedData) => handleEdit(`${BE_SCHOOL_TUITION_FEE_URL}`, id, updatedData, setTuitionFees)} + handleDelete={(id) => handleDelete(`${BE_SCHOOL_TUITION_FEE_URL}`, id, setTuitionFees)} + /> +
+
); }; diff --git a/Front-End/src/components/Structure/Configuration/FeesSection.js b/Front-End/src/components/Structure/Configuration/FeesSection.js index 60f494c..518c48e 100644 --- a/Front-End/src/components/Structure/Configuration/FeesSection.js +++ b/Front-End/src/components/Structure/Configuration/FeesSection.js @@ -3,8 +3,9 @@ import { Plus, Trash, Edit3, Check, X } from 'lucide-react'; import Table from '@/components/Table'; import InputTextIcon from '@/components/InputTextIcon'; import Popup from '@/components/Popup'; +import SelectChoice from '@/components/SelectChoice'; -const FeesSection = ({ fees, handleCreate, handleEdit, handleDelete, errors }) => { +const FeesSection = ({ fees, setFees, discounts, handleCreate, handleEdit, handleDelete }) => { const [editingFee, setEditingFee] = useState(null); const [newFee, setNewFee] = useState(null); const [formData, setFormData] = useState({}); @@ -12,8 +13,14 @@ const FeesSection = ({ fees, handleCreate, handleEdit, handleDelete, errors }) = const [popupVisible, setPopupVisible] = useState(false); const [popupMessage, setPopupMessage] = useState(""); + const paymentOptions = [ + { value: 0, label: '1 fois' }, + { value: 1, label: '4 fois' }, + { value: 2, label: '10 fois' } + ]; + const handleAddFee = () => { - setNewFee({ id: Date.now(), name: '', amount: '', description: '' }); + setNewFee({ id: Date.now(), name: '', base_amount: '', description: '' }); }; const handleRemoveFee = (id) => { @@ -21,7 +28,7 @@ const FeesSection = ({ fees, handleCreate, handleEdit, handleDelete, errors }) = }; const handleSaveNewFee = () => { - if (newFee.name && newFee.amount) { + if (newFee.name && newFee.base_amount) { handleCreate(newFee) .then(() => { setNewFee(null); @@ -41,7 +48,7 @@ const FeesSection = ({ fees, handleCreate, handleEdit, handleDelete, errors }) = }; const handleUpdateFee = (id, updatedFee) => { - if (updatedFee.name && updatedFee.amount) { + if (updatedFee.name && updatedFee.base_amount) { handleEdit(id, updatedFee) .then(() => { setEditingFee(null); @@ -60,26 +67,59 @@ const FeesSection = ({ fees, handleCreate, handleEdit, handleDelete, errors }) = } }; + const handleToggleActive = (id, isActive) => { + const fee = fees.find(fee => fee.id === id); + if (!fee) return; + + const updatedData = { + is_active: !isActive, + discounts: fee.discounts + }; + + handleEdit(id, updatedData) + .then(() => { + setFees(prevFees => prevFees.map(fee => fee.id === id ? { ...fee, is_active: !isActive } : fee)); + }) + .catch(error => { + console.error(error); + }); + }; + const handleChange = (e) => { const { name, value } = e.target; + let parsedValue = value; + if (name === 'discounts') { + parsedValue = value.split(',').map(v => parseInt(v, 10)); + } if (editingFee) { setFormData((prevData) => ({ ...prevData, - [name]: value, + [name]: parsedValue, })); } else if (newFee) { setNewFee((prevData) => ({ ...prevData, - [name]: value, + [name]: parsedValue, })); } }; + const calculateFinalAmount = (baseAmount, discountIds) => { + const totalDiscounts = discountIds.reduce((sum, discountId) => { + const discount = discounts.find(d => d.id === discountId); + return discount ? sum + parseFloat(discount.amount) : sum; + }, 0); + + const finalAmount = parseFloat(baseAmount) - totalDiscounts; + + return finalAmount.toFixed(2); + }; + const renderInputField = (field, value, onChange, placeholder) => (
); + const renderSelectField = (field, value, options, callback, label) => ( +
+ +
+ ); + const renderFeeCell = (fee, column) => { const isEditing = editingFee === fee.id; const isCreating = newFee && newFee.id === fee.id; @@ -97,10 +150,14 @@ const FeesSection = ({ fees, handleCreate, handleEdit, handleDelete, errors }) = switch (column) { case 'LIBELLE': return renderInputField('name', currentData.name, handleChange, 'Libellé du frais'); - case 'MONTANT': - return renderInputField('amount', currentData.amount, handleChange, 'Montant'); + case 'MONTANT DE BASE': + return renderInputField('base_amount', currentData.base_amount, handleChange, 'Montant'); case 'DESCRIPTION': return renderInputField('description', currentData.description, handleChange, 'Description'); + case 'OPTIONS DE PAIEMENT': + return renderSelectField('payment_option', currentData.payment_option, paymentOptions, handleChange, 'Options de paiement'); + case 'REMISES': + return renderSelectField('discounts', currentData.discounts, discounts.map(discount => ({ value: discount.id, label: discount.name })), handleChange, 'Remises'); case 'ACTIONS': return (
@@ -127,10 +184,20 @@ const FeesSection = ({ fees, handleCreate, handleEdit, handleDelete, errors }) = switch (column) { case 'LIBELLE': return fee.name; - case 'MONTANT': - return fee.amount + ' €'; + case 'MONTANT DE BASE': + return fee.base_amount + ' €'; case 'DESCRIPTION': return fee.description; + case 'OPTIONS DE PAIEMENT': + return paymentOptions.find(option => option.value === fee.payment_option)?.label || ''; + case 'REMISES': + const discountNames = fee.discounts + .map(discountId => discounts.find(discount => discount.id === discountId)?.name) + .filter(name => name) + .join(', '); + return discountNames; + case 'MONTANT FINAL': + return calculateFinalAmount(fee.base_amount, fee.discounts) + ' €'; case 'ACTIONS': return (
@@ -148,6 +215,13 @@ const FeesSection = ({ fees, handleCreate, handleEdit, handleDelete, errors }) = > +
); default: @@ -169,8 +243,11 @@ const FeesSection = ({ fees, handleCreate, handleEdit, handleDelete, errors }) = data={newFee ? [newFee, ...fees] : fees} columns={[ { name: 'LIBELLE', label: 'Libellé' }, - { name: 'MONTANT', label: 'Montant' }, + { name: 'MONTANT DE BASE', label: 'Montant' }, { name: 'DESCRIPTION', label: 'Description' }, + { name: 'OPTIONS DE PAIEMENT', label: 'Options de paiement' }, + { name: 'REMISES', label: 'Remises' }, + { name: 'MONTANT FINAL', label: 'Montant final' }, { name: 'ACTIONS', label: 'Actions' } ]} renderCell={renderFeeCell} diff --git a/Front-End/src/components/Structure/Configuration/TuitionFeesSection.js b/Front-End/src/components/Structure/Configuration/TuitionFeesSection.js index 6bdc25a..83b8c2a 100644 --- a/Front-End/src/components/Structure/Configuration/TuitionFeesSection.js +++ b/Front-End/src/components/Structure/Configuration/TuitionFeesSection.js @@ -1,13 +1,11 @@ import React, { useState } from 'react'; -import { Plus, Trash, Edit3, Check, X, Calendar } from 'lucide-react'; +import { Plus, Trash, Edit3, Check, X } from 'lucide-react'; import Table from '@/components/Table'; import InputTextIcon from '@/components/InputTextIcon'; import Popup from '@/components/Popup'; import SelectChoice from '@/components/SelectChoice'; -import { useTuitionFees } from '@/context/TuitionFeesContext'; -const TuitionFeesSection = ({ handleCreate, handleEdit, handleDelete, errors }) => { - const { fees, tuitionFees, setTuitionFees, discounts } = useTuitionFees(); +const TuitionFeesSection = ({ tuitionFees, setTuitionFees, discounts, fees, handleCreate, handleEdit, handleDelete }) => { const [editingTuitionFee, setEditingTuitionFee] = useState(null); const [newTuitionFee, setNewTuitionFee] = useState(null); const [formData, setFormData] = useState({}); @@ -26,18 +24,20 @@ const TuitionFeesSection = ({ handleCreate, handleEdit, handleDelete, errors }) }; const handleRemoveTuitionFee = (id) => { - handleDelete(id); - setTuitionFees(tuitionFees.filter(fee => fee.id !== id)); + handleDelete(id) + .then(() => { + setTuitionFees(prevTuitionFees => prevTuitionFees.filter(fee => fee.id !== id)); + }) + .catch(error => { + console.error(error); + }); }; const handleSaveNewTuitionFee = () => { if ( newTuitionFee.name && newTuitionFee.base_amount && - newTuitionFee.payment_option >= 0 && - newTuitionFee.validity_start_date && - newTuitionFee.validity_end_date && - new Date(newTuitionFee.validity_start_date) <= new Date(newTuitionFee.validity_end_date) + newTuitionFee.payment_option >= 0 ) { handleCreate(newTuitionFee) .then((createdTuitionFee) => { @@ -62,10 +62,7 @@ const TuitionFeesSection = ({ handleCreate, handleEdit, handleDelete, errors }) if ( updatedTuitionFee.name && updatedTuitionFee.base_amount && - updatedTuitionFee.payment_option >= 0 && - updatedTuitionFee.validity_start_date && - updatedTuitionFee.validity_end_date && - new Date(updatedTuitionFee.validity_start_date) <= new Date(updatedTuitionFee.validity_end_date) + updatedTuitionFee.payment_option >= 0 ) { handleEdit(id, updatedTuitionFee) .then((updatedFee) => { @@ -86,6 +83,24 @@ const TuitionFeesSection = ({ handleCreate, handleEdit, handleDelete, errors }) } }; + const handleToggleActive = (id, isActive) => { + const tuitionFee = tuitionFees.find(tuitionFee => tuitionFee.id === id); + if (!tuitionFee) return; + + const updatedData = { + is_active: !isActive, + discounts: tuitionFee.discounts + }; + + handleEdit(id, updatedData) + .then(() => { + setFees(prevTuitionFees => prevTuitionFees.map(tuitionFee => tuitionFee.id === id ? { ...tuitionFee, is_active: !isActive } : tuitionFee)); + }) + .catch(error => { + console.error(error); + }); + }; + const handleChange = (e) => { const { name, value } = e.target; let parsedValue = value; @@ -120,24 +135,11 @@ const TuitionFeesSection = ({ handleCreate, handleEdit, handleDelete, errors })
); - const renderDateField = (field, value, onChange) => ( -
- - -
- ); - const renderSelectField = (field, value, options, callback, label) => (
{ - const totalFees = fees.reduce((sum, fee) => sum + parseFloat(fee.amount), 0); - const totalDiscounts = discountIds.reduce((sum, discountId) => { const discount = discounts.find(d => d.id === discountId); return discount ? sum + parseFloat(discount.amount) : sum; }, 0); - const finalAmount = parseFloat(baseAmount) + totalFees - totalDiscounts; + const finalAmount = parseFloat(baseAmount) - totalDiscounts; return finalAmount.toFixed(2); }; @@ -172,10 +172,6 @@ const TuitionFeesSection = ({ handleCreate, handleEdit, handleDelete, errors }) return renderInputField('base_amount', currentData.base_amount, handleChange, 'Montant de base'); case 'DESCRIPTION': return renderInputField('description', currentData.description, handleChange, 'Description'); - case 'DATE DE DEBUT': - return renderDateField('validity_start_date', currentData.validity_start_date, handleChange); - case 'DATE DE FIN': - return renderDateField('validity_end_date', currentData.validity_end_date, handleChange); case 'OPTIONS DE PAIEMENT': return renderSelectField('payment_option', currentData.payment_option, paymentOptions, handleChange, 'Options de paiement'); case 'REMISES': @@ -210,10 +206,6 @@ const TuitionFeesSection = ({ handleCreate, handleEdit, handleDelete, errors }) return tuitionFee.base_amount + ' €'; case 'DESCRIPTION': return tuitionFee.description; - case 'DATE DE DEBUT': - return tuitionFee.validity_start_date; - case 'DATE DE FIN': - return tuitionFee.validity_end_date; case 'OPTIONS DE PAIEMENT': return paymentOptions.find(option => option.value === tuitionFee.payment_option)?.label || ''; case 'REMISES': @@ -241,6 +233,13 @@ const TuitionFeesSection = ({ handleCreate, handleEdit, handleDelete, errors }) > +
); default: @@ -263,8 +262,6 @@ const TuitionFeesSection = ({ handleCreate, handleEdit, handleDelete, errors }) { name: 'NOM', label: 'Nom' }, { name: 'MONTANT DE BASE', label: 'Montant de base' }, { name: 'DESCRIPTION', label: 'Description' }, - { name: 'DATE DE DEBUT', label: 'Date de début' }, - { name: 'DATE DE FIN', label: 'Date de fin' }, { name: 'OPTIONS DE PAIEMENT', label: 'Options de paiement' }, { name: 'REMISES', label: 'Remises' }, { name: 'MONTANT FINAL', label: 'Montant final' }, diff --git a/Front-End/src/context/TuitionFeesContext.js b/Front-End/src/context/TuitionFeesContext.js deleted file mode 100644 index dd356e3..0000000 --- a/Front-End/src/context/TuitionFeesContext.js +++ /dev/null @@ -1,24 +0,0 @@ -import React, { createContext, useState, useEffect, useContext } from 'react'; -import { fetchTuitionFees, fetchFees, fetchDiscounts } from '@/app/lib/schoolAction'; - -const TuitionFeesContext = createContext(); - -export const useTuitionFees = () => useContext(TuitionFeesContext); - -export const TuitionFeesProvider = ({ children }) => { - const [tuitionFees, setTuitionFees] = useState([]); - const [fees, setFees] = useState([]); - const [discounts, setDiscounts] = useState([]); - - useEffect(() => { - fetchTuitionFees().then(data => setTuitionFees(data)); - fetchFees().then(data => setFees(data)); - fetchDiscounts().then(data => setDiscounts(data)); - }, []); - - return ( - - {children} - - ); -}; \ No newline at end of file