11/11/2023 - 23h

recette2
cherif 2023-11-11 23:07:55 +01:00
parent fcb1cf08bf
commit d007693be2
1 changed files with 54 additions and 31 deletions

View File

@ -238,11 +238,14 @@ const Module_Agenda = (props) => {
const [Get_List_Agenda_Events_For_Given_User_result, setGet_List_Agenda_Events_For_Given_User_result] = useState();
function Get_List_Agenda_Events_For_Given_User(local_selected_id) {
var local_related_collection = p_filtre1;
var form = new FormData();
const stored_cookie = getCookie('tokenmysypart');
form.append("token", stored_cookie);
form.append("related_collection", "ressource_humaine");
form.append("related_collection", local_related_collection);
form.append("related_collection_recid", local_selected_id);
@ -433,12 +436,17 @@ const Module_Agenda = (props) => {
const [endDate, setendDate] = useState(new Date());
const [selected_related_collection, setselected_related_collection] = useState();
const [Update_One_Agenda_Event_api, setUpdate_One_Agenda_Event_api] = useState();
const [Update_One_Agenda_Event_message, setUpdate_One_Agenda_Event_message] = useState();
const [Update_One_Agenda_Event_result, setUpdate_One_Agenda_Event_result] = useState();
function Update_One_Agenda_Event() {
const Update_One_Agenda_Event = event => {
var local_related_collection = p_filtre1;
if (moment(endDate) <= moment(startDate)) {
alert(" Les dates de début et de fin sont incohérentes");
return;
@ -458,7 +466,7 @@ const Module_Agenda = (props) => {
const stored_cookie = getCookie('tokenmysypart');
form.append("token", stored_cookie);
form.append("_id", p_detail_event_id);
form.append("related_collection", "ressource_humaine");
form.append("related_collection", local_related_collection);
form.append("event_title", new_title);
form.append("event_start", new_start_date);
@ -481,7 +489,7 @@ const Module_Agenda = (props) => {
setUpdate_One_Agenda_Event_api("true");
setUpdate_One_Agenda_Event_result(res.data.message);
Get_List_Agenda_Events();
Get_List_Agenda_Events_For_Given_User(selected_employee_id);
setp_detail_event_id();
setp_detail_title();
@ -614,6 +622,19 @@ const Module_Agenda = (props) => {
})
}
const [display_other_agenda, setdisplay_other_agenda] = useState();
function show_other_agenda() {
setdisplay_other_agenda("1");
}
function show_my_agenda() {
setselected_employee_id(myconntected_employee_id);
setdisplay_other_agenda();
Get_List_Agenda_Events_For_Given_User(myconntected_employee_id);
}
return (
<div className="module_agenda">
{isLoading && <div className="loader-container">
@ -753,10 +774,29 @@ const Module_Agenda = (props) => {
<h3> Agenda et Planning </h3>
<div className="div_row" style={{ "marginBottom": "5px" }}>
<div className="div_row" style={{ "border": "None", "color": "orange", "textAlign": "center" }}>
<div className="div_row_gauche" style={{ "textAlign": 'left', 'marginLeft': '15px' }}>
&nbsp;
</div>
<div className="div_row_droite" style={{ "textAlign": 'right', 'marginRight': '15px' }}>
{(!display_other_agenda || String(display_other_agenda) !== "1") && <Button variant="contained" className="bton_enreg" onClick={show_other_agenda}>Voir autre agenda
</Button>}
{display_other_agenda && String(display_other_agenda) === "1" && <Button variant="contained" className="bton_enreg" onClick={show_my_agenda}>Voir mon agenda
</Button>}
</div>
</div>
{display_other_agenda && String(display_other_agenda) === "1" && <div className="div_row" style={{ "marginBottom": "5px" }}>
<div className="div_row_gauche texte_area_filter" >
<TextField
name="filtre1"
name="filtre_related_collection"
id="filtre_related_collection"
label="Choisir un champ"
select
sx={{ m: 1, width: '100%' }}
@ -764,6 +804,7 @@ const Module_Agenda = (props) => {
onChange={(e) => {
setp_filtre1(e.target.value);
setselected_employee_id("");
setselected_related_collection(e.target.value);
}}
>
@ -778,7 +819,6 @@ const Module_Agenda = (props) => {
{p_filtre1 && String(p_filtre1) === "ressource_humaine" && <div className="div_row_droite texte_area_filter_value" >
selected_employee_id = {selected_employee_id}
<TextField
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
required
@ -812,7 +852,6 @@ const Module_Agenda = (props) => {
{p_filtre1 && String(p_filtre1) === "ressource_materielle" && <div className="div_row_droite texte_area_filter_value" >
selected_employee_id = {selected_employee_id}
<TextField
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
required
@ -825,7 +864,10 @@ const Module_Agenda = (props) => {
disabled={false}
className="disabled_style"
value={selected_employee_id}
onChange={(e) => { setselected_employee_id(e.target.value); }}
onChange={(e) => {
setselected_employee_id(e.target.value);
Get_List_Agenda_Events_For_Given_User(e.target.value);
}}
>
{Getall_Training_Materiel_No_Filter_result &&
Getall_Training_Materiel_No_Filter_result.map((myclient) => (
@ -841,33 +883,14 @@ const Module_Agenda = (props) => {
</div>}
{p_filtre1 && <div className='filter_bton_add'>
<Tooltip id="my-tooltip01" style={{ "fontSize": "12px" }} />
<a data-tooltip-id="my-tooltip01" data-tooltip-content="Ajouter une nouvelle ligne de filtre">
&nbsp; <MdAddCircleOutline onClick={(e) => {
setp_filtre2("1");
setp_filtre2_value("");
}} />
</a>
</div>}
{p_filtre1 && <div className='filter_bton_add'>
<Tooltip id="my-tooltip02" style={{ "fontSize": "12px" }} />
<a data-tooltip-id="my-tooltip02" data-tooltip-content="Supprimer cette ligne de filtre">
&nbsp; <MdRemoveCircleOutline onClick={(e) => {
setp_filtre1();
setp_filtre1_value();
}}
/>
</a>
</div>}
</div>
</div>}
<div className="div_row" style={{ "border": "None" }}>
&nbsp;
</div>
<div style={{ "width": "90%", "marginLeft": "1%" }}>
<div style={{ "width": "98%", "marginLeft": "5px" }}>
<FullCalendar
locales={allLocales}
locale={'fr'}