recette2
cherif 2024-08-16 12:27:40 +02:00
parent 0856f1ca15
commit 9794b24b00
3 changed files with 429 additions and 96 deletions

View File

@ -51,8 +51,36 @@ import ChevronRightIcon from '@mui/icons-material/ChevronRight';
import { TreeView } from '@mui/x-tree-view/TreeView';
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';
const useStyles = makeStyles((theme) => ({
dialog: {
position: 'absolute',
// left: 10,
top: 400
},
paper: {
overflowY: 'unset',
},
customizedButton: {
position: 'absolute',
left: '95%',
top: '-9%',
backgroundColor: 'lightgray',
color: 'gray',
},
}));
const Partner_Commande = (props) => {
const classes = useStyles();
const history = useHistory();
const [submenu, setsubmenu] = useState("");
const [rowss, setRows] = useState([]);
@ -225,11 +253,87 @@ const Partner_Commande = (props) => {
const columns_order_lines = [
{ field: '_id', headerName: '_id', hide: true, editable: false },
{ field: 'id', headerName: 'id', hide: true, editable: false },
{ field: 'order_line_class_id', headerName: 'order_line_class_id', hide: true, editable: false },
{ 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', width: 250, hide: false, editable: false, flex: 1 },
{ field: 'order_line_session_code', headerName: 'Code Session', width: 250, hide: false, editable: false, flex: 1 },
{ field: 'order_line_formation_external_code', headerName: 'Code Formation', width: 150, hide: false, 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: "Session", headerName: 'Sessionii',
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_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 },
{ 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 },
@ -313,6 +417,7 @@ const Partner_Commande = (props) => {
);
}
},
{
field: "delete", headerName: 'Supprimer',
renderCell: (cellValues) => {
@ -1058,6 +1163,11 @@ const Partner_Commande = (props) => {
const myRef_head = useRef(null);
const [selected_id, setselected_id] = useState("");
const [selected_order_line_id, setselected_order_line_id] = useState("");
const [selected_order_line_row_number_id, setselected_order_line_row_number_id] = useState("");
const [selected_order_line_class_id, setselected_order_line_class_id] = useState("");
const [selected_order_header_type, setselected_order_header_type] = useState();
const [order_internal_ref, setorder_internal_ref] = useState("");
@ -2735,9 +2845,9 @@ const Partner_Commande = (props) => {
console.log(" GLOBAL #### total_taux_tax_bef = ", total_taux_tax_bef);
const total_taux_tax =1 + total_taux_tax_bef;
const total_taux_tax = 1 + total_taux_tax_bef;
const total_base1_total_reduction = (total_base1 - total_reduction) ;
const total_base1_total_reduction = (total_base1 - total_reduction);
const montant_ttc = (total_base1_total_reduction * total_taux_tax).toFixed(2);
@ -2746,8 +2856,8 @@ const Partner_Commande = (props) => {
console.log(" GLOBAL #### montant_ttc = ", montant_ttc);
var montant_taxe_tva = ((total_base1 - total_reduction) * total_taux_tax_bef ).toFixed(2);
// var montant_ttc = ((total_base1 - total_reduction) * (1 + [parseFloat(String(partner_taux_tva)) / 100])).toFixed(2); //(total_base2 + montant_taxe_tva).toFixed(2);
var montant_taxe_tva = ((total_base1 - total_reduction) * total_taux_tax_bef).toFixed(2);
// var montant_ttc = ((total_base1 - total_reduction) * (1 + [parseFloat(String(partner_taux_tva)) / 100])).toFixed(2); //(total_base2 + montant_taxe_tva).toFixed(2);
console.log(" GLOBAL #### montant_taxe_tva = ", montant_taxe_tva, " ### montant_ttc = ", montant_ttc);
@ -4124,6 +4234,97 @@ const Partner_Commande = (props) => {
]
const [Dialog_Create_Session_open, setDialog_Create_Session_open] = React.useState(false);
const Close_Dialog_Create_Session_open = () => {
setnew_session_date_debut("");
setnew_session_date_fin("");
setnew_session_nb_place("");
setnew_session_code("");
setDialog_Create_Session_open(false);
};
const [new_session_date_debut, setnew_session_date_debut] = useState();
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 filterPassedTime_start = (time) => {
const currentDate = new Date();
const selectedDate = new Date(time);
return currentDate.getTime() < selectedDate.getTime();
};
const [Create_Session_From_Quotation_api, setCreate_Session_From_Quotation_api] = useState();
const [Create_Session_From_Quotation_message, setCreate_Session_From_Quotation_message] = useState();
const [Create_Session_From_Quotation_result, setCreate_Session_From_Quotation_result] = useState();
function Create_Session_From_Quotation() {
var form = new FormData();
//form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA");
// zzzz
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_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);
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Add_SessionFormation_From_Quotation_Line/";
setLoading(true);
axios.post(myurl, form).then(res => {
//console.log(" In Create_Session_From_Quotation res.data.status = " + res.data.status);
//console.log(" In Create_Session_From_Quotation res.data.message r_class = " + res.data.message);
setLoading(false);
if (String(res.data.status) === String("true")) {
setCreate_Session_From_Quotation_api("true");
setCreate_Session_From_Quotation_result(res.data.message);
Getall_Parter_Orders_No_Filter();
Close_Dialog_Create_Session_open();
handleClick_edit_order_From_Line(selected_order_line_row_number_id);
alert(res.data.message);
/*if (document.getElementById('myRef_head')) {
var divh = document.getElementById('myRef_head').offsetTop;
window.scrollTo({
top: divh,
behavior: "smooth",
});
}*/
disable_Order_Header_DetailFields();
}
else {
setCreate_Session_From_Quotation_api("false");
setCreate_Session_From_Quotation_message(res.data.message);
alert(res.data.message);
}
}).catch((error) => {
setLoading(false);
console.warn('UpdateStagiaireData : Not good man :( Create_Session_From_Quotation = ' + error);
setCreate_Session_From_Quotation_api("false");
alert(" Impossible de faire la mise à jour");
})
}
return (
@ -4133,11 +4334,190 @@ const Partner_Commande = (props) => {
</div>}
{/****** Dialog pour créer une session depuis un devis */}
<Dialog
open={Dialog_Create_Session_open}
// onClose={Close_Dialog_Create_Session_open}
static
onClose={() => null}
PaperProps={{
className: classes.paper, // Apply the paper style
style: {
overflowY: 'unset',
//position: 'absolute',
//top: default_h
},
}}
hideBackdrop={true}
disableScrollLock
classes={{
paper: classes.dialog
}}
className="displaypartnersession mysy_MuiPaper-root"
>
<DialogTitle> Création Session </DialogTitle>
<DialogContent style={{ "minHeight": "20rem", "width": "30rem" }}>
<div className="div_row_dialog" style={{ textAlign: 'left', }}>
<b> Date début </b>
<DatePicker
name="planif_model_date_from"
id="planif_model_date_from"
selected={new_session_date_debut}
onChange={(date) => {
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();
/* console.log(" local_date = ", local_date);
console.log(" date_end_session = ", date_end_session);
console.log(" date_start_session = ", date_start_session);*/
if (local_date > date_end_session) {
alert(" La date est après la fin de la session");
return;
}
setnew_session_date_debut(date);
}
}
showTimeSelect={false}
filterTime={filterPassedTime_start}
dateFormat="dd/MM/yyyy"
className="disabled_style "
locale='fr-FR'
/>
</div>
<div className="div_row_dialog" style={{ textAlign: 'left' }}>
<b> Date fin </b>
<DatePicker
name="planif_model_date_from"
id="planif_model_date_from"
selected={new_session_date_fin}
onChange={(date) => {
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_start_session) {
alert(" La date est avant le début de la session");
return;
}
setnew_session_date_fin(date);
}
}
showTimeSelect={false}
filterTime={filterPassedTime_start}
dateFormat="dd/MM/yyyy"
className="disabled_style"
fullWidth
locale='fr-FR'
/>
</div>
<div className="session_caract_Dialog" > <b> Code Session </b>
<TextField
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
name="session_code"
id="session_code"
fullWidth
value={new_session_code}
onChange={(e) => {
setnew_session_code(e.target.value);
}
}
/>
</div>
<div className="session_caract_Dialog" > <b> Nb Places </b>
<TextField
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
name="session_nb_place"
id="session_nb_place"
type="number"
inputProps={{ min: "1", max: "999", step: "1" }}
fullWidth
value={new_session_nb_place}
onChange={(e) => {
setnew_session_nb_place(e.target.value);
}
}
/>
</div>
</DialogContent>
<DialogActions>
<div className="div_row">
<div className="div_row_gauche">
<Button onClick={Create_Session_From_Quotation} className="bton_enreg_dialog">Créer</Button>
</div>
<div className="div_row_droite" style={{ "textAlign": 'center' }}>
<Button onClick={Close_Dialog_Create_Session_open} className="bton_annule_dialog" >Annuler</Button>
</div>
<IconButton
autoFocus
onClick={Close_Dialog_Create_Session_open}
color="primary"
className={classes.customizedButton}
>
<CancelPresentationIcon />
</IconButton>
</div>
</DialogActions>
</Dialog>
{/****** fin Dialog pour créer une session depuis un devis */}
{/****** Dialog pour cloturer un devis (gerer la perte d'un devis avec motif, ou simple cloture) */}
<Dialog
open={Dialog_Cloture_Devis_open}
// onClose={Close_Dialog_Cloture_Devis_open}
// onClose={Close_Dialog_Cloture_Devis_open}
className="partner_commande"
static
onClose={() => null}
@ -4234,7 +4614,7 @@ const Partner_Commande = (props) => {
{/* Dialog pour gerer la signature digitale */}
<Dialog
open={Dialog_signature_digitale_open}
// onClose={Dialog_signature_digitale_handleClose}
// onClose={Dialog_signature_digitale_handleClose}
className="displaypartnersession"
static
onClose={() => null} >
@ -4349,7 +4729,7 @@ const Partner_Commande = (props) => {
{/****** Dialog pour la gestion d'un article (formation) */}
<Dialog
open={Dialog_Detail_Article_open}
// onClose={Dialog_1_handleClose}
// onClose={Dialog_1_handleClose}
className="partner_commande"
static
onClose={() => null} >
@ -4967,7 +5347,7 @@ const Partner_Commande = (props) => {
className="partner_commande"
static
onClose={() => null}
>
>
<DialogTitle>{Dialog_1_message}</DialogTitle>
<DialogContent>
@ -7120,6 +7500,7 @@ const Partner_Commande = (props) => {
order_line_montant_toutes_taxes: JSON.parse(item).order_line_montant_toutes_taxes,
order_line_taux_taxe: JSON.parse(item).order_line_taux_taxe,
order_line_class_id: JSON.parse(item).class_id,
}
))}

View File

@ -293,8 +293,30 @@ const TestUrl_New = (props) => {
})
}
const [tab_label, settab_label] = useState([]);
function Get_Local_Label(){
var new_data2 = [];
var node1 = {
"_id": "@text1",
"label": "text1_label",
};
var node2 = {
"_id": "@text2",
"label": "text2_label",
};
new_data2.push(node1);
new_data2.push(node2);
settab_label(new_data2);
}
useEffect(() => {
Get_Local_Label();
Get_List_Agenda_Events();
Get_Personnalisable_Collections();
Get_Personnalisable_Collection_and_Fields();
@ -796,53 +818,7 @@ const TestUrl_New = (props) => {
</Dialog>
</div>
<Draggable >
<div style={{ cursor: 'pointer', border: "1px solid" }}>I can now be moved around!</div>
</Draggable>
<div>
<h3>
Gestion du module Module_Email_Management
</h3>
<button onClick={(e) => {
setDialog_1_open(true);
}}>Envoie email</button>
zzz
</div>
<Editor
onInit={(evt, editor) => editorRef_description.current = editor}
initialValue={field_description}
onKeyUp={editor_keyup}
onEditorChange={(newValue, editor) => {
if (String(editor_tochange) === "1") {
//alert(" change");
DataUpdated()
seteditor_tochange("");
}
}}
init={{
resize: false,
height: 300,
menubar: false,
plugins: [
'advlist autolink lists link image charmap print preview anchor',
'searchreplace visualblocks code fullscreen',
'insertdatetime media table paste code help wordcount'
],
content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:14px; }'
}}
/>
@ -860,43 +836,7 @@ const TestUrl_New = (props) => {
<br />
{rows_champs_specifics &&
rows_champs_specifics.map((champ_spec) => (
<div className="session_caract"> {JSON.parse(champ_spec).field_label} <br />
<br />
<TextField
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
required
name={JSON.parse(champ_spec).field_name}
id={JSON.parse(champ_spec).field_name}
InputLabelProps={{
shrink: true,
}}
className="disabled_style"
onChange={change_champs_spec_handle}
/>
</div>
))}
<br />
<Button variant="contained" className="bton_enreg"
onClick={"get_champs_spec"}>
Display valeurs des champs spec
</Button>
<nav> Liste des valeurs des champs spec </nav>
{rows_champs_specifics &&
rows_champs_specifics.map((champ_spec) => (
<div className="session_caract"> '{champ_spec.field_value}' </div>
))}
<br />
<div className="div_row">
liste des events =

View File

@ -2686,6 +2686,7 @@
}
// end media
@ -2719,6 +2720,17 @@
.disabled_style_100_percent_row {
font-size: small !important;
color: black;
width: 100% !important;
height: 3.5rem !important;
margin: 5px !important;
border-radius: 5px;
background: white;
border: solid gainsboro 1px;
}
.css-md26zr-MuiInputBase-root-MuiOutlinedInput-root {
height: 3rem !important;
}