Théo DUPIN 3 years ago
commit 18253165c5

@ -149,3 +149,19 @@ app.post('/User/Add', (req, res) => {
res.send('Post added...' + result.insertId); res.send('Post added...' + result.insertId);
}); });
}); });
app.post('/User/Update/:id', (req, res) => {
const id = req.params.id;
let form = req.body;
console.log(form);
const sql = `UPDATE users SET lastname = '${form.lastname}', firstname = '${form.lastname}', idrole = '${form.lastname}', login = '${form.lastname}', password = '${form.lastname}', phone = '${form.lastname}', mail = '${form.lastname}' WHERE (iduser = ?)`;
db.query(sql ,[id], (err, result) => {
if (err) throw err;
console.log(result);
res.send('Post added...' + result.insertId);
});
});

@ -5,6 +5,7 @@ import Admin from './Admin_create.js';
import { useLocation } from "react-router-dom" import { useLocation } from "react-router-dom"
import Select, { SelectChangeEvent } from '@mui/material/Select'; import Select, { SelectChangeEvent } from '@mui/material/Select';
import MenuItem from '@mui/material/MenuItem'; import MenuItem from '@mui/material/MenuItem';
import { NavLink } from 'react-router-dom';
const api = axios.create({ const api = axios.create({
baseURL: 'http://localhost:8080' baseURL: 'http://localhost:8080'
@ -36,6 +37,21 @@ function Admin_modif() {
setSelectedIdRole(event.target.value); setSelectedIdRole(event.target.value);
}; };
function checkModif(event){
event.preventDefault();
const formData = new FormData(event.currentTarget);
const values = Object.fromEntries(formData.entries());
console.log(values.firstname);
const apiString = '/User/Update/' + currentUser.iduser;
api.post(apiString).then (function(response) {
console.log(response.data);
});
}
return ( return (
<div className="page_admin"> <div className="page_admin">
<NavigationAdmin /> <NavigationAdmin />
@ -44,7 +60,7 @@ function Admin_modif() {
<p className="Titre">Admin</p> <p className="Titre">Admin</p>
<p className="Sous-titre">Modification d'utilisateur</p> <p className="Sous-titre">Modification d'utilisateur</p>
<div className="Formulaire"> <div className="Formulaire">
<form className="form"> <form className="form" onSubmit={checkModif}>
<table className="Formulaire_de_connexion"> <table className="Formulaire_de_connexion">
<tr> <tr>
<div className="texte_côté"> <div className="texte_côté">
@ -79,12 +95,13 @@ function Admin_modif() {
</div> </div>
</tr> </tr>
</table> </table>
<p>{currentUser === true?"L'identifiant existe déja":''}</p>
<div className="bouton_submit">
<button className="bouton_val" type="submit">Valider</button>
<NavLink className="bouton_ann" to="/Admin_list">Retour</NavLink>
</div>
</form> </form>
</div> </div>
<tr className="bouton_submit">
<button className="bouton_val" type="submit">Valider</button>
<button className="bouton_ann" type="submit">Annuler</button>
</tr>
</div> </div>
</div> </div>
); );

@ -1,3 +1,5 @@
body {
.page_admin { .page_admin {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -468,7 +470,4 @@
} }
} }
} }
}

@ -1,9 +1,4 @@
body { body {
background-image: url("../../../public/fond_page_connexion.png");
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
background-size: cover;
.page_analyse { .page_analyse {
display: flex; display: flex;

@ -1,9 +1,4 @@
body { body {
background-image: url("../../../public/fond_page_connexion.png");
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
background-size: cover;
.page_calendrier { .page_calendrier {
display: flex; display: flex;

@ -1,9 +1,4 @@
body { body {
background-image: url("../../../public/fond_page_connexion.png");
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
background-size: cover;
.page_compte { .page_compte {
display: flex; display: flex;

@ -1,3 +1,4 @@
body {
.page_connexion { .page_connexion {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -93,3 +94,4 @@
} }
} }
} }
}

@ -1,9 +1,4 @@
body { body {
background-image: url("../../../public/fond_page_connexion.png");
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
background-size: cover;
.page_dashboard { .page_dashboard {
display: flex; display: flex;

@ -1,9 +1,5 @@
body { body {
background-image: url("../../../public/fond_page_connexion.png"); background-color: $alice-blue;
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
background-size: cover;
.page_parametre { .page_parametre {
display: flex; display: flex;
@ -24,7 +20,7 @@ body {
background: rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.3);
border-radius: 15px; border-radius: 15px;
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37); box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.25);
backdrop-filter: blur(3px); backdrop-filter: blur(3px);
-webkit-backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
@ -47,7 +43,7 @@ body {
width: 100%; width: 100%;
margin: 30px 30px; margin: 30px 30px;
border-radius: 25px; border-radius: 25px;
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37); box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.25);
input { input {
position: relative; position: relative;
@ -105,7 +101,7 @@ body {
background: rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.3);
border-radius: 15px; border-radius: 15px;
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37); box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.25);
backdrop-filter: blur(3px); backdrop-filter: blur(3px);
-webkit-backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
@ -144,7 +140,7 @@ body {
background: rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.3);
border-radius: 15px; border-radius: 15px;
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37); box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.25);
backdrop-filter: blur(3px); backdrop-filter: blur(3px);
-webkit-backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
@ -176,7 +172,7 @@ body {
background-color: rgb(190, 189, 189); background-color: rgb(190, 189, 189);
border-radius: 5px; border-radius: 5px;
border-radius: 5px; border-radius: 5px;
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37); box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.25);
cursor: pointer; cursor: pointer;
&:hover{ &:hover{
@ -205,7 +201,7 @@ body {
background-color: rgb(190, 189, 189); background-color: rgb(190, 189, 189);
border-radius: 5px; border-radius: 5px;
border-radius: 5px; border-radius: 5px;
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37); box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.25);
cursor: pointer; cursor: pointer;
&:hover{ &:hover{
@ -226,7 +222,7 @@ body {
background: rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.3);
border-radius: 15px; border-radius: 15px;
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37); box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.25);
backdrop-filter: blur(3px); backdrop-filter: blur(3px);
-webkit-backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
@ -259,10 +255,11 @@ body {
border-radius: 20px; border-radius: 20px;
box-shadow: inset 0 0 5px rgba(0,0,0,.5); box-shadow: inset 0 0 5px rgba(0,0,0,.5);
transition: .5s; transition: .5s;
cursor: pointer;
} }
input:checked[type="checkbox"] { input:checked[type="checkbox"] {
background-color: rgb(41, 186, 41); background-color: rgb(51, 75, 172);
} }
input[type="checkbox"]:before { input[type="checkbox"]:before {
@ -293,7 +290,7 @@ body {
background: rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.3);
border-radius: 15px; border-radius: 15px;
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37); box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.25);
backdrop-filter: blur(3px); backdrop-filter: blur(3px);
-webkit-backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
} }

Loading…
Cancel
Save