diff --git a/package-lock.json b/package-lock.json index d48e97c..7ae58d8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,6 +28,7 @@ "@mui/x-data-grid": "^5.17.26", "@mui/x-date-pickers": "^5.0.0", "@mui/x-date-pickers-pro": "^5.0.0", + "@react-icons/all-files": "^4.1.0", "@stripe/react-stripe-js": "^1.12.0", "@stripe/stripe-js": "^1.35.0", "@testing-library/jest-dom": "^5.14.1", @@ -89,7 +90,7 @@ "react-google-maps": "^9.4.5", "react-helmet": "^6.1.0", "react-hook-form": "^7.27.0", - "react-icons": "^4.3.1", + "react-icons": "^4.10.1", "react-input-range": "^1.3.0", "react-intl": "^5.24.7", "react-loading-dot": "^1.0.6", @@ -5896,6 +5897,14 @@ "resolved": "https://registry.npmjs.org/@react-dnd/shallowequal/-/shallowequal-2.0.0.tgz", "integrity": "sha512-Pc/AFTdwZwEKJxFJvlxrSmGe/di+aAOBn60sremrpLo6VI/6cmiUYNNwlI5KNYttg7uypzA3ILPMPgxB2GYZEg==" }, + "node_modules/@react-icons/all-files": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@react-icons/all-files/-/all-files-4.1.0.tgz", + "integrity": "sha512-hxBI2UOuVaI3O/BhQfhtb4kcGn9ft12RWAFVMUeNjqqhLsHvFtzIkFaptBJpFDANTKoDfdVoHTKZDlwKCACbMQ==", + "peerDependencies": { + "react": "*" + } + }, "node_modules/@react-native-community/cli": { "version": "9.3.2", "license": "MIT", @@ -35168,8 +35177,9 @@ } }, "node_modules/react-icons": { - "version": "4.6.0", - "license": "MIT", + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.10.1.tgz", + "integrity": "sha512-/ngzDP/77tlCfqthiiGNZeYFACw85fUjZtLbedmJ5DTlNDIwETxhwBzdOJ21zj4iJdvc0J3y7yOsX3PpxAJzrw==", "peerDependencies": { "react": "*" } @@ -49800,6 +49810,12 @@ "resolved": "https://registry.npmjs.org/@react-dnd/shallowequal/-/shallowequal-2.0.0.tgz", "integrity": "sha512-Pc/AFTdwZwEKJxFJvlxrSmGe/di+aAOBn60sremrpLo6VI/6cmiUYNNwlI5KNYttg7uypzA3ILPMPgxB2GYZEg==" }, + "@react-icons/all-files": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@react-icons/all-files/-/all-files-4.1.0.tgz", + "integrity": "sha512-hxBI2UOuVaI3O/BhQfhtb4kcGn9ft12RWAFVMUeNjqqhLsHvFtzIkFaptBJpFDANTKoDfdVoHTKZDlwKCACbMQ==", + "requires": {} + }, "@react-native-community/cli": { "version": "9.3.2", "peer": true, @@ -68794,7 +68810,9 @@ } }, "react-icons": { - "version": "4.6.0", + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.10.1.tgz", + "integrity": "sha512-/ngzDP/77tlCfqthiiGNZeYFACw85fUjZtLbedmJ5DTlNDIwETxhwBzdOJ21zj4iJdvc0J3y7yOsX3PpxAJzrw==", "requires": {} }, "react-input-range": { diff --git a/package.json b/package.json index c4ba273..a0be069 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "@mui/x-data-grid": "^5.17.26", "@mui/x-date-pickers": "^5.0.0", "@mui/x-date-pickers-pro": "^5.0.0", + "@react-icons/all-files": "^4.1.0", "@stripe/react-stripe-js": "^1.12.0", "@stripe/stripe-js": "^1.35.0", "@testing-library/jest-dom": "^5.14.1", @@ -84,7 +85,7 @@ "react-google-maps": "^9.4.5", "react-helmet": "^6.1.0", "react-hook-form": "^7.27.0", - "react-icons": "^4.3.1", + "react-icons": "^4.10.1", "react-input-range": "^1.3.0", "react-intl": "^5.24.7", "react-loading-dot": "^1.0.6", diff --git a/public/sample/template_import_client.csv b/public/sample/template_import_client.csv new file mode 100644 index 0000000..00e8187 --- /dev/null +++ b/public/sample/template_import_client.csv @@ -0,0 +1,2 @@ +nom;raison_sociale;email;adresse;code_postal;ville;pays;siret;telephone;tva;website;invoice_adresse;invoice_code_postal;invoice_email;invoice_nom;invoice_siret;invoice_tva;invoice_ville;invoice_pays +client122;raison_sociale1;email1@mysy-training.fr;2 place du test;75001;Paris;France;Siret1;1010101;;www.client1.fr;invoice_adresse;invoice_code_postal;fact@mysy.fr;invoice_nom_val;invoice_siret_val;invoice_tva;invoice_ville;invoice_pays diff --git a/src/components/DisplayPartnerTrainingsPagination.js b/src/components/DisplayPartnerTrainingsPagination.js index 927a703..8304f52 100644 --- a/src/components/DisplayPartnerTrainingsPagination.js +++ b/src/components/DisplayPartnerTrainingsPagination.js @@ -19,7 +19,7 @@ import axios from "axios"; import { CiCoffeeBean, CiDesktop, CiFileOff } from "react-icons/ci"; import img_loading_spin from "./../mysy_img/mysy_spin_loading.gif"; -//import { LuScreenShare, LuScreenShareOff } from "react-icons/lu"; +import { LuScreenShare, LuScreenShareOff } from "react-icons/lu"; const DistplayPartnerTraningsPage = (props) => { diff --git a/src/components/Partner.js b/src/components/Partner.js index bd28adb..1b66f5f 100644 --- a/src/components/Partner.js +++ b/src/components/Partner.js @@ -37,7 +37,7 @@ import { FcHome, FcButtingIn, FcDepartment, FcBullish, FcAddDatabase, FcFolder, FcList, FcGraduationCap, FcMultipleDevices, FcCurrencyExchange, FcMoneyTransfer, FcFeedback, FcKey, FcVideoCall, FcSettings, - FcBusinesswoman, FcServices, FcCollect, FcCandleSticks + FcBusinesswoman, FcServices, FcCollect, FcCandleSticks, FcKindle } from "react-icons/fc"; //import { FcHome} from "react-icons/fc"; @@ -701,14 +701,20 @@ const Partner = (props) => {

- {String(menu) !== "mes_devis" &&
   MES DEVIS
} - {String(menu) === "mes_devis" &&
    MES DEVIS
} + {String(menu) !== "mes_devis" &&
   MES DEVIS
} + {String(menu) === "mes_devis" &&
    MES DEVIS
}

- {String(menu) !== "mes_cmd" &&
   MES COMMANDES
} - {String(menu) === "mes_cmd" &&
    MES COMMANDES
} + {String(menu) !== "mes_cmd" &&
   MES COMMANDES
} + {String(menu) === "mes_cmd" &&
    MES COMMANDES
} +
+ +
+
+ {String(menu) !== "mes_cmd" &&
   MES FACTURES
} + {String(menu) === "mes_cmd" &&
    MES FACTURES
}
diff --git a/src/components/Partner_Client.js b/src/components/Partner_Client.js index 87e1b1a..edd237e 100644 --- a/src/components/Partner_Client.js +++ b/src/components/Partner_Client.js @@ -168,6 +168,79 @@ const Partner_Client = (props) => { }, []); + + const [part_client_file_name, setpart_client_file_name] = useState(); + function submenu_import_part_client_mass() { + setpart_client_file_name(); + setliste_part_client_file_change_api(); + hiddenFileInput.current.click(); + } + + const hiddenFileInput = React.useRef(null); + + const [liste_part_client_file_change_api, setliste_part_client_file_change_api] = useState(); + const [liste_part_client_file_change_result, setliste_part_client_file_change_result] = useState(); + const [liste_part_client_file_change_message, setliste_part_client_file_change_message] = useState(); + const liste_part_client_file_change = event => { + const fileUploaded = event.target.files[0]; + let file_size = event.target.files[0].size; + let file_type = event.target.files[0].type; + + //console.log("file_size = ",file_size," file_type = ",file_type); + if (file_size > 1000000) { + alert("Le fichier ne doit pas depasser un 1 Méga octets"); + return; + } + + setpart_client_file_name(event.target.files[0].name); + + const formData = new FormData(); + formData.append('File', fileUploaded); + //formData.append('token', 'K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA'); + const stored_cookie = getCookie('tokenmysypart'); + + formData.append("token", stored_cookie); + + //console.log("token = " + stored_cookie); + + fetch( + process.env.REACT_APP_API_URL + "myclass/api/Add_Partner_Client_mass/", + { + method: 'POST', + body: formData, + } + ) + .then((response) => response.json()) + .then((result) => { + if (String(result['status']) === String("true")) { + //console.log('Success:', result['message']); + setliste_part_client_file_change_result(result['message']); + setliste_part_client_file_change_api("true"); + + alert(result['message']); + Get_List_Partner_Clients(); + + + } else if (String(result['status']) === String("Err_Connexion")) { + alert('Erreur: ' + result['message']); + history.push("/Connexion"); + } + + else { + setliste_part_client_file_change_message(result['message']); + setliste_part_client_file_change_api("false"); + alert(result['message']); + } + + }) + .catch((error) => { + console.error('Error:', error); + setliste_part_client_file_change_api("false"); + }); + + }; + + return (
@@ -198,21 +271,37 @@ const Partner_Client = (props) => {
- +
+ Télécharger un fichier modèle +
+ + {part_client_file_name}
+ {String(liste_part_client_file_change_api) === String("true") && } + {String(liste_part_client_file_change_api) === String("false") && } + + +
{
Grid des clients
-
+
{Get_List_Partner_Clients_result && String(Get_List_Partner_Clients_api) === "true" && Get_List_Partner_Clients_result.map((client) => (
- mail = {String(JSON.parse(client).email)}
- nom = {String(JSON.parse(client).nom)}
- Tel = {String(JSON.parse(client).telephone)}
- Adresse = {String(JSON.parse(client).adr_adresse)} - {String(JSON.parse(client).adr_ville)}
+ mail = {String(JSON.parse(client).email)}
+ nom = {String(JSON.parse(client).nom)}
+ Tel = {String(JSON.parse(client).telephone)}
+ Adresse = {String(JSON.parse(client).adr_adresse)} - {String(JSON.parse(client).adr_ville)}
- + ))}
diff --git a/src/styles/components/_partnerclient.scss b/src/styles/components/_partnerclient.scss index 91e30f0..768970c 100644 --- a/src/styles/components/_partnerclient.scss +++ b/src/styles/components/_partnerclient.scss @@ -79,11 +79,18 @@ .bton_add_session { background: #c8cfd5; color: black; - width: 20% !important; + width: 30% !important; + } + + .bton_add_menuclient { + background: #c8cfd5; + color: black; + width: 30% !important; + font-size: x-small !important; } .icon_plus { - width: 8%; + width: 6%; }