ajout liste contact dans page repertoire + ajout images svg light

master
Maxence LANONE 3 years ago
parent 9e9523b549
commit 6f0ed413fe

@ -164,4 +164,15 @@ app.post('/User/Update/:id', (req, res) => {
console.log(result); console.log(result);
res.send('Post added...' + result.insertId); res.send('Post added...' + result.insertId);
}); });
});
//Api pour les contacts de la page repertoire
app.get('/Contact/All', (req, res) => {
let sql = 'SELECT * FROM contacts ORDER BY idcontact';
db.query(sql, (err, result) => {
if (err) throw err;
console.log(result);
res.send(result);
});
}); });

@ -1,6 +0,0 @@
import axios from 'axios';
export default axios.create({
baseURL:"http://localhost:3007/",
});

@ -0,0 +1 @@
<svg fill="#e8eef2ff" xmlns="http://www.w3.org/2000/svg" height="48" width="48"><path d="M24 28.05q-.9 0-1.475-.575Q21.95 26.9 21.95 26q0-.9.575-1.475.575-.575 1.475-.575.9 0 1.475.575.575.575.575 1.475 0 .9-.575 1.475-.575.575-1.475.575Zm-8 0q-.9 0-1.475-.575Q13.95 26.9 13.95 26q0-.9.575-1.475.575-.575 1.475-.575.9 0 1.475.575.575.575.575 1.475 0 .9-.575 1.475-.575.575-1.475.575Zm16 0q-.85 0-1.45-.575T29.95 26q0-.9.6-1.475.6-.575 1.45-.575t1.45.575q.6.575.6 1.475 0 .9-.575 1.475-.575.575-1.475.575Zm-8 8q-.9 0-1.475-.6-.575-.6-.575-1.45t.575-1.45q.575-.6 1.475-.6.9 0 1.475.575.575.575.575 1.475 0 .85-.575 1.45t-1.475.6Zm-8 0q-.9 0-1.475-.6-.575-.6-.575-1.45t.575-1.45q.575-.6 1.475-.6.9 0 1.475.575.575.575.575 1.475 0 .85-.575 1.45t-1.475.6Zm16 0q-.85 0-1.45-.6t-.6-1.45q0-.85.6-1.45t1.45-.6q.85 0 1.45.575t.6 1.475q0 .85-.575 1.45t-1.475.6ZM9.1 44.3q-1.35 0-2.375-1.025T5.7 40.9V10.1q0-1.4 1.025-2.4t2.375-1h3.15V5.4q0-.7.5-1.2t1.2-.5q.75 0 1.25.5t.5 1.2v1.3h16.6V5.4q0-.7.5-1.2t1.2-.5q.75 0 1.25.5t.5 1.2v1.3h3.15q1.4 0 2.4 1t1 2.4v30.8q0 1.35-1 2.375T38.9 44.3Zm0-3.4h29.8V19.5H9.1v21.4Z"/></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -0,0 +1 @@
<svg fill="#e8eef2ff" xmlns="http://www.w3.org/2000/svg" height="48" width="48"><path d="M24 28.05q-.9 0-1.475-.575Q21.95 26.9 21.95 26q0-.9.575-1.475.575-.575 1.475-.575.9 0 1.475.575.575.575.575 1.475 0 .9-.575 1.475-.575.575-1.475.575Zm-8 0q-.9 0-1.475-.575Q13.95 26.9 13.95 26q0-.9.575-1.475.575-.575 1.475-.575.9 0 1.475.575.575.575.575 1.475 0 .9-.575 1.475-.575.575-1.475.575Zm16 0q-.85 0-1.45-.575T29.95 26q0-.9.6-1.475.6-.575 1.45-.575t1.45.575q.6.575.6 1.475 0 .9-.575 1.475-.575.575-1.475.575Zm-8 8q-.9 0-1.475-.6-.575-.6-.575-1.45t.575-1.45q.575-.6 1.475-.6.9 0 1.475.575.575.575.575 1.475 0 .85-.575 1.45t-1.475.6Zm-8 0q-.9 0-1.475-.6-.575-.6-.575-1.45t.575-1.45q.575-.6 1.475-.6.9 0 1.475.575.575.575.575 1.475 0 .85-.575 1.45t-1.475.6Zm16 0q-.85 0-1.45-.6t-.6-1.45q0-.85.6-1.45t1.45-.6q.85 0 1.45.575t.6 1.475q0 .85-.575 1.45t-1.475.6ZM9.1 44.3q-1.35 0-2.375-1.025T5.7 40.9V10.1q0-1.4 1.025-2.4t2.375-1h3.15V5.4q0-.7.5-1.2t1.2-.5q.75 0 1.25.5t.5 1.2v1.3h16.6V5.4q0-.7.5-1.2t1.2-.5q.75 0 1.25.5t.5 1.2v1.3h3.15q1.4 0 2.4 1t1 2.4v30.8q0 1.35-1 2.375T38.9 44.3Zm0-3.4h29.8V19.5H9.1v21.4Zm0-24.4h29.8v-6.4H9.1Zm0 0v-6.4 6.4Z"/></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -0,0 +1 @@
<svg fill="#e8eef2ff" xmlns="http://www.w3.org/2000/svg" height="48" width="48"><path d="M15.75 34.15q.65 0 1.075-.425.425-.425.425-1.075V21.9q0-.65-.425-1.075-.425-.425-1.075-.425-.65 0-1.075.425-.425.425-.425 1.075v10.75q0 .65.45 1.075.45.425 1.05.425Zm8.25 0q.65 0 1.075-.425.425-.425.425-1.075v-17.3q0-.65-.425-1.075-.425-.425-1.075-.425-.65 0-1.075.425-.425.425-.425 1.075v17.3q0 .65.425 1.075.425.425 1.075.425Zm8.25 0q.65 0 1.075-.425.425-.425.425-1.075v-4.4q0-.65-.45-1.075-.45-.425-1.05-.425-.65 0-1.075.425-.425.425-.425 1.075v4.4q0 .65.425 1.075.425.425 1.075.425ZM9.1 42.3q-1.35 0-2.375-1.025T5.7 38.9V9.1q0-1.4 1.025-2.4t2.375-1h29.8q1.4 0 2.4 1t1 2.4v29.8q0 1.35-1 2.375T38.9 42.3Z"/></svg>

After

Width:  |  Height:  |  Size: 704 B

@ -0,0 +1 @@
<svg fill="#e8eef2ff" xmlns="http://www.w3.org/2000/svg" height="48" width="48"><path d="M15.75 34.15q.65 0 1.075-.425.425-.425.425-1.075V21.9q0-.65-.425-1.075-.425-.425-1.075-.425-.65 0-1.075.425-.425.425-.425 1.075v10.75q0 .65.45 1.075.45.425 1.05.425Zm8.25 0q.65 0 1.075-.425.425-.425.425-1.075v-17.3q0-.65-.425-1.075-.425-.425-1.075-.425-.65 0-1.075.425-.425.425-.425 1.075v17.3q0 .65.425 1.075.425.425 1.075.425Zm8.25 0q.65 0 1.075-.425.425-.425.425-1.075v-4.4q0-.65-.45-1.075-.45-.425-1.05-.425-.65 0-1.075.425-.425.425-.425 1.075v4.4q0 .65.425 1.075.425.425 1.075.425ZM9.1 42.3q-1.35 0-2.375-1.025T5.7 38.9V9.1q0-1.4 1.025-2.4t2.375-1h29.8q1.4 0 2.4 1t1 2.4v29.8q0 1.35-1 2.375T38.9 42.3Zm0-3.4h29.8V9.1H9.1v29.8Zm0 0V9.1v29.8Z"/></svg>

After

Width:  |  Height:  |  Size: 743 B

@ -0,0 +1 @@
<svg fill="#e8eef2ff" xmlns="http://www.w3.org/2000/svg" height="48" width="48"><path d="M1.55 36.15q-.7 0-1.2-.5t-.5-1.2v-1.1q0-2.05 2.1-3.275T7.5 28.85q.5 0 1.025.025.525.025.975.075-.4.9-.6 1.85-.2.95-.2 2v3.35Zm12 0q-.7 0-1.2-.5t-.5-1.2V32.8q0-3.3 3.35-5.375T24 25.35q5.45 0 8.8 2.075 3.35 2.075 3.35 5.375v1.65q0 .7-.5 1.2t-1.2.5Zm25.75 0V32.8q0-1.05-.2-2t-.6-1.85q.45-.05.975-.075.525-.025 1.025-.025 3.4 0 5.525 1.225Q48.15 31.3 48.15 33.35v1.1q0 .7-.5 1.2t-1.2.5ZM7.5 27.4q-1.5 0-2.55-1.05Q3.9 25.3 3.9 23.8q0-1.5 1.05-2.55Q6 20.2 7.5 20.2q1.5 0 2.55 1.05 1.05 1.05 1.05 2.55 0 1.5-1.05 2.55Q9 27.4 7.5 27.4Zm33 0q-1.5 0-2.55-1.05-1.05-1.05-1.05-2.55 0-1.5 1.05-2.55Q39 20.2 40.5 20.2q1.5 0 2.55 1.05 1.05 1.05 1.05 2.55 0 1.5-1.05 2.55Q42 27.4 40.5 27.4ZM24 23.85q-2.55 0-4.35-1.775-1.8-1.775-1.8-4.375 0-2.55 1.8-4.325Q21.45 11.6 24 11.6t4.35 1.775q1.8 1.775 1.8 4.325 0 2.6-1.8 4.375T24 23.85Z"/></svg>

After

Width:  |  Height:  |  Size: 913 B

@ -0,0 +1 @@
<svg fill="#e8eef2ff" xmlns="http://www.w3.org/2000/svg" height="48" width="48"><path d="M1.55 36.15q-.7 0-1.2-.5t-.5-1.2v-1.1q0-2.05 2.1-3.275T7.5 28.85q.5 0 1.025.025.525.025.975.075-.4.9-.6 1.85-.2.95-.2 2v3.35Zm12 0q-.7 0-1.2-.5t-.5-1.2V32.8q0-3.3 3.35-5.375T24 25.35q5.45 0 8.8 2.075 3.35 2.075 3.35 5.375v1.65q0 .7-.5 1.2t-1.2.5Zm25.75 0V32.8q0-1.05-.2-2t-.6-1.85q.45-.05.975-.075.525-.025 1.025-.025 3.4 0 5.525 1.225Q48.15 31.3 48.15 33.35v1.1q0 .7-.5 1.2t-1.2.5ZM24 28.6q-3.85 0-6.25 1.15t-2.5 2.95v.2h17.5v-.25q-.1-1.75-2.5-2.9T24 28.6ZM7.5 27.4q-1.5 0-2.55-1.05Q3.9 25.3 3.9 23.8q0-1.5 1.05-2.55Q6 20.2 7.5 20.2q1.5 0 2.55 1.05 1.05 1.05 1.05 2.55 0 1.5-1.05 2.55Q9 27.4 7.5 27.4Zm33 0q-1.5 0-2.55-1.05-1.05-1.05-1.05-2.55 0-1.5 1.05-2.55Q39 20.2 40.5 20.2q1.5 0 2.55 1.05 1.05 1.05 1.05 2.55 0 1.5-1.05 2.55Q42 27.4 40.5 27.4ZM24 23.85q-2.55 0-4.35-1.775-1.8-1.775-1.8-4.375 0-2.55 1.8-4.325Q21.45 11.6 24 11.6t4.35 1.775q1.8 1.775 1.8 4.325 0 2.6-1.8 4.375T24 23.85Zm0-9.05q-1.25 0-2.075.85-.825.85-.825 2.05 0 1.25.825 2.1.825.85 2.075.85 1.25 0 2.075-.85.825-.85.825-2.1 0-1.2-.825-2.05-.825-.85-2.075-.85Zm0 18.1Zm0-15.2Z"/></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -0,0 +1 @@
<svg fill="#e8eef2ff" xmlns="http://www.w3.org/2000/svg" height="48" width="48"><path d="M27.35 44.3h-6.7q-.65 0-1.15-.4-.5-.4-.6-1.05l-.8-4.95q-.85-.3-1.85-.875T14.5 35.85l-4.55 2.1q-.6.3-1.25.1-.65-.2-.95-.8l-3.4-6.05q-.35-.55-.175-1.175T4.85 29l4.25-3.1q-.1-.4-.125-.95-.025-.55-.025-.95 0-.4.025-.95.025-.55.125-.95L4.85 19q-.5-.4-.675-1.025Q4 17.35 4.35 16.8l3.4-6.05q.35-.6.975-.8.625-.2 1.225.1l4.6 2.1q.7-.6 1.7-1.15 1-.55 1.85-.85l.8-5.05q.1-.6.6-1t1.15-.4h6.7q.65 0 1.15.4.5.4.6 1l.8 5q.85.35 1.875.875T33.5 12.15l4.55-2.1q.6-.3 1.25-.1.65.2.95.8l3.4 6q.35.55.2 1.2-.15.65-.7 1.05l-4.25 3q.1.45.125 1 .025.55.025 1 0 .45-.025.975-.025.525-.125.975L43.15 29q.5.4.675 1.025.175.625-.175 1.175l-3.4 6.05q-.35.6-.975.8-.625.2-1.225-.1l-4.6-2.1q-.7.6-1.675 1.2-.975.6-1.875.85l-.8 4.95q-.1.65-.6 1.05t-1.15.4ZM24 30.5q2.7 0 4.6-1.9 1.9-1.9 1.9-4.6 0-2.7-1.9-4.6-1.9-1.9-4.6-1.9-2.7 0-4.6 1.9-1.9 1.9-1.9 4.6 0 2.7 1.9 4.6 1.9 1.9 4.6 1.9Z"/></svg>

After

Width:  |  Height:  |  Size: 952 B

@ -0,0 +1 @@
<svg fill="#e8eef2ff" xmlns="http://www.w3.org/2000/svg" height="48" width="48"><path d="M27.35 44.3h-6.7q-.65 0-1.15-.4-.5-.4-.6-1.05l-.8-4.95q-.85-.3-1.85-.875T14.5 35.85l-4.55 2.1q-.6.3-1.25.1-.65-.2-.95-.8l-3.4-6.05q-.35-.55-.175-1.175T4.85 29l4.25-3.1q-.1-.4-.125-.95-.025-.55-.025-.95 0-.4.025-.95.025-.55.125-.95L4.85 19q-.5-.4-.675-1.025Q4 17.35 4.35 16.8l3.4-6.05q.35-.6.975-.8.625-.2 1.225.1l4.6 2.1q.7-.6 1.7-1.15 1-.55 1.85-.85l.8-5.05q.1-.6.6-1t1.15-.4h6.7q.65 0 1.15.4.5.4.6 1l.8 5q.85.35 1.875.875T33.5 12.15l4.55-2.1q.6-.3 1.25-.1.65.2.95.8l3.4 6q.35.55.2 1.2-.15.65-.7 1.05l-4.25 3q.1.45.125 1 .025.55.025 1 0 .45-.025.975-.025.525-.125.975L43.15 29q.5.4.675 1.025.175.625-.175 1.175l-3.4 6.05q-.35.6-.975.8-.625.2-1.225-.1l-4.6-2.1q-.7.6-1.675 1.2-.975.6-1.875.85l-.8 4.95q-.1.65-.6 1.05t-1.15.4ZM24 30.5q2.7 0 4.6-1.9 1.9-1.9 1.9-4.6 0-2.7-1.9-4.6-1.9-1.9-4.6-1.9-2.7 0-4.6 1.9-1.9 1.9-1.9 4.6 0 2.7 1.9 4.6 1.9 1.9 4.6 1.9Zm0-3q-1.5 0-2.5-1.025T20.5 24q0-1.45 1-2.475 1-1.025 2.5-1.025 1.45 0 2.475 1.025Q27.5 22.55 27.5 24q0 1.45-1.025 2.475Q25.45 27.5 24 27.5Zm0-3.5Zm-2.1 16.9h4.2l.7-5.6q1.65-.4 3.15-1.25t2.7-2.1l5.3 2.3 1.9-3.45-4.7-3.4q.2-.85.35-1.7.15-.85.15-1.7t-.125-1.7q-.125-.85-.375-1.7l4.7-3.4-1.9-3.45-5.3 2.3q-1.15-1.35-2.625-2.25-1.475-.9-3.225-1.1l-.7-5.6h-4.2l-.7 5.6q-1.7.3-3.2 1.175-1.5.875-2.7 2.175l-5.25-2.3-1.9 3.45 4.65 3.4q-.2.85-.325 1.7T12.35 24q0 .85.125 1.7t.325 1.7l-4.65 3.4 1.9 3.45 5.25-2.3q1.25 1.25 2.75 2.1 1.5.85 3.15 1.25Z"/></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

@ -0,0 +1 @@
<svg fill="#e8eef2ff" xmlns="http://www.w3.org/2000/svg" height="48" width="48"><path d="M11.15 35.1q3.15-1.95 6.2-2.975Q20.4 31.1 24 31.1q3.6 0 6.7 1.025t6.2 2.975q2.2-2.7 3.1-5.4.9-2.7.9-5.7 0-7.2-4.85-12.05Q31.2 7.1 24 7.1q-7.2 0-12.05 4.85Q7.1 16.8 7.1 24q0 3 .925 5.7t3.125 5.4ZM24 25.6q-2.95 0-4.925-2-1.975-2-1.975-4.95 0-2.9 2-4.9 2-2 4.9-2 2.95 0 4.925 2 1.975 2 1.975 4.95 0 2.9-2 4.9-2 2-4.9 2Zm0 18.7q-4.25 0-7.95-1.6T9.6 38.325q-2.75-2.775-4.325-6.45Q3.7 28.2 3.7 24q0-4.25 1.6-7.925T9.675 9.65q2.775-2.75 6.45-4.35Q19.8 3.7 24.05 3.7q4.2 0 7.875 1.6t6.425 4.35q2.75 2.75 4.35 6.45 1.6 3.7 1.6 7.9t-1.6 7.875q-1.6 3.675-4.35 6.45Q35.6 41.1 31.9 42.7T24 44.3Z"/></svg>

After

Width:  |  Height:  |  Size: 680 B

@ -0,0 +1 @@
<svg fill="#e8eef2ff" xmlns="http://www.w3.org/2000/svg" height="48" width="48"><path d="M24 23.8q-3.4 0-5.525-2.125-2.125-2.125-2.125-5.525 0-3.4 2.125-5.55T24 8.45q3.4 0 5.55 2.15t2.15 5.55q0 3.4-2.15 5.525Q27.4 23.8 24 23.8ZM11.2 40.15q-1.35 0-2.3-.975-.95-.975-.95-2.325v-1.6q0-1.95.975-3.35.975-1.4 2.525-2.1 3.35-1.5 6.4-2.25 3.05-.75 6.15-.75 3.1 0 6.125.775T36.5 29.8q1.6.7 2.6 2.1 1 1.4 1 3.35v1.6q0 1.35-.95 2.325-.95.975-2.35.975Z"/></svg>

After

Width:  |  Height:  |  Size: 450 B

@ -0,0 +1 @@
<svg fill="#e8eef2ff" xmlns="http://www.w3.org/2000/svg" height="48" width="48"><path d="M24 23.8q-3.45 0-5.625-2.175T16.2 16q0-3.45 2.175-5.625T24 8.2q3.45 0 5.625 2.175T31.8 16q0 3.45-2.175 5.625T24 23.8Zm12.9 16.65H11.1q-1.4 0-2.4-1t-1-2.4v-1.6q0-2 1-3.425 1-1.425 2.55-2.175 3.4-1.5 6.5-2.25t6.25-.75q3.15 0 6.225.775Q33.3 28.4 36.7 29.9q1.6.7 2.6 2.125t1 3.425v1.6q0 1.4-1 2.4t-2.4 1Zm-25.8-3.4h25.8V35.5q0-.8-.475-1.525-.475-.725-1.175-1.075-3.15-1.5-5.775-2.075Q26.85 30.25 24 30.25q-2.85 0-5.525.575Q15.8 31.4 12.7 32.9q-.7.35-1.15 1.075-.45.725-.45 1.525ZM24 20.4q1.9 0 3.15-1.25T28.4 16q0-1.9-1.25-3.15T24 11.6q-1.9 0-3.15 1.25T19.6 16q0 1.9 1.25 3.15T24 20.4Zm0-4.4Zm0 21.05Z"/></svg>

After

Width:  |  Height:  |  Size: 695 B

@ -0,0 +1 @@
<svg fill="#e8eef2ff" xmlns="http://www.w3.org/2000/svg" height="48" width="48"><path d="M21.05 31q1.2 1.2 3.1 1.175 1.9-.025 2.8-1.375L36 17.3q.4-.65-.075-1.1-.475-.45-1.075-.05l-13.5 9.05q-1.35.9-1.425 2.75Q19.85 29.8 21.05 31Zm-11.3 9.3q-.95 0-1.85-.475Q7 39.35 6.6 38.5q-1.35-2.4-2.05-4.925-.7-2.525-.7-5.375 0-4.2 1.6-7.925 1.6-3.725 4.325-6.5t6.425-4.4q3.7-1.625 7.85-1.625 4.15 0 7.825 1.625t6.4 4.4Q41 16.55 42.6 20.275t1.6 7.925q0 2.85-.65 5.425Q42.9 36.2 41.5 38.5q-.65 1.25-1.375 1.525-.725.275-1.825.275Z"/></svg>

After

Width:  |  Height:  |  Size: 525 B

@ -0,0 +1 @@
<svg fill="#e8eef2ff" xmlns="http://www.w3.org/2000/svg" height="48" width="48"><path d="M20.45 31.75q1.15 1.15 3.325 1.075 2.175-.075 3.175-1.625l9-13.95q.4-.65-.075-1.1-.475-.45-1.075-.05L21 25.2q-1.5 1-1.6 3.2-.1 2.2 1.05 3.35ZM9.7 40.3q-.95 0-1.85-.475-.9-.475-1.3-1.325-1.35-2.4-2.05-4.925-.7-2.525-.7-5.375 0-4.2 1.6-7.925 1.6-3.725 4.325-6.5t6.425-4.4Q19.85 7.75 24 7.75q2.25 0 4.7.575t4.85 1.875q1.1.6 1.225 1.475.125.875-.525 1.475-.45.35-1.025.425-.575.075-1.125-.175-2.05-1.15-4.25-1.7T24 11.15q-6.95 0-11.875 4.975T7.2 28.2q0 2.25.625 4.5t1.725 4.2H38.4q1.1-1.8 1.725-4.15.625-2.35.625-4.65 0-1.8-.45-3.85t-1.55-3.95q-.35-.55-.225-1.15.125-.6.575-1 .65-.5 1.4-.35.75.15 1.15.9 1.2 2.3 1.825 4.55t.675 4.55q.05 3-.625 5.7t-2.075 5q-.65 1.25-1.375 1.525-.725.275-1.825.275ZM24 24Z"/></svg>

After

Width:  |  Height:  |  Size: 799 B

@ -9,133 +9,163 @@ import ContactDetail from '../components/Contact/ContactDetail';
import EditContact from '../components/Contact/EditContact'; import EditContact from '../components/Contact/EditContact';
import axios from 'axios'; import axios from 'axios';
import user from '../images/user.jpg'; import user from '../images/user.jpg';
import {Link,useLocation} from'react-router-dom'; import { Link, useLocation } from 'react-router-dom';
import { TableContainer, Table, TableHead, TableBody, TableRow, TableCell } from '@mui/material';
import { Paper } from '@mui/material';
const api = axios.create({ const api = axios.create({
baseURL: 'http://localhost:8080' baseURL: 'http://localhost:8080'
}) })
function Admin_list() { function Repertoire() {
const [contact, setContacts] = useState([]); const [contacts, setContacts] = useState([]);
const [SearchTerm, setSearchTerm] = useState(""); const [SearchTerm, setSearchTerm] = useState("");
const [SearchResults, setSearchResults] = useState([]); const [SearchResults, setSearchResults] = useState([]);
useEffect(() =>{ useEffect(() => {
api.get('/Contact/All/').then((response) => { api.get('/Contact/All').then((response) => {
setContacts(response.data); setContacts(response.data);
setSearchTerm(response.data[0].idcontact); setSearchTerm(response.data[0].idcontact);
}); });
}, []); }, []);
const handleClick = (event, idcontact) => {
setSearchTerm(idContact);
};
return ( return (
<div className='main'> <div className="page_admin">
<div className='ui center aligned card'> <link rel="stylesheet" href="https://unicons.iconscout.com/release/v4.0.0/css/line.css"></link>
<div className='image'> {/* Create a page to delete an user in the admin page*/}
<img src={user} alt='user'></img> <NavigationDashboard />
</div> <div className="Titre_Formulaire_Rech">
<div className='content'> <p className="Titre">Admin</p>
<div className='header'>{name}</div> <p className="Sous-titre">Liste des utilisateurs</p>
<div className='description'>{email}</div> <div className="rechLogo">
<div className="input_box">
<input type="search" placeholder="Rechercher..." />
<span className="search">
<i class="uil uil-search search-icon"></i>
</span>
</div>
<TableContainer component={Paper} sx={{ maxHeight: 0.8 }}>
<Table aria-label="simple table" size="small" stickyHeader>
<TableHead >
<TableRow>
<TableCell sx={{ bgcolor: 'info.main' }} align="left">Nom</TableCell>
<TableCell sx={{ bgcolor: 'info.main' }} align="center">Prénom</TableCell>
<TableCell sx={{ bgcolor: 'info.main' }} align="center">Identifiant</TableCell>
<TableCell sx={{ bgcolor: 'info.main' }} align="center">Téléphone</TableCell>
</TableRow>
</TableHead>
<TableBody >
{contacts.map((contact) => (
<TableRow
key={contact.idcontact}
hover
// onClick={(event) => handleClick(event, contact.idcontact)}
// selected={contact.idcontact === selectedIdcontact}
>
<TableCell align="left">{contact.lastname}</TableCell>
<TableCell align="center">{contact.firstname}</TableCell>
<TableCell align="center">{contact.phone}</TableCell>
<TableCell align="center">{contact.mail}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
</div> </div>
</div> </div>
<Link to="/">
<div className='center div'>
<button className='ui red button center aligned '>Contact List</button>
</div>
</Link>
</div> </div>
); );
} }
function Repertoire() { // function Repertoire() {
// // NOW WITH THE USE OF HOOKS WE WILL GET THE CONTACTS // // NOW WITH THE USE OF HOOKS WE WILL GET THE CONTACTS
// const LOCAL_STORAGE_KEY = "contacts" // const LOCAL_STORAGE_KEY = "contacts"
// const [contacts, setContacts] = useState([]); // const [contacts, setContacts] = useState([]);
// const [SearchTerm, setSearchTerm] = useState(""); // const [SearchTerm, setSearchTerm] = useState("");
// const [SearchResults, setSearchResults] = useState([]); // const [SearchResults, setSearchResults] = useState([]);
// const addContactHandler = async (contact) => { // const addContactHandler = async (contact) => {
// const request = { // const request = {
// id: uuid(), // id: uuid(),
// ...contact // ...contact
// } // }
// const response = await api.post("/contacts", request) // const response = await api.post("/contacts", request)
// setContacts([...contacts, response.data]); // setContacts([...contacts, response.data]);
// } // }
// // UPDATE CONTACT // // UPDATE CONTACT
// const updateContactHandler = async (contact) => { // const updateContactHandler = async (contact) => {
// const response = await api.put(`/contacts/${contact.id}`, contact); // const response = await api.put(`/contacts/${contact.id}`, contact);
// const { id, name, email } = response.data; // const { id, name, email } = response.data;
// setContacts(contacts.map(contact => { // setContacts(contacts.map(contact => {
// return contact.id === id ? { ...response.data } : contact; // return contact.id === id ? { ...response.data } : contact;
// })) // }))
// } // }
// // FOR DELETING THE ITEMS // // FOR DELETING THE ITEMS
// const removeContactHandler = async (id) => { // const removeContactHandler = async (id) => {
// await api.delete(`/contacts/${id}`); // await api.delete(`/contacts/${id}`);
// const newContactList = contacts.filter((contact) => { // const newContactList = contacts.filter((contact) => {
// return contact.id !== id; // return contact.id !== id;
// }); // });
// setContacts(newContactList); // setContacts(newContactList);
// } // }
// // SEARCHING THE CONTACTS // // SEARCHING THE CONTACTS
// const searchHandler = (searchTerm) => { // const searchHandler = (searchTerm) => {
// setSearchTerm(searchTerm); // setSearchTerm(searchTerm);
// if (searchTerm !== "") { // if (searchTerm !== "") {
// const newContactList = contacts.filter((contact) => { // const newContactList = contacts.filter((contact) => {
// return Object.values(contact).join(" ").toLowerCase().includes(searchTerm.toLowerCase()); // return Object.values(contact).join(" ").toLowerCase().includes(searchTerm.toLowerCase());
// }); // });
// setSearchResults(newContactList); // setSearchResults(newContactList);
// } else { // } else {
// setSearchResults(contacts); // setSearchResults(contacts);
// } // }
// } // }
// useEffect(() => { // useEffect(() => {
// const retrieveContacts = JSON.parse(localStorage.getItem(LOCAL_STORAGE_KEY)); // const retrieveContacts = JSON.parse(localStorage.getItem(LOCAL_STORAGE_KEY));
// if (retrieveContacts) setContacts(retrieveContacts); // if (retrieveContacts) setContacts(retrieveContacts);
// } // }
// , []); // , []);
// useEffect(() => { // useEffect(() => {
// localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(contacts)); // localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(contacts));
// } // }
// , [contacts]); // , [contacts]);
// return ( // return (
// <div className="ui container"> // <div className="ui container">
// <Router> // <Router>
// <Header /> // <Header />
// <Routes> // <Routes>
// <Route path="/Repertoire/" // <Route path="/Repertoire/"
// element={<ContactList contacts={SearchTerm.length < 1 ? contacts : SearchResults} getContactId={removeContactHandler} term={SearchTerm} searchKeyword={searchHandler} />} // element={<ContactList contacts={SearchTerm.length < 1 ? contacts : SearchResults} getContactId={removeContactHandler} term={SearchTerm} searchKeyword={searchHandler} />}
// render={(props)=><ContactList contacts={contacts} getContactId={removeContactHandler} {...props} />} // render={(props)=><ContactList contacts={contacts} getContactId={removeContactHandler} {...props} />}
// /> // />
// <Route path="/Repertoire/add" // <Route path="/Repertoire/add"
// element={<AddContact addContactHandler={addContactHandler} />} // element={<AddContact addContactHandler={addContactHandler} />}
// //render={(props)=><AddContact {...props} addContactHandler={addContactHandler}/>} // //render={(props)=><AddContact {...props} addContactHandler={addContactHandler}/>}
// /> // />
// <Route path="Repertoire/edit" // <Route path="Repertoire/edit"
// element={<EditContact updateContactHandler={updateContactHandler} />} // element={<EditContact updateContactHandler={updateContactHandler} />}
// /> // />
// <Route path="/Repertoire/contact/:id" element={<ContactDetail />} /> // <Route path="/Repertoire/contact/:id" element={<ContactDetail />} />
// </Routes> // </Routes>
// {/* <AddContact addContactHandler={addContactHandler}/> */} // {/* <AddContact addContactHandler={addContactHandler}/> */}
// {/*Here in contact list props are used to get the values in the above contact array*/} // {/*Here in contact list props are used to get the values in the above contact array*/}
// {/* <ContactList contacts={contacts} getContactId={removeContactHandler}/> */} // {/* <ContactList contacts={contacts} getContactId={removeContactHandler}/> */}
// </Router> // </Router>
// </div> // </div>
// ) // )
}; // };
export default Repertoire; export default Repertoire;
Loading…
Cancel
Save