21/01/23 - 12h

recette2
cherif 2023-01-21 12:17:19 +01:00
parent 9ba9ba8b94
commit 8bc86a7bf2
6 changed files with 171 additions and 62 deletions

View File

@ -293,16 +293,21 @@ function Abonnement(props) {
.then((response) => response.json())
.then((result) => {
console.log('Success:', result['message'], "result['status'] = ", result['status']);
setmyApiResponse(result['status']);
setResult(result['message']);
if (String(result['status']) == String("true")) {
if (String(result['status']) === String("true")) {
settestval(true);
desablefield1();
}
})
.catch((error) => {
console.error('Error:', error);
console.error('RecordData Error:', error);
setmyApiResponse("false");
});
@ -649,7 +654,7 @@ function Abonnement(props) {
<div className="titre1"> Votre plan actuel </div>
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>}
<nav style={{"color":"red"}}>Cet abonnement expire le {(JSON.parse(result).end_date_abonnement)} </nav>}
<div style={{ "marginBottom": "2rem" }}> &nbsp; </div>
<div className="titre1"> Mode de Paiement </div>
@ -1177,16 +1182,26 @@ function Abonnement(props) {
> Activez ce pack </Button>
</div>}
{String(currentpack2).toLowerCase() === String("Decouverte") && <div className="abonnement">
{String(currentpack2).toLowerCase() === String("decouverte") && (!JSON.parse(result).end_date_abonnement) &&
<div className="abonnement">
<Button variant="contained"
color="success"
className="btn_arret_abonnement"
onClick={(e) => {
confirmSTOPAbonnement("Gold");
confirmSTOPAbonnement("decouverte");
}}
> Arretez </Button>
</div>}
{String(currentpack2).toLowerCase() === String("decouverte") && (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>
<div className="div_row_standard">
@ -1242,16 +1257,25 @@ function Abonnement(props) {
}}> Activez ce pack </Button>
</div>}
{String(currentpack2).toLowerCase() === String("standard") && <div className="abonnement">
{String(currentpack2).toLowerCase() === String("standard") && (!JSON.parse(result).end_date_abonnement) && <div className="abonnement">
<Button variant="contained"
color="success"
className="btn_arret_abonnement"
onClick={(e) => {
confirmSTOPAbonnement("Gold");
confirmSTOPAbonnement("standard");
}}
> Arretez </Button>
</div>}
{String(currentpack2).toLowerCase() === String("standard") && (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>

View File

@ -159,7 +159,7 @@ function CheckOut(props) {
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);
//console.log(" In getCurrentUserData res.data.message = " + res.data.message);
setmyApiResponse("True");
setResult(res.data.message);
@ -337,8 +337,8 @@ function CheckOut(props) {
axios.post(url, formData).then(res => {
if (res.data.status != "False") {
console.log(" In test res.data.status = " + res.data.status);
console.log(" In test res.data.message = " + res.data.message);
//console.log(" In test res.data.status = " + res.data.status);
//console.log(" In test res.data.message = " + res.data.message);
setmyApiResponse("True");
setResult(res.data.message);
setgetpackproducts(res.data.message);
@ -431,6 +431,16 @@ function CheckOut(props) {
function Ordervalidation() {
//alert(" confirmation ok");
if( String(nb_formations) === "0" ){
alert(" Vous devez choisir un nombre de formation ");
document.getElementById('div_nb_formation').style.color = "red" ;
document.getElementById('div_ttc').style.color = "red" ;
return;
}
var form = new FormData();
const stored_cookie = getCookie('tokenmysypart');
form.append("token", stored_cookie);
@ -456,7 +466,7 @@ function CheckOut(props) {
form.append("0", JSON.stringify({
"code": currentpack, "prix": packprice, "comment": "nc", "qty": "1", "pack_products": prod_service
"code": currentpack, "prix": packprice, "comment": "nc", "qty": nb_formations, "pack_products": prod_service
}));
@ -705,7 +715,7 @@ function CheckOut(props) {
body: form,
}).then((data) => data.json())
.then((data) => {
console.log(' #### subscription_id:', data['subscription_id'], ' ### payment_intent_client_secret:', data['payment_intent_client_secret'], "data['Status'] = ", data['status'],);
//console.log(' #### subscription_id:', data['subscription_id'], ' ### payment_intent_client_secret:', data['payment_intent_client_secret'], "data['Status'] = ", data['status'],);
if (String(data['status']) === String("true")) {
//console.log(" subscriptionId = " + subscriptionId + " -- et clientSecret = " + clientSecret);
@ -794,7 +804,7 @@ function CheckOut(props) {
body: form,
}).then((data) => data.json())
.then((data) => {
console.log(' #### status:', data['status'], ' -- payement_id:', data['payement_id'], " -- amount_captured = ", data['amount_captured'],);
//console.log(' #### status:', data['status'], ' -- payement_id:', data['payement_id'], " -- amount_captured = ", data['amount_captured'],);
if (String(data['status']) === String("true")) {
setpayement_ok("1");
@ -824,6 +834,18 @@ function CheckOut(props) {
// Fing gestion stripe
const [nb_formations, setnb_formations] = useState("0");
const change_nb_formations = event => {
let valeur = event.target.value
//console.log(" valeur , ", valeur);
setnb_formations( event.target.value);
document.getElementById('div_nb_formation').style.color = "#104277" ;
document.getElementById('div_ttc').style.color = "#104277" ;
}
return (
<div className="checkout">
@ -854,65 +876,76 @@ function CheckOut(props) {
</div>
<div className="div_row_droite"> <div className="titre1"> Detail prix </div>
<div>
<div style={{ "width": "100%" }}>
<div style={{ "textAlign": "left", "width": "30%", "float": "left" }}>
<div style={{ "width": "90%" }}>
<div style={{ "textAlign": "left", "width": "50%", "float": "left" }}>
Periodicité :
</div>
<div style={{ "textAlign": "right", "width": "30%", "float": "left" }}>
<div style={{ "textAlign": "right", "width": "50%", "float": "left" }}>
<b><u> {periodicity} </u> </b>
</div>
<div> &nbsp;
</div>
</div>
<div style={{ "width": "100%" }}>
<div style={{ "textAlign": "left", "width": "30%", "float": "left" }}>
<div style={{ "width": "90%" }}>
<div style={{ "textAlign": "left", "width": "50%", "float": "left" }}>
Prix unitaire :
</div>
<div style={{ "textAlign": "right", "width": "30%", "float": "left" }}>
<div style={{ "textAlign": "right", "width": "50%", "float": "left" }}>
{packprice}
</div>
<div> &nbsp;
</div>
</div>
<div style={{ "width": "100%" }}>
<div style={{ "textAlign": "left", "width": "30%", "float": "left" }}>
<div style={{ "width": "90%" }} id="div_nb_formation">
<div style={{ "textAlign": "left", "width": "50%", "float": "left" }}>
Nombre de formations :
</div>
<div style={{ "textAlign": "right", "width": "50%", "float": "left" }}>
<input
value={nb_formations}
onChange={change_nb_formations}
type="number"
min="1"
max="50"
style={{"textAlign":"center"}}
/>
</div>
</div>
<div style={{ "width": "90%" }}>
<div style={{ "textAlign": "left", "width": "50%", "float": "left" }}>
TVA :
</div>
<div style={{ "textAlign": "right", "width": "30%", "float": "left" }}>
{packprice * 0.2}
</div>
<div> &nbsp;
<div style={{ "textAlign": "right", "width": "50%", "float": "left" }}>
{packprice * nb_formations * 0.2}
</div>
</div>
<div style={{ "width": "100%" }}>
<div style={{ "textAlign": "left", "width": "30%", "float": "left" }}>
<div style={{ "width": "90%" }}>
<div style={{ "textAlign": "left", "width": "50%", "float": "left" }}>
Discount :
</div>
<div style={{ "textAlign": "right", "width": "30%", "float": "left" }}>
<div style={{ "textAlign": "right", "width": "50%", "float": "left" }}>
0
</div>
<div> &nbsp;
</div>
</div>
<div style={{ "width": "100%" }}>
<div style={{ "textAlign": "left", "width": "30%", "float": "left" }}>
<div style={{ "width": "90%" }} id="div_ttc">
<div style={{ "textAlign": "left", "width": "50%", "float": "left" }}>
Total TTC :
</div>
<div style={{ "textAlign": "right", "width": "30%", "float": "left" }}>
{packprice * 1.2}
<div style={{ "textAlign": "right", "width": "50%", "float": "left" }}>
{packprice * nb_formations * 1.2}
</div>
<div> &nbsp; {
}
<div> &nbsp;
</div>
</div>

View File

@ -98,7 +98,8 @@ function PaymentMethodeNoConnect(props) {
const stored_part = getCookie('tokenmysypart');
const [paymenadded_api, setpaymenadded_api] = useState([]);
const [paymenadded_message, setpaymenadded_message] = useState([]);
function RecordData() {
const formData = new FormData();
@ -134,7 +135,7 @@ function PaymentMethodeNoConnect(props) {
)
.then((response) => response.json())
.then((result) => {
console.log('Success:', result['message'], "result['status'] = ", result['status']);
console.log(' paymenadded_api Success:', result['message'], "result['status'] = ", result['status']);
setmyApiResponse(result['status']);
setResult(result['message']);
@ -323,7 +324,7 @@ function PaymentMethodeNoConnect(props) {
<div className="div_row_central">
Pour confirmer le changement, veuillez entrer votre mot de passe et votre clé sécrete <br />
Pour confirmer le changement, veuillez entrer votre mot de passe et votre clé sécrete <br />
<Box alignItems="left" sx={{ '& > :not(style)': { m: 1 }, width: '100%', }}>

View File

@ -152,10 +152,15 @@
}
.btn_enreg_cmd {
//width: 10rem;
background-color: green !important;
background: #81BC3A;
padding: 0.3rem;
border-radius: 5rem;
font-size: small;
text-align: left;
border: solid 1px;
height: 2.5rem;
color: white;
padding: 10px;
width: 90%;
}
}
@ -304,10 +309,15 @@
}
.btn_enreg_cmd {
//width: 10rem;
background-color: green !important;
background: #81BC3A;
padding: 0.3rem;
border-radius: 5rem;
font-size: small;
text-align: left;
border: solid 1px;
height: 2.5rem;
color: white;
padding: 10px;
width: 80%;
}
}
@ -455,10 +465,15 @@
}
.btn_enreg_cmd {
//width: 10rem;
background-color: green !important;
background: #81BC3A;
padding: 0.3rem;
border-radius: 5rem;
font-size: small;
text-align: left;
border: solid 1px;
height: 2.5rem;
color: white;
padding: 10px;
width: 80%;
}
}
@ -592,10 +607,16 @@
}
.btn_enreg_cmd {
//width: 10rem;
background-color: green !important;
background: #81BC3A;
padding: 0.3rem;
border-radius: 5rem;
font-size: small;
text-align: left;
border: solid 1px;
height: 2.5rem;
color: white;
padding: 10px;
width: 50%;
}

View File

@ -211,7 +211,8 @@
text-align: left;
border: solid 1px;
height: 2.5rem;
color: black;
color: white;
}
}
@ -398,7 +399,8 @@
text-align: left;
border: solid 1px;
height: 2.5rem;
color: black;
color: white;
letter-spacing: 3px;
}
}
@ -585,7 +587,8 @@
text-align: left;
border: solid 1px;
height: 2.5rem;
color: black;
color: white;
letter-spacing: 3px;
}
}
@ -774,7 +777,8 @@
text-align: left;
border: solid 1px;
height: 2.5rem;
color: black;
color: white;
letter-spacing: 3px;
}

View File

@ -500,6 +500,15 @@
color: white;
}
.btn_arret_abonnement {
background-color: #ac9c13;
font-size: 0.9rem !important;
width: 100%;
color: white;
}
.btn_abonnement_sur_mesure {
font-size: 0.7rem !important;
width: 100%;
@ -992,6 +1001,15 @@
color: white;
}
.btn_arret_abonnement {
background-color: #ac9c13;
font-size: 0.7rem !important;
width: 100%;
color: white;
}
.btn_abonnement_sur_mesure {
font-size: 0.6rem !important;
width: 100%;
@ -1516,6 +1534,14 @@
color: white;
}
.btn_arret_abonnement {
background-color: #ac9c13;
font-size: 0.7rem !important;
width: 100%;
color: white;
}
.btn_abonnement_sur_mesure {
font-size: 0.8rem !important;
width: 100%;