diff --git a/src/components/Abonnement.js b/src/components/Abonnement.js index 4d66ec9..e9c1081 100644 --- a/src/components/Abonnement.js +++ b/src/components/Abonnement.js @@ -29,6 +29,7 @@ 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 import { RiAddCircleLine } from "react-icons/ri"; +import img_loading_spin from "./../mysy_img/mysy_spin_loading.gif"; function Abonnement(props) { @@ -488,7 +489,7 @@ function Abonnement(props) { getCurrentUserData(); GetPayementMode(); setpackprice(); - + }, []); @@ -759,6 +760,8 @@ function Abonnement(props) { }) } + const [isLoading, setLoading] = useState(); + const [neworderid, setneworderid] = useState(""); const [New_Ordervalidation_api, setNew_Ordervalidation_api] = useState(); const [New_Ordervalidation_message, setNew_Ordervalidation_message] = useState(); @@ -795,7 +798,8 @@ function Abonnement(props) { //form.append("1", JSON.stringify({ "code": "art_supp", "prix": "120", "comment": "nc" })); - + + setLoading(true); var myurl = process.env.REACT_APP_API_URL + "myclass/api/createOrder/"; fetch(myurl, @@ -817,11 +821,13 @@ function Abonnement(props) { // Mise à jour du plan de payement Update_Payement_Plan_Qty(); + setLoading(false); } else { setNew_Ordervalidation_api("false"); setNew_Ordervalidation_message(data['message']); + setLoading(false); } @@ -829,8 +835,10 @@ function Abonnement(props) { console.error('Error:', error); setneworderid(""); setNew_Ordervalidation_api("false"); + setLoading(false); }); + // setLoading(false); } @@ -952,6 +960,10 @@ function Abonnement(props) { return (
+ {isLoading &&
+
+
} + {String(gotocheckout) === String("1") &&
@@ -981,10 +993,10 @@ function Abonnement(props) {
Nombre de formations : {String(parnternbformation)}   - {result && !(JSON.parse(result).end_date_abonnement) && !changepartnb_ftion - && currentpack2 - && String(currentpack2).toLowerCase() !=="decouverte" - && + {result && !(JSON.parse(result).end_date_abonnement) && !changepartnb_ftion + && currentpack2 + && String(currentpack2).toLowerCase() !== "decouverte" + && }
@@ -1056,11 +1068,11 @@ function Abonnement(props) {
-
+
-
+
@@ -1235,7 +1247,7 @@ function Abonnement(props) { ), }} - + /> ), }} - + />
@@ -1269,7 +1281,7 @@ function Abonnement(props) { ), }} - + /> @@ -1286,10 +1298,10 @@ function Abonnement(props) { ), }} - + /> - + ), }} - + />
), }} - + /> ), }} - + />
), }} - + />
diff --git a/src/components/HebergementLms.js b/src/components/HebergementLms.js index 69b5fc3..b84e47f 100644 --- a/src/components/HebergementLms.js +++ b/src/components/HebergementLms.js @@ -216,17 +216,26 @@ function HebergementLms(props) { _URL.revokeObjectURL(objectUrl); console.log(" img_width = ", img_width, " img_height = ", img_height) - if (parseFloat(img_width) > 140 && parseFloat(img_width) < 250 && + if (parseFloat(img_width) > 130 && parseFloat(img_width) < 260 && parseFloat(img_height) > 60 && parseFloat(img_height) < 150) { //console.log(" img_height est = ", img_height, " < à 1500 "); // Verification que le nom du fichier est alpha numerique - var regExp = /^[A-Za-z0-9]+$/; + /*var regExp = /^[A-Za-z0-9]+$/; if (!regExp.test(event.target.files[0].name)) { sethandleSubmission_logo_message(" Le nom de l'image comporte des caractères non alphanumériques"); sethandleSubmission_logo_api("false"); setLoading(false); + return + }*/ + + + if (String(event.target.files[0].name).length > 50) { + sethandleSubmission_logo_message(" Le nom du fichier est trop long. il doit faire moins de 50 caractère"); + sethandleSubmission_logo_api("false"); + setLoading(false); + return } @@ -241,7 +250,7 @@ function HebergementLms(props) { return; } - console.log(" after img_width = ", img_width, " after img_height = ", img_height) + //console.log(" after img_width = ", img_width, " after img_height = ", img_height) }; img.src = objectUrl; @@ -343,18 +352,27 @@ function HebergementLms(props) { img.onload = function () { img_height = this.height; img_width = this.width; - console.log(" img_width = ", img_width); + //console.log(" img_width = ", img_width); _URL.revokeObjectURL(objectUrl); if (parseFloat(img_width) > 1500 && parseFloat(img_width) < 1930 && parseFloat(img_height) > 150 && parseFloat(img_height) < 195) { //console.log(" img_height est = ", img_height, " < à 1500 "); // Verification que le nom du fichier est alpha numerique - var regExp = /^[A-Za-z0-9]+$/; + /*var regExp = /^[A-Za-z0-9]+$/; if (!regExp.test(event.target.files[0].name)) { sethandleSubmission_bg_message(" Le nom de l'image comporte des caractères non alphanumériques"); sethandleSubmission_bg_api("false"); setLoading(false); + return + }*/ + + + if (String(event.target.files[0].name).length > 50) { + sethandleSubmission_bg_message(" Le nom du fichier est trop long. il doit faire moins de 50 caractère"); + sethandleSubmission_bg_api("false"); + setLoading(false); + return } diff --git a/src/styles/components/_abonnement.scss b/src/styles/components/_abonnement.scss index 2bfc2fd..394f582 100644 --- a/src/styles/components/_abonnement.scss +++ b/src/styles/components/_abonnement.scss @@ -22,6 +22,26 @@ font-style: italic; } + .loader-container { + width: 100%; + height: 100vh; + display: flex; + //justify-content: center; + align-items: center; + left: -5%; + position: fixed; + z-index: 1; + top: 0px; + background: white; + background-color: transparent; + } + + .mysy_spinner{ + border-radius: 5px; + border: 1px solid black; + opacity: 100%; + } + @media only screen and (max-width: 600px) { /*style smartphones et petites tablettes en portrait*/