27/07/2023 - 10h

recette2
cherif 2023-07-27 10:07:14 +02:00
parent b370b41193
commit c1cbd82330
2 changed files with 149 additions and 25 deletions

View File

@ -132,6 +132,11 @@ function Abonnement(props) {
setmyApiResponse("False");
}
else if (String(data['status']) === String("Err_Connexion")) {
alert('Erreur: ' + data['message']);
history.push("/Connexion");
return;
}
else {
setmyApiResponse("True");
@ -169,12 +174,12 @@ function Abonnement(props) {
.then((data) => {
//console.log('LAAAAAAAAA Success:', data['message'], "data['status'] = ", data['status'], " nb_carte", data['nb_carte']);
if (String(data['status']) === String("true") ) {
if (String(data['status']) === String("true")) {
setpaymentmodeapi("True");
setpaymentmode_nb_carte(data['nb_carte']);
if ( parseInt(data['nb_carte']) > 0 &&
if (parseInt(data['nb_carte']) > 0 &&
data['message'] && data['message'][0] &&
Object.keys(data['message'][0]).length > 0) {
setpaymentmode(data['message']);
@ -184,15 +189,20 @@ function Abonnement(props) {
}
} else
{
}
else if (String(data['status']) === String("Err_Connexion")) {
alert('Erreur: ' + data['message']);
history.push("/Connexion");
return;
}
else {
//console.log("erreur rrrr:" + data['status'])
setpaymentmodeapi("True");
setpaymentmode_nb_carte('0')
}
}).catch((error) => {
console.error('GetPayementMode : Error:', error);
@ -546,9 +556,9 @@ function Abonnement(props) {
setgotocheckout("1");
setselectedpacks(packs);
window.scrollTo({
top: 0,
behavior: "smooth",
});
top: 0,
behavior: "smooth",
});
return;
}
@ -586,9 +596,9 @@ function Abonnement(props) {
setgotocheckout("1");
setselectedpacks(packs);
window.scrollTo({
top: 0,
behavior: "smooth",
});
top: 0,
behavior: "smooth",
});
}
}
@ -598,7 +608,7 @@ function Abonnement(props) {
window.scrollTo({
top: 0,
behavior: "smooth",
});
});
if (Client_end_date_abonnement && String(Client_end_date_abonnement).length > 3) {
@ -649,9 +659,9 @@ function Abonnement(props) {
setgotocheckout("1");
setselectedpacks(packs);
window.scrollTo({
top: 0,
behavior: "smooth",
});
top: 0,
behavior: "smooth",
});
return;
}
@ -689,9 +699,9 @@ function Abonnement(props) {
setgotocheckout("1");
setselectedpacks(packs);
window.scrollTo({
top: 0,
behavior: "smooth",
});
top: 0,
behavior: "smooth",
});
}
}
}
@ -1166,6 +1176,10 @@ function Abonnement(props) {
}
}
} else if (String(res.data.status) === String("Err_Connexion")) {
alert('Erreur: ' + res.data.message);
history.push("/Connexion");
return;
}
else {
@ -1282,7 +1296,7 @@ function Abonnement(props) {
</a>
{handleOnblur_Code_Promo_api && String(handleOnblur_Code_Promo_api) === "false" &&
<nav className="koUpdateData"> {handleOnblur_Code_Promo_message} </nav>
<nav className="koUpdateData"> {handleOnblur_Code_Promo_message} </nav>
}
</div>

View File

@ -9,11 +9,14 @@ import { getCookie } from 'react-use-cookie';
import { DataGrid, GridToolbar, frFR } from '@mui/x-data-grid';
import Footer from "./Fotter";
import tick_ko from "../mysy_img/tick_KO.png";
import Popup from 'reactjs-popup';
import 'reactjs-popup/dist/index.css';
import { AiFillCloseCircle, } from "react-icons/ai";
import parse from 'html-react-parser'
import { BsEye, BsFileText } from "react-icons/bs";
import { useHistory } from "react-router-dom";
import axios from "axios";
import { CiCoffeeBean } from "react-icons/ci";
const DistplayPartnerTraningsPage = (props) => {
@ -26,6 +29,9 @@ const DistplayPartnerTraningsPage = (props) => {
{ value: 'certif', label: 'Certification' }
]
const [selectedfilt1, setselectedfilt1] = useState("");
const [selectedfilt2, setselectedfilt2] = useState("");
const [selectedfilt3, setselectedfilt3] = useState("");
@ -243,6 +249,65 @@ const DistplayPartnerTraningsPage = (props) => {
}
},
{
field: "push_to_lms", headerName: 'Push Elearning',
renderCell: (cellValues) => {
return (
<Popup
trigger={<Button
onClick={(event) => {
handlepush_to_lms(event, cellValues);
}}
>
<CiCoffeeBean />
</Button>}
modal
nested
position="center center"
>
{close => (
<div>
<button className="gest_close" onClick={close}>
&times;
</button>
<div className="gest_header"> MySy Information </div>
<div className="gest_content">
{' '}
/!\ Important : Confirmer la publication de la formation dans l'eapce E-Learning
</div>
<div className="gest_actions">
<div style={{ "width": "45%", "float": "left" }}>
<button className="gest_bton_popup" onClick={(event) => {
handlepush_to_lms(event, cellValues);
close();
}}> Valider </button>
</div>
<div style={{ "width": "45%", "float": "right" }}>
<button
className="gest_bton_popup"
onClick={() => {
//console.log('modal closed ');
close();
}}
>
Annuler
</button>
</div>
</div>
</div>
)}
</Popup>
);
}
},
]
@ -289,12 +354,11 @@ const DistplayPartnerTraningsPage = (props) => {
});
}
function handleClickManagement(event, cellValues) {
// Verification de la validité du token avant action.
@ -577,13 +641,59 @@ const DistplayPartnerTraningsPage = (props) => {
window.scrollTo({
top: 0,
behavior: "smooth",
});
});
}, []);
function Clearselectedfilt1() {
setselectedfilt1("");
}
const [handlepush_to_lms_api, sethandlepush_to_lms_api] = useState("");
const [handlepush_to_lms_result, sethandlepush_to_lms_result] = useState("");
const [handlepush_to_lms_message, sethandlepush_to_lms_message] = useState("");
function handlepush_to_lms(event, cellValues) {
//console.log(" ### event.target.value = ", event.target.value);
const formData = new FormData();
const url = process.env.REACT_APP_API_URL + "myclass/api/Push_Class_To_MySy_LMS/";
const stored_cookie = getCookie('tokenmysypart');
formData.append("token", stored_cookie);
formData.append('class_internal_url', cellValues.row.internal_url);
axios.post(url, formData).then(res => {
//console.log(" In getCurrentUserData res.data.status = " + res.data.status);
//console.log(" In getCurrentUserData res.data.message = " + res.data.message);
if (String(res.data.status) === "true") {
sethandlepush_to_lms_api("true");
sethandlepush_to_lms_result(res.data.message);
alert(res.data.message );
}
else if (String(res.data.status) === String("Err_Connexion")) {
alert('Erreur: ' + res.data.message);
history.push("/Connexion");
return;
}
else {
sethandlepush_to_lms_api("false");
sethandlepush_to_lms_message(res.data.message);
alert("Erreur : "+res.data.message );
}
}).catch((error) => {
console.warn('Erro handlepush_to_lms = ', error);
sethandlepush_to_lms_api("false");
})
}
return (
<div className='displaypartnertrainingpagination'>