recette2
cherif 2024-08-16 15:59:56 +02:00
parent 9794b24b00
commit cf3199ec45
3 changed files with 167 additions and 144 deletions

View File

@ -217,7 +217,7 @@ const Formation = (props) => {
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();

View File

@ -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,50 +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) => <ExpandableCell_50 {...params} />, },
{ field: 'order_line_session_code', headerName: 'Code Session', minwidth: 200, flex: 1, hideable: true, resizable: true,
renderCell: (cellValues) => {
return (
<nav>
{String(cellValues.row.order_line_session_id).length > 3 && <div>
{cellValues.row.order_line_session_code} a
</div>}
{String(cellValues.row.order_line_session_id).length <= 3 &&
String(cellValues.row.order_line_class_id).length >= 3 &&
(String(cellValues.row.order_line_status) === "1" ||
String(cellValues.row.order_line_status) === "3") &&
<Button
onClick={(event) => {
setselected_order_line_row_number_id(cellValues.row.id);
setnew_session_nb_place(cellValues.row.order_line_qty);
setselected_order_line_class_id(cellValues.row.order_line_class_id);
setselected_order_line_id(cellValues.row._id);
setnew_session_code("Sess_"+cellValues.row.order_header_ref_interne);
setDialog_Create_Session_open(true);
}}
>
Creat Sess b
</Button>}
</nav>
);
},
},
{ field: 'order_line_formation_title', headerName: 'Titre', minWidth: 200, flex: 1, renderCell: (params) => <ExpandableCell_50 {...params} />, },
{
field: "Session", headerName: 'Sessionii',
field: 'order_line_session_code', headerName: 'Code Session', minwidth: 200, flex: 1, hideable: true, resizable: true,
renderCell: (cellValues) => {
return (
<nav>
<nav style={{ width: '100%', 'textAlign': 'center' }}>
{String(cellValues.row.order_line_session_id).length > 3 && <div>
{cellValues.row.order_line_session_code} a
@ -311,6 +274,7 @@ const Partner_Commande = (props) => {
String(cellValues.row.order_line_class_id).length >= 3 &&
(String(cellValues.row.order_line_status) === "1" ||
String(cellValues.row.order_line_status) === "3") &&
String(cellValues.row.order_line_type) === "devis" && <nav>
<Button
@ -319,19 +283,26 @@ const Partner_Commande = (props) => {
setnew_session_nb_place(cellValues.row.order_line_qty);
setselected_order_line_class_id(cellValues.row.order_line_class_id);
setselected_order_line_id(cellValues.row._id);
setnew_session_code("Sess_"+cellValues.row.order_header_ref_interne);
setnew_session_code("Sess_" + cellValues.row.order_header_ref_interne);
setDialog_Create_Session_open(true);
}}
>
Creat Sess b
</Button>}
variant="outlined"
>
<IoAddCircleOutline style={{ "fontSize": "large", "color": "green" }} />
</Button>
</nav>}
</nav>
);
}
},
},
{ field: 'order_line_formation_external_code', headerName: 'Code Formation', minwidth: 200, flex: 1, hideable: true, resizable: true, renderCell: (params) => <ExpandableCell_50 {...params} />, },
{ field: 'order_line_formation_duration', headerName: 'Durée', width: 80, 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();
@ -4278,7 +4251,15 @@ const Partner_Commande = (props) => {
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 (
@ -4478,6 +4497,20 @@ const Partner_Commande = (props) => {
</div>
<div className="session_caract_Dialog" > Avec résa. inscriptions
<Checkbox
name="session_resa"
// className="disabled_style"
checked={new_session_with_resa}
onChange={(e) => {
setnew_session_with_resa(e.target.checked);
}}
/>
</div>
</DialogContent>
@ -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,
},
}}
>
<DataGrid
@ -7509,6 +7528,7 @@ const Partner_Commande = (props) => {
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"}
/>
</Box>