From 68e98e4df38a3f27c636426a711e4f678ea7a4df Mon Sep 17 00:00:00 2001 From: Tristan Barlet Date: Sat, 7 Jan 2023 18:04:18 -0500 Subject: [PATCH] =?UTF-8?q?reparation=20merge=20pr=C3=A9c=C3=A9dent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Repertoire.js | 92 +++++++++++++++++++++++++---------------- 1 file changed, 56 insertions(+), 36 deletions(-) diff --git a/src/pages/Repertoire.js b/src/pages/Repertoire.js index 41fd4b2..fe06f47 100644 --- a/src/pages/Repertoire.js +++ b/src/pages/Repertoire.js @@ -21,7 +21,6 @@ function Repertoire() { const [contactSelectionne, setContactSelectionne] = useState(""); const [modifContact, setModifContact] = useState(false); const [showConfirmation, setShowConfirmation] = useState(false); - console.log("showConfirmation", showConfirmation); const [contacts, setContacts] = useState([]); const [SearchTerm, setSearchTerm] = useState(""); const [SearchResults, setSearchResults] = useState([]); @@ -43,14 +42,6 @@ function Repertoire() { }); }, []); - - - function onClickDetail() { - return - - - } - function handleDeleteClick(contact) { api.delete('/Contact/Delete/' + contact.idcontact).then((response) => { const newContacts = contacts.filter((c) => c.idcontact !== contact.idcontact); @@ -169,36 +160,65 @@ function Repertoire() { Nom Prénom Entreprise - - - - - Photo - Nom - Prénom - Entreprise - Supprimer - - - - - {contacts.map((contact) => ( - - - - {contact.lastname} - {contact.firstname} - {contact.name} - - - + + + {contacts.map((contact) => ( + setContactSelectionne(contact)}> + + {contact.lastname} + {contact.firstname} + {contact.name} + ))} - - -
-
+ + + + : !modifContact ? + +
+

{contactSelectionne.lastname} {contactSelectionne.firstname}

+

Mail: {contactSelectionne.mail}

+

Numéro de téléphone: {contactSelectionne.phone}

+

Entreprise: {contactSelectionne.name}

+ {!showConfirmation ? +
+ + +
+ : +
+

Êtes-vous sûr de vouloir supprimer ce contact ?

+ +
+ } +
+ : + + } + + + + ); +}; + +function SupprimerContact(props) { + + const navigate = useNavigate(); + const deleteContact = (id) => { + api.delete('/Contact/' + id).then(() => { + props.getContactList(); + }); + }; + + return ( +
+

Supprimer Contact

+ +
+ ); +}