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"); setmyApiResponse("False");
} }
else if (String(data['status']) === String("Err_Connexion")) {
alert('Erreur: ' + data['message']);
history.push("/Connexion");
return;
}
else { else {
setmyApiResponse("True"); setmyApiResponse("True");
@ -184,8 +189,13 @@ 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']) //console.log("erreur rrrr:" + data['status'])
setpaymentmodeapi("True"); setpaymentmodeapi("True");
setpaymentmode_nb_carte('0') setpaymentmode_nb_carte('0')
@ -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 { else {

View File

@ -9,11 +9,14 @@ import { getCookie } from 'react-use-cookie';
import { DataGrid, GridToolbar, frFR } from '@mui/x-data-grid'; import { DataGrid, GridToolbar, frFR } from '@mui/x-data-grid';
import Footer from "./Fotter"; import Footer from "./Fotter";
import tick_ko from "../mysy_img/tick_KO.png"; 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 { AiFillCloseCircle, } from "react-icons/ai";
import parse from 'html-react-parser' import parse from 'html-react-parser'
import { BsEye, BsFileText } from "react-icons/bs"; import { BsEye, BsFileText } from "react-icons/bs";
import { useHistory } from "react-router-dom"; import { useHistory } from "react-router-dom";
import axios from "axios";
import { CiCoffeeBean } from "react-icons/ci";
const DistplayPartnerTraningsPage = (props) => { const DistplayPartnerTraningsPage = (props) => {
@ -26,6 +29,9 @@ const DistplayPartnerTraningsPage = (props) => {
{ value: 'certif', label: 'Certification' } { value: 'certif', label: 'Certification' }
] ]
const [selectedfilt1, setselectedfilt1] = useState(""); const [selectedfilt1, setselectedfilt1] = useState("");
const [selectedfilt2, setselectedfilt2] = useState(""); const [selectedfilt2, setselectedfilt2] = useState("");
const [selectedfilt3, setselectedfilt3] = 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) { function handleClickManagement(event, cellValues) {
// Verification de la validité du token avant action. // Verification de la validité du token avant action.
@ -584,6 +648,52 @@ const DistplayPartnerTraningsPage = (props) => {
setselectedfilt1(""); 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 ( return (
<div className='displaypartnertrainingpagination'> <div className='displaypartnertrainingpagination'>