28/08/23 - 20h30

recette2
cherif 2023-08-28 21:16:48 +02:00
parent 78d23dda68
commit e3951a76b9
1 changed files with 160 additions and 94 deletions

View File

@ -326,10 +326,10 @@ const Employes = (props) => {
const [selected_affectation_id, set_selected_affectation_id] = useState();
function handleClick_edit_affectation_From_Line(selected_row_id) {
setSelectionModel_affectations([]);
setdisplay_affectation("1");
setAdd_new_affectation("")
setAdd_new_affectation("");
clean_affectation_fields();
clean_nouvelle_affectation_fields();
var line = JSON.parse(rows_affectations[selected_row_id]);
@ -809,13 +809,18 @@ const Employes = (props) => {
setp_affect_date_au(mylocal_affectation.date_au);
}
if (mylocal_affectation.related_target_collection_object) {
setp_affect_cible(mylocal_affectation.related_target_collection_object);
if (mylocal_affectation.related_target_collection) {
setp_affect_cible(mylocal_affectation.related_target_collection);
if (String(mylocal_affectation.related_target_collection) === "myclass")
setp_affect_cible_label("Formation");
else if (String(mylocal_affectation.related_target_collection) === "session_formation")
setp_affect_cible_label("Session formation");
}
if (mylocal_affectation.related_target_collection_id_nom) {
setp_affect_cible_nom(mylocal_affectation.related_target_collection_id_nom);
if (mylocal_affectation.related_target_collection_id) {
setp_affect_cible_nom(mylocal_affectation.related_target_collection_id);
setp_affect_cible_nom_label(mylocal_affectation.related_target_collection_id_nom);
}
if (mylocal_affectation.comment) {
@ -1563,6 +1568,10 @@ const Employes = (props) => {
if (String(res.data.status) === String("true")) {
setDelete_affection_api("true");
setDelete_affection_result(res.data.message);
clean_affectation_fields();
setAffectation_data_changed();
setedite_affectation_form();
setdisplay_affectation();
Getall_Employee_Affectation(local_rh_id);
alert(" La fonction a été correctement supprimée.")
}
@ -1598,15 +1607,17 @@ const Employes = (props) => {
const [add_One_Employee, setadd_One_Employee] = useState();
function submenu_add_one_employee() {
setdisplay_detail_employe();
setadd_One_Employee("1");
setsubmenu("detail_employe");
}
function Annule_add_one_Employee() {
setdisplay_detail_employe();
setadd_One_Employee();
setsubmenu("");
setSelectionModel([]);
}
const [Add_One_Employee_Data_api, setAdd_One_Employee_Data_api] = useState();
const [Add_One_Employee_Data_message, setAdd_One_Employee_Data_message] = useState();
@ -1869,8 +1880,12 @@ const Employes = (props) => {
const [p_affect_date_du, setp_affect_date_du] = useState();
const [p_affect_date_au, setp_affect_date_au] = useState();
const [p_affect_cible, setp_affect_cible] = useState();
const [p_affect_cible_label, setp_affect_cible_label] = useState();
const [p_affect_cible_nom, setp_affect_cible_nom] = useState();
const [p_affect_cible_nom_label, setp_affect_cible_nom_label] = useState();
const [edite_affectation_form, setedite_affectation_form] = useState();
const [p_affect_comment, setp_affect_comment] = useState();
const [p_related_target_collection, setp_related_target_collection] = useState();
@ -1882,8 +1897,30 @@ const Employes = (props) => {
setp_affect_date_du();
setp_affect_date_au();
setp_affect_cible();
setp_affect_cible_label();
setp_affect_cible_nom();
setp_affect_cible_nom_label();
setp_affect_comment();
if (document.getElementsByName("affect_poste")[0])
document.getElementsByName("affect_poste")[0].value = "";
if (document.getElementsByName("affect_cible")[0])
document.getElementsByName("affect_cible")[0].value = "";
if (document.getElementsByName("affect_cible_nom")[0])
document.getElementsByName("affect_cible_nom")[0].value = "";
if (document.getElementsByName("affect_date_du")[0])
document.getElementsByName("affect_date_du")[0].value = "";
if (document.getElementsByName("affect_date_au")[0])
document.getElementsByName("affect_date_au")[0].value = "";
if (document.getElementsByName("affect_comment")[0])
document.getElementsByName("affect_comment")[0].value = "";
}
@ -1900,7 +1937,26 @@ const Employes = (props) => {
setp_one_affect_date_au();
setp_one_affect_cible();
setp_one_affect_cible_nom();
setp_one_affect_comment();
if (document.getElementsByName("one_affect_poste")[0])
document.getElementsByName("one_affect_poste")[0].value = "";
if (document.getElementsByName("one_affect_cible")[0])
document.getElementsByName("one_affect_cible")[0].value = "";
if (document.getElementsByName("one_affect_cible_nom")[0])
document.getElementsByName("one_affect_cible_nom")[0].value = "";
if (document.getElementsByName("one_affect_date_du")[0])
document.getElementsByName("one_affect_date_du")[0].value = "";
if (document.getElementsByName("one_affect_date_au")[0])
document.getElementsByName("one_affect_date_au")[0].value = "";
if (document.getElementsByName("one_affect_comment")[0])
document.getElementsByName("one_affect_comment")[0].value = "";
}
@ -2135,7 +2191,7 @@ const Employes = (props) => {
const stored_cookie = getCookie('tokenmysypart');
form.append("token", stored_cookie);
form.append("rh_id", selected_id);
if (p_one_affect_poste)
form.append("poste", p_one_affect_poste);
else {
@ -2152,7 +2208,7 @@ const Employes = (props) => {
if (p_one_affect_date_au)
form.append("date_au", p_one_affect_date_au );
form.append("date_au", p_one_affect_date_au);
else
form.append("date_au", "");
@ -2255,7 +2311,8 @@ const Employes = (props) => {
>
<MenuItem value="email" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Email &nbsp;</MenuItem>
<MenuItem value="nom" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Nom &nbsp;</MenuItem>
<MenuItem value="formation" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Lié a la Formation (code externe) &nbsp;</MenuItem>
<MenuItem value="session" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Lié a la Session (code session) &nbsp;</MenuItem>
</TextField>
@ -2334,6 +2391,8 @@ const Employes = (props) => {
>
<MenuItem value="email" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Email &nbsp;</MenuItem>
<MenuItem value="nom" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Nom &nbsp;</MenuItem>
<MenuItem value="formation" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Lié a la Formation (code externe) &nbsp;</MenuItem>
<MenuItem value="session" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Lié a la Session (code session) &nbsp;</MenuItem>
</TextField>
@ -2394,7 +2453,7 @@ const Employes = (props) => {
</div>
}
{/*
{p_filtre3 &&
<div className="div_row" style={{ "marginBottom": "5px" }}>
@ -2412,8 +2471,8 @@ const Employes = (props) => {
>
<MenuItem value="email" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Email &nbsp;</MenuItem>
<MenuItem value="nom" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Nom &nbsp;</MenuItem>
<MenuItem value="code_session" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }}>Code Session &nbsp;&nbsp;</MenuItem>
<MenuItem value="class_title" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Titre Formation &nbsp;</MenuItem>
<MenuItem value="formation" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Lié a la Formation (code externe) &nbsp;</MenuItem>
<MenuItem value="session" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Lié a la Session (code session) &nbsp;</MenuItem>
</TextField>
@ -2472,6 +2531,7 @@ const Employes = (props) => {
</div>
}
{/*
{p_filtre4 &&
<div className="div_row" style={{ "marginBottom": "5px" }}>
<div className="div_row_gauche texte_area_filter">
@ -3702,43 +3762,7 @@ const Employes = (props) => {
width: '100%',
paddingRight: '1px',
// Gestion des cellule a distance ou presentiel
'& .cell--distantiel': {
backgroundColor: '#AFE1AF',
color: 'black',
},
'& .cell--presentiel': {
backgroundColor: '#AFE1AF',
color: 'black',
},
// gestion couleur des lignes avec le statut d'inscription
'& .line--statut--annule': {
backgroundColor: '#D8D8D8',
color: 'white',
},
'& .line--statut--inscrit': {
backgroundColor: '#CEF6D8',
color: 'black',
},
'& .line--statut--preinscrit': {
backgroundColor: '#F7F2E0',
color: 'black',
},
/*"& .MuiDataGrid-virtualScrollerRenderZone": {
"& .MuiDataGrid-row": {
"&:nth-child(2n)": { backgroundColor: "rgba(235, 235, 235, .7)" }
}
},*/
"& .MuiDataGrid-columnHeaders": {
backgroundColor: "#c8cfd5",
color: "black",
fontSize: 14
},
}}
>
@ -3748,6 +3772,7 @@ const Employes = (props) => {
setSelectionModel_affectations(newSelectionModel);
if (newSelectionModel.length === 1)
handleClick_edit_affectation_From_Line(newSelectionModel);
if (newSelectionModel.length !== 1) {
setedite_affectation_form();
setdisplay_affectation();
@ -3781,43 +3806,43 @@ const Employes = (props) => {
components={{
Toolbar: GridToolbar,
}}
//sx={datagridSx}
getCellClassName={(params) => {
//field === 'distantiel'
if (params.field === 'distantiel' && String(params.value) === "1") {
return 'cell--distantiel';
}
if (params.field === "presentiel" && String(params.value) == "1") {
return 'cell--presentiel';
}
/*//sx={datagridSx}
getCellClassName={(params) => {
//field === 'distantiel'
if (params.field === 'distantiel' && String(params.value) === "1") {
return 'cell--distantiel';
}
if (params.field === "presentiel" && String(params.value) == "1") {
return 'cell--presentiel';
}
//field === "statut"
if (params.field === "status" && String(params.value) == "0") {
return 'cell--statut--preinscrit';
}
//field === "statut"
if (params.field === "status" && String(params.value) == "0") {
return 'cell--statut--preinscrit';
}
if (params.field === "status" && String(params.value) == "1") {
return 'cell--statut--inscrit';
}
if (params.field === "status" && String(params.value) == "1") {
return 'cell--statut--inscrit';
}
if (params.field === "status" && String(params.value) == "-1") {
return 'cell--statut--annule';
}
if (params.field === "status" && String(params.value) == "-1") {
return 'cell--statut--annule';
}
}}
getRowClassName={(params) => {
}}
getRowClassName={(params) => {
if (String(params.row.status) === "-1") {
return 'line--statut--annule';
}
if (String(params.row.status) === "0") {
return 'line--statut--preinscrit';
}
if (String(params.row.status) === "1") {
return 'line--statut--inscrit';
}
}}
if (String(params.row.status) === "-1") {
return 'line--statut--annule';
}
if (String(params.row.status) === "0") {
return 'line--statut--preinscrit';
}
if (String(params.row.status) === "1") {
return 'line--statut--inscrit';
}
}}*/
/>
@ -3882,17 +3907,13 @@ const Employes = (props) => {
}}
disabled={false}
className="disabled_style enable_style"
value={p_affect_cible}
value={p_affect_cible_label}
/>
</div>}
{String(edite_affectation_form) === "1" && <div className="session_caract">Cible edit<br />
p_affect_cible = {p_affect_cible} <br/>
{String(edite_affectation_form) === "1" && <div className="session_caract">Cible <br />
<TextField
name="affect_cible"
id="affect_cible"
@ -3907,11 +3928,11 @@ const Employes = (props) => {
setp_affect_cible(e.target.value);
setAffectation_data_changed("1");
}}
>
<MenuItem key="Formation" value="myclass" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }}>Formation &nbsp;&nbsp;</MenuItem>
<MenuItem key="Session de formation" value="Session de formation" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Session de formation &nbsp;</MenuItem>
<MenuItem value="myclass" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }}>Formation &nbsp;&nbsp;</MenuItem>
<MenuItem value="session_formation" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Session de formation &nbsp;</MenuItem>
<MenuItem value="" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Aucun &nbsp;</MenuItem>
</TextField>
@ -3929,14 +3950,13 @@ const Employes = (props) => {
}}
disabled={false}
className="disabled_style enable_style"
value={p_affect_cible_nom}
value={p_affect_cible_nom_label}
/>
</div>}
{String(edite_affectation_form) === "1" && <div className="session_caract">Cible Nom <br />
{String(edite_affectation_form) === "1" && <div className="session_caract">Cible Nom <br />
<TextField
name="affect_cible_nom"
id="affect_cible_nom"
@ -4040,6 +4060,29 @@ const Employes = (props) => {
/>
</div>}
<div className="session_caract">Commentaire <br />
<TextField
name="affect_comment"
id="affect_comment"
text
InputLabelProps={{
shrink: true,
}}
minRows={3}
maxRows={3}
disabled={false}
className="disabled_style enable_style"
value={p_affect_comment}
onChange={(e) => {
setp_affect_comment(e.target.value);
}}
/>
</div>
<div className="div_row" style={{ "border": "None" }}>
&nbsp;
</div>
@ -4194,7 +4237,7 @@ const Employes = (props) => {
id="one_affect_date_au"
selected={new Date(moment(p_one_affect_date_au, "DD/MM/YYYY HH:mm:ss"))}
onChange={(date) => {
setp_one_affect_date_au(format(date, 'dd/MM/yyyy') );
setp_one_affect_date_au(format(date, 'dd/MM/yyyy'));
}
}
showTimeSelect={false}
@ -4205,6 +4248,29 @@ const Employes = (props) => {
/>
</div>
<div className="session_caract">Commentaire <br />
<TextField
name="one_affect_comment"
id="one_affect_comment"
text
InputLabelProps={{
shrink: true,
}}
minRows={3}
maxRows={3}
disabled={false}
className="disabled_style enable_style"
value={p_one_affect_comment}
onChange={(e) => {
setp_one_affect_comment(e.target.value);
}}
/>
</div>
</div>
<div className="div_row" style={{ "border": "None" }}>
&nbsp;