04/07/23 - 17h

recette2
cherif 2023-07-04 16:52:22 +02:00
parent 7a373b681c
commit 05345acd66
29 changed files with 274 additions and 52 deletions

View File

@ -312,8 +312,12 @@ function Abonnement(props) {
if (String(result['status']) === String("true")) {
settestval(true);
desablefield1();
}
else if (String(result['status']) === String("Err_Connexion")) {
alert('Erreur: ' + result['message']);
history.push("/Connexion");
}
})

View File

@ -919,6 +919,11 @@ const AddClassManual = (props) => {
setisimgclassdeleted("1");
setuserimgclassprofil("");
}
else if (String(result['status']) === String("Err_Connexion")) {
alert('Erreur: ' + result['message']);
history.push("/Connexion");
}
else {
setisimgclassdeleted("0");
setisimgclassdeleted_message(result['message']);

View File

@ -189,8 +189,11 @@ const ButtonHilight = () => {
function part_logout_confirmation() {
/* si c'est une connexion partner qui est active */
alert(" deccc");
console.log(" ### AVANNN deconnexion iciiii");
if (typeof (stored_part) != "undefined") {
setpartCookie("tokenmysypart", "");
console.log(" ### deconnexion iciiii");
setpartCookie("tokenmysypart", "", { path: '/' });
}
history.push("/recherche-formation");
}

View File

@ -869,7 +869,11 @@ function CheckOut(props) {
setaddfacturationinfo_response(result['message']);
setfields1desabled(true);
setokcommande("");
}else if (String(result['status']) === String("Err_Connexion")) {
alert('Erreur: ' + result['message']);
history.push("/Connexion");
}
else {
setaddfacturationinfo_response("");
setfields1desabled(false);

View File

@ -914,7 +914,7 @@ const DisplayDetailClass_new_v2 = (props) => {
function part_logout_confirmation() {
/* si c'est une connexion partner qui est active */
if (typeof (stored_part) != "undefined") {
setCookie_part("tokenmysypart", "");
setCookie_part("tokenmysypart", "", { path: '/' });
}
history.push("/recherche-formation");
}

View File

@ -13,9 +13,12 @@ import tick_ko from "../mysy_img/tick_KO.png";
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";
const DistplayPartnerTraningsPage = (props) => {
const history = useHistory();
const [myApiResponse, setmyApiResponse] = useState("false");
const filters = [
{ value: 'external_code', label: 'Code Formation' },
@ -33,8 +36,42 @@ const DistplayPartnerTraningsPage = (props) => {
function handleClick(event, cellValues) {
Edittraining(event, cellValues);
//console.log(cellValues);
var url = process.env.REACT_APP_API_URL + "myclass/api/check_partner_token_validity_v2/";
var formData = new FormData();
const stored_cookie = getCookie('tokenmysypart');
formData.append("token", stored_cookie);
fetch(
url,
{
method: 'POST',
body: formData,
}
)
.then((response) => response.json())
.then((result) => {
console.log(' isValidToken ==> Success:', result['message'], "result['status'] = ", result['status']);
if (String(result['status']) !== String("true")) {
alert("La session de connexion n'est pas valide");
history.push("/Connexion");
}
if (String(result['status']) === String("true")) {
Edittraining(event, cellValues);
//console.log(cellValues);
}
})
.catch((error) => {
console.error('Error:', error);
});
}
const [selectionModel, setSelectionModel] = React.useState([]);
@ -210,23 +247,95 @@ const DistplayPartnerTraningsPage = (props) => {
function Visualiser(event, cellValues) {
// On ne visualise que les formations publiées
if( cellValues.row.published !== "1" ){
alert(" Vous devez publier la formation pour la visualiser ");
return;
}
window.open(
"/Display-Detail-formation/" + cellValues.row.internal_url,
'_blank'
);
var url = process.env.REACT_APP_API_URL + "myclass/api/check_partner_token_validity_v2/";
var formData = new FormData();
const stored_cookie = getCookie('tokenmysypart');
formData.append("token", stored_cookie);
fetch(
url,
{
method: 'POST',
body: formData,
}
)
.then((response) => response.json())
.then((result) => {
console.log(' isValidToken ==> Success:', result['message'], "result['status'] = ", result['status']);
if (String(result['status']) !== String("true")) {
alert("La session de connexion n'est pas valide");
history.push("/Connexion");
}
if (String(result['status']) === String("true")) {
// On ne visualise que les formations publiées
if (cellValues.row.published !== "1") {
alert(" Vous devez publier la formation pour la visualiser ");
return;
}
window.open(
"/Display-Detail-formation/" + cellValues.row.internal_url,
'_blank'
);
}
})
.catch((error) => {
console.error('Error:', error);
});
}
function handleClickManagement(event, cellValues) {
window.open(
"/GestionAdministrative/" + cellValues.row.internal_url,
'_blank'
);
// Verification de la validité du token avant action.
var url = process.env.REACT_APP_API_URL + "myclass/api/check_partner_token_validity_v2/";
var formData = new FormData();
const stored_cookie = getCookie('tokenmysypart');
formData.append("token", stored_cookie);
fetch(
url,
{
method: 'POST',
body: formData,
}
)
.then((response) => response.json())
.then((result) => {
console.log(' isValidToken ==> Success:', result['message'], "result['status'] = ", result['status']);
if (String(result['status']) !== String("true")) {
alert("La session de connexion n'est pas valide");
history.push("/Connexion");
}
else if (String(result['status']) === String("true")) {
window.open(
"/GestionAdministrative/" + cellValues.row.internal_url,
'_blank'
);
}
})
.catch((error) => {
console.error('Error:', error);
});
// Fin verification
}
@ -280,6 +389,43 @@ const DistplayPartnerTraningsPage = (props) => {
}
// Fonction de verification de la validité d'un token.
function isValidToken() {
var url = process.env.REACT_APP_API_URL + "myclass/api/check_partner_token_validity_v2/";
var formData = new FormData();
const stored_cookie = getCookie('tokenmysypart');
formData.append("token", stored_cookie);
fetch(
url,
{
method: 'POST',
body: formData,
}
)
.then((response) => response.json())
.then((result) => {
console.log(' isValidToken ==> Success:', result['message'], "result['status'] = ", result['status']);
if (String(result['status']) !== String("true")) {
alert("La session de connexion n'est pas valide");
history.push("/Connexion");
}
})
.catch((error) => {
console.error('Error:', error);
});
}
function Unpublish_class(tab_class) {
var url = process.env.REACT_APP_API_URL + "myclass/api/unpublish_class/";
@ -451,7 +597,7 @@ const DistplayPartnerTraningsPage = (props) => {
<div className='detail_training'>
<TrainingForm mytrainingclass={{
'ref': reftrainingtoupdate, 'class_external_code': externalcodetraining_toupdate
}} ispending={props.ispending} currentpack={props.currentpack} closeTrainingForm={closeTrainingForm}/>
}} ispending={props.ispending} currentpack={props.currentpack} closeTrainingForm={closeTrainingForm} />
</div>

View File

@ -35,11 +35,12 @@ import { FcAddImage } from "react-icons/fc";
import add_plus from "../mysy_img/plus.png";
import excel_icone from "../mysy_img/excel_icone.png";
import participants from "../mysy_img/participants.png";
import { useHistory } from "react-router-dom";
function GestionAdministrative(props) {
const history = useHistory();
const { internal_url } = useParams();
const [mypresence, setmypresence] = useState("");
const [mypublished, setmypublished] = useState("");
@ -2059,7 +2060,7 @@ function GestionAdministrative(props) {
if (document.getElementsByName("one_presentiel")[0])
document.getElementsByName("one_presentiel")[0].value = "";
if (document.getElementsByName("one_session_ondemande")[0])
if (document.getElementsByName("one_session_ondemande")[0])
document.getElementsByName("one_session_ondemande")[0].value = "";
if (document.getElementsByName("one_distantiel")[0])
@ -2479,7 +2480,11 @@ function GestionAdministrative(props) {
GetListeEmargement(mysession);
GetListeEvaluation(mysession);
submenu_inscrit();
}else if (String(result['status']) === String("Err_Connexion")) {
alert('Erreur: ' + result['message']);
history.push("/Connexion");
}
else {
setliste_participants_file_change_message(result['message']);
setliste_participants_file_change_api("false");
@ -2535,7 +2540,11 @@ function GestionAdministrative(props) {
setResend_LMS_Credentials_result(result['message']);
setResend_LMS_Credentials_api("true");
alert(" Les identifiants de connexion ont été correctement envoyés")
}else if (String(result['status']) === String("Err_Connexion")) {
alert('Erreur: ' + result['message']);
history.push("/Connexion");
}
else {
setResend_LMS_Credentials_message(result['message']);
setResend_LMS_Credentials_api("false");
@ -2588,7 +2597,11 @@ function GestionAdministrative(props) {
//console.log('Success:', result['message']);
setResend_LMS_Credentials_With_Email_result(result['message']);
setResend_LMS_Credentials_With_Email_api("true");
}else if (String(result['status']) === String("Err_Connexion")) {
alert('Erreur: ' + result['message']);
history.push("/Connexion");
}
else {
setResend_LMS_Credentials_With_Email_message(result['message']);
setResend_LMS_Credentials_With_Email_api("false");
@ -2689,7 +2702,12 @@ function GestionAdministrative(props) {
.then((result) => {
//console.log(" ## result['status'] = ", result['status'])
if (String(result['status']) === String("true")) {
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");
@ -2698,12 +2716,12 @@ function GestionAdministrative(props) {
alert(" Les sessions ont été correctement importées");
}
else {
setliste_sessions_file_change_message(result['message']);
setliste_sessions_file_change_api("false");
alert('Erreur: '+result['message']);
alert('Erreur: ' + result['message']);
}
})
@ -3999,16 +4017,16 @@ function GestionAdministrative(props) {
<div className="field_droite">
<select id="session_liste" value={mysession} onChange={handleChangeSession} className="selectsession">
<option value="" className="select_option_css">Choisir</option>
{GetCurrentClass_trainingsession_result &&
GetCurrentClass_trainingsession_result.map((session) => (
<option value={(JSON.parse(session).formation_session_id)} className="select_option_css">
{(JSON.parse(session).session_ondemande) === "1" && " A la Demande - "}
{( !JSON.parse(session).session_ondemande || JSON.parse(session).session_ondemande === "0" ) &&
(JSON.parse(session).date_debut).substring(0, 10)+ " au "+ (JSON.parse(session).date_fin).substring(0, 10)}
{(!JSON.parse(session).session_ondemande || JSON.parse(session).session_ondemande === "0") &&
(JSON.parse(session).date_debut).substring(0, 10) + " au " + (JSON.parse(session).date_fin).substring(0, 10)}
{/*(JSON.parse(session).date_debut).substring(0, 10)} au {(JSON.parse(session).date_fin).substring(0, 10) */} -

View File

@ -15,8 +15,8 @@ const Header = () => {
const history = useHistory();
const stored_user = getCookie('tokenmysych');
const stored_part = getCookie('tokenmysypart');
const [cookie, setCookie, removeCookie] = useCookies(['tokenmysych']);
const [partcookie, setpartCookie, removepartCookie] = useCookies(['tokenmysypart']);
const [cookie, setCookie, removeCookie] = useCookies(['tokenmysych'], { path: '/' });
const [partcookie, setpartCookie, removepartCookie] = useCookies(['tokenmysypart'], { path: '/' });
const [PartnerMenu, setPartnerMenu] = React.useState(null);
@ -137,8 +137,9 @@ const Header = () => {
function part_logout_confirmation() {
/* si c'est une connexion partner qui est active */
if (typeof (stored_part) != "undefined") {
setpartCookie("tokenmysypart", "");
setpartCookie("tokenmysypart", "", { path: '/' });
}
history.push("/recherche-formation");
}

View File

@ -292,7 +292,11 @@ function HebergementLms(props) {
setSend_logo_Img_api("true");
alert(" La mise à jour du logo a été correctement effectuée. ");
}else if (String(result['status']) === String("Err_Connexion")) {
alert('Erreur: ' + result['message']);
history.push("/Connexion");
}
else {
setSend_logo_Img_api("false");
setSend_logo_Img_message(result['message']);
@ -429,7 +433,11 @@ function HebergementLms(props) {
setSendBackground_Img_api("true");
alert(" L'image bannière a été correctement mise à jour")
}else if (String(result['status']) === String("Err_Connexion")) {
alert('Erreur: ' + result['message']);
history.push("/Connexion");
}
else {
setSendBackground_Img_api("false");
setSendBackground_Img_message(result['message']);

View File

@ -379,7 +379,7 @@ const ListeArticles = (props) => {
function part_logout_confirmation() {
/* si c'est une connexion partner qui est active */
if (typeof (stored_part) != "undefined") {
setpartCookie("tokenmysypart", "");
setpartCookie("tokenmysypart", "", { path: '/' });
}
history.push("/recherche-formation");
}

View File

@ -153,7 +153,11 @@ const Partner = (props) => {
setapiexcelimportmessage(result['status']);
if (String(result['status']) === String("true")) {
sethandleSubmission_api("true");
}else if (String(result['status']) === String("Err_Connexion")) {
alert('Erreur: ' + result['message']);
history.push("/Connexion");
}
else {
sethandleSubmission_api("false");
sethandleSubmission_message(result['message']);

View File

@ -35,7 +35,7 @@ function PartnerSignIn() {
const history = useHistory();
function logout_partner_confirmation() {
setCookie("tokenmysypart", "");
setCookie("tokenmysypart", "", { path: '/' });
}
function Logout_Partenaire() {
@ -129,7 +129,7 @@ function PartnerSignIn() {
if (String(val) === String("true")) {
setCookie("tokenmysypart", result['message']);
setCookie("tokenmysypart", result['message'], { path: '/' });
history.push("/Partner");
}
else {

View File

@ -127,7 +127,7 @@ function PartnerSignIn() {
if (String(val) === String("true")) {
sessionStorage.setItem("token", result['message']);
setCookie("tokenmysypart", result['message']);
setCookie("tokenmysypart", result['message'], { path: '/' });
history.push("/Partner");
}
else {

View File

@ -131,7 +131,7 @@ function PartnerSignIn() {
if (String(val) === String("true")) {
sessionStorage.setItem("token", result['message']);
setCookie("tokenmysypart", result['message']);
setCookie("tokenmysypart", result['message'], { path: '/' });
history.push("/Partner");
}
else {

View File

@ -164,7 +164,11 @@ function PaymentMethode(props) {
if (String(result['status']) === String("true")) {
setpaymentadded("1");
window.scrollTo(0, 0);
}else if (String(result['status']) === String("Err_Connexion")) {
alert('Erreur: ' + result['message']);
history.push("/Connexion");
}
else {
setpaymentadded("0");
}

View File

@ -147,7 +147,11 @@ function PaymentMethodeNoConnect(props) {
setpaymentadded("1");
}else if (String(result['status']) === String("Err_Connexion")) {
alert('Erreur: ' + result['message']);
history.push("/Connexion");
}
else {
setpaymentadded("0");

View File

@ -147,7 +147,11 @@ function PaymentMethodeNoConnect(props) {
if (String(result['status']) === String("true")) {
setpaymentadded("1");
}else if (String(result['status']) === String("Err_Connexion")) {
alert('Erreur: ' + result['message']);
history.push("/Connexion");
}
else {
setpaymentadded("0");
}

View File

@ -1780,7 +1780,7 @@ const Recherche = () => {
function part_logout_confirmation() {
/* si c'est une connexion partner qui est active */
if (typeof (stored_part) != "undefined") {
setpartCookie("tokenmysypart", "");
setpartCookie("tokenmysypart", "", { path: '/' });
}
history.push("/recherche-formation");
}

View File

@ -379,7 +379,7 @@ const RechercheArticles = (props) => {
function part_logout_confirmation() {
/* si c'est une connexion partner qui est active */
if (typeof (stored_part) != "undefined") {
setpartCookie("tokenmysypart", "");
setpartCookie("tokenmysypart", "", { path: '/' });
}
history.push("/recherche-formation");
}

View File

@ -1688,7 +1688,7 @@ const Recherche_new = () => {
function part_logout_confirmation() {
/* si c'est une connexion partner qui est active */
if (typeof (stored_part) != "undefined") {
setpartCookie("tokenmysypart", "");
setpartCookie("tokenmysypart", "", { path: '/' });
}
history.push("/recherche-formation");
}

View File

@ -1688,7 +1688,7 @@ const Recherche_new = () => {
function part_logout_confirmation() {
/* si c'est une connexion partner qui est active */
if (typeof (stored_part) != "undefined") {
setpartCookie("tokenmysypart", "");
setpartCookie("tokenmysypart", "", { path: '/' });
}
history.push("/recherche-formation");
}

View File

@ -2075,7 +2075,7 @@ const Recherche_new_v2 = () => {
function part_logout_confirmation() {
/* si c'est une connexion partner qui est active */
if (typeof (stored_part) != "undefined") {
setpartCookie("tokenmysypart", "");
setpartCookie("tokenmysypart", "", { path: '/' });
}
history.push("/recherche-formation");
}

View File

@ -25,8 +25,8 @@ import VisibilityOff from '@mui/icons-material/VisibilityOff';
function SignIn() {
const [isconnected, setisconnected] = useState("");
const [cookie, setCookie, removeCookie] = useCookies(['tokenmysych']);
const [cookie_part, setCookie_part, removeCookie_part] = useCookies(['tokenmysypart']);
const [cookie, setCookie, removeCookie] = useCookies(['tokenmysych'], { path: '/' });
const [cookie_part, setCookie_part, removeCookie_part] = useCookies(['tokenmysypart'], { path: '/' });
const [retval, setretval] = useState("0");
const [myApimyApiMessage, setmyApimyApiMessage] = useState("");
const [initpasswd, setinitpasswd] = useState();
@ -171,7 +171,7 @@ function SignIn() {
if (String(partner_connexion) === String("partner")) {
setCookie("tokenmysypart", JSON.parse(result['message']).token);
setCookie("tokenmysypart", JSON.parse(result['message']).token, { path: '/' });
//setCookie("tokenmysypart", result['message']);
history.push("/Partner");

View File

@ -163,7 +163,11 @@ function UpdateParnterInfo() {
desablesecurtyInsertKeyfields();
document.getElementsByName("current_insert_key")[0].value = new_key;
setinsert_key_updated(true);
}
}else if (String(result['status']) === String("Err_Connexion")) {
alert('Erreur: ' + result['message']);
history.push("/Connexion");
}
})
.catch((error) => {

View File

@ -92,7 +92,11 @@ function UpdateUserGoals(props) {
});
{ window.location.reload() }
}else if (String(result['status']) === String("Err_Connexion")) {
alert('Erreur: ' + result['message']);
history.push("/Connexion");
}
else {
setrecorddata_api("false");
setrecorddata_api_message(result['message']);

View File

@ -342,7 +342,11 @@ function UpdateUserInfo() {
if (String(result['status']) === String("true")) {
settestval("true");
desablefield1();
}
}else if (String(result['status']) === String("Err_Connexion")) {
alert('Erreur: ' + result['message']);
history.push("/Connexion");
}
})
.catch((error) => {

View File

@ -21,7 +21,7 @@ import MenuItem from '@mui/material/MenuItem';
function UpdateUserProfil(props) {
const history = useHistory();
const [myclasslevel, setmyclasslevel] = useState("n/a");
const [fiedsupdated, setfiedsupdated] = useState(false);
@ -95,10 +95,11 @@ function UpdateUserProfil(props) {
if (String(result['status']) === String("true")) {
setrecorddata_api("true");
setrecorddata_api_result(result['message']);
}else if (String(result['status']) === String("Err_Connexion")) {
alert('Erreur: ' + result['message']);
history.push("/Connexion");
}
else {
setrecorddata_api("false");
setrecorddata_api_message(result['message']);

View File

@ -163,7 +163,11 @@ function UpgradeToPro() {
alert(String(result['message']));
setmyApiResponse("1");
}else if (String(result['status']) === String("Err_Connexion")) {
alert('Erreur: ' + result['message']);
history.push("/Connexion");
}
else {
//alert(" GRR "+String(result['message']+ " result['status'] = "+ result['status']));
setisconnected("false");

View File

@ -167,7 +167,7 @@ function SignIn() {
if (String(val) === String("true")) {
if (String(menucompte) === String("partner")) {
setCookie("tokenmysypart", result['message']);
setCookie("tokenmysypart", result['message'], { path: '/' });
history.push("/Partner");
}