From 8bc86a7bf2cb032cfcaafe46236f17d9b14d01b3 Mon Sep 17 00:00:00 2001 From: cherif Date: Sat, 21 Jan 2023 12:17:19 +0100 Subject: [PATCH] 21/01/23 - 12h --- src/components/Abonnement.js | 38 +++++-- src/components/CheckOut.js | 105 ++++++++++++------ src/components/PaymentMethode_Carte.js | 7 +- src/styles/components/_checkout.scss | 45 ++++++-- .../_displaypartnertrainingpagination.scss | 12 +- src/styles/components/_produitsservices.scss | 26 +++++ 6 files changed, 171 insertions(+), 62 deletions(-) diff --git a/src/components/Abonnement.js b/src/components/Abonnement.js index fb9b2d4..7020eca 100644 --- a/src/components/Abonnement.js +++ b/src/components/Abonnement.js @@ -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) {
Votre plan actuel
Vous êtes actuellement sur un plan : {String(currentpack2).toUpperCase()} {result && (JSON.parse(result).end_date_abonnement) && - } + }
 
Mode de Paiement
@@ -1177,16 +1182,26 @@ function Abonnement(props) { > Activez ce pack } - {String(currentpack2).toLowerCase() === String("Decouverte") &&
+ {String(currentpack2).toLowerCase() === String("decouverte") && (!JSON.parse(result).end_date_abonnement) && +
} + {String(currentpack2).toLowerCase() === String("decouverte") && (JSON.parse(result).end_date_abonnement) && +
+ +
} +
@@ -1242,16 +1257,25 @@ function Abonnement(props) { }}> Activez ce pack
} - {String(currentpack2).toLowerCase() === String("standard") &&
+ {String(currentpack2).toLowerCase() === String("standard") && (!JSON.parse(result).end_date_abonnement) &&
} + {String(currentpack2).toLowerCase() === String("standard") && (JSON.parse(result).end_date_abonnement) && +
+ +
} +
diff --git a/src/components/CheckOut.js b/src/components/CheckOut.js index 1ec50ae..1e2e899 100644 --- a/src/components/CheckOut.js +++ b/src/components/CheckOut.js @@ -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 (
@@ -854,65 +876,76 @@ function CheckOut(props) {
Detail prix
-
-
+
+
Periodicité :
-
+
{periodicity}
-
  -
+
-
-
+
+
Prix unitaire :
-
+
{packprice} €
-
  -
+
-
-
+
+
+ Nombre de formations : +
+
+ +
+ + +
+ + +
+
TVA :
-
- {packprice * 0.2} € -
-
  +
+ {packprice * nb_formations * 0.2} €
+
-
-
+
+
Discount :
-
+
0 €
-
  -
+
-
-
+
+
Total TTC :
-
- {packprice * 1.2} € +
+ {packprice * nb_formations * 1.2} €
-
  { - - - - } +
 
diff --git a/src/components/PaymentMethode_Carte.js b/src/components/PaymentMethode_Carte.js index 37a17e4..ffa3b91 100644 --- a/src/components/PaymentMethode_Carte.js +++ b/src/components/PaymentMethode_Carte.js @@ -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) {
- Pour confirmer le changement, veuillez entrer votre mot de passe et votre clé sécrete
+ Pour confirmer le changement, veuillez entrer votre mot de passe et votre clé sécrete
:not(style)': { m: 1 }, width: '100%', }}> diff --git a/src/styles/components/_checkout.scss b/src/styles/components/_checkout.scss index 58ea2f0..4ad1ffc 100644 --- a/src/styles/components/_checkout.scss +++ b/src/styles/components/_checkout.scss @@ -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%; + } diff --git a/src/styles/components/_displaypartnertrainingpagination.scss b/src/styles/components/_displaypartnertrainingpagination.scss index b40aefe..41a28fe 100644 --- a/src/styles/components/_displaypartnertrainingpagination.scss +++ b/src/styles/components/_displaypartnertrainingpagination.scss @@ -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; } diff --git a/src/styles/components/_produitsservices.scss b/src/styles/components/_produitsservices.scss index 1098615..3726c18 100644 --- a/src/styles/components/_produitsservices.scss +++ b/src/styles/components/_produitsservices.scss @@ -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%;