Théo DUPIN 3 years ago
commit 18253165c5

@ -149,3 +149,19 @@ app.post('/User/Add', (req, res) => {
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 Select, { SelectChangeEvent } from '@mui/material/Select';
import MenuItem from '@mui/material/MenuItem';
import { NavLink } from 'react-router-dom';
const api = axios.create({
baseURL: 'http://localhost:8080'
@ -36,6 +37,21 @@ function Admin_modif() {
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 (
<div className="page_admin">
<NavigationAdmin />
@ -44,7 +60,7 @@ function Admin_modif() {
<p className="Titre">Admin</p>
<p className="Sous-titre">Modification d'utilisateur</p>
<div className="Formulaire">
<form className="form">
<form className="form" onSubmit={checkModif}>
<table className="Formulaire_de_connexion">
<tr>
<div className="texte_côté">
@ -79,12 +95,13 @@ function Admin_modif() {
</div>
</tr>
</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>
</div>
<tr className="bouton_submit">
<button className="bouton_val" type="submit">Valider</button>
<button className="bouton_ann" type="submit">Annuler</button>
</tr>
</div>
</div>
);

@ -1,4 +1,6 @@
.page_admin {
body {
.page_admin {
display: flex;
flex-direction: row;
height: 100vh;
@ -467,8 +469,5 @@
}
}
}
}
}

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

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

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

@ -1,4 +1,5 @@
.page_connexion {
body {
.page_connexion {
display: flex;
flex-direction: column;
align-items: center;
@ -92,4 +93,5 @@
color: rgba(53, 112, 206, 1);
}
}
}
}

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

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

Loading…
Cancel
Save