diff --git a/src/components/DisplayDetailClass_new_v2.js b/src/components/DisplayDetailClass_new_v2.js index b23221e..25e78ca 100644 --- a/src/components/DisplayDetailClass_new_v2.js +++ b/src/components/DisplayDetailClass_new_v2.js @@ -30,6 +30,7 @@ import img_met_rh from "../mysy_img/met_rh.jpg"; import img_met_bureautic from "../mysy_img/met_burautic.jpg"; import img_met_vente from "../mysy_img/met_vente.jpg"; import img_met_sport from "../mysy_img/met_sport.png"; +import img_met_sante_nat from "../mysy_img/met_sante_nat.jpeg"; /* /!\ important: les images du slides doivent avoir une dimension de : 250 X 450 */ @@ -334,7 +335,7 @@ const DisplayDetailClass_new_v2 = (props) => { if (local_user_connect === 0 && local_part_connect === 0) { confirmAlert({ title: 'Connexion ?', - message: 'Connectez-vous pour acceder au detail de cette formation', + message: 'Connectez-vous pour acceder  au detail de cette formation', buttons: [ { label: 'Vous avez un compte', @@ -447,7 +448,7 @@ const DisplayDetailClass_new_v2 = (props) => { console.log("### local_val = ", local_val) if (local_val >= 5) { - console.log(" ON PASSE AU MAX") + console.log(" ON PASSE  au MAX") var local_tmp_val = 2300 + decalage_pr_certificat; var local_main_h_px = 4000 + decalage_pr_certificat; //console.log("### local_tmp_val = ", local_tmp_val, " local_main_h_px = ",local_main_h_px); @@ -463,7 +464,7 @@ const DisplayDetailClass_new_v2 = (props) => { } } else { - console.log(" ON PASSE AU MIN"); + console.log(" ON PASSE  au MIN"); var local_tmp_val = 2100 + decalage_pr_certificat; var local_main_h_px = 4800 + decalage_pr_certificat; @@ -486,7 +487,7 @@ const DisplayDetailClass_new_v2 = (props) => { var local_val = parseInt(String(JSON.parse(res.data.message).nb_pave_a_afficher)); if (local_val >= 5) { - console.log(" ON PASSE AU MAX") + console.log(" ON PASSE  au MAX") local_tmp = "2000px"; main_h_px = "2700px"; @@ -496,7 +497,7 @@ const DisplayDetailClass_new_v2 = (props) => { } } else { - console.log(" ON PASSE AU MIN"); + console.log(" ON PASSE  au MIN"); local_tmp = "1700px"; main_h_px = "2500px"; @@ -516,7 +517,7 @@ const DisplayDetailClass_new_v2 = (props) => { var local_val = parseInt(String(JSON.parse(res.data.message).nb_pave_a_afficher)); if (local_val >= 5) { - console.log(" ON PASSE AU MAX") + console.log(" ON PASSE  au MAX") local_tmp = "2000px"; main_h_px = "2800px"; @@ -526,7 +527,7 @@ const DisplayDetailClass_new_v2 = (props) => { } } else { - console.log(" ON PASSE AU MIN"); + console.log(" ON PASSE  au MIN"); local_tmp = "1700px"; main_h_px = "2500px"; @@ -543,7 +544,7 @@ const DisplayDetailClass_new_v2 = (props) => { if (window.screen.width >= 1200) { var local_val = parseInt(String(JSON.parse(res.data.message).nb_pave_a_afficher)); if (local_val >= 5) { - console.log(" ON PASSE AU MAX") + console.log(" ON PASSE  au MAX") local_tmp = "2000px"; main_h_px = "2800px"; @@ -553,7 +554,7 @@ const DisplayDetailClass_new_v2 = (props) => { } } else { - console.log(" ON PASSE AU MIN"); + console.log(" ON PASSE  au MIN"); local_tmp = "1700px"; main_h_px = "2500px"; @@ -785,7 +786,7 @@ const DisplayDetailClass_new_v2 = (props) => { var new_displaydetailclass_new_v2_hei = parseInt(displaydetailclass_new_v2_hei) + 900; var new_sticky_div_hilight_top = parseInt(sticky_div_hilight_top) + 900; - + document.getElementById('mob_block_cross_sell_cat').style.top = new_meme_orga_top + "px"; document.getElementById('mobile').style.height = new_displaydetailclass_new_v2_hei + "px"; document.getElementById('sticky_div_hilight_pave').style.top = new_sticky_div_hilight_top + "px"; @@ -1384,7 +1385,7 @@ const DisplayDetailClass_new_v2 = (props) => { {(JSON.parse(formation).distantiel) === "1" && (JSON.parse(formation).presentiel) === "1" && (JSON.parse(formation).date_debut).substring(0, 10) !== (JSON.parse(formation).date_fin).substring(0, 10) && } @@ -1402,7 +1403,7 @@ const DisplayDetailClass_new_v2 = (props) => { {(JSON.parse(formation).distantiel) === "1" && ((JSON.parse(formation).presentiel) === "0" || !(JSON.parse(formation).presentiel)) && (JSON.parse(formation).date_debut).substring(0, 10) !== (JSON.parse(formation).date_fin).substring(0, 10) && } @@ -1417,7 +1418,7 @@ const DisplayDetailClass_new_v2 = (props) => { {(JSON.parse(formation).presentiel) === "1" && ((JSON.parse(formation).distantiel) === "0" || !(JSON.parse(formation).distantiel)) && (JSON.parse(formation).date_debut).substring(0, 10) !== (JSON.parse(formation).date_fin).substring(0, 10) && } @@ -1505,7 +1506,7 @@ const DisplayDetailClass_new_v2 = (props) => { } - + {String(iscertifvoltaire) === "1" &&
Certitrace @@ -1525,7 +1526,7 @@ const DisplayDetailClass_new_v2 = (props) => { {associatedtraining_message && associatedtraining_message.length > 0 &&
- Cela pourrait aussi vous intéresser : + Cela pourrait au ssi vous intéresser :
}
@@ -1561,6 +1562,9 @@ const DisplayDetailClass_new_v2 = (props) => { {JSON.parse(formation).metier && String(JSON.parse(formation).metier).toLocaleLowerCase() === String("sport") && sport} + {JSON.parse(formation).metier && String(JSON.parse(formation).metier).toLocaleLowerCase() === String("sante_nat") && + sante naturelle} + {JSON.parse(formation).metier && String(JSON.parse(formation).metier).toLocaleLowerCase() === String("dev_perso") && developpement personnel} @@ -1760,7 +1764,7 @@ const DisplayDetailClass_new_v2 = (props) => { {ratingvalue && String(ratingvalue).length === 1 && parseInt(String(ratingvalue)) <= 5 && } @@ -1858,7 +1862,7 @@ const DisplayDetailClass_new_v2 = (props) => { {(JSON.parse(formation).distantiel) === "1" && (JSON.parse(formation).presentiel) === "1" && (JSON.parse(formation).date_debut).substring(0, 10) !== (JSON.parse(formation).date_fin).substring(0, 10) && } @@ -1876,7 +1880,7 @@ const DisplayDetailClass_new_v2 = (props) => { {(JSON.parse(formation).distantiel) === "1" && ((JSON.parse(formation).presentiel) === "0" || !(JSON.parse(formation).presentiel)) && (JSON.parse(formation).date_debut).substring(0, 10) !== (JSON.parse(formation).date_fin).substring(0, 10) && } @@ -1891,7 +1895,7 @@ const DisplayDetailClass_new_v2 = (props) => { {(JSON.parse(formation).presentiel) === "1" && ((JSON.parse(formation).distantiel) === "0" || !(JSON.parse(formation).distantiel)) && (JSON.parse(formation).date_debut).substring(0, 10) !== (JSON.parse(formation).date_fin).substring(0, 10) && } @@ -2003,6 +2007,10 @@ const DisplayDetailClass_new_v2 = (props) => { DetailTraining.metier && String(DetailTraining.metier).toLocaleLowerCase() === String("sport") && sport} + {(!DetailTraining.img_url || String(DetailTraining.img_url).length <= 0) && + DetailTraining.metier && String(DetailTraining.metier).toLocaleLowerCase() === String("sante_nat") && + sante naturelle} + {(!DetailTraining.img_url || String(DetailTraining.img_url).length <= 0) && DetailTraining.metier && String(DetailTraining.metier).toLocaleLowerCase() === String("dev_perso") && developpement personnel} @@ -2148,7 +2156,7 @@ const DisplayDetailClass_new_v2 = (props) => {
- {(JSON.parse(formation).date_debut).substring(0, 10)} au {(JSON.parse(formation).date_fin).substring(0, 10)} + {(JSON.parse(formation).date_debut).substring(0, 10)}  au {(JSON.parse(formation).date_fin).substring(0, 10)}
@@ -2204,7 +2212,7 @@ const DisplayDetailClass_new_v2 = (props) => { Bureau Certitrace
} - + {String(iscertifvoltaire) === "1" &&
Certitrace @@ -2234,7 +2242,7 @@ const DisplayDetailClass_new_v2 = (props) => {
- Organisme de formation : + Organisme de formation :
@@ -2242,7 +2250,7 @@ const DisplayDetailClass_new_v2 = (props) => { {partnair_name && } {String(JSON.parse(formation).code_postal) !== "0" && String(JSON.parse(formation).date_debut) !== String(JSON.parse(formation).date_fin) && }
@@ -2732,7 +2743,7 @@ Si non, on utilise le formumaire de mysy,.
-
A voir aussi
+
A voir au ssi
{associatedtraining_message && String(associatedtraining_api) === "True" && diff --git a/src/components/GestionAdministrative.js b/src/components/GestionAdministrative.js index 0c8e330..b2ba6dc 100644 --- a/src/components/GestionAdministrative.js +++ b/src/components/GestionAdministrative.js @@ -2479,6 +2479,7 @@ function GestionAdministrative(props) { form.append("token", stored_cookie); form.append("session_id", mysession); form.append("attendee_email", selectedattendeeemail); + form.append("class_internal_url", internal_url); var myurl = process.env.REACT_APP_API_URL + "myclass/api/SendAttendeeCertification/"; @@ -2978,9 +2979,9 @@ function GestionAdministrative(props) { setsessionChanged(true); } } - showTimeSelect + showTimeSelect={false} filterTime={filterPassedTime_start} - dateFormat="dd/MM/yyyy HH:mm" + dateFormat="dd/MM/yyyy" className="disabled_style" locale='fr-FR' @@ -2998,9 +2999,9 @@ function GestionAdministrative(props) { setsessionChanged(true); } } - showTimeSelect + showTimeSelect={false} filterTime={filterPassedTime_end} - dateFormat="dd/MM/yyyy HH:mm" + dateFormat="dd/MM/yyyy" className="disabled_style" />
@@ -3144,9 +3145,9 @@ function GestionAdministrative(props) { } } - showTimeSelect + showTimeSelect={false} //filterTime={filterPassedTime_start} - dateFormat="dd/MM/yyyy HH:mm" + dateFormat="dd/MM/yyyy" className="disabled_style" locale='fr-FR' @@ -3165,9 +3166,9 @@ function GestionAdministrative(props) { setsessionChanged(true); } } - showTimeSelect + showTimeSelect={false} //filterTime={filterPassedTime_end} - dateFormat="dd/MM/yyyy HH:mm" + dateFormat="dd/MM/yyyy" className="disabled_style" />
@@ -3268,9 +3269,13 @@ function GestionAdministrative(props) {
}
} + +
+   +
+
- - + @@ -3938,7 +3943,7 @@ function GestionAdministrative(props) { id="detail_incr_date" selected={detailuser_date_inscription} - dateFormat="dd/MM/yyyy HH:mm" + dateFormat="dd/MM/yyyy" className="disabled_style" locale='fr-FR' @@ -4011,7 +4016,7 @@ function GestionAdministrative(props) { selected={detailuser_date_evaluation} - dateFormat="dd/MM/yyyy HH:mm" + dateFormat="dd/MM/yyyy" className="disabled_style" locale='fr-FR' @@ -4109,7 +4114,7 @@ function GestionAdministrative(props) { id="certif_date" selected={detailuser_date_certification} - dateFormat="dd/MM/yyyy HH:mm" + dateFormat="dd/MM/yyyy" className="disabled_style" locale='fr-FR' @@ -4124,7 +4129,7 @@ function GestionAdministrative(props) { id="certif_date" selected={detailuser_date_certification} - dateFormat="dd/MM/yyyy HH:mm" + dateFormat="dd/MM/yyyy" className="disabled_style" locale='fr-FR' style={{ "visibility": "hidden" }} @@ -4184,6 +4189,9 @@ function GestionAdministrative(props) { } +
+   +
diff --git a/src/components/Partner.js b/src/components/Partner.js index cf1db39..89e8b1c 100644 --- a/src/components/Partner.js +++ b/src/components/Partner.js @@ -25,6 +25,7 @@ import CheckOut from "./CheckOut"; import { IoCheckmarkCircleSharp } from "react-icons/io5"; import { FaHandPointRight } from "react-icons/fa"; import OrderConfirmation from "./OrderConfirmation"; +import Pricing from "./Pricing"; const Partner = (props) => { const { commingmenu, commingpack } = useParams(); @@ -214,12 +215,12 @@ const Partner = (props) => { if (action && list_menu.includes(action)) { setmenu(action); - if( action && orderid && packs && String("ordervalide")){ + if (action && orderid && packs && String("ordervalide")) { CheckSalesOrder(); } - if( action && orderid && packs && String("abonnement")){ - //console.log(" abonnement : payement intent = ", orderid, " pack = ", packs); + if (action && orderid && packs && String("abonnement")) { + //console.log(" abonnement : payement intent = ", orderid, " pack = ", packs); } } }, []) @@ -258,6 +259,12 @@ const Partner = (props) => { setformation_file_name(); } + function pricing_func(event) { + setmenu("pricing"); + setapiexcelimportmessage(); + setformation_file_name(); + } + function DiplaytrainingList(event) { setmenu("affichage"); @@ -546,6 +553,13 @@ const Partner = (props) => { {String(menu) === "abonnement" &&
ABONNEMENT
}
+ + {String(menu) !== "abonnement" &&
MES PRIX
} + {String(menu) === "abonnement" &&
MES PRIX
} +
+ + + {String(menu) !== "facture" &&
FACTURATION
} {String(menu) === "facture" &&
FACTURATION
}
@@ -749,6 +763,17 @@ const Partner = (props) => { } + {String(menu) === "pricing" &&
+ {/*String(partnerstatus) === String("1") && +
Finalisez la création de votre compte en ajoutant le moyen de payement de votre choix :) +
*/} + + + + +
+ } + {String(menu) === "abonnement" &&
{/*String(partnerstatus) === String("1") &&
Finalisez la création de votre compte en ajoutant le moyen de payement de votre choix :) diff --git a/src/components/Pricing.js b/src/components/Pricing.js new file mode 100644 index 0000000..64edcc5 --- /dev/null +++ b/src/components/Pricing.js @@ -0,0 +1,1051 @@ +import React, { useState, useEffect } from "react"; +import { useForm } from "react-hook-form"; +import { useHistory } from "react-router-dom"; +import { Button, FormGroup, Label, Input } from "reactstrap"; +import { FacebookLoginButton, GoogleLoginButton } from "react-social-login-buttons"; +//import { getCookie, setCookie, removeCookie } from 'react-use-cookie'; +import { Helmet } from "react-helmet"; +import { useCookies } from "react-cookie"; +import { confirmAlert } from 'react-confirm-alert'; // Import +import 'react-confirm-alert/src/react-confirm-alert.css'; // Import css +import bannerimg2 from "../mysy_img/MYSY-LOGO-BLUE.png"; +import Popup from 'reactjs-popup'; +import 'reactjs-popup/dist/index.css'; +import axios from "axios"; +import { useParams } from 'react-router-dom' +import logowhite from "../mysy_img/MYSY-LOGO-WHITE.png"; +import Footer from "./Fotter"; +import MenuItem from "@material-ui/core/MenuItem"; +import Button2 from "@material-ui/core/Button"; +import Menu from "@material-ui/core/Menu"; +import Header from "./Header"; +import { useLocation } from "react-router-dom"; +import { AiOutlineEdit, AiOutlinePlusCircle, AiTwotoneDelete } from "react-icons/ai"; +import { getCookie } from 'react-use-cookie'; +import { DataGrid, GridToolbar, frFR } from '@mui/x-data-grid'; +import Box from '@mui/material/Box'; +import InputLabel from '@mui/material/InputLabel'; +import InputAdornment from '@mui/material/InputAdornment'; +import FormControl from '@mui/material/FormControl'; +import TextField from '@mui/material/TextField'; +import AccountCircle from '@mui/icons-material/AccountCircle'; +import DatePicker from "react-datepicker"; +import "react-datepicker/dist/react-datepicker.css"; +import moment from "moment"; +import { set } from "date-fns"; + + +function Pricing() { + + // recuperation et gestion du token utilisateur + const history = useHistory(); + const stored_part = getCookie('tokenmysypart'); + const [selectionModel, setSelectionModel] = React.useState([]); + const [rowss, setRows] = useState([]); + const [menu, setmenu] = useState("default"); + const [iseditclientprice, setiseditclientprice] = useState(); + + const columns_prix_client = [ + { field: 'id', headerName: 'id', hide: true }, + { field: 'price_line_id', headerName: '_id', hide: true }, + { field: 'client', headerName: 'Client', width: 150, flex: 1 }, + { field: 'client_recid', headerName: 'Client Id', width: 150, hide: true }, + { field: 'discount', headerName: 'Réduction (%)', width: 100, hideable: false, flex: 1 }, + { field: 'date_debut', headerName: 'Date début', width: 150, flex: 1 }, + { field: 'date_fin', headerName: 'Date Fin', width: 150, flex: 1 }, + + { + field: "modifier", headerName: 'Modifier', + renderCell: (cellValues) => { + return ( + + + + ); + } + }, + { + field: "supprimer", headerName: 'Supprimer', + renderCell: (cellValues) => { + return ( + { + handleClick_delete(event, cellValues); + }} + > + + + } + modal + nested + position="center center" + > + {close => ( +
+ +
MySy Information
+
+ {' '} + + En confirmant cette opération, vous allez definitivement supprimer ce proix du système
+
+
+
+ + +
+
+ +
+
+
+ )} +
+ ); + } + } + ] + + + function handleClick(event, cellValues) { + + var price_line_id = cellValues.row.price_line_id; + setcurrentlineprice_id(price_line_id); + + setiseditclientprice(); + setisaddprice(); + Clean_notification(); + + GetAPrice_Data(price_line_id); + } + + const [isaddprice, setisaddprice] = useState(); + function handleAddPriceClick() { + setisaddprice("1"); + setiseditclientprice(); + Desable_new_prices_fields(); + + } + + const [GetClienPrices_api, setGetClienPrices_api] = useState() + const [GetClienPrices_result, setGetClienPrices_result] = useState([]); + const [GetClienPrices_message, setGetClienPrices_message] = useState() + + function GetClientPrices(event) { + var form = new FormData(); + + //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/get_cust_prices_by_partner/"; + + + fetch(myurl, + { + method: 'POST', + body: form, + }) + .then((data) => data.json()) + .then((data) => { + //console.log('Success:', data['message'], "data['status'] = ", data['status']); + + + if (String(data['status']) === String("false")) { + + //console.log("erreur rrrr:" + data['status']) + setGetClienPrices_api("false"); + + } + else if (String(data['status']) === String("true")) { + setGetClienPrices_result(data['message']); + setGetClienPrices_api("true"); + + } + + }).catch((error) => { + console.error('Error:', error); + setGetClienPrices_api("false"); + }); + + } + + const [selectedlinked_client, setselectedlinked_client] = useState() + + function changeselectedclient(event) { + setselectedlinked_client(event.target.value); + if (String(event.target.value).trim() !== "") { + Enable_new_prices_fields(); + + } else { + Desable_new_prices_fields(); + } + }; + + const [GetClient_Linked_api, setGetClient_Linked_api] = useState() + const [GetClient_Linked_result, setGetClient_Linked_result] = useState([]); + const [GetClient_Linked_message, setGetClient_Linked_message] = useState() + + function GetClientlinked(event) { + var form = new FormData(); + + //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/get_linked_customer_to_partner/"; + + + fetch(myurl, + { + method: 'POST', + body: form, + }) + .then((data) => data.json()) + .then((data) => { + //console.log('Success:', data['message'], "data['status'] = ", data['status']); + + + if (String(data['status']) === String("false")) { + + //console.log("erreur rrrr:" + data['status']) + setGetClient_Linked_api("false"); + + } + else if (String(data['status']) === String("true")) { + setGetClient_Linked_result(data['message']); + setGetClient_Linked_api("true"); + + } + + }).catch((error) => { + console.error('Error:', error); + setGetClient_Linked_api("false"); + }); + + } + + + function Enable_new_prices_fields() { + + + if (document.getElementsByName("new_discount") && document.getElementsByName("new_discount")[0]) { + document.getElementsByName("new_discount")[0].disabled = false; + document.getElementsByName("new_discount")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("sessiondatedebut") && document.getElementsByName("sessiondatedebut")[0]) { + document.getElementsByName("sessiondatedebut")[0].disabled = false; + document.getElementsByName("sessiondatedebut")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("sessiondatefin") && document.getElementsByName("sessiondatefin")[0]) { + document.getElementsByName("sessiondatefin")[0].disabled = false; + document.getElementsByName("sessiondatefin")[0].style.backgroundColor = "#FFFFFF"; + } + + } + + function Desable_new_prices_fields() { + + + if (document.getElementsByName("new_discount") && document.getElementsByName("new_discount")[0]) { + document.getElementsByName("new_discount")[0].disabled = true; + document.getElementsByName("new_discount")[0].style.backgroundColor = "#ECEFF1"; + } + + + + if (document.getElementsByName("new_sessiondatedebut") && document.getElementsByName("new_sessiondatedebut")[0]) { + document.getElementsByName("new_sessiondatedebut")[0].disabled = true; + document.getElementsByName("new_sessiondatedebut")[0].style.backgroundColor = "#ECEFF1"; + + } + + if (document.getElementById("new_sessiondatefin")) { + document.getElementById("new_sessiondatefin").disabled = true; + document.getElementById("new_sessiondatefin").style.backgroundColor = "#ECEFF1"; + } + + + } + + + function Clean_new_prices_fields() { + + + if (document.getElementsByName("new_discount") && document.getElementsByName("new_discount")[0]) { + document.getElementsByName("new_discount")[0].disabled = true; + document.getElementsByName("new_discount")[0].style.backgroundColor = "#ECEFF1"; + setnew_discount_val(""); + } + + if (document.getElementsByName("new_sessiondatedebut") && document.getElementsByName("new_sessiondatedebut")[0]) { + document.getElementsByName("new_sessiondatedebut")[0].disabled = true; + document.getElementsByName("new_sessiondatedebut")[0].style.backgroundColor = "#ECEFF1"; + setNew_SessionstartDate(""); + } + + if (document.getElementsByName("new_sessiondatefin") && document.getElementsByName("new_sessiondatefin")[0]) { + document.getElementsByName("new_sessiondatefin")[0].disabled = true; + document.getElementsByName("new_sessiondatefin")[0].style.backgroundColor = "#ECEFF1"; + setNew_SessionendDate(""); + } + + } + + function Clean_prices_fields() { + + + if (document.getElementsByName("discount") && document.getElementsByName("discount")[0]) { + document.getElementsByName("discount")[0].disabled = true; + document.getElementsByName("discount")[0].style.backgroundColor = "#ECEFF1"; + setnew_discount_val(""); + } + + if (document.getElementsByName("sessiondatedebut") && document.getElementsByName("sessiondatedebut")[0]) { + document.getElementsByName("sessiondatedebut")[0].disabled = true; + document.getElementsByName("sessiondatedebut")[0].style.backgroundColor = "#ECEFF1"; + setNew_SessionstartDate(""); + } + + if (document.getElementsByName("sessiondatefin") && document.getElementsByName("sessiondatefin")[0]) { + document.getElementsByName("sessiondatefin")[0].disabled = true; + document.getElementsByName("sessiondatefin")[0].style.backgroundColor = "#ECEFF1"; + setNew_SessionendDate(""); + } + + } + + function DataUpdated() { + Clean_notification(); + + } + + useEffect(() => { + GetClientPrices(); + GetClientlinked(); + }, []); + + let [sessionStatus, setsessionStatus] = useState(false); + let [sessionChanged, setsessionChanged] = useState(false); + + const [SessionstartDate, setSessionstartDate] = useState(""); + const [New_SessionstartDate, setNew_SessionstartDate] = useState(""); + + const filterPassedTime_start = (time) => { + const currentDate = new Date(); + const selectedDate = new Date(time); + + return currentDate.getTime() < selectedDate.getTime(); + }; + + + const [SessionendDate, setSessionendDate] = useState(""); + const [New_SessionendDate, setNew_SessionendDate] = useState(""); + + const filterPassedTime_end = (time) => { + const currentDate = new Date(); + const selectedDate = new Date(time); + + return currentDate.getTime() < selectedDate.getTime(); + }; + + const [discount_val, setdiscount_val] = useState(""); + + const [new_discount_val, setnew_discount_val] = useState(""); + + + + const Change_new_discount_val = (event) => { + const value = event.target.value; + if (isNaN(value)) { + alert(" Valeur incorrecte. "); + + } else { + setnew_discount_val(value); + + } + + } + + const Change_discount_val = (event) => { + const value = event.target.value; + if (isNaN(value)) { + alert(" Valeur incorrecte. "); + + } else { + setdiscount_val(value); + + } + + } + + const [Record_new_Price_api, setRecord_new_Price_api] = useState(""); + const [Record_new_Price_result, setRecord_new_Price_result] = useState(""); + const [Record_new_Price_message, setRecord_new_Price_message] = useState(""); + + function Record_new_Price() { + Clean_notification(); + + const formData = new FormData(); + const url = process.env.REACT_APP_API_URL + "myclass/api/add_business_price/"; + + if (String(selectedlinked_client).trim() === "") { + alert(" Le client n'est pas identifié"); + return; + } + + if (String(new_discount_val).trim() === "") { + alert(" Il manque la réduction"); + return; + } + + var local_date_debut = "" + if (!New_SessionstartDate || String(New_SessionstartDate).trim() === "") { + alert(" Vous devez definir la date d'application de la réduction "); + return; + } else { + local_date_debut = moment(New_SessionstartDate).format('DD/MM/YYYY'); + } + + var local_date_fin = "" + if (!New_SessionendDate || String(New_SessionendDate).trim() === "") { + alert(" Vous devez definir la date de fin de la réduction "); + return; + + } else { + local_date_fin = moment(New_SessionendDate).format('DD/MM/YYYY'); + } + + + // var class_internal_url = document.getElementsByName("adr_country")[0].value; + const stored_cookie = getCookie('tokenmysypart'); + formData.append("token", stored_cookie); + formData.append('client_recid', selectedlinked_client); + formData.append('discount', new_discount_val); + formData.append('date_du', local_date_debut); + formData.append('date_au', local_date_fin); + + fetch( + url, + { + method: 'POST', + body: formData, + } + ) + .then((response) => response.json()) + .then((result) => { + //console.log('Success:', result['message'], "result['status'] = ", result['status']); + setRecord_new_Price_api(result['status']); + setRecord_new_Price_result(result['status']); + setRecord_new_Price_message(result['message']); + + if (String(result['status']) === "true") { + Clean_new_prices_fields(); + GetClientPrices(); + } + + }) + .catch((error) => { + console.error('Error:', error); + setRecord_new_Price_api("false"); + setRecord_new_Price_result("false"); + setRecord_new_Price_message(" Impossible de créer le prix"); + }); + + + }; + + + const [currentlineprice_id, setcurrentlineprice_id] = useState(""); + + const [Update_Price_api, setUpdate_Price_api] = useState(""); + const [Update_Price_result, setUpdate_Price_result] = useState(""); + const [Update_Price_message, setUpdate_Price_message] = useState(""); + + function Clean_notification(){ + setRecord_new_Price_api(""); + setRecord_new_Price_result(""); + setRecord_new_Price_message(""); + setDelete_Price_api(""); + setUpdate_Price_api(""); + + } + + function Update_Price() { + + Clean_notification(); + + const formData = new FormData(); + const url = process.env.REACT_APP_API_URL + "myclass/api/update_business_price/"; + + if (String(discount_val).trim() === "") { + alert(" Il manque la réduction"); + return; + } + + var local_date_debut = "" + if (!SessionstartDate || String(SessionstartDate).trim() === "") { + alert(" Vous devez definir la date d'application de la réduction "); + return; + } else { + local_date_debut = moment(SessionstartDate).format('DD/MM/YYYY'); + } + + var local_date_fin = "" + if (!SessionendDate || String(SessionendDate).trim() === "") { + alert(" Vous devez definir la date de fin de la réduction "); + return; + + } else { + local_date_fin = moment(SessionendDate).format('DD/MM/YYYY'); + } + + + // var class_internal_url = document.getElementsByName("adr_country")[0].value; + const stored_cookie = getCookie('tokenmysypart'); + formData.append("token", stored_cookie); + formData.append('price_id', currentlineprice_id); + formData.append('discount', discount_val); + formData.append('date_du', local_date_debut); + formData.append('date_au', local_date_fin); + + fetch( + url, + { + method: 'POST', + body: formData, + } + ) + .then((response) => response.json()) + .then((result) => { + //console.log('Success:', result['message'], "result['status'] = ", result['status']); + setUpdate_Price_api(result['status']); + setUpdate_Price_result(result['status']); + setUpdate_Price_message(result['message']); + + if (String(result['status']) === "true") { + Clean_prices_fields(); + GetClientPrices(); + setiseditprice(false); + GetClientPrices(); + } + + }) + .catch((error) => { + console.error('Error:', error); + setUpdate_Price_api("false"); + setUpdate_Price_result("false"); + setUpdate_Price_message(" Impossible de créer le prix"); + }); + + + }; + + + const [Delete_Price_api, setDelete_Price_api] = useState(""); + const [Delete_Price_result, setDelete_Price_result] = useState(""); + const [Delete_Price_message, setDelete_Price_message] = useState(""); + + function Delete_Price(localprice_line_id) { + const formData = new FormData(); + const url = process.env.REACT_APP_API_URL + "myclass/api/delete_business_price/"; + + + + // var class_internal_url = document.getElementsByName("adr_country")[0].value; + const stored_cookie = getCookie('tokenmysypart'); + formData.append("token", stored_cookie); + formData.append('price_id', localprice_line_id); + + + fetch( + url, + { + method: 'POST', + body: formData, + } + ) + .then((response) => response.json()) + .then((result) => { + //console.log('Success:', result['message'], "result['status'] = ", result['status']); + setDelete_Price_api(result['status']); + setDelete_Price_result(result['status']); + setDelete_Price_message(result['message']); + + if (String(result['status']) === "true") { + + GetClientPrices(); + } + + }) + .catch((error) => { + console.error('Error:', error); + setDelete_Price_api("false"); + setDelete_Price_result("false"); + setDelete_Price_message(" Impossible de créer le prix"); + }); + + + }; + + + function Close_Price_windows() { + setisaddprice(); + + Clean_notification(); + + } + + function handleClick_delete(event, cellValues) { + Clean_notification(); + + var price_line_id = cellValues.row.price_line_id; + setcurrentlineprice_id(price_line_id); + setisaddprice(); + setiseditclientprice(); + Delete_Price(price_line_id); + + } + + // Cette fonction recupere une ligne de prix donnée + + + const [client_nom, setclient_nom] = useState(); + + + const [GetAPrice_api, setGetAPrice_api] = useState(); + const [GetAPrice_message, setGetAPrice_message] = useState(); + const [GetAPrice_result, setGetAPrice_result] = useState(); + function GetAPrice_Data(price_line_id) { + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("price_line_id", price_line_id); + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/get_cust_specific_prices_by_partner/"; + + axios.post(myurl, form).then(res => { + + if (String(res.data.status) === "true") { + //console.log(" In GetAPrice res.data.status = " + res.data.status); + //console.log(" In GetAPrice res.data.message r_class = " + res.data.message); + setiseditclientprice("1"); + setGetAPrice_api("true"); + setGetAPrice_result(res.data.message); + var mylocalprice = JSON.parse(res.data.message); + + + if (mylocalprice.client_nom) { + setclient_nom(mylocalprice.client_nom); + } + + if (mylocalprice.date_du) { + var date_du = new Date(moment(mylocalprice.date_du, "DD/MM/YYYY")); + setSessionstartDate(date_du); + } + + if (mylocalprice.date_au) { + var date_au = new Date(moment(mylocalprice.date_au, "DD/MM/YYYY")); + setSessionendDate(date_au); + } + + if (mylocalprice.discount) { + setdiscount_val(mylocalprice.discount); + + } + + + + } + else { + setGetAPrice_api("false"); + setGetAPrice_message(res.data.message); + } + + }).catch((error) => { + console.warn('Not good man :( GetAPrice = ', error); + setGetAPrice_api("false"); + //setmyApimyApiMessage("") + }) + } + + + const [iseditprice, setiseditprice] = useState(); + function EditPrice() { + Clean_notification(); + + setiseditprice(true); + Enable_exist_prices_fields(); + + } + + + function Enable_exist_prices_fields() { + + + if (document.getElementsByName("discount") && document.getElementsByName("discount")[0]) { + document.getElementsByName("discount")[0].disabled = false; + document.getElementsByName("discount")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("sessiondatedebut") && document.getElementsByName("sessiondatedebut")[0]) { + document.getElementsByName("sessiondatedebut")[0].disabled = false; + document.getElementsByName("sessiondatedebut")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("sessiondatefin") && document.getElementsByName("sessiondatefin")[0]) { + document.getElementsByName("sessiondatefin")[0].disabled = false; + document.getElementsByName("sessiondatefin")[0].style.backgroundColor = "#FFFFFF"; + } + + } + + function Desable_exist_prices_fields() { + + + if (document.getElementsByName("discount") && document.getElementsByName("discount")[0]) { + document.getElementsByName("discount")[0].disabled = true; + document.getElementsByName("discount")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("sessiondatedebut") && document.getElementsByName("sessiondatedebut")[0]) { + document.getElementsByName("sessiondatedebut")[0].disabled = true; + document.getElementsByName("sessiondatedebut")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("sessiondatefin") && document.getElementsByName("sessiondatefin")[0]) { + document.getElementsByName("sessiondatefin")[0].disabled = true; + document.getElementsByName("sessiondatefin")[0].style.backgroundColor = "#ECEFF1"; + } + + } + + + function update_Price() { + + } + + function DataUpdated_exist_price() { + + } + + return ( +
+ +

Gestion des prix

+ + {String(Update_Price_api) === "true" && +
Les prix à a été correctement mis à jour
} + + {String(Update_Price_api) === "false" && +
{Update_Price_message}
} + + {String(Delete_Price_api) === "true" && +
Les prix à a été correctement supprimé
} + + {String(Delete_Price_api) === "false" && +
{Delete_Price_message}
} + + {String(iseditclientprice) === "1" &&
+ :not(style)': { m: 1 }, width: '100%', }} onChange={DataUpdated_exist_price}> + + + + + ), + }} + variant="standard" + /> + + + + + ), + }} + variant="standard" + /> +
+ Date Debut + { + var date_du = new Date(moment(date, "DD/MM/YYYY")).setHours(8, 0, 0); + setSessionstartDate(date_du); + setsessionChanged(true); + } + } + showTimeSelect={false} + filterTime={filterPassedTime_start} + dateFormat="dd/MM/yyyy" + className="texte_area" + locale='fr-FR' + + /> +
+
Date Fin + { + var date_au = new Date(moment(date, "DD/MM/YYYY")).setHours(8, 0, 0); + setSessionendDate(date_au); + setsessionChanged(true); + } + } + + showTimeSelect={false} + filterTime={filterPassedTime_end} + dateFormat="dd/MM/yyyy" + className="texte_area" + /> +
+ + +
+ +
+ +
+ + {iseditprice && } +
+ +
+ + {!iseditprice && } + + {iseditprice && } +
+ +
+ +
+ + } + + {String(Record_new_Price_api) === "true" && +
Les prix à a été correctement ajouté
} + + {String(Record_new_Price_api) === "false" && +
{Record_new_Price_message}
} + + {String(isaddprice) === "1" &&
+ :not(style)': { m: 1 }, width: '100%', }} onChange={DataUpdated}> + {GetClient_Linked_result &&
+ +
} + + + + + + ), + }} + variant="standard" + /> + + + +
+ Date Debut + { + var date_du = new Date(moment(date, "DD/MM/YYYY")).setHours(8, 0, 0); + setNew_SessionstartDate(date_du); + setsessionChanged(true); + } + } + showTimeSelect={false} + filterTime={filterPassedTime_start} + dateFormat="dd/MM/yyyy" + className="texte_area" + locale='fr-FR' + + /> +
+
Date Fin + { + var date_au = new Date(moment(date, "DD/MM/YYYY")).setHours(8, 0, 0); + setNew_SessionendDate(date_au); + setsessionChanged(true); + } + } + showTimeSelect={false} + filterTime={filterPassedTime_end} + dateFormat="dd/MM/yyyy" + className="texte_area" + /> +
+ + +
+ +
+ +
+ + +
+ +
+ + +
+ + +
+ +
+ + } + +
+ +
+ + +

Mes prix client

+ {String(menu) === String("default") && GetClienPrices_result && GetClienPrices_result.length > 0 &&
+
+ Les prix que vous accordez à vos clients +
+ {String(GetClienPrices_api) === "false" &&
+ Impossible de traiter la demande +
} + {String(GetClienPrices_api) === "true" && +
+ { + setSelectionModel(newSelectionModel); + //console.log("ch selected--" + newSelectionModel); + }} + selectionModel={selectionModel} + + + localeText={frFR.components.MuiDataGrid.defaultProps.localeText} + rows={GetClienPrices_result.map((item, index) => ( + { + id: index, + client: JSON.parse(item).client_nom, + client_recid: JSON.parse(item).client_recid, + discount: JSON.parse(item).discount, + date_debut: JSON.parse(item).date_du, + date_fin: JSON.parse(item).date_au, + price_line_id: JSON.parse(item)._id, + + + } + ))} + + columns={columns_prix_client} + pageSize={10} + className="datagridclass" + + rowsPerPageOptions={[10]} + disableSelectionOnClick + components={{ + Toolbar: GridToolbar, + }} + + + /> + + +
+ {/* */} +
} + +
} + +

Mes prix fournisseur

+
+ ); +} + +export default Pricing; + diff --git a/src/components/Recherche_new_v2.js b/src/components/Recherche_new_v2.js index 6d16188..f768786 100644 --- a/src/components/Recherche_new_v2.js +++ b/src/components/Recherche_new_v2.js @@ -3216,8 +3216,23 @@ const Recherche_new_v2 = () => {
+
+
+ +
+
+ Santé naturelle +
+
+ +
+
+
+
+ + {!displayAllmetiers &&
diff --git a/src/mysy_img/met_sante_nat.jpeg b/src/mysy_img/met_sante_nat.jpeg new file mode 100644 index 0000000..7fe1ec6 Binary files /dev/null and b/src/mysy_img/met_sante_nat.jpeg differ diff --git a/src/styles/components/_pricing.scss b/src/styles/components/_pricing.scss new file mode 100644 index 0000000..1240d1d --- /dev/null +++ b/src/styles/components/_pricing.scss @@ -0,0 +1,179 @@ +.pricing { + @media only screen and (max-width: 600px) { + .koUpdateData { + font-size: small; + color: red; + font-style: italic; + } + .okUpdateData { + font-size: small; + color: green; + font-style: italic; + } + + .div_row { + float: left; + //border:0px solid black; + border-width: 0.01rem; + width: 100%; + margin-bottom: 1rem; + border-radius: 1rem; + } + + .div_row_gauche { + float: left; + //border:0px solid black; + border-width: 0.01rem; + width: 48%; + border-radius: 1rem; + } + + .div_row_droite { + float: right; + //border:0px solid black; + border-width: 0.01rem; + width: 48%; + border-radius: 1rem; + } + + } + + + @media only screen and (min-width: 601px) and (max-width: 991px) { + /*style petites-moyennes tablettes */ + + .koUpdateData { + font-size: small; + color: red; + font-style: italic; + } + .okUpdateData { + font-size: small; + color: green; + font-style: italic; + } + + .div_row { + float: left; + //border:0px solid black; + border-width: 0.01rem; + width: 100%; + margin-bottom: 1rem; + border-radius: 1rem; + } + + .div_row_gauche { + float: left; + //border:0px solid black; + border-width: 0.01rem; + width: 48%; + border-radius: 1rem; + } + + .div_row_droite { + float: right; + //border:0px solid black; + border-width: 0.01rem; + width: 48%; + border-radius: 1rem; + } + + } + + @media only screen and (min-width: 992px) and (max-width: 1199px) { + .koUpdateData { + font-size: small; + color: red; + font-style: italic; + } + .okUpdateData { + font-size: small; + color: green; + font-style: italic; + } + + .div_row { + float: left; + //border:0px solid black; + border-width: 0.01rem; + width: 100%; + margin-bottom: 1rem; + border-radius: 1rem; + } + + .div_row_gauche { + float: left; + //border:0px solid black; + border-width: 0.01rem; + width: 48%; + border-radius: 1rem; + } + + .div_row_droite { + float: right; + //border:0px solid black; + border-width: 0.01rem; + width: 48%; + border-radius: 1rem; + } + + } + + + @media only screen and (min-width: 1200px) { + .koUpdateData { + font-size: small; + color: red; + font-style: italic; + } + .okUpdateData { + font-size: small; + color: green; + font-style: italic; + } + + .div_row { + float: left; + //border:0px solid black; + border-width: 0.01rem; + width: 100%; + margin-bottom: 1rem; + border-radius: 1rem; + } + + .div_row_gauche { + float: left; + //border:0px solid black; + border-width: 0.01rem; + width: 48%; + border-radius: 1rem; + } + + .div_row_droite { + float: right; + //border:0px solid black; + border-width: 0.01rem; + width: 48%; + border-radius: 1rem; + } + + .buton_add_price{ + border-radius: 5px; + font-size: small; + padding: 0.3rem; + width: 20%; + background: #81BC3A; + float: right; + margin-right: 10px; + + } + + .texte_area{ + width: 48% !important; + } + } + + + + // End media +} \ No newline at end of file diff --git a/src/styles/index.scss b/src/styles/index.scss index 798fe29..23d4953 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -62,3 +62,4 @@ @import "./components/footer_v2"; @import "./components/displaydetailclass_new_v2"; @import "./components/sedesabonner"; +@import "./components/pricing";