From 7ee8f2e94df06af0f35d330d78ac75d42bec4890 Mon Sep 17 00:00:00 2001 From: cherif Date: Thu, 2 May 2024 21:33:25 +0200 Subject: [PATCH] 02/05/2024 - 22h --- src/components/DisplayPartnerSession.js | 305 ++++++++++++++---- src/components/Module_Absence.js | 145 +-------- .../components/_displaypartnersession.scss | 26 ++ src/styles/components/_module_absence.scss | 1 - 4 files changed, 274 insertions(+), 203 deletions(-) diff --git a/src/components/DisplayPartnerSession.js b/src/components/DisplayPartnerSession.js index 3e01c2a..a488d16 100644 --- a/src/components/DisplayPartnerSession.js +++ b/src/components/DisplayPartnerSession.js @@ -20,7 +20,7 @@ import fileDownload from 'js-file-download' import Popup from 'reactjs-popup'; import 'reactjs-popup/dist/index.css'; import { FcSearch } from "react-icons/fc"; -import { FcCancel, FcApproval, FcAcceptDatabase, FcPrint, FcAlarmClock, FcMultipleSmartphones, FcWorkflow } from "react-icons/fc"; +import { FcAlarmClock, FcMultipleSmartphones, FcWorkflow } from "react-icons/fc"; import DatePicker from "react-datepicker"; import "react-datepicker/dist/react-datepicker.css"; import { format } from 'date-fns' @@ -56,6 +56,14 @@ import Module_Editique from "./Module_Editique"; import Module_Attestation_Formation from "./Module_Attestation_Formation"; import Module_Evaluation_Positionnement from "./Module_Evaluation_Positionnement"; import { IoAddCircleOutline, IoCloseCircleOutline } from "react-icons/io5"; +import { FcCancel, FcApproval, FcAcceptDatabase, FcPrint, FcPlanner } from "react-icons/fc"; +import { CiBoxList } from "react-icons/ci"; +import FullCalendar from "@fullcalendar/react"; +import daygridPlugin from "@fullcalendar/daygrid"; +import interactionPlugin from "@fullcalendar/interaction"; +import timeGridPlugin from "@fullcalendar/timegrid"; + +import allLocales from '@fullcalendar/core/locales-all' const DisplayPartnerSession = (props) => { @@ -1904,8 +1912,8 @@ const DisplayPartnerSession = (props) => { for (var i = 0; i < liste_preinscr_id.length; i++) { var line = rowss_preinsc[liste_preinscr_id[i]] - - + + var line_json = JSON.parse(line) //console.log(" line_json['prenom'] = ", line_json['prenom']); //console.log(" line_json['_id'] = ", line_json['_id']); @@ -1961,7 +1969,7 @@ const DisplayPartnerSession = (props) => { submenu_color_management("inscrit"); - + } @@ -1977,7 +1985,7 @@ const DisplayPartnerSession = (props) => { desableSessionFields(); } - + } @@ -1985,7 +1993,7 @@ const DisplayPartnerSession = (props) => { setsubmenu("sequence_session"); submenu_color_management("sequence_session"); - + } @@ -1994,7 +2002,7 @@ const DisplayPartnerSession = (props) => { setsubmenu("emargement"); submenu_color_management("emargement"); - + } @@ -2002,7 +2010,7 @@ const DisplayPartnerSession = (props) => { setsubmenu("piece_jointe"); submenu_color_management("piece_jointe"); - + } async function submenu_historique() { @@ -2012,7 +2020,7 @@ const DisplayPartnerSession = (props) => { if (!edit_session_form) { desableSessionFields(); } - + } @@ -2047,7 +2055,7 @@ const DisplayPartnerSession = (props) => { setsubmenu("editique"); submenu_color_management("editique"); - + } @@ -2056,7 +2064,7 @@ const DisplayPartnerSession = (props) => { submenu_color_management("evaluation"); Getall_Survey_hot_evaluation_By_Session(); - + GetListeEvaluation(selected_session_id); } @@ -2066,7 +2074,7 @@ const DisplayPartnerSession = (props) => { setsubmenu("attestation"); submenu_color_management("attestation"); - + GetListeEvaluation(selected_session_id); } @@ -2076,7 +2084,7 @@ const DisplayPartnerSession = (props) => { async function submenu_q_positionnement() { setsubmenu("positionnement"); submenu_color_management("q_positionnement"); - + } @@ -2233,6 +2241,7 @@ const DisplayPartnerSession = (props) => { } + const [Getall_Sequence_Of_Session_result_planning_view, setGetall_Sequence_Of_Session_result_planning_view] = useState([]); const [Getall_Sequence_Of_Session_api, setGetall_Sequence_Of_Session_api] = useState(); const [Getall_Sequence_Of_Session_message, setGetall_Sequence_Of_Session_message] = useState(); @@ -2263,6 +2272,42 @@ const DisplayPartnerSession = (props) => { //console.log(" ##NB_Sequence = ", res.data.message.length); setnb_sequence(res.data.message.length); + var new_data2 = []; + const new_data = res.data.message.map((x) => { + + //--- + var localid = JSON.parse(x)._id; // on donne volontairement a l'id la valeur de '_id' + var local_id = JSON.parse(x)._id; + var local_title = JSON.parse(x).sequence_title; + var local_start = new Date(moment(JSON.parse(x).sequence_start, "DD/MM/YYYY hh:mm")) + var local_end = new Date(moment(JSON.parse(x).sequence_end, "DD/MM/YYYY hh:mm")) + + var local_agenda = JSON.parse(x).agenda; + var local_objectif = JSON.parse(x).objectif; + var local_session_id = JSON.parse(x).session_id; + + + //--- + var node = { + "_id": localid, + "id": localid, + "title": local_title, + "start": local_start, + "end": local_end, + "local_agenda": local_agenda, + "local_objectif": local_objectif + }; + new_data2.push(node); + }); + + if (new_data2.length > 0) { + setGetall_Sequence_Of_Session_result_planning_view(new_data2); + + console.log(" ### new_data2 = ", new_data2); + + } + + } else { setGetall_Sequence_Of_Session_api("false"); @@ -9392,6 +9437,7 @@ const DisplayPartnerSession = (props) => { { "id": "0", "label": "Calendrier de travail", "value": "0" }, { "id": "1", "label": "La 1/2 journée", "value": "1" }, { "id": "2", "label": "La journée", "value": "2" }, + { "id": "3", "label": "Un modèle à ma semaine", "value": "3" }, ] /* Recuperation des evaluations */ @@ -9733,7 +9779,7 @@ const DisplayPartnerSession = (props) => { ] const New_Option_PreInscription = [ - + { "id": "update_client", "label": "Demande MAJ Client", "value": "update_client" }, { "id": "valide_inscr", "label": "Valider Inscription", "value": "valide_inscr" }, { "id": "refuse_inscr", "label": "Refuser Inscription", "value": "refuse_inscr" }, @@ -9908,8 +9954,6 @@ const DisplayPartnerSession = (props) => { form.append("survey_type", "hot_eval"); - //alert(" mysession = "+mysession); zzzz - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Init_Survey_Tab_For_All_Session_Inscrit/"; @@ -9944,6 +9988,7 @@ const DisplayPartnerSession = (props) => { }) } + function Export_survey_hot_eval_datatab_class() { const stored_cookie = getCookie('tokenmysypart'); @@ -9975,6 +10020,104 @@ const DisplayPartnerSession = (props) => { } + const [display_view, setdisplay_view] = useState("list"); + function func_display_planning_view() { + setdisplay_view("planning"); + } + + function func_display_list_view() { + setdisplay_view("list"); + } + + + const renderEventContent = (eventInfo) => { + //console.log(eventInfo); + return ( + <> + {eventInfo.timeText}
+ {eventInfo.event.title} + + ) + }; + + + const handleSelect = (info) => { + + /*if (String(selected_attendee_email).length < 2) { + alert(" Vous devez choisir un stagiaire"); + return; + } + + + setp_detail_title("Nouvelle") + setp_detail_start(info.start) + setp_detail_end(info.end) + setp_detail_comment(""); + setp_detail_event_id(""); + setp_detail_justified(false); + setp_detail_event_type(""); + + setStartDate(info.start); + setendDate(info.end); + setDialog_1_open(true);*/ + + + + }; + + const [mysy_events, setmysy_events] = useState(); + + const [Partner_Debut_Journee, setPartner_Debut_Journee] = useState("7:00"); + const [Partner_Fin_Journee, setPartner_Fin_Journee] = useState("20:00"); + + const handleEventClick = (arg) => { + + /* if (String(selected_attendee_email).length < 2) { + alert(" Vous devez choisir un stagiaire"); + return; + } + + + setp_detail_title(arg.event.title) + setp_detail_start(arg.event.start) + setp_detail_end(arg.event.end) + setp_detail_event_id(arg.event.id); + + if (arg.event.extendedProps.comment) { + setp_detail_comment(arg.event.extendedProps.comment); + } + else + setp_detail_comment(""); + + + if (arg.event.extendedProps.justified) { + if (String(arg.event.extendedProps.justified) === "true") + setp_detail_justified(true); + + else + setp_detail_justified(false); + + + } + else + setp_detail_justified(false); + + + + if (arg.event.extendedProps.type) { + setp_detail_event_type(arg.event.extendedProps.type); + } + else + setp_detail_event_type(""); + + + setStartDate(arg.event.start); + setendDate(arg.event.end); + setDialog_1_open(true); + */ + } + + return (
@@ -13864,8 +14007,16 @@ const DisplayPartnerSession = (props) => {
+
-
+ +
+ Affichage : + +
+ + + {display_view && String(display_view) === "list" &&
  @@ -13900,13 +14051,11 @@ const DisplayPartnerSession = (props) => { rows={Getall_Sequence_Of_Session_result.map((item, index) => ( { id: index, - _id: JSON.parse(item)._id, sequence_start: JSON.parse(item).sequence_start, sequence_end: JSON.parse(item).sequence_end, session_id: JSON.parse(item).session_id, sequence_title: JSON.parse(item).sequence_title, - agenda: JSON.parse(item).agenda, objectif: JSON.parse(item).objectif, commentaire: JSON.parse(item).commentaire, @@ -14080,7 +14229,47 @@ const DisplayPartnerSession = (props) => {
-
+
} + + {display_view && String(display_view) === "planning" && Getall_Sequence_Of_Session_result_planning_view && +
+

Affichage planning

+   + +
+ } + //plugins={[timeGridPlugin]} + plugins={[timeGridPlugin, daygridPlugin, interactionPlugin]} + views={["dayGridMonth", "dayGridWeek", "dayGridDay"]} + slotMinTime={Partner_Debut_Journee} + slotMaxTime={Partner_Fin_Journee} + scrollTime='08:00' + displayEventEnd={true} + eventContent={renderEventContent} + eventClick={handleEventClick} + + /> +
+ + + + +
}
@@ -14517,7 +14706,7 @@ const DisplayPartnerSession = (props) => { } /> - +
{/* -- début champs specifiques **/} @@ -14768,40 +14957,40 @@ const DisplayPartnerSession = (props) => {
}
- {String(addOneParticipant) !== "1" && selected_code_session && selected_internal_url && -
+ {String(addOneParticipant) !== "1" && selected_code_session && selected_internal_url && +
- - + + -
- Télécharger un fichier modèle -
+
+ Télécharger un fichier modèle +
- {participant_file_name}
- {String(liste_participants_file_change_api) === String("true") && } - {String(liste_participants_file_change_api) === String("false") && } + {participant_file_name}
+ {String(liste_participants_file_change_api) === String("true") && } + {String(liste_participants_file_change_api) === String("false") && } - + -
} +
} @@ -14839,7 +15028,7 @@ const DisplayPartnerSession = (props) => { } /> - + @@ -15046,7 +15235,7 @@ const DisplayPartnerSession = (props) => { } /> - + @@ -16238,13 +16427,13 @@ const DisplayPartnerSession = (props) => {
- {String(participant_data_edit_mode) === "1" && -
+ {String(participant_data_edit_mode) === "1" && +
- + -
} +
} {String(participant_data_edit_mode) === "1" &&
} diff --git a/src/components/Module_Absence.js b/src/components/Module_Absence.js index 394b155..8a302af 100644 --- a/src/components/Module_Absence.js +++ b/src/components/Module_Absence.js @@ -569,22 +569,6 @@ const Module_Absence = (props) => { setDialog_1_open(true); - - - /*const { start, end } = info; - const eventNamePrompt = prompt("Enter, Nom evenment"); - if (eventNamePrompt) { - - setEvents([ - ...events, - { - start, - end, - title: eventNamePrompt, - id: uuid(), - }, - ]); - }*/ }; @@ -1195,134 +1179,7 @@ const Module_Absence = (props) => {
- {/* -
- -
-   -
- -
- {(!display_other_agenda || String(display_other_agenda) !== "1") && } - - {display_other_agenda && String(display_other_agenda) === "1" && } - - -
-
- - {display_other_agenda && String(display_other_agenda) === "1" &&
-
- { - - setp_filtre1(e.target.value); - setselected_employee_id(""); - setselected_related_collection(e.target.value); - - }} - > - Employé   - Materiel   - - - -
- - - - {p_filtre1 && String(p_filtre1) === "ressource_humaine" &&
- - { - - Get_Ressource_Data(e.target.value) - setselected_employee_id(e.target.value); - Get_List_Agenda_Events_For_Given_User(e.target.value); - - - }} - > - {Getall_Training_Employee_No_Filter_result && - Getall_Training_Employee_No_Filter_result.map((myclient) => ( - - {JSON.parse(myclient).nom}  {JSON.parse(myclient).prenom} - - - ))} - - - - -
} - - {p_filtre1 && String(p_filtre1) === "ressource_materielle" &&
- - { - Get_Ressource_Data(e.target.value) - 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) => ( - - {JSON.parse(myclient).nom}  - - - ))} - - - - -
} - - - -
} -
-   -
- -
- {agenda_owner_name && String(agenda_owner_name) === "Mon Planning" &&
{agenda_owner_name}
} - {agenda_owner_name && String(agenda_owner_name) !== "Mon Planning" &&
Vous êtes sur le planning de {agenda_owner_name} - ({agenda_owner_type})
} -
- -*/} + {String(display_view) === "planning" &&
  diff --git a/src/styles/components/_displaypartnersession.scss b/src/styles/components/_displaypartnersession.scss index 9e36d93..a4a1743 100644 --- a/src/styles/components/_displaypartnersession.scss +++ b/src/styles/components/_displaypartnersession.scss @@ -707,6 +707,13 @@ float: left; } + .mode_affichage { + width: 25%; + float: right; + cursor: pointer; + + } + } @media only screen and (min-width: 601px) and (max-width: 991px) { @@ -1345,6 +1352,13 @@ float: left; } + .mode_affichage { + width: 15%; + float: right; + cursor: pointer; + + } + } @media only screen and (min-width: 992px) and (max-width: 1199px) { @@ -1907,6 +1921,13 @@ float: left; } + .mode_affichage { + width: 12%; + float: right; + cursor: pointer; + + } + } @media only screen and (min-width: 1200px) { @@ -2634,6 +2655,11 @@ float: left; } + .mode_affichage { + width: 8%; + float: right; + cursor: pointer; + } } // end media diff --git a/src/styles/components/_module_absence.scss b/src/styles/components/_module_absence.scss index 6b22e4f..6e233f7 100644 --- a/src/styles/components/_module_absence.scss +++ b/src/styles/components/_module_absence.scss @@ -2469,7 +2469,6 @@ width: 8%; float: right; cursor: pointer; - } }