20/01/23 - 23h
parent
c5ff0db848
commit
9ba9ba8b94
|
@ -27,6 +27,8 @@ import fileDownload from 'js-file-download'
|
|||
import PayementComponent_Carte from "./PaymentMethode_Carte"
|
||||
import img_logo_stripe from "./../mysy_img/logo-stripe-secure.png";
|
||||
import SendIcon from '@mui/icons-material/Send';
|
||||
import { confirmAlert } from 'react-confirm-alert'; // Import
|
||||
|
||||
|
||||
function Abonnement(props) {
|
||||
|
||||
|
@ -361,6 +363,8 @@ function Abonnement(props) {
|
|||
//document.getElementsByName("vat_num")[0].style.backgroundColor = "#ECEFF1";
|
||||
}
|
||||
|
||||
const [getCurrentUserData_result, setgetCurrentUserData_result] = useState([]);
|
||||
|
||||
function getCurrentUserData() {
|
||||
|
||||
settestval('d'); // ==> Do not delete
|
||||
|
@ -369,11 +373,13 @@ function Abonnement(props) {
|
|||
formData.append('token', stored_part);
|
||||
|
||||
axios.post(url, formData).then(res => {
|
||||
if (res.data.status != "False") {
|
||||
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) === String("true") ) {
|
||||
//console.log(" In getCurrentUserData res.data.status = " + res.data.status);
|
||||
//console.log(" In getCurrentUserData res.data.message = " + res.data.message);
|
||||
setmyApiResponse("True");
|
||||
setResult(res.data.message);
|
||||
setgetCurrentUserData_result(res.data.messag)
|
||||
|
||||
var mylocaltraining = JSON.parse(res.data.message);
|
||||
if (mylocaltraining) {
|
||||
|
@ -473,13 +479,7 @@ function Abonnement(props) {
|
|||
|
||||
|
||||
function confirmAbonnement(packs) {
|
||||
/* alert(" test");
|
||||
history.push("/Partner",
|
||||
{mysy_arg:'stat'});
|
||||
|
||||
return;
|
||||
|
||||
*/
|
||||
|
||||
window.scrollTo(0, 0);
|
||||
|
||||
if (String(packs).toLowerCase() === String("decouverte")) {
|
||||
|
@ -551,6 +551,71 @@ function Abonnement(props) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
const [StopAbonnement_api, setStopAbonnement_api] = useState([]);
|
||||
const [StopAbonnement_message, setStopAbonnement_message] = useState([]);
|
||||
const [StopAbonnement_result, setStopAbonnement_result] = useState([]);
|
||||
function StopAbonnement(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/stop_strip_subscription/";
|
||||
|
||||
|
||||
fetch(myurl,
|
||||
{
|
||||
method: 'POST',
|
||||
body: form,
|
||||
})
|
||||
.then((data) => data.json())
|
||||
.then((data) => {
|
||||
|
||||
console.log(" In getCurrentUserData res.data.status = " + data.status);
|
||||
console.log(" In getCurrentUserData res.data.message = " + data.message);
|
||||
|
||||
if (String(data['status']) === String("false")) {
|
||||
|
||||
setStopAbonnement_api("false");
|
||||
setStopAbonnement_message(data['message']);
|
||||
|
||||
}
|
||||
else if (String(data['status']) === String("true")) {
|
||||
|
||||
setStopAbonnement_api("true");
|
||||
setStopAbonnement_result(data['message']);
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
console.error('StopAbonnement Error:', error);
|
||||
setStopAbonnement_api("false");
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
function confirmSTOPAbonnement(localpacks) {
|
||||
confirmAlert({
|
||||
title: '',
|
||||
message: "Confirmez l'arret de votre abonnement " + String(localpacks),
|
||||
buttons: [
|
||||
{
|
||||
label: 'Yes',
|
||||
onClick: () => { StopAbonnement(); }
|
||||
},
|
||||
{
|
||||
label: 'No',
|
||||
onClick: () => { return }
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function returntoorder() {
|
||||
setgotocheckout("0");
|
||||
|
||||
|
@ -567,12 +632,25 @@ function Abonnement(props) {
|
|||
}
|
||||
|
||||
|
||||
{String(StopAbonnement_api) === String("true") && <div className="div_row">
|
||||
<nav className="okUpdateData"> Votre demande a été bien prise en compte <br /> {StopAbonnement_result} </nav>
|
||||
|
||||
</div>}
|
||||
|
||||
{String(StopAbonnement_api) === String("false") && <div className="div_row">
|
||||
<nav className="koUpdateData"> {StopAbonnement_message} </nav>
|
||||
|
||||
</div>}
|
||||
|
||||
{String(gotocheckout) === String("0") && <div>
|
||||
<div className="div_row">
|
||||
<div className="div_row_gauche">
|
||||
|
||||
|
||||
<div className="titre1"> Votre plan actuel </div>
|
||||
Vous êtes actuellement sur un plan : {String(currentpack2).toUpperCase()}
|
||||
Vous êtes actuellement sur un plan : {String(currentpack2).toUpperCase()}
|
||||
{result && (JSON.parse(result).end_date_abonnement) &&
|
||||
<nav>Cet abonnement expire le {(JSON.parse(result).end_date_abonnement)} </nav>}
|
||||
|
||||
<div style={{ "marginBottom": "2rem" }}> </div>
|
||||
<div className="titre1"> Mode de Paiement </div>
|
||||
|
||||
|
@ -1099,6 +1177,16 @@ function Abonnement(props) {
|
|||
> Activez ce pack </Button>
|
||||
</div>}
|
||||
|
||||
{String(currentpack2).toLowerCase() === String("Decouverte") && <div className="abonnement">
|
||||
<Button variant="contained"
|
||||
color="success"
|
||||
className="btn_arret_abonnement"
|
||||
onClick={(e) => {
|
||||
confirmSTOPAbonnement("Gold");
|
||||
}}
|
||||
> Arretez </Button>
|
||||
</div>}
|
||||
|
||||
</div>
|
||||
|
||||
<div className="div_row_standard">
|
||||
|
@ -1154,6 +1242,17 @@ function Abonnement(props) {
|
|||
}}> Activez ce pack </Button>
|
||||
</div>}
|
||||
|
||||
{String(currentpack2).toLowerCase() === String("standard") && <div className="abonnement">
|
||||
<Button variant="contained"
|
||||
color="success"
|
||||
className="btn_arret_abonnement"
|
||||
onClick={(e) => {
|
||||
confirmSTOPAbonnement("Gold");
|
||||
}}
|
||||
> Arretez </Button>
|
||||
</div>}
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -1211,6 +1310,26 @@ function Abonnement(props) {
|
|||
> Activez ce pack </Button>
|
||||
</div>}
|
||||
|
||||
{String(currentpack2).toLowerCase() === String("gold") && (!JSON.parse(result).end_date_abonnement) &&
|
||||
<div className="abonnement">
|
||||
<Button variant="contained"
|
||||
color="success"
|
||||
className="btn_arret_abonnement"
|
||||
onClick={(e) => {
|
||||
confirmSTOPAbonnement("Gold");
|
||||
}}
|
||||
> Arretez </Button>
|
||||
</div>}
|
||||
|
||||
{String(currentpack2).toLowerCase() === String("gold") && (JSON.parse(result).end_date_abonnement) &&
|
||||
<div className="abonnement">
|
||||
<Button variant="contained"
|
||||
color="success"
|
||||
className="btn_arret_abonnement" style={{"cursor":"none"}}
|
||||
|
||||
> Arrêt le {(JSON.parse(result).end_date_abonnement)} </Button>
|
||||
</div>}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -786,6 +786,7 @@ function CheckOut(props) {
|
|||
var myurl = process.env.REACT_APP_API_URL + "myclass/api/confirm_payment/";
|
||||
var form = new FormData();
|
||||
form.append("stripe_payment_id", payement_id);
|
||||
form.append('token', stored_part);
|
||||
|
||||
|
||||
fetch(myurl, {
|
||||
|
|
|
@ -127,7 +127,7 @@ Recuperation de toutes les formation du partenaire
|
|||
|
||||
var new_data2 = ch_data2.split(',').map(Number);
|
||||
new_data2.push(123);
|
||||
console.log(" new_data2 = " + new_data2);
|
||||
console.log(" new_data2 b= " + new_data2);
|
||||
|
||||
setglobal_view_data(ch_array);
|
||||
console.log(global_view_data);
|
||||
|
@ -172,7 +172,7 @@ Recuperation de toutes les formation du partenaire
|
|||
form.append("date_start", date_start);
|
||||
form.append("date_end", date_end);
|
||||
form.append('token', stored_part);
|
||||
form.append('topX', '5');
|
||||
form.append('topX', '6');
|
||||
|
||||
//alert("myurl = "+myurl);
|
||||
|
||||
|
@ -197,7 +197,7 @@ Recuperation de toutes les formation du partenaire
|
|||
|
||||
var nom = JSON.parse(obj).name1;
|
||||
setdetail_view_data1_name(nom);
|
||||
console.log("new_data2 = ", ch_data2);
|
||||
console.log("new_data2 la = ", ch_data2);
|
||||
console.log("result = ", new_data2);
|
||||
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ Recuperation de toutes les formation du partenaire
|
|||
|
||||
var nom = JSON.parse(obj).name1;
|
||||
setdetail_view_data1_name_selected_training(nom);
|
||||
console.log("new_data2 = ", ch_data2);
|
||||
console.log("new_data2 a = ", ch_data2);
|
||||
console.log("result = ", new_data2);
|
||||
|
||||
}
|
||||
|
@ -469,16 +469,21 @@ Recuperation de toutes les formation du partenaire
|
|||
</div>
|
||||
|
||||
<div className="div_row_droite">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div className="div_row">
|
||||
<div className="titre1"> La tendance de votre entreprise </div>
|
||||
|
||||
<div className="titre1"> La tendance de votre entreprise </div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{global_view_data && global_view_data.length > 3 && <div className="row">
|
||||
|
||||
|
||||
<div className="section col-md-6">
|
||||
<h3 className="section-title">Graphique en ligne (Toute formation)</h3>
|
||||
<div className="section-content">
|
||||
|
@ -488,7 +493,7 @@ Recuperation de toutes les formation du partenaire
|
|||
|
||||
<div className="section col-md-6">
|
||||
<h3 className="section-title">
|
||||
Diagramme à bandes (Toute formation) </h3>
|
||||
Diagramme à bandes (Toute formation) </h3>
|
||||
<div className="section-content">
|
||||
<Chart options={options_global_view} series={series_Gobal} type="bar" />
|
||||
</div>
|
||||
|
@ -500,7 +505,7 @@ Diagramme à bandes (Toute formation) </h3>
|
|||
</div>
|
||||
|
||||
<div className="div_row">
|
||||
<div className="titre1"> Le top 5 de vos formation sur la periode</div>
|
||||
<div className="titre1"> Le top 5 de vos formation sur la periode</div>
|
||||
{topX_formation && <div className="row">
|
||||
|
||||
<div className="section col-md-6">
|
||||
|
@ -531,7 +536,7 @@ Diagramme à bandes (Toute formation) </h3>
|
|||
|
||||
|
||||
{String(allclassAPI) === "true" && <div className="div_row">
|
||||
<div className="titre1"> Les detail d'une formation </div>
|
||||
<div className="titre1"> Les detail d'une formation </div>
|
||||
<h5> Selectionnez une formation </h5>
|
||||
<div className="div_row_gauche">
|
||||
<select id={"selectedtraining"} name={"selectedtraining"}
|
||||
|
|
|
@ -2056,6 +2056,16 @@
|
|||
color: white;
|
||||
}
|
||||
|
||||
.btn_arret_abonnement {
|
||||
font-size: 0.8rem !important;
|
||||
width: 100%;
|
||||
background-color: #ac9c13;
|
||||
white-space: nowrap;
|
||||
padding-left: 0px;
|
||||
padding-right: 0px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn_abonnement_sur_mesure {
|
||||
font-size: 0.8rem !important;
|
||||
width: 100%;
|
||||
|
|
Loading…
Reference in New Issue