From cf3199ec45a846ef52ab3f4b33213436b0a806b1 Mon Sep 17 00:00:00 2001 From: cherif Date: Fri, 16 Aug 2024 15:59:56 +0200 Subject: [PATCH] ssss --- src/components/Config_Document_Super_Admin.js | 2 +- src/components/Formation.js | 2 +- src/components/Partner_Commande.js | 307 ++++++++++-------- 3 files changed, 167 insertions(+), 144 deletions(-) diff --git a/src/components/Config_Document_Super_Admin.js b/src/components/Config_Document_Super_Admin.js index bda373c..8c1b65b 100644 --- a/src/components/Config_Document_Super_Admin.js +++ b/src/components/Config_Document_Super_Admin.js @@ -3292,7 +3292,7 @@ const Config_Documents_Super_Admin = (props) => { {String(p_one_detail_type_doc) === "email" &&
Joindre en PDF
- { const [GetCurrentClass_trainingsession_cities_api, setGetCurrentClass_trainingsession_cities_api] = useState(); const [GetCurrentClass_trainingsession_cities_message, setGetCurrentClass_trainingsession_cities_message] = useState(); - const [GetCurrentClass_trainingsession_cities_result, setGetCurrentClass_trainingsession_cities_result] = useState(); + const [GetCurrentClass_trainingsession_cities_result, setGetCurrentClass_trainingsession_cities_result] = useState([]); function GetCurrentClass_trainingsession_cities(event) { var form = new FormData(); diff --git a/src/components/Partner_Commande.js b/src/components/Partner_Commande.js index 384bf48..e451a72 100644 --- a/src/components/Partner_Commande.js +++ b/src/components/Partner_Commande.js @@ -26,7 +26,7 @@ import moment from "moment"; import InputAdornment from '@mui/material/InputAdornment'; import { AiFillCloseCircle } from "react-icons/ai"; import Box from '@mui/material/Box'; - +import { gridClasses } from '@mui/x-data-grid'; import { CiTrash } from "react-icons/ci"; import { MdAddCircleOutline, MdRemoveCircleOutline } from "react-icons/md"; import Dialog from '@mui/material/Dialog'; @@ -54,7 +54,7 @@ import { TreeItem } from '@mui/x-tree-view/TreeItem'; import { makeStyles } from "@material-ui/core/styles"; import CancelPresentationIcon from '@mui/icons-material/CancelPresentation'; import { IconButton } from '@material-ui/core'; - +import Checkbox from '@mui/material/Checkbox'; const useStyles = makeStyles((theme) => ({ @@ -257,12 +257,13 @@ const Partner_Commande = (props) => { { field: 'order_line_formation', headerName: 'intenal_url', width: 0, hide: true, editable: false }, { field: 'order_line_session_id', headerName: 'session_id', width: 0, hide: true, editable: false }, - { field: 'order_line_formation_title', headerName: 'Titre', minwidth: 200, flex: 1, hideable: true, resizable: true, renderCell: (params) => , }, - { field: 'order_line_session_code', headerName: 'Code Session', minwidth: 200, flex: 1, hideable: true, resizable: true, + { field: 'order_line_formation_title', headerName: 'Titre', minWidth: 200, flex: 1, renderCell: (params) => , }, + { + field: 'order_line_session_code', headerName: 'Code Session', minwidth: 200, flex: 1, hideable: true, resizable: true, renderCell: (cellValues) => { return ( - ); }, }, - { - field: "Session", headerName: 'Sessionii', - renderCell: (cellValues) => { - return ( - - - ); - } - }, - - { field: 'order_line_formation_external_code', headerName: 'Code Formation', minwidth: 200, flex: 1, hideable: true, resizable: true, renderCell: (params) => , }, + { field: 'order_line_formation_external_code', headerName: 'Code Formation', minwidth: 200, flex: 1, hideable: true, resizable: true, renderCell: (params) => , }, { field: 'order_line_formation_duration', headerName: 'Durée', width: 80, hide: false, editable: false }, { field: 'order_line_qty', headerName: 'Qte', width: 100, hide: false, editable: false }, { field: 'order_line_prix_unitaire', headerName: 'Prix Unit.', width: 100, hide: false, editable: false }, @@ -4242,6 +4213,7 @@ const Partner_Commande = (props) => { setnew_session_date_fin(""); setnew_session_nb_place(""); setnew_session_code(""); + setnew_session_with_resa(false); setDialog_Create_Session_open(false); }; @@ -4250,6 +4222,7 @@ const Partner_Commande = (props) => { const [new_session_date_fin, setnew_session_date_fin] = useState(); const [new_session_code, setnew_session_code] = useState(""); const [new_session_nb_place, setnew_session_nb_place] = useState(""); + const [new_session_with_resa, setnew_session_with_resa] = useState(false); const filterPassedTime_start = (time) => { const currentDate = new Date(); @@ -4271,14 +4244,22 @@ const Partner_Commande = (props) => { const stored_cookie = getCookie('tokenmysypart'); form.append("token", stored_cookie); - form.append("date_debut", format(new_session_date_debut, 'dd/MM/yyyy')); + form.append("date_debut", format(new_session_date_debut, 'dd/MM/yyyy')); form.append("date_fin", format(new_session_date_fin, 'dd/MM/yyyy')); form.append("nb_participant", new_session_nb_place); form.append("class_id", selected_order_line_class_id); form.append("code_session", new_session_code); form.append("quotation_line_id", selected_order_line_id); - console.log(" form == ", form); + if (new_session_with_resa) + form.append("resa_inscrit", "1"); + else { + form.append("resa_inscrit", "0"); + + } + + + //console.log(" form == ", form); var myurl = process.env.REACT_APP_API_URL + "myclass/api/Add_SessionFormation_From_Quotation_Line/"; @@ -4297,6 +4278,7 @@ const Partner_Commande = (props) => { Close_Dialog_Create_Session_open(); handleClick_edit_order_From_Line(selected_order_line_row_number_id); + Getall_TrainingSession(); alert(res.data.message); /*if (document.getElementById('myRef_head')) { @@ -4325,6 +4307,43 @@ const Partner_Commande = (props) => { }) } + const datagridSx = { + borderRadius: 2, + marginRight: 1, + marginLeft: 1, + border: 0, + overflowX: 'scroll', + "& .MuiDataGrid-main": { borderRadius: 0 }, + /*'& div[data-rowIndex][role="row"]:nth-of-type(5n-4)': { + color: "blue", + fontSize: 18, + //risky + minHeight: "60px !important", + height: 60, + "& div": { + minHeight: "60px !important", + height: 60, + lineHeight: "59px !important" + } + },*/ + "& .MuiDataGrid-virtualScrollerRenderZone": { + "& .MuiDataGrid-row": { + "&:nth-child(2n)": { backgroundColor: "rgba(235, 235, 235, .7)" } + } + }, + "& .MuiDataGrid-columnHeaders": { + backgroundColor: "#c8cfd5", + color: "black", + fontSize: 16 + }, + + [`& .${gridClasses.cell}`]: { + py: 1, + }, + + }; + + return ( @@ -4369,76 +4388,76 @@ const Partner_Commande = (props) => {
- - Date début - { - let local_date = new Date(date).getTime(); - let date_end_session = new Date(new_session_date_fin).getTime(); - let date_start_session = new Date(new_session_date_debut).getTime(); + Date début + { - /* console.log(" local_date = ", local_date); - console.log(" date_end_session = ", date_end_session); - console.log(" date_start_session = ", date_start_session);*/ + let local_date = new Date(date).getTime(); + let date_end_session = new Date(new_session_date_fin).getTime(); + let date_start_session = new Date(new_session_date_debut).getTime(); - if (local_date > date_end_session) { - alert(" La date est après la fin de la session"); - return; - } + /* console.log(" local_date = ", local_date); + console.log(" date_end_session = ", date_end_session); + console.log(" date_start_session = ", date_start_session);*/ - - setnew_session_date_debut(date); + if (local_date > date_end_session) { + alert(" La date est après la fin de la session"); + return; } - } - showTimeSelect={false} - filterTime={filterPassedTime_start} - dateFormat="dd/MM/yyyy" - className="disabled_style " - locale='fr-FR' - /> + + setnew_session_date_debut(date); + } + } + showTimeSelect={false} + filterTime={filterPassedTime_start} + dateFormat="dd/MM/yyyy" + className="disabled_style " + + locale='fr-FR' + />
- - - Date fin - { - - let local_date = new Date(date).getTime(); - let date_end_session = new Date(new_session_date_fin).getTime(); - let date_start_session = new Date(new_session_date_debut).getTime(); - + Date fin + { - if (local_date < date_start_session) { - alert(" La date est avant le début de la session"); - return; - } + let local_date = new Date(date).getTime(); + let date_end_session = new Date(new_session_date_fin).getTime(); + let date_start_session = new Date(new_session_date_debut).getTime(); - setnew_session_date_fin(date); + + + if (local_date < date_start_session) { + alert(" La date est avant le début de la session"); + return; } - } - showTimeSelect={false} - filterTime={filterPassedTime_start} - dateFormat="dd/MM/yyyy" - className="disabled_style" - fullWidth - locale='fr-FR' - /> - + + setnew_session_date_fin(date); + } + } + showTimeSelect={false} + filterTime={filterPassedTime_start} + dateFormat="dd/MM/yyyy" + className="disabled_style" + fullWidth + locale='fr-FR' + + /> +
@@ -4478,6 +4497,20 @@ const Partner_Commande = (props) => {
+
Avec résa. inscriptions + { + setnew_session_with_resa(e.target.checked); + + }} + + /> + +
+ @@ -4832,10 +4865,11 @@ const Partner_Commande = (props) => { onChange={(event, value) => { - if (value._id) { + if (value && value._id) { setp_add_line_session_id(value._id); setp_add_line_session_code(value.code_session); } else { + setp_add_line_session_id(""); setp_add_line_session_code(""); } @@ -7419,44 +7453,29 @@ const Partner_Commande = (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 }, + '& .line--statut--selected': { + backgroundColor: '#FBF2EF', + color: 'black', + }, + '& .line--statut--pair': { + backgroundColor: 'rgba(235, 235, 235, .7)', + color: 'black', + }, + '& .line--statut--impair': { + backgroundColor: '#FFFFFF', + color: 'black', + }, + [`& .${gridClasses.cell}`]: { + py: 1, + }, }} > { pageSize={10} className="datagridclass" + onRowDoubleClick={(newSelectionModel) => { handleClick_edit_order_From_Line(newSelectionModel.row.id); @@ -7520,6 +7540,9 @@ const Partner_Commande = (props) => { Toolbar: GridToolbar, }} + getEstimatedRowHeight={() => 200} + getRowHeight={() => "auto"} + />