diff --git a/src/components/Employes.js b/src/components/Employes.js index d514b73..297eb92 100644 --- a/src/components/Employes.js +++ b/src/components/Employes.js @@ -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) => { > - + + @@ -2334,6 +2391,8 @@ const Employes = (props) => { > + + @@ -2394,7 +2453,7 @@ const Employes = (props) => { } - {/* + {p_filtre3 &&