From 59788b27157b416af6dfa0063b6708370d93d7a9 Mon Sep 17 00:00:00 2001 From: Cherif Date: Sun, 26 Oct 2025 15:41:27 +0100 Subject: [PATCH] 26/10/2025 - 15h --- PROD_CODE_FRONT/Formation_Partner_Catalog.js | 721 ++ src/components/AddClassManual.js | 295 +- src/components/DisplayDetailClass_new_v2.js | 2 +- src/components/DisplayDetailClass_new_v3.js | 2 +- src/components/DisplayPartnerSession.js | 104 +- src/components/Display_Action_And_Class.js | 2 +- ...play_Partner_Catalog_DetailClass_new_v2.js | 78 +- src/components/Formation_Partner_Catalog.js | 36 +- ...on_Partner_Catalog_Special_JMJFormation.js | 24 +- ...play_Partner_Catalog_DetailClass_new_v2.js | 2 +- ...on_Partner_Catalog_Special_JMJFormation.js | 480 + .../Module_Attestation_Formation.js | 2 +- .../Module_Evaluation_Positionnement.js | 73 +- src/components/Module_Session_Evaluation.js | 131 +- src/components/Mon_Catalogue_Public.js | 8 +- src/components/New_C_Formation_2025.js | 28 +- .../Formation_Partner_Catalog.js | 721 ++ .../PROD_FRONT_CODE/New_C_Formation_2025.js | 483 + .../PROD_FRONT_CODE/Partner_Commande.js | 8783 +++++++++++++++++ src/components/Partner.js | 2 +- src/components/Partner_Commande.js | 18 +- .../new_detail_formation_2025.js | 2931 ++++++ .../new_detail_formation_2025.js | 68 +- .../new_marketplace_2025.js | 2 +- 24 files changed, 14841 insertions(+), 155 deletions(-) create mode 100644 PROD_CODE_FRONT/Formation_Partner_Catalog.js create mode 100644 src/components/Jmj_Theme/PROD_CODE/Formation_Partner_Catalog_Special_JMJFormation.js create mode 100644 src/components/PROD_FRONT_CODE/Formation_Partner_Catalog.js create mode 100644 src/components/PROD_FRONT_CODE/New_C_Formation_2025.js create mode 100644 src/components/PROD_FRONT_CODE/Partner_Commande.js create mode 100644 src/components/detail_formation_automatic_files/PROD_25102025/new_detail_formation_2025.js diff --git a/PROD_CODE_FRONT/Formation_Partner_Catalog.js b/PROD_CODE_FRONT/Formation_Partner_Catalog.js new file mode 100644 index 0000000..b7b1ef0 --- /dev/null +++ b/PROD_CODE_FRONT/Formation_Partner_Catalog.js @@ -0,0 +1,721 @@ +import React, { useState, useEffect } from "react"; + +import { FacebookShareButton, LinkedinShareButton, TwitterShareButton } from "react-share"; +import { SocialIcon } from 'react-social-icons'; +import { Button, } from "reactstrap"; +import { useHistory } from "react-router-dom"; +import { Helmet } from "react-helmet"; +import { useCookies } from "react-cookie"; +import { confirmAlert } from 'react-confirm-alert'; + +import coeurimg from "../mysy_img/coeur.png"; +import img_met_program from "../mysy_img/met_programmation.jpg"; + +import img_met_graphisme from "../mysy_img/metier_graphisme.jpg"; + +import img_met_autre from "../mysy_img/met_autre.jpg"; +import img_met_digital from "../mysy_img/met_digital.jpg"; +import img_met_management from "../mysy_img/met_management.jpg"; + +import img_met_dev_perso from "../mysy_img/metier_dev_perso.jpg"; +import img_met_rh from "../mysy_img/met_rh.jpg"; + +import img_met_bureautic from "../mysy_img/met_burautic.jpg"; +import img_met_vente from "../mysy_img/met_vente.jpg"; +import axios from "axios"; +//import { Rating } from 'react-simple-star-rating' +import Rating from '@mui/material/Rating'; +import parse from 'html-react-parser' +import { CiLocationOn } from "react-icons/ci"; + +const Formation_Partner_Catalog = (props) => { + const [userconnected, setuserconnected] = useState("0"); + const [partnerconnected, setpartnerconnected] = useState("0"); + const [cookie, setCookie, removeCookie] = useCookies(['tokenmysych']); + const [cookie_part, setCookie_part, removeCookie_part] = useCookies(['tokenmysypart']); + const history = useHistory(); + const [myfilter, setmyfilter] = useState(props.formation.price); + + const [profileimg, setprofileimg] = useState(props.formation.price); + + + // Gestion des Cookies + const stored_partner = cookie_part.tokenmysypart; + const stored_user = cookie.tokenmysych; + + function test(val) { + + if (userconnected === "0" && partnerconnected === "0") { + confirmAlert({ + title: 'Activer votre session ?', + message: 'Merci de vous connecter pour acceder au detail de cette formation', + buttons: [ + { + label: 'Oui', + onClick: () => { history.push("/mysy-training-login/training/" + props.formation.internal_url) } + }, + { + label: 'Non', + onClick: () => { return } + + } + ], + closeOnEscape: false, + closeOnClickOutside: false, + keyCodeForClose: [8, 32], + willUnmount: () => { }, + afterClose: () => { }, + onClickOutside: () => { }, + onKeypress: () => { }, + onKeypressEscape: () => { }, + }); + } else { + window.open( + "/Display-Partner-Catalog-Detail-formation/" + props.formation.internal_url, + '_blank' + ); + } + + + } + + const [myclassimage, setmyclassimage] = useState(); + const [isclassimage, setisclassimage] = useState("False"); + const [userimgclassprofil, setuserimgclassprofil] = useState(""); + + const [class_img_stored_in_bdd, setclass_img_stored_in_bdd] = useState(""); + + function getClassImage_no_token() { + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/getRecodedClassImage_no_token/"; + + + + var form = new FormData(); + + form.append("type", "partner"); + form.append("related_collection", "myclass"); + form.append("related_collection_recid", props.formation._id); + form.append("class_external_code", props.formation.external_code); + + + axios.post(myurl, form).then(res => { + + if (res.data.status != "False") { + + //console.log(" getClassImage : In test res.data.status = " + res.data.status); + //console.log(" getClassImage: res.data.message.img = " + res.data.message); + + if (res.data.message.img.length > 0) { + setisclassimage("True"); + } + else { + setisclassimage("False"); + } + setisclassimage(res.data.message.img); + var ch_img = "data:image/png;base64," + res.data.message.img; + setclass_img_stored_in_bdd(ch_img); + } + else { + //console.log(" In Erreur res.data.status = " + res.data.status); + //console.log(" In Erreur res.data.message = " + res.data.message); + setisclassimage("False"); + setuserimgclassprofil(); + setclass_img_stored_in_bdd(); + } + }).catch((error) => { + + console.warn('getClassImage ee: Not good man :( getClassImage = '); + setisclassimage("False"); + setuserimgclassprofil(""); + setclass_img_stored_in_bdd(""); + }) + + } + + + /* Cette variable accompagne la gestion des images par defaut. + idée : si la valeur de "DetailTraining.metier" != "management, digital, office, rh, vente, dev_perso" + alors l'utilisateur à créer une formation avec un metier qui n'est pas geré, donc on met une image par defaut + */ + const [ismetiermanaged, setismetiermanaged] = useState(); + const liste_metier = ["management", "digital", "office", "rh", "vente", "dev_perso"]; + + useEffect(() => { + setmyfilter(props.myfil); + + if (typeof (stored_user) === "undefined" || String(stored_user) === '') { + setuserconnected("0"); + } else { + setuserconnected("1"); + } + + if (typeof (stored_partner) === "undefined" || String(stored_partner) === '') { + setpartnerconnected("0"); + } else { + setpartnerconnected("1"); + } + + getClassImage_no_token(); + GetCurrentClass_trainingsession(); + + GetCurrentClass_trainingsession_cities(); + + // Verifier si le metier est geré + if (props.formation.metier) { + if (!liste_metier.includes(props.formation.metier)) { + setismetiermanaged("0"); // j'ai une valeur dans metier, mais qui n'est pas geré + } + } + else { + setismetiermanaged("0"); + } + + if (props.formation.img_url && String(props.formation.img_url).length > 0) { + setismetiermanaged("1"); + } + + }, []); + + + const [GetCurrentClass_api, setGetCurrentClass_api] = useState(); + const [GetCurrentClass_message, setGetCurrentClass_message] = useState(); + const [GetCurrentClass_result, setGetCurrentClass_result] = useState(); + function GetCurrentClass_trainingsession(event) { + + var form = new FormData(); + + form.append("class_internal_url", props.formation.internal_url); + + form.append("token", stored_partner); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/GetActiveSessionFormation_List/"; + + axios.post(myurl, form).then(res => { + + if (res.data.status != "false") { + //console.log(" In GetCurrentClass_trainingsession res.data.status = " + res.data.status); + //console.log(" In GetCurrentClass_trainingsession res.data.message r_class = " + res.data.message); + setGetCurrentClass_api("true"); + setGetCurrentClass_result(res.data.message); + } + else { + setGetCurrentClass_api("false"); + setGetCurrentClass_message(res.data.message); + } + + }).catch((error) => { + console.warn('Not good man :( GetCurrentClass_trainingsession = ', error); + setGetCurrentClass_api("false"); + //setmyApimyApiMessage("") + }) + } + + + 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([]); + function GetCurrentClass_trainingsession_cities(event) { + + var form = new FormData(); + + form.append("class_internal_url", props.formation.internal_url); + + form.append("token", stored_partner); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/GetActiveSession_Cities_And_Distance_Formation_List/"; + + axios.post(myurl, form).then(res => { + + if (res.data.status != "false") { + //console.log(" In GetCurrentClass_trainingsession_cities res.data.status = " + res.data.status); + //console.log(" In GetCurrentClass_trainingsession_cities res.data.message r_class = " + res.data.message); + setGetCurrentClass_trainingsession_cities_api("true"); + setGetCurrentClass_trainingsession_cities_result(res.data.message); + } + else { + setGetCurrentClass_trainingsession_cities_api("false"); + setGetCurrentClass_trainingsession_cities_message(res.data.message); + } + + }).catch((error) => { + console.warn('Not good man :( GetCurrentClass_trainingsession_cities = ', error); + setGetCurrentClass_trainingsession_cities_api("false"); + //setmyApimyApiMessage("") + }) + } + + return ( + +
+ +
+ + {class_img_stored_in_bdd && String(class_img_stored_in_bdd).length > 50 &&
+ informatique +
+ } + + + { (!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50 ) && String(ismetiermanaged) !== "0" && String(ismetiermanaged) !== "1" &&
+ + {(!props.formation.img_url || String(props.formation.img_url).length <= 0) && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("it") && + String(isclassimage) === "False" && informatique} + + {(!props.formation.img_url || String(props.formation.img_url).length <= 0) && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("graphisme") && + String(isclassimage) === "False" && graphisme} + + {(!props.formation.img_url || String(props.formation.img_url).length <= 0) && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("management") && + String(isclassimage) === "False" && management} + + {(!props.formation.img_url || String(props.formation.img_url).length <= 0) && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("digital") && + String(isclassimage) === "False" && digital} + + {(!props.formation.img_url || String(props.formation.img_url).length <= 0) && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("office") && + String(isclassimage) === "False" && office} + + {!props.formation.img_url || String(props.formation.img_url).length <= 0 && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("rh") && + String(isclassimage) === "False" && ressources humaines} + + {!props.formation.img_url || String(props.formation.img_url).length <= 0 && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("vente") && + String(isclassimage) === "False" && vente} + + {!props.formation.img_url || String(props.formation.img_url).length <= 0 && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("dev_perso") && + String(isclassimage) === "False" && developpement personnel} + + {String(isclassimage) === "True" && developpement personnel} + + +
+ } + + + {(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50 ) && String(ismetiermanaged) === "0" && String(userimgclassprofil).length > 100 &&
+ autre + {props.formation.institut_formation &&
Dispensé par :
{String(props.formation.institut_formation)}
} +
} + + {(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50 ) && String(ismetiermanaged) === "0" && String(userimgclassprofil).length <= 100 &&
+ autre + {props.formation.institut_formation &&
Dispensé par :
{String(props.formation.institut_formation)}
} +
} + + {(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50 ) && String(ismetiermanaged) === "1" &&
+ autre + {props.formation.institut_formation &&
Dispensé par :
{String(props.formation.institut_formation)}
} +
} + + +
{ + e.preventDefault(); + if (props.formation.url && props.formation.url.length > 5) { + + window.open( + props.formation.url, + '_blank' + ); + } else { + window.open( + "/Display-Partner-Catalog-Detail-formation/" + props.formation.internal_url, + '_blank' + ); + } + }}> +
+
+ +
+ {props.formation.note && String(props.formation.note).length === 1 && + parseInt(String(props.formation.note)) <= 5 && + + + + } + +
+
+
+
+ + + {props.formation.cpf && String(props.formation.cpf) === String("1") && +
+ OUI Éligible au CPF   +
} + + {props.formation.cpf && String(props.formation.cpf) !== String("1") && +
+ NON Éligible au CPF   +
} + + {!props.formation.cpf && +
+ NON Éligible au CPF   +
} + +
+
+
+
+ +
+

+ + {String(parse(String(props.formation.title).replace(/(<([^>]+)>)/ig, ''))).substring(0, 100)} + + +

+
+
+ + {String(props.formation.price).length == 9 && +
Prix : Non communiqué   +
+ } + + + {String(props.formation.price).length != 9 && String(props.formation.price) === String("0") && +
Gratuit   +
+ } + + {String(props.formation.price).length != 9 && String(props.formation.price) !== String("0") && (!props.formation.business_prices || + Object.keys(props.formation.business_prices).length <= 0) && +
{props.formation.price} € HT  + +
+ } + + {String(props.formation.price).length != 9 && String(props.formation.price) !== String("0") && + props.formation.business_prices && Object.keys(props.formation.business_prices).length > 0 && +
+ + + + +
+ } + +
+ +
+ {parse(String(props.formation.description).replace(/(<([^>]+)>)/ig, ''))} + +
+ {GetCurrentClass_trainingsession_cities_result && GetCurrentClass_trainingsession_cities_result.length > 0 && + + } + {!GetCurrentClass_result || GetCurrentClass_result.length <= 0 && + + } + +
+
+
+ +
+ +
+
+ {!props.formation.extented_search && +
+ + + {props.formation.duration_unit && +
+
Durée +
+ + {String(props.formation.duration_unit) === "heure" && +
+ {props.formation.duration} hr(s)   +
} + + {String(props.formation.duration_unit) === "heures" && +
+ {props.formation.duration} hr(s)   +
} + + + {String(props.formation.duration_unit) === "jour" && +
+ {props.formation.duration} jr(s)   +
} + + {String(props.formation.duration_unit) === "mois" && +
+ {props.formation.duration} mois(s) +
} + + {String(props.formation.duration_unit) === "semaine" && +
+ {props.formation.duration} Sem (s) +
} + + {String(props.formation.duration_unit) === "user_rythme" && +
+ A votre rythme +
} + +
+ } + + + {!props.formation.duration_unit && +
+
Durée +
+ + {props.formation.duration &&
+ {props.formation.duration} jr(s)   +
} + + {!props.formation.duration &&
+ En traitement   +
} + + +
+ + } +
+
+ Certification +
+ +
+ {props.formation.certif && String(props.formation.certif) === String("1") && +
+ Oui   +
} + + {props.formation.certif && String(props.formation.certif) !== String("1") && +
+ Non   +
} + + {!props.formation.certif && +
+ NC   +
} + + +
+
+ +
+ + + +   + + + + + +   + + + + +
+ + + +
} + + +
+ {String(props.formation.coeur) === String("1") &&
+ coup de coeur +
} + + + + + +
+
+ Sur site +
+ {props.formation.presentiel && props.formation.presentiel.presentiel && + String(props.formation.presentiel.presentiel) === String("1") &&
+ Oui +
} + + {props.formation.presentiel && props.formation.presentiel.presentiel && + String(props.formation.presentiel.presentiel) !== String("1") &&
+ Non +
} + + {!props.formation.presentiel || !props.formation.presentiel.presentiel && +
+ NC +
} +
+ +
+
+ A distance +
+ {props.formation.presentiel && props.formation.presentiel.distantiel && + String(props.formation.presentiel.distantiel) === String("1") &&
+ Oui +
} + + {props.formation.presentiel && props.formation.presentiel.distantiel && + String(props.formation.presentiel.distantiel) !== String("1") &&
+ Non +
} + + {!props.formation.presentiel || !props.formation.presentiel.distantiel && +
+ NC +
} +
+ +
+
+ Support +
+ {props.formation.support && +
+ {props.formation.support} +
} + + {!props.formation.support && +
+ NC +
} +
+ + +
+ +
+
+
+ {!props.formation.extented_search && props.formation.coeur != "1" && +
+ + + + + + + {GetCurrentClass_result && GetCurrentClass_result.length > 0 && + + } + +
} + +
+
+
+
+ + ) +} + + +export default Formation_Partner_Catalog; \ No newline at end of file diff --git a/src/components/AddClassManual.js b/src/components/AddClassManual.js index 1b73d37..c1c7aa1 100644 --- a/src/components/AddClassManual.js +++ b/src/components/AddClassManual.js @@ -4295,6 +4295,9 @@ const AddClassManual = (props) => { Getall_Partner_Formulaires_Eval_Chaud(); Getall_Partner_Formulaires_Eval_Formateur(); + Get_List_Attestation_PDF(); + Get_List_Attestation_Email(); + Getall_Partner_Formulaires_Q_Position(); Get_Given_Class_Default_Documents(); setsubmenu("documents"); @@ -5729,6 +5732,213 @@ const AddClassManual = (props) => { } + + + const [selected_default_attestation_PDF, setselected_default_attestation_PDF] = useState(""); + + const [New_Get_List_Attestation_PDF_result, setNew_Get_List_Attestation_PDF_result] = useState([]); + + const [Get_List_Attestation_PDF_api, setGet_List_Attestation_PDF_api] = useState(); + const [Get_List_Attestation_PDF_message, setGet_List_Attestation_PDF_message] = useState(); + const [Get_List_Attestation_PDF_result, setGet_List_Attestation_PDF_result] = useState(); + function Get_List_Attestation_PDF() { + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("type_doc", "pdf"); + form.append("courrier_template_type_document_ref_interne", "ATTESTATION_FORMATION"); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Modele_Attestion_Formation_With_Filter/"; + setLoading(true); + + + axios.post(myurl, form).then(res => { + //console.log(" In Get_List_Attestation_PDF res.data.status = " + res.data.status); + //console.log(" In Get_List_Attestation_PDF res.data.message r_class = " + res.data.message); + setLoading(false); + if (String(res.data.status) === String("true")) { + + + setGet_List_Attestation_PDF_api("true"); + setGet_List_Attestation_PDF_result(res.data.message); + + var new_data2 = []; + + const new_data = res.data.message.map((x) => { + + //--- + var localid = JSON.parse(x).id; + var local_id = JSON.parse(x)._id; + var local_ref_interne = JSON.parse(x).ref_interne; + var local_nom = JSON.parse(x).nom; + var local_sujet = JSON.parse(x).sujet; + var local_type_doc = JSON.parse(x).type_doc; + var local_cible = JSON.parse(x).cible; + var local_joint_pdf = JSON.parse(x).joint_pdf; + + + + //--- + var node = { + "_id": local_id, + "id": localid, + "label": local_nom, + "ref_interne": local_ref_interne, + "nom": local_nom, + "sujet": local_sujet, + "type_doc": local_type_doc, + "cible": local_cible, + "joint_pdf": local_joint_pdf, + + }; + new_data2.push(node); + }); + + var node = { + "_id": "", + "id": "", + "label": "", + "ref_interne": "", + "nom": "", + "sujet": "", + "type_doc": "", + "cible": "", + "joint_pdf": "", + + }; + new_data2.push(node); + + if (new_data2.length > 0) + setNew_Get_List_Attestation_PDF_result(new_data2); + else + setNew_Get_List_Attestation_PDF_result([]) + + } + else { + setGet_List_Attestation_PDF_api("false"); + setGet_List_Attestation_PDF_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + + } + + }).catch((error) => { + setLoading(false); + console.warn('Not good man :( Get_List_Attestation_PDF = ', error); + setGet_List_Attestation_PDF_api("false"); + alert("Impossible de récupérer les modèles d'attestation PDF"); + //setmyApimyApiMessage("") + }) + } + + + const [selected_default_attestation_Email, setselected_default_attestation_Email] = useState(""); + + const [New_Get_List_Attestation_Email_result, setNew_Get_List_Attestation_Email_result] = useState([]); + + const [Get_List_Attestation_Email_api, setGet_List_Attestation_Email_api] = useState(); + const [Get_List_Attestation_Email_message, setGet_List_Attestation_Email_message] = useState(); + const [Get_List_Attestation_Email_result, setGet_List_Attestation_Email_result] = useState(); + function Get_List_Attestation_Email() { + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("type_doc", "email"); + form.append("courrier_template_type_document_ref_interne", "ATTESTATION_FORMATION"); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Modele_Attestion_Formation_With_Filter/"; + setLoading(true); + + + axios.post(myurl, form).then(res => { + //console.log(" In Get_List_Attestation_Email res.data.status = " + res.data.status); + //console.log(" In Get_List_Attestation_Email res.data.message r_class = " + res.data.message); + setLoading(false); + if (String(res.data.status) === String("true")) { + + + setGet_List_Attestation_Email_api("true"); + setGet_List_Attestation_Email_result(res.data.message); + + var new_data2 = []; + + const new_data = res.data.message.map((x) => { + + //--- + var localid = JSON.parse(x).id; + var local_id = JSON.parse(x)._id; + var local_ref_interne = JSON.parse(x).ref_interne; + var local_nom = JSON.parse(x).nom; + var local_sujet = JSON.parse(x).sujet; + var local_type_doc = JSON.parse(x).type_doc; + var local_cible = JSON.parse(x).cible; + var local_joint_pdf = JSON.parse(x).joint_pdf; + + + + //--- + var node = { + "_id": local_id, + "id": localid, + "label": local_nom, + "ref_interne": local_ref_interne, + "nom": local_nom, + "sujet": local_sujet, + "type_doc": local_type_doc, + "cible": local_cible, + "joint_pdf": local_joint_pdf, + + }; + new_data2.push(node); + }); + + var node = { + "_id": "", + "id": "", + "label": "", + "ref_interne": "", + "nom": "", + "sujet": "", + "type_doc": "", + "cible": "", + "joint_pdf": "", + + }; + new_data2.push(node); + + if (new_data2.length > 0) + setNew_Get_List_Attestation_Email_result(new_data2); + else + setNew_Get_List_Attestation_Email_result([]) + + } + else { + setGet_List_Attestation_Email_api("false"); + setGet_List_Attestation_Email_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + + } + + }).catch((error) => { + setLoading(false); + console.warn('Not good man :( Get_List_Attestation_Email = ', error); + setGet_List_Attestation_Email_api("false"); + alert("Impossible de récupérer les modèles d'attestation Email"); + //setmyApimyApiMessage("") + }) + } + + + const [selected_default_Stagiaire_Convocations_PDF, setselected_default_Stagiaire_Convocations_PDF] = useState(""); const [New_Get_List_Stagiaire_Convocations_PDF_result, setNew_Get_List_Stagiaire_Convocations_PDF_result] = useState([]); @@ -6154,9 +6364,12 @@ const AddClassManual = (props) => { form.append("CONVENTION_STAGIAIRE_INDIVIDUELLE_MAIL", selected_default_Convention_individuelle_Mail); form.append("CONVENTION_STAGIAIRE_INDIVIDUELLE_PDF", selected_default_Convention_individuelle_PDF); - form.append("CONVENTION_STAGIAIRE_ENTREPRISE_MAIL", selected_default_Convention_entreprise_Mail); + form.append("CONVENTION_STAGIAIRE_ENTREPRISE_MAIL", selected_default_Convention_entreprise_Mail); form.append("CONVENTION_STAGIAIRE_ENTREPRISE_PDF", selected_default_Convention_entreprise_PDF); + form.append("ATTESTATION_FORMATION_MAIL", selected_default_attestation_Email); + form.append("ATTESTATION_FORMATION_PDF", selected_default_attestation_PDF); + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Update_Class_Default_Document/"; @@ -6217,7 +6430,7 @@ const AddClassManual = (props) => { if (String(res.data.status) === "true") { //console.log(" In Get_Given_Class_Default_Documents res.data.status = " + res.data.status); - // console.log(" In Get_Given_Class_Default_Documents res.data.message r_class = " + res.data.message); + //console.log(" In Get_Given_Class_Default_Documents res.data.message r_class = " + res.data.message); //console.log(" In Get_Given_Class_Default_Documents res.data.message len = " + String(res.data.message).length); setLoading(false); @@ -6250,11 +6463,11 @@ const AddClassManual = (props) => { setselected_default_Convention_individuelle_PDF(mylocaltraining.CONVENTION_STAGIAIRE_INDIVIDUELLE_PDF); } - if (mylocaltraining.CONVENTION_STAGIAIRE_ENTREPRISE_MAIL) { + if (mylocaltraining.CONVENTION_STAGIAIRE_ENTREPRISE_MAIL) { setselected_default_Convention_entreprise_Mail(mylocaltraining.CONVENTION_STAGIAIRE_ENTREPRISE_MAIL); } - if (mylocaltraining.CONVENTION_STAGIAIRE_ENTREPRISE_PDF) { + if (mylocaltraining.CONVENTION_STAGIAIRE_ENTREPRISE_PDF) { setselected_default_Convention_entreprise_PDF(mylocaltraining.CONVENTION_STAGIAIRE_ENTREPRISE_PDF); } @@ -6270,6 +6483,16 @@ const AddClassManual = (props) => { setselected_default_Formulaires_Eval_Formateur(mylocaltraining.EVAL_FORMATION_FORMATEUR); } + if (mylocaltraining.ATTESTATION_FORMATION_PDF) { + console.log(" ### eeee = ", mylocaltraining.ATTESTATION_FORMATION_PDF) + setselected_default_attestation_PDF(mylocaltraining.ATTESTATION_FORMATION_PDF); + } + + if (mylocaltraining.ATTESTATION_FORMATION_MAIL) { + console.log(" ### iii = ", mylocaltraining.ATTESTATION_FORMATION_MAIL) + setselected_default_attestation_Email(mylocaltraining.ATTESTATION_FORMATION_MAIL); + } + }); @@ -9032,6 +9255,70 @@ const AddClassManual = (props) => { + {/*** Attestation */} +
+ +
Attestation Ftion
+
+ {New_Get_List_Attestation_PDF_result.length > 0 &&
Choisir un modèle par défault (PDF) + (data)._id === String(selected_default_attestation_PDF))[0].label} + + onChange={(event, value) => { + setdefault_doc_modification("1"); + if (value && value._id) + setselected_default_attestation_PDF(value._id); + else + setselected_default_attestation_PDF("") + + }} + + renderInput={(params) => + } + /> + +
} +
+
+ {New_Get_List_Attestation_Email_result.length > 0 &&
Choisir un modèle par défault (Email) + (data)._id === String(selected_default_attestation_Email))[0].label} + + onChange={(event, value) => { + setdefault_doc_modification("1"); + if (value && value._id) + setselected_default_attestation_Email(value._id); + else + setselected_default_attestation_Email("") + + }} + + renderInput={(params) => + } + /> + +
} +
+ +
+ +
diff --git a/src/components/DisplayDetailClass_new_v2.js b/src/components/DisplayDetailClass_new_v2.js index 6963daf..9c5a72d 100644 --- a/src/components/DisplayDetailClass_new_v2.js +++ b/src/components/DisplayDetailClass_new_v2.js @@ -1918,7 +1918,7 @@ const DisplayDetailClass_new_v2 = (props) => {
- {ratingvalue && String(ratingvalue).length === 1 && + {ratingvalue && String(ratingvalue).length > 0 && parseInt(String(ratingvalue)) <= 5 && {
- {ratingvalue && String(ratingvalue).length === 1 && + {ratingvalue && String(ratingvalue).length > 0 && parseInt(String(ratingvalue)) <= 5 && { setGet_Class_Default_Document_id_result(res.data.message); var mylocaltraining = JSON.parse(res.data.message); + if (mylocaltraining[local_type_document]) { // console.log(" OKKK = ", mylocaltraining[local_type_document]); setNew_Get_Class_Default_Document_id_result(mylocaltraining[local_type_document]); if (local_type_document === "CONVENTION_STAGIAIRE_INDIVIDUELLE_MAIL" || local_type_document === "CONVENTION_STAGIAIRE_INDIVIDUELLE_PDF" || local_type_document === "CONVENTION_STAGIAIRE_ENTREPRISE_MAIL" - || local_type_document === "CONVENTION_STAGIAIRE_ENTREPRISE_PDF") + || local_type_document === "CONVENTION_STAGIAIRE_ENTREPRISE_PDF") { + setselected_convention_id(mylocaltraining[local_type_document]); + } else if (local_type_document === "CONVOCATION_STAGIAIRE_MAIL" || local_type_document === "CONVOCATION_STAGIAIRE_PDF") @@ -14702,19 +14705,19 @@ const DisplayPartnerSession = (props) => { new_data2.push(node); }); - var node = { - "_id": "", - "id": "", - "label": "", - "ref_interne": "", - "nom": "", - "sujet": "", - "type_doc": "", - "cible": "", - "joint_pdf": "", + var node = { + "_id": "", + "id": "", + "label": "", + "ref_interne": "", + "nom": "", + "sujet": "", + "type_doc": "", + "cible": "", + "joint_pdf": "", - }; - new_data2.push(node); + }; + new_data2.push(node); if (new_data2.length > 0) setNew_Get_List_Stagiaire_Convocations_result(new_data2); @@ -16689,7 +16692,7 @@ const DisplayPartnerSession = (props) => { -
Type Document
+
Type Document
{ options={New_Option_Type_Document} onChange={(event, value) => { if (value && value.value) { - if (value.value === "email" && String(Dialog_1_message) === "CONVENTION_STAGIAIRE_INDIVIDUELLE") Get_Class_Default_Document_id("CONVENTION_STAGIAIRE_INDIVIDUELLE_MAIL"); else if (value.value === "pdf" && String(Dialog_1_message) === "CONVENTION_STAGIAIRE_INDIVIDUELLE") @@ -16775,7 +16777,7 @@ const DisplayPartnerSession = (props) => {
} {(String(selected_convention_type) === "email" || String(selected_convention_type) === "pdf") && -
Choisir une convention +
Choisir une convention {New_Get_List_Stagiaire_Conventions_result.length > 0 && { fullWidth //className="disabled_style enable_style" options={New_Get_List_Stagiaire_Conventions_result} - // value={New_Get_List_Stagiaire_Conventions_result.filter((data) => (data)._id === String(selected_convention_id))[0].label} + value={New_Get_List_Stagiaire_Conventions_result.filter((data) => (data)._id === String(selected_convention_id))[0].label} onChange={(event, value) => { if (value && value._id) { @@ -17114,45 +17116,45 @@ const DisplayPartnerSession = (props) => {
- {(String(selected_convention_type) === "email" || String(selected_convention_type) === "pdf") && - New_Get_List_Stagiaire_Convocations_result.length > 0 &&
Choisir une convocation - (data)._id === String(selected_convocation_id))[0].label} - onChange={(event, value) => { - if (value && value._id) { + {(String(selected_convention_type) === "email" || String(selected_convention_type) === "pdf") && + New_Get_List_Stagiaire_Convocations_result.length > 0 &&
Choisir une convocation + (data)._id === String(selected_convocation_id))[0].label} + onChange={(event, value) => { + if (value && value._id) { - setselected_convocation_id(value._id); + setselected_convocation_id(value._id); - // setselected_convention_id(value._id); + // setselected_convention_id(value._id); - if (String(value._id) === "default_mail") { - setselected_convention_type("email"); + if (String(value._id) === "default_mail") { + setselected_convention_type("email"); + } + else if (String(value._id) === "default_pdf") { + setselected_convention_type("pdf"); + } else { + var result2 = Get_List_Stagiaire_Convocations_result.filter((local_mymanager) => JSON.parse(local_mymanager)._id === String(value._id)) + setselected_convention_type(JSON.parse(result2).type_doc); + } + settab_convention_pieces_jointes_result([]); } - else if (String(value._id) === "default_pdf") { - setselected_convention_type("pdf"); - } else { - var result2 = Get_List_Stagiaire_Convocations_result.filter((local_mymanager) => JSON.parse(local_mymanager)._id === String(value._id)) - setselected_convention_type(JSON.parse(result2).type_doc); + else { + setselected_convocation_id(""); + settab_convention_pieces_jointes_result([]); } - settab_convention_pieces_jointes_result([]); - } - else { - setselected_convocation_id(""); - settab_convention_pieces_jointes_result([]); - } - }} + }} - renderInput={(params) => - } - /> + renderInput={(params) => + } + /> -
} +
} {String(selected_convention_type) === "email" &&
Type Document
{ setalert_type("error"); return; } - if (!selected_convention_id || selected_convention_id === "") { + if (!selected_convocation_id || selected_convocation_id === "") { setdisplay_alert_mysy("1"); setalert_message("Vous devez choisir un modèle de document"); setalert_type("error"); @@ -28121,7 +28123,7 @@ const DisplayPartnerSession = (props) => { {String(submenu) === String("positionnement") &&
+ related_collection_recid={selected_session_id} class_id={session_selected_class_id} />
} diff --git a/src/components/Display_Action_And_Class.js b/src/components/Display_Action_And_Class.js index 6a40094..3cd12bb 100644 --- a/src/components/Display_Action_And_Class.js +++ b/src/components/Display_Action_And_Class.js @@ -1470,7 +1470,7 @@ const Display_Action_And_Class = (props) => {
- {ratingvalue && String(ratingvalue).length === 1 && + {ratingvalue && String(ratingvalue).length > 0 && parseInt(String(ratingvalue)) <= 5 && { const { classId, action } = useParams(); @@ -489,7 +489,7 @@ const Display_Partner_Catalog_DetailClass_new_v2 = (props) => { axios.post(myurl, form).then(res => { // console.log(" In Display res.data.status = " + res.data.status); - //console.log(" In Display res.data.message = " + res.data.message); + console.log(" In Display res.data.message = " + res.data.message); if (String(res.data.status) === String("true")) { if (res.data.message.length > 0) { @@ -1406,31 +1406,31 @@ const Display_Partner_Catalog_DetailClass_new_v2 = (props) => { /// ---- - const [Download_one_attached_document_no_token_api, setDownload_one_attached_document_no_token_api] = useState(); - const [Download_one_attached_document_no_token_result, setDownload_one_attached_document_no_token_result] = useState(); - const [Download_one_attached_document_no_token_message, setDownload_one_attached_document_no_token_message] = useState(); + const [Download_one_attached_document_no_token_api, setDownload_one_attached_document_no_token_api] = useState(); + const [Download_one_attached_document_no_token_result, setDownload_one_attached_document_no_token_result] = useState(); + const [Download_one_attached_document_no_token_message, setDownload_one_attached_document_no_token_message] = useState(); - const Download_one_attached_document_no_token = (event) => { + const Download_one_attached_document_no_token = (event) => { - var nom_fiche_detaillee = "Fiche_catalogue.pdf"; - var file_name = event.target.id; + var nom_fiche_detaillee = "Fiche_catalogue.pdf"; + var file_name = event.target.id; - var url = process.env.REACT_APP_API_URL + "myclass/api/Get_Stored_Downloaded_File_From_Id_WITHOUT_TOKEN/" + file_name; + var url = process.env.REACT_APP_API_URL + "myclass/api/Get_Stored_Downloaded_File_From_Id_WITHOUT_TOKEN/" + file_name; - // console.log(" ### url = ", url); + // console.log(" ### url = ", url); - axios.get(url, { responseType: 'blob', },) - .then((res) => { - fileDownload(res.data, nom_fiche_detaillee); - setDownload_one_attached_document_no_token_api("true"); - }).catch((error) => { - console.error('Error:', error); - setDownload_one_attached_document_no_token_api("false"); + axios.get(url, { responseType: 'blob', },) + .then((res) => { + fileDownload(res.data, nom_fiche_detaillee); + setDownload_one_attached_document_no_token_api("true"); + }).catch((error) => { + console.error('Error:', error); + setDownload_one_attached_document_no_token_api("false"); - }); - } + }); + } return ( @@ -1676,15 +1676,23 @@ const Display_Partner_Catalog_DetailClass_new_v2 = (props) => { {String(DetailTraining["price"]) && String(DetailTraining["price"]) !== String("0") && String(DetailTraining["price"]) === String("0") && (!DetailTraining.business_prices || Object.keys(DetailTraining.business_prices).length <= 0) && DetailTraining["price"] &&
- {String(DetailTraining["price"])} € HT + {String(DetailTraining["price"])} € + {parseFloat(String(DetailTraining["partnaire_tva"])) > 0 && <> HT } + {parseFloat(String(DetailTraining["partnaire_tva"])) <= 0 && <> TTC }
} {String(DetailTraining["price"]) && String(DetailTraining["price"]) !== String("0") && DetailTraining.business_prices && Object.keys(DetailTraining.business_prices).length > 0 && DetailTraining["price"] &&
- + {DetailTraining.business_prices && DetailTraining.business_prices.length > 0 &&
- +
}
} @@ -2247,7 +2255,9 @@ const Display_Partner_Catalog_DetailClass_new_v2 = (props) => {
{JSON.parse(formation).price &&
- {(String(JSON.parse(formation).price))} € HT + {(String(JSON.parse(formation).price))} € + {parseFloat(String(JSON.parse(formation).partnaire_tva)) > 0 && <> HT } + {parseFloat(String(JSON.parse(formation).partnaire_tva)) <= 0 && <> TTC }
} @@ -2306,7 +2316,7 @@ const Display_Partner_Catalog_DetailClass_new_v2 = (props) => {
- {ratingvalue && String(ratingvalue).length === 1 && + {ratingvalue && String(ratingvalue).length > 0 && parseInt(String(ratingvalue)) <= 5 && {
} @@ -2687,7 +2697,10 @@ const Display_Partner_Catalog_DetailClass_new_v2 = (props) => { {String(DetailTraining["price"]) && String(DetailTraining["price"]) !== String("0") && (!DetailTraining.business_prices || Object.keys(DetailTraining.business_prices).length <= 0) && DetailTraining["price"] &&
-
{String(DetailTraining["price"])} € HT +
{String(DetailTraining["price"])} € + {parseFloat(String(DetailTraining["partnaire_tva"])) > 0 && <> HT } + {parseFloat(String(DetailTraining["partnaire_tva"])) <= 0 && <> TTC } +
{DetailTraining["cpf"] && String(DetailTraining["cpf"]) === "1" &&
Éligible CPF
} @@ -2701,13 +2714,18 @@ const Display_Partner_Catalog_DetailClass_new_v2 = (props) => { && DetailTraining["price"] &&
- +
Eligle CFP
{DetailTraining.business_prices && DetailTraining.business_prices.length > 0 &&
- +
} @@ -3023,7 +3041,9 @@ const Display_Partner_Catalog_DetailClass_new_v2 = (props) => {
{JSON.parse(formation).price &&
- {(String(JSON.parse(formation).price))} € HT + {(String(JSON.parse(formation).price))} € + {parseFloat(String(JSON.parse(formation).partnaire_tva)) > 0 && <> HT } + {parseFloat(String(JSON.parse(formation).partnaire_tva)) <= 0 && <> TTC }
} diff --git a/src/components/Formation_Partner_Catalog.js b/src/components/Formation_Partner_Catalog.js index b7b1ef0..f7d9c87 100644 --- a/src/components/Formation_Partner_Catalog.js +++ b/src/components/Formation_Partner_Catalog.js @@ -27,7 +27,7 @@ import axios from "axios"; import Rating from '@mui/material/Rating'; import parse from 'html-react-parser' import { CiLocationOn } from "react-icons/ci"; - + const Formation_Partner_Catalog = (props) => { const [userconnected, setuserconnected] = useState("0"); const [partnerconnected, setpartnerconnected] = useState("0"); @@ -250,14 +250,14 @@ const Formation_Partner_Catalog = (props) => {
- + {class_img_stored_in_bdd && String(class_img_stored_in_bdd).length > 50 &&
informatique
} - - { (!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50 ) && String(ismetiermanaged) !== "0" && String(ismetiermanaged) !== "1" &&
+ + {(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50) && String(ismetiermanaged) !== "0" && String(ismetiermanaged) !== "1" &&
{(!props.formation.img_url || String(props.formation.img_url).length <= 0) && props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("it") && @@ -298,22 +298,22 @@ const Formation_Partner_Catalog = (props) => { } - {(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50 ) && String(ismetiermanaged) === "0" && String(userimgclassprofil).length > 100 &&
+ {(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50) && String(ismetiermanaged) === "0" && String(userimgclassprofil).length > 100 &&
autre {props.formation.institut_formation &&
Dispensé par :
{String(props.formation.institut_formation)}
}
} - {(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50 ) && String(ismetiermanaged) === "0" && String(userimgclassprofil).length <= 100 &&
+ {(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50) && String(ismetiermanaged) === "0" && String(userimgclassprofil).length <= 100 &&
autre {props.formation.institut_formation &&
Dispensé par :
{String(props.formation.institut_formation)}
}
} - {(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50 ) && String(ismetiermanaged) === "1" &&
+ {(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50) && String(ismetiermanaged) === "1" &&
autre {props.formation.institut_formation &&
Dispensé par :
{String(props.formation.institut_formation)}
}
} - +
{ e.preventDefault(); @@ -390,7 +390,11 @@ const Formation_Partner_Catalog = (props) => { {String(props.formation.price).length != 9 && String(props.formation.price) !== String("0") && (!props.formation.business_prices || Object.keys(props.formation.business_prices).length <= 0) && -
{props.formation.price} € HT  +
{props.formation.price} € + {parseFloat(String(props.formation.partnaire_tva)) > 0 && <> HT } + {parseFloat(String(props.formation.partnaire_tva)) <= 0 && <> TTC } + +
} @@ -398,9 +402,15 @@ const Formation_Partner_Catalog = (props) => { {String(props.formation.price).length != 9 && String(props.formation.price) !== String("0") && props.formation.business_prices && Object.keys(props.formation.business_prices).length > 0 &&
- +
-
+
{parse(String(props.formation.description).replace(/(<([^>]+)>)/ig, ''))}
@@ -567,7 +577,7 @@ const Formation_Partner_Catalog = (props) => {
- +
} diff --git a/src/components/Jmj_Theme/Formation_Partner_Catalog_Special_JMJFormation.js b/src/components/Jmj_Theme/Formation_Partner_Catalog_Special_JMJFormation.js index b743271..28cabf5 100644 --- a/src/components/Jmj_Theme/Formation_Partner_Catalog_Special_JMJFormation.js +++ b/src/components/Jmj_Theme/Formation_Partner_Catalog_Special_JMJFormation.js @@ -266,7 +266,7 @@ const Formation_Partner_Catalog_Special_JMJFormation = (props) => { flexDirection: 'column', }, image: { - maxWidth: '100%', + maxWidth: '100%', height: '200px', overflow: 'hidden', margin: "auto", @@ -432,16 +432,30 @@ const Formation_Partner_Catalog_Special_JMJFormation = (props) => {

{String(parse(String(props.formation.title).replace(/(<([^>]+)>)/ig, ''))).substring(0, 50)}

- {props.formation.discounted_price && props.formation.business_prices &&

{props.formation.discounted_price} € HT 

} + {props.formation.discounted_price && props.formation.business_prices &&

{props.formation.discounted_price} € + {parseFloat(String(props.formation.partnaire_tva)) > 0 && <> HT  } + {parseFloat(String(props.formation.partnaire_tva)) <= 0 && <> TTC  } + +

} {props.formation.business_prices && props.formation.business_prices.length <= 0 - &&

{props.formation.price} € HT 

} + &&

{props.formation.price} € + {parseFloat(String(props.formation.partnaire_tva)) > 0 && <> HT  } + {parseFloat(String(props.formation.partnaire_tva)) <= 0 && <> TTC  } +

} {props.formation.business_prices && props.formation.business_prices.length > 0 &&

-

{props.formation.business_prices[0].discounted_price}€ HT  - {props.formation.price} € HT   +

{props.formation.business_prices[0].discounted_price}€ + {parseFloat(String(props.formation.partnaire_tva)) > 0 && <> HT  } + {parseFloat(String(props.formation.partnaire_tva)) <= 0 && <> TTC  } + + {props.formation.price} € + {parseFloat(String(props.formation.partnaire_tva)) > 0 && <> HT  } + {parseFloat(String(props.formation.partnaire_tva)) <= 0 && <> TTC  } + + ({props.formation.business_prices[0].discount} %)

} diff --git a/src/components/Jmj_Theme/Jmj_Display_Partner_Catalog_DetailClass_new_v2.js b/src/components/Jmj_Theme/Jmj_Display_Partner_Catalog_DetailClass_new_v2.js index 14468d8..84480c6 100644 --- a/src/components/Jmj_Theme/Jmj_Display_Partner_Catalog_DetailClass_new_v2.js +++ b/src/components/Jmj_Theme/Jmj_Display_Partner_Catalog_DetailClass_new_v2.js @@ -2046,7 +2046,7 @@ const JmJ_Display_Partner_Catalog_DetailClass_new_v2 = (props) => {
- {ratingvalue && String(ratingvalue).length === 1 && + {ratingvalue && String(ratingvalue).length > 0 && parseInt(String(ratingvalue)) <= 5 && { + const [userconnected, setuserconnected] = useState("0"); + const [partnerconnected, setpartnerconnected] = useState("0"); + const [cookie, setCookie, removeCookie] = useCookies(['tokenmysych']); + const [cookie_part, setCookie_part, removeCookie_part] = useCookies(['tokenmysypart']); + const history = useHistory(); + const [myfilter, setmyfilter] = useState(props.formation.price); + + const [profileimg, setprofileimg] = useState(props.formation.price); + + + // Gestion des Cookies + const stored_partner = cookie_part.tokenmysypart; + const stored_user = cookie.tokenmysych; + + function test(val) { + + if (userconnected === "0" && partnerconnected === "0") { + confirmAlert({ + title: 'Activer votre session ?', + message: 'Merci de vous connecter pour acceder au detail de cette formation', + buttons: [ + { + label: 'Oui', + onClick: () => { history.push("/mysy-training-login/training/" + props.formation.internal_url) } + }, + { + label: 'Non', + onClick: () => { return } + + } + ], + closeOnEscape: false, + closeOnClickOutside: false, + keyCodeForClose: [8, 32], + willUnmount: () => { }, + afterClose: () => { }, + onClickOutside: () => { }, + onKeypress: () => { }, + onKeypressEscape: () => { }, + }); + } else { + window.open( + "/Display-Detail-formation/" + props.formation.internal_url, + '_blank' + ); + } + + + } + + const [myclassimage, setmyclassimage] = useState(); + const [isclassimage, setisclassimage] = useState("False"); + const [userimgclassprofil, setuserimgclassprofil] = useState(""); + + const [class_img_stored_in_bdd, setclass_img_stored_in_bdd] = useState(""); + + function getClassImage_no_token() { + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/getRecodedClassImage_no_token/"; + + var form = new FormData(); + + form.append("type", "partner"); + form.append("related_collection", "myclass"); + form.append("related_collection_recid", props.formation._id); + form.append("class_external_code", props.formation.external_code); + + axios.post(myurl, form).then(res => { + + // console.log(" getClassImage_no_token : In test res.data.status = ", res.data.status); + if (String(res.data.status) === "true") { + + + //console.log(" getClassImage_no_token: res.data.message.img = ", res.data.message); + + if (res.data.message.img.length > 0) { + setisclassimage("True"); + } + else { + setisclassimage("False"); + } + setisclassimage(res.data.message.img); + var ch_img = "data:image/png;base64," + res.data.message.img; + setclass_img_stored_in_bdd(ch_img); + // console.log(" getClassImage_no_token: setclass_img_stored_in_bdd = ", setclass_img_stored_in_bdd); + + } + else { + // console.log(" In Erreur res.data.status = " + res.data.status); + //console.log(" In Erreur res.data.message = " + res.data.message); + setisclassimage("False"); + setuserimgclassprofil(); + setclass_img_stored_in_bdd(); + } + }).catch((error) => { + + console.warn('getClassImage ee: Not good man :( getClassImage = '); + setisclassimage("False"); + setuserimgclassprofil(""); + setclass_img_stored_in_bdd(""); + }) + + } + + + /* Cette variable accompagne la gestion des images par defaut. + idée : si la valeur de "DetailTraining.metier" != "management, digital, office, rh, vente, dev_perso" + alors l'utilisateur à créer une formation avec un metier qui n'est pas geré, donc on met une image par defaut + */ + const [ismetiermanaged, setismetiermanaged] = useState(); + const liste_metier = ["management", "digital", "office", "rh", "vente", "dev_perso"]; + + useEffect(() => { + setmyfilter(props.myfil); + + // console.log(" #### useEffect props.formation = ", props.formation); + + + if (typeof (stored_user) === "undefined" || String(stored_user) === '') { + setuserconnected("0"); + } else { + setuserconnected("1"); + } + + if (typeof (stored_partner) === "undefined" || String(stored_partner) === '') { + setpartnerconnected("0"); + } else { + setpartnerconnected("1"); + } + + getClassImage_no_token(); + GetCurrentClass_trainingsession(); + + GetCurrentClass_trainingsession_cities(); + + // Verifier si le metier est geré + if (props.formation.metier) { + if (!liste_metier.includes(props.formation.metier)) { + setismetiermanaged("0"); // j'ai une valeur dans metier, mais qui n'est pas geré + } + } + else { + setismetiermanaged("0"); + } + + if (props.formation.img_url && String(props.formation.img_url).length > 0) { + setismetiermanaged("1"); + } + + }, []); + + + const [GetCurrentClass_api, setGetCurrentClass_api] = useState(); + const [GetCurrentClass_message, setGetCurrentClass_message] = useState(); + const [GetCurrentClass_result, setGetCurrentClass_result] = useState(); + function GetCurrentClass_trainingsession(event) { + + var form = new FormData(); + + form.append("class_internal_url", props.formation.internal_url); + + form.append("token", stored_partner); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/GetActiveSessionFormation_List/"; + + axios.post(myurl, form).then(res => { + + if (res.data.status != "false") { + //console.log(" In GetCurrentClass_trainingsession res.data.status = " + res.data.status); + //console.log(" In GetCurrentClass_trainingsession res.data.message r_class = " + res.data.message); + setGetCurrentClass_api("true"); + setGetCurrentClass_result(res.data.message); + } + else { + setGetCurrentClass_api("false"); + setGetCurrentClass_message(res.data.message); + } + + }).catch((error) => { + console.warn('Not good man :( GetCurrentClass_trainingsession = ', error); + setGetCurrentClass_api("false"); + //setmyApimyApiMessage("") + }) + } + + + 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([]); + function GetCurrentClass_trainingsession_cities(event) { + + var form = new FormData(); + + form.append("class_internal_url", props.formation.internal_url); + + form.append("token", stored_partner); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/GetActiveSession_Cities_And_Distance_Formation_List/"; + + axios.post(myurl, form).then(res => { + + if (res.data.status != "false") { + //console.log(" In GetCurrentClass_trainingsession_cities res.data.status = " + res.data.status); + //console.log(" In GetCurrentClass_trainingsession_cities res.data.message r_class = " + res.data.message); + setGetCurrentClass_trainingsession_cities_api("true"); + setGetCurrentClass_trainingsession_cities_result(res.data.message); + } + else { + setGetCurrentClass_trainingsession_cities_api("false"); + setGetCurrentClass_trainingsession_cities_message(res.data.message); + } + + }).catch((error) => { + console.warn('Not good man :( GetCurrentClass_trainingsession_cities = ', error); + setGetCurrentClass_trainingsession_cities_api("false"); + //setmyApimyApiMessage("") + }) + } + + const styles = { + list: { + display: 'flex', + flexDirection: 'column', + gap: '32px', + width: '100%', + }, + row: { + display: 'flex', + flexDirection: 'row', + gap: '24px', + width: '100%', + }, + card: { + flexGrow: 1, + backgroundColor: '#fff', + borderRadius: '8px', + overflow: 'hidden', + display: 'flex', + flexDirection: 'column', + }, + image: { + maxWidth: '100%', + height: '200px', + overflow: 'hidden', + margin: "auto", + + }, + content: { + padding: '16px', + }, + header: { + display: 'flex', + justifyContent: 'space-between', + alignItems: 'center', + }, + eligibility: { + backgroundColor: '#e2e9fb', + padding: '4px 8px', + borderRadius: '4px', + fontSize: '12px', + fontWeight: 'bold', + }, + title: { + fontSize: '14px', + fontWeight: 'bold', + margin: '8px 0', + }, + price: { + fontSize: '14px', + fontWeight: 'bold', + color: '#000', + }, + description: { + fontSize: '12px', + color: '#666', + margin: '8px 0', + height: "40px", + overflow: "hidden", + }, + details: { + display: 'flex', + justifyContent: 'space-between', + marginTop: '16px', + }, + button: { + backgroundColor: '#007bff', + color: '#fff', + padding: '8px 16px', + border: 'none', + borderRadius: '4px', + cursor: 'pointer', + }, + buttonOutline: { + backgroundColor: '#fff', + color: '#007bff', + padding: '8px 16px', + border: '1px solid #007bff', + borderRadius: '4px', + cursor: 'pointer', + }, + }; + + return ( + +
+ + +
+
+ +
 
+ + {props.formation.cpf && String(props.formation.cpf) === String("1") &&
+ {"OUI CPF"} +
+ } + {props.formation.cpf && String(props.formation.cpf) !== String("1") &&
+ {"NON CPF"} +
+ } + {!props.formation.cpf && String(props.formation.cpf) !== String("1") &&
+ {"NON CPF"} +
} + +
+ + + {class_img_stored_in_bdd && String(class_img_stored_in_bdd).length > 50 && + Formation + } + + {(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50) && + (!props.formation.img_url || String(props.formation.img_url).length <= 10) && + String(ismetiermanaged) !== "0" && String(ismetiermanaged) !== "1" && + +
+ + {(!props.formation.img_url || String(props.formation.img_url).length <= 0) && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("it") && + String(isclassimage) === "False" && informatique} + + {(!props.formation.img_url || String(props.formation.img_url).length <= 0) && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("graphisme") && + String(isclassimage) === "False" && graphisme} + + {(!props.formation.img_url || String(props.formation.img_url).length <= 0) && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("management") && + String(isclassimage) === "False" && management} + + {(!props.formation.img_url || String(props.formation.img_url).length <= 0) && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("digital") && + String(isclassimage) === "False" && digital} + + {(!props.formation.img_url || String(props.formation.img_url).length <= 0) && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("office") && + String(isclassimage) === "False" && office} + + {!props.formation.img_url || String(props.formation.img_url).length <= 0 && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("rh") && + String(isclassimage) === "False" && ressources humaines} + + {!props.formation.img_url || String(props.formation.img_url).length <= 0 && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("vente") && + String(isclassimage) === "False" && vente} + + {!props.formation.img_url || String(props.formation.img_url).length <= 0 && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("dev_perso") && + String(isclassimage) === "False" && developpement personnel} + + {String(isclassimage) === "True" && developpement personnel} + + +
+ } + + {(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50) && String(ismetiermanaged) === "0" && String(userimgclassprofil).length > 100 && +
+ autre + {/*props.formation.institut_formation &&
Dispensé par :
+ {String(props.formation.institut_formation)}
*/} +
} + + {(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50) && String(ismetiermanaged) === "0" && String(userimgclassprofil).length <= 100 && +
+ autre + {/*props.formation.institut_formation &&
Dispensé par :
+ {String(props.formation.institut_formation)}
*/} +
} + + {(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50) && String(ismetiermanaged) === "1" && +
+ autre + {/*props.formation.institut_formation &&
Dispensé par :
+ {String(props.formation.institut_formation)}
*/} +
} + + +
+
+
+ {props.formation.note && String(props.formation.note).length === 1 && + parseInt(String(props.formation.note)) <= 5 && + + } +
+ +

{String(parse(String(props.formation.title).replace(/(<([^>]+)>)/ig, ''))).substring(0, 50)}

+ {props.formation.discounted_price && props.formation.business_prices &&

{props.formation.discounted_price} € HT 

} + + {props.formation.business_prices && props.formation.business_prices.length <= 0 + &&

{props.formation.price} € HT 

} + + {props.formation.business_prices && props.formation.business_prices.length > 0 && +

+ +

{props.formation.business_prices[0].discounted_price}€ HT  + {props.formation.price} € HT   + ({props.formation.business_prices[0].discount} %)

+

} + +

{String(parse(String(props.formation.description).replace(/(<([^>]+)>)/ig, ''))).substring(0, 80)}...

+
+ +
+
+ + +
+
+ +
+ + ) +} + + +export default Formation_Partner_Catalog_Special_JMJFormation; \ No newline at end of file diff --git a/src/components/Module_Attestation_Formation.js b/src/components/Module_Attestation_Formation.js index c7fdeb8..49ff950 100644 --- a/src/components/Module_Attestation_Formation.js +++ b/src/components/Module_Attestation_Formation.js @@ -534,7 +534,7 @@ const Module_Attestation_Formation = (props) => { function Get_List_Stagiaire_Attestation_Ftion(ref_interne, nom, type_doc, courrier_template_type_document_ref_interne) { var form = new FormData(); - + const stored_cookie = getCookie('tokenmysypart'); form.append("token", stored_cookie); form.append("type_doc", type_doc); diff --git a/src/components/Module_Evaluation_Positionnement.js b/src/components/Module_Evaluation_Positionnement.js index db77067..a6f7087 100644 --- a/src/components/Module_Evaluation_Positionnement.js +++ b/src/components/Module_Evaluation_Positionnement.js @@ -131,7 +131,7 @@ const Module_Evaluation_Positionnement = (props) => { }, }, - { field: 'mode_envoi', headerName: 'Mode Envoi', minwidth: 300, flex: 1, hide: true, editable: false, renderCell: (params) => , }, + { field: 'mode_envoi', headerName: 'Mode Envoi', minwidth: 300, flex: 1, hide: true, editable: false, renderCell: (params) => , }, { @@ -852,6 +852,68 @@ const Module_Evaluation_Positionnement = (props) => { const fixedVal = []; const [val, setVal] = useState([...fixedVal]); + const [New_Get_Class_Default_Document_id_result, setNew_Get_Class_Default_Document_id_result] = useState(""); + + const [Get_Class_Default_Document_id_api, setGet_Class_Default_Document_id_api] = useState(); + const [Get_Class_Default_Document_id_message, setGet_Class_Default_Document_id_message] = useState(); + const [Get_Class_Default_Document_id_result, setGet_Class_Default_Document_id_result] = useState(); + function Get_Class_Default_Document_id(local_type_document) { + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("class_id", props.class_id); + form.append("document_type", local_type_document); + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Given_Class_List_Default_Documents_For_Given_Type_Doc/"; + setLoading(true); + + setNew_Get_Class_Default_Document_id_result(""); + setselected_formulaire_id(""); + + axios.post(myurl, form).then(res => { + //console.log(" In Get_Class_Default_Document_id res.data.status = " + res.data.status); + // console.log(" In Get_Class_Default_Document_id res.data.message r_class = " + res.data.message); + setLoading(false); + if (String(res.data.status) === String("true")) { + + setGet_Class_Default_Document_id_api("true"); + setGet_Class_Default_Document_id_result(res.data.message); + + var mylocaltraining = JSON.parse(res.data.message); + + if (mylocaltraining[local_type_document]) { + // console.log(" OKKK = ", mylocaltraining[local_type_document]); + setNew_Get_Class_Default_Document_id_result(mylocaltraining[local_type_document]); + if (local_type_document === "QUESTION_POSITIONNEMENT") { + setselected_formulaire_id(mylocaltraining[local_type_document]); + } + + + } + + + } + else { + setGet_Class_Default_Document_id_api("false"); + setGet_Class_Default_Document_id_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + + } + + }).catch((error) => { + setLoading(false); + console.warn('Not good man :( Get_Class_Default_Document_id = ', error); + setGet_Class_Default_Document_id_api("false"); + alert("Impossible de récupérer le document par défaut"); + //setmyApimyApiMessage("") + }) + } return ( @@ -1032,14 +1094,16 @@ const Module_Evaluation_Positionnement = (props) => {
-
Choisir un questionnaire de positionnement - Choisir un questionnaire de positionnement + {New_Getall_Partner_Formulaires_with_Filter.length > 0 && (data)._id === String(selected_formulaire_id))[0].label} + onChange={(event, value) => { if (value && value._id) { @@ -1055,7 +1119,7 @@ const Module_Evaluation_Positionnement = (props) => { /> } - /> + />}
@@ -1117,6 +1181,7 @@ const Module_Evaluation_Positionnement = (props) => { diff --git a/src/components/Module_Session_Evaluation.js b/src/components/Module_Session_Evaluation.js index bdb7688..18a2cc8 100644 --- a/src/components/Module_Session_Evaluation.js +++ b/src/components/Module_Session_Evaluation.js @@ -778,7 +778,7 @@ const Module_Session_Evaluation = (props) => { const stored_cookie = getCookie('tokenmysypart'); form.append("token", stored_cookie); form.append("session_id", selected_session_id); - form.append("formulaire_id", selected_formulaire_id); + form.append("formulaire_id", selected_formulaire_hot_eval_id); form.append("survey_type", "hot_eval"); form.append("sending_date", ""); @@ -1235,7 +1235,7 @@ const Module_Session_Evaluation = (props) => { const stored_cookie = getCookie('tokenmysypart'); form.append("token", stored_cookie); form.append("session_id", selected_session_id); - form.append("formulaire_id", selected_formulaire_id); + form.append("formulaire_id", selected_formulaire_cold_eval_id); form.append("survey_type", "cold_eval"); form.append("sending_date", date_cold_eval_sending); @@ -1427,7 +1427,7 @@ const Module_Session_Evaluation = (props) => { const stored_cookie = getCookie('tokenmysypart'); form.append("token", stored_cookie); form.append("session_id", selected_session_id); - form.append("formulaire_id", selected_formulaire_id); + form.append("formulaire_id", selected_formulaire_formateur_eval_id); form.append("related_collection", "ressource_humaine"); form.append("related_collection_id", selected_formateur_id); //form.append("class_id", props.session_class_id); @@ -2227,10 +2227,16 @@ const Module_Session_Evaluation = (props) => { const Dialog_LIST_HOT_EVALUATION_QUESTION_handleClose_buton = () => { setDialog_LIST_HOT_EVALUATION_QUESTION_open(false); + setselected_formulaire_id(""); + setselected_formulaire_hot_eval_id(""); }; - const [selected_formulaire_id, setselected_formulaire_id] = useState(); + const [selected_formulaire_id, setselected_formulaire_id] = useState(""); + + const [selected_formulaire_hot_eval_id, setselected_formulaire_hot_eval_id] = useState(""); + const [selected_formulaire_cold_eval_id, setselected_formulaire_cold_eval_id] = useState(""); + const [selected_formulaire_formateur_eval_id, setselected_formulaire_formateur_eval_id] = useState(""); const [selected_formulaire_type, setselected_formulaire_type] = useState(""); @@ -2245,6 +2251,8 @@ const Module_Session_Evaluation = (props) => { const Dialog_LIST_COLD_EVALUATION_QUESTION_handleClose_buton = () => { setDialog_LIST_COLD_EVALUATION_QUESTION_open(false); + setselected_formateur_id(""); + setselected_formulaire_cold_eval_id("") }; var date_today_90j = new Date(); @@ -2260,6 +2268,8 @@ const Module_Session_Evaluation = (props) => { const Dialog_LIST_EVALUATION_FORMATEUR_handleClose_buton = () => { setDialog_LIST_EVALUATION_FORMATEUR_open(false); + setselected_formateur_id(""); + setselected_formulaire_formateur_eval_id(""); }; const [display_alert_mysy, setdisplay_alert_mysy] = useState(""); @@ -2292,6 +2302,85 @@ const Module_Session_Evaluation = (props) => { const [selected_specific_survey, setselected_specific_survey] = useState(""); + const [New_Get_Class_Default_Document_id_result, setNew_Get_Class_Default_Document_id_result] = useState(""); + + const [Get_Class_Default_Document_id_api, setGet_Class_Default_Document_id_api] = useState(); + const [Get_Class_Default_Document_id_message, setGet_Class_Default_Document_id_message] = useState(); + const [Get_Class_Default_Document_id_result, setGet_Class_Default_Document_id_result] = useState(); + function Get_Class_Default_Document_id(local_type_document) { + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("class_id", props.session_class_id); + form.append("document_type", local_type_document); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Given_Class_List_Default_Documents_For_Given_Type_Doc/"; + setLoading(true); + + setNew_Get_Class_Default_Document_id_result(""); + setselected_formulaire_id(""); + setselected_formulaire_hot_eval_id(""); + setselected_formulaire_cold_eval_id(""); + setselected_formulaire_formateur_eval_id(""); + + axios.post(myurl, form).then(res => { + //console.log(" In Get_Class_Default_Document_id res.data.status = " + res.data.status); + //console.log(" In Get_Class_Default_Document_id res.data.message r_class = " + res.data.message); + setLoading(false); + if (String(res.data.status) === String("true")) { + + + setGet_Class_Default_Document_id_api("true"); + setGet_Class_Default_Document_id_result(res.data.message); + + if (res.data.message) { + + var mylocaltraining = JSON.parse(res.data.message); + + if (mylocaltraining[local_type_document]) { + // console.log(" OKKK = ", mylocaltraining[local_type_document]); + setNew_Get_Class_Default_Document_id_result(mylocaltraining[local_type_document]); + + if (local_type_document === "EVAL_FORMATION_HOT") { + setselected_formulaire_hot_eval_id(mylocaltraining[local_type_document]); + } else if (local_type_document === "EVAL_FORMATION_COLD") { + setselected_formulaire_cold_eval_id(mylocaltraining[local_type_document]); + } else if (local_type_document === "EVAL_FORMATION_FORMATEUR") { + setselected_formulaire_formateur_eval_id(mylocaltraining[local_type_document]); + } + + else { + setselected_formulaire_id(mylocaltraining[local_type_document]); + } + + + } + } + + + } + else { + setGet_Class_Default_Document_id_api("false"); + setGet_Class_Default_Document_id_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + + } + + }).catch((error) => { + setLoading(false); + console.warn('Not good man :( Get_Class_Default_Document_id = ', error); + setGet_Class_Default_Document_id_api("false"); + alert("Impossible de récupérer le document par défaut"); + //setmyApimyApiMessage("") + }) + } + + return (
@@ -2462,22 +2551,26 @@ const Module_Session_Evaluation = (props) => { -
Choisir un questionnaire d'évaluation à chaud - Choisir un questionnaire d'évaluation à chaud + {New_Getall_Partner_Formulaires_hot_evaluation_with_Filter.length > 0 && (data)._id === String(selected_formulaire_hot_eval_id))[0].label} + onChange={(event, value) => { if (value && value._id) { setselected_formulaire_id(value._id); + setselected_formulaire_hot_eval_id(value._id); } else { setselected_formulaire_id(""); + setselected_formulaire_hot_eval_id(value._id); } }} @@ -2486,7 +2579,7 @@ const Module_Session_Evaluation = (props) => { /> } - /> + />}
@@ -2543,21 +2636,24 @@ const Module_Session_Evaluation = (props) => {
Choisir un questionnaire d'évaluation à froid - 0 && (data)._id === String(selected_formulaire_cold_eval_id))[0].label} onChange={(event, value) => { if (value && value._id) { setselected_formulaire_id(value._id); + setselected_formulaire_cold_eval_id(value._id); } else { setselected_formulaire_id(""); + setselected_formulaire_cold_eval_id(""); } }} @@ -2566,7 +2662,7 @@ const Module_Session_Evaluation = (props) => { /> } - /> + />}
@@ -2644,21 +2740,23 @@ const Module_Session_Evaluation = (props) => {
Choisir un questionnaire d'évaluation pour le formateur - 0 && (data)._id === String(selected_formulaire_formateur_eval_id))[0].label} onChange={(event, value) => { if (value && value._id) { setselected_formulaire_id(value._id); + setselected_formulaire_formateur_eval_id(value._id); } else { setselected_formulaire_id(""); + setselected_formulaire_formateur_eval_id(value._id); } }} @@ -2667,7 +2765,7 @@ const Module_Session_Evaluation = (props) => { /> } - /> + />}
@@ -2746,7 +2844,6 @@ const Module_Session_Evaluation = (props) => { -
@@ -2781,6 +2878,8 @@ const Module_Session_Evaluation = (props) => {
diff --git a/src/components/Mon_Catalogue_Public.js b/src/components/Mon_Catalogue_Public.js index b9cc4cd..a158d1e 100644 --- a/src/components/Mon_Catalogue_Public.js +++ b/src/components/Mon_Catalogue_Public.js @@ -1319,7 +1319,7 @@ const Mon_Catalogue_Public = (props) => { form.append("user_state", state); form.append("subdomain", window.location.host.split(".")[0]); - + var myurl = "" if (displayAllClasses == true) { myurl = process.env.REACT_APP_API_URL + "myclass/api/get_all_class_Given_partner_owner_recid_No_Login/"; @@ -1333,7 +1333,7 @@ const Mon_Catalogue_Public = (props) => { axios.post(myurl, form).then(res => { if (String(res.data.status) != String("false")) { //console.log(" In test res.data.status = " + res.data.status); - //console.log(" In test res.data.message = " + res.data.message); + // console.log(" In test res.data.message = " + res.data.message); setmyApiResponse("True"); setResult(res.data.message) @@ -2723,7 +2723,7 @@ const Mon_Catalogue_Public = (props) => { if (JSON.parse(x).affiche_contact) catalog_pub_affiche_contact = JSON.parse(x).affiche_contact; - console.log(" ### setmy_theme_code = ", theme_code); + // console.log(" ### setmy_theme_code = ", theme_code); //--- @@ -2789,7 +2789,7 @@ const Mon_Catalogue_Public = (props) => { "affiche_contact": catalog_pub_affiche_contact, }; - console.log(" --- node = ", node); + // console.log(" --- node = ", node); new_data2.push(node); }); diff --git a/src/components/New_C_Formation_2025.js b/src/components/New_C_Formation_2025.js index 301a574..24645e1 100644 --- a/src/components/New_C_Formation_2025.js +++ b/src/components/New_C_Formation_2025.js @@ -433,16 +433,34 @@ const New_C_Formation_2025 = (props) => {

{String(parse(String(props.formation.title).replace(/(<([^>]+)>)/ig, ''))).substring(0, 50)}

- {props.formation.discounted_price && props.formation.business_prices &&

{props.formation.discounted_price} € HT 

} + {props.formation.discounted_price && props.formation.business_prices &&

{props.formation.discounted_price} € + + {parseFloat(String(props.formation.partnaire_tva)) > 0 && <> HT } + {parseFloat(String(props.formation.partnaire_tva)) <= 0 && <> TTC } + +  

} {props.formation.business_prices && props.formation.business_prices.length <= 0 - &&

{props.formation.price} € HT 

} + &&

+ {props.formation.price} € + {parseFloat(String(props.formation.partnaire_tva)) > 0 && <> HT } + {parseFloat(String(props.formation.partnaire_tva)) <= 0 && <> TTC } + +  

} {props.formation.business_prices && props.formation.business_prices.length > 0 &&

-

{props.formation.business_prices[0].discounted_price}€ HT  - {props.formation.price} € HT   +

{props.formation.business_prices[0].discounted_price}€ + + {parseFloat(String(props.formation.partnaire_tva)) > 0 && <> HT } + {parseFloat(String(props.formation.partnaire_tva)) <= 0 && <> TTC } + +   + {props.formation.price} € + {parseFloat(String(props.formation.partnaire_tva)) > 0 && <> HT } + {parseFloat(String(props.formation.partnaire_tva)) <= 0 && <> TTC } +   ({props.formation.business_prices[0].discount} %)

} @@ -474,7 +492,7 @@ const New_C_Formation_2025 = (props) => { -
+
) } diff --git a/src/components/PROD_FRONT_CODE/Formation_Partner_Catalog.js b/src/components/PROD_FRONT_CODE/Formation_Partner_Catalog.js new file mode 100644 index 0000000..b7b1ef0 --- /dev/null +++ b/src/components/PROD_FRONT_CODE/Formation_Partner_Catalog.js @@ -0,0 +1,721 @@ +import React, { useState, useEffect } from "react"; + +import { FacebookShareButton, LinkedinShareButton, TwitterShareButton } from "react-share"; +import { SocialIcon } from 'react-social-icons'; +import { Button, } from "reactstrap"; +import { useHistory } from "react-router-dom"; +import { Helmet } from "react-helmet"; +import { useCookies } from "react-cookie"; +import { confirmAlert } from 'react-confirm-alert'; + +import coeurimg from "../mysy_img/coeur.png"; +import img_met_program from "../mysy_img/met_programmation.jpg"; + +import img_met_graphisme from "../mysy_img/metier_graphisme.jpg"; + +import img_met_autre from "../mysy_img/met_autre.jpg"; +import img_met_digital from "../mysy_img/met_digital.jpg"; +import img_met_management from "../mysy_img/met_management.jpg"; + +import img_met_dev_perso from "../mysy_img/metier_dev_perso.jpg"; +import img_met_rh from "../mysy_img/met_rh.jpg"; + +import img_met_bureautic from "../mysy_img/met_burautic.jpg"; +import img_met_vente from "../mysy_img/met_vente.jpg"; +import axios from "axios"; +//import { Rating } from 'react-simple-star-rating' +import Rating from '@mui/material/Rating'; +import parse from 'html-react-parser' +import { CiLocationOn } from "react-icons/ci"; + +const Formation_Partner_Catalog = (props) => { + const [userconnected, setuserconnected] = useState("0"); + const [partnerconnected, setpartnerconnected] = useState("0"); + const [cookie, setCookie, removeCookie] = useCookies(['tokenmysych']); + const [cookie_part, setCookie_part, removeCookie_part] = useCookies(['tokenmysypart']); + const history = useHistory(); + const [myfilter, setmyfilter] = useState(props.formation.price); + + const [profileimg, setprofileimg] = useState(props.formation.price); + + + // Gestion des Cookies + const stored_partner = cookie_part.tokenmysypart; + const stored_user = cookie.tokenmysych; + + function test(val) { + + if (userconnected === "0" && partnerconnected === "0") { + confirmAlert({ + title: 'Activer votre session ?', + message: 'Merci de vous connecter pour acceder au detail de cette formation', + buttons: [ + { + label: 'Oui', + onClick: () => { history.push("/mysy-training-login/training/" + props.formation.internal_url) } + }, + { + label: 'Non', + onClick: () => { return } + + } + ], + closeOnEscape: false, + closeOnClickOutside: false, + keyCodeForClose: [8, 32], + willUnmount: () => { }, + afterClose: () => { }, + onClickOutside: () => { }, + onKeypress: () => { }, + onKeypressEscape: () => { }, + }); + } else { + window.open( + "/Display-Partner-Catalog-Detail-formation/" + props.formation.internal_url, + '_blank' + ); + } + + + } + + const [myclassimage, setmyclassimage] = useState(); + const [isclassimage, setisclassimage] = useState("False"); + const [userimgclassprofil, setuserimgclassprofil] = useState(""); + + const [class_img_stored_in_bdd, setclass_img_stored_in_bdd] = useState(""); + + function getClassImage_no_token() { + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/getRecodedClassImage_no_token/"; + + + + var form = new FormData(); + + form.append("type", "partner"); + form.append("related_collection", "myclass"); + form.append("related_collection_recid", props.formation._id); + form.append("class_external_code", props.formation.external_code); + + + axios.post(myurl, form).then(res => { + + if (res.data.status != "False") { + + //console.log(" getClassImage : In test res.data.status = " + res.data.status); + //console.log(" getClassImage: res.data.message.img = " + res.data.message); + + if (res.data.message.img.length > 0) { + setisclassimage("True"); + } + else { + setisclassimage("False"); + } + setisclassimage(res.data.message.img); + var ch_img = "data:image/png;base64," + res.data.message.img; + setclass_img_stored_in_bdd(ch_img); + } + else { + //console.log(" In Erreur res.data.status = " + res.data.status); + //console.log(" In Erreur res.data.message = " + res.data.message); + setisclassimage("False"); + setuserimgclassprofil(); + setclass_img_stored_in_bdd(); + } + }).catch((error) => { + + console.warn('getClassImage ee: Not good man :( getClassImage = '); + setisclassimage("False"); + setuserimgclassprofil(""); + setclass_img_stored_in_bdd(""); + }) + + } + + + /* Cette variable accompagne la gestion des images par defaut. + idée : si la valeur de "DetailTraining.metier" != "management, digital, office, rh, vente, dev_perso" + alors l'utilisateur à créer une formation avec un metier qui n'est pas geré, donc on met une image par defaut + */ + const [ismetiermanaged, setismetiermanaged] = useState(); + const liste_metier = ["management", "digital", "office", "rh", "vente", "dev_perso"]; + + useEffect(() => { + setmyfilter(props.myfil); + + if (typeof (stored_user) === "undefined" || String(stored_user) === '') { + setuserconnected("0"); + } else { + setuserconnected("1"); + } + + if (typeof (stored_partner) === "undefined" || String(stored_partner) === '') { + setpartnerconnected("0"); + } else { + setpartnerconnected("1"); + } + + getClassImage_no_token(); + GetCurrentClass_trainingsession(); + + GetCurrentClass_trainingsession_cities(); + + // Verifier si le metier est geré + if (props.formation.metier) { + if (!liste_metier.includes(props.formation.metier)) { + setismetiermanaged("0"); // j'ai une valeur dans metier, mais qui n'est pas geré + } + } + else { + setismetiermanaged("0"); + } + + if (props.formation.img_url && String(props.formation.img_url).length > 0) { + setismetiermanaged("1"); + } + + }, []); + + + const [GetCurrentClass_api, setGetCurrentClass_api] = useState(); + const [GetCurrentClass_message, setGetCurrentClass_message] = useState(); + const [GetCurrentClass_result, setGetCurrentClass_result] = useState(); + function GetCurrentClass_trainingsession(event) { + + var form = new FormData(); + + form.append("class_internal_url", props.formation.internal_url); + + form.append("token", stored_partner); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/GetActiveSessionFormation_List/"; + + axios.post(myurl, form).then(res => { + + if (res.data.status != "false") { + //console.log(" In GetCurrentClass_trainingsession res.data.status = " + res.data.status); + //console.log(" In GetCurrentClass_trainingsession res.data.message r_class = " + res.data.message); + setGetCurrentClass_api("true"); + setGetCurrentClass_result(res.data.message); + } + else { + setGetCurrentClass_api("false"); + setGetCurrentClass_message(res.data.message); + } + + }).catch((error) => { + console.warn('Not good man :( GetCurrentClass_trainingsession = ', error); + setGetCurrentClass_api("false"); + //setmyApimyApiMessage("") + }) + } + + + 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([]); + function GetCurrentClass_trainingsession_cities(event) { + + var form = new FormData(); + + form.append("class_internal_url", props.formation.internal_url); + + form.append("token", stored_partner); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/GetActiveSession_Cities_And_Distance_Formation_List/"; + + axios.post(myurl, form).then(res => { + + if (res.data.status != "false") { + //console.log(" In GetCurrentClass_trainingsession_cities res.data.status = " + res.data.status); + //console.log(" In GetCurrentClass_trainingsession_cities res.data.message r_class = " + res.data.message); + setGetCurrentClass_trainingsession_cities_api("true"); + setGetCurrentClass_trainingsession_cities_result(res.data.message); + } + else { + setGetCurrentClass_trainingsession_cities_api("false"); + setGetCurrentClass_trainingsession_cities_message(res.data.message); + } + + }).catch((error) => { + console.warn('Not good man :( GetCurrentClass_trainingsession_cities = ', error); + setGetCurrentClass_trainingsession_cities_api("false"); + //setmyApimyApiMessage("") + }) + } + + return ( + +
+ +
+ + {class_img_stored_in_bdd && String(class_img_stored_in_bdd).length > 50 &&
+ informatique +
+ } + + + { (!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50 ) && String(ismetiermanaged) !== "0" && String(ismetiermanaged) !== "1" &&
+ + {(!props.formation.img_url || String(props.formation.img_url).length <= 0) && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("it") && + String(isclassimage) === "False" && informatique} + + {(!props.formation.img_url || String(props.formation.img_url).length <= 0) && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("graphisme") && + String(isclassimage) === "False" && graphisme} + + {(!props.formation.img_url || String(props.formation.img_url).length <= 0) && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("management") && + String(isclassimage) === "False" && management} + + {(!props.formation.img_url || String(props.formation.img_url).length <= 0) && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("digital") && + String(isclassimage) === "False" && digital} + + {(!props.formation.img_url || String(props.formation.img_url).length <= 0) && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("office") && + String(isclassimage) === "False" && office} + + {!props.formation.img_url || String(props.formation.img_url).length <= 0 && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("rh") && + String(isclassimage) === "False" && ressources humaines} + + {!props.formation.img_url || String(props.formation.img_url).length <= 0 && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("vente") && + String(isclassimage) === "False" && vente} + + {!props.formation.img_url || String(props.formation.img_url).length <= 0 && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("dev_perso") && + String(isclassimage) === "False" && developpement personnel} + + {String(isclassimage) === "True" && developpement personnel} + + +
+ } + + + {(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50 ) && String(ismetiermanaged) === "0" && String(userimgclassprofil).length > 100 &&
+ autre + {props.formation.institut_formation &&
Dispensé par :
{String(props.formation.institut_formation)}
} +
} + + {(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50 ) && String(ismetiermanaged) === "0" && String(userimgclassprofil).length <= 100 &&
+ autre + {props.formation.institut_formation &&
Dispensé par :
{String(props.formation.institut_formation)}
} +
} + + {(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50 ) && String(ismetiermanaged) === "1" &&
+ autre + {props.formation.institut_formation &&
Dispensé par :
{String(props.formation.institut_formation)}
} +
} + + +
{ + e.preventDefault(); + if (props.formation.url && props.formation.url.length > 5) { + + window.open( + props.formation.url, + '_blank' + ); + } else { + window.open( + "/Display-Partner-Catalog-Detail-formation/" + props.formation.internal_url, + '_blank' + ); + } + }}> +
+
+ +
+ {props.formation.note && String(props.formation.note).length === 1 && + parseInt(String(props.formation.note)) <= 5 && + + + + } + +
+
+
+
+ + + {props.formation.cpf && String(props.formation.cpf) === String("1") && +
+ OUI Éligible au CPF   +
} + + {props.formation.cpf && String(props.formation.cpf) !== String("1") && +
+ NON Éligible au CPF   +
} + + {!props.formation.cpf && +
+ NON Éligible au CPF   +
} + +
+
+
+
+ +
+

+ + {String(parse(String(props.formation.title).replace(/(<([^>]+)>)/ig, ''))).substring(0, 100)} + + +

+
+
+ + {String(props.formation.price).length == 9 && +
Prix : Non communiqué   +
+ } + + + {String(props.formation.price).length != 9 && String(props.formation.price) === String("0") && +
Gratuit   +
+ } + + {String(props.formation.price).length != 9 && String(props.formation.price) !== String("0") && (!props.formation.business_prices || + Object.keys(props.formation.business_prices).length <= 0) && +
{props.formation.price} € HT  + +
+ } + + {String(props.formation.price).length != 9 && String(props.formation.price) !== String("0") && + props.formation.business_prices && Object.keys(props.formation.business_prices).length > 0 && +
+ + + + +
+ } + +
+ +
+ {parse(String(props.formation.description).replace(/(<([^>]+)>)/ig, ''))} + +
+ {GetCurrentClass_trainingsession_cities_result && GetCurrentClass_trainingsession_cities_result.length > 0 && + + } + {!GetCurrentClass_result || GetCurrentClass_result.length <= 0 && + + } + +
+
+
+ +
+ +
+
+ {!props.formation.extented_search && +
+ + + {props.formation.duration_unit && +
+
Durée +
+ + {String(props.formation.duration_unit) === "heure" && +
+ {props.formation.duration} hr(s)   +
} + + {String(props.formation.duration_unit) === "heures" && +
+ {props.formation.duration} hr(s)   +
} + + + {String(props.formation.duration_unit) === "jour" && +
+ {props.formation.duration} jr(s)   +
} + + {String(props.formation.duration_unit) === "mois" && +
+ {props.formation.duration} mois(s) +
} + + {String(props.formation.duration_unit) === "semaine" && +
+ {props.formation.duration} Sem (s) +
} + + {String(props.formation.duration_unit) === "user_rythme" && +
+ A votre rythme +
} + +
+ } + + + {!props.formation.duration_unit && +
+
Durée +
+ + {props.formation.duration &&
+ {props.formation.duration} jr(s)   +
} + + {!props.formation.duration &&
+ En traitement   +
} + + +
+ + } +
+
+ Certification +
+ +
+ {props.formation.certif && String(props.formation.certif) === String("1") && +
+ Oui   +
} + + {props.formation.certif && String(props.formation.certif) !== String("1") && +
+ Non   +
} + + {!props.formation.certif && +
+ NC   +
} + + +
+
+ +
+ + + +   + + + + + +   + + + + +
+ + + +
} + + +
+ {String(props.formation.coeur) === String("1") &&
+ coup de coeur +
} + + + + + +
+
+ Sur site +
+ {props.formation.presentiel && props.formation.presentiel.presentiel && + String(props.formation.presentiel.presentiel) === String("1") &&
+ Oui +
} + + {props.formation.presentiel && props.formation.presentiel.presentiel && + String(props.formation.presentiel.presentiel) !== String("1") &&
+ Non +
} + + {!props.formation.presentiel || !props.formation.presentiel.presentiel && +
+ NC +
} +
+ +
+
+ A distance +
+ {props.formation.presentiel && props.formation.presentiel.distantiel && + String(props.formation.presentiel.distantiel) === String("1") &&
+ Oui +
} + + {props.formation.presentiel && props.formation.presentiel.distantiel && + String(props.formation.presentiel.distantiel) !== String("1") &&
+ Non +
} + + {!props.formation.presentiel || !props.formation.presentiel.distantiel && +
+ NC +
} +
+ +
+
+ Support +
+ {props.formation.support && +
+ {props.formation.support} +
} + + {!props.formation.support && +
+ NC +
} +
+ + +
+ +
+
+
+ {!props.formation.extented_search && props.formation.coeur != "1" && +
+ + + + + + + {GetCurrentClass_result && GetCurrentClass_result.length > 0 && + + } + +
} + +
+
+
+
+ + ) +} + + +export default Formation_Partner_Catalog; \ No newline at end of file diff --git a/src/components/PROD_FRONT_CODE/New_C_Formation_2025.js b/src/components/PROD_FRONT_CODE/New_C_Formation_2025.js new file mode 100644 index 0000000..301a574 --- /dev/null +++ b/src/components/PROD_FRONT_CODE/New_C_Formation_2025.js @@ -0,0 +1,483 @@ +import React, { useState, useEffect } from "react"; + +import { useHistory } from "react-router-dom"; + +import { useCookies } from "react-cookie"; +import { confirmAlert } from 'react-confirm-alert'; + +import img_met_program from "../mysy_img/met_programmation.jpg"; + +import img_met_graphisme from "../mysy_img/metier_graphisme.jpg"; + +import img_met_autre from "../mysy_img/met_autre.jpg"; +import img_met_digital from "../mysy_img/met_digital.jpg"; +import img_met_management from "../mysy_img/met_management.jpg"; + +import img_met_dev_perso from "../mysy_img/metier_dev_perso.jpg"; +import img_met_rh from "../mysy_img/met_rh.jpg"; + +import img_met_bureautic from "../mysy_img/met_burautic.jpg"; +import img_met_vente from "../mysy_img/met_vente.jpg"; +import axios from "axios"; +//import { Rating } from 'react-simple-star-rating' +import Rating from '@mui/material/Rating'; +import parse from 'html-react-parser' +import { CiLocationOn } from "react-icons/ci"; + +const New_C_Formation_2025 = (props) => { + const [userconnected, setuserconnected] = useState("0"); + const [partnerconnected, setpartnerconnected] = useState("0"); + const [cookie, setCookie, removeCookie] = useCookies(['tokenmysych']); + const [cookie_part, setCookie_part, removeCookie_part] = useCookies(['tokenmysypart']); + const history = useHistory(); + const [myfilter, setmyfilter] = useState(props.formation.price); + + const [profileimg, setprofileimg] = useState(props.formation.price); + + + // Gestion des Cookies + const stored_partner = cookie_part.tokenmysypart; + const stored_user = cookie.tokenmysych; + + function test(val) { + + if (userconnected === "0" && partnerconnected === "0") { + confirmAlert({ + title: 'Activer votre session ?', + message: 'Merci de vous connecter pour acceder au detail de cette formation', + buttons: [ + { + label: 'Oui', + onClick: () => { history.push("/mysy-training-login/training/" + props.formation.internal_url) } + }, + { + label: 'Non', + onClick: () => { return } + + } + ], + closeOnEscape: false, + closeOnClickOutside: false, + keyCodeForClose: [8, 32], + willUnmount: () => { }, + afterClose: () => { }, + onClickOutside: () => { }, + onKeypress: () => { }, + onKeypressEscape: () => { }, + }); + } else { + window.open( + "/Display-Detail-formation/" + props.formation.internal_url, + '_blank' + ); + } + + + } + + const [myclassimage, setmyclassimage] = useState(); + const [isclassimage, setisclassimage] = useState("False"); + const [userimgclassprofil, setuserimgclassprofil] = useState(""); + + const [class_img_stored_in_bdd, setclass_img_stored_in_bdd] = useState(""); + + function getClassImage_no_token() { + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/getRecodedClassImage_no_token/"; + + var form = new FormData(); + + form.append("type", "partner"); + form.append("related_collection", "myclass"); + form.append("related_collection_recid", props.formation._id); + form.append("class_external_code", props.formation.external_code); + + axios.post(myurl, form).then(res => { + + // console.log(" getClassImage_no_token : In test res.data.status = ", res.data.status); + if (String(res.data.status) === "true") { + + + //console.log(" getClassImage_no_token: res.data.message.img = ", res.data.message); + + if (res.data.message.img.length > 0) { + setisclassimage("True"); + } + else { + setisclassimage("False"); + } + setisclassimage(res.data.message.img); + var ch_img = "data:image/png;base64," + res.data.message.img; + setclass_img_stored_in_bdd(ch_img); + // console.log(" getClassImage_no_token: setclass_img_stored_in_bdd = ", setclass_img_stored_in_bdd); + + } + else { + // console.log(" In Erreur res.data.status = " + res.data.status); + //console.log(" In Erreur res.data.message = " + res.data.message); + setisclassimage("False"); + setuserimgclassprofil(); + setclass_img_stored_in_bdd(); + } + }).catch((error) => { + + console.warn('getClassImage ee: Not good man :( getClassImage = '); + setisclassimage("False"); + setuserimgclassprofil(""); + setclass_img_stored_in_bdd(""); + }) + + } + + + /* Cette variable accompagne la gestion des images par defaut. + idée : si la valeur de "DetailTraining.metier" != "management, digital, office, rh, vente, dev_perso" + alors l'utilisateur à créer une formation avec un metier qui n'est pas geré, donc on met une image par defaut + */ + const [ismetiermanaged, setismetiermanaged] = useState(); + const liste_metier = ["management", "digital", "office", "rh", "vente", "dev_perso"]; + + useEffect(() => { + setmyfilter(props.myfil); + + // console.log(" #### useEffect props.formation = ", props.formation); + + + if (typeof (stored_user) === "undefined" || String(stored_user) === '') { + setuserconnected("0"); + } else { + setuserconnected("1"); + } + + if (typeof (stored_partner) === "undefined" || String(stored_partner) === '') { + setpartnerconnected("0"); + } else { + setpartnerconnected("1"); + } + + getClassImage_no_token(); + GetCurrentClass_trainingsession(); + + GetCurrentClass_trainingsession_cities(); + + // Verifier si le metier est geré + if (props.formation.metier) { + if (!liste_metier.includes(props.formation.metier)) { + setismetiermanaged("0"); // j'ai une valeur dans metier, mais qui n'est pas geré + } + } + else { + setismetiermanaged("0"); + } + + if (props.formation.img_url && String(props.formation.img_url).length > 0) { + setismetiermanaged("1"); + } + + }, []); + + + const [GetCurrentClass_api, setGetCurrentClass_api] = useState(); + const [GetCurrentClass_message, setGetCurrentClass_message] = useState(); + const [GetCurrentClass_result, setGetCurrentClass_result] = useState(); + function GetCurrentClass_trainingsession(event) { + + var form = new FormData(); + + form.append("class_internal_url", props.formation.internal_url); + + form.append("token", stored_partner); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/GetActiveSessionFormation_List/"; + + axios.post(myurl, form).then(res => { + + if (res.data.status != "false") { + //console.log(" In GetCurrentClass_trainingsession res.data.status = " + res.data.status); + //console.log(" In GetCurrentClass_trainingsession res.data.message r_class = " + res.data.message); + setGetCurrentClass_api("true"); + setGetCurrentClass_result(res.data.message); + } + else { + setGetCurrentClass_api("false"); + setGetCurrentClass_message(res.data.message); + } + + }).catch((error) => { + console.warn('Not good man :( GetCurrentClass_trainingsession = ', error); + setGetCurrentClass_api("false"); + //setmyApimyApiMessage("") + }) + } + + + 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([]); + function GetCurrentClass_trainingsession_cities(event) { + + var form = new FormData(); + + form.append("class_internal_url", props.formation.internal_url); + + form.append("token", stored_partner); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/GetActiveSession_Cities_And_Distance_Formation_List/"; + + axios.post(myurl, form).then(res => { + + if (res.data.status != "false") { + //console.log(" In GetCurrentClass_trainingsession_cities res.data.status = " + res.data.status); + //console.log(" In GetCurrentClass_trainingsession_cities res.data.message r_class = " + res.data.message); + setGetCurrentClass_trainingsession_cities_api("true"); + setGetCurrentClass_trainingsession_cities_result(res.data.message); + } + else { + setGetCurrentClass_trainingsession_cities_api("false"); + setGetCurrentClass_trainingsession_cities_message(res.data.message); + } + + }).catch((error) => { + console.warn('Not good man :( GetCurrentClass_trainingsession_cities = ', error); + setGetCurrentClass_trainingsession_cities_api("false"); + //setmyApimyApiMessage("") + }) + } + + const styles = { + list: { + display: 'flex', + flexDirection: 'column', + gap: '32px', + width: '100%', + }, + row: { + display: 'flex', + flexDirection: 'row', + gap: '24px', + width: '100%', + }, + card: { + flexGrow: 1, + backgroundColor: '#fff', + borderRadius: '8px', + overflow: 'hidden', + display: 'flex', + flexDirection: 'column', + }, + + image: { + maxWidth: '100%', + height: '200px', + overflow: 'hidden', + margin: "auto", + + }, + content: { + padding: '16px', + }, + header: { + display: 'flex', + justifyContent: 'space-between', + alignItems: 'center', + }, + eligibility: { + backgroundColor: '#e2e9fb', + padding: '4px 8px', + borderRadius: '4px', + fontSize: '12px', + fontWeight: 'bold', + }, + title: { + fontSize: '14px', + fontWeight: 'bold', + margin: '8px 0', + }, + price: { + fontSize: '14px', + fontWeight: 'bold', + color: '#000', + }, + description: { + fontSize: '12px', + color: '#666', + margin: '8px 0', + height: "40px", + overflow: "hidden", + }, + details: { + display: 'flex', + justifyContent: 'space-between', + marginTop: '16px', + }, + button: { + backgroundColor: '#007bff', + color: '#fff', + padding: '8px 16px', + border: 'none', + borderRadius: '4px', + cursor: 'pointer', + }, + buttonOutline: { + backgroundColor: '#fff', + color: '#007bff', + padding: '8px 16px', + border: '1px solid #007bff', + borderRadius: '4px', + cursor: 'pointer', + }, + }; + + return ( + +
+ + +
+
+ +
 
+ + {props.formation.cpf && String(props.formation.cpf) === String("1") &&
+ {"OUI CPF"} +
+ } + {props.formation.cpf && String(props.formation.cpf) !== String("1") &&
+ {"NON CPF"} +
+ } + {!props.formation.cpf && String(props.formation.cpf) !== String("1") &&
+ {"NON CPF"} +
} + +
+ + + {class_img_stored_in_bdd && String(class_img_stored_in_bdd).length > 50 && + Formation + } + + {(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50) && + (!props.formation.img_url || String(props.formation.img_url).length <= 10) && + String(ismetiermanaged) !== "0" && String(ismetiermanaged) !== "1" && + +
+ + {(!props.formation.img_url || String(props.formation.img_url).length <= 0) && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("it") && + String(isclassimage) === "False" && informatique} + + {(!props.formation.img_url || String(props.formation.img_url).length <= 0) && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("graphisme") && + String(isclassimage) === "False" && graphisme} + + {(!props.formation.img_url || String(props.formation.img_url).length <= 0) && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("management") && + String(isclassimage) === "False" && management} + + {(!props.formation.img_url || String(props.formation.img_url).length <= 0) && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("digital") && + String(isclassimage) === "False" && digital} + + {(!props.formation.img_url || String(props.formation.img_url).length <= 0) && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("office") && + String(isclassimage) === "False" && office} + + {!props.formation.img_url || String(props.formation.img_url).length <= 0 && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("rh") && + String(isclassimage) === "False" && ressources humaines} + + {!props.formation.img_url || String(props.formation.img_url).length <= 0 && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("vente") && + String(isclassimage) === "False" && vente} + + {!props.formation.img_url || String(props.formation.img_url).length <= 0 && + props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("dev_perso") && + String(isclassimage) === "False" && developpement personnel} + + {String(isclassimage) === "True" && developpement personnel} + + +
+ } + + {(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50) && String(ismetiermanaged) === "0" && String(userimgclassprofil).length > 100 && +
+ autre + {/*props.formation.institut_formation &&
Dispensé par :
+ {String(props.formation.institut_formation)}
*/} +
} + + {(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50) && String(ismetiermanaged) === "0" && String(userimgclassprofil).length <= 100 && +
+ autre + {/*props.formation.institut_formation &&
Dispensé par :
+ {String(props.formation.institut_formation)}
*/} +
} + + {(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50) && String(ismetiermanaged) === "1" && +
+ autre + {/*props.formation.institut_formation &&
Dispensé par :
+ {String(props.formation.institut_formation)}
*/} +
} + + +
+
+
+ {props.formation.note && String(props.formation.note).length === 1 && + parseInt(String(props.formation.note)) <= 5 && + + } +
+ +

{String(parse(String(props.formation.title).replace(/(<([^>]+)>)/ig, ''))).substring(0, 50)}

+ {props.formation.discounted_price && props.formation.business_prices &&

{props.formation.discounted_price} € HT 

} + + {props.formation.business_prices && props.formation.business_prices.length <= 0 + &&

{props.formation.price} € HT 

} + + {props.formation.business_prices && props.formation.business_prices.length > 0 && +

+ +

{props.formation.business_prices[0].discounted_price}€ HT  + {props.formation.price} € HT   + ({props.formation.business_prices[0].discount} %)

+

} + +

{String(parse(String(props.formation.description).replace(/(<([^>]+)>)/ig, ''))).substring(0, 80)}...

+
+ +
+
+ + +
+
+ + + +
+ + ) +} + + +export default New_C_Formation_2025; \ No newline at end of file diff --git a/src/components/PROD_FRONT_CODE/Partner_Commande.js b/src/components/PROD_FRONT_CODE/Partner_Commande.js new file mode 100644 index 0000000..3aeead4 --- /dev/null +++ b/src/components/PROD_FRONT_CODE/Partner_Commande.js @@ -0,0 +1,8783 @@ +import React, { useRef, useState, useEffect } from "react"; +import TextField from '@mui/material/TextField'; +import MenuItem from '@mui/material/MenuItem'; +import 'react-confirm-alert/src/react-confirm-alert.css'; // Import css +import Button from '@mui/material/Button'; +import axios from "axios"; +import { getCookie, } from 'react-use-cookie'; +import { useHistory } from "react-router-dom"; + +import { DataGrid, GridToolbar, frFR } from '@mui/x-data-grid'; +import "react-draft-wysiwyg/dist/react-draft-wysiwyg.css"; + +import { Fab } from "@material-ui/core"; +import { IoMdAddCircle, } from "react-icons/io"; + +import { FcViewDetails, } from "react-icons/fc"; +import 'react-tooltip/dist/react-tooltip.css'; +import { Tooltip } from 'react-tooltip'; + +import Autocomplete from '@mui/material/Autocomplete'; +import fileDownload from 'js-file-download' +import Popup from 'reactjs-popup'; +import 'reactjs-popup/dist/index.css'; + +import fr from 'date-fns/locale/fr'; +import { registerLocale } from 'react-datepicker'; +import DatePicker from "react-datepicker"; +import "react-datepicker/dist/react-datepicker.css"; +import { format } from 'date-fns' +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'; +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 Module_Historique_Action from "./Module_Historique_Action"; +import img_loading_spin from "./../mysy_img/mysy_spin_loading.gif"; +import { Global } from "recharts"; +import { FcAddDatabase } from "react-icons/fc"; +import { IoAddCircleOutline } from "react-icons/io5"; +import ToggleSwitch from "./ToggleSwitch"; +import { FcInfo } from "react-icons/fc"; + +import Link from '@mui/material/Link'; +import { PiDotsThree, } from "react-icons/pi"; + +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'; +import { FcOpenedFolder } from "react-icons/fc"; + +import { useParams } from 'react-router-dom'; +import { + GridToolbarContainer, GridToolbarExport, GridToolbarColumnsButton, + GridToolbarFilterButton, GridToolbarDensitySelector, GridToolbarExportContainer, useGridApiContext, + gridFilteredSortedRowIdsSelector, + gridVisibleColumnFieldsSelector, + + +} from '@mui/x-data-grid'; +import * as XLSX from 'xlsx'; +import Paper from '@material-ui/core/Paper'; +import Draggable from 'react-draggable'; + +import Module_Alert_Confirmation from "./Module_Alert_Confirmation"; + +function PaperComponent(props) { + return ( + + + + ); +} + + +const useStyles = makeStyles((theme) => ({ + + dialog: { + position: 'absolute', + // left: 10, + top: 400 + }, + + paper: { + overflowY: 'unset', + }, + customizedButton: { + position: 'absolute', + left: '95%', + top: '-10px', + backgroundColor: 'lightgray', + color: 'gray', + }, +})); + + + +const Partner_Commande = (props) => { + + const { action, orderid } = useParams(); + registerLocale('fr', fr); + const classes = useStyles(); + + const history = useHistory(); + const [submenu, setsubmenu] = useState(""); + const [rowss, setRows] = useState([]); + const [rowss_total_data, setRows_total_data] = useState([]); + const [selectionModel, setSelectionModel] = React.useState([]); + + const [article_formation_ou_produit, setarticle_formation_ou_produit] = useState("formation"); + + const [rows_order_lines, setrows_order_lines] = useState([]); + const [selectionModel_order_lines, setselectionModel_order_lines] = React.useState([]); + + var date_today_90j = new Date(); + date_today_90j.setDate(date_today_90j.getDate() + 90); + + const [p_filtre1, setp_filtre1] = useState(""); + const [p_filtre1_value, setp_filtre1_value] = useState(""); + + const [p_filtre2, setp_filtre2] = useState(""); + const [p_filtre2_value, setp_filtre2_value] = useState(""); + + const [p_filtre3, setp_filtre3] = useState(""); + const [p_filtre3_value, setp_filtre3_value] = useState(""); + + const [p_filtre4, setp_filtre4] = useState(""); + const [p_filtre4_value, setp_filtre4_value] = useState(""); + + function ExpandableCell_50({ value }) { + const [expanded, setExpanded] = React.useState(false); + + return ( + + ); + } + + const columns = [ + { field: '_id', headerName: '_id', hide: true, disableExport: true, }, + { field: 'id', headerName: 'id', hide: true, disableExport: true, }, + { field: 'order_header_ref_interne', headerName: 'Reference', maxWidth: 200, minWidth: 180, flex: 1, hide: false, editable: false, renderCell: (params) => , }, + { field: 'order_header_type', headerName: 'Type', width: 100, hide: false, editable: false }, + { + field: 'order_header_status', headerName: 'Statut', maxWidth: 150, flex: 1, hide: false, editable: false, + renderCell: (cellValues) => { + + return ( +
+ {cellValues.row.order_header_status && String(cellValues.row.order_header_status) === "-1" && "Annulé"} + {cellValues.row.order_header_status && String(cellValues.row.order_header_status) === "0" && "Brouillon"} + + {cellValues.row.order_header_status && String(cellValues.row.order_header_status) === "1" && "En cours"} + + + {cellValues.row.order_header_status && String(cellValues.row.order_header_status) === "2" + && String(cellValues.row.order_header_type) === "commande" && "Traité"} + + {cellValues.row.order_header_status && String(cellValues.row.order_header_status) === "2" + && String(cellValues.row.order_header_type) === "devis" && "Fermé"} + + {cellValues.row.order_header_status && String(cellValues.row.order_header_status) === "3" + && String(cellValues.row.order_header_type) === "commande" && "Facturé"} + + {cellValues.row.order_header_status && String(cellValues.row.order_header_status) === "3" + && String(cellValues.row.order_header_type) === "devis" && "Gagné"} + + {cellValues.row.order_header_status && String(cellValues.row.order_header_status) === "4" + && String(cellValues.row.order_header_type) === "devis" && "Perdu"} + + + +
+ + ); + + }, + + + }, + { field: 'order_header_client_id', headerName: 'Client_Id', width: 0, hide: true, editable: false, disableExport: true, }, + { field: 'order_header_client_nom', headerName: 'Nom Client', minWidth: 200, flex: 1, renderCell: (params) => , }, + { field: 'order_header_vendeur_id', headerName: 'Vendeur Id', width: 0, hide: true, editable: false, disableExport: true, }, + { field: 'order_header_vendeur_nom_prenom', headerName: 'Vendeur', width: 150, flex: 1, editable: false, flex: 1 }, + { field: 'order_header_date_cmd', headerName: 'Date', minWidth: 150, hide: false, editable: false, flex: 1, renderCell: (params) => , }, + { field: 'order_header_date_expiration', headerName: 'Date Expiration', minWidth: 150, hide: false, editable: false }, + + { + field: "delete", headerName: 'Supprimer', disableExport: true, + renderCell: (cellValues) => { + return ( + <> + {String(props.check_user_acces_right("commande", "write")) === "1" && { + // handleClick_delete(event, cellValues); + }} + > + + + } + modal + nested + position="center center" + > + {close => ( +
+ +
MySy Information
+
+ {' '} + + En confirmant cette opération, le document sera définitivement supprimé.
+ +
+
+
+ + +
+
+ +
+
+
+ )} +
} + + + ); + } + } + + ] + + + 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', minWidth: 200, flex: 1, + renderCell: (cellValues) => { + return ( +
+ +
+ ); + } + }, + { + field: 'order_line_session_code', headerName: 'Code Session', minwidth: 200, flex: 1, hideable: true, resizable: true, + renderCell: (cellValues) => { + return ( + + + + ); + }, + }, + + + + { field: 'order_line_formation_external_code', headerName: 'Code Formation', minwidth: 200, flex: 1, hide: 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 }, + { field: 'order_line_montant_hors_taxes', headerName: 'Total HT', width: 100, hide: false, editable: false }, + { field: 'order_line_tax_amount', headerName: 'Taxe', width: 100, hide: false, editable: false }, + + { field: 'order_line_type_reduction', headerName: 'Reduc. Type', width: 100, hide: true, editable: false }, + { field: 'order_line_type_valeur', headerName: 'Reduc. Val', width: 100, hide: true, editable: false }, + { field: 'order_line_montant_reduction', headerName: 'Reduc. Mont.', width: 100, hide: false, editable: false }, + + + { field: 'order_line_taux_taxe', headerName: '% Taxe', width: 100, hide: false, editable: false }, + + { field: 'order_line_montant_toutes_taxes', headerName: 'Montant TTC', width: 100, hide: false, editable: false }, + { field: 'order_header_id', headerName: 'Id_Entete', hide: true, editable: false }, + { field: 'order_header_ref_interne', headerName: 'Ref_Interne', hide: true, editable: false }, + { field: 'order_line_type', headerName: 'Type', width: 100, hide: true, editable: false }, + { field: 'order_line_type_article', headerName: 'Type Article', width: 100, hide: true, editable: false }, + { field: 'related_order_internal_ref', headerName: 'Cmd. Associé', width: 100, hide: true, editable: false }, + { + field: 'order_line_status', headerName: 'Statut', width: 150, hide: true, editable: false, + renderCell: (cellValues) => { + + return ( +
+ {cellValues.row.order_line_status && String(cellValues.row.order_line_status) === "-1" && "Annulé"} + {cellValues.row.order_line_status && String(cellValues.row.order_line_status) === "0" && "Brouillon"} + + {cellValues.row.order_line_status && String(cellValues.row.order_line_status) === "1" && "En cours"} + + + {cellValues.row.order_line_status && String(cellValues.row.order_line_status) === "2" + && String(cellValues.row.order_line_type) === "commande" && "Traité"} + + {cellValues.row.order_line_status && String(cellValues.row.order_line_status) === "2" + && String(cellValues.row.order_line_type) === "devis" && "Fermé"} + + {cellValues.row.order_line_status && String(cellValues.row.order_line_status) === "3" + && String(cellValues.row.order_line_type) === "commande" && "Facturé"} + + {cellValues.row.order_line_status && String(cellValues.row.order_line_status) === "3" + && String(cellValues.row.order_line_type) === "devis" && "Gagné"} + + {cellValues.row.order_line_status && String(cellValues.row.order_line_status) === "4" + && String(cellValues.row.order_line_type) === "devis" && "Perdu"} + + + +
+ + ); + + }, + + valueFormatter: (params) => { + if (String(params.value) === "-1") + return "Annulé"; + else if (String(params.value) === "0") + return "Brouillon"; + else if (String(params.value) === "1") + return "En cours"; + else if (String(params.value) === "2") + return "Traité"; + else if (String(params.value) === "3") + return "Facturé"; + else + return "?"; + + }, + }, + { + field: "Detail", headerName: 'Voir détail', + renderCell: (cellValues) => { + return ( + + + + ); + } + }, + + { + field: "delete", headerName: 'Supprimer', + renderCell: (cellValues) => { + return ( + <> + {String(props.check_user_acces_right("commande", "write")) === "1" && + { + // handleClick_delete(event, cellValues); + }} + > + + + } + modal + nested + position="center center" + > + {close => ( +
+ +
MySy Information
+
+ {' '} + + En confirmant cette opération, la ligne sera définitivement supprimée.
+ +
+
+
+ + +
+
+ +
+
+
+ )} +
} + + + + ); + } + }, + { field: 'order_line_comment', headerName: 'Commentaire', width: 150, hide: true, editable: false, }, + + ] + + + + function handleClick_delete(event, cellValues) { + + var local_order_header_id = cellValues.row._id; + var local_order_type = cellValues.row.order_header_type; + + + + Delete_Order_Header_AndLine_Data(local_order_header_id, local_order_type); + } + + + const [Delete_Order_Header_AndLine_Data_api, setDelete_Order_Header_AndLine_Data_api] = useState(); + const [Delete_Order_Header_AndLine_Data_message, setDelete_Order_Header_AndLine_Data_message] = useState(); + const [Delete_Order_Header_AndLine_Data_result, setDelete_Order_Header_AndLine_Data_result] = useState(); + function Delete_Order_Header_AndLine_Data(local_order_header_id, local_order_type) { + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("order_header_id", local_order_header_id); + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Delete_Partner_Order_Header_And_Lines/"; + + setLoading(true); + axios.post(myurl, form).then(res => { + //console.log(" In Delete_Order_Header_AndLine_Data res.data.status = " + res.data.status); + //console.log(" In Delete_Order_Header_AndLine_Data res.data.message r_class = " + res.data.message); + + setLoading(false); + if (String(res.data.status) === String("true")) { + setDelete_Order_Header_AndLine_Data_api("true"); + setDelete_Order_Header_AndLine_Data_result(res.data.message); + + clean_order_detail_fields(); + setsubmenu(); + setdisplay_detail_order(); + setadd_One_Order(); + setSelectionModel([]); + + setgridline_id(""); + Getall_Parter_Orders_No_Filter(); + + if (document.getElementById('myRef_head')) { + var divh = document.getElementById('myRef_head').offsetTop; + window.scrollTo({ + top: divh, + behavior: "smooth", + }); + } + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("success"); + } + else { + setDelete_Order_Header_AndLine_Data_api("false"); + setDelete_Order_Header_AndLine_Data_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + + } + + }).catch((error) => { + setLoading(false); + console.log('Delete_Order_Header_AndLine_Data : Not good man :( Delete_Order_Header_AndLine_Data = ' + error); + setDelete_Order_Header_AndLine_Data_api("false"); + if (local_order_type == "devis") + alert(" Impossible de supprimer le devis "); + else + alert(" Impossible de supprimer la commande "); + }) + } + + + + function Display_Detail_Order_Line(event, cellValues) { + + var order_line_id = String(cellValues.row._id); + + var order_line_formation = String(cellValues.row.order_line_formation); + var order_line_qty = String(cellValues.row.order_line_qty); + var order_line_prix_unitaire = String(cellValues.row.order_line_prix_unitaire); + + setselected_order_line_id(order_line_id); + + + setp_add_line_item_internal_url(order_line_formation); + + setp_add_line_item(order_line_formation); + setp_add_line_item_qty(order_line_qty); + setp_add_line_item_price(order_line_prix_unitaire); + setp_add_line_item_status(String(cellValues.row.order_line_status)); + setp_add_line_item_type(String(cellValues.row.order_line_type)); + setp_add_line_item_comment(String(cellValues.row.order_line_comment)); + + setp_add_line_session_id(String(cellValues.row.order_line_session_id)); + setp_add_line_session_code(String(cellValues.row.order_line_session_code)); + + setp_add_line_order_line_type_article(String(cellValues.row.order_line_type_article)); + setarticle_formation_ou_produit(String(cellValues.row.order_line_type_article)); + + //console.log(" String(cellValues.row.order_line_type_article = ", String(cellValues.row.order_line_type_article)); + + Get_Given_Line_Of_Partner_Order_Line_Data(order_line_id, order_internal_ref); + + setDialog_Detail_Article_open(true); + //alert(" afficher le detail de la ligne " + String(order_line_id)); + + } + + + function clean_all_filters() { + setp_filtre1(""); + setp_filtre1_value(); + + setp_filtre2(""); + setp_filtre2_value(); + + setp_filtre3(""); + setp_filtre3_value(); + + setp_filtre4(""); + setp_filtre4_value(); + + clean_order_detail_fields(); + setsubmenu(); + setorder_data_edit_mode(); + setorder_data_edit_mode(); + setdisplay_detail_order(); + setadd_One_Order(); + setSelectionModel([]); + setselectionModel_order_lines([]); + + Getall_Parter_Orders_No_Filter(); + + setgridline_id(""); + } + + + function handleClick_delete_Order_line(event, cellValues) { + + var local_order_line_id = cellValues.row._id; + + Delete_Order_Line_Data(local_order_line_id); + } + + const [Delete_Order_Line_Data_api, setDelete_Order_Line_Data_api] = useState(); + const [Delete_Order_Line_Data_message, setDelete_Order_Line_Data_message] = useState(); + const [Delete_Order_Line_Data_result, setDelete_Order_Line_Data_result] = useState(); + function Delete_Order_Line_Data(local_order_line_id) { + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("order_line_id", local_order_line_id); + form.append("order_header_id", selected_id); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Delete_Partner_Order_Line/"; + + setLoading(true); + axios.post(myurl, form).then(res => { + //console.log(" In Delete_Order_Line_Data res.data.status = " + res.data.status); + //console.log(" In Delete_Order_Line_Data res.data.message r_class = " + res.data.message); + + setLoading(false); + if (String(res.data.status) === String("true")) { + setDelete_Order_Line_Data_api("true"); + setDelete_Order_Line_Data_result(res.data.message); + + Display_Detail_Order_data(selected_id); + + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("success"); + } + else { + setDelete_Order_Line_Data_api("false"); + setDelete_Order_Line_Data_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + + } + + }).catch((error) => { + + setLoading(false); + console.log('Delete_Order_Line_Data : Not good man :( Delete_Order_Line_Data = ' + error); + setDelete_Order_Line_Data_api("false"); + alert(" Impossible de supprimer la ligne"); + }) + } + + + const myRef = useRef(null) + + const [Dialog_1_message, setDialog_1_message] = React.useState(false); + const [Dialog_1_open, setDialog_1_open] = React.useState(false); + function Dialog_1_handle_change_participant_session(message) { + setDialog_1_message(message); + setDialog_1_open(true); + } + + const Dialog_1_handleClose = () => { + //alert(" Utiliser le bouton 'fermer' "); + //setOpen(false); + }; + + const Dialog_1_handleClose_buton = () => { + setDialog_1_open(false); + }; + + const [New_GetCurrentPartnerClass_result, setNew_GetCurrentPartnerClass_result] = useState([]); + + const [GetCurrentPartnerClass_api, setGetCurrentPartnerClass_api] = useState(); + const [GetCurrentPartnerClass_message, setGetCurrentPartnerClass_message] = useState(); + const [GetCurrentPartnerClass_result, setGetCurrentPartnerClass_result] = useState(); + function GetCurrentPartnerClass(event) { + var form = new FormData(); + + + + //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("archive", "0"); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/get_partner_class/"; + + axios.post(myurl, form).then(res => { + + if (String(res.data.status) === String("true")) { + //console.log(" In GetCurrentPartnerClass res.data.status = " + res.data.status); + //console.log(" In GetCurrentPartnerClass res.data.message r_class = " + res.data.message); + setGetCurrentPartnerClass_api("true"); + setGetCurrentPartnerClass_result(res.data.message); + + var new_data2 = []; + + const new_data = res.data.message.map((x) => { + + //--- + var localid = JSON.parse(x).id; + var local_id = JSON.parse(x)._id; + var local_internal_url = JSON.parse(x).internal_url; + var local_title = JSON.parse(x).title; + var local_is_published = JSON.parse(x).published; + + + //--- + var node = { + "_id": local_id, + "id": localid, + "label": local_title, + "internal_url": local_internal_url, + "title": local_title, + "ispublished": local_is_published, + }; + new_data2.push(node); + + // return {"_id": " + str(local_id) + ", "label": " + local_courrier_template_ref_interne + '" , "courrier_template_ref_interne": "' + local_courrier_template_ref_interne + '", "nom_champ_technique": "' + local_nom_champ_technique + '", "nom_champ_fonctionel": "' + local_nom_champ_fonctionel + '","valide": "1" }; + + }); + + + var node = { + "_id": "", + "id": "", + "label": "", + "internal_url": "", + "title": "", + "ispublished": "", + }; + new_data2.push(node); + + if (new_data2.length > 0) { + setNew_GetCurrentPartnerClass_result(new_data2); + //console.log(" ### setNew_GetCurrentPartnerClass_result = ", New_GetCurrentPartnerClass_result); + } + + + } else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); + } + else { + setGetCurrentPartnerClass_api("false"); + setGetCurrentPartnerClass_message(res.data.message); + alert('Erreur: ' + res.data.message); + } + + }).catch((error) => { + console.warn('Not good man :( mysearchtext = ', error); + setGetCurrentPartnerClass_api("false"); + alert(" Impossible de recuperer la liste des formations") + }) + } + + const [New_Getall_Partner_Product_Service_result, setNew_Getall_Partner_Product_Service_result] = useState([]); + + const [Getall_Partner_Product_Service_api, setGetall_Partner_Product_Service_api] = useState(); + const [Getall_Partner_Product_Service_message, setGetall_Partner_Product_Service_message] = useState(); + const [Getall_Partner_Product_Service_result, setGetall_Partner_Product_Service_result] = useState([]); + function Getall_Partner_Product_Service(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_List_Partner_Produit_Service/"; + + + axios.post(myurl, form).then(res => { + + if (String(res.data.status) === String("true")) { + //console.log(" In Getall_Partner_Product_Service res.data.status = " + res.data.status); + //console.log(" In Getall_Partner_Product_Service res.data.message r_class = " + res.data.message); + setGetall_Partner_Product_Service_api("true"); + setGetall_Partner_Product_Service_result(res.data.message); + + var new_data2 = []; + const new_data = res.data.message.map((x) => { + + //--- + var localid = JSON.parse(x).id; + var local_id = JSON.parse(x)._id; + var local_code = JSON.parse(x).code; + var local_nom = JSON.parse(x).nom; + var local_type = JSON.parse(x).type; + var local_code_taxe = JSON.parse(x).code_taxe; + var local_prix_vente = JSON.parse(x).prix_vente; + + + //--- + var node = { + "_id": local_id, + "id": localid, + "label": local_code + "-" + local_nom, + "code": local_code, + "nom": local_nom, + "type": local_type, + "code_taxe": local_code_taxe, + "prix_vente": local_prix_vente, + + + }; + new_data2.push(node); + }); + + //--- + var node = { + "_id": "", + "id": "", + "label": "", + "code": "", + "nom": "", + "type": "", + "code_taxe": "", + "prix_vente": "", + + }; + new_data2.push(node); + + + if (new_data2.length > 0) + setNew_Getall_Partner_Product_Service_result(new_data2); + + } + else { + setGetall_Partner_Product_Service_api("false"); + setGetall_Partner_Product_Service_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + console.warn('Not good man :( Getall_Partner_Product_Service = ', error); + setGetall_Partner_Product_Service_api("false"); + alert(" Impossible de recuperer la liste des produits et services"); + //setmyApimyApiMessage("") + }) + } + + + + const [partner_digital_signature_status, setpartner_digital_signature_status] = useState("0"); + const [local_partner_digital_signature_status, setlocal_partner_digital_signature_status] = useState(false); + + + const [Getall_Partner_Digital_Sign_Status_api, setGetall_Partner_Digital_Sign_Status_api] = useState(); + const [Getall_Partner_Digital_Sign_Status_message, setGetall_Partner_Digital_Sign_Status_message] = useState(); + const [Getall_Partner_Digital_Sign_Status_result, setGetall_Partner_Digital_Sign_Status_result] = useState([]); + function Getall_Partner_Digital_Sign_Status(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/Is_Partnair_Has_Digital_Signature/"; + + setLoading(true); + axios.post(myurl, form).then(res => { + + setLoading(false); + + if (String(res.data.status) === String("true")) { + //console.log(" In Getall_Partner_Digital_Sign_Status res.data.status = " + res.data.status); + //console.log(" In Getall_Partner_Digital_Sign_Status res.data.message r_class = " + res.data.message); + setGetall_Partner_Digital_Sign_Status_api("true"); + setGetall_Partner_Digital_Sign_Status_result(res.data.message); + + + if (JSON.parse(res.data.message).config_name && JSON.parse(res.data.message).config_value) { + + + if (String(JSON.parse(res.data.message).config_name) === "signature_digital" && + String(JSON.parse(res.data.message).config_value) === "1") { + + setpartner_digital_signature_status("1"); + setlocal_partner_digital_signature_status(true); + + } + + } + + + + } + else { + setGetall_Partner_Digital_Sign_Status_api("false"); + setGetall_Partner_Digital_Sign_Status_message(res.data.message); + } + + }).catch((error) => { + setLoading(false); + console.warn('Not good man :( Getall_Partner_Digital_Sign_Status = ', error); + setGetall_Partner_Digital_Sign_Status_api("false"); + //setmyApimyApiMessage("") + }) + } + + + const [Getall_Parter_Devis_Config_Points_api, setGetall_Parter_Devis_Config_Points_api] = useState(); + const [Getall_Parter_Devis_Config_Points_message, setGetall_Parter_Devis_Config_Points_message] = useState(); + const [Getall_Parter_Devis_Config_Points_result, setGetall_Parter_Devis_Config_Points_result] = useState([]); + function Getall_Parter_Devis_Config_Points(event) { + + var form = new FormData(); + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("tab_related_collection", "quotation"); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Partner_Basic_Setup/"; + + setLoading(true); + axios.post(myurl, form).then(res => { + setLoading(false); + + if (String(res.data.status) === String("true")) { + //console.log(" In Getall_Parter_Devis_Config_Points res.data.status = " + res.data.status); + //console.log(" In Getall_Parter_Devis_Config_Points res.data.message r_class = " + res.data.message); + setGetall_Parter_Devis_Config_Points_api("true"); + setGetall_Parter_Devis_Config_Points_result(res.data.message); + + } + else { + setGetall_Parter_Devis_Config_Points_api("false"); + setGetall_Parter_Devis_Config_Points_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("success"); + } + + }).catch((error) => { + setLoading(false); + console.warn('Not good man :( Getall_Parter_Devis_Config_Points = ', error); + setGetall_Parter_Devis_Config_Points_api("false"); + alert(" Impossible de recuperer la liste des points de configuration des devis"); + //setmyApimyApiMessage("") + }) + } + + + const [history_securite_read, sethistory_securite_read] = useState(""); + + useEffect(() => { + + sethistory_securite_read(props.check_user_acces_right("historique", "read")) + + Get_List_Partner_Clients(); + Getall_Training_Employee_No_Filter(); + GetCurrentPartnerClass(); + Get_Given_Partner_Config_Point_Taux_TVA(); + Getall_Partner_Paiement_Condition(); + Getall_TrainingSession(); + Getall_Partner_Digital_Sign_Status(); + Getall_Partner_Product_Service(); + + + if (orderid && String(orderid).length > 3) { + + /* + Dans le cas précis des produits et service, "props.class_external_code" est utilisé comme + l'_id du client*/ + + Getall_Parter_Orders_With_Filter_On_Client_Id(orderid); + // console.log(" ~### 222 mes facture props action, orderid = ", action, orderid); + + } else { + Getall_Parter_Orders_No_Filter(); + } + + if (document.getElementById('myRef_head')) { + var divh = document.getElementById('myRef_head').offsetTop; + window.scrollTo({ + top: divh, + behavior: "smooth", + }); + } + + + Getall_Parter_Devis_Config_Points(); + + }, []) + + const [Getall_Parter_Orders_No_Filter_api, setGetall_Parter_Orders_No_Filter_api] = useState(); + const [Getall_Parter_Orders_No_Filter_message, setGetall_Parter_Orders_No_Filter_message] = useState(); + const [Getall_Parter_Orders_No_Filter_result, setGetall_Parter_Orders_No_Filter_result] = useState(); + function Getall_Parter_Orders_No_Filter(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_List_Partner_Order_no_filter/"; + + axios.post(myurl, form).then(res => { + + if (String(res.data.status) === String("true")) { + //console.log(" In Getall_Parter_Orders_No_Filter res.data.status = " + res.data.status); + //console.log(" In Getall_Parter_Orders_No_Filter res.data.message r_class = " + res.data.message); + setGetall_Parter_Orders_No_Filter_api("true"); + setGetall_Parter_Orders_No_Filter_result(res.data.message); + setRows(res.data.message); + setRows_total_data(JSON.parse(res.data.total_data)); + } + else { + setGetall_Parter_Orders_No_Filter_api("false"); + setGetall_Parter_Orders_No_Filter_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + console.warn('Not good man :( Getall_Parter_Orders_No_Filter = ', error); + setGetall_Parter_Orders_No_Filter_api("false"); + alert(" Impossible de recuperer la liste des commandes et devis"); + //setmyApimyApiMessage("") + }) + } + + + const [Getall_Parter_Orders_With_Filter_api, setGetall_Parter_Orders_With_Filter_api] = useState(); + const [Getall_Parter_Orders_With_Filter_message, setGetall_Parter_Orders_With_Filter_message] = useState(); + const [Getall_Parter_Orders_With_Filter_result, setGetall_Parter_Orders_With_Filter_result] = useState(); + function Getall_Parter_Orders_With_Filter(event) { + + var form = new FormData(); + + // Recuperation des parametres + var filtre1 = p_filtre1; + var filtre2 = p_filtre2; + var filtre3 = p_filtre3; + var filtre4 = p_filtre4; + + var filtre1_value = ""; + var filtre2_value = ""; + var filtre3_value = ""; + var filtre4_value = ""; + // Recuperation des valeurs de filtres + + if (p_filtre1_value) { + filtre1_value = p_filtre1_value; + form.append(filtre1, filtre1_value); + } + + if (p_filtre2_value) { + filtre2_value = p_filtre2_value; + form.append(filtre2, filtre2_value); + } + + if (p_filtre3_value) { + filtre3_value = p_filtre3_value; + form.append(filtre3, p_filtre3_value); + } + + if (p_filtre4_value) { + filtre4_value = p_filtre4_value; + form.append(filtre4, p_filtre4_value); + } + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Partner_Order_with_filter/"; + + axios.post(myurl, form).then(res => { + + if (String(res.data.status) === String("true")) { + //console.log(" In Getall_Parter_Orders_With_Filter res.data.status = " + res.data.status); + //console.log(" In Getall_Parter_Orders_With_Filter res.data.message r_class = " + res.data.message); + setGetall_Parter_Orders_With_Filter_api("true"); + setGetall_Parter_Orders_With_Filter_result(res.data.message); + setRows(res.data.message); + setRows_total_data(JSON.parse(res.data.total_data)); + } + else { + setGetall_Parter_Orders_With_Filter_api("false"); + setGetall_Parter_Orders_With_Filter_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + console.warn('Not good man :( Getall_Parter_Orders_With_Filter = ', error); + setGetall_Parter_Orders_With_Filter_api("false"); + alert(" Impossible de recuperer la liste des commandes et devis"); + //setmyApimyApiMessage("") + }) + } + + const [Getall_Parter_Orders_With_Filter_On_Client_Id_api, setGetall_Parter_Orders_With_Filter_On_Client_Id_api] = useState(); + const [Getall_Parter_Orders_With_Filter_On_Client_Id_message, setGetall_Parter_Orders_With_Filter_On_Client_Id_message] = useState(); + const [Getall_Parter_Orders_With_Filter_On_Client_Id_result, setGetall_Parter_Orders_With_Filter_On_Client_Id_result] = useState(); + function Getall_Parter_Orders_With_Filter_On_Client_Id(local_client_id) { + + var form = new FormData(); + + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("order_header_client_id", local_client_id); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Partner_Order_with_filter/"; + + axios.post(myurl, form).then(res => { + + if (String(res.data.status) === String("true")) { + //console.log(" In Getall_Parter_Orders_With_Filter_On_Client_Id res.data.status = " + res.data.status); + //console.log(" In Getall_Parter_Orders_With_Filter_On_Client_Id res.data.message r_class = " + res.data.message); + setGetall_Parter_Orders_With_Filter_On_Client_Id_api("true"); + setGetall_Parter_Orders_With_Filter_On_Client_Id_result(res.data.message); + setRows(res.data.message); + setRows_total_data(JSON.parse(res.data.total_data)); + } + else { + setGetall_Parter_Orders_With_Filter_On_Client_Id_api("false"); + setGetall_Parter_Orders_With_Filter_On_Client_Id_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + console.warn('Not good man :( Getall_Parter_Orders_With_Filter_On_Client_Id = ', error); + setGetall_Parter_Orders_With_Filter_On_Client_Id_api("false"); + alert(" Impossible de recuperer la liste des commandes et devis"); + //setmyApimyApiMessage("") + }) + } + + + const [session_file_name, setsession_file_name] = useState(); + const [liste_sessions_file_change_api, setliste_sessions_file_change_api] = useState(); + const [liste_sessions_file_change_result, setliste_sessions_file_change_result] = useState(); + const [liste_sessions_file_change_message, setliste_sessions_file_change_message] = useState(); + const liste_sessions_file_change = event => { + + + const fileUploaded = event.target.files[0]; + let file_size = event.target.files[0].size; + let file_type = event.target.files[0].type; + + //console.log("file_size = ",file_size," file_type = ",file_type); + if (file_size > 10000000) { + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message("Le fichier ne doit pas dépasser un 1 Méga octets"); + setalert_type("error"); + // alert("Le fichier ne doit pas dépasser un 1 Méga octets"); + return; + } + + setsession_file_name(event.target.files[0].name); + + const formData = new FormData(); + formData.append('File', fileUploaded); + //formData.append('token', 'K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA'); + const stored_cookie = getCookie('tokenmysypart'); + + formData.append("token", stored_cookie); + //console.log("token = " + stored_cookie); + + fetch( + // ici a modifier process.env.REACT_APP_API_URL + "myclass/api/Add_Ressource_Humaine_mass/", + { + method: 'POST', + body: formData, + } + ) + .then((response) => response.json()) + .then((result) => { + + //console.log(" ## result['status'] = ", result['status']) + if (String(result['status']) === String("Err_Connexion")) { + alert('Erreur: ' + result['message']); + history.push("/Connexion"); + } + + else if (String(result['status']) === String("true")) { + //console.log('Success:', result['message']); + setliste_sessions_file_change_result(result['message']); + setliste_sessions_file_change_api("true"); + + //Getall_Training_Employee(); + // alert(" Les employés ont été correctement importés"); + + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message("Les employés ont été correctement importés"); + setalert_type("success"); + + + } + + else { + setliste_sessions_file_change_message(result['message']); + setliste_sessions_file_change_api("false"); + alert('Erreur: ' + result['message']); + + } + + + }) + .catch((error) => { + console.error('Error:', error); + setliste_sessions_file_change_api("false"); + alert(" Impossible d'importer les employés "); + }); + } + + 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(""); + function handleClick_edit_order_From_Line(selected_row_id) { + + //submenu_detail_employe(); + + var line = JSON.parse(rowss[selected_row_id]); + + //console.log("### line = ", line); + var order_id = line._id; + setselected_id(order_id); + + var order_ref = line.order_header_ref_interne; + setorder_internal_ref(order_ref); + + var order_header_type = line.order_header_type; + setselected_order_header_type(order_header_type); + + //console.log(" ### employe_id = ", employe_id); + Display_Detail_Order_data(order_id); + + + var divh = document.getElementById('myRef').offsetTop; + window.scrollTo({ + top: divh, + behavior: "smooth", + }); + + + + } + + function Display_Detail_Order_data(order_id) { + //clearDetailAttendeFields(); + setadd_One_Order(); + setdisplay_detail_order("1"); + setsubmenu("detail_order"); + clean_order_detail_fields(); + setselectionModel_order_lines([]); + + setLoading(true); + Get_Order_Data(order_id); + Get_Partner_Orders_Lines_from_header_id(order_id); + + } + + const [Order_data_changed, setOrder_data_changed] = useState(); + const [order_data_edit_mode, setorder_data_edit_mode] = useState(); + + + + const [Quotation_list_relance, setQuotation_list_relance] = useState([]); + + const [GetAttendee_api, setGetAttendee_api] = useState(); + const [GetAttendee_message, setGetAttendee_message] = useState(); + const [GetAttendee_result, setGetAttendee_result] = useState([]); + function Get_Order_Data(order_id) { + setOrder_data_changed(""); + setorder_data_edit_mode(""); + + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("_id", order_id); + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Given_Partner_Order/"; + + setLoading(true); + + axios.post(myurl, form).then(res => { + + if (String(res.data.status) === "true") { + setLoading(false); + //console.log(" In Get_Order_Data res.data.status = " + res.data.status); + //console.log(" In Get_Order_Data res.data.message r_class = " + res.data.message); + setGetAttendee_api("true"); + setGetAttendee_result(res.data.message); + + if (res.data.message.length > 0) { + var mylocal_order = JSON.parse(res.data.message); + + + //document.getElementsByName("detail_header_type")[0].value = ""; + if (mylocal_order.order_header_type) + setp_detail_header_type(mylocal_order.order_header_type); + + //document.getElementsByName("detail_header_status")[0].value = ""; + if (mylocal_order.order_header_status) { + setp_detail_header_statut(mylocal_order.order_header_status); + + if (mylocal_order.order_header_type === "commande") { + if (String(mylocal_order.order_header_status) === "0") { + setp_detail_header_statut_label("Brouillon"); + } + else if (String(mylocal_order.order_header_status) === "1") { + setp_detail_header_statut_label("En cours"); + } + else if (String(mylocal_order.order_header_status) === "2") { + setp_detail_header_statut_label("Traité"); + } + else if (String(mylocal_order.order_header_status) === "3") { + setp_detail_header_statut_label("Facturé"); + } + else if (String(mylocal_order.order_header_status) === "-1") { + setp_detail_header_statut_label("Annulé"); + } + } + if (mylocal_order.order_header_type === "devis") { + if (String(mylocal_order.order_header_status) === "0") { + setp_detail_header_statut_label("Brouillon"); + } + else if (String(mylocal_order.order_header_status) === "1") { + setp_detail_header_statut_label("En cours"); + } + else if (String(mylocal_order.order_header_status) === "2") { + setp_detail_header_statut_label("Fermé"); + } + else if (String(mylocal_order.order_header_status) === "3") { + setp_detail_header_statut_label("Gagné"); + } + + else if (String(mylocal_order.order_header_status) === "4") { + setp_detail_header_statut_label("Perdu"); + } + + else if (String(mylocal_order.order_header_status) === "-1") { + setp_detail_header_statut_label("Annulé"); + } + } + + } + else { + setp_detail_header_statut("0"); + setp_detail_header_statut_label("Brouillon"); + } + + if (mylocal_order.date_validation) { + setp_detail_header_devis_date_validation(mylocal_order.date_validation); + } else { + setp_detail_header_devis_date_validation(""); + } + + if (mylocal_order.date_envoi_quotation) { + setp_detail_header_devis_date_envoi(mylocal_order.date_envoi_quotation); + } else { + setp_detail_header_devis_date_envoi(""); + } + + if (mylocal_order.related_order_internal_ref) { + setp_detail_header_order_header_ref_interne(mylocal_order.related_order_internal_ref); + } else { + setp_detail_header_order_header_ref_interne(""); + } + + if (mylocal_order.closure_reason) { + setp_detail_comment_raison_cloture(mylocal_order.closure_reason); + } else { + setp_detail_comment_raison_cloture(""); + } + + //document.getElementsByName("detail_header_ref_interne")[0].value = ""; + if (mylocal_order.order_header_ref_interne) { + setp_detail_header_ref_interne(mylocal_order.order_header_ref_interne); + } + + if (mylocal_order.order_header_paiement_condition_code) { + setp_detail_header_condition_paiement_code(mylocal_order.order_header_paiement_condition_code); + } + + if (mylocal_order.order_header_paiement_condition_id) { + setp_detail_header_condition_paiement_id(mylocal_order.order_header_paiement_condition_id); + } + + + //document.getElementsByName("detail_header_ref_cient")[0].value = ""; + if (mylocal_order.order_header_ref_client) { + setp_detail_header_ref_client(mylocal_order.order_header_ref_client); + } + + if (mylocal_order.order_header_email_client) { + setp_detail_header_email_client(mylocal_order.order_header_email_client); + } + + + //document.getElementsByName("detail_header_date_cmd")[0].value = ""; + if (mylocal_order.order_header_date_cmd) { + setp_detail_header_date_cmd(mylocal_order.order_header_date_cmd); + setp_detail_header_date_cmd_val(mylocal_order.order_header_date_cmd); + } + + //document.getElementsByName("detail_header_date_expiration")[0].value = ""; + if (mylocal_order.order_header_date_expiration) { + setp_detail_header_date_expiration(mylocal_order.order_header_date_expiration); + setp_detail_header_date_expiration_val(mylocal_order.order_header_date_cmd); + } + + + + //document.getElementsByName("detail_nom_client")[0].value = ""; + if (mylocal_order.order_header_client_nom) { + setp_detail_header_client_nom(mylocal_order.order_header_client_nom); + setp_detail_header_client_nom_id(mylocal_order.order_header_client_id); + } + + + //document.getElementsByName("detail_header_description")[0].value = ""; + if (mylocal_order.order_header_description) { + setp_detail_header_description(mylocal_order.order_header_description); + } + + //document.getElementsByName("detail_header_comment")[0].value = ""; + if (mylocal_order.order_header_lieu_formation) { + setp_detail_header_lieu_formation(mylocal_order.order_header_lieu_formation); + } else { + setp_detail_header_lieu_formation(""); + } + + if (mylocal_order.order_header_comment) { + setp_detail_header_comment(mylocal_order.order_header_comment); + } + + + + + // document.getElementsByName("detail_header_vendeur_nom_prenom")[0].value = ""; + if (mylocal_order.order_header_vendeur_nom_prenom) { + setp_detail_header_vendeur_nom(mylocal_order.order_header_vendeur_nom_prenom); + setp_detail_header_vendeur_nom_id(mylocal_order.order_header_vendeur_id); + } + + + // Recuperation des adresses (livraison / lieu execution - Facturation ) + //document.getElementsByName("detail_header_fact_adresse")[0].value = ""; + if (mylocal_order.order_header_adr_fact_adresse) { + setp_detail_header_fact_adr(mylocal_order.order_header_adr_fact_adresse); + } + + //document.getElementsByName("detail_header_fact_code_postal")[0].value = ""; + if (mylocal_order.order_header_adr_fact_code_postal) { + setp_detail_header_fact_code_postal(mylocal_order.order_header_adr_fact_code_postal); + } + + //document.getElementsByName("detail_header_fact_ville")[0].value = ""; + if (mylocal_order.order_header_adr_fact_ville) { + setp_detail_header_fact_ville(mylocal_order.order_header_adr_fact_ville); + } + + //document.getElementsByName("detail_header_fact_pays")[0].value = ""; + if (mylocal_order.order_header_adr_fact_pays) { + setp_detail_header_fact_pays(mylocal_order.order_header_adr_fact_pays); + } + + //document.getElementsByName("detail_header_liv_adresse")[0].value = ""; + if (mylocal_order.order_header_adr_liv_adresse) { + setp_detail_header_liv_adr(mylocal_order.order_header_adr_liv_adresse); + } + + //document.getElementsByName("detail_header_liv_code_postal")[0].value = ""; + if (mylocal_order.order_header_adr_liv_code_postal) { + setp_detail_header_liv_code_postal(mylocal_order.order_header_adr_liv_code_postal); + } + + //document.getElementsByName("detail_header_liv_ville")[0].value = ""; + if (mylocal_order.order_header_adr_liv_ville) { + sep_detail_header_liv_ville(mylocal_order.order_header_adr_liv_ville); + } + + //document.getElementsByName("detail_header_liv_pays")[0].value = ""; + if (mylocal_order.order_header_adr_liv_pays) { + setp_detail_header_liv_pays(mylocal_order.order_header_adr_liv_pays); + } + + + // Recuperation des montant, taxes et autres reductions + //document.getElementsByName("detail_header_total_ht")[0].value = ""; + if (mylocal_order.order_header_total_ht) { + setp_detail_header_total_ht(mylocal_order.order_header_total_ht); + } + + //document.getElementsByName("detail_header_total_tax")[0].value = ""; + if (mylocal_order.order_header_tax_amount) { + setp_detail_header_total_tax(mylocal_order.order_header_tax_amount); + } + + + //document.getElementsByName("detail_header_total_ttc")[0].value = ""; + if (mylocal_order.order_header_total_ttc) { + setp_detail_header_total_ttc(mylocal_order.order_header_total_ttc); + } + + //document.getElementsByName("detail_header_type_reduction")[0].value = ""; + if (mylocal_order.order_header_type_reduction) { + setp_detail_header_type_reduction(mylocal_order.order_header_type_reduction); + } + + //document.getElementsByName("detail_header_type_reduction_valeur")[0].value = ""; + if (mylocal_order.order_header_type_reduction_valeur) { + setp_detail_header_type_reduction_valeur(mylocal_order.order_header_type_reduction_valeur); + } + + + if (mylocal_order.order_header_montant_reduction) { + setp_detail_header_total_reduction_amount(mylocal_order.order_header_montant_reduction); + } + + + if (mylocal_order.total_lines_montant_reduction) { + setp_detail_header_montant_reduction(mylocal_order.total_lines_montant_reduction); + } + + if (mylocal_order.total_header_hors_taxe_before_header_reduction) { + setp_detail_total_header_hors_taxe_before_header_reduction(mylocal_order.total_header_hors_taxe_before_header_reduction); + } + + if (mylocal_order.total_header_hors_taxe_after_header_reduction) { + setp_detail_total_header_hors_taxe_after_header_reduction(mylocal_order.total_header_hors_taxe_after_header_reduction); + } + + if (mylocal_order.order_header_tax_amount) { + setp_detail_order_header_tax_amount(mylocal_order.order_header_tax_amount); + } + + + if (mylocal_order.total_header_toutes_taxes) { + setp_detail_total_header_toutes_taxes(mylocal_order.total_header_toutes_taxes); + } + + if (mylocal_order.total_lines_hors_taxe_before_lines_reduction) { + setp_detail_total_lines_hors_taxe_before_lines_reduction(mylocal_order.total_lines_hors_taxe_before_lines_reduction); + } + + if (mylocal_order.total_lines_hors_taxe_after_lines_reduction) { + setp_detail_total_lines_hors_taxe_after_lines_reduction(mylocal_order.total_lines_hors_taxe_after_lines_reduction); + } + + if (mylocal_order.relance_auto) { + setp_detail_header_devis_relance_auto(mylocal_order.relance_auto); + } else { + setp_detail_header_devis_relance_auto(""); + } + + if (mylocal_order.frequence_relance_auto) { + setp_detail_header_devis_frequence_relance(mylocal_order.frequence_relance_auto); + } else { + setp_detail_header_devis_frequence_relance(""); + } + + if (mylocal_order.nb_relance_auto) { + setp_detail_header_devis_nb_relance(mylocal_order.nb_relance_auto); + } else { + setp_detail_header_devis_nb_relance(""); + + } + + if (mylocal_order.list_relance) { + setQuotation_list_relance(mylocal_order.list_relance); + } else { + setQuotation_list_relance([]); + + } + + + if (mylocal_order.order_header_inclus_bpf) { + setp_add_cmd_header_order_inclus_bpf(mylocal_order.order_header_inclus_bpf); + } else { + setp_add_cmd_header_order_inclus_bpf(""); + } + + + + disable_Order_Header_DetailFields(); + order_header_submenu_main(); + + } else { + // alert(" Aucune commande/devis recuperé"); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message("Aucune commande/devis recuperé"); + setalert_type("error"); + } + + + } else if (String(res.data.status) === String("Err_Connexion")) { + setLoading(false); + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); + } + + else { + setLoading(false); + setGetAttendee_api("false"); + setGetAttendee_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + setLoading(false); + console.warn('Not good man :( Get_Order_Data = ', error); + setGetAttendee_api("false"); + alert(" Impossible de recuperer les données de la commande / devis"); + //setmyApimyApiMessage("") + }) + } + + + const [Get_Partner_Orders_Lines_from_header_id_api, setGet_Partner_Orders_Lines_from_header_id_api] = useState(); + const [Get_Partner_Orders_Lines_from_header_id_message, setGet_Partner_Orders_Lines_from_header_id_message] = useState(); + const [Get_Partner_Orders_Lines_from_header_id_result, setGet_Partner_Orders_Lines_from_header_id_result] = useState(); + function Get_Partner_Orders_Lines_from_header_id(local_order_header_id) { + + var form = new FormData(); + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("order_header_id", local_order_header_id); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Given_Partner_Order_Lines/"; + setLoading(true); + axios.post(myurl, form).then(res => { + + if (String(res.data.status) === String("true")) { + setLoading(false); + //console.log(" In Get_Partner_Orders_Lines_from_header_id res.data.status = " + res.data.status); + //console.log(" In Get_Partner_Orders_Lines_from_header_id res.data.message r_class = " + res.data.message); + setGet_Partner_Orders_Lines_from_header_id_api("true"); + setGet_Partner_Orders_Lines_from_header_id_result(res.data.message); + setrows_order_lines(res.data.message); + } + else { + setLoading(false); + setGet_Partner_Orders_Lines_from_header_id_api("false"); + setGet_Partner_Orders_Lines_from_header_id_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + setLoading(false); + console.warn('Not good man :( Get_Partner_Orders_Lines_from_header_id = ', error); + setGet_Partner_Orders_Lines_from_header_id_api("false"); + alert(" Impossible de recuperer le detail de la commande / devis"); + //setmyApimyApiMessage("") + }) + } + + const [New_Get_List_Partner_Clients_result, setNew_Get_List_Partner_Clients_result] = useState([]); + + const [Get_List_Partner_Clients_api, setGet_List_Partner_Clients_api] = useState(); + const [Get_List_Partner_Clients_message, setGet_List_Partner_Clients_message] = useState(); + const [Get_List_Partner_Clients_result, setGet_List_Partner_Clients_result] = useState(); + function Get_List_Partner_Clients(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_List_Partner_Client/"; + + axios.post(myurl, form).then(res => { + //console.log(" In Get_List_Partner_Clients res.data.status = " + res.data.status); + //console.log(" In Get_List_Partner_Clients res.data.message r_class = " + res.data.message); + + if (String(res.data.status) === String("true")) { + setGet_List_Partner_Clients_api("true"); + setGet_List_Partner_Clients_result(res.data.message); + + var new_data2 = []; + const new_data = res.data.message.map((x) => { + + //--- + var localid = JSON.parse(x).id; + var local_id = JSON.parse(x)._id; + var local_nom = JSON.parse(x).nom; + var local_raison_sociale = JSON.parse(x).raison_sociale; + var local_cond_paiement_id = JSON.parse(x).invoice_condition_paiement_id; + + //--- + var node = { + "_id": local_id, + "id": localid, + "label": local_nom, + "nom": local_nom, + "raison_sociale": local_raison_sociale, + "invoice_condition_paiement_id": local_cond_paiement_id, + + }; + new_data2.push(node); + }); + + if (new_data2.length > 0) + setNew_Get_List_Partner_Clients_result(new_data2); + + } + else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); + } + else { + setGet_List_Partner_Clients_api("false"); + setGet_List_Partner_Clients_message(res.data.message); + alert('Erreur: ' + res.data.message); + } + + }).catch((error) => { + console.warn('Not good man :( Get_List_Partner_Clients = ', error); + setGet_List_Partner_Clients_api("false"); + alert('Erreur: Impossible de recuperer la liste des clients'); + //setmyApimyApiMessage("") + }) + } + + + const [New_Getall_TrainingSession_result, setNew_Getall_TrainingSession_result] = useState([]); + + const [Getall_TrainingSession_api, setGetall_TrainingSession_api] = useState(); + const [Getall_TrainingSession_message, setGetall_TrainingSession_message] = useState(); + const [Getall_TrainingSession_result, setGetall_TrainingSession_result] = useState(); + function Getall_TrainingSession(event) { + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("archive", "0"); + var myurl = process.env.REACT_APP_API_URL + "myclass/api/GetAllValideSessionPartner_List/"; + + setLoading(true); + + axios.post(myurl, form).then(res => { + + setLoading(false); + + if (String(res.data.status) === String("true")) { + //console.log(" In Getall_TrainingSession res.data.status = " + res.data.status); + //console.log(" In Getall_TrainingSession res.data.message r_class = " + res.data.message); + setGetall_TrainingSession_api("true"); + setGetall_TrainingSession_result(res.data.message); + + var new_data2 = []; + const new_data = res.data.message.map((x) => { + + //--- + var localid = JSON.parse(x).id; + var local_id = JSON.parse(x)._id; + var local_internal_url = JSON.parse(x).class_internal_url; + var local_title_session = JSON.parse(x).titre; + var local_code_session = JSON.parse(x).code_session; + + + + //--- + var node = { + "_id": local_id, + "id": localid, + "label": local_code_session, + "class_internal_url": local_internal_url, + "titre": local_title_session, + "code_session": local_code_session, + }; + new_data2.push(node); + + // return {"_id": " + str(local_id) + ", "label": " + local_courrier_template_ref_interne + '" , "courrier_template_ref_interne": "' + local_courrier_template_ref_interne + '", "nom_champ_technique": "' + local_nom_champ_technique + '", "nom_champ_fonctionel": "' + local_nom_champ_fonctionel + '","valide": "1" }; + + }); + + //--- + var node = { + "_id": "", + "id": "", + "label": "", + "class_internal_url": "", + "titre": "", + "code_session": "", + }; + new_data2.push(node); + + if (new_data2.length > 0) { + setNew_Getall_TrainingSession_result(new_data2); + + //console.log(" ### setNew_Getall_TrainingSession_result = ", new_data2); + } + + + } + else { + setGetall_TrainingSession_api("false"); + setGetall_TrainingSession_message(res.data.message); + } + + }).catch((error) => { + setLoading(false); + console.warn('Not good man :( Getall_TrainingSession = ', error); + setGetall_TrainingSession_api("false"); + //setmyApimyApiMessage("") + }) + } + + + const [partner_taux_tva, setpartner_taux_tva] = useState("20"); + + const [Get_Given_Partner_Config_Point_Taux_TVA_api, setGet_Given_Partner_Config_Point_Taux_TVA_api] = useState(); + const [Get_Given_Partner_Config_Point_Taux_TVA_message, setGet_Given_Partner_Config_Point_Taux_TVA_message] = useState(); + const [Get_Given_Partner_Config_Point_Taux_TVA_result, setGet_Given_Partner_Config_Point_Taux_TVA_result] = useState(); + function Get_Given_Partner_Config_Point_Taux_TVA() { + + var form = new FormData(); + const stored_cookie = getCookie('tokenmysypart'); + + form.append("token", stored_cookie); + form.append("config_name", "tva"); + form.append("related_collection", ""); + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Given_Partner_Basic_Setup/"; + + axios.post(myurl, form).then(res => { + //console.log(" In Get_Given_Partner_Config_Point_Taux_TVA res.data.status = " + res.data.status); + //console.log(" In Get_Given_Partner_Config_Point_Taux_TVA res.data.message r_class = " + res.data.message); + + if (String(res.data.status) === String("true")) { + setGet_Given_Partner_Config_Point_Taux_TVA_api("true"); + setGet_Given_Partner_Config_Point_Taux_TVA_result(res.data.message); + + if (res.data.message.length > 0) { + var point_config_tva = JSON.parse(res.data.message); + + if (point_config_tva.config_value) { + setpartner_taux_tva(point_config_tva.config_value); + //console.log(" GGG TVA PART = ", point_config_tva.config_value); + } + + } else { + // alert(" Aucun taux de TVA récuperé") + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message("Aucun taux de TVA récuperé"); + setalert_type("error"); + } + } + else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); + } + else { + setGet_Given_Partner_Config_Point_Taux_TVA_api("false"); + setGet_Given_Partner_Config_Point_Taux_TVA_message(res.data.message); + alert('Erreur: ' + res.data.message); + } + + }).catch((error) => { + console.warn('Not good man :( Get_Given_Partner_Config_Point_Taux_TVA = ', error); + setGet_Given_Partner_Config_Point_Taux_TVA_api("false"); + alert('Erreur: Impossible de recuperer la liste des clients'); + //setmyApimyApiMessage("") + }) + } + + const [Get_Givent_Partner_Client_Data_api, setGet_Givent_Partner_Client_Data_api] = useState(); + const [Get_Givent_Partner_Client_Data_message, setGet_Givent_Partner_Client_Data_message] = useState(); + const [Get_Givent_Partner_Client_Data_result, setGet_Givent_Partner_Client_Data_result] = useState(); + function Get_Givent_Partner_Client_Data(local_partner_client_id) { + + var form = new FormData(); + const stored_cookie = getCookie('tokenmysypart'); + + form.append("token", stored_cookie); + form.append("_id", local_partner_client_id); + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Given_Partner_Client_From_Id/"; + + axios.post(myurl, form).then(res => { + //console.log(" In Get_Givent_Partner_Client_Data res.data.status = " + res.data.status); + //console.log(" In Get_Givent_Partner_Client_Data res.data.message r_class = " + res.data.message); + + if (String(res.data.status) === String("true")) { + setGet_Givent_Partner_Client_Data_api("true"); + setGet_Givent_Partner_Client_Data_result(res.data.message); + var mylocalclient = JSON.parse(res.data.message); + + + if (mylocalclient) { + if (mylocalclient.email) { + setp_detail_header_email_client(mylocalclient.email); + } + + // Recuperation de l'adresse de facturation + if (mylocalclient.invoice_adresse) { + setp_detail_header_fact_adr(mylocalclient.invoice_adresse); + } + + if (mylocalclient.invoice_code_postal) { + setp_detail_header_fact_code_postal(mylocalclient.invoice_code_postal); + } + + if (mylocalclient.invoice_ville) { + setp_detail_header_fact_ville(mylocalclient.invoice_ville); + } + + if (mylocalclient.invoice_pays) { + setp_detail_header_fact_pays(mylocalclient.invoice_pays); + } + + + // Recuperation de l'adresse du lieu de formation (par defaut adresse de la societe) + if (mylocalclient.adr_adresse) { + setp_detail_header_liv_adr(mylocalclient.adr_adresse); + } + + if (mylocalclient.adr_code_postal) { + setp_detail_header_liv_code_postal(mylocalclient.adr_code_postal); + } + + if (mylocalclient.adr_ville) { + sep_detail_header_liv_ville(mylocalclient.adr_ville); + } + + if (mylocalclient.adr_pays) { + setp_detail_header_liv_pays(mylocalclient.adr_pays); + } + } + } + else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); + } + else { + setGet_Givent_Partner_Client_Data_api("false"); + setGet_Givent_Partner_Client_Data_message(res.data.message); + alert('Erreur: ' + res.data.message); + } + + }).catch((error) => { + console.warn('Not good man :( Get_Givent_Partner_Client_Data = ', error); + setGet_Givent_Partner_Client_Data_api("false"); + alert('Erreur: Impossible de recuperer les données du client'); + //setmyApimyApiMessage("") + }) + } + + const [Get_Given_Line_Of_Partner_Order_Line_Data_api, setGet_Given_Line_Of_Partner_Order_Line_Data_api] = useState(); + const [Get_Given_Line_Of_Partner_Order_Line_Data_message, setGet_Given_Line_Of_Partner_Order_Line_Data_message] = useState(); + const [Get_Given_Line_Of_Partner_Order_Line_Data_result, setGet_Given_Line_Of_Partner_Order_Line_Data_result] = useState(); + function Get_Given_Line_Of_Partner_Order_Line_Data(local_order_line_id, local_order_header_ref_interne) { + setOrder_data_changed(""); + setorder_data_edit_mode(""); + + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("order_line_id", local_order_line_id); + form.append("order_header_ref_interne", local_order_header_ref_interne); + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Given_Line_Of_Partner_Order_Lines/"; + + axios.post(myurl, form).then(res => { + + if (String(res.data.status) === "true") { + //console.log(" In Get_Given_Line_Of_Partner_Order_Line_Data res.data.status = " + res.data.status); + //console.log(" In Get_Given_Line_Of_Partner_Order_Line_Data res.data.message r_class = " + res.data.message); + setGet_Given_Line_Of_Partner_Order_Line_Data_api("true"); + setGet_Given_Line_Of_Partner_Order_Line_Data_result(res.data.message); + + if (res.data.message.length > 0) { + var mylocal_order = JSON.parse(res.data.message); + + + if (mylocal_order.order_line_formation) { + setp_add_line_item(mylocal_order.order_line_formation); + } + + + if (mylocal_order.order_line_session_id) { + setp_add_line_session_id(mylocal_order.order_line_session_id); + } else { + setp_add_line_session_id(""); + } + + if (mylocal_order.order_line_session_code_session) { + setp_add_line_session_code(mylocal_order.order_line_session_code_session); + } else { + setp_add_line_session_code(""); + } + + if (mylocal_order.order_line_type_article) { + setp_add_line_order_line_type_article(mylocal_order.order_line_type_article); + } else { + setp_add_line_order_line_type_article(""); + } + + + if (mylocal_order.order_line_qty) { + setp_add_line_item_qty(mylocal_order.order_line_qty); + } + + + + if (mylocal_order.order_line_prix_unitaire) { + setp_add_line_item_price(mylocal_order.order_line_prix_unitaire); + } + + + /*if (mylocal_order.order_header_id) { + setp_detail_header_type_reduction(mylocal_order.order_header_id); + } + + + if (mylocal_order.order_header_ref_interne) { + setp_detail_header_type_reduction_valeur(mylocal_order.order_header_ref_interne); + }*/ + + + if (mylocal_order.order_line_montant_reduction) { + setp_add_line_item_reduction_total_amount(mylocal_order.order_line_montant_reduction); + } + + + + if (mylocal_order.order_line_montant_toutes_taxes) { + setp_add_line_item_total_amount_ttc(mylocal_order.order_line_montant_toutes_taxes); + + } + + + if (mylocal_order.order_line_tax) { + setp_add_line_item_taxe(mylocal_order.order_line_tax); + } + + if (mylocal_order.order_line_taux_taxe) { + setpartner_taux_tva(mylocal_order.order_line_taux_taxe); + } + + + if (mylocal_order.order_line_tax_amount) { + setp_add_line_item_taxe_amount(mylocal_order.order_line_tax_amount); + } + + + if (mylocal_order.order_line_type_reduction) { + setp_add_line_item_type_reduction(mylocal_order.order_line_type_reduction); + } + + + if (mylocal_order.order_line_type_valeur) { + setp_add_line_item_reduction_value(mylocal_order.order_line_type_valeur); + } + + + if (mylocal_order.order_line_type) { + setp_add_line_item_type(mylocal_order.order_line_type); + } + + + if (mylocal_order.order_line_status) { + setp_add_line_item_status(mylocal_order.order_line_status); + } + + + if (mylocal_order.order_line_comment) { + setp_add_line_item_comment(mylocal_order.order_line_comment); + } + + + if (mylocal_order.title) { + setp_add_line_item_title(mylocal_order.title); + } + + if (mylocal_order.order_line_type_apprenant) { + setp_add_line_item_type_apprenant(mylocal_order.order_line_type_apprenant); + } else { + setp_add_line_item_type_apprenant(""); + } + + + if (mylocal_order.order_line_montant_hors_taxes) { + setp_add_line_item_total_amount_ht(mylocal_order.order_line_montant_hors_taxes); + + } + + + /*if (mylocal_order.domaine) { + setp_detail_header_montant_reduction(mylocal_order.domaine); + }*/ + + + if (mylocal_order.duration_concat) { + setp_add_line_item_duration_concat(mylocal_order.duration_concat); + } + + + ; + + } else { + // alert(" Aucune ligne commande/devis recuperée"); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message("Aucune ligne commande/devis recuperée"); + setalert_type("error"); + } + + + } else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); + } + + else { + setGet_Given_Line_Of_Partner_Order_Line_Data_api("false"); + setGet_Given_Line_Of_Partner_Order_Line_Data_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + console.warn('Not good man :( Get_Given_Line_Of_Partner_Order_Line_Data = ', error); + setGet_Given_Line_Of_Partner_Order_Line_Data_api("false"); + alert(" Impossible de recuperer les données de la ligne "); + //setmyApimyApiMessage("") + }) + } + + + + const hiddenFileInput_session = React.useRef(null); + + function submenu_import_order() { + setsession_file_name(); + setliste_sessions_file_change_api(); + hiddenFileInput_session.current.click(); + } + + const [add_One_Order, setadd_One_Order] = useState(); + + + function submenu_add_one_order() { + clean_order_detail_fields(); + + Getall_Partner_Paiement_Condition(); + setp_add_cmd_header_order_type("commande"); + setDialog_1_message(" Nouvelle commande"); + setDialog_Detail_Commande_open(true); + + } + + + function submenu_add_one_quotation() { + + clean_order_detail_fields(); + + Getall_Parter_Devis_Config_Points(); + Getall_Partner_Paiement_Condition(); + setp_add_cmd_header_order_type("devis"); + setDialog_1_message(" Nouveau devis"); + setDialog_Detail_Commande_open(true); + + } + + function Annule_add_one_Order() { + setdisplay_detail_order(); + setsubmenu(""); + setSelectionModel([]); + } + + const [display_detail_order, setdisplay_detail_order] = React.useState(); + + const [p_detail_header_client_nom, setp_detail_header_client_nom] = useState(); + const [p_detail_header_client_nom_id, setp_detail_header_client_nom_id] = useState(); + + const [p_detail_header_description, setp_detail_header_description] = useState(""); + const [p_detail_header_comment, setp_detail_header_comment] = useState(""); + const [p_detail_header_lieu_formation, setp_detail_header_lieu_formation] = useState(""); + const [p_detail_header_date_cmd, setp_detail_header_date_cmd] = useState(new Date().toLocaleDateString('fr-FR')); + const [p_detail_header_date_expiration, setp_detail_header_date_expiration] = useState(date_today_90j.toLocaleDateString('fr-FR')); + const [p_detail_header_condition_paiement_code, setp_detail_header_condition_paiement_code] = useState(""); + const [p_detail_header_condition_paiement_id, setp_detail_header_condition_paiement_id] = useState(""); + const [p_detail_header_ref_client, setp_detail_header_ref_client] = useState(); + const [p_detail_header_ref_interne, setp_detail_header_ref_interne] = useState(); + + const [p_detail_comment_raison_cloture, setp_detail_comment_raison_cloture] = React.useState(""); + + + const [p_detail_header_devis_date_validation, setp_detail_header_devis_date_validation] = useState(); + const [p_detail_header_devis_date_envoi, setp_detail_header_devis_date_envoi] = useState(); + + const [p_detail_header_email_client, setp_detail_header_email_client] = useState(); + + const [p_detail_header_vendeur_nom, setp_detail_header_vendeur_nom] = useState(); + const [p_detail_header_vendeur_nom_id, setp_detail_header_vendeur_nom_id] = useState(); + + const [p_detail_header_type, setp_detail_header_type] = useState(); + const [p_detail_header_statut, setp_detail_header_statut] = useState(""); + const [p_detail_header_vendeur_id, setp_detail_header_vendeur_id] = useState(); + const [p_detail_header_client_id, setp_detail_header_client_id] = useState(); + const [p_detail_header_statut_label, setp_detail_header_statut_label] = useState(); + + const [p_detail_header_order_header_ref_interne, setp_detail_header_order_header_ref_interne] = useState(); + + + const [p_detail_header_date_cmd_val, setp_detail_header_date_cmd_val] = useState(new Date().toLocaleDateString('fr-FR')); + const [p_detail_header_date_expiration_val, setp_detail_header_date_expiration_val] = useState(date_today_90j.toLocaleDateString('fr-FR')); + const [p_detail_header_fact_adr, setp_detail_header_fact_adr] = useState(); + const [p_detail_header_fact_code_postal, setp_detail_header_fact_code_postal] = useState(); + const [p_detail_header_fact_ville, setp_detail_header_fact_ville] = useState(); + const [p_detail_header_fact_pays, setp_detail_header_fact_pays] = useState(); + + + const [p_detail_header_liv_adr, setp_detail_header_liv_adr] = useState(); + const [p_detail_header_liv_code_postal, setp_detail_header_liv_code_postal] = useState(); + const [p_detail_header_liv_ville, sep_detail_header_liv_ville] = useState(); + const [p_detail_header_liv_pays, setp_detail_header_liv_pays] = useState(); + + const [p_detail_header_total_ht, setp_detail_header_total_ht] = useState(); + const [p_detail_header_total_tax, setp_detail_header_total_tax] = useState(); + const [p_detail_header_total_ttc, setp_detail_header_total_ttc] = useState(); + const [p_detail_header_type_reduction, setp_detail_header_type_reduction] = useState(); + const [p_detail_header_total_reduction_amount, setp_detail_header_total_reduction_amount] = useState(); + const [p_detail_header_type_reduction_valeur, setp_detail_header_type_reduction_valeur] = useState(); + const [p_detail_header_montant_reduction, setp_detail_header_montant_reduction] = useState(); + const [p_detail_total_header_hors_taxe_before_header_reduction, setp_detail_total_header_hors_taxe_before_header_reduction] = useState(); + const [p_detail_total_header_hors_taxe_after_header_reduction, setp_detail_total_header_hors_taxe_after_header_reduction] = useState(); + const [p_detail_order_header_tax_amount, setp_detail_order_header_tax_amount] = useState(); + const [p_detail_total_header_toutes_taxes, setp_detail_total_header_toutes_taxes] = useState(); + + + + const [p_detail_total_lines_hors_taxe_before_lines_reduction, setp_detail_total_lines_hors_taxe_before_lines_reduction] = useState(); + const [p_detail_total_lines_hors_taxe_after_lines_reduction, setp_detail_total_lines_hors_taxe_after_lines_reduction] = useState(); + + + + async function Enable_Order_Header_DetailFields() { + + await sleep(5); + + setorder_data_edit_mode("1"); + + if (document.getElementsByName("detail_header_type")[0]) { + document.getElementsByName("detail_header_type")[0].disabled = false; + document.getElementsByName("detail_header_type")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("order_header_inclus_bpf")[0]) { + document.getElementsByName("order_header_inclus_bpf")[0].disabled = false; + document.getElementsByName("order_header_inclus_bpf")[0].style.backgroundColor = "#FFFFFF"; + } + + + if (document.getElementsByName("detail_header_status")[0]) { + document.getElementsByName("detail_header_status")[0].disabled = false; + document.getElementsByName("detail_header_status")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("detail_header_ref_interne")[0]) { + document.getElementsByName("detail_header_ref_interne")[0].disabled = false; + document.getElementsByName("detail_header_ref_interne")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("detail_header_order_paiement_condition")[0]) { + document.getElementsByName("detail_header_order_paiement_condition")[0].disabled = false; + document.getElementsByName("detail_header_order_paiement_condition")[0].style.backgroundColor = "#FFFFFF"; + } + + + if (document.getElementsByName("detail_header_date_cmd")[0]) { + document.getElementsByName("detail_header_date_cmd")[0].disabled = false; + document.getElementsByName("detail_header_date_cmd")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("detail_header_date_expiration")[0]) { + document.getElementsByName("detail_header_date_expiration")[0].disabled = false; + document.getElementsByName("detail_header_date_expiration")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("detail_nom_client")[0]) { + document.getElementsByName("detail_nom_client")[0].disabled = false; + document.getElementsByName("detail_nom_client")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("detail_header_description")[0]) { + document.getElementsByName("detail_header_description")[0].disabled = false; + document.getElementsByName("detail_header_description")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("detail_header_comment")[0]) { + document.getElementsByName("detail_header_comment")[0].disabled = false; + document.getElementsByName("detail_header_comment")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("detail_header_lieu_formation")[0]) { + document.getElementsByName("detail_header_lieu_formation")[0].disabled = false; + document.getElementsByName("detail_header_lieu_formation")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("detail_header_vendeur_nom_prenom")[0]) { + document.getElementsByName("detail_header_vendeur_nom_prenom")[0].disabled = false; + document.getElementsByName("detail_header_vendeur_nom_prenom")[0].style.backgroundColor = "#FFFFFF"; + } + + //---- + if (document.getElementsByName("detail_header_ref_cient")[0]) { + document.getElementsByName("detail_header_ref_cient")[0].disabled = false; + document.getElementsByName("detail_header_ref_cient")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("detail_header_email_client")[0]) { + document.getElementsByName("detail_header_email_client")[0].disabled = false; + document.getElementsByName("detail_header_email_client")[0].style.backgroundColor = "#FFFFFF"; + } + + + if (document.getElementsByName("detail_header_fact_adresse")[0]) { + document.getElementsByName("detail_header_fact_adresse")[0].disabled = false; + document.getElementsByName("detail_header_fact_adresse")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("detail_header_fact_code_postal")[0]) { + document.getElementsByName("detail_header_fact_code_postal")[0].disabled = false; + document.getElementsByName("detail_header_fact_code_postal")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("detail_header_fact_ville")[0]) { + document.getElementsByName("detail_header_fact_ville")[0].disabled = false; + document.getElementsByName("detail_header_fact_ville")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("detail_header_fact_pays")[0]) { + document.getElementsByName("detail_header_fact_pays")[0].disabled = false; + document.getElementsByName("detail_header_fact_pays")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("detail_header_liv_adresse")[0]) { + document.getElementsByName("detail_header_liv_adresse")[0].disabled = false; + document.getElementsByName("detail_header_liv_adresse")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("detail_header_liv_code_postal")[0]) { + document.getElementsByName("detail_header_liv_code_postal")[0].disabled = false; + document.getElementsByName("detail_header_liv_code_postal")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("detail_header_liv_ville")[0]) { + document.getElementsByName("detail_header_liv_ville")[0].disabled = false; + document.getElementsByName("detail_header_liv_ville")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("detail_header_liv_pays")[0]) { + document.getElementsByName("detail_header_liv_pays")[0].disabled = false; + document.getElementsByName("detail_header_liv_pays")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("detail_header_total_ht")[0]) { + document.getElementsByName("detail_header_total_ht")[0].disabled = false; + document.getElementsByName("detail_header_total_ht")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("detail_header_total_tax")[0]) { + document.getElementsByName("detail_header_total_tax")[0].disabled = false; + document.getElementsByName("detail_header_total_tax")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("detail_header_total_ttc")[0]) { + document.getElementsByName("detail_header_total_ttc")[0].disabled = false; + document.getElementsByName("detail_header_total_ttc")[0].style.backgroundColor = "#FFFFFF"; + } + + /* + if (document.getElementsByName("detail_header_type_reduction")[0]) { + document.getElementsByName("detail_header_type_reduction")[0].disabled = false; + document.getElementsByName("detail_header_type_reduction")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("detail_header_type_reduction_valeur")[0]) { + document.getElementsByName("detail_header_type_reduction_valeur")[0].disabled = false; + document.getElementsByName("detail_header_type_reduction_valeur")[0].style.backgroundColor = "#FFFFFF"; + } + + + if (document.getElementsByName("detail_header_montant_reduction")[0]) { + document.getElementsByName("detail_header_montant_reduction")[0].disabled = false; + document.getElementsByName("detail_header_montant_reduction")[0].style.backgroundColor = "#FFFFFF"; + }*/ + + if (document.getElementsByName("detail_header_devis_nb_relance_auto")[0]) { + document.getElementsByName("detail_header_devis_nb_relance_auto")[0].disabled = false; + document.getElementsByName("detail_header_devis_nb_relance_auto")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("detail_header_devis_freq_relance_auto")[0]) { + document.getElementsByName("detail_header_devis_freq_relance_auto")[0].disabled = false; + document.getElementsByName("detail_header_devis_freq_relance_auto")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("detail_header_devis_relance_auto")[0]) { + document.getElementsByName("detail_header_devis_relance_auto")[0].disabled = false; + document.getElementsByName("detail_header_devis_relance_auto")[0].style.backgroundColor = "#FFFFFF"; + } + + + } + + async function disable_Order_Header_DetailFields() { + await sleep(5); + + setorder_data_edit_mode("0"); + + if (document.getElementsByName("detail_header_type")[0]) { + document.getElementsByName("detail_header_type")[0].disabled = true; + document.getElementsByName("detail_header_type")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("order_header_inclus_bpf")[0]) { + document.getElementsByName("order_header_inclus_bpf")[0].disabled = true; + document.getElementsByName("order_header_inclus_bpf")[0].style.backgroundColor = "#ECEFF1"; + } + + + if (document.getElementsByName("detail_header_status")[0]) { + document.getElementsByName("detail_header_status")[0].disabled = true; + document.getElementsByName("detail_header_status")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("detail_header_ref_interne")[0]) { + document.getElementsByName("detail_header_ref_interne")[0].disabled = true; + document.getElementsByName("detail_header_ref_interne")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("detail_header_order_paiement_condition")[0]) { + document.getElementsByName("detail_header_order_paiement_condition")[0].disabled = true; + document.getElementsByName("detail_header_order_paiement_condition")[0].style.backgroundColor = "#ECEFF1"; + } + + + if (document.getElementsByName("detail_header_date_cmd")[0]) { + document.getElementsByName("detail_header_date_cmd")[0].disabled = true; + document.getElementsByName("detail_header_date_cmd")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("detail_header_date_expiration")[0]) { + document.getElementsByName("detail_header_date_expiration")[0].disabled = true; + document.getElementsByName("detail_header_date_expiration")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("detail_nom_client")[0]) { + document.getElementsByName("detail_nom_client")[0].disabled = true; + document.getElementsByName("detail_nom_client")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("detail_header_description")[0]) { + document.getElementsByName("detail_header_description")[0].disabled = true; + document.getElementsByName("detail_header_description")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("detail_header_comment")[0]) { + document.getElementsByName("detail_header_comment")[0].disabled = true; + document.getElementsByName("detail_header_comment")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("detail_header_lieu_formation")[0]) { + document.getElementsByName("detail_header_lieu_formation")[0].disabled = true; + document.getElementsByName("detail_header_lieu_formation")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("detail_header_vendeur_nom_prenom")[0]) { + document.getElementsByName("detail_header_vendeur_nom_prenom")[0].disabled = true; + document.getElementsByName("detail_header_vendeur_nom_prenom")[0].style.backgroundColor = "#ECEFF1"; + } + + //--- + if (document.getElementsByName("detail_header_ref_cient")[0]) { + document.getElementsByName("detail_header_ref_cient")[0].disabled = true; + document.getElementsByName("detail_header_ref_cient")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("detail_header_email_client")[0]) { + document.getElementsByName("detail_header_email_client")[0].disabled = true; + document.getElementsByName("detail_header_email_client")[0].style.backgroundColor = "#ECEFF1"; + } + + + if (document.getElementsByName("detail_header_fact_adresse")[0]) { + document.getElementsByName("detail_header_fact_adresse")[0].disabled = true; + document.getElementsByName("detail_header_fact_adresse")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("detail_header_fact_code_postal")[0]) { + document.getElementsByName("detail_header_fact_code_postal")[0].disabled = true; + document.getElementsByName("detail_header_fact_code_postal")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("detail_header_fact_ville")[0]) { + document.getElementsByName("detail_header_fact_ville")[0].disabled = true; + document.getElementsByName("detail_header_fact_ville")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("detail_header_fact_pays")[0]) { + document.getElementsByName("detail_header_fact_pays")[0].disabled = true; + document.getElementsByName("detail_header_fact_pays")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("detail_header_liv_adresse")[0]) { + document.getElementsByName("detail_header_liv_adresse")[0].disabled = true; + document.getElementsByName("detail_header_liv_adresse")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("detail_header_liv_code_postal")[0]) { + document.getElementsByName("detail_header_liv_code_postal")[0].disabled = true; + document.getElementsByName("detail_header_liv_code_postal")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("detail_header_liv_ville")[0]) { + document.getElementsByName("detail_header_liv_ville")[0].disabled = true; + document.getElementsByName("detail_header_liv_ville")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("detail_header_liv_pays")[0]) { + document.getElementsByName("detail_header_liv_pays")[0].disabled = true; + document.getElementsByName("detail_header_liv_pays")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("detail_header_total_ht")[0]) { + document.getElementsByName("detail_header_total_ht")[0].disabled = true; + document.getElementsByName("detail_header_total_ht")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("detail_header_total_tax")[0]) { + document.getElementsByName("detail_header_total_tax")[0].disabled = true; + document.getElementsByName("detail_header_total_tax")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("detail_header_total_ttc")[0]) { + document.getElementsByName("detail_header_total_ttc")[0].disabled = true; + document.getElementsByName("detail_header_total_ttc")[0].style.backgroundColor = "#ECEFF1"; + } + + + if (document.getElementsByName("detail_header_type_reduction")[0]) { + document.getElementsByName("detail_header_type_reduction")[0].disabled = true; + document.getElementsByName("detail_header_type_reduction")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("detail_header_type_reduction_valeur")[0]) { + document.getElementsByName("detail_header_type_reduction_valeur")[0].disabled = true; + document.getElementsByName("detail_header_type_reduction_valeur")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("detail_header_montant_reduction")[0]) { + document.getElementsByName("detail_header_montant_reduction")[0].disabled = true; + document.getElementsByName("detail_header_montant_reduction")[0].style.backgroundColor = "#ECEFF1"; + } + + + if (document.getElementsByName("detail_header_devis_relance_auto")[0]) { + document.getElementsByName("detail_header_devis_relance_auto")[0].disabled = true; + document.getElementsByName("detail_header_devis_relance_auto")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("detail_header_devis_freq_relance_auto")[0]) { + document.getElementsByName("detail_header_devis_freq_relance_auto")[0].disabled = true; + document.getElementsByName("detail_header_devis_freq_relance_auto")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("detail_header_devis_nb_relance_auto")[0]) { + document.getElementsByName("detail_header_devis_nb_relance_auto")[0].disabled = true; + document.getElementsByName("detail_header_devis_nb_relance_auto")[0].style.backgroundColor = "#ECEFF1"; + } + + } + + function Annule_Order_DetailFields() { + + Get_Order_Data(selected_id); + Get_Partner_Orders_Lines_from_header_id(selected_id); + + setOrder_data_changed(""); + setorder_data_edit_mode(""); + disable_Order_Header_DetailFields(); + order_header_submenu_main(); + + } + + const [Update_One_Order_Data_api, setUpdate_One_Order_Data_api] = useState(); + const [Update_One_Order_Data_message, setUpdate_One_Order_Data_message] = useState(); + const [Update_One_Order_Data_result, setUpdate_One_Order_Data_result] = useState(); + function Update_One_Order_Data() { + var form = new FormData(); + //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("order_header_id", selected_id); + form.append("order_header_ref_interne", p_detail_header_ref_interne); + form.append("order_header_type", p_detail_header_type); + + if (p_detail_header_statut) + form.append("order_header_status", p_detail_header_statut); + else + form.append("order_header_status", "0"); + + if (p_detail_header_email_client) + form.append("order_header_email_client", p_detail_header_email_client); + else + form.append("order_header_email_client", ""); + + + if (p_detail_header_client_nom_id) + form.append("order_header_client_id", p_detail_header_client_nom_id); + else + form.append("order_header_client_id", ""); + + + if (p_detail_header_vendeur_nom_id) + form.append("order_header_vendeur_id", p_detail_header_vendeur_nom_id); + else + form.append("order_header_vendeur_id", ""); + + if (p_detail_header_condition_paiement_id) + form.append("order_header_condition_paiement_id", p_detail_header_condition_paiement_id); + else + form.append("order_header_condition_paiement_id", ""); + + if (p_detail_header_date_expiration_val) + form.append("order_header_date_expiration", p_detail_header_date_expiration); + else + form.append("order_header_date_expiration", ""); + + if (p_detail_header_date_cmd_val) + form.append("order_header_date_cmd", p_detail_header_date_cmd_val); + else + form.append("order_header_date_cmd", ""); + + if (p_detail_header_lieu_formation) + form.append("order_header_lieu_formation", p_detail_header_lieu_formation); + else + form.append("order_header_lieu_formation", ""); + + if (p_detail_header_comment) + form.append("order_header_comment", p_detail_header_comment); + else + form.append("order_header_comment", ""); + + if (p_detail_header_description) + form.append("order_header_description", p_detail_header_description); + else + form.append("order_header_description", ""); + + if (p_detail_header_ref_client) + form.append("order_header_ref_client", p_detail_header_ref_client); + else + form.append("order_header_ref_client", ""); + + + // ---- + if (p_detail_header_fact_adr) + form.append("order_header_adr_fact_adresse", p_detail_header_fact_adr); + else + form.append("order_header_adr_fact_adresse", ""); + + if (p_detail_header_fact_code_postal) + form.append("order_header_adr_fact_code_postal", p_detail_header_fact_code_postal); + else + form.append("order_header_adr_fact_code_postal", ""); + + + if (p_detail_header_fact_ville) + form.append("order_header_adr_fact_ville", p_detail_header_fact_ville); + else + form.append("order_header_adr_fact_ville", ""); + + + if (p_detail_header_fact_pays) + form.append("order_header_adr_fact_pays", p_detail_header_fact_pays); + else + form.append("order_header_adr_fact_pays", ""); + + + if (p_detail_header_liv_adr) + form.append("order_header_adr_liv_adresse", p_detail_header_liv_adr); + else + form.append("order_header_adr_liv_adresse", ""); + + if (p_detail_header_liv_code_postal) + form.append("order_header_adr_liv_code_postal", p_detail_header_liv_code_postal); + else + form.append("order_header_adr_liv_code_postal", ""); + + if (p_detail_header_liv_ville) + form.append("order_header_adr_liv_ville", p_detail_header_liv_ville); + else + form.append("order_header_adr_liv_ville", ""); + + if (p_detail_header_liv_pays) + form.append("order_header_adr_liv_pays", p_detail_header_liv_pays); + else + form.append("order_header_adr_liv_pays", ""); + + + + + //--- + + if (p_detail_header_total_ht) + form.append("order_header_total_ht", p_detail_header_total_ht); + else + form.append("order_header_total_ht", ""); + + if (p_detail_header_total_tax) + form.append("order_header_total_tax", p_detail_header_total_tax); + else + form.append("order_header_total_tax", ""); + + if (p_detail_header_total_ttc) + form.append("order_header_total_ttc", p_detail_header_total_ttc); + else + form.append("order_header_total_ttc", ""); + + + if (p_detail_header_type_reduction) + form.append("order_header_type_reduction", p_detail_header_type_reduction); + else + form.append("order_header_type_reduction", ""); + + + if (p_detail_header_type_reduction_valeur) + form.append("order_header_type_reduction_valeur", p_detail_header_type_reduction_valeur); + else + form.append("order_header_type_reduction_valeur", ""); + + + if (p_detail_header_montant_reduction) + form.append("order_header_montant_reduction", p_detail_header_montant_reduction); + else + form.append("order_header_montant_reduction", ""); + + + if (p_add_cmd_header_order_inclus_bpf) + form.append("order_header_inclus_bpf", p_add_cmd_header_order_inclus_bpf); + else + form.append("order_header_inclus_bpf", ""); + + + //console.log(" form == ", form); + + var myurl = ""; + if (String(p_detail_header_type) === "commande") + myurl = process.env.REACT_APP_API_URL + "myclass/api/Update_Partner_Order_Header/"; + else if (String(p_detail_header_type) === "devis") { + myurl = process.env.REACT_APP_API_URL + "myclass/api/Update_Partner_Quotation_Header/"; + + if (p_detail_header_devis_relance_auto) + form.append("relance_auto", p_detail_header_devis_relance_auto); + else + form.append("relance_auto", ""); + + if (p_detail_header_devis_nb_relance) + form.append("nb_relance_auto", p_detail_header_devis_nb_relance); + else + form.append("nb_relance_auto", ""); + + if (p_detail_header_devis_frequence_relance) + form.append("frequence_relance_auto", p_detail_header_devis_frequence_relance); + else + form.append("frequence_relance_auto", ""); + + + } + else { + // alert(" Type de commande inconnu."); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message("Type de commande inconnu."); + setalert_type("error"); + return; + } + setLoading(true); + axios.post(myurl, form).then(res => { + //console.log(" In Update_One_Order_Data res.data.status = " + res.data.status); + //console.log(" In Update_One_Order_Data res.data.message r_class = " + res.data.message); + + setLoading(false); + if (String(res.data.status) === String("true")) { + setUpdate_One_Order_Data_api("true"); + setUpdate_One_Order_Data_result(res.data.message); + + Getall_Parter_Orders_No_Filter(); + + + + setOrder_data_changed(""); + setorder_data_edit_mode(""); + Display_Detail_Order_data(selected_id); + // alert(" La mise à jour du " + String(p_detail_header_type) + " été correctement faite."); + // alert(res.data.message); + + var txt = "La mise à jour du " + String(p_detail_header_type) + " été correctement faite." + setdisplay_alert_mysy("1"); + setalert_message(txt); + setalert_type("success"); + + if (document.getElementById('myRef_head')) { + var divh = document.getElementById('myRef_head').offsetTop; + window.scrollTo({ + top: divh, + behavior: "smooth", + }); + } + disable_Order_Header_DetailFields(); + + } + else { + setUpdate_One_Order_Data_api("false"); + setUpdate_One_Order_Data_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + + setLoading(false); + console.warn('UpdateStagiaireData : Not good man :( Update_One_Order_Data = ' + error); + setUpdate_One_Order_Data_api("false"); + alert(" Impossible de faire la mise à jour"); + + }) + } + + const [New_Getall_Training_Employee_No_Filter_result, setNew_Getall_Training_Employee_No_Filter_result] = useState([]); + + const [Getall_Training_Employee_No_Filter_api, setGetall_Training_Employee_No_Filter_api] = useState(); + const [Getall_Training_Employee_No_Filter_message, setGetall_Training_Employee_No_Filter_message] = useState(); + const [Getall_Training_Employee_No_Filter_result, setGetall_Training_Employee_No_Filter_result] = useState(); + function Getall_Training_Employee_No_Filter(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_List_Ressource_Humaine_no_filter/"; + + + + axios.post(myurl, form).then(res => { + + if (String(res.data.status) === String("true")) { + //console.log(" In Getall_Training_Employee_No_Filter res.data.status = " + res.data.status); + //console.log(" In Getall_Training_Employee_No_Filter res.data.message r_class = " + res.data.message); + setGetall_Training_Employee_No_Filter_api("true"); + setGetall_Training_Employee_No_Filter_result(res.data.message); + + var new_data2 = []; + const new_data = res.data.message.map((x) => { + + //--- + var localid = JSON.parse(x).id; + var local_id = JSON.parse(x)._id; + var local_nom = JSON.parse(x).nom; + var local_prenom = JSON.parse(x).prenom; + var local_ismanager = JSON.parse(x).ismanager; + + + //--- + var node = { + "_id": local_id, + "id": localid, + "label": local_nom + " " + local_prenom, + "nom": local_nom, + "prenom": local_prenom, + "ismanager": local_ismanager + }; + new_data2.push(node); + }); + + var node = { + "_id": "", + "id": "", + "label": "", + "nom": "", + "prenom": "", + "ismanager": "" + }; + new_data2.push(node); + + if (new_data2.length > 0) + setNew_Getall_Training_Employee_No_Filter_result(new_data2); + } + else { + setGetall_Training_Employee_No_Filter_api("false"); + setGetall_Training_Employee_No_Filter_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).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("") + }) + } + + + const [test_comment_dialog, settest_comment_dialog] = useState(); + const [Dialog_Detail_Article_open, setDialog_Detail_Article_open] = React.useState(false); + + const Close_Dialog_Detail_Article_open = () => { + + setDialog_Detail_Article_open(false); + }; + + + + const [Add_Update_One_Order_Line_Data_api, setAdd_Update_One_Order_Line_Data_api] = useState(); + const [Add_Update_One_Order_Line_Data_message, setAdd_Update_One_Order_Line_Data_message] = useState(); + const [Add_Update_One_Order_Line_Data_result, setAdd_Update_One_Order_Line_Data_result] = useState(); + function Add_Update_One_Order_Line_Data() { + + /*** Recualcule des taux et montants */ + + var qty = parseFloat(document.getElementById("ref_article_qty").value); + var unit_price = parseFloat(document.getElementById("ref_article_unit_price").value); + var total_base1 = (unit_price * qty).toFixed(2); + var total_reduction = 0; + + + + var reduct_type = document.getElementById("ref_article_type_reduction").value; + var reduct_value = document.getElementById("ref_article_reduction_value").value; + + //var reduct_type = p_add_line_item_type_reduction; + + //console.log(" reduct_type = ", reduct_type); + //console.log(" p_add_line_item_type_reduction = ", p_add_line_item_type_reduction); + + if (String(p_add_line_item_type_reduction) === "fixe") { + //console.log("fixe : p_add_line_item_reduction_value = ", reduct_value); + total_reduction = (parseFloat(String(reduct_value)) * qty).toFixed(2); + + + + } if (String(p_add_line_item_type_reduction) === "percent") { + //console.log("percent p_add_line_item_reduction_value = ", reduct_value); + total_reduction = ((unit_price * parseFloat(String(reduct_value)) * qty) / 100).toFixed(2); + + } + + + + console.log(" GLOBAL #### partner_taux_tva = ", partner_taux_tva, " ### qty = ", qty, " ### unit_price = ", unit_price, " ### total_base1 = ", total_base1, " ### total_reduction = ", total_reduction, " ### reduct_value = ", reduct_value); + + const total_taux_tax_bef = parseFloat(String(partner_taux_tva)) / 100; + + console.log(" GLOBAL #### total_taux_tax_bef = ", total_taux_tax_bef); + + const total_taux_tax = 1 + total_taux_tax_bef; + + const total_base1_total_reduction = (total_base1 - total_reduction); + + const montant_ttc = (total_base1_total_reduction * total_taux_tax).toFixed(2); + + //console.log(" GLOBAL #### total_taux_tax = ", total_taux_tax); + //console.log(" GLOBAL #### total_base1_total_reduction = ", total_base1_total_reduction); + //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); + + // 20/08/2024 - enlever la réduction du total ht + total_base1 = total_base1 - total_reduction; + + //console.log(" GLOBAL #### montant_taxe_tva = ", montant_taxe_tva, " ### montant_ttc = ", montant_ttc); + + setp_add_line_item_reduction_total_amount(String(total_reduction)); + setp_add_line_item_total_amount_ht(String(total_base1)); + setp_add_line_item_taxe("tva"); + setp_add_line_item_taxe_amount(String(montant_taxe_tva)); + setp_add_line_item_total_amount_ttc(String(montant_ttc)); + /*** FINNN Recualcule des taux et montants */ + + var form = new FormData(); + //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("order_line_formation", p_add_line_item_internal_url); + form.append("order_line_qty", p_add_line_item_qty); + form.append("order_line_prix_unitaire", p_add_line_item_price); + form.append("order_line_id", selected_order_line_id); + form.append("order_header_ref_interne", order_internal_ref); + form.append("order_header_id", selected_id); + form.append("order_line_status", p_add_line_item_status); + form.append("order_line_type", p_add_line_item_type); + form.append("order_line_comment", p_add_line_item_comment); + + form.append("order_line_type_article", article_formation_ou_produit); + + form.append("order_line_type_apprenant", String(p_add_line_item_type_apprenant)); + + form.append("order_line_type_reduction", p_add_line_item_type_reduction); + form.append("order_line_type_valeur", p_add_line_item_reduction_value); + form.append("order_line_montant_reduction", String(total_reduction)); + + + + form.append("order_line_montant_hors_taxes", String(total_base1)); + + form.append("order_line_taux_taxe", partner_taux_tva); + + form.append("order_line_tax", p_add_line_item_taxe); + form.append("order_line_tax_amount", String(montant_taxe_tva)); + form.append("order_line_montant_toutes_taxes", String(montant_ttc)); + + if (p_add_line_session_id && String(p_add_line_session_id).length > 2) + form.append("order_line_session_id", p_add_line_session_id); + else + form.append("order_line_session_id", ""); + + // Controle des champs obligatoires + if (!p_add_line_item || String(p_add_line_item).length < 2) { + //alert(" Vous devez choisir une formation "); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message("Vous devez choisir une formation "); + setalert_type("error"); + return; + } + + + if (!p_add_line_item_qty || parseFloat(String(p_add_line_item_qty)) <= 0) { + // alert(" La quantité choisie est incorrecte "); + setdisplay_alert_mysy("1"); + setalert_message(" La quantité choisie est incorrecte "); + setalert_type("error"); + return; + } + + if (!p_add_line_item_price || parseFloat(String(p_add_line_item_price)) < 0) { + // alert(" Le prix unitaire est incorrecte "); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(" Le prix unitaire est incorrecte "); + setalert_type("error"); + return; + } + + if (String(p_add_line_item_type_reduction) === "percent" && + (parseFloat(String(p_add_line_item_reduction_value)) < 0 || parseFloat(String(p_add_line_item_reduction_value)) > 100)) { + // alert(" Pour une reduction de type 'pourcentage', la valeur doit être comprise entre 0 et 100 "); + + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message("Pour une reduction de type 'pourcentage', la valeur doit être comprise entre 0 et 100"); + setalert_type("error"); + + return; + } + + if (String(p_add_line_item_type_reduction) === "fixe" && + (parseFloat(String(p_add_line_item_reduction_value)) < 0 || parseFloat(String(p_add_line_item_reduction_value)) > parseFloat(String(p_add_line_item_price)))) { + // alert(" Pour une reduction de type 'fixe', la valeur ne doit pas excéder le prix unitaire de l'article "); + + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(" Pour une reduction de type 'fixe', la valeur ne doit pas excéder le prix unitaire de l'article "); + setalert_type("error"); + return; + } + + //console.log("### form = ", form); + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Add_Update_Partner_Order_Line/"; + + setLoading(true); + axios.post(myurl, form).then(res => { + //console.log(" In Add_Update_One_Order_Line_Data res.data.status = " + res.data.status); + //console.log(" In Add_Update_One_Order_Line_Data res.data.message r_class = " + res.data.message); + + setLoading(false); + if (String(res.data.status) === String("true")) { + setAdd_Update_One_Order_Line_Data_api("true"); + setAdd_Update_One_Order_Line_Data_result(res.data.message); + clean_article_detail_fields(); + + Display_Detail_Order_data(selected_id); + // alert(" L'article a été correctement ajouté / mis à jour."); + + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message("L'article a été correctement ajouté / mis à jour."); + setalert_type("success"); + + setDialog_Detail_Article_open(false); + + //myRef_head.current.scrollIntoView({ behavior: "smooth" }); + + } + else { + setAdd_Update_One_Order_Line_Data_api("false"); + setAdd_Update_One_Order_Line_Data_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + + setLoading(false); + console.warn('UpdateStagiaireData : Not good man :( Add_Update_One_Order_Line_Data = ' + error); + setAdd_Update_One_Order_Line_Data_api("false"); + alert(" Impossible d'ajouter / mettre à jour la ligne"); + + }) + } + + + + const Update_Dialog_Detail_Article_open = () => { + Add_Update_One_Order_Line_Data(); + + }; + + + + const [p_add_line_session_id, setp_add_line_session_id] = useState(""); + const [p_add_line_session_code, setp_add_line_session_code] = useState(""); + + const [p_add_line_order_line_type_article, setp_add_line_order_line_type_article] = useState(""); + + const [p_add_line_item, setp_add_line_item] = useState(""); + const [p_add_line_item_internal_url, setp_add_line_item_internal_url] = useState(""); + const [p_add_line_item_title, setp_add_line_item_title] = useState(); + const [p_add_line_item_qty, setp_add_line_item_qty] = useState(); + const [p_add_line_item_price, setp_add_line_item_price] = useState(); + const [p_add_line_item_comment, setp_add_line_item_comment] = useState(); + const [p_add_line_item_status, setp_add_line_item_status] = useState(); + const [p_add_line_item_type, setp_add_line_item_type] = useState(); + + const [p_add_line_item_type_apprenant, setp_add_line_item_type_apprenant] = useState(""); + + + function clean_article_detail_fields() { + setp_add_line_item(); + setp_add_line_item_internal_url(""); + setp_add_line_item_title(); + setp_add_line_item_qty(); + setp_add_line_item_price(); + setp_add_line_item_comment(); + setp_add_line_item_status(); + setp_add_line_item_type(); + setp_add_line_session_id(""); + setp_add_line_session_code(""); + setp_add_line_item_type_apprenant(""); + } + + function Ajouter_une_ligne_article() { + + setarticle_formation_ou_produit("formation"); + // Recuperation des session de formation + Getall_TrainingSession(); + + setp_add_line_session_id(""); + setp_add_line_session_code(""); + setp_add_line_item(""); + setp_add_line_item_qty(""); + setp_add_line_item_price(""); + setp_add_line_item_comment(""); + setp_add_line_item_type_reduction(""); + setp_add_line_item_reduction_value(""); + setp_add_line_item_reduction_total_amount(""); + setp_add_line_item_total_amount_ht(""); + setp_add_line_item_taxe(""); + setp_add_line_item_taxe_amount(""); + setp_add_line_item_total_amount_ttc(""); + setp_add_line_item_type_apprenant(""); + + setpartner_taux_tva("20"); + + setselected_order_line_id(""); + + setp_add_line_item_status(p_detail_header_statut); + setp_add_line_item_type(p_detail_header_type); + + setDialog_Detail_Article_open(true); + } + + const [Dialog_Detail_Commande_open, setDialog_Detail_Commande_open] = useState(false); + + + function Dialog_cmd_handleClose() { + + } + + const Dialog_cmd_handleClose_buton = () => { + setDialog_Detail_Commande_open(false); + }; + + + const Close_Dialog_Detail_Order_open = () => { + clean_order_detail_fields(); + setDialog_Detail_Commande_open(false); + }; + + + const [Add_Dialog_Detail_Order_api, setAdd_Dialog_Detail_Order_api] = useState(); + const [Add_Dialog_Detail_Order_message, setAdd_Dialog_Detail_Order_message] = useState(); + const [Add_Dialog_Detail_Order_result, setAdd_Dialog_Detail_Order_result] = useState(); + function Add_Dialog_Detail_Order() { + var form = new FormData(); + //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("order_header_client_id", p_add_cmd_header_client_id); + form.append("order_header_description", p_add_cmd_header_description); + form.append("order_header_comment", p_add_cmd_header_comment); + form.append("order_header_lieu_formation", p_add_cmd_header_lieu_formation); + form.append("order_header_date_cmd", p_add_cmd_header_date_cmd); + form.append("order_header_date_expiration", p_add_cmd_header_date_expiration_cmd); + form.append("order_header_condition_paiement_id", p_add_cmd_header_condition_paiement_id); + form.append("order_header_ref_client", p_add_cmd_header_ref_client); + form.append("order_header_vendeur_id", p_add_cmd_header_vendeur_id); + form.append("order_header_type", p_add_cmd_header_order_type); + form.append("order_header_email_client", p_detail_header_email_client); + form.append("order_header_adr_fact_adresse", p_detail_header_fact_adr); + form.append("order_header_adr_fact_code_postal", p_detail_header_fact_code_postal); + form.append("order_header_adr_fact_ville", p_detail_header_fact_ville); + form.append("order_header_adr_fact_pays", p_detail_header_fact_pays); + form.append("order_header_adr_liv_adresse", p_detail_header_liv_adr); + form.append("order_header_adr_liv_code_postal", p_detail_header_liv_code_postal); + form.append("order_header_adr_liv_ville", p_detail_header_liv_ville); + form.append("order_header_adr_liv_pays", p_detail_header_liv_pays); + form.append("order_header_inclus_bpf", p_add_cmd_header_order_inclus_bpf); + + + if (!p_add_cmd_header_client_id || String(p_add_cmd_header_client_id).length < 2) { + // alert(" Vous devez choisir un client"); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message("Vous devez choisir un client"); + setalert_type("error"); + return; + } + //console.log("### form = ", form); + + + var myurl = "" + + if (String(p_add_cmd_header_order_type) === "devis") { + + /*** On va aller recuperer les setup de relance qui ont été parametrés */ + if (Getall_Parter_Devis_Config_Points_result && Getall_Parter_Devis_Config_Points_result.length > 0) { + const new_data = Getall_Parter_Devis_Config_Points_result.map((x) => { + form.append(String(JSON.parse(x).config_name), String(JSON.parse(x).config_value)); + }); + } + + myurl = process.env.REACT_APP_API_URL + "myclass/api/Add_Partner_Quotation/"; + } else if (String(p_add_cmd_header_order_type) === "commande") { + myurl = process.env.REACT_APP_API_URL + "myclass/api/Add_Partner_Order/"; + } else { + // alert(" Type de commande inconnu"); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message("Type de commande inconnu"); + setalert_type("error"); + return; + } + + setLoading(true); + axios.post(myurl, form).then(res => { + //console.log(" In Add_Update_One_Order_Line_Data res.data.status = " + res.data.status); + //console.log(" In Add_Update_One_Order_Line_Data res.data.message r_class = " + res.data.message); + + setLoading(false); + if (String(res.data.status) === String("true")) { + setAdd_Dialog_Detail_Order_api("true"); + setAdd_Dialog_Detail_Order_result(res.data.message); + clean_order_detail_fields(); + setDialog_Detail_Commande_open(false); + Getall_Parter_Orders_No_Filter(); + + if (String(p_add_cmd_header_order_type) === "devis") { + // alert(" La devis à jour été correctement ajouté."); + setdisplay_alert_mysy("1"); + setalert_message(" La devis à jour été correctement ajouté."); + setalert_type("success"); + } else if (String(p_add_cmd_header_order_type) === "commande") { + // alert(" La commande à jour été correctement ajoutée."); + setdisplay_alert_mysy("1"); + setalert_message("La commande à jour été correctement ajoutée."); + setalert_type("success"); + } + + if (document.getElementById('myRef_head')) { + var divh = document.getElementById('myRef_head').offsetTop; + window.scrollTo({ + top: divh, + behavior: "smooth", + }); + } + + } + else { + setAdd_Dialog_Detail_Order_api("false"); + setAdd_Dialog_Detail_Order_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + + setLoading(false); + console.warn('Add_Dialog_Detail_Order : Not good man :( Add_Dialog_Detail_Order = ' + error); + setAdd_Dialog_Detail_Order_api("false"); + + if (String(p_add_cmd_header_order_type) === "devis") { + // alert(" Impossible d'ajouter le devis"); + + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message("Impossible d'ajouter le devis"); + setalert_type("error"); + + } else if (String(p_add_cmd_header_order_type) === "commande") { + // alert(" La commande d'ajouter la commande."); + + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message("La commande d'ajouter la commande."); + setalert_type("error"); + } + + }) + + + } + + const Dialog_Order_handleClose = () => { + //alert(" Utiliser le bouton 'fermer' "); + //setOpen(false); + }; + + const [client_selected_paiement_ction_id, setclient_selected_paiement_ction_id] = useState(""); + + const [p_add_cmd_header_client_id, setp_add_cmd_header_client_id] = useState(""); + const [p_add_cmd_header_description, setp_add_cmd_header_description] = useState(""); + const [p_add_cmd_header_comment, setp_add_cmd_header_comment] = useState(""); + const [p_add_cmd_header_lieu_formation, setp_add_cmd_header_lieu_formation] = useState(""); + const [p_add_cmd_header_vendeur_id, setp_add_cmd_header_vendeur_id] = useState(props.conntected_employee_id); + const [p_add_cmd_header_vendeur_id_label, setp_add_cmd_header_vendeur_id_label] = useState(); + + const [p_add_cmd_header_date_cmd, setp_add_cmd_header_date_cmd] = useState(new Date().toLocaleDateString('fr-FR')); + const [p_add_cmd_header_date_expiration_cmd, setp_add_cmd_header_date_expiration_cmd] = useState(date_today_90j.toLocaleDateString('fr-FR')); + const [p_add_cmd_header_order_type, setp_add_cmd_header_order_type] = useState(""); + const [p_add_cmd_header_order_location_type, setp_add_cmd_header_order_location_type] = useState("1"); + const [p_add_cmd_header_ref_client, setp_add_cmd_header_ref_client] = useState(""); + const [p_add_cmd_header_condition_paiement_id, setp_add_cmd_header_condition_paiement_id] = useState(""); + + const [p_add_cmd_header_order_inclus_bpf, setp_add_cmd_header_order_inclus_bpf] = useState("1"); + + + function clean_order_detail_fields() { + setp_add_cmd_header_client_id(); + setp_add_cmd_header_description(); + setp_add_cmd_header_comment(); + setp_add_cmd_header_lieu_formation(); + setp_add_cmd_header_vendeur_id(props.conntected_employee_id); + setp_add_cmd_header_date_cmd(new Date().toLocaleDateString('fr-FR')); + setp_add_cmd_header_date_expiration_cmd(date_today_90j.toLocaleDateString('fr-FR')); + setp_add_cmd_header_order_type(); + setp_add_cmd_header_order_location_type("1"); + setp_add_cmd_header_order_inclus_bpf("1"); + + setp_add_cmd_header_ref_client(); + setp_add_cmd_header_condition_paiement_id(""); + + setp_detail_header_fact_adr(); + setp_detail_header_fact_code_postal(); + setp_detail_header_fact_ville(); + setp_detail_header_fact_pays(); + + setp_detail_header_liv_adr(); + setp_detail_header_liv_code_postal(); + sep_detail_header_liv_ville(); + setp_detail_header_liv_pays(); + setp_detail_header_devis_date_validation(""); + setp_detail_header_devis_date_envoi(""); + + } + + const [header_submenu, setheader_submenu] = useState("main"); + async function order_header_submenu_main() { + setheader_submenu("main"); + + await sleep(5); + submenu_color_management("order_header_main"); + + if (String(order_data_edit_mode) !== "1") { + disable_Order_Header_DetailFields(); + } + /* + + if (document.getElementById("order_header_main")) { + document.getElementById("order_header_main").style.backgroundColor = "#107758"; + document.getElementById("order_header_main").style.color = "white"; + } + + if (document.getElementById("order_header_detail")) { + document.getElementById("order_header_detail").style.backgroundColor = "#d8edfc"; + document.getElementById("order_header_detail").style.color = "black"; + } + + if (document.getElementById("order_header_facturation")) { + document.getElementById("order_header_facturation").style.backgroundColor = "#d8edfc"; + document.getElementById("order_header_facturation").style.color = "black"; + } +*/ + if (String(order_data_edit_mode) !== "1") { + disable_Order_Header_DetailFields(); + } + } + + async function order_header_submenu_detail() { + setheader_submenu("detail"); + + await sleep(5); + + submenu_color_management("order_header_detail"); + + if (String(order_data_edit_mode) !== "1") { + disable_Order_Header_DetailFields(); + } + + /* + if (document.getElementById("order_header_detail")) { + document.getElementById("order_header_detail").style.backgroundColor = "#107758"; + document.getElementById("order_header_detail").style.color = "white"; + } + + if (document.getElementById("order_header_main")) { + document.getElementById("order_header_main").style.backgroundColor = "#d8edfc"; + document.getElementById("order_header_main").style.color = "black"; + } + + if (document.getElementById("order_header_facturation")) { + document.getElementById("order_header_facturation").style.backgroundColor = "#d8edfc"; + document.getElementById("order_header_facturation").style.color = "black"; + } + + */ + if (String(order_data_edit_mode) !== "1") { + disable_Order_Header_DetailFields(); + } + } + + + + async function order_header_submenu_facturation() { + setheader_submenu("facturation"); + submenu_color_management("order_header_facturation"); + await sleep(5); + /* + if (document.getElementById("order_header_facturation")) { + document.getElementById("order_header_facturation").style.backgroundColor = "#107758"; + document.getElementById("order_header_facturation").style.color = "white"; + } + + if (document.getElementById("order_header_detail")) { + document.getElementById("order_header_detail").style.backgroundColor = "#d8edfc"; + document.getElementById("order_header_detail").style.color = "black"; + } + + if (document.getElementById("order_header_main")) { + document.getElementById("order_header_main").style.backgroundColor = "#d8edfc"; + document.getElementById("order_header_main").style.color = "black"; + } + */ + + if (String(order_data_edit_mode) !== "1") { + disable_Order_Header_DetailFields(); + } + } + + + async function order_header_submenu_relance() { + setheader_submenu("order_header_relance"); + + submenu_color_management("order_header_relance"); + await sleep(5); + + /* if (document.getElementById("order_header_facturation")) { + document.getElementById("order_header_facturation").style.backgroundColor = "#107758"; + document.getElementById("order_header_facturation").style.color = "white"; + } + + if (document.getElementById("order_header_detail")) { + document.getElementById("order_header_detail").style.backgroundColor = "#d8edfc"; + document.getElementById("order_header_detail").style.color = "black"; + } + + if (document.getElementById("order_header_main")) { + document.getElementById("order_header_main").style.backgroundColor = "#d8edfc"; + document.getElementById("order_header_main").style.color = "black"; + } + */ + + if (String(order_data_edit_mode) !== "1") { + disable_Order_Header_DetailFields(); + } + } + + async function order_header_submenu_historique() { + /* setheader_submenu("historique"); + + submenu_color_management("historique"); + await sleep(5); + + + if (String(order_data_edit_mode) !== "1") { + disable_Order_Header_DetailFields(); + }*/ + + setDialog_order_history_open(true) + } + + function submenu_color_management(current_menu) { + const list_sous_menu = ["order_header_facturation", "order_header_detail", "order_header_main", + "order_header_relance", "historique"] + + for (let i = 0; i < list_sous_menu.length; i++) { + + var sous_menu = list_sous_menu[i]; + if (String(sous_menu) !== current_menu) { + if (document.getElementById(sous_menu)) { + document.getElementById(sous_menu).style.backgroundColor = "#d8edfc"; + document.getElementById(sous_menu).style.color = "black"; + document.getElementById(sous_menu).style.fontWeight = "normal"; + } + } + + } + + if (document.getElementById(current_menu)) { + document.getElementById(current_menu).style.backgroundColor = "#107758"; + document.getElementById(current_menu).style.color = "white"; + document.getElementById(current_menu).style.fontWeight = "bold"; + } + + + + } + + + + const sleep = (milliseconds) => { + return new Promise(resolve => setTimeout(resolve, milliseconds)) + } + + + const [p_add_line_item_type_reduction, setp_add_line_item_type_reduction] = useState("fixe"); + const [p_add_line_item_reduction_value, setp_add_line_item_reduction_value] = useState(); + const [p_add_line_item_reduction_total_amount, setp_add_line_item_reduction_total_amount] = useState(); + const [p_add_line_item_total_amount_ht, setp_add_line_item_total_amount_ht] = useState(); + const [p_add_line_item_taxe, setp_add_line_item_taxe] = useState(); + const [p_add_line_item_taxe_amount, setp_add_line_item_taxe_amount] = useState(); + const [p_add_line_item_total_amount_ttc, setp_add_line_item_total_amount_ttc] = useState(); + const [p_add_line_item_duration_concat, setp_add_line_item_duration_concat] = useState(); + + + function Recalcul_Item_Amounts() { + var qty = parseFloat(document.getElementById("ref_article_qty").value); + var unit_price = parseFloat(document.getElementById("ref_article_unit_price").value); + var total_base1 = (unit_price * qty).toFixed(2); + var total_reduction = 0; + + + + var reduct_type = document.getElementById("ref_article_type_reduction").value; + var reduct_value = document.getElementById("ref_article_reduction_value").value; + + //var reduct_type = p_add_line_item_type_reduction; + + console.log(" reduct_type = ", reduct_type); + console.log(" p_add_line_item_type_reduction = ", p_add_line_item_type_reduction); + + if (String(p_add_line_item_type_reduction) === "fixe") { + console.log("fixe : p_add_line_item_reduction_value = ", reduct_value); + total_reduction = (parseFloat(String(reduct_value)) * qty).toFixed(2); + + } if (String(p_add_line_item_type_reduction) === "percent") { + console.log("percent p_add_line_item_reduction_value = ", reduct_value); + total_reduction = ((unit_price * parseFloat(String(reduct_value)) * qty) / 100).toFixed(2); + + } + + + + console.log(" #### partner_taux_tva = ", partner_taux_tva, " ### qty = ", qty, " ### unit_price = ", unit_price, " ### total_base1 = ", total_base1, " ### total_reduction = ", total_reduction, " ### reduct_value = ", reduct_value); + + var montant_taxe_tva = ((total_base1 - total_reduction) * [parseFloat(String(partner_taux_tva)) / 100]).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); + + // 20/08/2024 - enlever la réduction du total ht + total_base1 = total_base1 - total_reduction; + + console.log(" #### montant_taxe_tva = ", montant_taxe_tva, " ### montant_ttc = ", montant_ttc); + + setp_add_line_item_reduction_total_amount(String(total_reduction)); + setp_add_line_item_total_amount_ht(String(total_base1)); + setp_add_line_item_taxe("tva"); + setp_add_line_item_taxe_amount(String(montant_taxe_tva)); + setp_add_line_item_total_amount_ttc(String(montant_ttc)); + + //console.log(" ### montant tva = ", String(montant_taxe_tva), " ### montant TTC = ", String(montant_ttc)); + } + + + + function Compute_Order_Header_Price() { + + if (String(Order_data_changed) === "1") { + // alert(" Merci d'enregistrer les modification avant de lancer le calcul"); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(" Merci d'enregistrer les modification avant de lancer le calcul"); + setalert_type("error"); + } + + Compute_Partner_Order(); + + + } + + const [Compute_Partner_Order_api, setCompute_Partner_Order_api] = useState(); + const [Compute_Partner_Order_message, setCompute_Partner_Order_message] = useState(); + const [Compute_Partner_Order_result, setCompute_Partner_Order_result] = useState(); + function Compute_Partner_Order(event) { + + var form = new FormData(); + const stored_cookie = getCookie('tokenmysypart'); + + form.append("token", stored_cookie); + form.append("_id", selected_id); + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Compute_Order_Header/"; + + setLoading(true); + + axios.post(myurl, form).then(res => { + //console.log(" In Compute_Partner_Order res.data.status = " + res.data.status); + //console.log(" In Compute_Partner_Order res.data.message r_class = " + res.data.message); + + setLoading(false); + if (String(res.data.status) === String("true")) { + setCompute_Partner_Order_api("true"); + setCompute_Partner_Order_result(res.data.message); + Get_Order_Data(selected_id); + Get_Partner_Orders_Lines_from_header_id(selected_id); + + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("success"); + } + else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); + } + else { + setCompute_Partner_Order_api("false"); + setCompute_Partner_Order_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + setLoading(false); + console.warn('Not good man :( Compute_Partner_Order = ', error); + setCompute_Partner_Order_api("false"); + alert('Erreur: Impossible de mettre à jour les prix'); + //setmyApimyApiMessage("") + }) + } + + + + function print_order_pdf() { + const stored_cookie = getCookie('tokenmysypart'); + + var nom_fichier_cmd = "Order_" + order_internal_ref + ".pdf"; + console.log(" nom_fichier_cmd = ", nom_fichier_cmd, " --- selected_id = ", selected_id); + + var url = process.env.REACT_APP_API_URL + "myclass/api/GerneratePDF_Partner_Order/" + stored_cookie + "/" + selected_id; + + //console.log(" nom_fichier_cmd = ", nom_fichier_cmd, " --- selected_id = ", selected_id, " --- url =", url); + setLoading(true); + + axios.get(url, { responseType: 'blob', },) + .then((res) => { + setLoading(false); + fileDownload(res.data, nom_fichier_cmd) + }).catch((error) => { + setLoading(false); + console.error('Error:', error); + + }); + } + + + const [Send_Order_By_Email_api, setSend_Order_By_Email_api] = useState(); + const [Send_Order_By_Email_message, setSend_Order_By_Email_message] = useState(); + const [Send_Order_By_Email_result, setSend_Order_By_Email_result] = useState(); + function Send_Order_By_Email() { + var form = new FormData(); + //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("order_id", selected_id); + + if (local_partner_digital_signature_status === true) { + form.append("request_digital_signature", "1"); + } else { + form.append("request_digital_signature", "0"); + } + + for (let i = 0; i < tab_convention_pieces_jointes_result.length; i++) { + form.append('File', tab_convention_pieces_jointes_result[i]); + } + + //console.log("### form = ", form); + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Send_Partner_Order_By_Email/"; + + setLoading(true); + axios.post(myurl, form).then(res => { + //console.log(" In Add_Update_One_Order_Line_Data res.data.status = " + res.data.status); + //console.log(" In Add_Update_One_Order_Line_Data res.data.message r_class = " + res.data.message); + + setLoading(false); + if (String(res.data.status) === String("true")) { + setSend_Order_By_Email_api("true"); + setSend_Order_By_Email_message(res.data.message); + + Get_Order_Data(selected_id); + + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("success"); + + } + else { + setSend_Order_By_Email_api("false"); + setSend_Order_By_Email_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + + setLoading(false); + console.warn('Send_Order_By_Email : Not good man :( Send_Order_By_Email = ' + error); + setSend_Order_By_Email_api("false"); + + if (String(p_add_cmd_header_order_type) === "devis") { + setdisplay_alert_mysy("1"); + setalert_message("Impossible d'envoyer le devis par email"); + setalert_type("error"); + // alert(" Impossible d'envoyer le devis par email"); + } else if (String(p_add_cmd_header_order_type) === "commande") { + // alert(" Impossible d'envoyer la commande par email"); + setdisplay_alert_mysy("1"); + setalert_message("Impossible d'envoyer la commande par email"); + setalert_type("error"); + } + + }) + + + } + + + const [Confirm_Order_Data_api, setConfirm_Order_Data_api] = useState(); + const [Confirm_Order_Data_message, setConfirm_Order_Data_message] = useState(); + const [Confirm_Order_Data_result, setConfirm_Order_Data_result] = useState(); + function Confirm_Order_Data() { + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("order_header_id", selected_id); + + + //console.log("### form = ", form); + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Confirm_Partner_Order_Header_And_Lines/"; + setLoading(true); + + axios.post(myurl, form).then(res => { + //console.log(" In Add_Update_One_Order_Line_Data res.data.status = " + res.data.status); + //console.log(" In Add_Update_One_Order_Line_Data res.data.message r_class = " + res.data.message); + + setLoading(false); + if (String(res.data.status) === String("true")) { + setConfirm_Order_Data_api("true"); + setConfirm_Order_Data_message(res.data.message); + Getall_Training_Employee_No_Filter(); + Display_Detail_Order_data(selected_id); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("success"); + } + else { + setConfirm_Order_Data_api("false"); + setConfirm_Order_Data_message(res.data.message); + + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + + setLoading(false); + console.warn('Confirm_Order_Data : Not good man :( Confirm_Order_Data = ' + error); + setConfirm_Order_Data_api("false"); + + if (String(p_add_cmd_header_order_type) === "devis") { + // alert(" Impossible de confirmer le devis"); + + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message("Impossible de confirmer le devis"); + setalert_type("error"); + + } else if (String(p_add_cmd_header_order_type) === "commande") { + // alert(" Impossible de confirmer la commande"); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message("Impossible de confirmer la commande"); + setalert_type("error"); + } + + }) + + + } + + + + const [Make_Order_Ready_To_Invoice_api, setMake_Order_Ready_To_Invoice_api] = useState(); + const [Make_Order_Ready_To_Invoice_message, setMake_Order_Ready_To_Invoice_message] = useState(); + const [Make_Order_Ready_To_Invoice_result, setMake_Order_Ready_To_Invoice_result] = useState(); + function Make_Order_Ready_To_Invoice() { + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("order_header_id", selected_id); + + + //console.log("### form = ", form); + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Order_Ready_To_Invoice/"; + + setLoading(true); + axios.post(myurl, form).then(res => { + //console.log(" In Add_Update_One_Order_Line_Data res.data.status = " + res.data.status); + //console.log(" In Add_Update_One_Order_Line_Data res.data.message r_class = " + res.data.message); + + setLoading(false); + if (String(res.data.status) === String("true")) { + setMake_Order_Ready_To_Invoice_api("true"); + setMake_Order_Ready_To_Invoice_message(res.data.message); + Getall_Training_Employee_No_Filter(); + Display_Detail_Order_data(selected_id); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("success"); + } + else { + setMake_Order_Ready_To_Invoice_api("false"); + setMake_Order_Ready_To_Invoice_message(res.data.message); + + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + + setLoading(false); + console.warn('Make_Order_Ready_To_Invoice : Not good man :( Make_Order_Ready_To_Invoice = ' + error); + setMake_Order_Ready_To_Invoice_api("false"); + + if (String(p_add_cmd_header_order_type) === "devis") { + alert(" Impossible de confirmer le devis"); + } else if (String(p_add_cmd_header_order_type) === "commande") { + alert(" Impossible de confirmer la commande"); + } + + }) + + + } + + const [Cancel_Order_Data_api, setCancel_Order_Data_api] = useState(); + const [Cancel_Order_Data_message, setCancel_Order_Data_message] = useState(); + const [Cancel_Order_Data_result, setCancel_Order_Data_result] = useState(); + function Cancel_Order_Data() { + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("order_header_id", selected_id); + + + //console.log("### form = ", form); + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Annule_Partner_Order_Header_And_Lines/"; + + setLoading(true); + axios.post(myurl, form).then(res => { + //console.log(" In Add_Update_One_Order_Line_Data res.data.status = " + res.data.status); + //console.log(" In Add_Update_One_Order_Line_Data res.data.message r_class = " + res.data.message); + + setLoading(false); + if (String(res.data.status) === String("true")) { + setCancel_Order_Data_api("true"); + setCancel_Order_Data_message(res.data.message); + Getall_Training_Employee_No_Filter(); + Display_Detail_Order_data(selected_id); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("success"); + } + else { + setCancel_Order_Data_api("false"); + setCancel_Order_Data_message(res.data.message); + + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + + setLoading(false); + console.warn('Cancel_Order_Data : Not good man :( Cancel_Order_Data = ' + error); + setCancel_Order_Data_api("false"); + + if (String(p_add_cmd_header_order_type) === "devis") { + alert(" Impossible d'annuler le devis par email"); + } else if (String(p_add_cmd_header_order_type) === "commande") { + alert(" Impossible d'annler la commande "); + } + + }) + + + } + + const [Convert_Quotation_To_Order_Data_api, setConvert_Quotation_To_Order_Data_api] = useState(); + const [Convert_Quotation_To_Order_Data_message, setConvert_Quotation_To_Order_Data_message] = useState(); + const [Convert_Quotation_To_Order_Data_result, setConvert_Quotation_To_Order_Data_result] = useState(); + function Convert_Quotation_To_Order_Data() { + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("order_id", selected_id); + + + //console.log("### form = ", form); + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Convert_Quotation_to_Order/"; + + setLoading(true); + axios.post(myurl, form).then(res => { + //console.log(" In Add_Update_One_Order_Line_Data res.data.status = " + res.data.status); + //console.log(" In Add_Update_One_Order_Line_Data res.data.message r_class = " + res.data.message); + + setLoading(false); + if (String(res.data.status) === String("true")) { + setConvert_Quotation_To_Order_Data_api("true"); + setConvert_Quotation_To_Order_Data_message(res.data.message); + clean_all_filters(); + Getall_Parter_Orders_No_Filter(); + + Display_Detail_Order_data(selected_id); + if (document.getElementById('myRef_head')) { + var divh = document.getElementById('myRef_head').offsetTop; + window.scrollTo({ + top: divh, + behavior: "smooth", + }); + } + + + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("success"); + } + else { + setConvert_Quotation_To_Order_Data_api("false"); + setConvert_Quotation_To_Order_Data_message(res.data.message); + + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + setLoading(false); + + console.warn('Convert_Quotation_To_Order_Data : Not good man :( Convert_Quotation_To_Order_Data = ' + error); + setConvert_Quotation_To_Order_Data_api("false"); + alert(" Impossible de convertir le devis en commande "); + }) + + + } + + + + const [Valide_Quotation_And_Insert_To_Session_api, setValide_Quotation_And_Insert_To_Session_api] = useState(); + const [Valide_Quotation_And_Insert_To_Session_message, setValide_Quotation_And_Insert_To_Session_message] = useState(); + const [Valide_Quotation_And_Insert_To_Session_result, setValide_Quotation_And_Insert_To_Session_result] = useState(); + function Valide_Quotation_And_Insert_To_Session() { + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("quotation_id", selected_id); + + if (local_partner_digital_signature_status === true) { + form.append("request_digital_signature", "1"); + } else { + form.append("request_digital_signature", "0"); + } + + //console.log("### form = ", form); + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Insert_Quotation_To_Session/"; + + setLoading(true); + axios.post(myurl, form).then(res => { + //console.log(" In Add_Update_One_Order_Line_Data res.data.status = " + res.data.status); + //console.log(" In Add_Update_One_Order_Line_Data res.data.message r_class = " + res.data.message); + + setLoading(false); + if (String(res.data.status) === String("true")) { + setValide_Quotation_And_Insert_To_Session_api("true"); + setValide_Quotation_And_Insert_To_Session_message(res.data.message); + clean_all_filters(); + Getall_Parter_Orders_No_Filter(); + + Display_Detail_Order_data(selected_id); + if (document.getElementById('myRef_head')) { + var divh = document.getElementById('myRef_head').offsetTop; + window.scrollTo({ + top: divh, + behavior: "smooth", + }); + } + + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("success"); + } + else { + setValide_Quotation_And_Insert_To_Session_api("false"); + setValide_Quotation_And_Insert_To_Session_message(res.data.message); + + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + setLoading(false); + + console.warn('Valide_Quotation_And_Insert_To_Session : Not good man :( Valide_Quotation_And_Insert_To_Session = ' + error); + setValide_Quotation_And_Insert_To_Session_api("false"); + alert(" Impossible de valider le devis et d'inserer les lignes dans la session "); + }) + + + } + + + + + function Check_Electronic_Sign_Before_Sending_Email() { + if (partner_digital_signature_status && String(partner_digital_signature_status) === "1") { + setDialog_signature_digitale_open(true); + } else { + + Send_Order_By_Email(); + } + } + + const [Invoice_Order_Data_api, setInvoice_Order_Data_api] = useState(); + const [Invoice_Order_Data_message, setInvoice_Order_Data_message] = useState(); + const [Invoice_Order_Data_result, setInvoice_Order_Data_result] = useState(); + function Invoice_Order_Data() { + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("order_id", selected_id); + form.append("order_ref_interne", order_internal_ref); + + + //console.log("### form = ", form); + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Invoice_Partner_Order/"; + + setLoading(true); + axios.post(myurl, form).then(res => { + //console.log(" In Add_Update_One_Order_Line_Data res.data.status = " + res.data.status); + //console.log(" In Add_Update_One_Order_Line_Data res.data.message r_class = " + res.data.message); + + setLoading(false); + if (String(res.data.status) === String("true")) { + setInvoice_Order_Data_api("true"); + setInvoice_Order_Data_message(res.data.message); + clean_all_filters(); + Getall_Parter_Orders_No_Filter(); + + Display_Detail_Order_data(selected_id); + if (document.getElementById('myRef_head')) { + var divh = document.getElementById('myRef_head').offsetTop; + window.scrollTo({ + top: divh, + behavior: "smooth", + }); + } + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("success"); + } + else { + setInvoice_Order_Data_api("false"); + setInvoice_Order_Data_message(res.data.message); + + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + setLoading(false); + + console.warn('Invoice_Order_Data : Not good man :( Invoice_Order_Data = ' + error); + setInvoice_Order_Data_api("false"); + alert(" Impossible de facturer la commande "); + }) + + + } + + const [Get_Class_Data_api, setGet_Class_Data_api] = useState(); + const [Get_Class_Data_message, setGet_Class_Data_message] = useState(); + const [Get_Class_Data_result, setGet_Class_Data_result] = useState(); + function Get_Class_Data(local_internal_url) { + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("internal_url", local_internal_url); + + + //console.log("### form = ", form); + var myurl = process.env.REACT_APP_API_URL + "myclass/api/get_Class_From_Internal_Url/"; + + setLoading(true); + axios.post(myurl, form).then(res => { + //console.log(" In Add_Update_One_Order_Line_Data res.data.status = " + res.data.status); + //console.log(" In Add_Update_One_Order_Line_Data res.data.message r_class = " + res.data.message); + + setLoading(false); + if (String(res.data.status) === String("true")) { + setGet_Class_Data_api("true"); + setGet_Class_Data_message(res.data.message); + + if (JSON.parse(res.data.message).price) { + setp_add_line_item_price(String(JSON.parse(res.data.message).price)); + document.getElementsByName("ref_article_unit_price")[0].value = String(JSON.parse(res.data.message).price); + } + + + } + else { + setGet_Class_Data_api("false"); + setGet_Class_Data_message(res.data.message); + + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("success"); + } + + }).catch((error) => { + setLoading(false); + + console.warn('Get_Class_Data : Not good man :( Get_Class_Data = ' + error); + setGet_Class_Data_api("false"); + alert(" Impossible de récuperer les données de la formation "); + }) + + + } + + const [isLoading, setLoading] = useState(); + const [gridline_id, setgridline_id] = useState(""); + + + const [New_Getall_Partner_Paiement_Condition_result, setNew_Getall_Partner_Paiement_Condition_result] = useState([]); + + const [Getall_Partner_Paiement_Condition_api, setGetall_Partner_Paiement_Condition_api] = useState(); + const [Getall_Partner_Paiement_Condition_message, setGetall_Partner_Paiement_Condition_message] = useState(); + const [Getall_Partner_Paiement_Condition_result, setGetall_Partner_Paiement_Condition_result] = useState([]); + function Getall_Partner_Paiement_Condition(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_List_Paiement_Condition/"; + + setLoading(true); + axios.post(myurl, form).then(res => { + setLoading(false); + + if (String(res.data.status) === String("true")) { + //console.log(" In Getall_Partner_Paiement_Condition res.data.status = " + res.data.status); + //console.log(" In Getall_Partner_Paiement_Condition res.data.message r_class = " + res.data.message); + setGetall_Partner_Paiement_Condition_api("true"); + setGetall_Partner_Paiement_Condition_result(res.data.message); + + var new_data2 = []; + const new_data = res.data.message.map((x) => { + + //--- + var localid = JSON.parse(x).id; + var local_id = JSON.parse(x)._id; + var local_code = JSON.parse(x).code; + var local_description = JSON.parse(x).description; + var local_nb_jour = JSON.parse(x).nb_jour; + var local_depart = JSON.parse(x).depart; + + + //--- + var node = { + "_id": local_id, + "id": localid, + "label": local_code, + "code": local_code, + "description": local_description, + "nb_jour": local_nb_jour, + "depart": local_depart, + + }; + new_data2.push(node); + }); + + //--- + var node = { + "_id": "", + "id": "", + "label": "", + "code": "", + "description": "", + "nb_jour": "", + "depart": "", + + }; + new_data2.push(node); + + + //console.log(" ### new_data2 condition paiement = ", new_data2); + + if (new_data2.length > 0) + setNew_Getall_Partner_Paiement_Condition_result(new_data2); + + + } + else { + setGetall_Partner_Paiement_Condition_api("false"); + setGetall_Partner_Paiement_Condition_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + setLoading(false); + console.warn('Not good man :( Getall_Partner_Paiement_Condition = ', error); + setGetall_Partner_Paiement_Condition_api("false"); + alert(" Impossible de recuperer la liste des conditions de paiement"); + //setmyApimyApiMessage("") + }) + } + + + const New_Status_Filter = [ + { "id": "0", "label": "Brouillon ", "value": "0" }, + { "id": "1", "label": "En cours ", "value": "1" }, + { "id": "2", "label": "Traité", "value": "2" }, + { "id": "-1", "label": "Annulé", "value": "-1" }, + { "id": "", "label": "", "value": "" }, + { "id": "1", "label": "", "value": "1" }, // Cette ligne pour couvrir l'ajout d'une ligne de filter. C'est fait expres. + ] + + + const New_Quotation_Status_Filter = [ + { "id": "0", "label": "Brouillon ", "value": "0" }, + { "id": "1", "label": "En cours ", "value": "1" }, + { "id": "2", "label": "Fermé", "value": "2" }, + + { "id": "3", "label": "Gagné", "value": "3" }, + { "id": "4", "label": "Perdu", "value": "4" }, + + { "id": "-1", "label": "Annulé", "value": "-1" }, + { "id": "", "label": "", "value": "" }, + { "id": "1", "label": "", "value": "1" }, // Cette ligne pour couvrir l'ajout d'une ligne de filter. C'est fait expres. + ] + + + const New_Emplacement_Filter = [ + { "id": "inter", "label": "Inter ", "value": "inter" }, + { "id": "intra", "label": "Intra ", "value": "intra" }, + { "id": "", "label": "", "value": "" }, + { "id": "1", "label": "", "value": "1" }, // Cette ligne pour couvrir l'ajout d'une ligne de filter. C'est fait expres. + ] + + + + const [Dialog_signature_digitale_message, setDialog_signature_digitale_message] = React.useState(false); + const [Dialog_signature_digitale_open, setDialog_signature_digitale_open] = React.useState(false); + function Dialog_signature_digitale_handle_change_participant_session(message) { + setDialog_signature_digitale_message(message); + setDialog_signature_digitale_open(true); + } + + const Dialog_signature_digitale_handleClose = () => { + //alert(" Utiliser le bouton 'fermer' "); + //setOpen(false); + }; + + const Dialog_signature_digitale_handleClose_buton = () => { + setDialog_signature_digitale_open(false); + settab_convention_pieces_jointes_result([]); + }; + + + const New_Option_Frequence_Relance = [ + { "id": "semaine", "label": "Semaine", "value": "semaine" }, + { "id": "mois", "label": "Mois", "value": "mois" }, + { "id": "", "label": "", "value": "" }, + ] + + const New_Option_Oui_Non = [ + { "id": "1", "label": "Oui", "value": "1" }, + { "id": "0", "label": "Non", "value": "0" }, + { "id": "", "label": "", "value": "" }, + ] + + const [p_detail_header_devis_relance_auto, setp_detail_header_devis_relance_auto] = useState(""); + const [p_detail_header_devis_nb_relance, setp_detail_header_devis_nb_relance] = useState(""); + const [p_detail_header_devis_frequence_relance, setp_detail_header_devis_frequence_relance] = useState(""); + + + const [selected, setSelected] = React.useState([]); + const [expanded, setExpanded] = React.useState([]); + const handleToggle = (event, nodeIds) => { + setExpanded(nodeIds); + }; + + const handleExpandClick = () => { + + setExpanded((oldExpanded) => + oldExpanded.length === 0 ? ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'] : [], + ); + }; + + const handleSelect = (event, nodeIds) => { + setSelected(nodeIds); + }; + + + const New_Option_Filter = [ + { "id": "ref_interne", "label": "Ref. Interne", "value": "ref_interne" }, + { "id": "ref_externe", "label": "Ref. Externe (chez le client)", "value": "ref_externe" }, + { "id": "client_nom", "label": "Nom Client", "value": "client_nom" }, + { "id": "formation", "label": "Lié à la Formation (code externe)", "value": "formation" }, + { "id": "code_session", "label": "Lié à la session (code session)", "value": "code_session" }, + { "id": "", "label": "", "value": "" }, + { "id": "1", "label": "", "value": "1" }, // Cette ligne pour couvrir l'ajout d'une ligne de filter. C'est fait expres. + ] + + const New_Option_Cloture_Devis = [ + { "id": "4", "label": "Perte", "value": "4" }, + { "id": "2", "label": "Cloture", "value": "2" }, + { "id": "", "label": "", "value": "" }, + ] + const [Dialog_Cloture_Devis_open, setDialog_Cloture_Devis_open] = React.useState(false); + + const Close_Dialog_Cloture_Devis_open = () => { + setp_new_raison_cloture(""); + setp_new_comment_raison_cloture(""); + setDialog_Cloture_Devis_open(false); + }; + + const [p_new_raison_cloture, setp_new_raison_cloture] = React.useState(""); + const [p_new_comment_raison_cloture, setp_new_comment_raison_cloture] = React.useState(""); + + + const [Closure_Given_Quotation_api, setClosure_Given_Quotation_api] = useState(); + const [Closure_Given_Quotation_message, setClosure_Given_Quotation_message] = useState(); + const [Closure_Given_Quotation_result, setClosure_Given_Quotation_result] = useState(); + function Closure_Given_Quotation() { + var form = new FormData(); + //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("order_header_id", selected_id); + form.append("order_header_status", p_new_raison_cloture); + form.append("closure_reason", setp_new_comment_raison_cloture); + + + //console.log(" form == ", form); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Closure_Partner_Quotation_Header/"; + + + setLoading(true); + axios.post(myurl, form).then(res => { + //console.log(" In Closure_Given_Quotation res.data.status = " + res.data.status); + //console.log(" In Closure_Given_Quotation res.data.message r_class = " + res.data.message); + + setLoading(false); + if (String(res.data.status) === String("true")) { + setClosure_Given_Quotation_api("true"); + setClosure_Given_Quotation_result(res.data.message); + + Getall_Parter_Orders_No_Filter(); + + setOrder_data_changed(""); + setorder_data_edit_mode(""); + Display_Detail_Order_data(selected_id); + Close_Dialog_Cloture_Devis_open(); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("success"); + + if (document.getElementById('myRef_head')) { + var divh = document.getElementById('myRef_head').offsetTop; + window.scrollTo({ + top: divh, + behavior: "smooth", + }); + } + disable_Order_Header_DetailFields(); + + } + else { + setClosure_Given_Quotation_api("false"); + setClosure_Given_Quotation_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + + setLoading(false); + console.warn('UpdateStagiaireData : Not good man :( Closure_Given_Quotation = ' + error); + setClosure_Given_Quotation_api("false"); + alert(" Impossible de faire la mise à jour"); + + }) + } + + const New_Option_formation_produit = [ + { "id": "formation", "label": "Formation", "value": "formation" }, + { "id": "produit", "label": "Produit & Service", "value": "produit" }, + { "id": "", "label": "", "value": "" }, + ] + + + 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(""); + setnew_session_with_resa(false); + + 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 [new_session_with_resa, setnew_session_with_resa] = useState(false); + + 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"); + + 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); + + 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/"; + + + 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); + Getall_TrainingSession(); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("success"); + + /*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); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).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"); + + }) + } + + 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, + }, + + }; + + + function Delete_Convention_Attached_Doc(event) { + + var doc_to_del_name = event.target.id; + const myArray = tab_convention_pieces_jointes_result; + + + + let new_myArray = myArray.filter(file => file.name !== String(doc_to_del_name)); + + var new_tab = [] + for (let i = 0; i < new_myArray.length; i++) { + new_tab.push(new_myArray[i]); + } + + settab_convention_pieces_jointes_result(new_tab); + + + } + + const [sessions_file_change_1_convention_api, setsessions_file_change_1_convention_api] = useState(); + const [sessions_file_change_1_convention_result, setsessions_file_change_1_convention_result] = useState(); + const [sessions_file_change_1_convention_message, setsessions_file_change_1_convention_message] = useState(); + const sessions_file_change_1_convention = event => { + + const fileUploaded = event.target.files[0]; + let file_size = event.target.files[0].size; + let file_type = event.target.files[0].type; + + + if (file_type !== "application/pdf") { + // alert("Le fichier n'est pas de type PDF"); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message("Le fichier n'est pas de type PDF"); + setalert_type("error"); + return; + } + + + + if (file_size > 10000000) { + // alert("Le fichier ne doit pas depasser un 1 Méga octets"); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message("Le fichier ne doit pas depasser un 1 Méga octets"); + setalert_type("error"); + // console.log("Le fichier ne doit pas depasser un 1 Méga octets"); + return; + } + + //var new_node = {'name':event.target.files[0].name, 'type':event.target.files[0].type} + + + var new_tmp = []; + + if (tab_convention_pieces_jointes_result && tab_convention_pieces_jointes_result.length > 0) { + + tab_convention_pieces_jointes_result.map((x) => { + new_tmp.push(x); + + }); + + } + + new_tmp.push(event.target.files[0]) + + settab_convention_pieces_jointes_result(new_tmp); + + //console.log(" tab_convention_pieces_jointes_result = ", tab_convention_pieces_jointes_result) + + + return; + + + }; + + const [tab_convention_pieces_jointes_result, settab_convention_pieces_jointes_result] = useState([]); + + const New_type_apprenant = [ + { "id": "0", "label": "Autre", "value": "0" }, + { "id": "1", "label": "Salariés", "value": "1" }, + { "id": "2", "label": "Apprentis", "value": "2" }, + { "id": "3", "label": "Particuliers", "value": "3" }, + { "id": "4", "label": "Rech. Emploi", "value": "4" }, + { "id": "", "label": "", "value": "" }, + + ] + + const inclus_bpf_tab = [ + { + value: '1', + label: 'Oui', + }, + { + value: '0', + label: 'Non', + }, + { + value: '', + label: '', + }, + + ]; + + + // DEBUT EXPORT EXCEL DATAGRID + + function CustomToolbar(props) { + + + return ( + + + + + + + + + + + ); + } + + function getExcelData(apiRef) { + // Select rows and columns + const filteredSortedRowIds = gridFilteredSortedRowIdsSelector(apiRef); + const visibleColumnsField = gridVisibleColumnFieldsSelector(apiRef).filter((data) => (data) !== "__check__"); + + // Format the data. Here we only keep the value + const data = filteredSortedRowIds.map((id) => { + const row = {}; + visibleColumnsField.forEach((field) => { + row[field] = apiRef.current.getCellParams(id, field).value; + }); + return row; + }); + + return data; + } + + + function ExportButton(props) { + return ( + + + + ); + } + + function handleExport(apiRef, data_colums) { + const data = getExcelData(apiRef); + const visibleColumnsField = gridVisibleColumnFieldsSelector(apiRef).filter((data) => (data) !== "__check__"); + + + const local_config = { + keys: visibleColumnsField, + + columnNames: data_colums.filter((mydata) => (mydata).disableExport !== true).map(function (mydata) { + if (mydata.headerName && visibleColumnsField.includes(mydata.field)) { + if (mydata.headerName) { + return mydata.headerName; + } + } + + }), + + fileName: 'data_' + String(new Date().toJSON().slice(0, 10)).replaceAll("-", "_") + '.xlsx', + sheetName: 'Export_' + String(new Date().toJSON().slice(0, 10)).replaceAll("-", "_"), + }; + + local_config.columnNames = local_config.columnNames.filter(function (element) { + return element !== undefined; + }); + + + const rows = data.map((row) => { + const mRow = {}; + for (const key of local_config.keys) { + mRow[key] = row[key]; + } + return mRow; + }); + + const worksheet = XLSX.utils.json_to_sheet(rows); + XLSX.utils.sheet_add_aoa(worksheet, [[...local_config.columnNames]], { + origin: 'A1', + }); + + const workbook = XLSX.utils.book_new(); + XLSX.utils.book_append_sheet(workbook, worksheet, local_config.sheetName); + XLSX.writeFile(workbook, local_config.fileName, { compression: true }); + } + function ExportMenuItem(props) { + const apiRef = useGridApiContext(); + const { hideMenu } = props; + + return ( + { + handleExport(apiRef, props.data_colums); + // Hide the export menu after the export + hideMenu?.(); + }} + > + Export Excel + + ); + } + + // FIN EXPORT EXCEL DATAGRID + + const [Dialog_order_history_message, setDialog_order_history_message] = React.useState(false); + const [Dialog_order_history_open, setDialog_order_history_open] = React.useState(false); + function Dialog_order_history_handle_change_participant_session(message) { + setDialog_order_history_message(message); + setDialog_order_history_open(true); + } + + const Dialog_order_history_handleClose = () => { + //alert(" Utiliser le bouton 'fermer' "); + //setOpen(false); + }; + + const Dialog_order_history_handleClose_buton = () => { + setDialog_order_history_open(false); + + if (document.getElementsByName("order_history_bton") && document.getElementsByName("order_history_bton")[0]) { + document.getElementsByName("order_history_bton")[0].style.backgroundColor = "#d8edfc"; + document.getElementsByName("order_history_bton")[0].style.color = "#3b3e40"; + } + }; + + const [display_alert_mysy, setdisplay_alert_mysy] = useState(""); + const [alert_message, setalert_message] = useState(""); + const [alert_type, setalert_type] = useState(""); + + function clear_alert_message() { + setalert_message(""); + } + function clear_alert_type() { + setalert_type(""); + } + function clear_display_alert_mysy() { + setdisplay_alert_mysy(""); + } + + return ( + +
+ {isLoading &&
+
+
} + + {/*** Affichage des messages d'alerte*/} + {display_alert_mysy && String(display_alert_mysy) === "1" && + + } + {/*** FIN Affichage des messages d'alerte*/} + + + + {/* Dialog affichage historique commande/devis */} + null} + + PaperProps={{ + + + className: classes.paper, // Apply the paper style + style: { + overflowY: 'unset', + position: 'absolute', + // top: '5rem', + margin: "2px", + }, + }} + hideBackdrop={true} + disableScrollLock + classes={{ + paper: classes.dialog + }} + + PaperComponent={PaperComponent} + aria-labelledby="draggable-dialog-title" > + + MySy Information + + +
+
+ +
+ + +
+ + +
+
+ + +
+ + + + + + + + + + +
+
+   +
+ + +
+ +
+
+ +
+ +
+ {/* FIN Dialog affichage historique commande/devis */} + + + {/****** Dialog pour créer une session depuis un devis */} + + 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" + + > + + Création Session + + + +
+ + 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(); + + /* 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"); + + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(" La date est après la fin de la session"); + setalert_type("error"); + + return; + } + + + setnew_session_date_debut(date); + } + } + showTimeSelect={false} + filterTime={filterPassedTime_start} + dateFormat="dd/MM/yyyy" + className="disabled_style " + + locale={'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(); + + + + + if (local_date < date_start_session) { + // alert(" La date est avant le début de la session"); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message("La date est avant le début de la session"); + setalert_type("error"); + return; + } + + + setnew_session_date_fin(date); + } + } + showTimeSelect={false} + filterTime={filterPassedTime_start} + dateFormat="dd/MM/yyyy" + className="disabled_style" + fullWidth + locale={'fr'} + + /> + + +
+ +
Code Session + { + setnew_session_code(e.target.value); + } + } + + /> + +
+ +
Nb Places + { + setnew_session_nb_place(e.target.value); + } + } + + /> + +
+ +
Avec résa. inscriptions + { + setnew_session_with_resa(e.target.checked); + + }} + + /> + +
+ + + +
+ + + + +
+
+ +
+
+ +
+ + + + + +
+ + +
+
+ + + {/****** 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) */} + + null} + + PaperProps={{ + + + className: classes.paper, // Apply the paper style + style: { + overflowY: 'unset', + position: 'absolute', + //top: '5rem', + margin: "2px", + }, + }} + hideBackdrop={true} + disableScrollLock + classes={{ + paper: classes.dialog + }} + + PaperComponent={PaperComponent} + aria-labelledby="draggable-dialog-title" + > + + Cloture devis {String(p_detail_header_ref_interne)} + + + +
Raison Cloture + { + + if (value && value.value) { + setp_new_raison_cloture(value.value); + + } else { + setp_new_raison_cloture(""); + + } + }} + + + renderInput={(params) => + } + /> +
+ + + + + {p_new_raison_cloture && String(p_new_raison_cloture) !== "" && +
Commentaire + { + setp_new_comment_raison_cloture(e.target.value); + } + } + + //label="Commentaire" + //variant="standard" + multiline + minRows={2} + maxRows={2} + rows={2} + + + /> + +
} + + +
+ + + + + + + + +
+ {p_new_raison_cloture && String(p_new_raison_cloture) !== "" &&
+ +
} +
+ +
+ +
+ + +
+
+ + + {/****** Dialog pour cloturer un devis (gerer la perte d'un devis avec motif, ou simple cloture) */} + + + + {/* Dialog pour gerer la signature digitale et ajouter une pièce jointe*/} + null} + + PaperProps={{ + + + className: classes.paper, // Apply the paper style + style: { + overflowY: 'unset', + position: 'absolute', + // top: '5rem', + margin: "2px", + }, + }} + hideBackdrop={true} + disableScrollLock + classes={{ + paper: classes.dialog + }} + + PaperComponent={PaperComponent} + aria-labelledby="draggable-dialog-title" + > + + MySy Information + + + Envoi devis par email + + + + {String(partner_digital_signature_status) === "1" && } + +
+ +
+
+
+
+ +
+ Pièces jointes + +
+ +
+ + {String(props.check_user_acces_right("commande", "write")) === "1" &&
+ +
} + + +
+ + + {tab_convention_pieces_jointes_result &&
+ +
+ Liste des pièces jointes
+ {
+ {tab_convention_pieces_jointes_result && tab_convention_pieces_jointes_result.map((val) => ( +
+
+ + +
+ ))} +
} +
+
} + + + +
+
+ + +
+ + + + + + + +
+
+ + + +
+ + + +
+ +
+
+ +
+ +
+ {/* FIN Dialog pour gerer la signature digitale */} + + + + null} + + PaperProps={{ + + + className: classes.paper, // Apply the paper style + style: { + overflowY: 'unset', + position: 'absolute', + //top: '5rem', + margin: "2px", + }, + }} + hideBackdrop={true} + disableScrollLock + classes={{ + paper: classes.dialog + }} + + PaperComponent={PaperComponent} + aria-labelledby="draggable-dialog-title" + + > + + MySy Information + + + {Dialog_1_message} + + + + + + + + + + + + {/****** Dialog pour la gestion d'un article (formation) */} + null} + + PaperProps={{ + + + className: classes.paper, // Apply the paper style + style: { + overflowY: 'unset', + position: 'absolute', + // top: '5rem', + margin: "2px", + }, + }} + hideBackdrop={true} + disableScrollLock + classes={{ + paper: classes.dialog + }} + + PaperComponent={PaperComponent} + aria-labelledby="draggable-dialog-title" > + + Edition Détail ligne {String(p_detail_header_type).toLocaleUpperCase()} + + + {/*p_add_line_item = {p_add_line_item}
*/} + + + + {(!selected_order_line_id || String(selected_order_line_id).length < 3) && +
Type Article + + (data).id === String(article_formation_ou_produit))[0].label} + fullWidth + onChange={(event, value) => { + if (value && value.id) { + setarticle_formation_ou_produit(value.id); + setp_add_line_item(""); + setp_add_line_item_qty(""); + setp_add_line_item_price(""); + setp_add_line_session_id(""); + setp_add_line_session_code(""); + + } + }} + + renderInput={(params) => + + } + /> +
+ } + + {/*** Si c'est pour une formation */} + {article_formation_ou_produit && String(article_formation_ou_produit) === "formation" && +
+ {New_GetCurrentPartnerClass_result && New_GetCurrentPartnerClass_result.length > 0 && + (p_add_line_item || String(p_add_line_item) === "") && String(p_detail_header_statut_label).toLowerCase() !== "facturé" && +
Formation + (data).internal_url === String(p_add_line_item))[0].label} + + onChange={(event, value) => { + // setp_champ_table(value.nom_champ_technique); + if (value && value.internal_url) { + setp_add_line_item(value.internal_url); + setp_add_line_item_internal_url(value.internal_url); + Get_Class_Data(value.internal_url); + setp_add_line_item_title(value.title); + } else { + setp_add_line_item(""); + setp_add_line_item_internal_url(""); + setp_add_line_item_title(""); + + } + }} + + + renderInput={(params) => + } + /> + + + +
} + + {(p_add_line_item || String(p_add_line_item) === "") && String(p_detail_header_statut_label).toLowerCase() !== "facturé" + && New_Getall_TrainingSession_result && New_Getall_TrainingSession_result.length > 0 &&
Session + + + (data).class_internal_url === String(p_add_line_item)) + } + + value={New_Getall_TrainingSession_result.filter((data) => (data)._id === String(p_add_line_session_id))[0].label} + + onChange={(event, value) => { + + 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(""); + } + }} + + + renderInput={(params) => + } + /> + + + +
} + + + {String(p_detail_header_statut_label).toLowerCase() === "facturé" &&
Article + + + + +
} + + {String(p_detail_header_statut_label).toLowerCase() === "facturé" &&
Quantité + + + +
} + + {String(p_detail_header_statut_label).toLowerCase() !== "facturé" &&
Quantité + + { + setp_add_line_item_qty(e.target.value); + Recalcul_Item_Amounts(); + } + } + type="number" + + /> + +
} + + + {String(p_detail_header_statut_label).toLowerCase() !== "facturé" &&
Prix Unitaire + { + setp_add_line_item_price(e.target.value); + Recalcul_Item_Amounts(); + } + } + + type="number" + + /> +
} + + {String(p_detail_header_statut_label).toLowerCase() === "facturé" &&
Prix Unitaire + +
} + +
Taux TVA + { + setpartner_taux_tva(e.target.value); + Recalcul_Item_Amounts(); + + } + } + + type="number" + /> +
+ + {String(p_detail_header_statut_label).toLowerCase() !== "facturé" &&
Type apprenant + val.value === String(p_add_line_item_type_apprenant))[0].label} + onChange={(event, value) => { + if (value && value.id) { + setp_add_line_item_type_apprenant(value.id); + } else { + setp_add_line_item_type_apprenant(""); + } + }} + + renderInput={(params) => + } + /> +
} + + {String(p_detail_header_statut_label).toLowerCase() === "facturé" &&
Type apprenant + val.value === String(p_add_line_item_type_apprenant))[0].label} + disabled + type="text" + /> +
} + +
} + + + {/*** Si c'est pour un produit ou service */} + {article_formation_ou_produit && String(article_formation_ou_produit) === "produit" && +
+ {New_Getall_Partner_Product_Service_result && New_Getall_Partner_Product_Service_result.length > 0 && + (p_add_line_item || String(p_add_line_item) === "") && String(p_detail_header_statut_label).toLowerCase() !== "facturé" && +
Produit & Service + (data)._id === String(p_add_line_item))[0].label} + + onChange={(event, value) => { + // setp_champ_table(value.nom_champ_technique); + if (value && value._id) { + setp_add_line_item(value._id); + setp_add_line_item_internal_url(value._id); + setp_add_line_item_price(value.prix_vente); + setpartner_taux_tva(value.code_taxe); + //Get_Class_Data(value.internal_url); + setp_add_line_item_title(value.code); + } else { + setp_add_line_item(""); + setp_add_line_item_internal_url(""); + setp_add_line_item_title(""); + + } + }} + + + renderInput={(params) => + } + /> +
} + + + + + {String(p_detail_header_statut_label).toLowerCase() === "facturé" &&
Article + + + + +
} + + {String(p_detail_header_statut_label).toLowerCase() === "facturé" &&
Quantité + + + +
} + + {String(p_detail_header_statut_label).toLowerCase() !== "facturé" &&
Quantité + + { + setp_add_line_item_qty(e.target.value); + Recalcul_Item_Amounts(); + } + } + type="number" + + /> + +
} + + + {String(p_detail_header_statut_label).toLowerCase() !== "facturé" &&
Prix Unitaire + { + setp_add_line_item_price(e.target.value); + Recalcul_Item_Amounts(); + } + } + + type="number" + + /> +
} + + {String(p_detail_header_statut_label).toLowerCase() === "facturé" &&
Prix Unitaire + +
} + +
Taux TVA + { + setpartner_taux_tva(e.target.value); + Recalcul_Item_Amounts(); + } + } + + type="number" + /> +
+ + +
} + + + {String(p_detail_header_statut_label).toLowerCase() !== "facturé" &&
Type reduction + { + setp_add_line_item_type_reduction(e.target.value); + //console.log(" ## e.target.value = ", e.target.value); + setp_add_line_item_reduction_value("0"); + setp_add_line_item_reduction_total_amount('0'); + setp_add_line_item_reduction_value('0'); + setp_add_line_item_total_amount_ht('0'); + + } + } + + > + Montant   + Pourcentage   + + +
} + + {String(p_detail_header_statut_label).toLowerCase() === "facturé" &&
Type reduction + + +
} + + {String(p_detail_header_statut_label).toLowerCase() !== "facturé" &&
Reduction + { + + setp_add_line_item_reduction_value(e.target.value); + Recalcul_Item_Amounts(); + } + } + + type="number" + /> + +
} + + {String(p_detail_header_statut_label).toLowerCase() === "facturé" &&
Reduction + + +
} + +
Total Reduction + + +
+ + + + {String(p_detail_header_statut_label).toLowerCase() !== "facturé" &&
Commentaire + { + setp_add_line_item_comment(e.target.value); + } + } + //label="Commentaire" + //variant="standard" + multiline + minRows={2} + maxRows={2} + rows={2} + + + /> + +
} + + {String(p_detail_header_statut_label).toLowerCase() === "facturé" &&
Commentaire + + +
} + +
Total HT + + +
+ + + +
+ + + + + + + + + {String(p_detail_header_statut_label).toLowerCase() !== "facturé" &&
+
+ +
+
+ +
+ +
} + {String(p_detail_header_statut_label).toLowerCase() === "facturé" &&
+
+   +
+
+ +
+ +
} + +
+
+ + {/****** FIN Dialog pour la gestion d'un article (formation) */} + + + + {/********** Dialog pour une entete de commande/devis */} + null} + + PaperProps={{ + + + className: classes.paper, // Apply the paper style + style: { + overflowY: 'unset', + position: 'absolute', + // top: '5rem', + margin: "2px", + }, + }} + hideBackdrop={true} + disableScrollLock + classes={{ + paper: classes.dialog + }} + + PaperComponent={PaperComponent} + aria-labelledby="draggable-dialog-title" + > + + {Dialog_1_message} + + +
Client + { + if (value && value._id) { + + setp_add_cmd_header_client_id(value._id); + Get_Givent_Partner_Client_Data(value._id); + setclient_selected_paiement_ction_id(value.invoice_condition_paiement_id); + setp_add_cmd_header_condition_paiement_id(value.invoice_condition_paiement_id); + + } + + }} + + renderInput={(params) => + } + /> + +
+ + +
+ +
Date cmd + + { + setp_add_cmd_header_date_cmd(format(date, 'dd/MM/yyyy')); + + } + } + showTimeSelect={false} + //filterTime={filterPassedTime_start} + dateFormat="dd/MM/yyyy" + className="disabled_style enable_style" + style={{ "width": "100%" }} + locale={'fr'} + fullWidth + /> +
+ +
Date expiration
+ + { + setp_add_cmd_header_date_expiration_cmd(format(date, 'dd/MM/yyyy')); + + } + } + showTimeSelect={false} + //filterTime={filterPassedTime_start} + dateFormat="dd/MM/yyyy" + className="disabled_style enable_style" + + locale={'fr'} + fullWidth + /> +
+
+ +
Description
+ { + setp_add_cmd_header_description(e.target.value); + + } + } + /> +
+ +
Ref. externe
+ { + setp_add_cmd_header_ref_client(e.target.value); + + } + } + /> +
+ +
Vendeur
+ + { + if (value && value._id) { + setp_add_cmd_header_vendeur_id(value._id); + setp_add_cmd_header_vendeur_id_label(value.label); + + + } else { + setp_add_cmd_header_vendeur_id(""); + setp_add_cmd_header_vendeur_id_label(""); + } + }} + + renderInput={(params) => + } + /> + + {/* { + setp_add_cmd_header_vendeur_id(e.target.value); + + } + } + > + {Getall_Training_Employee_No_Filter_result && + Getall_Training_Employee_No_Filter_result.map((myclient) => ( + + {JSON.parse(myclient).nom}  {JSON.parse(myclient).prenom} + + + ))} + */} +
+ +
Conditions Paiement
+ + {New_Getall_Partner_Paiement_Condition_result && New_Getall_Partner_Paiement_Condition_result.length > 0 && + (data)._id === String(client_selected_paiement_ction_id))[0].label} + options={New_Getall_Partner_Paiement_Condition_result} + onChange={(event, value) => { + + if (value && value._id) { + setp_add_cmd_header_condition_paiement_id(value._id); + setclient_selected_paiement_ction_id(value._id); + + } + + }} + + renderInput={(params) => + } + />} + +
+ +
Type
+ + + + +
+
Emplacement
+ + {New_Emplacement_Filter && New_Emplacement_Filter.length > 0 && (data).value === String(p_add_cmd_header_order_location_type))[0].label} + options={New_Emplacement_Filter} + onChange={(event, value) => { + if (value && value.value) { + + setp_add_cmd_header_order_location_type(value.value); + } else { + setp_add_cmd_header_order_location_type(""); + } + + }} + + renderInput={(params) => + } + />} + + +
+ +
Inclus BPF
+ {inclus_bpf_tab && inclus_bpf_tab.length > 0 && p_add_cmd_header_order_inclus_bpf && (data).value === String(p_add_cmd_header_order_inclus_bpf))[0].label} + options={inclus_bpf_tab} + onChange={(event, value) => { + if (value && value.value) { + setp_add_cmd_header_order_inclus_bpf(value.value); + } else { + setp_add_cmd_header_order_inclus_bpf(""); + } + + }} + + renderInput={(params) => + } + />} + + + +
+ +
Lieu de formation
+ { + setp_add_cmd_header_lieu_formation(e.target.value); + } + } + + + /> +
+ + +
Commentaire
+ { + setp_add_cmd_header_comment(e.target.value); + + } + } + + + /> +
+
 
+ +
+ + + + + + + + +
+
+ +
+
+ +
+ +
+ +
+
+ + + +

Mes Commandes et Devis

+
+
Utilisez les filtres !
+
+
+ {New_Option_Filter && New_Option_Filter.length > 0 && (data).value === String(p_filtre1))[0].label} + options={New_Option_Filter} + onChange={(event, value) => { + if (value && value.value) { + setp_filtre1(value.value); + } else { + setp_filtre1(""); + } + + }} + + renderInput={(params) => + } + />} +
+ + + +
+ {p_filtre1 && + { setp_filtre1_value(e.target.value); }} + InputProps={{ + endAdornment: ( + + { + setp_filtre1_value(""); + }} /> + + ), + }} + + /> + + } +
+ {p_filtre1 && } + {p_filtre1 && } + + +
+ + {p_filtre2 && +
+
+ {New_Option_Filter && New_Option_Filter.length > 0 && (data).value === String(p_filtre2))[0].label} + options={New_Option_Filter} + onChange={(event, value) => { + if (value && value.value) { + setp_filtre2(value.value); + + } + + }} + + renderInput={(params) => + } + />} +
+
+ {String(p_filtre2).length > 2 && + setp_filtre2_value(e.target.value)} + InputProps={{ + endAdornment: ( + + { + setp_filtre2_value(""); + }} /> + + ), + }} + + />} +
+ + {String(p_filtre2).length > 2 && } + + {String(p_filtre2).length > 2 && } + +
+ } + + + {p_filtre3 && +
+
+ {New_Option_Filter && New_Option_Filter.length > 0 && (data).value === String(p_filtre3))[0].label} + options={New_Option_Filter} + onChange={(event, value) => { + if (value && value.value) { + setp_filtre3(value.value); + + } + + }} + + renderInput={(params) => + } + />} +
+
+ {String(p_filtre3).length > 2 && + setp_filtre3_value(e.target.value)} + InputProps={{ + endAdornment: ( + + { + setp_filtre3_value(""); + }} /> + + ), + }} + + />} +
+ + {String(p_filtre2).length > 2 && } + + {String(p_filtre3).length > 2 && } +
+ } + + +
+ +
+ +
+ +
+ + +
+ +
+ +
+
+ +
+
+ {rowss_total_data && rowss_total_data.length > 0 && rowss_total_data.map((val) => ())} + +
+ +
+   + + { + setSelectionModel(newSelectionModel); + /*if (newSelectionModel.length === 1) + handleClick_edit_order_From_Line(newSelectionModel);*/ + if (newSelectionModel.length !== 1) { + clean_order_detail_fields(); + setsubmenu(); + setdisplay_detail_order(); + setadd_One_Order(); + + } + }} + selectionModel={selectionModel} + + localeText={frFR.components.MuiDataGrid.defaultProps.localeText} + rows={rowss.map((item, index) => ( + { + id: index, + _id: JSON.parse(item)._id, + order_header_ref_interne: JSON.parse(item).order_header_ref_interne, + order_header_type: JSON.parse(item).order_header_type, + order_header_status: JSON.parse(item).order_header_status, + order_header_client_id: JSON.parse(item).order_header_client_id, + order_header_client_nom: JSON.parse(item).order_header_client_nom, + order_header_vendeur_id: JSON.parse(item).order_header_vendeur_id, + order_header_vendeur_nom_prenom: JSON.parse(item).order_header_vendeur_nom_prenom, + order_header_date_cmd: JSON.parse(item).order_header_date_cmd, + order_header_date_expiration: JSON.parse(item).order_header_date_expiration, + + } + ))} + + columns={columns} + pageSize={10} + className="datagridclass" + + onRowDoubleClick={(newSelectionModel) => { + setgridline_id(newSelectionModel.row.id); + setp_detail_header_client_nom_id(newSelectionModel.row.order_header_client_id); + handleClick_edit_order_From_Line(newSelectionModel.row.id); + } + } + + rowsPerPageOptions={[10]} + //disableSelectionOnClick + /* components={{ + Toolbar: GridToolbar, + }}*/ + //sx={datagridSx} + getCellClassName={(params) => { + + + //field === "order_header_status" + if (params.field === "order_header_status" && String(params.value) == "0") { + return 'cell--status--brouillon'; + } + + if (params.field === "order_header_status" && String(params.value) == "1") { + + return 'cell--status--encours'; + } + + if (params.field === "order_header_status" && String(params.value) == "2") { + return 'cell--status--traite'; + } + + if (params.field === "order_header_status" && String(params.value) == "3") { + return 'cell--status--facture'; + } + + }} + 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'; + } + // Pour la gestion de la couleur de zone double cliquée + if (String(params.row.id) === String(gridline_id)) { + return 'line--statut--selected'; + } + else if (parseInt(String(params.row.id)) % 2 === 0) { + return 'line--statut--pair'; + } + else if (parseInt(String(params.row.id)) % 2 !== 0) { + return 'line--statut--impair'; + } + + }} + + + /> + +
+ +
+ +
+ +
+ +
+ + {String(props.check_user_acces_right("commande", "write")) === "1" &&
+ + {/**/} + + + + + + + +
} +
+
 
+ + + {String(submenu) === "detail_order" && String(add_One_Order) !== "1" &&
+ +
+
+ +
+ + + {selected_order_header_type && String(selected_order_header_type) !== "devis" && } + {selected_order_header_type && String(selected_order_header_type) === "devis" && } + + {String(history_securite_read) === "1" && } + +
+ +
+ + +
+ {String(header_submenu) === "main" &&
+
Type
+ { + setp_detail_header_type(e.target.value); + setOrder_data_changed("1"); + } + } + + /> +
+ + {String(order_data_edit_mode) !== "1" &&
Statut + {p_detail_header_order_header_ref_interne && String(p_detail_header_order_header_ref_interne).length > 2 && + +   + + } +
+ + + { + setp_detail_header_statut(e.target.value); + setOrder_data_changed("1"); + } + } + /> + +
} + {String(order_data_edit_mode) === "1" && String(p_detail_header_type) === "commande" &&
Statut
+ + + {New_Status_Filter && New_Status_Filter.length > 0 && (data).value === String(p_detail_header_statut))[0].label} + options={New_Status_Filter} + onChange={(event, value) => { + if (value && value.value) { + + setp_detail_header_statut(value.value); + setOrder_data_changed("1"); + } + + }} + + renderInput={(params) => + } + />} + + + {/* { + setp_detail_header_statut(e.target.value); + setOrder_data_changed("1"); + } + } + + > + Brouillon    + En cours   + Traité   + Annulé   + */} + +
} + {String(order_data_edit_mode) === "1" && String(p_detail_header_type) === "devis" &&
Statut
+ + + {New_Quotation_Status_Filter && New_Quotation_Status_Filter.length > 0 && (data).value === String(p_detail_header_statut))[0].label} + options={New_Quotation_Status_Filter} + onChange={(event, value) => { + if (value && value.value) { + + setp_detail_header_statut(value.value); + setOrder_data_changed("1"); + + + } + + }} + + renderInput={(params) => + } + />} + + + +
} + +
Ref. Interne
+ { + setp_detail_header_ref_interne(e.target.value); + setOrder_data_changed("1"); + } + } + + /> +
+ + + {String(order_data_edit_mode) !== "1" &&
Inclus BPF
+ (data).value === String(p_add_cmd_header_order_inclus_bpf))[0].label} + /> + +
} + + + {String(order_data_edit_mode) === "1" &&
Inclus BPF
+ {inclus_bpf_tab && inclus_bpf_tab.length > 0 && (data).value === String(p_add_cmd_header_order_inclus_bpf))[0].label} + options={inclus_bpf_tab} + onChange={(event, value) => { + setOrder_data_changed("1"); + if (value && value.value) { + setp_add_cmd_header_order_inclus_bpf(value.value); + } else { + setp_add_cmd_header_order_inclus_bpf(""); + } + + }} + + renderInput={(params) => + } + />} +
} + + + + {String(order_data_edit_mode) === "1" &&
+ Conditions Paiement
+ + + {New_Getall_Partner_Paiement_Condition_result && New_Getall_Partner_Paiement_Condition_result.length > 0 && + (data).label === String(p_detail_header_condition_paiement_code))[0].label} + options={New_Getall_Partner_Paiement_Condition_result} + className="disabled_style" + onChange={(event, value) => { + if (value && value._id) { + setp_detail_header_condition_paiement_code(value.code); + setp_detail_header_condition_paiement_id(value._id); + setOrder_data_changed("1"); + } + + }} + + renderInput={(params) => + } + />} + + +
} + {String(order_data_edit_mode) !== "1" &&
Conditions Paiement
+ + +
} + + + {String(order_data_edit_mode) !== "1" &&
Date Cmd
+ +
} + + {String(order_data_edit_mode) === "1" &&
Date Cmd
+ { + setp_detail_header_date_cmd_val(format(date, 'dd/MM/yyyy')); + setOrder_data_changed("1"); + } + } + showTimeSelect={false} + //filterTime={filterPassedTime_start} + dateFormat="dd/MM/yyyy" + className="disabled_style enable_style" + locale={'fr'} + /> +
} + + + {String(order_data_edit_mode) !== "1" &&
Date expiration
+ +
} + + {String(order_data_edit_mode) === "1" &&
Date expiration
+ { + setp_detail_header_date_expiration_val(format(date, 'dd/MM/yyyy')); + setp_detail_header_date_expiration(format(date, 'dd/MM/yyyy')); + setOrder_data_changed("1"); + } + } + showTimeSelect={false} + //filterTime={filterPassedTime_start} + dateFormat="dd/MM/yyyy" + className="disabled_style enable_style" + locale={'fr'} + /> +
} + + + + {String(order_data_edit_mode) !== "1" && } + + {String(order_data_edit_mode) === "1" &&
Nom Client
+ + { + setp_detail_header_client_nom_id(e.target.value); + Get_Givent_Partner_Client_Data(e.target.value); + setOrder_data_changed("1"); + } + } + + > + {Get_List_Partner_Clients_result && + Get_List_Partner_Clients_result.map((myclient) => ( + + {JSON.parse(myclient).nom}   + + + ))} + + +
} + + +
Email Client
+ { + setp_detail_header_email_client(e.target.value); + setOrder_data_changed("1"); + } + } + + /> +
+ + +
Ref. Externe
+ { + setp_detail_header_ref_client(e.target.value); + setOrder_data_changed("1"); + } + } + + /> +
+ +
Description
+ { + setp_detail_header_description(e.target.value); + setOrder_data_changed("1"); + } + } + + /> +
+ +
Lieu de formation
+ { + setp_detail_header_lieu_formation(e.target.value); + setOrder_data_changed("1"); + } + } + + /> +
+ + +
Commentaire
+ { + setp_detail_header_comment(e.target.value); + setOrder_data_changed("1"); + } + } + + /> +
+ + {String(order_data_edit_mode) !== "1" &&
Vendeur
+ { + setp_detail_header_vendeur_nom(e.target.value); + setOrder_data_changed("1"); + } + } + + /> +
} + + {String(order_data_edit_mode) === "1" &&
Vendeur
+ { + setp_detail_header_vendeur_nom_id(e.target.value); + setOrder_data_changed("1"); + } + } + + > + {Getall_Training_Employee_No_Filter_result && + Getall_Training_Employee_No_Filter_result.map((myclient) => ( + + {JSON.parse(myclient).nom}  {JSON.parse(myclient).prenom} + + + ))} + + +
} + + + +
} + + {String(header_submenu) === "detail" &&
+ {/*
+ + + +
*/} + + {/* + {String(order_data_edit_mode) === "1" &&
Type de Reduction (entete)
+ { + setp_detail_header_type_reduction(e.target.value); + setOrder_data_changed("1"); + } + } + + > + Montant   + Pourcentage   + +
} + + {String(order_data_edit_mode) !== "1" &&
Type de Reduction (entete)
+ + +
} + + +
Valeur reduction (entete)
+ { + setp_detail_header_type_reduction_valeur(e.target.value); + setOrder_data_changed("1"); + } + } + + /> +
+ +
Montant Reduction (entete)
+ { + setp_detail_header_montant_reduction(e.target.value); + setOrder_data_changed("1"); + } + } + + /> +
+ +*/} + +
Total Ligne HT avant reduction
+ +
+ +
Total Ligne Reduction
+ +
+ +
Total Ligne HT apres reduction
+ +
+ + +
Total Ligne Taxes
+ +
+ +
Entete : Total reduction
+ +
+ + + +
Entete : Total HT avant reduction d'entete
+ +
+ +
Entete : Total HT apres reduction d'entete
+ +
+ +
} + + {String(header_submenu) === "facturation" &&
+ +
Adresse Facturation
+ { + setp_detail_header_fact_adr(e.target.value); + setOrder_data_changed("1"); + } + } + + /> +
+ +
Code postal
+ { + setp_detail_header_fact_code_postal(e.target.value); + setOrder_data_changed("1"); + } + } + + /> +
+ +
Ville
+ { + setp_detail_header_fact_ville(e.target.value); + setOrder_data_changed("1"); + } + } + + /> +
+ +
Pays
+ { + setp_detail_header_fact_pays(e.target.value); + setOrder_data_changed("1"); + } + } + + /> +
+ + + +
Adresse Livraison
+ { + setp_detail_header_liv_adr(e.target.value); + setOrder_data_changed("1"); + } + } + + /> +
+ +
Code postal
+ { + setp_detail_header_liv_code_postal(e.target.value); + setOrder_data_changed("1"); + } + } + + /> +
+ +
Ville
+ { + sep_detail_header_liv_ville(e.target.value); + setOrder_data_changed("1"); + } + } + + /> +
+ +
Pays
+ { + setp_detail_header_liv_pays(e.target.value); + setOrder_data_changed("1"); + } + } + + /> +
+ + +
} + + {String(header_submenu) === "order_header_relance" &&
+ + + {String(order_data_edit_mode) !== "1" &&
Relance Automatique
+ (data).id === String(p_detail_header_devis_relance_auto))[0].label} + + /> +
} + + {String(order_data_edit_mode) === "1" && New_Option_Oui_Non &&
Relance Automatique
+ (data).id === String(p_detail_header_devis_relance_auto))[0].label} + onChange={(event, value) => { + if (value && value.value) { + setp_detail_header_devis_relance_auto(value.value); + + } else { + setp_detail_header_devis_relance_auto(""); + } + setOrder_data_changed("1"); + }} + + renderInput={(params) => + } + /> + + + +
} + + + {String(order_data_edit_mode) !== "1" && } + + {String(order_data_edit_mode) === "1" && New_Option_Frequence_Relance &&
+ + + Fréquence de relance (en jour)
+ { + setp_detail_header_devis_frequence_relance(e.target.value); + setOrder_data_changed("1"); + } + } + + /> +
} + + + + {String(order_data_edit_mode) !== "1" &&
Nombre Relance
+ +
} + + {String(order_data_edit_mode) === "1" &&
Nombre Relance
+ { + setp_detail_header_devis_nb_relance(e.target.value); + setOrder_data_changed("1"); + } + } + /> +
} + +
+
Les relances effectuées
+
+ + + {Quotation_list_relance && + Quotation_list_relance.map((relance, index) => ( + +
+ {relance.date_relance && relance.mesg_relance && } +
+ ))} + +
+
+ + +
} + + + {String(header_submenu) === "historique" &&
+ +
} + + + +
+
+ + {String(props.check_user_acces_right("commande", "write")) === "1" && String(p_detail_header_statut_label).toLowerCase() === "brouillon" && + String(p_detail_header_statut_label).toLowerCase() !== "facturé" && + } + + {String(props.check_user_acces_right("commande", "write")) === "1" && String(p_detail_header_statut_label).toLowerCase() === "en cours" && + String(p_detail_header_type).toLowerCase() === "commande" && + } + + + {String(props.check_user_acces_right("commande", "write")) === "1" && String(selected_order_header_type) === "commande" && + String(p_detail_header_statut_label).toLowerCase() === "traité" && + Facturer + } + + modal + nested + position="center center" + > + {close => ( +
+ +
MySy Information
+
+ {' '} + + En confirmant cette opération, vous allez lancer le processus de facturation.
+
+
+
+ + +
+
+ +
+
+
+ )} +
+ + } + + + {String(props.check_user_acces_right("commande", "write")) === "1" && String(selected_order_header_type) === "devis" && + (String(p_detail_header_statut_label).toLowerCase().trim() === "en cours" || String(p_detail_header_statut_label).toLowerCase().trim() === "gagné") && + String(p_detail_header_order_header_ref_interne) === "" && + + } + + {String(selected_order_header_type) === "devis" && + (String(p_detail_header_statut_label).toLowerCase().trim() === "en cours" || String(p_detail_header_statut_label).toLowerCase().trim() === "gagné") && + String(p_detail_header_order_header_ref_interne) !== "" && + + } + + + {String(props.check_user_acces_right("commande", "write")) === "1" && String(selected_order_header_type) === "devis" && String(p_detail_header_statut_label).toLowerCase() === "en cours" && + Valider et Reserver + } + + modal + nested + position="center center" + > + {close => ( +
+ +
MySy Information
+
+ {' '} + + En confirmant cette opération, vous allez valider le devis et reserver automatiquement les places dans la session
+ +
+
+
+ + +
+
+ +
+
+
+ )} +
+ + } + + {String(props.check_user_acces_right("commande", "write")) === "1" && String(p_detail_header_statut_label).toLowerCase() !== "facturé" && } + + + {String(props.check_user_acces_right("commande", "write")) === "1" && String(p_detail_header_statut_label).toLowerCase() !== "traité" && + String(p_detail_header_statut_label).toLowerCase() !== "facturé" && + Supprimer } + + modal + nested + position="center center" + > + {close => ( +
+ +
MySy Information
+
+ {' '} + + En confirmant cette opération, le document sera définitivement supprimé.
+ +
+
+
+ + +
+
+ +
+
+
+ )} +
+ } + {String(p_detail_header_statut_label).toLowerCase() !== "traité" && + String(p_detail_header_statut_label).toLowerCase() !== "facturé" && + String(selected_order_header_type) === "devis" && + + } + +

+ {String(p_detail_header_statut_label).toLowerCase() === "en cours" && + + } + + + {String(props.check_user_acces_right("commande", "write")) === "1" && String(p_detail_header_statut_label).toLowerCase() !== "brouillon" && } + {String(props.check_user_acces_right("commande", "write")) === "1" && String(p_detail_header_statut_label).toLowerCase() !== "brouillon" && } + +

+ + {String(p_detail_header_devis_date_validation).length > 5 && } + {String(p_detail_header_devis_date_envoi).length > 5 && } + + + {(!p_detail_header_devis_date_validation || String(p_detail_header_devis_date_validation).length < 5) && } + {(!p_detail_header_devis_date_envoi || String(p_detail_header_devis_date_envoi).length < 5) && } + + + +
+ +
+ + +
+
+   +
+ {String(Order_data_changed) === "1" && String(order_data_edit_mode) === "1" &&
+ /!\ Pensez à enregistrer les modifications +
} +
+ + {String(Order_data_changed) === "1" && String(order_data_edit_mode) === "1" &&
+ + + +
} + + {String(order_data_edit_mode) === "1" &&
+ +
} +
+ + + {String(props.check_user_acces_right("commande", "write")) === "1" && String(order_data_edit_mode) !== "1" && String(p_detail_header_statut_label).toLowerCase() !== "facturé" &&
+ + + +
} +
+   +
+
+
+ +
+ +
+ {String(props.check_user_acces_right("commande", "write")) === "1" && } + +
+   + + { + setselectionModel_order_lines(newSelectionModel); + /*if (newSelectionModel.length === 1) + handleClick_edit_order_From_Line(newSelectionModel); + if (newSelectionModel.length !== 1) { + setsubmenu(); + setdisplay_detail_order(); + setadd_One_Order(); + }*/ + }} + selectionModel={selectionModel_order_lines} + + localeText={frFR.components.MuiDataGrid.defaultProps.localeText} + rows={rows_order_lines.map((item, index) => ( + { + id: index, + _id: JSON.parse(item)._id, + order_line_formation: JSON.parse(item).order_line_formation, + order_line_qty: JSON.parse(item).order_line_qty, + order_line_status: JSON.parse(item).order_line_status, + order_line_prix_unitaire: JSON.parse(item).order_line_prix_unitaire, + order_header_id: JSON.parse(item).order_header_id, + order_line_session_id: JSON.parse(item).order_line_session_id, + order_line_session_code: JSON.parse(item).order_line_session_code_session, + order_header_ref_interne: JSON.parse(item).order_header_ref_interne, + order_line_type: JSON.parse(item).order_line_type, + order_line_formation_title: JSON.parse(item).title, + order_line_formation_duration: JSON.parse(item).duration_concat, + order_line_comment: JSON.parse(item).order_line_comment, + order_line_formation_external_code: JSON.parse(item).order_line_formation_external_code, + order_line_type_article: JSON.parse(item).order_line_type_article, + order_line_montant_hors_taxes: JSON.parse(item).order_line_montant_hors_taxes, + related_order_internal_ref: JSON.parse(item).related_order_internal_ref, + + order_line_tax_amount: JSON.parse(item).order_line_tax_amount, + 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, + + order_line_type_reduction: JSON.parse(item).order_line_type_reduction, + order_line_type_valeur: JSON.parse(item).order_line_type_valeur, + order_line_montant_reduction: JSON.parse(item).order_line_montant_reduction, + + } + ))} + + columns={columns_order_lines} + pageSize={10} + className="datagridclass" + + + onRowDoubleClick={(newSelectionModel) => { + handleClick_edit_order_From_Line(newSelectionModel.row.id); + + }} + + rowsPerPageOptions={[10]} + //disableSelectionOnClick + components={{ + Toolbar: GridToolbar, + }} + + getEstimatedRowHeight={() => 200} + getRowHeight={() => "auto"} + + + /> + +
+ +
+ +
+
+
+
+   +
+ {String(Order_data_changed) === "1" && String(order_data_edit_mode) === "1" &&
+ /!\ Pensez à enregistrer les modifications +
} +
+ + {String(Order_data_changed) === "1" && String(order_data_edit_mode) === "1" &&
+ + + +
} + + {String(order_data_edit_mode) === "1" &&
+ +
} +
+ + + {String(props.check_user_acces_right("commande", "write")) === "1" && String(order_data_edit_mode) !== "1" &&
+ + + +
} +
+   +
+
+ +
+
} +
+ + +
+ ) +} + + +export default Partner_Commande; \ No newline at end of file diff --git a/src/components/Partner.js b/src/components/Partner.js index 46afbd2..d697cf3 100644 --- a/src/components/Partner.js +++ b/src/components/Partner.js @@ -1648,7 +1648,7 @@ const Partner = (props) => { my_lms_url = (JSON.parse(res.data.message).lms_virtualhost_url) + "user_portal.php?recid=" + encodeURIComponent(JSON.parse(res.data.message).lms_part_recid) + "&mysytoken=" + encodeURIComponent(JSON.parse(res.data.message).lms_pwd_mask); - //console.log(" ### LMS url = ", my_lms_url); + // console.log(" ### LMS url = ", my_lms_url); setpartner_lms_url(my_lms_url); setpartner_lms_virtualhost_url((JSON.parse(res.data.message).lms_virtualhost_url)); diff --git a/src/components/Partner_Commande.js b/src/components/Partner_Commande.js index 3aeead4..c90ce6f 100644 --- a/src/components/Partner_Commande.js +++ b/src/components/Partner_Commande.js @@ -1941,12 +1941,14 @@ const Partner_Commande = (props) => { setGet_Given_Partner_Config_Point_Taux_TVA_api("true"); setGet_Given_Partner_Config_Point_Taux_TVA_result(res.data.message); + setpartner_taux_tva("20"); + if (res.data.message.length > 0) { var point_config_tva = JSON.parse(res.data.message); if (point_config_tva.config_value) { setpartner_taux_tva(point_config_tva.config_value); - //console.log(" GGG TVA PART = ", point_config_tva.config_value); + // console.log(" GGG TVA PART = ", point_config_tva.config_value); } } else { @@ -3076,11 +3078,11 @@ const Partner_Commande = (props) => { - console.log(" GLOBAL #### partner_taux_tva = ", partner_taux_tva, " ### qty = ", qty, " ### unit_price = ", unit_price, " ### total_base1 = ", total_base1, " ### total_reduction = ", total_reduction, " ### reduct_value = ", reduct_value); + // console.log(" GLOBAL #### partner_taux_tva = ", partner_taux_tva, " ### qty = ", qty, " ### unit_price = ", unit_price, " ### total_base1 = ", total_base1, " ### total_reduction = ", total_reduction, " ### reduct_value = ", reduct_value); const total_taux_tax_bef = parseFloat(String(partner_taux_tva)) / 100; - console.log(" GLOBAL #### total_taux_tax_bef = ", total_taux_tax_bef); + // console.log(" GLOBAL #### total_taux_tax_bef = ", total_taux_tax_bef); const total_taux_tax = 1 + total_taux_tax_bef; @@ -3307,7 +3309,7 @@ const Partner_Commande = (props) => { setp_add_line_item_total_amount_ttc(""); setp_add_line_item_type_apprenant(""); - setpartner_taux_tva("20"); + // setpartner_taux_tva("20"); setselected_order_line_id(""); @@ -3717,8 +3719,8 @@ const Partner_Commande = (props) => { //var reduct_type = p_add_line_item_type_reduction; - console.log(" reduct_type = ", reduct_type); - console.log(" p_add_line_item_type_reduction = ", p_add_line_item_type_reduction); + //console.log(" reduct_type = ", reduct_type); + // console.log(" p_add_line_item_type_reduction = ", p_add_line_item_type_reduction); if (String(p_add_line_item_type_reduction) === "fixe") { console.log("fixe : p_add_line_item_reduction_value = ", reduct_value); @@ -3732,7 +3734,7 @@ const Partner_Commande = (props) => { - console.log(" #### partner_taux_tva = ", partner_taux_tva, " ### qty = ", qty, " ### unit_price = ", unit_price, " ### total_base1 = ", total_base1, " ### total_reduction = ", total_reduction, " ### reduct_value = ", reduct_value); + // console.log(" #### partner_taux_tva = ", partner_taux_tva, " ### qty = ", qty, " ### unit_price = ", unit_price, " ### total_base1 = ", total_base1, " ### total_reduction = ", total_reduction, " ### reduct_value = ", reduct_value); var montant_taxe_tva = ((total_base1 - total_reduction) * [parseFloat(String(partner_taux_tva)) / 100]).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); @@ -3740,7 +3742,7 @@ const Partner_Commande = (props) => { // 20/08/2024 - enlever la réduction du total ht total_base1 = total_base1 - total_reduction; - console.log(" #### montant_taxe_tva = ", montant_taxe_tva, " ### montant_ttc = ", montant_ttc); + // console.log(" #### montant_taxe_tva = ", montant_taxe_tva, " ### montant_ttc = ", montant_ttc); setp_add_line_item_reduction_total_amount(String(total_reduction)); setp_add_line_item_total_amount_ht(String(total_base1)); diff --git a/src/components/detail_formation_automatic_files/PROD_25102025/new_detail_formation_2025.js b/src/components/detail_formation_automatic_files/PROD_25102025/new_detail_formation_2025.js new file mode 100644 index 0000000..81a3129 --- /dev/null +++ b/src/components/detail_formation_automatic_files/PROD_25102025/new_detail_formation_2025.js @@ -0,0 +1,2931 @@ +import React, { useRef, useState, useEffect } from "react"; +import "./new_s_detail_formation_2025.css"; +import { useParams } from 'react-router-dom' +import axios from "axios"; +import { FcInfo } from "react-icons/fc"; +import 'reactjs-popup/dist/index.css'; +import fileDownload from 'js-file-download'; +import { Helmet } from "react-helmet"; +import 'react-slideshow-image/dist/styles.css' +import 'react-tooltip/dist/react-tooltip.css' +import { Tooltip } from 'react-tooltip' +import slideimg1 from "../../mysy_img/education.jpg"; +import slideimg4 from "../../mysy_img/mysy_img.png"; + +import img_met_program from "../../mysy_img/met_programmation.jpg"; + +import img_met_graphisme from "../../mysy_img/metier_graphisme.jpg"; + +import img_met_autre from "../../mysy_img/met_autre.jpg"; +import img_met_digital from "../../mysy_img/met_digital.jpg"; +import img_met_management from "../../mysy_img/met_management.jpg"; + + +import img_met_dev_perso from "../../mysy_img/metier_dev_perso.jpg"; +import img_met_rh from "../../mysy_img/met_rh.jpg"; + +import img_met_bureautic from "../../mysy_img/met_burautic.jpg"; +import img_met_vente from "../../mysy_img/met_vente.jpg"; +import img_met_sport from "../../mysy_img/met_sport.png"; +import img_met_sante_nat from "../../mysy_img/met_sante_nat.jpeg"; + +import Social_X_icon from '../../img_new_design_2025/social_i_X.png'; +import Social_Link_icon from '../../img_new_design_2025/social_i_Link.png'; +import Social_Fa_icon from '../../img_new_design_2025/social_i_Fa.png'; + +/* +/!\ important: les images du slides doivent avoir une dimension de : 250 X 450 +*/ +import { Button, } from "reactstrap"; +import { useHistory } from "react-router-dom"; +import { useCookies } from "react-cookie"; + +import { confirmAlert } from 'react-confirm-alert'; +//import { Rating } from 'react-simple-star-rating'; +import Rating from '@mui/material/Rating'; +import parse from 'html-react-parser'; +import Inscription from "./../Inscription_Information"; +import SendIcon from '@mui/icons-material/Send'; + + +import Accordion from '@mui/material/Accordion'; +import AccordionDetails from '@mui/material/AccordionDetails'; +import AccordionSummary from '@mui/material/AccordionSummary'; +import Typography from '@mui/material/Typography'; +import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; + +import Dialog from '@mui/material/Dialog'; +import DialogActions from '@mui/material/DialogActions'; +import DialogContent from '@mui/material/DialogContent'; +import DialogContentText from '@mui/material/DialogContentText'; +import DialogTitle from '@mui/material/DialogTitle'; + + +const New_C_Detail_Formation_2025 = (props) => { + const { classId, action } = useParams(); + const [result, setResult] = useState(""); + const [myApiResponse, setmyApiResponse] = useState(); + const [DetailTraining, setDetailTraining] = useState([]); + const [closepopup, setclosepopup] = useState(0); + const [country_code, setcountry_code] = useState(""); + const [country_name, setcountry_name] = useState(""); + const [city, setcity] = useState(""); + const [postal, setpostal] = useState(""); + const [latitude, setlatitude] = useState(""); + const [longitude, setlongitude] = useState(""); + const [IPv4, setIPv4] = useState(""); + const [state, setstate] = useState(""); + const [userIp, setuserIp] = useState(""); + const [mynote, setmynote] = useState(0); + const [userconnected, setuserconnected] = useState("0"); + const [partnerconnected, setpartnerconnected] = useState("0"); + const [cookie, setCookie, removeCookie] = useCookies(['tokenmysych']); + const [cookie_part, setCookie_part, removeCookie_part] = useCookies(['tokenmysypart']); + + const [inscritpion, setinscritpion] = useState(""); + const [ratingvalue, setratingvalue] = useState(0); + + const [text_size, settext_size] = useState("0"); + + const socialIconStyles = { + width: '24px', + height: '24px', + cursor: 'pointer', + }; + + const socialIconStyles_mobile = { + width: '24px', + height: '24px', + cursor: 'pointer', + }; + + // Gestion des Cookies + const stored_partner = cookie_part.tokenmysypart; + const stored_user = cookie.tokenmysych; + + + const [childdata, setchilddata] = useState(); + + + // Cette fonction verifier si le token de l'evaluation est valide + //si $action != 'information' et 'inscription', alors la valeur est forcement celle d'un token. + const [tokenEval_api, settokenEval_api] = useState(); + const [tokenEval_message, settokenEval_message] = useState(); + const [tokenEval_result, settokenEval_result] = useState(); + function CheckEvaluationToken() { + + var form = new FormData(); + //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); + + form.append("eval_token", action); + form.append("class_internal_url", classId); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/MySyckeckEvaluationToken/"; + + axios.post(myurl, form).then(res => { + //console.log(" In CheckEvaluationToken res.data.status = " + res.data.status); + //console.log(" In CheckEvaluationToken res.data.message r_class = " + res.data.message); + + + if (String(res.data.status) !== "false") { + settokenEval_api("true"); + settokenEval_result(res.data.message); + } + else { + //console.log(" In tokenEval_trainingsession res.data.status = " + res.data.status); + settokenEval_api("false"); + settokenEval_message(res.data.message); + } + + }).catch((error) => { + console.warn('Not good man :( CheckEvaluationToken = ', error); + settokenEval_api("false"); + //setmyApimyApiMessage("") + }) + } + + + useEffect(() => { + + async function funclocaltoken() { + if (action && String(action).toLocaleLowerCase() !== "inscription" && + String(action).toLocaleLowerCase() !== "information") { + + CheckEvaluationToken(); + } + } + + + var local_user_connect = 0; + var local_part_connect = 0; + + if (typeof (stored_user) === "undefined" || String(stored_user) === '') { + setuserconnected("0"); + local_user_connect = 0; + } else { + setuserconnected("1"); + local_user_connect = 1; + } + + if (typeof (stored_partner) === "undefined" || String(stored_partner) === '') { + setpartnerconnected("0"); + local_part_connect = 0; + } else { + setpartnerconnected("1"); + local_part_connect = 1; + } + + async function fetchData() { + const result = await axios('https://geolocation-db.com/json/',); + setuserIp(result.data.IPv4); + setcountry_code(result.data.country_code); + setcountry_name(result.data.country_name); + setcity(result.data.city); + setpostal(result.data.postal); + setlatitude(result.data.latitude); + setlongitude(result.data.longitude); + setIPv4(result.data.IPv4); + setstate(result.data.state); + setuserIp(result.data.IPv4); + submenu_datelieu(); + } + fetchData(); + + + GetCurrentClass_trainingsession(); + Display(); + GetAssociatedTraning(); + + + funclocaltoken(); + window.scrollTo({ + top: 0, + behavior: "smooth", + }); + + + }, []); + + + function contactUs(e) { + + var sender_mail = ""; + var sender_tel = ""; + var token = ""; + if (String(userconnected) === "0") { + sender_mail = document.getElementsByName("usermail")[0].value; + sender_tel = document.getElementsByName("usernumtel")[0].value; + if (sender_mail.length == 0 && sender_tel.length == 0) { + alert(" Les information fournies sont incorrectes "); + return; + } + } else { + token = String(stored_user) + + } + + + var useravis = document.getElementsByName("useravis")[0].value; + var usersupqual = document.getElementsByName("userqualsup")[0].value; + var usernote = document.getElementsByName("usernote")[0].value; + + if (useravis.length < 20 || usersupqual.length < 20 || usernote.length < 0) { + alert("Merci de saisir le nombre minimum de caractère requis pour les champs "); + return; + } + + + var re = /\S+@\S+\.\S+/; + if (re.test(sender_mail) == false) { + alert("l'email est incorrecte"); + return; + } + + + ////console.log("contacter " + sender_mail + " - " + sender_tel + " - ") + + + //alert("contacter "+sender_mail+" - "+sender_tel+" - "+usermessage+" - url = " + //+process.env.REACT_APP_API_URL+" - user_ip ="+IPv4+" - "+latitude); + var myurl = process.env.REACT_APP_API_URL + "myclass/api/add_user_message/"; + var form = new FormData(); + form.append("type", "email"); + form.append("recever_mail", ""); + form.append("recever_tel", ""); + form.append("sender_mail", sender_mail); + form.append("sender_tel", sender_tel); + form.append("object", DetailTraining["external_code"]); + form.append("token", ""); + form.append("user_ip", IPv4); + form.append("user_country_code", country_code); + form.append("user_country_name", country_name); + form.append("user_city", city); + form.append("user_postal", postal); + form.append("user_latitude", latitude); + form.append("user_longitude", longitude); + form.append("user_state", state); + + axios.post(myurl, form).then(res => { + if (res.data.status != "False") { + //console.log(" In test res.data.status = " + res.data.status); + //console.log(" In test res.data.message = " + res.data.message); + setclosepopup(1); + document.getElementsByName("usermail")[0].value = ""; + document.getElementsByName("usernumtel")[0].value = ""; + document.getElementsByName("usercomment")[0].value = ""; + } + else { + //console.log(" contact-nous statut = " + res.data.status); + //console.log(" contact-nous res.data.message = " + res.data.message); + } + }).catch((error) => { + console.warn('contact-nous Not good man :( mysearchtext = '); + + }) + + + } + + + /* Cette variable accompagne la gestion des images par defaut. + idée : si la valeur de "DetailTraining.metier" != "management, digital, office, rh, vente, dev_perso" + alors l'utilisateur à créer une formation avec un metier qui n'est pas geré, donc on met une image par defaut + */ + const [ismetiermanaged, setismetiermanaged] = useState(); + const liste_metier = ["management", "digital", "office", "rh", "vente", "dev_perso"]; + + + const [nb_pave_a_afficher, setnb_pave_a_afficher] = useState(); + + const [isdatadock, setisdatadock] = useState(); + const [isqualiopi, setisqualiopi] = useState(); + const [iscertitrace, setiscertitrace] = useState(); + const [isbureaucertitrace, setisbureaucertitrace] = useState(); + const [iscertifvoltaire, setiscertifvoltaire] = useState(); + const [partnair_name, setpartnair_name] = useState(); + const [website_partenaire, setwebsite_partenaire] = useState(); + + const [class_sales_price, setclass_sales_price] = useState("0"); + + const [myclassimage, setmyclassimage] = useState(); + const [isclassimage, setisclassimage] = useState("False"); + const [userimgclassprofil, setuserimgclassprofil] = useState(""); + + const [class_img_stored_in_bdd, setclass_img_stored_in_bdd] = useState(""); + + function getClassImage_no_token(class_id, class_external_code) { + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/getRecodedClassImage_no_token/"; + + var form = new FormData(); + + form.append("type", "partner"); + form.append("related_collection", "myclass"); + form.append("related_collection_recid", class_id); + form.append("class_external_code", class_external_code); + + + axios.post(myurl, form).then(res => { + + if (res.data.status != "False") { + + //console.log(" getClassImage : In test res.data.status = " + res.data.status); + console.log(" getClassImage: res.data.message.img = " + res.data.message); + + if (res.data.message.img.length > 0) { + setisclassimage("True"); + } + else { + setisclassimage("False"); + } + setisclassimage(res.data.message.img); + var ch_img = "data:image/png;base64," + res.data.message.img; + setclass_img_stored_in_bdd(ch_img); + } + else { + //console.log(" In Erreur res.data.status = " + res.data.status); + //console.log(" In Erreur res.data.message = " + res.data.message); + setisclassimage("False"); + setuserimgclassprofil(); + setclass_img_stored_in_bdd(); + } + }).catch((error) => { + + console.warn('getClassImage ee: Not good man :( getClassImage = '); + setisclassimage("False"); + setuserimgclassprofil(""); + setclass_img_stored_in_bdd(""); + }) + + } + + + const [Get_Class_Catalogue_File_api, setGet_Class_Catalogue_File_api] = useState(); + const [Get_Class_Catalogue_File_result, setGet_Class_Catalogue_File_result] = useState([]); + const [Get_Class_Catalogue_File_message, setGet_Class_Catalogue_File_message] = useState(); + + function Get_Class_Catalogue_File(class_id) { + + const formData = new FormData(); + + formData.append("filter_object_owner_collection", "myclass"); + formData.append("filter_object_owner_id", class_id); + formData.append("filter_type_document", "catalogue_file"); + + + //formData.append("class_internal_url", internal_url); + //console.log("token = " + stored_cookie); + + fetch( + process.env.REACT_APP_API_URL + "myclass/api/Get_List_object_owner_collection_Stored_Files_With_Filter_No_Token/", + { + method: 'POST', + body: formData, + } + ) + .then((response) => response.json()) + .then((result) => { + + //console.log(" ## result['status'] = ", result['status']) + if (String(result['status']) === String("true")) { + //console.log('Message :', result['message']); + setGet_Class_Catalogue_File_result(result['message']); + setGet_Class_Catalogue_File_api("true"); + + } + else { + setGet_Class_Catalogue_File_message(result['message']); + setGet_Class_Catalogue_File_api("false"); + } + + }) + .catch((error) => { + + console.error(' Get_Class_Catalogue_File Error:', error); + setGet_Class_Catalogue_File_api("false"); + }); + + } + + + + + + function Display(e) { + var myurl = process.env.REACT_APP_API_URL + "myclass/api/get_class/"; + var form = new FormData(); + form.append("internal_url", classId); + + var my_local_user_connect; + var my_local_part_connect; + if (typeof (stored_user) === "undefined" || String(stored_user) === '') { + my_local_user_connect = 0; + } else { + my_local_user_connect = 1; + } + + if (typeof (stored_partner) === "undefined" || String(stored_partner) === '') { + my_local_part_connect = 0; + } else { + my_local_part_connect = 1; + } + + + + if (String(my_local_user_connect) === "1") { + form.append("token", stored_user); + form.append("connection_type", "user"); + } + else if (String(my_local_part_connect) === "1") { + form.append("token", stored_partner); + form.append("connection_type", "partner"); + } + else { + form.append("token", ""); + form.append("connection_type", ""); + } + + // Ajout des info IP user + form.append("user_ip", IPv4); + form.append("user_country_code", country_code); + form.append("user_country_name", country_name); + form.append("user_city", city); + form.append("user_postal", postal); + form.append("user_latitude", latitude); + form.append("user_longitude", longitude); + form.append("user_state", state); + + var cpt_pave = 0; + //alert("myurl = "+myurl); + + axios.post(myurl, form).then(res => { + // console.log(" In Display res.data.status = " + res.data.status); + // console.log(" In Display res.data.message = " + res.data.message); + if (String(res.data.status) === String("true")) { + + if (res.data.message.length > 0) { + setmyApiResponse("True"); + + if (String(JSON.parse(res.data.message).coeur) !== String("1") && + String(JSON.parse(res.data.message).freeacces) !== String("1")) { + + //alert(" ce n'est pas un coeur = " + JSON.parse(res.data.message).coeur) + // Verification si on est en e connecté ou non. + var local_user_connect = 0; + var local_part_connect = 0; + + if (typeof (stored_user) === "undefined" || String(stored_user) === '') { + setuserconnected("0"); + local_user_connect = 0; + } else { + setuserconnected("1"); + local_user_connect = 1; + } + + if (typeof (stored_partner) === "undefined" || String(stored_partner) === '') { + setpartnerconnected("0"); + local_part_connect = 0; + } else { + setpartnerconnected("1"); + local_part_connect = 1; + } + + if (local_user_connect === 0 && local_part_connect === 0) { + confirmAlert({ + title: 'Connexion ?', + message: 'Connectez-vous pour acceder  au detail de cette formation', + buttons: [ + { + label: 'Vous avez un compte', + onClick: () => { history.push("/mysy-training-login/training/" + classId) } + }, + { + label: "Vous n'avez pas de compte", + onClick: () => { history.push("/create_account") } + }, + + ], + closeOnEscape: false, + closeOnClickOutside: false, + keyCodeForClose: [8, 32], + willUnmount: () => { }, + afterClose: () => { }, + onClickOutside: () => { }, + onKeypress: () => { }, + onKeypressEscape: () => { }, + }); + + + } + } else { + //alert(" c'est pas un coeur = " + JSON.parse(res.data.message).coeur) + } + } + else { + setmyApiResponse("False"); + } + //console.log(" In displaydetailclass res.data.status = " + res.data.status); + //console.log(" In displaydetailclass res.data.message = " + res.data.message); + //console.log(" In displaydetailclass taille res.data.message = " + res.data.message.length); + setResult(res.data.message); + setDetailTraining(JSON.parse(res.data.message)); + + + getClassImage_no_token(JSON.parse(res.data.message)._id, JSON.parse(res.data.message).external_code); + + + Get_Class_Catalogue_File(JSON.parse(res.data.message)._id); + + + if (JSON.parse(res.data.message).note) { + setratingvalue(JSON.parse(res.data.message).note); + } + + if (JSON.parse(res.data.message).isdatadock) { + setisdatadock(JSON.parse(res.data.message).isdatadock); + } + + if (JSON.parse(res.data.message).business_prices && JSON.parse(res.data.message).business_prices.length == 1) { + setclass_sales_price(JSON.parse(res.data.message).business_prices[0].discounted_price); + + } else { + setclass_sales_price(JSON.parse(res.data.message).price); + setclass_sales_price(JSON.parse(res.data.message).price); + } + + + if (JSON.parse(res.data.message).isqualiopi) { + setisqualiopi(JSON.parse(res.data.message).isqualiopi); + } + + + if (JSON.parse(res.data.message).iscertitrace) { + setiscertitrace(JSON.parse(res.data.message).iscertitrace); + } + + if (JSON.parse(res.data.message).isbureaucertitrace) { + setisbureaucertitrace(JSON.parse(res.data.message).isbureaucertitrace); + } + + if (JSON.parse(res.data.message).iscertifvoltaire) { + setiscertifvoltaire(JSON.parse(res.data.message).iscertifvoltaire); + } + + if (JSON.parse(res.data.message).nom_partenaire) { + setpartnair_name(JSON.parse(res.data.message).nom_partenaire); + } + + if (JSON.parse(res.data.message).nb_pave_a_afficher) { + setnb_pave_a_afficher(JSON.parse(res.data.message).nb_pave_a_afficher); + //console.log(" ### NB setnb_pave_a_afficher = ", JSON.parse(res.data.message).nb_pave_a_afficher); + } + + + if (JSON.parse(res.data.message).website_partenaire) { + setwebsite_partenaire(JSON.parse(res.data.message).website_partenaire); + } + + // Verifier si le metier est geré + if (JSON.parse(res.data.message).metier) { + if (!liste_metier.includes(JSON.parse(res.data.message).metier)) { + setismetiermanaged("0"); // j'ai une valeur dans metier, mais qui n'est pas geré + } + } + else { + setismetiermanaged("0"); + } + + if (JSON.parse(res.data.message).img_url && String(JSON.parse(res.data.message).img_url).length > 0) { + setismetiermanaged("1"); + } + + if (JSON.parse(res.data.message).text_size) { + settext_size(JSON.parse(res.data.message).text_size); + + //"block_crossell_meme_orga" + var local_tmp; + var val; + var footer_top; + var main_h; + var main_h_px; + + + //console.log("nb_partner_certificat = ", JSON.parse(res.data.message).nb_partner_certificat); + + /* + if (window.screen.width < 601) { + + var decalage_pr_certificat = parseInt(String(JSON.parse(res.data.message).nb_partner_certificat)) * 150; + //console.log("decalage_pr_certificat = ", decalage_pr_certificat); + + var local_val = parseInt(String(JSON.parse(res.data.message).nb_pave_a_afficher)); + + //console.log("### local_val = ", local_val) + if (local_val >= 5) { + //console.log(" ON PASSE  au MAX") + var local_tmp_val = 2300 + decalage_pr_certificat; + var local_main_h_px = 4000 + decalage_pr_certificat; + //console.log("### local_tmp_val = ", local_tmp_val, " local_main_h_px = ",local_main_h_px); + local_tmp = local_tmp_val + "px"; + main_h_px = local_main_h_px + "px"; + + if (String(action).toLowerCase() === "information" || String(action).toLowerCase() === "inscription") { + + var local_tmp_val = 2800 + decalage_pr_certificat; + var local_main_h_px = 4500 + decalage_pr_certificat; + local_tmp = local_tmp_val + "px"; + main_h_px = local_main_h_px + "px"; + } + + } else { + //console.log(" ON PASSE  au MIN"); + var local_tmp_val = 2100 + decalage_pr_certificat; + var local_main_h_px = 4800 + decalage_pr_certificat; + + local_tmp = local_tmp_val + "px"; + main_h_px = local_main_h_px + "px"; + + if (String(action).toLowerCase() === "information" || String(action).toLowerCase() === "inscription") { + var local_tmp_val = 2600 + decalage_pr_certificat; + var local_main_h_px = 5300 + decalage_pr_certificat; + local_tmp = local_tmp_val + "px"; + main_h_px = local_main_h_px + "px"; + } + } + // document.getElementById('mob_block_cross_sell_cat').style.top = local_tmp; + //document.getElementById('mobile').style.height = main_h_px; + + } + + if (window.screen.width >= 601 && window.screen.width <= 991) { + + var local_val = parseInt(String(JSON.parse(res.data.message).nb_pave_a_afficher)); + if (local_val >= 5) { + //console.log(" ON PASSE  au MAX") + local_tmp = "2000px"; + main_h_px = "2700px"; + + if (String(action).toLowerCase() === "information" || String(action).toLowerCase() === "inscription") { + local_tmp = "2500px"; + main_h_px = "3200px"; + } + + } else { + console.log(" ON PASSE  au MIN"); + local_tmp = "1700px"; + main_h_px = "2500px"; + + if (String(action).toLowerCase() === "information" || String(action).toLowerCase() === "inscription") { + local_tmp = "2200px"; + main_h_px = "3000px"; + } + + } + document.getElementById('block_crossell_meme_orga').style.top = local_tmp; + document.getElementById('desktop').style.height = main_h_px; + + + } + + if (window.screen.width >= 992 && window.screen.width <= 1199) { + + var local_val = parseInt(String(JSON.parse(res.data.message).nb_pave_a_afficher)); + if (local_val >= 5) { + console.log(" ON PASSE  au MAX") + local_tmp = "2000px"; + main_h_px = "2800px"; + + if (String(action).toLowerCase() === "information" || String(action).toLowerCase() === "inscription") { + local_tmp = "2500px"; + main_h_px = "3200px"; + } + + } else { + console.log(" ON PASSE  au MIN"); + local_tmp = "1700px"; + main_h_px = "2500px"; + + if (String(action).toLowerCase() === "information" || String(action).toLowerCase() === "inscription") { + local_tmp = "2200px"; + main_h_px = "3000px"; + } + + } + document.getElementById('block_crossell_meme_orga').style.top = local_tmp; + document.getElementById('desktop').style.height = main_h_px; + } + + if (window.screen.width >= 1200) { + var local_val = parseInt(String(JSON.parse(res.data.message).nb_pave_a_afficher)); + if (local_val >= 5) { + console.log(" ON PASSE  au MAX") + local_tmp = "2000px"; + main_h_px = "2800px"; + + if (String(action).toLowerCase() === "information" || String(action).toLowerCase() === "inscription") { + local_tmp = "2500px"; + main_h_px = "3200px"; + } + + } else { + //console.log(" ON PASSE  au MIN"); + local_tmp = "1700px"; + main_h_px = "2500px"; + + if (String(action).toLowerCase() === "information" || String(action).toLowerCase() === "inscription") { + local_tmp = "2300px"; + main_h_px = "3000px"; + } + } + + if (document.getElementById('block_crossell_meme_orga')) { + document.getElementById('block_crossell_meme_orga').style.top = local_tmp; + } + document.getElementById('desktop').style.height = main_h_px; + } + + */ + + } + } + else { + //console.log(" In Erreur res.data.status = " + res.data.status); + //console.log(" In Erreur res.data.message = " + res.data.message); + setmyApiResponse("false"); + history.push("/formation-inconnue/"); + + } + + + }).catch((error) => { + console.warn('Not good man :( Display = ', error); + //console.log(error); + setmyApiResponse("false"); + + }) + + + } + + const [associatedtraining_api, setassociatedtraining_api] = useState(""); + const [associatedtraining_message, setassociatedtraining_message] = useState(""); + function GetAssociatedTraning(e) { + var myurl = process.env.REACT_APP_API_URL + "myclass/api/get_associated_class_of_partnair/"; + var form = new FormData(); + form.append("internal_url", classId); + // Ajout des info IP user + form.append("user_ip", IPv4); + form.append("user_country_code", country_code); + form.append("user_country_name", country_name); + form.append("user_city", city); + form.append("user_postal", postal); + form.append("user_latitude", latitude); + form.append("user_longitude", longitude); + form.append("user_state", state); + + + //alert("myurl = "+myurl); + + axios.post(myurl, form).then(res => { + if (String(res.data.status) !== String("false")) { + //console.log(" In GetAssociatedTraning res.data.status = " + res.data.status); + //console.log(" In GetAssociatedTraning res.data.message = " + res.data.message); + setassociatedtraining_api("True"); + setassociatedtraining_message(res.data.message); + + } + else { + //console.log(" In Erreur res.data.status = " + res.data.status); + //console.log(" In Erreur res.data.message = " + res.data.message); + setassociatedtraining_api("False"); + } + + + }).catch((error) => { + console.warn('Not good man :( GetAssociatedTraning = '); + setassociatedtraining_api("False"); + + }) + + + } + + const history = useHistory(); + + const fadeImages = [ + { + url: slideimg1, + }, + + { + url: slideimg4, + }, + ]; + + + function CheckAvis(e) { + + const val = document.getElementById("useravis").value + //alert(" evalu " + val); + if (val.length < 20) { + alert(" Le champ 'Avis' doit etre plus renseigné"); + } + //alert(val); + } + + function CheckNote(e) { + const val = e.target.value; + + if (isNaN(val)) { + //alert(val + " is not a number
mynote = "+mynote); + document.getElementById("usernote").value = mynote; + } else { + if (val > 5) { + alert(" Valeur Maxi doit etre 5"); + document.getElementById("usernote").value = mynote; + } else { + setmynote(val); + } + } + + } + + const [submenu, setsubmenu] = useState("datelieu"); + + function submenu_info() { + setsubmenu("formateur"); + //if (document.getElementsByName("menu_formateur")[0]) + // document.getElementsByName('menu_formateur')[0].focus(); + + if (document.getElementsByName("menu_datelieu")[0]) + document.getElementsByName('menu_datelieu')[0].blur(); + + if (document.getElementsByName("submenu_divers")[0]) + document.getElementsByName('submenu_divers')[0].blur(); + } + + function submenu_datelieu() { + setsubmenu("datelieu"); + //if (document.getElementsByName("menu_datelieu")[0]) + // document.getElementsByName('menu_datelieu')[0].focus(); + + if (document.getElementsByName("menu_formateur")[0]) + document.getElementsByName('menu_formateur')[0].blur(); + + if (document.getElementsByName("submenu_divers")[0]) + document.getElementsByName('submenu_divers')[0].blur(); + } + + + function submenu_divers() { + setsubmenu("divers"); + //if (document.getElementsByName("submenu_divers")[0]) + //document.getElementsByName('submenu_divers')[0].focus(); + + if (document.getElementsByName("menu_datelieu")[0]) + document.getElementsByName('menu_datelieu')[0].blur(); + + if (document.getElementsByName("submenu_divers")[0]) + document.getElementsByName('submenu_divers')[0].blur(); + } + + + function Inscription_bton(event) { + if (DetailTraining["internal_url"] && String(DetailTraining["class_inscription_url"]).length > 10) { + window.open( + String(DetailTraining["class_inscription_url"]), + '_blank' + ); + + } else { + setinscritpion("1"); + + } + + + if (document.getElementById('myRef_informe')) { + var divh = document.getElementById('myRef_informe').offsetTop; + window.scrollTo({ + top: divh, + behavior: "smooth", + }); + } + + + } + + function Contact_bton(event) { + setinscritpion("2"); + + + if (document.getElementById('myRef_informe')) { + var divh = document.getElementById('myRef_informe').offsetTop; + window.scrollTo({ + top: divh, + behavior: "smooth", + }); + } + + + } + + + const [GetCurrentClass_api, setGetCurrentClass_api] = useState(); + const [GetCurrentClass_message, setGetCurrentClass_message] = useState(); + const [GetCurrentClass_result, setGetCurrentClass_result] = useState(); + function GetCurrentClass_trainingsession(event) { + + var form = new FormData(); + + form.append("class_internal_url", classId); + + form.append("token", stored_partner); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/GetActiveSessionFormation_List/"; + + axios.post(myurl, form).then(res => { + //console.log(" In GetCurrentClass_trainingsession res.data.status = " + res.data.status); + // console.log(" In GetCurrentClass_trainingsession res.data.message r_class = " + res.data.message); + + if (String(res.data.status) === String("true")) { + //console.log(" In GetCurrentClass_trainingsession res.data.status = " + res.data.status); + //console.log(" In GetCurrentClass_trainingsession res.data.message r_class = " + res.data.message); + setGetCurrentClass_api("true"); + setGetCurrentClass_result(res.data.message); + + } + else { + setGetCurrentClass_api("false"); + setGetCurrentClass_message(res.data.message); + } + + }).catch((error) => { + console.warn('Not good man :( GetCurrentClass_trainingsession = ', error); + setGetCurrentClass_api("false"); + //setmyApimyApiMessage("") + }) + } + + + const handleAccountCreation = () => { + history.push("/create_account") + }; + + const handleAccountConnexion = () => { + history.push("/Connexion") + }; + + function handleAccountLogout() { + + if (String(userconnected) === String("1")) { + user_logout(); + } + else if (String(partnerconnected) === String("1")) { + part_logout(); + } + } + + + function part_logout_confirmation() { + /* si c'est une connexion partner qui est active */ + if (typeof (stored_part) != "undefined") { + setCookie_part("tokenmysypart", "", { path: '/' }); + } + history.push("/recherche-formation"); + } + + function part_logout() { + confirmAlert({ + title: '', + message: 'Confirmez la deconnexion (pro)', + buttons: [ + { + label: 'Oui', + onClick: () => part_logout_confirmation() + }, + { + label: 'Non', + onClick: () => { return } + } + ] + }); + } + + + function user_logout_confirmation() { + /* si c'est une connexion partner qui est active */ + if (typeof (stored_user) != "undefined") { + setCookie("tokenmysych", ""); + } + history.push("/recherche-formation"); + } + + function user_logout() { + confirmAlert({ + title: '', + message: 'Confirmez la deconnexion (user)', + buttons: [ + { + label: 'Oui', + onClick: () => user_logout_confirmation() + }, + { + label: 'Non', + onClick: () => { return } + } + ] + }); + } + + + function Close_info_form() { + setinscritpion(""); + + {/* + document.getElementById('mob_block_cross_sell_cat').style.display = "flex"; + if (window.screen.width < 601) { + var meme_orga_top = document.getElementById('mob_block_cross_sell_cat').style.top; + var displaydetailclass_new_v2_hei = document.getElementById('mobile').style.height; + var sticky_div_hilight_top = document.getElementById('sticky_div_hilight_pave').style.top; + + var new_meme_orga_top = parseInt(meme_orga_top) - 900; + var new_displaydetailclass_new_v2_hei = parseInt(displaydetailclass_new_v2_hei) - 900; + var new_sticky_div_hilight_top = parseInt(sticky_div_hilight_top) - 900; + + + document.getElementById('mob_block_cross_sell_cat').style.top = new_meme_orga_top + "px"; + document.getElementById('mobile').style.height = new_displaydetailclass_new_v2_hei + "px"; + document.getElementById('sticky_div_hilight_pave').style.top = new_sticky_div_hilight_top + "px"; + + + } + + + else if (window.screen.width >= 601 && window.screen.width <= 991) { + var meme_orga_top = document.getElementById('block_crossell_meme_orga').style.top; + var displaydetailclass_new_v2_hei = document.getElementById('desktop').style.height; + var new_meme_orga_top = parseInt(meme_orga_top) - 900; + var new_displaydetailclass_new_v2_hei = parseInt(displaydetailclass_new_v2_hei) - 900; + + document.getElementById('block_crossell_meme_orga').style.top = new_meme_orga_top + "px"; + document.getElementById('desktop').style.height = new_displaydetailclass_new_v2_hei + "px"; + + } + else if (window.screen.width >= 992 && window.screen.width <= 1199) { + var meme_orga_top = document.getElementById('block_crossell_meme_orga').style.top; + var displaydetailclass_new_v2_hei = document.getElementById('desktop').style.height; + var new_meme_orga_top = parseInt(meme_orga_top) - 500; + var new_displaydetailclass_new_v2_hei = parseInt(displaydetailclass_new_v2_hei) - 500; + + document.getElementById('block_crossell_meme_orga').style.top = new_meme_orga_top + "px"; + document.getElementById('desktop').style.height = new_displaydetailclass_new_v2_hei + "px"; + } + else if (window.screen.width >= 1200) { + var meme_orga_top = document.getElementById('block_crossell_meme_orga').style.top; + var displaydetailclass_new_v2_hei = document.getElementById('desktop').style.height; + var new_meme_orga_top = parseInt(meme_orga_top) - 500; + var new_displaydetailclass_new_v2_hei = parseInt(displaydetailclass_new_v2_hei) - 500; + + document.getElementById('block_crossell_meme_orga').style.top = new_meme_orga_top + "px"; + document.getElementById('desktop').style.height = new_displaydetailclass_new_v2_hei + "px"; + + + } + */} + window.scrollTo({ + top: 0, + behavior: "smooth", + }); + + } + + function Close_inscrip_form() { + setinscritpion(); + {/* document.getElementById('mob_block_cross_sell_cat').style.display = "flex"; + + if (window.screen.width < 601) { + var meme_orga_top = document.getElementById('mob_block_cross_sell_cat').style.top; + var displaydetailclass_new_v2_hei = document.getElementById('mobile').style.height; + var sticky_div_hilight_top = document.getElementById('sticky_div_hilight_pave').style.top; + + var new_meme_orga_top = parseInt(meme_orga_top) - 900; + var new_displaydetailclass_new_v2_hei = parseInt(displaydetailclass_new_v2_hei) - 900; + var new_sticky_div_hilight_top = parseInt(sticky_div_hilight_top) - 900; + + document.getElementById('mob_block_cross_sell_cat').style.top = new_meme_orga_top + "px"; + document.getElementById('mobile').style.height = new_displaydetailclass_new_v2_hei + "px"; + document.getElementById('sticky_div_hilight_pave').style.top = new_sticky_div_hilight_top + "px"; + } + else if (window.screen.width >= 601 && window.screen.width <= 991) { + var meme_orga_top = document.getElementById('block_crossell_meme_orga').style.top; + var displaydetailclass_new_v2_hei = document.getElementById('desktop').style.height; + var new_meme_orga_top = parseInt(meme_orga_top) - 900; + var new_displaydetailclass_new_v2_hei = parseInt(displaydetailclass_new_v2_hei) - 900; + + document.getElementById('block_crossell_meme_orga').style.top = new_meme_orga_top + "px"; + document.getElementById('desktop').style.height = new_displaydetailclass_new_v2_hei + "px"; + + } + else if (window.screen.width >= 992 && window.screen.width <= 1199) { + var meme_orga_top = document.getElementById('block_crossell_meme_orga').style.top; + var displaydetailclass_new_v2_hei = document.getElementById('desktop').style.height; + var new_meme_orga_top = parseInt(meme_orga_top) - 500; + var new_displaydetailclass_new_v2_hei = parseInt(displaydetailclass_new_v2_hei) - 500; + + document.getElementById('block_crossell_meme_orga').style.top = new_meme_orga_top + "px"; + document.getElementById('desktop').style.height = new_displaydetailclass_new_v2_hei + "px"; + } + else if (window.screen.width >= 1200) { + var meme_orga_top = document.getElementById('block_crossell_meme_orga').style.top; + var displaydetailclass_new_v2_hei = document.getElementById('desktop').style.height; + var new_meme_orga_top = parseInt(meme_orga_top) - 500; + var new_displaydetailclass_new_v2_hei = parseInt(displaydetailclass_new_v2_hei) - 500; + + document.getElementById('block_crossell_meme_orga').style.top = new_meme_orga_top + "px"; + document.getElementById('desktop').style.height = new_displaydetailclass_new_v2_hei + "px"; + + + } + +*/} + window.scrollTo({ + top: 0, + behavior: "smooth", + }); + + } + + + const [expanded, setExpanded] = React.useState(false); + + const handleChange = (panel) => (event, isExpanded) => { + setExpanded(isExpanded ? panel : false); + }; + + const myRef_informe = useRef(null) + + const [Dialog_contact_message, setDialog_contact_message] = React.useState(false); + const [Dialog_contact_open, setDialog_contact_open] = React.useState(false); + function Dialog_contact_handle_change_participant_session(message) { + setDialog_contact_message(message); + setDialog_contact_open(true); + } + + const Dialog_contact_handleClose = () => { + + }; + + const Dialog_contact_handleClose_buton = () => { + + setDialog_contact_open(false); + clear_contact_message_fields(); + + }; + + const [contact_message_nom_prenom, setcontact_message_nom_prenom] = React.useState(""); + const [contact_message_email, setcontact_message_email] = React.useState(""); + const [contact_message_phone, setcontact_message_phone] = React.useState(""); + const [contact_message_sujet, setcontact_message_sujet] = React.useState(""); + const [contact_message_message, setcontact_message_message] = React.useState(""); + + function clear_contact_message_fields() { + setcontact_message_nom_prenom(""); + setcontact_message_email(""); + setcontact_message_phone(""); + setcontact_message_sujet(""); + setcontact_message_sujet(""); + setcontact_message_message(""); + } + + function Send_Contact_Message(e) { + + var sender_mail = ""; + var sender_tel = ""; + var token = ""; + + ////console.log("contacter " + sender_mail + " - " + sender_tel + " - ") + + var mysubject = contact_message_sujet; + var mymessage = contact_message_message; + var mysender_name = contact_message_nom_prenom; + var mysender_email = contact_message_email; + + + //alert("contacter "+mysender_email+" - "+mymessage+" - url = " + //+process.env.REACT_APP_API_URL+" - user_ip ="+IPv4+" - "+latitude); + + var re = /\S+@\S+\.\S+/; + if (re.test(mysender_email) == false) { + alert("l'email est incorrecte"); + return; + } + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/add_user_message/"; + var form = new FormData(); + form.append("type", "email"); + form.append("recever_mail", "contact@mysy-training.com"); + form.append("recever_tel", "+33769203945"); + form.append("sender_mail", mysender_email); + form.append("sender_tel", sender_tel); + form.append("object", mysubject); + form.append("message", mymessage); + form.append("sender_name", mysender_name); + form.append("token", ""); + form.append("user_ip", IPv4); + form.append("user_country_code", country_code); + form.append("user_country_name", country_name); + form.append("user_city", city); + form.append("user_postal", postal); + form.append("user_latitude", latitude); + form.append("user_longitude", longitude); + form.append("user_state", state); + + + // console.log("## form = ", form); + + + + axios.post(myurl, form).then(res => { + + if (String(res.data.status) === String("false")) { + + alert(res.data.message); + } + + else if (String(res.data.status) === String("true")) { + Dialog_contact_handleClose_buton(); + alert(res.data.message); + + } + else { + + } + }).catch((error) => { + console.warn('contact-nous Not good man :( mysearchtext = '); + + }) + } + + + const [Download_one_attached_document_no_token_api, setDownload_one_attached_document_no_token_api] = useState(); + const [Download_one_attached_document_no_token_result, setDownload_one_attached_document_no_token_result] = useState(); + const [Download_one_attached_document_no_token_message, setDownload_one_attached_document_no_token_message] = useState(); + + const Download_one_attached_document_no_token = (event) => { + + var nom_fiche_detaillee = "Fiche_catalogue.pdf"; + var file_name = event.target.id; + + + var url = process.env.REACT_APP_API_URL + "myclass/api/Get_Stored_Downloaded_File_From_Id_WITHOUT_TOKEN/" + file_name; + + //console.log(" ### url = ", url); + + + axios.get(url, { responseType: 'blob', },) + .then((res) => { + fileDownload(res.data, nom_fiche_detaillee); + setDownload_one_attached_document_no_token_api("true"); + }).catch((error) => { + console.error('Error:', error); + setDownload_one_attached_document_no_token_api("false"); + + }); + } + + + + /// ---- + return ( + +
+ + + + + + {`${DetailTraining["title"]}`} + + + {/*** GESTION Contact */} + + + Contactez Nous + + + +
+
+ Nom & Prénom +
+
+ + { + setcontact_message_nom_prenom(e.target.value); + }} + className='form-control formInput' + placeholder='Nom' + > +
+
+ +
+
+ E-mail +
+
+ { + setcontact_message_email(e.target.value); + }} + className='form-control formInput' + placeholder='Adresse email' + > +
+
+ + +
+
+ Téléphone +
+
+ { + setcontact_message_phone(e.target.value); + }} + className='form-control formInput' + placeholder='Numéro Tél' + > +
+
+ +
+
+ Sujet +
+
+ { + setcontact_message_sujet(e.target.value); + }} + className='form-control formInput' + placeholder='Sujet' + > +
+
+ +
+
+ Votre message +
+
+ +
+
+ +
+ +
MySy Training Technology
+
+
+ + Adresse : 1 Cr du Havre, 75008 Paris
+ Adresse email : + contact@mysy-training.com
+ + Téléphone fixe : +331 77 00 38 57
+
+ +
+ + +
+ + +
+
+ +
+
+ + +
+
+ +
+ + +
+ {/*** FIN GESTION Contact */} + +
+ +
+ +
+
+
+ +
+
+ {DetailTraining["title"]} +
+ +
+
+ +
+
+ +
+ +
+ + {String(ismetiermanaged) !== "0" && String(ismetiermanaged) !== "1" &&
+ + {(!DetailTraining.img_url || String(DetailTraining.img_url).length <= 0) && + DetailTraining.metier && String(DetailTraining.metier).toLocaleLowerCase() === String("it") && + informatique} + + + {(!DetailTraining.img_url || String(DetailTraining.img_url).length <= 0) && + DetailTraining.metier && String(DetailTraining.metier).toLocaleLowerCase() === String("graphisme") && + graphisme} + + {(!DetailTraining.img_url || String(DetailTraining.img_url).length <= 0) && + DetailTraining.metier && String(DetailTraining.metier).toLocaleLowerCase() === String("management") && + management} + + {(!DetailTraining.img_url || String(DetailTraining.img_url).length <= 0) && + DetailTraining.metier && String(DetailTraining.metier).toLocaleLowerCase() === String("digital") && + digital} + + {(!DetailTraining.img_url || String(DetailTraining.img_url).length <= 0) && + DetailTraining.metier && String(DetailTraining.metier).toLocaleLowerCase() === String("office") && + office} + + {(!DetailTraining.img_url || String(DetailTraining.img_url).length <= 0) && + DetailTraining.metier && String(DetailTraining.metier).toLocaleLowerCase() === String("rh") && + ressources humaines} + + {(!DetailTraining.img_url || String(DetailTraining.img_url).length <= 0) && + DetailTraining.metier && String(DetailTraining.metier).toLocaleLowerCase() === String("vente") && + vente} + + {(!DetailTraining.img_url || String(DetailTraining.img_url).length <= 0) && + DetailTraining.metier && String(DetailTraining.metier).toLocaleLowerCase() === String("dev_perso") && + developpement personnel} + + + +
} + + {String(ismetiermanaged) === "0" &&
+ autre + +
} + + {String(ismetiermanaged) === "1" &&
+ autre +
} +
+ + +
+ + {String(DetailTraining["price"]) && String(DetailTraining["price"]) === String("0") && +
+
Gratuit +
+
Eligible CPF +
+
+ } + + {String(DetailTraining["price"]) && String(DetailTraining["price"]) !== String("0") && String(DetailTraining["price"]) === String("0") && (!DetailTraining.business_prices || Object.keys(DetailTraining.business_prices).length <= 0) + && DetailTraining["price"] && +
+ {String(DetailTraining["price"])} € HT +
} + + {String(DetailTraining["price"]) && String(DetailTraining["price"]) !== String("0") && DetailTraining.business_prices && Object.keys(DetailTraining.business_prices).length > 0 + && DetailTraining["price"] &&
+ + + {DetailTraining.business_prices && DetailTraining.business_prices.length > 0 &&
+ + +
} +
} + +
+ +
+ {String(action).toLowerCase() !== "information" && String(action).toLowerCase() !== "inscription" && +
+ +
+ +
+ M'inscrire +
+ +
+ +
+ +
+ M'informer + +
+ + +
+ +
} + +
+
+ +
+ +
+ Caractéristiques +
+ +
+ + + +
+ +
+ + + +
+ +
+ {DetailTraining.presentiel && DetailTraining.presentiel.distantiel === "1" && " Oui "} + {DetailTraining.presentiel && DetailTraining.presentiel.distantiel === "0" && " Non "} +
+ + +
+ + +
+ +
+ + + +
+ +
+ {DetailTraining.presentiel && DetailTraining.presentiel.presentiel === "1" && " Oui "} + {DetailTraining.presentiel && DetailTraining.presentiel.presentiel === "0" && " Non "} +
+ + +
+ + + +
+ +
+ + +
+ + {String(DetailTraining["duration_unit"]) !== "user_rythme" && +
+ {DetailTraining["duration"]} {DetailTraining["duration_unit"]}(s) +
+ } + + {String(DetailTraining["duration_unit"]) === "user_rythme" && +
+ A votre rythme +
+ } + +
+ + +
+ +
+ + + + +
+ +
+ {DetailTraining["certif"] && String(DetailTraining["certif"]) !== String("1") && " Non " + } + {DetailTraining["certif"] && String(DetailTraining["certif"]) === String("1") && " Oui " + } +
+ + +
+ + +
+ +
+ + + + +
+ +
+ {DetailTraining["support"] && } + {!DetailTraining["support"] && "Non précisé"} + +
+
+ +
+ + + + + +
+ +
+ +
+
+ Organisme de formation +
+ +
+ {partnair_name && } +
+ +
+
+ +
+ social Mysy Training Facebook + +
+ +
+ social Mysy Training LinkedIn + +
+ +
+ social Mysy Training X (twitter) + + +
+ +
+ +
+
+ + < nav ref={myRef_informe} id="myRef_informe"> + + {(String(inscritpion) === "2" || String(inscritpion) === "1") && +
+
+ +
+ +
+ + {String(inscritpion) === "2" &&
+ + + +
+ } + {String(inscritpion) === "1" &&
+ + +
+ + } + +
+ + +
+
+
} + + + +
+
+ +
+ +
+ + +
+ Description +
+ + +
+ {parse(String(DetailTraining["description"]))} +
+
+ + +
+
+
+ + +
+
+ +
+ + {GetCurrentClass_result && GetCurrentClass_result.length > 0 && +
+ +
+ Les sessions +
+ +
+
    + + + {GetCurrentClass_result && GetCurrentClass_result.slice(0, 5).map((formation) => ( +
  • + {(JSON.parse(formation).session_ondemande) && (JSON.parse(formation).session_ondemande) === "1" && } + + {(!(JSON.parse(formation).session_ondemande) || (JSON.parse(formation).session_ondemande) === "0") && } +
  • + + ))} + +
+
+ +
} + +
+
+
+ + +
+
+ +
+
+ +
+ Objectif +
+ + {DetailTraining["objectif"] &&
+ {parse(String(DetailTraining["objectif"]))} +
+ } + +
+ + +
+
+
+ +
+
+ + +
+ +
+ Programme +
+ + {DetailTraining["programme"] &&
+ {parse(String(DetailTraining["programme"]))}sticky_div_hilight +
+ } +
+ +
+
+ +
+
+ + {DetailTraining["tab_ue_detail_data"] && DetailTraining["tab_ue_detail_data"].length > 0 && < div className="mob_info_page_title_desc_long_txt" > +
+ Modules +
+ + + {DetailTraining["tab_ue_detail_data"] &&
+ +
+ {DetailTraining["tab_ue_detail_data"] && DetailTraining["tab_ue_detail_data"].map((val) => ( +
+ + + } + aria-controls={val._id} + id={val._id} + > + + + {val.titre} + + + + +
{parse(String(val.description).replace(/(<([^>]+)>)/ig, ''))}
+ +
+
+
+ + +
+ ))} +
+ +
} + +
} +
+
+ +
+
+ {DetailTraining["pourqui"] &&
+ +
+ Pour Qui +
+ + {DetailTraining["pourqui"] &&
+ {parse(String(DetailTraining["pourqui"]))} +
+ } + +
} + + +
+
+ + +
+
+ {DetailTraining["prerequis"] &&
+ +
+ Pré-requis +
+ + {DetailTraining["prerequis"] &&
+ {parse(String(DetailTraining["prerequis"]))} +
+ } + +
} + + +
+
+ +
+ +
+
+   +
+
+ +
+
+
+ +
+ +
+ + {associatedtraining_message && associatedtraining_message.length > 0 && +
+ Cela pourrait aussi vous intéresser +
} + +
+ + {associatedtraining_message && String(associatedtraining_api) === "True" && + associatedtraining_message.slice(0, 3).map((formation) => ( + +
+ +
+ + {JSON.parse(formation).metier && String(JSON.parse(formation).metier).toLocaleLowerCase() === String("it") && + informatique} + + {JSON.parse(formation).metier && String(JSON.parse(formation).metier).toLocaleLowerCase() === String("graphisme") && + graphisme} + + {JSON.parse(formation).metier && String(JSON.parse(formation).metier).toLocaleLowerCase() === String("management") && + management} + + {JSON.parse(formation).metier && String(JSON.parse(formation).metier).toLocaleLowerCase() === String("digital") && + digital} + + {JSON.parse(formation).metier && String(JSON.parse(formation).metier).toLocaleLowerCase() === String("office") && + office} + + {JSON.parse(formation).metier && String(JSON.parse(formation).metier).toLocaleLowerCase() === String("rh") && + ressources humaines} + + {JSON.parse(formation).metier && String(JSON.parse(formation).metier).toLocaleLowerCase() === String("vente") && + vente} + + {JSON.parse(formation).metier && String(JSON.parse(formation).metier).toLocaleLowerCase() === String("sport") && + sport} + + {JSON.parse(formation).metier && String(JSON.parse(formation).metier).toLocaleLowerCase() === String("sante_nat") && + sante naturelle} + + + {JSON.parse(formation).metier && String(JSON.parse(formation).metier).toLocaleLowerCase() === String("dev_perso") && + developpement personnel} + + {!JSON.parse(formation).metier && autre personnel} + +
+ +
+
+ {JSON.parse(formation).cpf && (String(JSON.parse(formation).cpf)) === "1" && + "Éligible au CPF"} + + {!JSON.parse(formation).cpf || String(JSON.parse(formation).cpf) !== "1" && + "NON Éligible au CPF"} + +
+ +
+ + +
+ +
+ {JSON.parse(formation).note && String(JSON.parse(formation).note).length === 1 && + parseInt(String(JSON.parse(formation).note)) <= 5 && + } +
+ +
+ {parse(String(JSON.parse(formation).title))} +
+ + {JSON.parse(formation).price &&
+ {(String(JSON.parse(formation).price))} € HT + +
} + + +
+ +
+ +
{ + e.preventDefault(); + //test(props.formation.external_code); + window.open( + "/Display-Detail-formation/" + JSON.parse(formation).internal_url, + '_self' + ); + + + }}> +
+ Voir les détails +
+ +
+ + +
+ +
+ ))} + +
+ +
+
+
+ +
+
+ +
+ + + + +
+ + +
+
+ + +
+ +
+
+
+ +
+ {ratingvalue && String(ratingvalue).length > 0 && + parseInt(String(ratingvalue)) <= 5 && + } +
+ +
+ {DetailTraining["title"]} +
+ +
+ +
+ {DetailTraining["cpf"] && String(DetailTraining["cpf"]) === "1" && + "Éligible au CPF"} + + {!DetailTraining["cpf"] || String(DetailTraining["cpf"]) !== "1" && + "NON Éligible au CPF"} +
+ +
+ +
+ + + +
+
+ +
+ + + + +
+
+
+ + {String(inscritpion) === "1" &&
+ +
+ + } + + {String(inscritpion) === "2" &&
+ + +
+ + } + + {(String(action).toLocaleLowerCase() === "inscription" || String(action).toLocaleLowerCase() === "information") + && String(action).toLocaleLowerCase() !== "evaluation" + &&
+ + +
+ } + + {String(action).toLocaleLowerCase() !== "inscription" && String(action).toLocaleLowerCase() !== "information" && String(tokenEval_api) === "true" + &&
+ + + +
+ } + + + +
+ {Get_Class_Catalogue_File_result && Get_Class_Catalogue_File_result.length > 0 &&
+ + + +
} + + +
+
Description + +
+ {DetailTraining["description"] &&
+ {parse(String(DetailTraining["description"]))} + +
+ } +
+
+ + {GetCurrentClass_result && GetCurrentClass_result.length > 0 && +
+
+ Les sessions + +
+
+
    + + {GetCurrentClass_result && GetCurrentClass_result.slice(0, 5).map((formation) => ( + + +
  • + + {(JSON.parse(formation).session_ondemande) && (JSON.parse(formation).session_ondemande) === "1" && } + + {(!(JSON.parse(formation).session_ondemande) || (JSON.parse(formation).session_ondemande) === "0") && } +
  • + + ))} + +
+
+ +
+ } + +
+
+
+ Objectif +
+ {DetailTraining["objectif"] &&
+ {parse(String(DetailTraining["objectif"]))} + +
+ } + +
+ + +
+ + +
+
+ Programme +
+ {DetailTraining["programme"] &&
+ {parse(String(DetailTraining["programme"]))} + +
+ } +
+ + +
+ {DetailTraining["tab_ue_detail_data"] && DetailTraining["tab_ue_detail_data"].length > 0 && < div className="block_info_page_pave_title_desc_long_text" > +
+ Modules +
+ + + {DetailTraining["tab_ue_detail_data"] &&
+ +
+ {DetailTraining["tab_ue_detail_data"] && DetailTraining["tab_ue_detail_data"].map((val) => ( +
+ + + } + aria-controls={val._id} + id={val._id} + > + + + {val.titre} + + + + +
{parse(String(val.description).replace(/(<([^>]+)>)/ig, ''))}
+ +
+
+
+ + +
+ ))} +
+ +
} + +
} + +
+ + {DetailTraining["pourqui"] && String(DetailTraining["pourqui"]).length > 2 &&
+
+ Pour Qui +
+ {DetailTraining["pourqui"] &&
+ {parse(String(DetailTraining["pourqui"]))} + + +
+ } +
} + +
+ + {DetailTraining["prerequis"] && String(DetailTraining["prerequis"]).length > 2 &&
+
+ Pré-requis +
+ {DetailTraining["prerequis"] &&
+ {parse(String(DetailTraining["prerequis"]))} + + +
+ + } +
} + + +
+ + {DetailTraining["plus_produit"] && String(DetailTraining["plus_produit"]).length > 2 &&
+
+ Points forts +
+ {DetailTraining["plus_produit"] &&
+ {parse(String(DetailTraining["plus_produit"]))} + + +
+ + } +
} + + + + +
+ +
+ + {/****** Stick droire */} +
+
+ + +
+ + + {class_img_stored_in_bdd && String(class_img_stored_in_bdd).length > 50 &&
+ + +
+ } + + {(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50) && String(ismetiermanaged) !== "0" && String(ismetiermanaged) !== "1" &&
+ + {(!DetailTraining.img_url || String(DetailTraining.img_url).length <= 0) && + DetailTraining.metier && String(DetailTraining.metier).toLocaleLowerCase() === String("it") && + informatique} + + + {(!DetailTraining.img_url || String(DetailTraining.img_url).length <= 0) && + DetailTraining.metier && String(DetailTraining.metier).toLocaleLowerCase() === String("graphisme") && + graphisme} + + {(!DetailTraining.img_url || String(DetailTraining.img_url).length <= 0) && + DetailTraining.metier && String(DetailTraining.metier).toLocaleLowerCase() === String("management") && + management} + + {(!DetailTraining.img_url || String(DetailTraining.img_url).length <= 0) && + DetailTraining.metier && String(DetailTraining.metier).toLocaleLowerCase() === String("digital") && + digital} + + {(!DetailTraining.img_url || String(DetailTraining.img_url).length <= 0) && + DetailTraining.metier && String(DetailTraining.metier).toLocaleLowerCase() === String("office") && + office} + + {(!DetailTraining.img_url || String(DetailTraining.img_url).length <= 0) && + DetailTraining.metier && String(DetailTraining.metier).toLocaleLowerCase() === String("rh") && + ressources humaines} + + {(!DetailTraining.img_url || String(DetailTraining.img_url).length <= 0) && + DetailTraining.metier && String(DetailTraining.metier).toLocaleLowerCase() === String("vente") && + vente} + + {(!DetailTraining.img_url || String(DetailTraining.img_url).length <= 0) && + DetailTraining.metier && String(DetailTraining.metier).toLocaleLowerCase() === String("sport") && + sport} + + {(!DetailTraining.img_url || String(DetailTraining.img_url).length <= 0) && + DetailTraining.metier && String(DetailTraining.metier).toLocaleLowerCase() === String("sante_nat") && + sante naturelle} + + {(!DetailTraining.img_url || String(DetailTraining.img_url).length <= 0) && + DetailTraining.metier && String(DetailTraining.metier).toLocaleLowerCase() === String("dev_perso") && + developpement personnel} + + +
} + + {(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50) && String(ismetiermanaged) === "0" &&
+ autre + +
} + + {(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50) && String(ismetiermanaged) === "1" &&
+ autre + +
} + + + + + {String(DetailTraining["price"]) && String(DetailTraining["price"]) === String("0") && +
+
Gratuit +
+ + {DetailTraining["cpf"] && String(DetailTraining["cpf"]) === "1" &&
Éligible CPF
} + {(!DetailTraining["cpf"] || String(DetailTraining["cpf"]) !== "1") &&
Non Élig. CPF
} +
+ } + + {String(DetailTraining["price"]) && String(DetailTraining["price"]) !== String("0") && (!DetailTraining.business_prices || Object.keys(DetailTraining.business_prices).length <= 0) + && DetailTraining["price"] &&
+
{String(DetailTraining["price"])} € HT +
+ + {DetailTraining["cpf"] && String(DetailTraining["cpf"]) === "1" &&
Éligible CPF
} + {(!DetailTraining["cpf"] || String(DetailTraining["cpf"]) !== "1") &&
Non Élig. CPF
} + + + +
} + + {String(DetailTraining["price"]) && String(DetailTraining["price"]) !== String("0") && DetailTraining.business_prices && Object.keys(DetailTraining.business_prices).length > 0 + && DetailTraining["price"] && +
+
+ +
+
Eligle CFP +
+ + {DetailTraining.business_prices && DetailTraining.business_prices.length > 0 &&
+ + +
} + +
} + +
+ +
Caractéristiques
+ + +
+
    + + + +
    + +
    + + + + + +
    + {String(DetailTraining["duration_unit"]) !== "user_rythme" && +
    + {DetailTraining["duration"]}  {DetailTraining["duration_unit"]}(s) + +
    + } + + {String(DetailTraining["duration_unit"]) === "user_rythme" && +
    + VR + +
    + } + +
    + + +
    + +
    + + + + + +
    + +
    + {DetailTraining["certif"] && String(DetailTraining["certif"]) !== String("1") &&
    + + Non  
    + } + {DetailTraining["certif"] && String(DetailTraining["certif"]) === String("1") &&
    + + Oui  
    + } + +
    + + +
    + + +
    + +
    + + + +
    + +
    + {DetailTraining.presentiel && DetailTraining.presentiel.distantiel === "1" &&
    Oui
    } + {DetailTraining.presentiel && DetailTraining.presentiel.distantiel !== "1" &&
    Non
    } + +
    + + +
    + + +
    + +
    + + + +
    + +
    + {DetailTraining.presentiel && DetailTraining.presentiel.presentiel === "1" &&
    Oui
    } + {DetailTraining.presentiel && DetailTraining.presentiel.presentiel !== "1" &&
    Non
    } + +
    + + +
    + + +
    + +
    + +
    + +
    + {DetailTraining["support"] &&
    + + {String(DetailTraining["support"]).charAt(0).toUpperCase() + String(DetailTraining["support"]).slice(1)}
    + } + {!DetailTraining["support"] &&
    + + Non précisé
    + } + +
    +
    +
+ +
+ + +
+
+ + + + {String(action).toLowerCase() !== "information" && String(action).toLowerCase() !== "inscription" &&
+ +
+ +
+
M’inscrire
+
+ +
+
+
M’informer
+
+ +
} + +
+ {String(isqualiopi) === "1" &&
+ +
+ Qualiopi +
+ +
} + {String(isqualiopi) === "1" &&
} + + {String(isdatadock) === "1" &&
+
+ DataDock + +
+ +
} + {String(isdatadock) === "1" &&
} + +
+ {String(iscertifvoltaire) === "1" &&
+ Certitrace + +
} + + +
+ + + +
+ +
+ Organisme de formation +
+ +
+ + {partnair_name && } +
+ +
+ +
+ + +
+ social Mysy Training Facebook +
+ +
+ social Mysy Training LinkedIn +
+ +
+ social Mysy Training X (twitter) + +
+
+ + + + +
+ + +
+ +
+ +
+ + +
+
+ {associatedtraining_message && String(associatedtraining_api) === "True" && associatedtraining_message.length > 0 && +
Cela pourrait aussi vous intéresser
} + +
+ {associatedtraining_message && String(associatedtraining_api) === "True" && + associatedtraining_message.slice(0, 3).map((formation) => ( +
+
+
+ + {JSON.parse(formation).metier && String(JSON.parse(formation).metier).toLocaleLowerCase() === String("it") && + informatique} + + {JSON.parse(formation).metier && String(JSON.parse(formation).metier).toLocaleLowerCase() === String("graphisme") && + graphisme} + + {JSON.parse(formation).metier && String(JSON.parse(formation).metier).toLocaleLowerCase() === String("management") && + management} + + {JSON.parse(formation).metier && String(JSON.parse(formation).metier).toLocaleLowerCase() === String("digital") && + digital} + + {JSON.parse(formation).metier && String(JSON.parse(formation).metier).toLocaleLowerCase() === String("office") && + office} + + {JSON.parse(formation).metier && String(JSON.parse(formation).metier).toLocaleLowerCase() === String("rh") && + ressources humaines} + + {JSON.parse(formation).metier && String(JSON.parse(formation).metier).toLocaleLowerCase() === String("vente") && + vente} + + {JSON.parse(formation).metier && String(JSON.parse(formation).metier).toLocaleLowerCase() === String("sport") && + sport} + + {JSON.parse(formation).metier && String(JSON.parse(formation).metier).toLocaleLowerCase() === String("sante_nat") && + sante naturelle} + + + {JSON.parse(formation).metier && String(JSON.parse(formation).metier).toLocaleLowerCase() === String("dev_perso") && + developpement personnel} + + {!JSON.parse(formation).metier && autre personnel} + + +
+ +
+ + {JSON.parse(formation).cpf && (String(JSON.parse(formation).cpf)) === "1" && +
+ Éligible CPF
} + + {!JSON.parse(formation).cpf || String(JSON.parse(formation).cpf) !== "1" && +
+ NON Éligible CPF
} + +
+ + +
+ +
+ + {JSON.parse(formation).note && String(JSON.parse(formation).note).length === 1 && + parseInt(String(JSON.parse(formation).note)) <= 5 && + + } +
+ +
{parse(String(JSON.parse(formation).title)).substring(0, 50)} +
+ + {JSON.parse(formation).price &&
+ {(String(JSON.parse(formation).price))} € HT +
} + + +
+ + + +
+
{ + e.preventDefault(); + //test(props.formation.external_code); + window.open( + "/Display-Detail-formation/" + JSON.parse(formation).internal_url, + '_self' + ); + + + }}> +
+ Voir les détails +
+ +
+
+ +
+ +
+ ))} +
+
+
+
+ +
+ ) +} + + +export default New_C_Detail_Formation_2025; \ No newline at end of file diff --git a/src/components/detail_formation_automatic_files/new_detail_formation_2025.js b/src/components/detail_formation_automatic_files/new_detail_formation_2025.js index ca5e0b9..1369242 100644 --- a/src/components/detail_formation_automatic_files/new_detail_formation_2025.js +++ b/src/components/detail_formation_automatic_files/new_detail_formation_2025.js @@ -85,6 +85,8 @@ const New_C_Detail_Formation_2025 = (props) => { const [inscritpion, setinscritpion] = useState(""); const [ratingvalue, setratingvalue] = useState(0); + const [partnaire_tva, setpartnaire_tva] = useState(""); + const [text_size, settext_size] = useState("0"); const socialIconStyles = { @@ -541,6 +543,13 @@ const New_C_Detail_Formation_2025 = (props) => { setratingvalue(JSON.parse(res.data.message).note); } + if (JSON.parse(res.data.message).partnaire_tva) { + setpartnaire_tva(JSON.parse(res.data.message).partnaire_tva); + } else { + setpartnaire_tva(""); + } + + if (JSON.parse(res.data.message).isdatadock) { setisdatadock(JSON.parse(res.data.message).isdatadock); } @@ -1539,15 +1548,32 @@ const New_C_Detail_Formation_2025 = (props) => { {String(DetailTraining["price"]) && String(DetailTraining["price"]) !== String("0") && String(DetailTraining["price"]) === String("0") && (!DetailTraining.business_prices || Object.keys(DetailTraining.business_prices).length <= 0) && DetailTraining["price"] &&
- {String(DetailTraining["price"])} € HT + + {parseFloat(String(DetailTraining["partnaire_tva"])) > 0 && <> {String(DetailTraining["price"])} € HT } + {parseFloat(String(DetailTraining["partnaire_tva"])) <= 0 && <> {String(DetailTraining["price"])} € TTC } + +
} {String(DetailTraining["price"]) && String(DetailTraining["price"]) !== String("0") && DetailTraining.business_prices && Object.keys(DetailTraining.business_prices).length > 0 && DetailTraining["price"] &&
- + {DetailTraining.business_prices && DetailTraining.business_prices.length > 0 &&
- +
}
} @@ -2110,7 +2136,10 @@ const New_C_Detail_Formation_2025 = (props) => {
{JSON.parse(formation).price &&
- {(String(JSON.parse(formation).price))} € HT + + {parseFloat(String(JSON.parse(formation).partnaire_tva)) > 0 && <>{(String(JSON.parse(formation).price))} € HT } + {parseFloat(String(JSON.parse(formation).partnaire_tva)) <= 0 && <>{(String(JSON.parse(formation).price))} € TTC } +
} @@ -2169,8 +2198,8 @@ const New_C_Detail_Formation_2025 = (props) => {
- {ratingvalue && String(ratingvalue).length === 1 && - parseInt(String(ratingvalue)) <= 5 && + {ratingvalue && String(ratingvalue).length > 0 && + parseFloat(String(ratingvalue)) <= 5 && { {String(DetailTraining["price"]) && String(DetailTraining["price"]) !== String("0") && (!DetailTraining.business_prices || Object.keys(DetailTraining.business_prices).length <= 0) && DetailTraining["price"] &&
-
{String(DetailTraining["price"])} € HT + +
+ + {parseFloat(String(DetailTraining["partnaire_tva"])) > 0 && <> {String(DetailTraining["price"])} € HT } + {parseFloat(String(DetailTraining["partnaire_tva"])) <= 0 && <> {String(DetailTraining["price"])} € TTC }
{DetailTraining["cpf"] && String(DetailTraining["cpf"]) === "1" &&
Éligible CPF
} @@ -2569,13 +2602,24 @@ const New_C_Detail_Formation_2025 = (props) => { && DetailTraining["price"] &&
- + +
Eligle CFP
{DetailTraining.business_prices && DetailTraining.business_prices.length > 0 &&
- +
} @@ -2874,7 +2918,7 @@ const New_C_Detail_Formation_2025 = (props) => {
- {JSON.parse(formation).note && String(JSON.parse(formation).note).length === 1 && + {JSON.parse(formation).note && String(JSON.parse(formation).note).length >= 1 && parseInt(String(JSON.parse(formation).note)) <= 5 && {
{JSON.parse(formation).price &&
- {(String(JSON.parse(formation).price))} € HT + + {parseFloat(String(JSON.parse(formation).partnaire_tva)) > 0 && <>{(String(JSON.parse(formation).price))} € HT } + {parseFloat(String(JSON.parse(formation).partnaire_tva)) <= 0 && <>{(String(JSON.parse(formation).price))} € TTC }
} diff --git a/src/components/marketplace_automatic_files/new_marketplace_2025.js b/src/components/marketplace_automatic_files/new_marketplace_2025.js index 98a6fd5..29e08d7 100644 --- a/src/components/marketplace_automatic_files/new_marketplace_2025.js +++ b/src/components/marketplace_automatic_files/new_marketplace_2025.js @@ -3740,7 +3740,7 @@ const New_C_Marketplace_2025 = () => {  
  -
} +
}