From e54778bc3e4fee07fbcb6770cd576e4326a14351 Mon Sep 17 00:00:00 2001 From: cherif Date: Sat, 4 Jan 2025 14:58:48 +0100 Subject: [PATCH] 04/01/2025 - 14h48 --- src/components/Crm_Opportunite.js | 32 +- src/components/DisplayPartnerSession.js | 1363 ++++++++++++++++- .../DisplayPartnerTrainingsPagination.js | 2 +- src/components/Partner.js | 4 +- .../Partner_Config_Session_Steps.js | 2 +- .../components/_displaypartnersession.scss | 84 +- 6 files changed, 1423 insertions(+), 64 deletions(-) diff --git a/src/components/Crm_Opportunite.js b/src/components/Crm_Opportunite.js index 516c921..4f05d7c 100644 --- a/src/components/Crm_Opportunite.js +++ b/src/components/Crm_Opportunite.js @@ -377,24 +377,22 @@ const CRM_Opportunite = (props) => { new_data2.push(node); setTaskStatus(new_data2); - var node = { - "_id": "", - "id": "", - "label": "", - "titre": "", - "title": "", - "description": "", - "status": "", - "priorite": "", - "revenu_cible": "", - "client_nom": "", - "client_id": "", - "contact_nom": "", - }; - new_data2.push(node); - }); - + var node = { + "_id": "", + "id": "", + "label": "", + "titre": "", + "title": "", + "description": "", + "status": "", + "priorite": "", + "revenu_cible": "", + "client_nom": "", + "client_id": "", + "contact_nom": "", + }; + new_data2.push(node); if (new_data2.length > 0) { setNew_Getall_Partner_CRM_Opportunite_result(new_data2); diff --git a/src/components/DisplayPartnerSession.js b/src/components/DisplayPartnerSession.js index 8449e65..d7085aa 100644 --- a/src/components/DisplayPartnerSession.js +++ b/src/components/DisplayPartnerSession.js @@ -93,7 +93,7 @@ import { } from '@mui/x-data-grid'; import * as XLSX from 'xlsx'; - + import { makeStyles } from "@material-ui/core/styles"; import Paper from '@material-ui/core/Paper'; import Draggable from 'react-draggable'; @@ -101,6 +101,15 @@ import { IconButton } from '@material-ui/core'; import AutoFixHighOutlinedIcon from '@mui/icons-material/AutoFixHighOutlined'; import CancelPresentationIcon from '@mui/icons-material/CancelPresentation'; +import { DataGridPro } from '@mui/x-data-grid-pro'; + +import { useCallback, } from "react"; +import { DndProvider, useDrag } from "react-dnd"; +import { useDrop } from 'react-dnd' + +import { HTML5Backend } from "react-dnd-html5-backend"; +import update from "immutability-helper"; + function PaperComponent(props) { return ( { const [datagrid_columns_size_model2, setdatagrid_columns_size_model2] = useState(100); - // zzzz + const columns = [ { field: 'id', headerName: 'id', hide: true, disableExport: true, }, @@ -1434,6 +1443,8 @@ const DisplayPartnerSession = (props) => { ] + const [New_Getall_TrainingSession_result, setNew_Getall_TrainingSession_result] = useState(); + const [Getall_TrainingSession_api, setGetall_TrainingSession_api] = useState(); const [Getall_TrainingSession_message, setGetall_TrainingSession_message] = useState(); const [Getall_TrainingSession_result, setGetall_TrainingSession_result] = useState(); @@ -1486,6 +1497,65 @@ const DisplayPartnerSession = (props) => { setGetall_TrainingSession_api("true"); setGetall_TrainingSession_result(res.data.message); setRows(res.data.message); + + + var new_data2 = []; + const new_data = res.data.message.map((x) => { + + //--- + var localid = JSON.parse(x).id; + var local_id = JSON.parse(x)._id; + var local_code_session = JSON.parse(x).code_session; + var local_titre = JSON.parse(x).titre; + var local_date_debut = JSON.parse(x).date_debut; + var local_date_fin = JSON.parse(x).date_fin; + var local_session_etape = JSON.parse(x).session_etape; + var local_is_session_alert = JSON.parse(x).is_session_alert; + var local_invoiced_statut = JSON.parse(x).invoiced_statut; + var local_session_alert_message = JSON.parse(x).session_alert_message; + + + //--- + var node = { + "_id": local_id, + "id": localid, + "label": local_code_session, + "code_session": local_code_session, + "titre": local_titre, + "date_debut": local_date_debut, + "date_fin": local_date_fin, + "session_etape": local_session_etape, + "is_session_alert": local_is_session_alert, + "is_session_alert": local_is_session_alert, + "invoiced_statut": local_invoiced_statut, + "session_alert_message": local_session_alert_message, + + + }; + new_data2.push(node); + setTaskStatus(new_data2); + + }); + var node = { + "_id": "", + "id": "", + "label": "", + "code_session": "", + "titre": "", + "date_debut": "", + "date_fin": "", + "session_etape": "", + "is_session_alert": "", + "invoiced_statut": "", + "session_alert_message": "", + }; + new_data2.push(node); + + if (new_data2.length > 0) { + setNew_Getall_TrainingSession_result(new_data2); + + } + } else { setGetall_TrainingSession_api("false"); @@ -1656,7 +1726,7 @@ const DisplayPartnerSession = (props) => { } - // lorsqu'on rentre dans ce fichier avec une formation, il faut aller chercher toutes sessions de la formation zzz + // lorsqu'on rentre dans ce fichier avec une formation, il faut aller chercher toutes sessions de la formation const [Getall_TrainingSession_For_Given_Class_api, setGetall_TrainingSession_For_Given_Class_api] = useState(); const [Getall_TrainingSession_For_Given_Class_message, setGetall_TrainingSession_For_Given_Class_message] = useState(); @@ -1685,6 +1755,62 @@ const DisplayPartnerSession = (props) => { setGetall_TrainingSession_For_Given_Class_api("true"); setGetall_TrainingSession_For_Given_Class_result(res.data.message); setRows(res.data.message); + + var new_data2 = []; + const new_data = res.data.message.map((x) => { + + //--- + var localid = JSON.parse(x).id; + var local_id = JSON.parse(x)._id; + var local_code_session = JSON.parse(x).code_session; + var local_titre = JSON.parse(x).titre; + var local_date_debut = JSON.parse(x).date_debut; + var local_date_fin = JSON.parse(x).date_fin; + var local_session_etape = JSON.parse(x).session_etape; + var local_is_session_alert = JSON.parse(x).is_session_alert; + var local_invoiced_statut = JSON.parse(x).invoiced_statut; + var local_session_alert_message = JSON.parse(x).session_alert_message; + + + //--- + var node = { + "_id": local_id, + "id": localid, + "label": local_code_session, + "code_session": local_code_session, + "titre": local_titre, + "date_debut": local_date_debut, + "date_fin": local_date_fin, + "session_etape": local_session_etape, + "is_session_alert": local_is_session_alert, + "invoiced_statut": local_invoiced_statut, + "session_alert_message": local_session_alert_message, + + }; + new_data2.push(node); + setTaskStatus(new_data2); + + }); + var node = { + "_id": "", + "id": "", + "label": "", + "code_session": "", + "titre": "", + "date_debut": "", + "date_fin": "", + "session_etape": "", + "is_session_alert": "", + "invoiced_statut": "", + "session_alert_message": "", + }; + new_data2.push(node); + + if (new_data2.length > 0) { + setNew_Getall_TrainingSession_result(new_data2); + + } + } else { setGetall_TrainingSession_For_Given_Class_api("false"); @@ -2022,7 +2148,7 @@ const DisplayPartnerSession = (props) => { setGetall_Parter_OR_Default_Session_Steps_result(res.data.message); var new_data2 = []; - const new_data = res.data.message.map((x) => { + var new_data = res.data.message.map((x) => { //--- var localid = JSON.parse(x).id; @@ -2046,6 +2172,93 @@ const DisplayPartnerSession = (props) => { setNew_Getall_Parter_OR_Default_Session_Steps_result(new_data2); + var new_data2 = []; + var local_opport_chanel = []; + var local_new_option = []; + var local_opport_chanel_label = {}; + new_data = res.data.message.map((x) => { + + //--- + var localid = JSON.parse(x).id; + var local_id = JSON.parse(x)._id; + var local_session_step_name = JSON.parse(x).session_step_name; + var local_session_step_sequence = JSON.parse(x).session_step_sequence; + + //--- + var node = { + "_id": local_id, + "id": localid, + "label": local_session_step_name, + "session_step_name": local_session_step_name, + "session_step_sequence": local_session_step_sequence, + + }; + new_data2.push(node); + local_opport_chanel.push(local_session_step_name); + + var node_for_status = { + "_id": local_id, + "id": local_session_step_name, + "label": local_session_step_name[0].toUpperCase() + local_session_step_name.slice(1), + "value": local_session_step_name, + + }; + local_new_option.push(node_for_status); + + + }); + + var node = { + "_id": "", + "id": "", + "label": "", + "code": "", + "description": "", + "rang": "" + }; + + //local_opport_chanel.push(node); + + if (new_data2.length > 0) { + setNew_Getall_Parter_Session_Steps_result(new_data2); + setSession_step_chanel(local_opport_chanel); + + if (String(props.reduce) === "0") { + var tmp = 80 / new_data2.length; + var tmp_val = tmp + "vw"; + + setkanban_colonne_width(tmp_val); + } else { + var tmp = 95 / new_data2.length; + var tmp_val = tmp + "vw"; + + setkanban_colonne_width(tmp_val); + } + + + } else { + setNew_Getall_Parter_Session_Steps_result([]); + setSession_step_chanel([]); + } + + var node_for_status = { + "_id": "", + "id": "", + "label": "", + "value": "", + + }; + local_new_option.push(node_for_status); + setNew_Option_Status(local_new_option); + + for (let i = 0; i < local_opport_chanel.length; i++) { + var temp_val = String(local_opport_chanel[i]); + local_opport_chanel_label[String(local_opport_chanel[i])] = temp_val[0].toUpperCase() + temp_val.slice(1); + } + + setSession_step_chanel_label(local_opport_chanel_label); + + } else { setGetall_Parter_OR_Default_Session_Steps_api("false"); @@ -2063,6 +2276,139 @@ const DisplayPartnerSession = (props) => { const [history_securite_read, sethistory_securite_read] = useState(""); + const [Session_step_chanel, setSession_step_chanel] = useState([]); + const [Session_step_chanel_label, setSession_step_chanel_label] = useState(); + const [New_Option_Status, setNew_Option_Status] = useState([]); + const [kanban_colonne_width, setkanban_colonne_width] = useState("16vw"); + + const [New_Getall_Parter_Session_Steps_result, setNew_Getall_Parter_Session_Steps_result] = useState([]); + + const [Getall_Parter_Session_Steps_api, setGetall_Parter_Session_Steps_api] = useState(); + const [Getall_Parter_Session_Steps_message, setGetall_Parter_Session_Steps_message] = useState(); + const [Getall_Parter_Session_Steps_result, setGetall_Parter_Session_Steps_result] = useState(); + function Getall_Parter_Session_Steps(event) { + + var form = new FormData(); + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Partner_session_step/"; + + axios.post(myurl, form).then(res => { + + if (String(res.data.status) === String("true")) { + //console.log(" In Getall_Parter_Session_Steps res.data.status = " + res.data.status); + //console.log(" In Getall_Parter_Session_Steps res.data.message r_class = " + res.data.message); + setGetall_Parter_Session_Steps_api("true"); + setGetall_Parter_Session_Steps_result(res.data.message); + + var new_data2 = []; + var local_opport_chanel = []; + var local_new_option = []; + var local_opport_chanel_label = {}; + const new_data = res.data.message.map((x) => { + + //--- + var localid = JSON.parse(x).id; + var local_id = JSON.parse(x)._id; + var local_session_step_name = JSON.parse(x).session_step_name; + var local_session_step_sequence = JSON.parse(x).session_step_sequence; + + //--- + var node = { + "_id": local_id, + "id": localid, + "label": local_session_step_name, + "session_step_name": local_session_step_name, + "session_step_sequence": local_session_step_sequence, + + }; + new_data2.push(node); + local_opport_chanel.push(local_session_step_name); + + var node_for_status = { + "_id": local_id, + "id": local_session_step_name, + "label": local_session_step_name[0].toUpperCase() + local_session_step_name.slice(1), + "value": local_session_step_name, + + }; + local_new_option.push(node_for_status); + + + }); + + var node = { + "_id": "", + "id": "", + "label": "", + "code": "", + "description": "", + "rang": "" + }; + + //local_opport_chanel.push(node); + + if (new_data2.length > 0) { + setNew_Getall_Parter_Session_Steps_result(new_data2); + setSession_step_chanel(local_opport_chanel); + + if (String(props.reduce) === "0") { + var tmp = 80 / new_data2.length; + var tmp_val = tmp + "vw"; + + setkanban_colonne_width(tmp_val); + } else { + var tmp = 95 / new_data2.length; + var tmp_val = tmp + "vw"; + + setkanban_colonne_width(tmp_val); + } + + + } else { + setNew_Getall_Parter_Session_Steps_result([]); + setSession_step_chanel([]); + } + + var node_for_status = { + "_id": "", + "id": "", + "label": "", + "value": "", + + }; + local_new_option.push(node_for_status); + setNew_Option_Status(local_new_option); + + for (let i = 0; i < local_opport_chanel.length; i++) { + var temp_val = String(local_opport_chanel[i]); + local_opport_chanel_label[String(local_opport_chanel[i])] = temp_val[0].toUpperCase() + temp_val.slice(1); + } + + setSession_step_chanel_label(local_opport_chanel_label); + + } + else { + setGetall_Parter_Session_Steps_api("false"); + setGetall_Parter_Session_Steps_message(res.data.message); + alert(res.data.message); + } + + + + + }).catch((error) => { + console.warn('Not good man :( Getall_Parter_Session_Steps = ', error); + setGetall_Parter_Session_Steps_api("false"); + alert(" Impossible de recuperer la liste des étapes de session"); + //setmyApimyApiMessage("") + }) + } + + useEffect(() => { sethistory_securite_read(props.check_user_acces_right("historique", "read")) @@ -2076,6 +2422,7 @@ const DisplayPartnerSession = (props) => { GetAttestation_Certif(); Get_List_Partner_Clients(); Getall_Partner_Site_Formation(); + // Getall_Parter_Session_Steps(); let windowWidth = window.innerWidth; if (windowWidth < 1001) { @@ -6040,7 +6387,7 @@ const DisplayPartnerSession = (props) => { } const [display_detail_insc, setdisplay_detail_insc] = React.useState(); - + const [getPartnerImages_api, setgetPartnerImages_api] = useState(); const [getPartnerImages_message, setgetPartnerImages_message] = useState(); const [getPartnerImages_result, setgetPartnerImages_result] = useState(); @@ -11494,6 +11841,221 @@ const DisplayPartnerSession = (props) => { } // FIN EXPORT EXCEL DATAGRID + const [data_row_grouped_by, setdata_row_grouped_by] = useState(""); + + const [data_row_grouped_field, setdata_row_grouped_field] = useState(""); + + function getTreeDataPath(param) { + + var local_tmp = data_row_grouped_field; + + var local_tab_array = []; + + + if (param[local_tmp]) { + local_tab_array.push(String(param[local_tmp])); + } else { + local_tab_array.push(""); + } + + local_tab_array.push(String(param["code_session"])); + + return local_tab_array; + } + + + function datagrid_grouped_by(champ_filtre) { + setdata_row_grouped_field(champ_filtre); + + getTreeDataPath(rowss) + } + + const New_option_group_by = [ + { "id": "", "label": "Aucun", "value": "" }, + { "id": "etape", "label": "Etape", "value": "etape" }, + + ] + + + const [session_display_view, setsession_display_view] = useState("list"); + function func_sesion_display_kanban_view() { + setsession_display_view("kanban"); + } + + function func_session_display_list_view() { + setsession_display_view("list"); + } + + + // MySy Comment : design d'une tache (couleur, taille, etc) + const classes_session_step = { + board: { + display: "flex", + margin: "0 auto", + width: "100%", + fontFamily: 'Arial, "Helvetica Neue", sans-serif' + }, + column: { + // minWidth: 200, + //width: "16vw", + width: kanban_colonne_width, + height: "80vh", + margin: "0 auto", + backgroundColor: "#212F3D", + border: 'double #32a1ce', + + }, + columnHead: { + textAlign: "center", + padding: 10, + fontSize: "1.2em", + backgroundColor: "#C6D8AF", + border: "red", + }, + item: { + padding: 10, + margin: 10, + fontSize: "0.8em", + cursor: "pointer", + backgroundColor: "white" + } + }; + + + const KanbanColumn = ({ status, changeTaskStatus, children }) => { + const ref = useRef(null); + const [, drop] = useDrop({ + accept: "card", + drop(item) { + changeTaskStatus(item.id, status); + } + }); + drop(ref); + return
{children}
; + }; + + const KanbanItem = ({ id, children }) => { + const ref = useRef(null); + + + const [{ isDragging }, drag] = + useDrag({ + type: "card", + item: () => ({ id }), + collect: monitor => ({ + isDragging: monitor.isDragging() + }) + }); + + const opacity = isDragging ? 0 : 1; + drag(ref); + return ( +
+ {children} +
+ ); + }; + + const [tasks, setTaskStatus] = useState([]); + + // MySy Comment : quand on change la position d'une tache, dans cette fonction on appel l'api de mise à jour + const changeTaskStatus = useCallback( + (id, status) => { + + + let task = tasks.find(task => task._id === id); + const taskIndex = tasks.indexOf(task); + task = { ...task, status }; + let newTasks = update(tasks, { + [taskIndex]: { $set: task } + }); + + setTaskStatus(newTasks); + // Recuperer l'_id du statuts + + if (New_Option_Status.length > 0 && status) { + var local_status_id = New_Option_Status.filter((data) => (data).value === String(status))[0]._id; + var local_step_name = New_Option_Status.filter((data) => (data).value === String(status))[0].value; + + // console.log(" ### id = ", id, " ### local_step_name = ", local_step_name); + + + Update_Session_Formation_Only_Step(id, local_step_name); + } + //eeeee */ + + }, + [tasks] + ); + + + const [Update_Session_Formation_Only_Step_api, setUpdate_Session_Formation_Only_Step_api] = useState(); + const [Update_Session_Formation_Only_Step_message, setUpdate_Session_Formation_Only_Step_message] = useState(); + const [Update_Session_Formation_Only_Step_result, setUpdate_Session_Formation_Only_Step_result] = useState(); + function Update_Session_Formation_Only_Step(local_session_id, new_step) { + var form = new FormData(); + //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("_id", local_session_id); + form.append("session_etape", new_step); + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Update_SessionFormation_Only_Step/"; + + //setLoading(true); + axios.post(myurl, form).then(res => { + //console.log(" In Update_Session_Formation_Only_Step res.data.status = " + res.data.status); + //console.log(" In Update_Session_Formation_Only_Step res.data.message r_class = " + res.data.message); + + //setLoading(false); + if (String(res.data.status) === String("true")) { + setUpdate_Session_Formation_Only_Step_api("true"); + setUpdate_Session_Formation_Only_Step_result(res.data.message); + + setgridline_id(''); + + if (props.object_key && String(props.object_key).length > 2) { + + setLoading(true); + + let text = String(props.object_key); + + if (props.object_key === "class") { + Getall_TrainingSession_For_Given_Class(props.class_internal_url); + } else { + Getall_TrainingSession(); + GetCurrentSession(props.object_key, props.class_internal_url); + Display_session_From_Props(props.object_key, props.class_internal_url); + } + setLoading(false); + } else { + Getall_TrainingSession(); + window.scrollTo({ + top: 0, + behavior: "smooth", + }); + } + + + + } + else { + setUpdate_Session_Formation_Only_Step_api("false"); + setUpdate_Session_Formation_Only_Step_message(res.data.message); + alert(res.data.message); + } + + }).catch((error) => { + //setLoading(false); + console.warn('UpdateStagiaireData : Not good man :( Update_Session_Formation_Only_Step = ' + error); + setUpdate_Session_Formation_Only_Step_api("false"); + alert(" Impossible de mettre à jour la session de formation"); + + }) + } return ( @@ -14108,32 +14670,84 @@ const DisplayPartnerSession = (props) => {
+ + + + + {(!display_session_with_alert || display_session_with_alert !== true) &&
+
+ + +
+
} +
-
+ {(!data_row_grouped_by || String(data_row_grouped_by) === "") &&
+
+ + + + + + +
+ +
} + -
- - -
{(!display_session_with_alert || display_session_with_alert !== true) && -
+
  - { /> - -
+ } -
} - - {(display_session_with_alert && display_session_with_alert === true) && -
-   - { }} > - + +
+ {Session_step_chanel.map(channel => ( + +
+
{Session_step_chanel_label[channel]}
+
+ {tasks + .filter(item => item.session_etape === channel) + .map(item => ( + +
{ + setgridline_id(item.id); + + setsequence_gridline_id(""); + + setaddOneSession("0"); + setEdite_session("0"); + setsessionChanged(false); + //handleClick_edit_session_From_Line(newSelectionModel.row.id); + + setselected_session_id(item._id); + + setsession_selected_row_id(item.id); + setsession_selected_class_id(item.class_id); + + setselected_session_invoiced_statut(item.invoiced_statut); + + //console.log(" ### newSelectionModel.row.invoiced_statut = ", newSelectionModel.row.invoiced_statut); + + setDialog_2_message(String(JSON.parse(rowss[item.id]).title)); + setDialog_2_open(true); + }} + > + {String(item.is_session_alert) === "1" && } + {String(item.code_session).length > 30 && } + {String(item.code_session).length <= 30 && } + + + {String(item.titre).length > 30 && } + {String(item.titre).length <= 30 && } + +
+ +
+ ))} +
+
+
+ ))} +
+
+
+ + + } + + {data_row_grouped_by && String(data_row_grouped_by) === "etape" && + { setSelectionModel(newSelectionModel); /*if (newSelectionModel.length === 1) @@ -14556,7 +15360,7 @@ const DisplayPartnerSession = (props) => { localeText={frFR.components.MuiDataGrid.defaultProps.localeText} - rows={rowss.filter((data) => (JSON.parse(data)).is_session_alert === "1").map((item, index) => ( + rows={rowss.map((item, index) => ( { id: index, class_internal_url: JSON.parse(item).class_internal_url, @@ -14577,7 +15381,6 @@ const DisplayPartnerSession = (props) => { nb_preinscrit: JSON.parse(item).nb_preinscrit, duration: JSON.parse(item).duration_concat, class_external_code: JSON.parse(item).class_external_code, - class_id: JSON.parse(item).class_id, prix_session: JSON.parse(item).prix_session, published: JSON.parse(item).class_published, session_title: JSON.parse(item).titre, @@ -14591,6 +15394,7 @@ const DisplayPartnerSession = (props) => { is_session_alert: JSON.parse(item).is_session_alert, session_alert_message: JSON.parse(item).session_alert_message, + is_bpf: JSON.parse(item).is_bpf, } @@ -14612,12 +15416,14 @@ const DisplayPartnerSession = (props) => { setselected_session_id(newSelectionModel.row._id); + setsession_selected_row_id(newSelectionModel.row.id); + setsession_selected_class_id(newSelectionModel.row.class_id); - var result = JSON.parse(rowss.filter((data) => (JSON.parse(data))._id === newSelectionModel.row._id)); + setselected_session_invoiced_statut(newSelectionModel.row.invoiced_statut); - setsession_selected_row_id(result.id); + //console.log(" ### newSelectionModel.row.invoiced_statut = ", newSelectionModel.row.invoiced_statut); - setDialog_2_message(String(newSelectionModel.row.title)); + setDialog_2_message(String(JSON.parse(rowss[newSelectionModel.row.id]).title)); setDialog_2_open(true); }} @@ -14626,9 +15432,9 @@ const DisplayPartnerSession = (props) => { rowsPerPageOptions={[10]} disableSelectionOnClick - /* components={{ - Toolbar: GridToolbar, - }}*/ + /*components={{ + Toolbar: GridToolbar, + }}*/ //sx={datagridSx} getCellClassName={(params) => { @@ -14717,7 +15523,480 @@ const DisplayPartnerSession = (props) => { /> - + } + +
+ +
} + + {display_session_with_alert && display_session_with_alert === true && +
+   + {(!data_row_grouped_by || String(data_row_grouped_by) === "") && (!session_display_view || String(session_display_view) !== "kanban") && + + { + setSelectionModel(newSelectionModel); + /*if (newSelectionModel.length === 1) + handleClick_edit_session_From_Line(newSelectionModel);*/ + if (newSelectionModel.length !== 1) { + setaddOneParticipant(); + setdisplay_detail_insc(); + setselected_code_session(); + setsubmenu(); + } + }} + selectionModel={selectionModel} + + localeText={frFR.components.MuiDataGrid.defaultProps.localeText} + + + rows={rowss.filter((data) => (JSON.parse(data)).is_session_alert === "1").map((item, index) => ( + { + id: index, + class_internal_url: JSON.parse(item).class_internal_url, + code_session: JSON.parse(item).code_session, + _id: JSON.parse(item)._id, + date_debut: JSON.parse(item).date_debut, + date_fin: JSON.parse(item).date_fin, + distantiel: JSON.parse(item).distantiel, + presentiel: JSON.parse(item).presentiel, + statut: JSON.parse(item).session_status, + etape: JSON.parse(item).session_etape, + formateur: JSON.parse(item).formateur, + nb_participant: JSON.parse(item).nb_participant, + title: JSON.parse(item).titre, + domaine: JSON.parse(item).domaine, + taux_remplissage: JSON.parse(item).taux_remplissage, + nb_inscrit: JSON.parse(item).nb_inscrit, + nb_preinscrit: JSON.parse(item).nb_preinscrit, + duration: JSON.parse(item).duration_concat, + class_external_code: JSON.parse(item).class_external_code, + class_id: JSON.parse(item).class_id, + prix_session: JSON.parse(item).prix_session, + published: JSON.parse(item).class_published, + session_title: JSON.parse(item).titre, + + site_formation_id: JSON.parse(item).site_formation_id, + site_formation_nom: JSON.parse(item).site_formation_code, + invoiced_statut: JSON.parse(item).invoiced_statut, + + qty_in_quotation: JSON.parse(item).qty_in_quotation, + qty_in_quotation_list_quotation: JSON.parse(item).qty_in_quotation_list_quotation, + + is_session_alert: JSON.parse(item).is_session_alert, + session_alert_message: JSON.parse(item).session_alert_message, + + + } + ))} + + columns={columns} + pageSize={10} + className="datagridclass" + + onRowDoubleClick={(newSelectionModel) => { + setgridline_id(newSelectionModel.row.id); + + setsequence_gridline_id(""); + + setaddOneSession("0"); + setEdite_session("0"); + setsessionChanged(false); + //handleClick_edit_session_From_Line(newSelectionModel.row.id); + + setselected_session_id(newSelectionModel.row._id); + + + var result = JSON.parse(rowss.filter((data) => (JSON.parse(data))._id === newSelectionModel.row._id)); + + setsession_selected_row_id(result.id); + + setDialog_2_message(String(newSelectionModel.row.title)); + setDialog_2_open(true); + + }} + + + + rowsPerPageOptions={[10]} + disableSelectionOnClick + /* components={{ + Toolbar: GridToolbar, + }}*/ + //sx={datagridSx} + getCellClassName={(params) => { + + // Traitement du statut "facturé" + if (String(params.row.invoiced_statut) === "2") { + return 'line--statut--invoiced'; + } + + + //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 === "etape" + if (params.field === "etape" && String(params.value) == "0") { + return 'cell--etape--projet'; + } + + if (params.field === "etape" && String(params.value) == "1") { + return 'cell--etape--planification'; + } + + if (params.field === "etape" && String(params.value) == "2") { + return 'cell--etape--planifie'; + } + + if (params.field === "etape" && String(params.value) == "3") { + return 'cell--etape--termine'; + } + + if (params.field === "etape" && String(params.value) == "4") { + return 'cell--etape--facture'; + } + + if (params.field === "etape" && String(params.value) == "-1") { + return 'cell--etape--annule'; + } + + + + // Pour la gestion de la couleur de zone double cliquée + if (String(params.row.id) === String(gridline_id)) { + return 'line--statut--selected'; + } + else if (parseInt(String(params.row.id)) % 2 === 0) { + return 'line--statut--pair'; + } + else if (parseInt(String(params.row.id)) % 2 !== 0) { + return 'line--statut--impair'; + } + + }} + + getRowClassName={(params) => { + + // Pour la gestion de la couleur de zone double cliquée + if (String(params.row.id) === String(gridline_id)) { + + return 'line--statut--selected'; + } + else if (parseInt(String(params.row.id)) % 2 === 0) { + return 'line--statut--pair'; + } + else if (parseInt(String(params.row.id)) % 2 !== 0) { + return 'line--statut--impair'; + } + + }} + getEstimatedRowHeight={() => 200} + getRowHeight={() => "auto"} + sx={{ + "& .MuiDataGrid-cellContent": { + minHeight: 50, + + }, + [`& .${gridClasses.cell}`]: { + py: 1, + }, + }} + + + /> + + } + + {(!data_row_grouped_by || String(data_row_grouped_by) === "") && session_display_view && String(session_display_view) === "kanban" && + +
+ +
+ {Session_step_chanel.map(channel => ( + +
+
{Session_step_chanel_label[channel]}
+
+ {tasks + .filter(item => item.is_session_alert === "1") + .filter(item => item.session_etape === channel) + .map(item => ( + + +
{ + setgridline_id(item.id); + + setsequence_gridline_id(""); + + setaddOneSession("0"); + setEdite_session("0"); + setsessionChanged(false); + //handleClick_edit_session_From_Line(newSelectionModel.row.id); + + setselected_session_id(item._id); + + setsession_selected_row_id(item.id); + setsession_selected_class_id(item.class_id); + + setselected_session_invoiced_statut(item.invoiced_statut); + + //console.log(" ### newSelectionModel.row.invoiced_statut = ", newSelectionModel.row.invoiced_statut); + + setDialog_2_message(String(JSON.parse(rowss[item.id]).title)); + setDialog_2_open(true); + }} + > + {String(item.is_session_alert) === "1" && } + {String(item.code_session).length > 30 && } + {String(item.code_session).length <= 30 && } + + + {String(item.titre).length > 30 && } + {String(item.titre).length <= 30 && } + +
+ +
+ ))} +
+
+
+ ))} +
+
+
+ +
} +
} diff --git a/src/components/DisplayPartnerTrainingsPagination.js b/src/components/DisplayPartnerTrainingsPagination.js index 5d6acef..3ffa112 100644 --- a/src/components/DisplayPartnerTrainingsPagination.js +++ b/src/components/DisplayPartnerTrainingsPagination.js @@ -3061,7 +3061,7 @@ const DistplayPartnerTraningsPage = (props) => { onSelectionModelChange={(newSelectionModel) => { setSelectionModel(newSelectionModel); - console.log("ch selected--" + newSelectionModel); + // console.log("ch selected--" + newSelectionModel); }} selectionModel={selectionModel} localeText={frFR.components.MuiDataGrid.defaultProps.localeText} diff --git a/src/components/Partner.js b/src/components/Partner.js index 57fefb7..9d28f1d 100644 --- a/src/components/Partner.js +++ b/src/components/Partner.js @@ -2351,7 +2351,7 @@ const Partner = (props) => { object_key={orderid} class_internal_url={packs} read_access={check_user_acces_right("session", "read")} write_access={check_user_acces_right("session", "write")} - check_user_acces_right={check_user_acces_right} /> + check_user_acces_right={check_user_acces_right} reduce={"0"}/>
} @@ -3082,7 +3082,7 @@ const Partner = (props) => { + check_user_acces_right={check_user_acces_right} reduce={"1"} />
} diff --git a/src/components/Partner_Config_Session_Steps.js b/src/components/Partner_Config_Session_Steps.js index 385f5ec..212427b 100644 --- a/src/components/Partner_Config_Session_Steps.js +++ b/src/components/Partner_Config_Session_Steps.js @@ -171,7 +171,7 @@ const Partner_Configuration_Session_Steps = (props) => { function Getall_Parter_Session_Steps(event) { var form = new FormData(); - + const stored_cookie = getCookie('tokenmysypart'); form.append("token", stored_cookie); diff --git a/src/styles/components/_displaypartnersession.scss b/src/styles/components/_displaypartnersession.scss index b4280f7..6ee92b2 100644 --- a/src/styles/components/_displaypartnersession.scss +++ b/src/styles/components/_displaypartnersession.scss @@ -42,7 +42,7 @@ opacity: 100%; } - + .Mui-disabled { font-size: small !important; @@ -714,6 +714,26 @@ } + + .block_groupe_class { + width: 100%; + float: right; + + } + + .block_groupe_class_text { + width: 100%; + float: left; + text-align: left; + padding-top: 15px; + } + + .block_groupe_class_list { + width: 100%; + text-align: right; + float: left; + + } } @media only screen and (min-width: 601px) and (max-width: 991px) { @@ -1359,6 +1379,25 @@ } + .block_groupe_class { + width: 50%; + float: right; + + } + + .block_groupe_class_text { + width: 30%; + float: left; + text-align: left; + padding-top: 15px; + } + + .block_groupe_class_list { + width: 69%; + text-align: right; + float: left; + + } } @media only screen and (min-width: 992px) and (max-width: 1199px) { @@ -1929,6 +1968,25 @@ } + .block_groupe_class { + width: 50%; + float: right; + + } + + .block_groupe_class_text { + width: 45%; + float: left; + text-align: left; + padding-top: 15px; + } + + .block_groupe_class_list { + width: 54%; + text-align: right; + float: left; + + } } @media only screen and (min-width: 1200px) { @@ -2688,10 +2746,34 @@ + .block_groupe_class { + width: 30%; + float: right; + + } + + .block_groupe_class_text { + width: 30%; + float: left; + text-align: left; + padding-top: 15px; + } + + .block_groupe_class_list { + width: 65%; + text-align: right; + float: left; + + } } // end media + /* .mode_affichage:hover:active, + .mode_affichage:hover { + background-color: #e7f3fb; + }*/ + .DialogContent_width_700px { width: 700px !important;