From 3be83fb3a3cde71892be752295ff304db5fa8c18 Mon Sep 17 00:00:00 2001 From: adbusnel Date: Thu, 5 Dec 2024 08:59:13 +0100 Subject: [PATCH 01/15] [MOD] fixed help errors --- .../Popup/helpNumberAndCategoryEditPopupContent.jsx | 2 +- src/Components/Popup/helpNumberCreation.jsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Components/Popup/helpNumberAndCategoryEditPopupContent.jsx b/src/Components/Popup/helpNumberAndCategoryEditPopupContent.jsx index 3d77aceb..4d94682a 100644 --- a/src/Components/Popup/helpNumberAndCategoryEditPopupContent.jsx +++ b/src/Components/Popup/helpNumberAndCategoryEditPopupContent.jsx @@ -109,7 +109,7 @@ const HelpNumberAndCategoryEditPopupContent = ({ type, onClose }) => { const item = items.find((item) => item._id === selectedId) setSelectedItem(item) if (item && type === 'number') { - setFormData({ name: item.name, telephone: item.telephone || '', helpNumbersCategory: item.helpNumbersCategory }) + setFormData({ name: item.name, telephone: item.telephone, email: item.email, description: item.description || '', helpNumbersCategory: item.helpNumbersCategory }) } else { setFormData({ name: item.name }) } diff --git a/src/Components/Popup/helpNumberCreation.jsx b/src/Components/Popup/helpNumberCreation.jsx index 43a211db..c078411e 100644 --- a/src/Components/Popup/helpNumberCreation.jsx +++ b/src/Components/Popup/helpNumberCreation.jsx @@ -70,8 +70,8 @@ const HelpNumberCreationPopupContent = ({ onClose }) => { if (name === '') { toast.error('Le nom est vide.') sendPost = false - } else if (!/^\d{10}$/.test(telephone) || telephone === '') { - toast.error('Veuillez fournir un numéro de téléphone valide (10 chiffres).') + } else if (!/^[0-9]+$/.test(telephone) || telephone === '') { + toast.error('Veuillez fournir un numéro de téléphone valide.') sendPost = false } else if (email === '' || !validateEmail(email)) { toast.error('Veuillez fournir une adresse email valide.') From 45abc460b5a84d599a2d73a56b1862712371c694 Mon Sep 17 00:00:00 2001 From: adbusnel Date: Thu, 5 Dec 2024 09:31:08 +0100 Subject: [PATCH 02/15] [MOD] fixed update content when creating, deleting and modifying help page --- src/Components/Aides/aides.jsx | 82 ++++++++++--------- src/Components/Popup/categoryCreation.jsx | 3 +- .../helpNumberAndCategoryEditPopupContent.jsx | 10 +-- src/Components/Popup/helpNumberCreation.jsx | 4 +- src/Users/Shared/helpPage.jsx | 16 +++- src/css/Components/Aides/aides.scss | 4 + 6 files changed, 67 insertions(+), 52 deletions(-) diff --git a/src/Components/Aides/aides.jsx b/src/Components/Aides/aides.jsx index 46f9b6e6..75be1c49 100644 --- a/src/Components/Aides/aides.jsx +++ b/src/Components/Aides/aides.jsx @@ -5,7 +5,7 @@ import phoneIcon from '../../assets/phoneIcon.png' import mailIcon from '../../assets/mailIcon.png' import { toast } from 'react-toastify' -export default function AidePage () { +export default function AidePage ({ updateContent, handleUpdateContent }) { const [categories, setCategories] = useState([]) const [contacts, setContacts] = useState([]) const [chosenContact, setChosenContact] = useState([]) @@ -18,49 +18,51 @@ export default function AidePage () { useEffect(() => { const categoryUrl = process.env.REACT_APP_BACKEND_URL + '/user/helpNumbersCategories' const helpNumbersUrl = process.env.REACT_APP_BACKEND_URL + '/user/helpNumbers' - - fetch(categoryUrl, { - method: 'GET', - headers: { - 'x-auth-token': sessionStorage.getItem('token'), - 'Content-Type': 'application/json' - } - }).then(response => { - if (response.status === 401) { - disconnect() - } - return response.json() - }) - .then(data => { - setCategories(data) - const filterID = data.filter((category) => category.name === 'Autres') - if (filterID.length !== 0) { - setDefaultID(filterID[0]._id) - setSelectedCat(filterID[0]._id) + if (updateContent) { + fetch(categoryUrl, { + method: 'GET', + headers: { + 'x-auth-token': sessionStorage.getItem('token'), + 'Content-Type': 'application/json' + } + }).then(response => { + if (response.status === 401) { + disconnect() } + return response.json() }) - .catch(error => toast.error(error.message)) + .then(data => { + setCategories(data) + const filterID = data.filter((category) => category.name === 'Autres') + if (filterID.length !== 0) { + setDefaultID(filterID[0]._id) + setSelectedCat(filterID[0]._id) + } + }) + .catch(error => toast.error(error.message)) - fetch(helpNumbersUrl, { - method: 'GET', - headers: { - 'x-auth-token': sessionStorage.getItem('token'), - 'Content-Type': 'application/json' - } - }).then(response => { - if (response.status === 401) { - disconnect() - } - return response.json() - }) - .then(data => { - setContacts(data) - setFilteredContacts(data) - setChosenContact(data[0]) - setSelectedContact(data[0]._id) + fetch(helpNumbersUrl, { + method: 'GET', + headers: { + 'x-auth-token': sessionStorage.getItem('token'), + 'Content-Type': 'application/json' + } + }).then(response => { + if (response.status === 401) { + disconnect() + } + return response.json() }) - .catch(error => toast.error('Erreur ' + error.status + ': ' + error.message)) - }, []) + .then(data => { + setContacts(data) + setFilteredContacts(data) + setChosenContact(data[0]) + setSelectedContact(data[0]._id) + }) + .catch(error => toast.error('Erreur ' + error.status + ': ' + error.message)) + handleUpdateContent() + } + }, [updateContent]) const filterContactsByCategory = (category) => { const filtered = contacts.filter((contact) => category !== defaultID ? contact.helpNumbersCategory === category : contact) diff --git a/src/Components/Popup/categoryCreation.jsx b/src/Components/Popup/categoryCreation.jsx index c0f21a04..59ea1f01 100644 --- a/src/Components/Popup/categoryCreation.jsx +++ b/src/Components/Popup/categoryCreation.jsx @@ -3,7 +3,7 @@ import '../../css/Components/Popup/popup.scss' import { disconnect } from '../../functions/disconnect' import { toast } from 'react-toastify' -const CategoryCreationPopupContent = ({ onClose }) => { +const CategoryCreationPopupContent = ({ handleUpdateContent, onClose }) => { const [name, setName] = useState('') const handleNameChange = (event) => { @@ -29,6 +29,7 @@ const CategoryCreationPopupContent = ({ onClose }) => { } if (response.ok) { toast.success('Catégorie créée avec succès.') + handleUpdateContent() } else { const data = await response.json() toast.error(data.message) diff --git a/src/Components/Popup/helpNumberAndCategoryEditPopupContent.jsx b/src/Components/Popup/helpNumberAndCategoryEditPopupContent.jsx index 4d94682a..1c9473d6 100644 --- a/src/Components/Popup/helpNumberAndCategoryEditPopupContent.jsx +++ b/src/Components/Popup/helpNumberAndCategoryEditPopupContent.jsx @@ -3,8 +3,8 @@ import { disconnect } from '../../functions/disconnect' import { toast } from 'react-toastify' import '../../css/pages/homePage.scss' -const HelpNumberAndCategoryEditPopupContent = ({ type, onClose }) => { - const [formData, setFormData] = useState({ name: '', phone: '' }) +const HelpNumberAndCategoryEditPopupContent = ({ handleUpdateContent, type, onClose }) => { + const [formData, setFormData] = useState({ name: '', phone: '', email: '', description: '' }) const [items, setItems] = useState([]) const [selectedItem, setSelectedItem] = useState(null) const [loading, setLoading] = useState(true) @@ -97,7 +97,7 @@ const HelpNumberAndCategoryEditPopupContent = ({ type, onClose }) => { } toast.success(`${type === 'number' ? 'Numéro' : 'Catégorie'} supprimé avec succès !`) onClose() - window.location.reload() // Rafraîchir la page après suppression + handleUpdateContent() } catch (error) { console.error('Erreur lors de la requête:', error) toast.error(`Erreur lors de la suppression: ${error.message}`) @@ -150,9 +150,9 @@ const HelpNumberAndCategoryEditPopupContent = ({ type, onClose }) => { throw new Error(`Error ${response.status}: ${errorData.message || 'Unknown error'}`) } - toast.error('Modification réussie !') + toast.success('Modification réussie !') onClose() - window.location.reload() + handleUpdateContent() } catch (error) { console.error('Erreur lors de la requête:', error) toast.error(`Erreur lors de la requête: ${error.message}`) diff --git a/src/Components/Popup/helpNumberCreation.jsx b/src/Components/Popup/helpNumberCreation.jsx index c078411e..2430435d 100644 --- a/src/Components/Popup/helpNumberCreation.jsx +++ b/src/Components/Popup/helpNumberCreation.jsx @@ -3,7 +3,7 @@ import '../../css/Components/Popup/popup.scss' import { disconnect } from '../../functions/disconnect' import { toast } from 'react-toastify' -const HelpNumberCreationPopupContent = ({ onClose }) => { +const HelpNumberCreationPopupContent = ({ handleUpdateContent, onClose }) => { const [name, setName] = useState('') const [email, setEmail] = useState('') const [categoryID, setCategoryID] = useState('') @@ -101,7 +101,7 @@ const HelpNumberCreationPopupContent = ({ onClose }) => { } if (response.ok) { toast.success("Numéro d'aide ajouté avec succès.") - onClose() + handleUpdateContent() } else /* istanbul ignore next */ { const data = response.json() toast.error(data.message) diff --git a/src/Users/Shared/helpPage.jsx b/src/Users/Shared/helpPage.jsx index e942ebe7..4514fb35 100644 --- a/src/Users/Shared/helpPage.jsx +++ b/src/Users/Shared/helpPage.jsx @@ -14,6 +14,7 @@ const HelpPage = () => { const [isOpenNumber, setIsOpenNumber] = useState(false) const [isOpenEdit, setIsOpenEdit] = useState(false) const [editType, setEditType] = useState('') // Pour stocker le type d'élément à modifier + const [updateContent, setUpdateContent] = useState(true) const handleCategoryCustomPopup = async () => { setIsOpenCategory(!isOpenCategory) @@ -35,6 +36,13 @@ const HelpPage = () => { setIsOpenEdit(true) } + const handleUpdateContent = () => { + setUpdateContent(!updateContent) + setIsOpenCategory(false) + setIsOpenNumber(false) + setIsOpenEdit(false) + } + const buttonComponent = [ { name: 'Ajouter une Catégorie', @@ -69,7 +77,7 @@ const HelpPage = () => { {(close) => (
- +
)} @@ -77,7 +85,7 @@ const HelpPage = () => { {(close) => (
- +
)} @@ -85,11 +93,11 @@ const HelpPage = () => { {(close) => (
- +
)} - + ) diff --git a/src/css/Components/Aides/aides.scss b/src/css/Components/Aides/aides.scss index 50762b51..51a61cd9 100644 --- a/src/css/Components/Aides/aides.scss +++ b/src/css/Components/Aides/aides.scss @@ -2,6 +2,10 @@ display: flex; flex-direction: row; gap: 25px; + overflow: auto; + white-space: nowrap; + height: 10vh; + align-items: center; } .category-btn { From 1f190f77b8473ccb0786425356579d4fc58e32fc Mon Sep 17 00:00:00 2001 From: adbusnel Date: Thu, 5 Dec 2024 09:37:07 +0100 Subject: [PATCH 03/15] [MOD] removed deconnection button from profile page --- src/Components/Profil/profilPage.jsx | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/src/Components/Profil/profilPage.jsx b/src/Components/Profil/profilPage.jsx index cf53f687..fa432b2a 100644 --- a/src/Components/Profil/profilPage.jsx +++ b/src/Components/Profil/profilPage.jsx @@ -5,8 +5,6 @@ import userIcon from '../../assets/userIcon.png' import Popup from 'reactjs-popup' import cross from '../../assets/Cross.png' import { toast } from 'react-toastify' -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' -import { faRightFromBracket } from '@fortawesome/free-solid-svg-icons' const ProfilPage = ({ isModif, handleProfileModification }) => { const [userProfile, setUserProfile] = useState({}) @@ -49,18 +47,6 @@ const ProfilPage = ({ isModif, handleProfileModification }) => { const handlePictureChange = (event) => { setNewPicture(event.target.files[0]) - // const selectedFile = event.target.files[0] - // if (selectedFile) { - // const reader = new FileReader() - // reader.readAsDataURL(selectedFile) - // reader.onload = () => { - // const base64Image = reader.result - // setNewPicture(base64Image) - // } - // reader.onerror = (error) => { - // console.error('Error occurred while reading the file:', error) - // } - // } } const handleSubmit = async (e) => { @@ -107,10 +93,10 @@ const ProfilPage = ({ isModif, handleProfileModification }) => { sessionStorage.setItem('profile', JSON.stringify(data)) window.location.reload() } else { - console.error(`Error: ${data.message}`) + toast.eror(`Error: ${data.message}`) } } catch (error) { - console.error(`Error: ${error}`) + toast.eror(`Error: ${error}`) } } @@ -137,7 +123,7 @@ const ProfilPage = ({ isModif, handleProfileModification }) => { } catch (error) { navigate('/profile') setNegativeResponse('') - console.log('Erreur lors de la mise à jour du profil: ' + error.message) + toast.error('Erreur lors de la mise à jour du profil: ' + error.message) } } @@ -214,9 +200,6 @@ const ProfilPage = ({ isModif, handleProfileModification }) => {

{userProfile.email}

-
disconnect()} className='item'> - Déconnexion -
) From a051df5e01df9ca6e5b016fea802feae75571878 Mon Sep 17 00:00:00 2001 From: adbusnel Date: Thu, 5 Dec 2024 09:54:10 +0100 Subject: [PATCH 04/15] [MOD] hide button to modify user profile if user is suspended, removed profile from sidebar --- .../Accounts/SchoolAdm/schoolAccountsTable.js | 17 ++++++++++------- src/Components/Sidebar/sidebar.jsx | 1 - 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Components/Accounts/SchoolAdm/schoolAccountsTable.js b/src/Components/Accounts/SchoolAdm/schoolAccountsTable.js index e6f33fe6..3e8428ad 100644 --- a/src/Components/Accounts/SchoolAdm/schoolAccountsTable.js +++ b/src/Components/Accounts/SchoolAdm/schoolAccountsTable.js @@ -47,12 +47,15 @@ export default function SchoolAccountsTable ({ status }) { disconnect() } else { const data = await resp.json() - const array = [...accounts, ...data] - const teacherAccounts = array.filter(account => account.role.name === 'teacher') - const studentAccounts = array.filter(account => account.role.name === 'student') - setTeacherList(teacherAccounts) - setStudentList(studentAccounts) + if (data.message !== 'Access Forbidden') { + const array = [...accounts, ...data] + + const teacherAccounts = array.filter(account => account.role.name === 'teacher') + const studentAccounts = array.filter(account => account.role.name === 'student') + setTeacherList(teacherAccounts) + setStudentList(studentAccounts) + } } } @@ -407,7 +410,7 @@ export default function SchoolAccountsTable ({ status }) { {data.lastname} {data.email} {showClasses(data.classes)} - {status && } + {status && {data.active && }} {status && { @@ -451,7 +454,7 @@ export default function SchoolAccountsTable ({ status }) { {data.lastname} {data.email} {showClasses(data.classes)} - {status && } + {status && {data.active && }} {status && { diff --git a/src/Components/Sidebar/sidebar.jsx b/src/Components/Sidebar/sidebar.jsx index aaed2327..4c3f3164 100644 --- a/src/Components/Sidebar/sidebar.jsx +++ b/src/Components/Sidebar/sidebar.jsx @@ -156,7 +156,6 @@ export default function Sidebar () { { id: 'statistiques', path: '/statistiques', icon: , iconSelected: , label: 'Mes statistiques', title: 'Mes statistiques', selected: IsCurrentPage('/statistiques', false) }, { id: 'messages', path: '/messages', icon: , iconSelected: , label: 'Mes messages', title: 'Mes messages', selected: IsCurrentPage('/messages', false) }, { id: 'aides', path: '/aides', icon: , iconSelected: , label: 'Mes aides', title: 'Mes aides', selected: IsCurrentPage('/aides', false) }, - { id: 'profile', path: '/profile', icon: , iconSelected: , label: 'Mon profil', title: 'Mon profil', selected: IsCurrentPage('/profile', false) }, { id: 'alerts', path: '/alerts', icon: , iconSelected: , label: 'Mes alertes', title: 'Mes alertes', selected: IsCurrentPage('/alerts', false) } ] if (sessionStorage.getItem('role') === 'student') { From a90d67ebcd3f5f935f8cc1a6ce1c506dad896d94 Mon Sep 17 00:00:00 2001 From: adbusnel Date: Thu, 5 Dec 2024 13:39:53 +0100 Subject: [PATCH 05/15] [MOD] fixed creation of account with a profile photo, when accoutn created account list is updated and popup closes --- .../Accounts/Adm/admAccountsTable.js | 9 +- .../Accounts/SchoolAdm/schoolAccountsTable.js | 9 +- .../Popup/singleAccountCreation.jsx | 90 ++++++++++++------- src/Users/Admin/admAccountsPage.js | 11 ++- .../SchoolAdmin/schoolAdmAccountsPage.js | 12 ++- 5 files changed, 94 insertions(+), 37 deletions(-) diff --git a/src/Components/Accounts/Adm/admAccountsTable.js b/src/Components/Accounts/Adm/admAccountsTable.js index 3bc62f9e..336a94f2 100644 --- a/src/Components/Accounts/Adm/admAccountsTable.js +++ b/src/Components/Accounts/Adm/admAccountsTable.js @@ -9,7 +9,7 @@ import deleteButton from '../../../assets/deleteIcon.png' import suspendButton from '../../../assets/suspendIcon.png' import restoreButton from '../../../assets/restoreIcon.png' -export default function AdmAccountsTable () { +export default function AdmAccountsTable ({handleUpdateContent, isUpdated}) { const [accountList, setAccountList] = useState([]) // list of accounts const [isPopupOpen, setIsPopupOpen] = useState(false) const [userId, setUserId] = useState('') @@ -35,6 +35,13 @@ export default function AdmAccountsTable () { } } + useEffect(() => { + if (isUpdated) { + getAccountList() + handleUpdateContent() + } + }, [isUpdated]) + async function getSuspendedAccountList (list) { const baseUrl = process.env.REACT_APP_BACKEND_URL + '/user/getDisabled' const token = sessionStorage.getItem('token') diff --git a/src/Components/Accounts/SchoolAdm/schoolAccountsTable.js b/src/Components/Accounts/SchoolAdm/schoolAccountsTable.js index 3e8428ad..28cd0356 100644 --- a/src/Components/Accounts/SchoolAdm/schoolAccountsTable.js +++ b/src/Components/Accounts/SchoolAdm/schoolAccountsTable.js @@ -11,7 +11,7 @@ import suspendButton from '../../../assets/suspendIcon.png' import restoreButton from '../../../assets/restoreIcon.png' import Select from 'react-select' -export default function SchoolAccountsTable ({ status }) { +export default function SchoolAccountsTable ({ isUpdated, handleUpdateContent, status }) { const [teacherList, setTeacherList] = useState([]) const [studentList, setStudentList] = useState([]) const [selectedUser, setSelectedUser] = useState(null) @@ -103,6 +103,13 @@ export default function SchoolAccountsTable ({ status }) { }) } + useEffect(() => { + if (isUpdated) { + getAccountList() + handleUpdateContent() + } + }, [isUpdated]) + const showClasses = (classes) => { if (!Array.isArray(classes)) { return '' diff --git a/src/Components/Popup/singleAccountCreation.jsx b/src/Components/Popup/singleAccountCreation.jsx index d4342221..64a0ad88 100644 --- a/src/Components/Popup/singleAccountCreation.jsx +++ b/src/Components/Popup/singleAccountCreation.jsx @@ -5,7 +5,7 @@ import userIcon from '../../assets/userIcon.png' import { disconnect } from '../../functions/disconnect' import { toast } from 'react-toastify' -const SingleAccountCreationPopupContent = ({ close }) => { +const SingleAccountCreationPopupContent = ({ handleUpdateContent }) => { const roleProfile = sessionStorage.getItem('role') const singleCreationUrl = process.env.REACT_APP_BACKEND_URL + '/adm/register' const [firstname, setFirstName] = useState('') @@ -54,19 +54,7 @@ const SingleAccountCreationPopupContent = ({ close }) => { } const handlePictureChange = (event) => { - const selectedFile = event.target.files[0] setPicture(event.target.files[0]) - if (selectedFile) { - const reader = new FileReader() - reader.readAsDataURL(selectedFile) - reader.onload = () => { - const base64Image = reader.result - setPicture(base64Image) - } - reader.onerror = (error) => { - console.error('Error occurred while reading the file:', error) - } - } } const validateEmail = (email) => { @@ -74,6 +62,35 @@ const SingleAccountCreationPopupContent = ({ close }) => { return regEx.test(email) } + async function modifyAccount(updatedUser, userId) { + const formData = new FormData() + formData.append('firstname', updatedUser.firstname) + formData.append('lastname', updatedUser.lastname) + formData.append('role', updatedUser.role) + formData.append('email', updatedUser.email) + + if (picture) { + formData.append('file', picture) + } + + const response = await fetch(`${process.env.REACT_APP_BACKEND_URL}/user/modifyProfile/${userId}`, { + method: 'PATCH', + headers: { + 'x-auth-token': sessionStorage.getItem('token') + }, + body: formData + }) + + if (response.status === 401) { + disconnect() + } else if (response.ok) { + toast.success('Compte créé avec succès') + handleUpdateContent() + } else { + toast.error('Erreur lors de la mise à jour du profil: ' + response.statusText) + } + } + const singleAccountCreation = async (event) => { event.preventDefault() @@ -125,7 +142,7 @@ const SingleAccountCreationPopupContent = ({ close }) => { email, role, classes: classesArray, - picture: picture || userIcon + picture: userIcon } await fetch(singleCreationUrl, { @@ -140,15 +157,24 @@ const SingleAccountCreationPopupContent = ({ close }) => { if (response.status === 401) { disconnect() } else if (response.ok) { - toast.success('Compte créé avec succès') - window.location.reload() + if (!picture) { + toast.success('Compte créé avec succès') + handleUpdateContent() + } else { + return response.json() + } + // window.location.reload() } else { return response.json() } }) .then((data) => { if (data) { - toast.error(data.message) + if (picture) { + modifyAccount(schoolAdminPayload, data.id) + } else { + toast.error(data.message) + } } }) .catch((e) => { @@ -218,7 +244,7 @@ const SingleAccountCreationPopupContent = ({ close }) => { }, []) return ( - <> +
{/* Le reste du contenu du composant */} {roleProfile === 'admin' ? ( @@ -233,18 +259,6 @@ const SingleAccountCreationPopupContent = ({ close }) => {
)} - - - {roleProfile === 'admin' ? ( '' @@ -292,8 +306,22 @@ const SingleAccountCreationPopupContent = ({ close }) => { )} +
+ + + +
- + ) } diff --git a/src/Users/Admin/admAccountsPage.js b/src/Users/Admin/admAccountsPage.js index a61749e6..507ef2a6 100644 --- a/src/Users/Admin/admAccountsPage.js +++ b/src/Users/Admin/admAccountsPage.js @@ -11,6 +11,7 @@ import '../../css/Components/Popup/popup.scss' export default function AdmAccountsPage () { const [isOpenSingle, setIsOpenSingle] = useState(false) const [isOpenMany, setIsOpenMany] = useState(false) + const [isUpdated, setIsUpdated] = useState(false) const handleSingleAccount = () => { setIsOpenSingle(!isOpenSingle) @@ -26,6 +27,12 @@ export default function AdmAccountsPage () { } } + const handleUpdateContent = () => { + setIsOpenMany(false) + setIsOpenSingle(false) + setIsUpdated(!isUpdated) + } + const buttonComponent = [ { name: 'Ajouter un Compte', @@ -48,13 +55,13 @@ export default function AdmAccountsPage () { />
- +
{(close) => (
- +
)}
diff --git a/src/Users/SchoolAdmin/schoolAdmAccountsPage.js b/src/Users/SchoolAdmin/schoolAdmAccountsPage.js index 4b22a6b4..751d45ea 100644 --- a/src/Users/SchoolAdmin/schoolAdmAccountsPage.js +++ b/src/Users/SchoolAdmin/schoolAdmAccountsPage.js @@ -13,6 +13,7 @@ export default function SchoolAdmAccountsPage () { const [isOpenSingle, setIsOpenSingle] = useState(false) const [isOpenMany, setIsOpenMany] = useState(false) const [isOpenClasses, setIsOpenClasses] = useState(false) + const [isUpdated, setIsUpdated] = useState(false) const handleSingleAccount = () => { setIsOpenSingle(!isOpenSingle) @@ -44,6 +45,13 @@ export default function SchoolAdmAccountsPage () { } } + const handleUpdateContent = () => { + setIsOpenMany(false) + setIsOpenSingle(false) + setIsOpenClasses(false) + setIsUpdated(!isUpdated) + } + const buttonComponent = [ { name: 'Ajouter un Compte', @@ -74,7 +82,7 @@ export default function SchoolAdmAccountsPage () { {(close) => (
- +
)} @@ -94,7 +102,7 @@ export default function SchoolAdmAccountsPage () { )} - + ) From 82d2c59f8620e6348efce1fd4e865cfba3d6ff2f Mon Sep 17 00:00:00 2001 From: adbusnel Date: Thu, 5 Dec 2024 13:58:18 +0100 Subject: [PATCH 06/15] [MOD] fix css popups help numbers and categories --- src/Components/Popup/categoryCreation.jsx | 5 +++-- .../Popup/helpNumberAndCategoryEditPopupContent.jsx | 11 ++++++----- src/Components/Popup/helpNumberCreation.jsx | 5 +++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/Components/Popup/categoryCreation.jsx b/src/Components/Popup/categoryCreation.jsx index 59ea1f01..b5a4ba0a 100644 --- a/src/Components/Popup/categoryCreation.jsx +++ b/src/Components/Popup/categoryCreation.jsx @@ -44,13 +44,14 @@ const CategoryCreationPopupContent = ({ handleUpdateContent, onClose }) => { } return ( - <> +
+

Création d'une nouvelle catégorie d'aide

- +
) } diff --git a/src/Components/Popup/helpNumberAndCategoryEditPopupContent.jsx b/src/Components/Popup/helpNumberAndCategoryEditPopupContent.jsx index 1c9473d6..476aa76e 100644 --- a/src/Components/Popup/helpNumberAndCategoryEditPopupContent.jsx +++ b/src/Components/Popup/helpNumberAndCategoryEditPopupContent.jsx @@ -160,7 +160,8 @@ const HelpNumberAndCategoryEditPopupContent = ({ handleUpdateContent, type, onCl } return ( -
+
+

Modifier {type === 'number' ? 'le numéro d’aide' : 'la catégorie d’aide'}

{loading &&

Chargement des données...

} @@ -216,10 +217,10 @@ const HelpNumberAndCategoryEditPopupContent = ({ handleUpdateContent, type, onCl )} - - +
+ + +
)} diff --git a/src/Components/Popup/helpNumberCreation.jsx b/src/Components/Popup/helpNumberCreation.jsx index 2430435d..4bae1101 100644 --- a/src/Components/Popup/helpNumberCreation.jsx +++ b/src/Components/Popup/helpNumberCreation.jsx @@ -112,7 +112,8 @@ const HelpNumberCreationPopupContent = ({ handleUpdateContent, onClose }) => { } return ( - <> +
+

Création d'un nouveau numéro d'aide