10/04/2024 - 22h50
parent
3b779c4563
commit
25dc282bd9
|
@ -771,6 +771,9 @@ const AddClassManual = (props) => {
|
|||
document.getElementsByName("zone_diffusion_v2")[0].value = mylocaltraining.zone_diffusion_str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
getClassImage(mylocaltraining._id);
|
||||
/*
|
||||
* Update 22/10/2023 :
|
||||
Gestion des champs spécifiques. ils commencent tous par 'my_'
|
||||
|
@ -813,6 +816,7 @@ const AddClassManual = (props) => {
|
|||
*/
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
//console.log(" In test res.data.status = "+res.data.status);
|
||||
|
@ -1151,14 +1155,20 @@ const AddClassManual = (props) => {
|
|||
)
|
||||
.then((response) => response.json())
|
||||
.then((result) => {
|
||||
//console.log('Success:', result['message'], "result['status'] = ", result['status']);
|
||||
console.log('Success:', result['message'], "result['status'] = ", result['status'], "result['class_id'] = ", result['class_id']);
|
||||
setLoading(false);
|
||||
setimportmessage(result['message']);
|
||||
setmyApiResponse(result['status']);
|
||||
setdatamodification("0");
|
||||
|
||||
if (String(userimgclassprofilchanged) === "1")
|
||||
sendClassImage();
|
||||
if ( String(result['status']) === "true") {
|
||||
|
||||
var myclass_id = String(result['class_id']);
|
||||
console.log(" ####GRRRRR myclass_id = ", myclass_id);
|
||||
|
||||
if (String(userimgclassprofilchanged) === "1")
|
||||
sendClassImage(myclass_id);
|
||||
}
|
||||
|
||||
//alert(result['status'] + " -- " + myApiResponse + ' mess = ' + result['message']);
|
||||
|
||||
|
@ -1392,6 +1402,8 @@ const AddClassManual = (props) => {
|
|||
const stored_cookie = getCookie('tokenmysypart');
|
||||
form.append("token", stored_cookie);
|
||||
form.append("class_external_code", class_external_code);
|
||||
form.append("related_collection", "myclass");
|
||||
form.append("related_collection_recid", selected_class_id);
|
||||
form.append("type", "partner");
|
||||
setLoading(true);
|
||||
fetch(
|
||||
|
@ -1438,9 +1450,10 @@ const AddClassManual = (props) => {
|
|||
|
||||
const [isimgclassSaved, setisimgclassSaved] = useState("");
|
||||
const [isimgclassSaved_message, setisimgclassSaved_message] = useState("");
|
||||
function sendClassImage(e) {
|
||||
function sendClassImage(local_myclass_id) {
|
||||
|
||||
var class_external_code = "";
|
||||
|
||||
if (document.getElementsByName("external_code")[0].value && document.getElementsByName("external_code")[0].value.length > 3) {
|
||||
class_external_code = document.getElementsByName("external_code")[0].value;
|
||||
} else {
|
||||
|
@ -1448,13 +1461,16 @@ const AddClassManual = (props) => {
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
var formData = new FormData();
|
||||
formData.append('File', isimgclassSelected);
|
||||
const stored_cookie = getCookie('tokenmysypart');
|
||||
formData.append("token", stored_cookie);
|
||||
formData.append("class_external_code", class_external_code);
|
||||
formData.append("related_collection", "myclass");
|
||||
formData.append("related_collection_recid", local_myclass_id);
|
||||
formData.append("type", "myclass");
|
||||
|
||||
formData.append("type", "partner");
|
||||
setLoading(true);
|
||||
fetch(
|
||||
process.env.REACT_APP_API_URL + "myclass/api/recordClassImage/",
|
||||
|
@ -1492,7 +1508,7 @@ const AddClassManual = (props) => {
|
|||
const [myclassimage, setmyclassimage] = useState();
|
||||
const [isclassimage, setisclassimage] = useState();
|
||||
|
||||
function getClassImage(e) {
|
||||
function getClassImage( local_class_id) {
|
||||
var myurl = process.env.REACT_APP_API_URL + "myclass/api/getRecodedClassImage/";
|
||||
|
||||
var class_external_code = props.mytrainingclass['class_external_code'];
|
||||
|
@ -1507,6 +1523,8 @@ const AddClassManual = (props) => {
|
|||
const stored_cookie = getCookie('tokenmysypart');
|
||||
form.append("token", stored_cookie);
|
||||
form.append("type", "partner");
|
||||
form.append("related_collection", "myclass");
|
||||
form.append("related_collection_recid", local_class_id);
|
||||
form.append("class_external_code", class_external_code);
|
||||
|
||||
setLoading(true);
|
||||
|
@ -1595,7 +1613,7 @@ const AddClassManual = (props) => {
|
|||
|
||||
fillfield();
|
||||
if (props.mytrainingclass['class_external_code']) {
|
||||
getClassImage();
|
||||
|
||||
//console.log("props.mytrainingclass['plus_produit'] = " + props.mytrainingclass['plus_produit']);
|
||||
setplus_produit_enabled(props.mytrainingclass['plus_produit']);
|
||||
setmots_cle_enabled(props.mytrainingclass['mots_cle']);
|
||||
|
@ -3594,14 +3612,14 @@ const AddClassManual = (props) => {
|
|||
|
||||
</Box>
|
||||
|
||||
<div style={{ "marginRight":"10px"}}>
|
||||
<div style={{ "marginRight": "10px" }}>
|
||||
<div className="div_row" style={{ "border": "None" }}>
|
||||
<hr className="hr_break" />
|
||||
</div>
|
||||
|
||||
<nav style={{ "border": "None", "fontSize": "22px", "fontWeight": "600" }}> Les pièces jointes </nav>
|
||||
|
||||
<div className="session_data" style={{ "padding": "5px", "marginRight":"10px"}}>
|
||||
<div className="session_data" style={{ "padding": "5px", "marginRight": "10px" }}>
|
||||
<br />
|
||||
|
||||
<div className="div_row" style={{ "padding": "5px", "border": "None" }}>
|
||||
|
|
|
@ -96,7 +96,6 @@ const DisplayDetailClass_new_v2 = (props) => {
|
|||
var form = new FormData();
|
||||
//form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA");
|
||||
|
||||
|
||||
form.append("eval_token", action);
|
||||
form.append("class_internal_url", classId);
|
||||
|
||||
|
@ -129,7 +128,7 @@ const DisplayDetailClass_new_v2 = (props) => {
|
|||
|
||||
async function funclocaltoken() {
|
||||
|
||||
|
||||
|
||||
if (action && String(action).toLocaleLowerCase() !== "inscription" &&
|
||||
String(action).toLocaleLowerCase() !== "information") {
|
||||
|
||||
|
@ -174,12 +173,12 @@ const DisplayDetailClass_new_v2 = (props) => {
|
|||
}
|
||||
fetchData();
|
||||
|
||||
|
||||
|
||||
GetCurrentClass_trainingsession();
|
||||
Display();
|
||||
Display();
|
||||
GetAssociatedTraning();
|
||||
|
||||
|
||||
|
||||
funclocaltoken();
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
|
@ -290,6 +289,59 @@ const DisplayDetailClass_new_v2 = (props) => {
|
|||
|
||||
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("");
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function Display(e) {
|
||||
var myurl = process.env.REACT_APP_API_URL + "myclass/api/get_class/";
|
||||
|
@ -339,8 +391,8 @@ const DisplayDetailClass_new_v2 = (props) => {
|
|||
//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);
|
||||
// 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) {
|
||||
|
@ -411,6 +463,9 @@ const DisplayDetailClass_new_v2 = (props) => {
|
|||
setDetailTraining(JSON.parse(res.data.message));
|
||||
|
||||
|
||||
getClassImage_no_token(JSON.parse(res.data.message)._id, JSON.parse(res.data.message).external_code);
|
||||
|
||||
|
||||
if (JSON.parse(res.data.message).note) {
|
||||
setratingvalue(JSON.parse(res.data.message).note);
|
||||
}
|
||||
|
@ -902,7 +957,7 @@ const DisplayDetailClass_new_v2 = (props) => {
|
|||
|
||||
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);
|
||||
// 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);
|
||||
|
@ -2074,8 +2129,15 @@ const DisplayDetailClass_new_v2 = (props) => {
|
|||
<nav className="discount_block"> (- {String(DetailTraining.business_prices[0].discount)} % ) </nav>
|
||||
</div>}
|
||||
|
||||
|
||||
{class_img_stored_in_bdd && String(class_img_stored_in_bdd).length > 50 && <div className="block_sticky_info_img">
|
||||
|
||||
<img src={class_img_stored_in_bdd} className="training_img" />
|
||||
</div>
|
||||
}
|
||||
|
||||
{String(ismetiermanaged) !== "0" && String(ismetiermanaged) !== "1" && <div className="block_sticky_info_img">
|
||||
|
||||
{(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50 ) && String(ismetiermanaged) !== "0" && String(ismetiermanaged) !== "1" && <div className="block_sticky_info_img">
|
||||
|
||||
{(!DetailTraining.img_url || String(DetailTraining.img_url).length <= 0) &&
|
||||
DetailTraining.metier && String(DetailTraining.metier).toLocaleLowerCase() === String("it") &&
|
||||
|
@ -2121,12 +2183,12 @@ const DisplayDetailClass_new_v2 = (props) => {
|
|||
|
||||
</div>}
|
||||
|
||||
{String(ismetiermanaged) === "0" && <div className="block_sticky_info_img">
|
||||
{(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50 ) && String(ismetiermanaged) === "0" && <div className="block_sticky_info_img">
|
||||
<img src={img_met_autre} alt="autre" className="training_img" />
|
||||
|
||||
</div>}
|
||||
|
||||
{String(ismetiermanaged) === "1" && <div className="">
|
||||
{(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50 ) && String(ismetiermanaged) === "1" && <div className="">
|
||||
<img src={DetailTraining.img_url} alt="autre" className="" style={{ "maxWidth": "100%" }} />
|
||||
|
||||
</div>}
|
||||
|
|
|
@ -86,56 +86,57 @@ const Formation = (props) => {
|
|||
const [isclassimage, setisclassimage] = useState("False");
|
||||
const [userimgclassprofil, setuserimgclassprofil] = useState("");
|
||||
|
||||
function getClassImage(e) {
|
||||
var myurl = process.env.REACT_APP_API_URL + "myclass/api/getRecodedClassImage_from_front/";
|
||||
const [class_img_stored_in_bdd, setclass_img_stored_in_bdd] = useState("");
|
||||
|
||||
var class_external_code = props.formation.external_code;
|
||||
function getClassImage_no_token() {
|
||||
|
||||
var myurl = process.env.REACT_APP_API_URL + "myclass/api/getRecodedClassImage_no_token/";
|
||||
|
||||
if (class_external_code.length < 3) {
|
||||
//console.log("Le code externe prend au moins 3 caractères");
|
||||
return;
|
||||
}
|
||||
|
||||
//console.log(" class_external_code = " + class_external_code);
|
||||
|
||||
var form = new FormData();
|
||||
form.append("class_external_code", class_external_code);
|
||||
|
||||
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 && res.data.message.img.length > 0) {
|
||||
if (res.data.message.img.length > 0) {
|
||||
setisclassimage("True");
|
||||
//console.log(" getClassImage : In test res.data.status = " + res.data.status);
|
||||
//console.log(" getClassImage: res.data.message.img = " + res.data.message);
|
||||
|
||||
var ch_img = "data:image/png;base64," + res.data.message.img;
|
||||
setuserimgclassprofil(ch_img);
|
||||
//console.log("ch_img = "+ch_img);
|
||||
}
|
||||
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();
|
||||
//alert("4");
|
||||
setclass_img_stored_in_bdd();
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.warn('getClassImageee : Not good man :( getClassImage = ', error);
|
||||
|
||||
console.warn('getClassImage ee: Not good man :( getClassImage = ');
|
||||
setisclassimage("False");
|
||||
setuserimgclassprofil(profileimg);
|
||||
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
|
||||
|
@ -158,7 +159,7 @@ const Formation = (props) => {
|
|||
setpartnerconnected("1");
|
||||
}
|
||||
|
||||
getClassImage();
|
||||
getClassImage_no_token();
|
||||
GetCurrentClass_trainingsession();
|
||||
|
||||
GetCurrentClass_trainingsession_cities();
|
||||
|
@ -252,8 +253,14 @@ const Formation = (props) => {
|
|||
<div className="formation">
|
||||
|
||||
<div style={{ "width": "100%" }}>
|
||||
|
||||
{class_img_stored_in_bdd && String(class_img_stored_in_bdd).length > 50 && <div className="forma_img_gauche">
|
||||
<img src={class_img_stored_in_bdd} alt="informatique" className="training_img" />
|
||||
</div>
|
||||
}
|
||||
|
||||
{String(ismetiermanaged) !== "0" && String(ismetiermanaged) !== "1" && <div className="forma_img_gauche">
|
||||
|
||||
{ (!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50 ) && String(ismetiermanaged) !== "0" && String(ismetiermanaged) !== "1" && <div className="forma_img_gauche">
|
||||
|
||||
{(!props.formation.img_url || String(props.formation.img_url).length <= 0) &&
|
||||
props.formation.metier && String(props.formation.metier).toLocaleLowerCase() === String("it") &&
|
||||
|
@ -294,22 +301,22 @@ const Formation = (props) => {
|
|||
}
|
||||
|
||||
|
||||
{String(ismetiermanaged) === "0" && String(userimgclassprofil).length > 100 && <div className="forma_img_gauche">
|
||||
{(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50 ) && String(ismetiermanaged) === "0" && String(userimgclassprofil).length > 100 && <div className="forma_img_gauche">
|
||||
<img src={userimgclassprofil} alt="autre" className="training_img" />
|
||||
{props.formation.institut_formation && <div style={{ width: '100%', "textAlign": "center" }}> Dispensé par :<br /> {String(props.formation.institut_formation)} </div>}
|
||||
</div>}
|
||||
|
||||
{String(ismetiermanaged) === "0" && String(userimgclassprofil).length <= 100 && <div className="forma_img_gauche">
|
||||
{(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50 ) && String(ismetiermanaged) === "0" && String(userimgclassprofil).length <= 100 && <div className="forma_img_gauche">
|
||||
<img src={img_met_autre} alt="autre" className="training_img" />
|
||||
{props.formation.institut_formation && <div style={{ width: '100%', "textAlign": "center" }}> Dispensé par :<br /> {String(props.formation.institut_formation)} </div>}
|
||||
</div>}
|
||||
|
||||
{String(ismetiermanaged) === "1" && <div className="forma_img_gauche">
|
||||
{(!class_img_stored_in_bdd || String(class_img_stored_in_bdd).length < 50 ) && String(ismetiermanaged) === "1" && <div className="forma_img_gauche">
|
||||
<img src={props.formation.img_url} alt="autre" className="training_img" />
|
||||
{props.formation.institut_formation && <div style={{ width: '100%', "textAlign": "center" }}> Dispensé par : <br /> {String(props.formation.institut_formation)} </div>}
|
||||
</div>}
|
||||
|
||||
|
||||
|
||||
<div className="forma_rightbox"
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
|
|
Loading…
Reference in New Issue