30/09/2023 - 19h

recette2
cherif 2023-09-30 18:56:30 +02:00
parent 263cb03e6d
commit 43257f4537
2 changed files with 72 additions and 29 deletions

View File

@ -41,7 +41,8 @@ import { TransitionProps } from '@mui/material/transitions';
import { Checkbox } from "@mui/material"; import { Checkbox } from "@mui/material";
import { ElectricScooterRounded } from "@mui/icons-material"; import { ElectricScooterRounded } from "@mui/icons-material";
import { Container, Row, Col } from 'react-grid-system'; import { Container, Row, Col } from 'react-grid-system';
import Visibility from '@mui/icons-material/Visibility';
import VisibilityOff from '@mui/icons-material/VisibilityOff';
const Employes = (props) => { const Employes = (props) => {
@ -588,7 +589,7 @@ const Employes = (props) => {
Getall_Employee_Affectation(employe_id); Getall_Employee_Affectation(employe_id);
Getall_Employee_Acces_Right(employe_id); Getall_Employee_Acces_Right(employe_id);
} }
@ -813,7 +814,7 @@ const Employes = (props) => {
if (mylocal_employe.user_login) { if (mylocal_employe.user_login) {
setp_detail_user_login(mylocal_employe.user_login); setp_detail_user_login(mylocal_employe.user_login);
setp_new_login(mylocal_employe.user_login) setp_new_login(mylocal_employe.user_login)
}else{ } else {
setp_new_login(mylocal_employe.email) setp_new_login(mylocal_employe.email)
} }
@ -2807,7 +2808,7 @@ const Employes = (props) => {
const [p_new_login, setp_new_login] = React.useState(""); const [p_new_login, setp_new_login] = React.useState("");
const [p_new_pwd, setp_new_pwd] = React.useState(""); const [p_new_pwd, setp_new_pwd] = React.useState("");
const [p_conf_new_login, setp_conf_new_login] = React.useState(""); const [p_conf_new_login, setp_conf_new_login] = React.useState("");
function OnchangeCellDataGrid(params) { function OnchangeCellDataGrid(params) {
@ -2904,7 +2905,7 @@ const Employes = (props) => {
form.append("token", stored_cookie); form.append("token", stored_cookie);
form.append("email", p_new_login); form.append("email", p_new_login);
form.append("pwd", p_new_pwd); form.append("pwd", p_new_pwd);
form.append("ressource_humaine_id", selected_id); form.append("ressource_humaine_id", selected_id);
@ -2921,13 +2922,13 @@ const Employes = (props) => {
setAdd_Update_Employee_Login_Pass_Data_result(res.data.message); setAdd_Update_Employee_Login_Pass_Data_result(res.data.message);
setp_detail_user_login(p_new_login); setp_detail_user_login(p_new_login);
setDialog_1_open_create_update_login_pwd_update(false); setDialog_1_open_create_update_login_pwd_update(false);
alert(res.data.message); alert(res.data.message);
setp_new_login(''); setp_new_login('');
setp_new_pwd(''); setp_new_pwd('');
setp_conf_new_login(''); setp_conf_new_login('');
} }
else { else {
setAdd_Update_Employee_Login_Pass_Data_api("false"); setAdd_Update_Employee_Login_Pass_Data_api("false");
@ -2944,12 +2945,28 @@ const Employes = (props) => {
}) })
} }
function Generate_Pwd(){ function Generate_Pwd() {
var randomstring = Math.random().toString(36).slice(-8); var randomstring = Math.random().toString(36).slice(-8);
setp_new_pwd(randomstring); setp_new_pwd(randomstring);
setp_conf_new_login(randomstring); setp_conf_new_login(randomstring);
} }
const [currentpawdvisible, setcurrentpawdvisible] = useState(false);
const handleClickShowPassword = () => {
if (currentpawdvisible == false) {
document.getElementsByName("new_pwd")[0].type = "text";
document.getElementsByName("conf_new_login")[0].type = "text";
setcurrentpawdvisible(true);
}
else if (currentpawdvisible == true) {
document.getElementsByName("new_pwd")[0].type = "password";
document.getElementsByName("conf_new_login")[0].type = "password";
setcurrentpawdvisible(false);
}
};
return ( return (
<div className="employes"> <div className="employes">
<Dialog <Dialog
@ -3019,84 +3036,102 @@ const Employes = (props) => {
open={Dialog_1_open_create_update_login_pwd_update} open={Dialog_1_open_create_update_login_pwd_update}
onClose={Dialog_1_handleClose_buton_create_update_login_pwd_update} onClose={Dialog_1_handleClose_buton_create_update_login_pwd_update}
className="employes" className="employes"
> >
<DialogTitle>MySy Information</DialogTitle> <DialogTitle>MySy Information</DialogTitle>
<DialogContent style={{"background": "#fffff0"}}> <DialogContent style={{ "background": "#fffff0" }}>
<DialogContentText> <DialogContentText>
Mise à jour Login & Mot de passe Mise à jour Login & Mot de passe
</DialogContentText> </DialogContentText>
<div className="session_caract_Dialog" > Login
{String(p_detail_user_login).length > 2 && <div className="session_caract_Dialog" > Login
<TextField
autoFocus
margin="dense"
id="new_login"
disabled
//label="Prix Unitaire"
fullWidth
//variant="standard"
value={p_new_login}
/>
</div>}
{String(p_detail_user_login).length < 2 && <div className="session_caract_Dialog" > Login
<TextField <TextField
autoFocus autoFocus
margin="dense" margin="dense"
id="new_login" id="new_login"
//label="Prix Unitaire" //label="Prix Unitaire"
fullWidth fullWidth
//variant="standard" //variant="standard"
value={p_new_login} value={p_new_login}
onChange={(e) => { onChange={(e) => {
setp_new_login(e.target.value); setp_new_login(e.target.value);
} }
} }
/> />
</div> </div>}
<div className="session_caract_Dialog" > Mot de passe <div className="session_caract_Dialog" > Mot de passe
<TextField <TextField
autoFocus autoFocus
margin="dense" margin="dense"
id="new_pwd" id="new_pwd"
name="new_pwd"
type = "password"
//label="Prix Unitaire" //label="Prix Unitaire"
fullWidth fullWidth
//variant="standard" //variant="standard"
value={p_new_pwd} value={p_new_pwd}
onChange={(e) => { onChange={(e) => {
setp_new_pwd(e.target.value); setp_new_pwd(e.target.value);
} }
} }
/> />
<nav className="show_pwd_div" onClick={handleClickShowPassword}>
{currentpawdvisible ? <Visibility /> : <VisibilityOff />}
</nav>
</div> </div>
<div className="session_caract_Dialog" > Confirmer Mot de passe <div className="session_caract_Dialog" > Confirmer Mot de passe
<TextField <TextField
autoFocus autoFocus
margin="dense" margin="dense"
id="conf_new_login" id="conf_new_login"
name="conf_new_login"
type = "password"
//label="Prix Unitaire" //label="Prix Unitaire"
fullWidth fullWidth
//variant="standard" //variant="standard"
value={p_conf_new_login} value={p_conf_new_login}
onChange={(e) => { onChange={(e) => {
setp_conf_new_login(e.target.value); setp_conf_new_login(e.target.value);
} }
} }
/> />
<Button onClick={Generate_Pwd} className="bton_enreg_dialog" style={{"width":"100%", "margin":"0px", "background":"orange"}}>Generer un mot de passe</Button>
</div> </div>
<div className="div_row">
<div className="div_row_droite">
<Button onClick={Generate_Pwd} className="bton_enreg_dialog">Generer un mot de passe</Button>
</div>
</div>
</DialogContent> </DialogContent>
<DialogActions> <DialogActions>
<div className="div_row"> <div className="div_row">
<div className="div_row_gauche"> <div className="div_row_gauche">

View File

@ -2240,6 +2240,14 @@
max-width: 30% !important; max-width: 30% !important;
} }
.show_pwd_div {
width: 50%;
float: right;
padding-right: 10px;
text-align: right;
}
} }