26/08/23 - 20h

recette2
cherif 2023-08-26 19:57:52 +02:00
parent 426bc94fa0
commit 50f743d7af
4 changed files with 1177 additions and 82 deletions

View File

@ -4612,7 +4612,7 @@ const DisplayPartnerSession = (props) => {
<MenuItem value="1" style={{ "paddingLeft": "5px", "textAlign": "left", "background": "green" }}>Actif &nbsp;</MenuItem>
</TextField>
</div>}
{!edit_session_form && String(p_session_status) === "1" && <div className="session_caract">Statut a * <br />
{!edit_session_form && String(p_session_status) === "1" && <div className="session_caract">Statut * <br />
<TextField
name="session_status_not_change_font"
id="session_status_not_change_font"
@ -4641,7 +4641,7 @@ const DisplayPartnerSession = (props) => {
/>
</div>}
{!edit_session_form && String(p_session_status) === "0" && <div className="session_caract">Statut a * <br />
{!edit_session_form && String(p_session_status) === "0" && <div className="session_caract">Statut * <br />
<TextField
name="session_status_not_change_font"
id="session_status_not_change_font"

File diff suppressed because it is too large Load Diff

View File

@ -45,6 +45,9 @@ const Employes = (props) => {
const [rowss, setRows] = useState([]);
const [selectionModel, setSelectionModel] = React.useState([]);
const [rows_affectations, setrows_affectations] = useState([]);
const [selectionModel_affectations, setSelectionModel_affectations] = React.useState([]);
const [p_filtre1, setp_filtre1] = useState();
const [p_filtre1_value, setp_filtre1_value] = useState();
@ -93,7 +96,7 @@ const Employes = (props) => {
{ field: 'profil', headerName: 'profil', width: 150, hide: false, editable: true },
{ field: 'fonction', headerName: 'Fonction', width: 150, hide: false, editable: true },
{
/* {
field: "Detail", headerName: 'Voir detail',
renderCell: (cellValues) => {
return (
@ -110,7 +113,7 @@ const Employes = (props) => {
);
}
},
},*/
{
field: "delete", headerName: 'Supprimer',
renderCell: (cellValues) => {
@ -174,6 +177,16 @@ const Employes = (props) => {
]
const columns_employee_affectation = [
{ field: '_id', headerName: '_id', hide: true },
{ field: 'id', headerName: 'id', hide: true },
{ field: 'poste', headerName: 'Poste', width: 150, hideable: false, },
{ field: 'date_du', headerName: 'Du', width: 150, hide: false, editable: true },
{ field: 'date_au', headerName: 'Au', width: 150, hide: false, editable: true },
{ field: 'target_related_collection', headerName: 'Type', width: 150, hide: false, editable: true },
{ field: 'target_related_collection_id', headerName: 'Type ID', width: 150, hide: false, editable: true },
]
function clean_all_filters() {
setp_filtre1();
setp_filtre1_value();
@ -223,6 +236,8 @@ const Employes = (props) => {
const [selected_employe_email, setselected_employe_email] = useState("");
function handleClick_edit_session_From_Line(selected_row_id) {
submenu_detail_employe();
var line = JSON.parse(rowss[selected_row_id]);
//console.log("### line = ", line);
@ -238,6 +253,8 @@ const Employes = (props) => {
if (myRef.current) {
myRef.current.scrollIntoView({ behavior: "smooth" });
}
Getall_Employee_Affectation(employe_id);
}
@ -565,11 +582,13 @@ const Employes = (props) => {
else {
setGetall_Training_Employee_No_Filter_api("false");
setGetall_Training_Employee_No_Filter_message(res.data.message);
alert(res.data.message);
}
}).catch((error) => {
console.warn('Not good man :( Getall_Training_Employee_No_Filter = ', error);
setGetall_Training_Employee_No_Filter_api("false");
alert(" Impossible de recuperer la liste des employés");
//setmyApimyApiMessage("")
})
}
@ -645,6 +664,45 @@ const Employes = (props) => {
}
const [Getall_Employee_Affectation_api, setGetall_Employee_Affectation_api] = useState();
const [Getall_Employee_Affectation_message, setGetall_Employee_Affectation_message] = useState();
const [Getall_Employee_Affectation_result, setGetall_Employee_Affectation_result] = useState();
function Getall_Employee_Affectation(local_employe_id) {
var form = new FormData();
const stored_cookie = getCookie('tokenmysypart');
form.append("token", stored_cookie);
form.append("rh_id", local_employe_id);
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Ressource_Humaine_Affectation/";
axios.post(myurl, form).then(res => {
if (String(res.data.status) === String("true")) {
//console.log(" In Getall_Employee_Affectation res.data.status = " + res.data.status);
//console.log(" In Getall_Employee_Affectation res.data.message r_class = " + res.data.message);
setGetall_Employee_Affectation_api("true");
setGetall_Employee_Affectation_result(res.data.message);
setrows_affectations(res.data.message);
}
else {
setGetall_Employee_Affectation_api("false");
setGetall_Employee_Affectation_message(res.data.message);
alert(res.data.message)
}
}).catch((error) => {
console.warn('Not good man :( Getall_Employee_Affectation = ', error);
setGetall_Employee_Affectation_api("false");
alert(" Impossible de recuperer les affectations de l'employé");
//setmyApimyApiMessage("")
})
}
function disable_Employee_DetailFields() {
setemployee_data_edit_mode("0");
@ -1381,6 +1439,96 @@ const Employes = (props) => {
hiddenFileInput_session.current.click();
}
const sleep = (milliseconds) => {
return new Promise(resolve => setTimeout(resolve, milliseconds))
}
async function submenu_detail_employe() {
setsubmenu("detail_employe");
await sleep(5);
/*if (!edit_session_form) {
desableSessionFields();
}*/
if (document.getElementById("detail_employe")) {
document.getElementById("detail_employe").style.backgroundColor = "#104277";
document.getElementById("detail_employe").style.color = "white";
}
if (document.getElementById("droit_acces")) {
document.getElementById("droit_acces").style.backgroundColor = "#d8edfc";
document.getElementById("droit_acces").style.color = "black";
}
if (document.getElementById("affectation")) {
document.getElementById("affectation").style.backgroundColor = "#d8edfc";
document.getElementById("affectation").style.color = "black";
}
//console.log(" ### employee_data_edit_mode = ", employee_data_edit_mode);
if (String(employee_data_edit_mode) !== "1")
disable_Employee_DetailFields();
}
async function submenu_affectation() {
setsubmenu("affectation");
await sleep(5);
/*if (!edit_session_form) {
desableSessionFields();
}*/
if (document.getElementById("affectation")) {
document.getElementById("affectation").style.backgroundColor = "#104277";
document.getElementById("affectation").style.color = "white";
}
if (document.getElementById("detail_employe")) {
document.getElementById("detail_employe").style.backgroundColor = "#d8edfc";
document.getElementById("detail_employe").style.color = "black";
}
if (document.getElementById("droit_acces")) {
document.getElementById("droit_acces").style.backgroundColor = "#d8edfc";
document.getElementById("droit_acces").style.color = "black";
}
}
async function submenu_droit_acces() {
setsubmenu("droit_acces");
await sleep(5);
/*if (!edit_session_form) {
desableSessionFields();
}*/
if (document.getElementById("droit_acces")) {
document.getElementById("droit_acces").style.backgroundColor = "#104277";
document.getElementById("droit_acces").style.color = "white";
}
if (document.getElementById("detail_employe")) {
document.getElementById("detail_employe").style.backgroundColor = "#d8edfc";
document.getElementById("detail_employe").style.color = "black";
}
if (document.getElementById("affectation")) {
document.getElementById("affectation").style.backgroundColor = "#d8edfc";
document.getElementById("affectation").style.color = "black";
}
}
return (
<div className="employes">
<Dialog
@ -1899,9 +2047,10 @@ const Employes = (props) => {
</div>
<div className="div_row"> &nbsp;</div>
<div className="div_row">
<Button variant="outlined" ref={myRef} onClick={"submenu_detail_stagaire"} className="detail_class_submenu" id='detail_session' name='detail_session'>Détail employé</Button>
<Button variant="outlined" onClick={"submenu_preinscrit"} className="detail_class_submenu" id='preinscrit' name='preinscrit'>Droits d'acces () </Button>
<Button variant="outlined" onClick={"submenu_inscrit"} className="detail_class_submenu" id='inscrit' name='inscrit'>Affectation () </Button>
<Button variant="outlined" ref={myRef} onClick={submenu_detail_employe} className="detail_class_submenu" id='detail_employe' name='detail_employe'>Détail employé</Button>
<Button variant="outlined" onClick={submenu_droit_acces} className="detail_class_submenu" id='droit_acces' name='droit_acces'>Droits d'acces </Button>
<Button variant="outlined" onClick={submenu_affectation} className="detail_class_submenu" id='affectation' name='affectation'>Affectation </Button>
</div>
@ -1909,7 +2058,7 @@ const Employes = (props) => {
{String(display_detail_employe) === "1" && String(add_One_Employee) !== "1" && <div className="div_row">
{String(submenu) === "detail_employe" && String(add_One_Employee) !== "1" && <div className="div_row">
<nav style={{ "border": "None", "fontSize": "22px", "fontWeight": "600" }}> Détail Employé </nav>
<div className="div_row" style={{ "border": "None" }}>
<div className="div_row_gauche">
@ -2445,7 +2594,7 @@ const Employes = (props) => {
{String(display_detail_employe) !== "1" && String(add_One_Employee) === "1" && <div className="div_row">
{String(submenu) === "detail_employe" && String(add_One_Employee) === "1" && <div className="div_row">
<nav style={{ "border": "None", "fontSize": "22px", "fontWeight": "600" }}> Ajouter un Employé </nav>
<div className="session_data" >
@ -2853,10 +3002,151 @@ const Employes = (props) => {
<div className="div_row">
{String(submenu) === "affectation" && <div className="div_row">
<nav style={{ "border": "None", "fontSize": "22px", "fontWeight": "600" }}> Affectation </nav>
<div className="session_data">
<div style={{ "border": "None" }}>
<div style={{ height: 550, width: '100%', paddingRight: '1px' }}>
&nbsp;
<Box
sx={{
height: 500,
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
},
}}
>
<DataGrid
checkboxSelection
onSelectionModelChange={(newSelectionModel) => {
setSelectionModel_affectations(newSelectionModel);
/*if (newSelectionModel.length === 1)
handleClick_edit_session_From_Line(newSelectionModel);
if (newSelectionModel.length === 0) {
setdisplay_detail_employe();
setadd_One_Employee();
}*/
}}
selectionModel={selectionModel_affectations}
localeText={frFR.components.MuiDataGrid.defaultProps.localeText}
rows={rows_affectations.map((item, index) => (
{
id: index,
_id: JSON.parse(item)._id,
poste: JSON.parse(item).poste,
date_du: JSON.parse(item).date_du,
date_au: JSON.parse(item).date_au,
target_related_collection: JSON.parse(item).target_related_collection,
target_related_collection_id: JSON.parse(item).target_related_collection_id,
}
))}
columns={columns_employee_affectation}
pageSize={10}
className="datagridclass"
rowsPerPageOptions={[10]}
//disableSelectionOnClick
components={{
Toolbar: GridToolbar,
}}
//sx={datagridSx}
getCellClassName={(params) => {
//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 === "statut"
if (params.field === "status" && String(params.value) == "0") {
return 'cell--statut--preinscrit';
}
if (params.field === "status" && String(params.value) == "1") {
return 'cell--statut--inscrit';
}
if (params.field === "status" && String(params.value) == "-1") {
return 'cell--statut--annule';
}
}}
getRowClassName={(params) => {
if (String(params.row.status) === "-1") {
return 'line--statut--annule';
}
if (String(params.row.status) === "0") {
return 'line--statut--preinscrit';
}
if (String(params.row.status) === "1") {
return 'line--statut--inscrit';
}
}}
/>
</Box>
<br />
</div>
</div>
</div>
</div>}
{String(submenu) === "droit_acces" && <div className="div_row">
<nav style={{ "border": "None", "fontSize": "22px", "fontWeight": "600" }}> Droit Acces </nav>
</div>}
</div >
);
}

View File

@ -62,7 +62,8 @@ const Partner_Client = (props) => {
{ field: 'email', headerName: 'email', width: 100, hideable: false, flex: 1 },
{ field: 'nom', headerName: 'nom', width: 100, hide: false, editable: true, flex: 1 },
{
/*{
field: "update", headerName: 'Modifier',
renderCell: (cellValues) => {
return (
@ -75,7 +76,7 @@ const Partner_Client = (props) => {
);
}
},
},*/
{
field: "delete", headerName: 'Supprimer',
renderCell: (cellValues) => {