13/12/2023 - 23h30
parent
e0742a4d14
commit
1fc4fe31cb
|
@ -37,17 +37,14 @@ import DialogActions from '@mui/material/DialogActions';
|
|||
import DialogContent from '@mui/material/DialogContent';
|
||||
import DialogContentText from '@mui/material/DialogContentText';
|
||||
import DialogTitle from '@mui/material/DialogTitle';
|
||||
import { TransitionProps } from '@mui/material/transitions';
|
||||
import { Checkbox } from "@mui/material";
|
||||
import { ElectricScooterRounded } from "@mui/icons-material";
|
||||
import { Container, Row, Col } from 'react-grid-system';
|
||||
|
||||
import Visibility from '@mui/icons-material/Visibility';
|
||||
import VisibilityOff from '@mui/icons-material/VisibilityOff';
|
||||
import { Fab } from "@material-ui/core";
|
||||
import { IoMdAddCircle, IoIosRemoveCircleOutline } from "react-icons/io";
|
||||
import { AiTwotoneEdit, AiTwotoneSave } from "react-icons/ai";
|
||||
import { ConsoleView } from "react-device-detect";
|
||||
|
||||
import img_loading_spin from "./../mysy_img/mysy_spin_loading.gif";
|
||||
|
||||
const Employes = (props) => {
|
||||
const history = useHistory();
|
||||
|
@ -58,6 +55,8 @@ const Employes = (props) => {
|
|||
const [rows_affectations, setrows_affectations] = useState([]);
|
||||
const [selectionModel_affectations, setSelectionModel_affectations] = React.useState([]);
|
||||
|
||||
const [selectionModel_contrat, setselectionModel_contrat] = React.useState([]);
|
||||
|
||||
|
||||
const [rows_acces_right, setrows_acces_right] = useState([]);
|
||||
const [selectionModel_acces_right, setselectionModel_acces_right] = React.useState([]);
|
||||
|
@ -311,6 +310,80 @@ const Employes = (props) => {
|
|||
|
||||
]
|
||||
|
||||
const columns_employee_contrat = [
|
||||
{ field: '_id', headerName: '_id', hide: true },
|
||||
{ field: 'id', headerName: 'id', hide: true },
|
||||
{ field: 'rh_id', headerName: 'rh_id', flex: 1, hideable: false, hide: true, },
|
||||
{ field: 'date_debut', headerName: 'Du', width: 150, hide: false, },
|
||||
{ field: 'date_fin', headerName: 'Au', width: 150, hide: false, },
|
||||
{ field: 'type_contrat', headerName: 'Type Contrat', flex: 1, hide: false, width: 150,},
|
||||
{ field: 'type_employe', headerName: 'Type Employé', flex: 1, hide: false, width: 150,},
|
||||
|
||||
{
|
||||
field: "delete", headerName: 'Supprimer',
|
||||
renderCell: (cellValues) => {
|
||||
return (
|
||||
|
||||
<Popup
|
||||
trigger={<Button
|
||||
|
||||
onClick={(event) => {
|
||||
//handleClick_delete(event, cellValues);
|
||||
}}
|
||||
>
|
||||
<CiTrash />
|
||||
|
||||
</Button>}
|
||||
modal
|
||||
nested
|
||||
position="center center"
|
||||
>
|
||||
{close => (
|
||||
<div>
|
||||
<button className="gest_close" onClick={close}>
|
||||
×
|
||||
</button>
|
||||
<div className="gest_header"> MySy Information </div>
|
||||
<div className="gest_content">
|
||||
{' '}
|
||||
|
||||
En confirmant cette opération, le contrat sera <i><font color="red"> définitivement supprimé</font></i>. <br />
|
||||
|
||||
</div>
|
||||
<div className="gest_actions">
|
||||
<div style={{ "width": "45%", "float": "left" }}>
|
||||
<button className="gest_bton_popup" onClick={(event) => {
|
||||
//handleClick_delete_affection(event, cellValues);
|
||||
//console.log('modal closed ');
|
||||
close();
|
||||
}}> Valider </button>
|
||||
|
||||
</div>
|
||||
<div style={{ "width": "45%", "float": "right" }}>
|
||||
<button
|
||||
className="gest_bton_popup"
|
||||
onClick={() => {
|
||||
//console.log('modal closed ');
|
||||
close();
|
||||
}}
|
||||
>
|
||||
Annuler
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</Popup>
|
||||
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
]
|
||||
|
||||
|
||||
const [tabledata, settabledata] = useState([]);
|
||||
const [rows_acces_right_v2, setrows_acces_right_v2] = useState([]);
|
||||
|
||||
|
@ -432,6 +505,47 @@ const Employes = (props) => {
|
|||
}
|
||||
|
||||
|
||||
const [Getall_Employee_Contrat_api, setGetall_Employee_Contrat_api] = useState();
|
||||
const [Getall_Employee_Contrat_message, setGetall_Employee_Contrat_message] = useState();
|
||||
const [Getall_Employee_Contrat_result, setGetall_Employee_Contrat_result] = useState([]);
|
||||
function Getall_Employee_Contrat(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_Employee_Contrat/";
|
||||
|
||||
|
||||
|
||||
axios.post(myurl, form).then(res => {
|
||||
|
||||
if (String(res.data.status) === String("true")) {
|
||||
//console.log(" In Getall_Employee_Contrat res.data.status = " + res.data.status);
|
||||
//console.log(" In Getall_Employee_Contrat res.data.message r_class = " + res.data.message);
|
||||
setGetall_Employee_Contrat_api("true");
|
||||
setGetall_Employee_Contrat_result(res.data.message);
|
||||
|
||||
}
|
||||
else {
|
||||
setGetall_Employee_Contrat_api("false");
|
||||
setGetall_Employee_Contrat_message(res.data.message);
|
||||
alert(res.data.message)
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
console.warn('Not good man :( Getall_Employee_Contrat = ', error);
|
||||
setGetall_Employee_Contrat_api("false");
|
||||
alert(" Impossible de recuperer les contrat de l'employé");
|
||||
//setmyApimyApiMessage("")
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
function clean_all_filters() {
|
||||
|
@ -605,6 +719,8 @@ const Employes = (props) => {
|
|||
|
||||
Getall_Employee_Affectation(employe_id);
|
||||
Getall_Employee_Acces_Right(employe_id);
|
||||
Getall_Employee_Contrat(employe_id);
|
||||
Get_Partner_Purchase_Prices();
|
||||
|
||||
Get_List_Of_All_PJ(employe_id);
|
||||
|
||||
|
@ -3669,9 +3785,106 @@ const Employes = (props) => {
|
|||
}
|
||||
// -- end champs specifiques
|
||||
|
||||
const [Dialog_employe_contrat_open, setDialog_employe_contrat_open] = React.useState(false);
|
||||
|
||||
function func_Dialog_employe_contrat_open(message) {
|
||||
setDialog_employe_contrat_open(true);
|
||||
}
|
||||
|
||||
const Dialog_employe_contrat_open_handleClose = () => {
|
||||
//alert(" Utiliser le bouton 'fermer' ");
|
||||
//setOpen(false);
|
||||
};
|
||||
|
||||
const Dialog_employe_contrat_handleClose_buton = () => {
|
||||
|
||||
|
||||
setDialog_employe_contrat_open(false);
|
||||
};
|
||||
|
||||
const Dialog_employe_contrat_handleClose = () => {
|
||||
setDialog_employe_contrat_open(false);
|
||||
};
|
||||
|
||||
const [selected_contrat_id, setselected_contrat_id] = useState();
|
||||
|
||||
const [p_employe_contrat_type_contrat, setp_employe_contrat_type_contrat] = useState("");
|
||||
const [p_employe_contrat_type_employe, setp_employe_contrat_type_employe] = useState("");
|
||||
const [p_employe_contrat_cout, setp_employe_contrat_cout] = useState("");
|
||||
const [p_employe_contrat_groupe_prix_achat_id, setp_employe_contrat_groupe_prix_achat_id] = useState("");
|
||||
|
||||
const [p_employe_contrat_date_debut, setp_employe_contrat_date_debut] = useState(new Date().toLocaleDateString('fr-FR'));
|
||||
const [p_employe_contrat_date_fin, setp_employe_contrat_date_fin] = useState(date_today_90j.toLocaleDateString('fr-FR'));
|
||||
|
||||
const [Get_Partner_Purchase_Prices_api, setGet_Partner_Purchase_Prices_api] = useState();
|
||||
const [Get_Partner_Purchase_Prices_message, setGet_Partner_Purchase_Prices_message] = useState();
|
||||
const [Get_Partner_Purchase_Prices_result, setGet_Partner_Purchase_Prices_result] = useState([]);
|
||||
function Get_Partner_Purchase_Prices(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_Partner_Group_Purchase_Price_List/";
|
||||
|
||||
|
||||
setLoading(true);
|
||||
axios.post(myurl, form).then(res => {
|
||||
setLoading(false);
|
||||
if (String(res.data.status) === String("true")) {
|
||||
//console.log(" In Get_Partner_Purchase_Prices res.data.status = " + res.data.status);
|
||||
//console.log(" In Get_Partner_Purchase_Prices res.data.message r_class = " + res.data.message);
|
||||
setGet_Partner_Purchase_Prices_api("true");
|
||||
setGet_Partner_Purchase_Prices_result(res.data.message);
|
||||
}
|
||||
else {
|
||||
setGet_Partner_Purchase_Prices_api("false");
|
||||
setGet_Partner_Purchase_Prices_message(res.data.message);
|
||||
alert(res.data.message);
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
setLoading(false);
|
||||
console.warn('Not good man :( Get_Partner_Purchase_Prices = ', error);
|
||||
setGet_Partner_Purchase_Prices_api("false");
|
||||
alert(" Impossible de recuperer la liste des prix d'achat ");
|
||||
//setmyApimyApiMessage("")
|
||||
})
|
||||
}
|
||||
|
||||
const [isLoading, setLoading] = useState();
|
||||
|
||||
const [dialog_contrat_data_changed, setdialog_contrat_data_changed] = useState();
|
||||
|
||||
function handleClick_edit_employee_contrat_From_Line(row_id) {
|
||||
|
||||
var line = JSON.parse(Getall_Employee_Contrat_result[row_id]);
|
||||
|
||||
//console.log("### line = ", line);
|
||||
var employe_id = line._id;
|
||||
setselected_id(employe_id);
|
||||
|
||||
setp_employe_contrat_type_contrat(line.type_contrat);
|
||||
setp_employe_contrat_type_employe(line.type_employe);
|
||||
setp_employe_contrat_cout(line.cout);
|
||||
setp_employe_contrat_groupe_prix_achat_id(line.groupe_prix_achat_id);
|
||||
|
||||
setp_employe_contrat_date_debut(line.date_debut);
|
||||
setp_employe_contrat_date_fin(line.date_fin);
|
||||
setDialog_employe_contrat_open(true);
|
||||
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="employes">
|
||||
|
||||
{isLoading && <div className="loader-container">
|
||||
<div className="mysy_spinner"> <img src={img_loading_spin} /> </div>
|
||||
</div>}
|
||||
|
||||
|
||||
<Dialog
|
||||
open={Dialog_1_open}
|
||||
onClose={Dialog_1_handleClose}
|
||||
|
@ -3851,7 +4064,193 @@ const Employes = (props) => {
|
|||
</DialogActions>
|
||||
</Dialog>
|
||||
|
||||
<Dialog
|
||||
open={Dialog_employe_contrat_open}
|
||||
onClose={Dialog_employe_contrat_handleClose}
|
||||
|
||||
className="displaypartnersession"
|
||||
|
||||
>
|
||||
|
||||
<DialogTitle>Contrat employé </DialogTitle>
|
||||
<DialogContent className="DialogContent_width">
|
||||
|
||||
<div className="session_caract_Dialog" > Type de contrat
|
||||
<TextField
|
||||
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
|
||||
|
||||
name="event_dialog_code_groupe_prix"
|
||||
id="event_dialog_code_groupe_prix"
|
||||
|
||||
fullWidth
|
||||
select
|
||||
|
||||
value={p_employe_contrat_type_contrat}
|
||||
onChange={(e) => {
|
||||
setp_employe_contrat_type_contrat(e.target.value);
|
||||
setdialog_contrat_data_changed("1");
|
||||
}
|
||||
}
|
||||
>
|
||||
<MenuItem value="cdi" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >CDI </MenuItem>
|
||||
<MenuItem value="cdd" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >CDD </MenuItem>
|
||||
<MenuItem value="autre" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Autre </MenuItem>
|
||||
|
||||
</TextField>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="session_caract_Dialog" > Type d'employé
|
||||
<TextField
|
||||
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
|
||||
|
||||
name="event_dialog_type_employer"
|
||||
id="event_dialog_type_employer"
|
||||
|
||||
fullWidth
|
||||
select
|
||||
|
||||
value={p_employe_contrat_type_employe}
|
||||
onChange={(e) => {
|
||||
setp_employe_contrat_type_employe(e.target.value);
|
||||
setdialog_contrat_data_changed("1");
|
||||
}
|
||||
}
|
||||
>
|
||||
<MenuItem value="cdi" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >CDI </MenuItem>
|
||||
<MenuItem value="cdd" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >CDD </MenuItem>
|
||||
<MenuItem value="autre" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Autre </MenuItem>
|
||||
|
||||
|
||||
</TextField>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="session_caract_Dialog" > Debut
|
||||
<DatePicker
|
||||
name="event_dialog_date_debut"
|
||||
id="event_dialog_date_debut"
|
||||
|
||||
selected={new Date(moment(p_employe_contrat_date_debut, "DD/MM/YYYY"))}
|
||||
onChange={(date) => {
|
||||
setp_employe_contrat_date_debut(format(date, 'd/MM/yyyy'));
|
||||
setdialog_contrat_data_changed("1");
|
||||
|
||||
}
|
||||
}
|
||||
showTimeSelect={false}
|
||||
dateFormat="dd/MM/yyyy"
|
||||
className="disabled_style session_caract_Dialog_DatePicker"
|
||||
locale='fr-FR'
|
||||
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div className="session_caract_Dialog" > Fin
|
||||
<DatePicker
|
||||
name="event_dialog_date_fin"
|
||||
id="event_dialog_date_fin"
|
||||
selected={new Date(moment(p_employe_contrat_date_fin, "DD/MM/YYYY"))}
|
||||
onChange={(date) => {
|
||||
|
||||
setp_employe_contrat_date_fin(format(date, 'd/MM/yyyy'));
|
||||
setdialog_contrat_data_changed("1");
|
||||
|
||||
}
|
||||
}
|
||||
showTimeSelect={false}
|
||||
dateFormat="dd/MM/yyyy"
|
||||
className="disabled_style session_caract_Dialog_DatePicker"
|
||||
locale='fr-FR'
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
||||
<div className="session_caract_Dialog" > Groupe de Prix d'Achat
|
||||
<TextField
|
||||
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
|
||||
|
||||
name="event_dialog_grp_fournisseur"
|
||||
id="event_dialog_grp_fournisseur"
|
||||
|
||||
fullWidth
|
||||
select
|
||||
|
||||
value={p_employe_contrat_groupe_prix_achat_id}
|
||||
onChange={(e) => {
|
||||
setp_employe_contrat_groupe_prix_achat_id(e.target.value);
|
||||
setdialog_contrat_data_changed("1");
|
||||
}
|
||||
}
|
||||
>
|
||||
{Get_Partner_Purchase_Prices_result &&
|
||||
Get_Partner_Purchase_Prices_result.map((myclient) => (
|
||||
<MenuItem key={JSON.parse(myclient)._id} value={JSON.parse(myclient)._id}
|
||||
style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }}>
|
||||
{JSON.parse(myclient).code_groupe_prix}
|
||||
|
||||
</MenuItem>
|
||||
|
||||
))}
|
||||
<MenuItem key="" value=""
|
||||
style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }}>
|
||||
Autre
|
||||
|
||||
</MenuItem>
|
||||
|
||||
</TextField>
|
||||
</div>
|
||||
|
||||
{String(p_employe_contrat_groupe_prix_achat_id) === "" && <div className="session_caract_Dialog" > Prix
|
||||
<TextField
|
||||
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
|
||||
|
||||
name="event_dialog_fournisseur"
|
||||
id="event_dialog_fournisseur"
|
||||
type="number"
|
||||
step="any"
|
||||
fullWidth
|
||||
|
||||
value={p_employe_contrat_cout}
|
||||
onChange={(e) => {
|
||||
setp_employe_contrat_cout(e.target.value);
|
||||
setdialog_contrat_data_changed("1");
|
||||
}
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
|
||||
{String(dialog_contrat_data_changed) === "1" && <div className="div_row" style={{ "border": "None", "color": "orange", "textAlign": "center", "width": "100%" }}>
|
||||
/!\ Pensez à enregistrer les modifications
|
||||
</div>}
|
||||
|
||||
|
||||
|
||||
</DialogContent>
|
||||
|
||||
|
||||
<DialogActions>
|
||||
|
||||
|
||||
<div className="div_row">
|
||||
<div className="div_row_gauche">
|
||||
|
||||
{String(selected_contrat_id).trim().length > 2 && <Button onClick={"Add_Update_Grp_Purchase_Price"} className="bton_enreg_dialog">Mettre à jour</Button>}
|
||||
{String(selected_contrat_id).trim() === "" && <Button onClick={"Add_Update_Grp_Purchase_Price"} className="bton_enreg_dialog">Ajouter</Button>}
|
||||
</div>
|
||||
|
||||
<div className="div_row_droite" style={{ "textAlign": 'center' }}>
|
||||
<Button onClick={Dialog_employe_contrat_handleClose_buton} className="bton_annule_dialog" >Fermer</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</DialogActions>
|
||||
|
||||
|
||||
</Dialog>
|
||||
|
||||
<h3> Vos employés </h3>
|
||||
<div className="div_row">
|
||||
|
@ -6331,79 +6730,6 @@ const Employes = (props) => {
|
|||
|
||||
}
|
||||
|
||||
{/*String(acces_right_data_edit_mode) === "1" &&
|
||||
<div style={{ height: 400, width: "100%", "marginLeft": "1rem", "marginRight": "1rem" }}>
|
||||
<Container fluid>
|
||||
<Row>
|
||||
<Col sm={4}>
|
||||
Module
|
||||
</Col>
|
||||
<Col sm={4}>
|
||||
Lecture
|
||||
</Col>
|
||||
<Col sm={4}>
|
||||
Ecriture
|
||||
</Col>
|
||||
</Row>
|
||||
<br />
|
||||
{rows_acces_right &&
|
||||
rows_acces_right.map((module) => (
|
||||
<Row>
|
||||
<Col sm={4}>
|
||||
{JSON.parse(module).module_name}
|
||||
</Col>
|
||||
<Col sm={4}>
|
||||
{String(JSON.parse(module).read)}
|
||||
{String(JSON.parse(module).read) === "true" &&
|
||||
<input type="checkbox"
|
||||
onChange={access_right_datagrid_changed}
|
||||
id={JSON.parse(module).module_name + "_read"}
|
||||
name={JSON.parse(module).module_name + "_read"}
|
||||
checked />
|
||||
|
||||
}
|
||||
{String(JSON.parse(module).read) !== "true" &&
|
||||
<input type="checkbox"
|
||||
onChange={access_right_datagrid_changed}
|
||||
id={JSON.parse(module).module_name + "_read"}
|
||||
name={JSON.parse(module).module_name + "_read"}
|
||||
checked={false}
|
||||
/>
|
||||
|
||||
}
|
||||
</Col>
|
||||
<Col sm={4}>
|
||||
|
||||
{String(JSON.parse(module).write)}
|
||||
{String(JSON.parse(module).write) === "true" &&
|
||||
<input type="checkbox"
|
||||
onChange={access_right_datagrid_changed}
|
||||
id={JSON.parse(module).module_name + "_write"}
|
||||
name={JSON.parse(module).module_name + "_write"}
|
||||
checked />
|
||||
|
||||
}
|
||||
{String(JSON.parse(module).write) !== "true" &&
|
||||
<input type="checkbox"
|
||||
onChange={access_right_datagrid_changed}
|
||||
id={JSON.parse(module).module_name + "_write"}
|
||||
name={JSON.parse(module).module_name + "_write"}
|
||||
checked={false}
|
||||
/>
|
||||
|
||||
}
|
||||
|
||||
</Col>
|
||||
</Row>
|
||||
))}
|
||||
|
||||
|
||||
</Container>
|
||||
</div>
|
||||
|
||||
*/}
|
||||
|
||||
|
||||
{String(acces_right_data_edit_mode) !== "1" &&
|
||||
<div style={{ height: 550, width: '100%', paddingRight: '1px', "marginLeft": "10px", "marginRight": "10px", }}>
|
||||
|
||||
|
@ -6508,8 +6834,8 @@ const Employes = (props) => {
|
|||
</div>
|
||||
</div>}
|
||||
|
||||
{String(submenu) === "contrat" && <div className="div_row">
|
||||
<nav style={{ "border": "None", "fontSize": "22px", "fontWeight": "600" }}> Droit Acces </nav>
|
||||
{String(submenu) === "contrat" && <div className="div_row" style={{"paddingRight":"10px"}}>
|
||||
<nav style={{ "border": "None", "fontSize": "22px", "fontWeight": "600" }}> Droit Acces </nav>
|
||||
<div className="div_row">
|
||||
<Button variant="outlined" 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>
|
||||
|
@ -6517,10 +6843,73 @@ const Employes = (props) => {
|
|||
<Button variant="outlined" onClick={submenu_contrat} className="detail_class_submenu" id='affectation' name='contrat'>Contrat </Button>
|
||||
</div>
|
||||
|
||||
<nav style={{ "border": "None", "fontSize": "22px", "fontWeight": "600" }}>Detail du contrat </nav>
|
||||
<nav style={{ "border": "None", "fontSize": "22px", "fontWeight": "600" }}>Detail contrat(s) </nav>
|
||||
|
||||
<h3> ici les contrat, les prix d'achat, etcttttt, la categorie (interne, externe), etc</h3>
|
||||
</div>}
|
||||
<div style={{ height: 550, width: '100%', paddingRight: '1px', "marginLeft": "10px", "marginRight": "10px", }}>
|
||||
|
||||
<Box
|
||||
sx={{
|
||||
height: 500,
|
||||
width: '100%',
|
||||
paddingRight: '1px',
|
||||
"& .MuiDataGrid-columnHeaders": {
|
||||
backgroundColor: "#c8cfd5",
|
||||
color: "black",
|
||||
fontSize: 14
|
||||
},
|
||||
}}
|
||||
>
|
||||
<DataGrid
|
||||
//checkboxSelection
|
||||
|
||||
onSelectionModelChange={(newSelectionModel) => {
|
||||
setselectionModel_contrat(newSelectionModel);
|
||||
|
||||
}}
|
||||
|
||||
|
||||
selectionModel={selectionModel_contrat}
|
||||
|
||||
localeText={frFR.components.MuiDataGrid.defaultProps.localeText}
|
||||
rows={Getall_Employee_Contrat_result.map((item, index) => (
|
||||
{
|
||||
id: index,
|
||||
_id: JSON.parse(item)._id,
|
||||
rh_id: JSON.parse(item).rh_id,
|
||||
date_debut: JSON.parse(item).date_debut,
|
||||
date_fin: JSON.parse(item).date_fin,
|
||||
type_contrat: JSON.parse(item).type_contrat,
|
||||
type_employe: JSON.parse(item).type_employe,
|
||||
|
||||
}
|
||||
))}
|
||||
|
||||
|
||||
columns={columns_employee_contrat}
|
||||
pageSize={10}
|
||||
className="datagridclass"
|
||||
disabled={true}
|
||||
|
||||
onRowDoubleClick={(newSelectionModel) => {
|
||||
|
||||
setselected_contrat_id(newSelectionModel.row._id)
|
||||
handleClick_edit_employee_contrat_From_Line(newSelectionModel.row.id);
|
||||
|
||||
}}
|
||||
|
||||
rowsPerPageOptions={[10]}
|
||||
//disableSelectionOnClick
|
||||
components={{
|
||||
Toolbar: GridToolbar,
|
||||
}}
|
||||
|
||||
/>
|
||||
</Box>
|
||||
<br />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
</div >
|
||||
|
|
|
@ -6,21 +6,17 @@ import Button from '@mui/material/Button';
|
|||
import axios from "axios";
|
||||
import { getCookie, setCookie } from 'react-use-cookie';
|
||||
import { useHistory } from "react-router-dom";
|
||||
import CheckOut from "./CheckOut";
|
||||
|
||||
import { DataGrid, GridToolbar, frFR } from '@mui/x-data-grid';
|
||||
import "react-draft-wysiwyg/dist/react-draft-wysiwyg.css";
|
||||
import { Editor } from '@tinymce/tinymce-react';
|
||||
import parse from 'html-react-parser';
|
||||
import { FcViewDetails, FcDisapprove } from "react-icons/fc";
|
||||
|
||||
import 'react-tooltip/dist/react-tooltip.css'
|
||||
import { Tooltip } from 'react-tooltip'
|
||||
import add_plus from "../mysy_img/plus.png";
|
||||
import excel_icone from "../mysy_img/excel_icone.png";
|
||||
import participants from "../mysy_img/participants.png";
|
||||
import fileDownload from 'js-file-download'
|
||||
|
||||
import Popup from 'reactjs-popup';
|
||||
import 'reactjs-popup/dist/index.css';
|
||||
import { FcCancel, FcApproval, FcAcceptDatabase, FcPrint } from "react-icons/fc";
|
||||
|
||||
import DatePicker from "react-datepicker";
|
||||
import "react-datepicker/dist/react-datepicker.css";
|
||||
import { format } from 'date-fns'
|
||||
|
@ -28,8 +24,7 @@ import moment from "moment";
|
|||
import InputAdornment from '@mui/material/InputAdornment';
|
||||
import { AiFillCloseCircle } from "react-icons/ai";
|
||||
import Box from '@mui/material/Box';
|
||||
import { Typography, LinearProgress, sliderClasses } from '@mui/material';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { CiTrash } from "react-icons/ci";
|
||||
import { MdAddCircleOutline, MdRemoveCircleOutline } from "react-icons/md";
|
||||
import Dialog from '@mui/material/Dialog';
|
||||
|
@ -152,10 +147,10 @@ const Partner_Prix_Achat = (props) => {
|
|||
]
|
||||
|
||||
|
||||
const [Ge_Partner_Purchase_Prices_api, setGe_Partner_Purchase_Prices_api] = useState();
|
||||
const [Ge_Partner_Purchase_Prices_message, setGe_Partner_Purchase_Prices_message] = useState();
|
||||
const [Ge_Partner_Purchase_Prices_result, setGe_Partner_Purchase_Prices_result] = useState([]);
|
||||
function Ge_Partner_Purchase_Prices(event) {
|
||||
const [Get_Partner_Purchase_Prices_api, setGet_Partner_Purchase_Prices_api] = useState();
|
||||
const [Get_Partner_Purchase_Prices_message, setGet_Partner_Purchase_Prices_message] = useState();
|
||||
const [Get_Partner_Purchase_Prices_result, setGet_Partner_Purchase_Prices_result] = useState([]);
|
||||
function Get_Partner_Purchase_Prices(event) {
|
||||
|
||||
var form = new FormData();
|
||||
|
||||
|
@ -170,21 +165,21 @@ const Partner_Prix_Achat = (props) => {
|
|||
axios.post(myurl, form).then(res => {
|
||||
setLoading(false);
|
||||
if (String(res.data.status) === String("true")) {
|
||||
//console.log(" In Ge_Partner_Purchase_Prices res.data.status = " + res.data.status);
|
||||
//console.log(" In Ge_Partner_Purchase_Prices res.data.message r_class = " + res.data.message);
|
||||
setGe_Partner_Purchase_Prices_api("true");
|
||||
setGe_Partner_Purchase_Prices_result(res.data.message);
|
||||
//console.log(" In Get_Partner_Purchase_Prices res.data.status = " + res.data.status);
|
||||
//console.log(" In Get_Partner_Purchase_Prices res.data.message r_class = " + res.data.message);
|
||||
setGet_Partner_Purchase_Prices_api("true");
|
||||
setGet_Partner_Purchase_Prices_result(res.data.message);
|
||||
}
|
||||
else {
|
||||
setGe_Partner_Purchase_Prices_api("false");
|
||||
setGe_Partner_Purchase_Prices_message(res.data.message);
|
||||
setGet_Partner_Purchase_Prices_api("false");
|
||||
setGet_Partner_Purchase_Prices_message(res.data.message);
|
||||
alert(res.data.message);
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
setLoading(false);
|
||||
console.warn('Not good man :( Ge_Partner_Purchase_Prices = ', error);
|
||||
setGe_Partner_Purchase_Prices_api("false");
|
||||
console.warn('Not good man :( Get_Partner_Purchase_Prices = ', error);
|
||||
setGet_Partner_Purchase_Prices_api("false");
|
||||
alert(" Impossible de recuperer la liste des prix d'achat ");
|
||||
//setmyApimyApiMessage("")
|
||||
})
|
||||
|
@ -192,7 +187,7 @@ const Partner_Prix_Achat = (props) => {
|
|||
|
||||
|
||||
useEffect(() => {
|
||||
Ge_Partner_Purchase_Prices();
|
||||
Get_Partner_Purchase_Prices();
|
||||
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
|
@ -244,8 +239,8 @@ const Partner_Prix_Achat = (props) => {
|
|||
|
||||
|
||||
function handleClick_edit_groupe_purch_price_From_Line(selected_row_id) {
|
||||
|
||||
var line = JSON.parse(Ge_Partner_Purchase_Prices_result[selected_row_id]);
|
||||
|
||||
var line = JSON.parse(Get_Partner_Purchase_Prices_result[selected_row_id]);
|
||||
|
||||
setselected_pruchase_price_id(line._id);
|
||||
setp_purchase_price_code(line.code_groupe_prix);
|
||||
|
@ -306,7 +301,7 @@ const Partner_Prix_Achat = (props) => {
|
|||
setAdd_Update_Grp_Purchase_Price_api("true");
|
||||
setAdd_Update_Grp_Purchase_Price_result(res.data.message);
|
||||
Dialog_pruch_price_handleClose_buton();
|
||||
Ge_Partner_Purchase_Prices();
|
||||
Get_Partner_Purchase_Prices();
|
||||
setSelectionModel([]);
|
||||
setgridline_id();
|
||||
alert(res.data.message);
|
||||
|
@ -358,7 +353,7 @@ const Partner_Prix_Achat = (props) => {
|
|||
Dialog_pruch_price_handleClose_buton();
|
||||
setSelectionModel([]);
|
||||
setgridline_id();
|
||||
Ge_Partner_Purchase_Prices();
|
||||
Get_Partner_Purchase_Prices();
|
||||
alert(res.data.message);
|
||||
|
||||
}
|
||||
|
@ -490,7 +485,7 @@ const Partner_Prix_Achat = (props) => {
|
|||
id="event_dialog_date_fin"
|
||||
selected={new Date(moment(p_purchase_price_date_fin, "DD/MM/YYYY"))}
|
||||
onChange={(date) => {
|
||||
|
||||
|
||||
setp_purchase_price_date_fin(format(date, 'd/MM/yyyy'));
|
||||
setdialog_data_changed("1");
|
||||
|
||||
|
@ -537,7 +532,7 @@ const Partner_Prix_Achat = (props) => {
|
|||
|
||||
<div className="div_row">
|
||||
<div className="div_row_gauche">
|
||||
|
||||
|
||||
{String(selected_pruchase_price_id).trim().length > 2 && <Button onClick={Add_Update_Grp_Purchase_Price} className="bton_enreg_dialog">Mettre à jour</Button>}
|
||||
{String(selected_pruchase_price_id).trim() === "" && <Button onClick={Add_Update_Grp_Purchase_Price} className="bton_enreg_dialog">Ajouter</Button>}
|
||||
</div>
|
||||
|
@ -771,7 +766,7 @@ const Partner_Prix_Achat = (props) => {
|
|||
selectionModel={selectionModel}
|
||||
|
||||
localeText={frFR.components.MuiDataGrid.defaultProps.localeText}
|
||||
rows={Ge_Partner_Purchase_Prices_result.map((item, index) => (
|
||||
rows={Get_Partner_Purchase_Prices_result.map((item, index) => (
|
||||
{
|
||||
id: index,
|
||||
_id: JSON.parse(item)._id,
|
||||
|
|
Loading…
Reference in New Issue