diff --git a/src/components/DisplayPartnerTrainingsPagination.js b/src/components/DisplayPartnerTrainingsPagination.js index 56d4c1a..5ecd2d1 100644 --- a/src/components/DisplayPartnerTrainingsPagination.js +++ b/src/components/DisplayPartnerTrainingsPagination.js @@ -7,7 +7,7 @@ import Button from '@mui/material/Button'; import Select from 'react-select' import { getCookie } from 'react-use-cookie'; import { DataGrid, GridToolbar, frFR } from '@mui/x-data-grid'; - +import excel_icone from "../mysy_img/excel_icone.png"; import Popup from 'reactjs-popup'; import 'reactjs-popup/dist/index.css'; import { AiFillCloseCircle, } from "react-icons/ai"; @@ -33,6 +33,9 @@ import DialogContent from '@mui/material/DialogContent'; import DialogContentText from '@mui/material/DialogContentText'; import DialogTitle from '@mui/material/DialogTitle'; import ToggleSwitch from "./ToggleSwitch"; +import SendIcon from '@mui/icons-material/Send'; +import { GrDocumentCsv } from "react-icons/gr"; + const DistplayPartnerTraningsPage = (props) => { const history = useHistory(); @@ -51,6 +54,110 @@ const DistplayPartnerTraningsPage = (props) => { const [createtraining, setcreatetraining] = useState(false); + const changeHandler2 = (event) => { + Closecreatetraining(); + setapiexcelimportmessage(); + setformation_file_name(); + sethandleSubmission_api(); + hiddenFileInput_formation.current.click(); + }; + + const [formation_file_name, setformation_file_name] = useState(); + + const hiddenFileInput_formation = React.useRef(null); + + const [excelimportmessage, setexcelimportmessage] = useState(""); + const [apiexcelimportmessage, setapiexcelimportmessage] = useState(""); + + const [handleSubmission_api, sethandleSubmission_api] = useState(); + const [handleSubmission_result, sethandleSubmission_result] = useState(); + const [handleSubmission_message, sethandleSubmission_message] = useState(); + + const handleSubmission = event => { + + const formData = new FormData(); + + 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 dépasser un 1 Méga octets"); + return; + } + + setformation_file_name(event.target.files[0].name); + + //console.log(" import du ficier ", event.target.files[0].name); + + + formData.append('File', fileUploaded); + //formData.append('token', 'K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA'); + const stored_cookie = getCookie('tokenmysypart'); + + + formData.append("token", stored_cookie); + + //console.log("token = " + stored_cookie); theme_name + setLoading(true); + fetch( + process.env.REACT_APP_API_URL + "myclass/api/add_class_mass/", + { + method: 'POST', + body: formData, + } + ) + .then((response) => response.json()) + .then((result) => { + //console.log('Success:', result['message']); + setexcelimportmessage(result['message']); + setmyApiResponse("true"); + setapiexcelimportmessage(result['status']); + setLoading(false); + if (String(result['status']) === String("true")) { + + sethandleSubmission_api("true"); + GetAllClass_new(); + var local_message = result['message']; // + " Vous allez être redirigé vers la liste des formations" + window.scrollTo({ + top: 0, + behavior: "smooth", + }); + + alert(local_message); + //history.push("/Partner/affichage"); + //window.location.reload(); + //return; + + } else if (String(result['status']) === String("Err_Connexion")) { + alert('Erreur: ' + result['message']); + history.push("/Connexion"); + } + + else { + sethandleSubmission_api("false"); + sethandleSubmission_message(result['message']); + window.scrollTo({ + top: 0, + behavior: "smooth", + }); + alert(result['message']); + console.log(" 000000000000000&") + + + } + //alert("result['status'] " + result['status']); + }) + .catch((error) => { + setLoading(false); + setmyApiResponse("false"); + setapiexcelimportmessage("-1"); + sethandleSubmission_api("false"); + alert(" Impossible d'importer/mettre à jour les formations"); + }); + }; + function handleClick(event, cellValues) { @@ -1650,10 +1757,10 @@ const DistplayPartnerTraningsPage = (props) => { } - {String(myApiResponse) === "True" && -
-   - {/*!createtraining &&
+ +
+   + {/*!createtraining &&
*/} -
-
- +
+ + { + setSelectionModel(newSelectionModel); + //console.log("ch selected--" + newSelectionModel); + }} + selectionModel={selectionModel} + localeText={frFR.components.MuiDataGrid.defaultProps.localeText} + rows={rowss.map((item, index) => ( + + { + id: index, + _id: JSON.parse(item)._id, + internal_url: JSON.parse(item).internal_url, + zone_diffusion: JSON.parse(item).zone_diffusion_str, + external_code: JSON.parse(item).external_code, + title: parse((JSON.parse(item).title).replace(/(<([^>]+)>)/ig, '')), + domain: JSON.parse(item).domaine, + metier: JSON.parse(item).metier, + url: JSON.parse(item).url, + price: JSON.parse(item).price, + description: parse((JSON.parse(item).description).replace(/(<([^>]+)>)/ig, '')), + published: JSON.parse(item).published, + lms_class_code: JSON.parse(item).lms_class_code, + duration: JSON.parse(item).duration, + duration_unit: JSON.parse(item).duration_unit, + duration_in_hour: JSON.parse(item).duration_in_hour, + presentiel: JSON.parse(item).presentiel.presentiel, + distanciel: JSON.parse(item).presentiel.distantiel, + cible: JSON.parse(item).pourqui, + currecny: JSON.parse(item).currecny, + + } + ))} + + columns={columns} + pageSize={10} + className="datagridclass" + + onRowDoubleClick={(newSelectionModel) => { + setgridline_id(newSelectionModel.row.id); + Closecreatetraining(); + closeTrainingForm(); + + var al = JSON.parse(rowss[newSelectionModel.row.id]) + + setselected_row_data_json(JSON.parse(rowss[newSelectionModel.row.id])); + + + setreftrainingtoupdate(newSelectionModel.row.internal_url); + setexternalcodetraining_toupdate(newSelectionModel.row.external_code); + setDialog_formation_open(true); + + } + } + + rowsPerPageOptions={[10]} + disableSelectionOnClick + components={{ + Toolbar: GridToolbar, + }} + sx={datagridSx} + getCellClassName={(params) => { + if (params.field === 'published' && String(params.value) === "1") { + return 'cell--published'; + } + + if (params.field === "published" && String(params.value) !== "1") { + return 'cell--unpublished' + } }} - > - { - onSelectionModelChange={(newSelectionModel) => { - setSelectionModel(newSelectionModel); - //console.log("ch selected--" + newSelectionModel); - }} - selectionModel={selectionModel} - localeText={frFR.components.MuiDataGrid.defaultProps.localeText} - rows={rowss.map((item, index) => ( - - { - id: index, - _id: JSON.parse(item)._id, - internal_url: JSON.parse(item).internal_url, - zone_diffusion: JSON.parse(item).zone_diffusion_str, - external_code: JSON.parse(item).external_code, - title: parse((JSON.parse(item).title).replace(/(<([^>]+)>)/ig, '')), - domain: JSON.parse(item).domaine, - metier: JSON.parse(item).metier, - url: JSON.parse(item).url, - price: JSON.parse(item).price, - description: parse((JSON.parse(item).description).replace(/(<([^>]+)>)/ig, '')), - published: JSON.parse(item).published, - lms_class_code: JSON.parse(item).lms_class_code, - duration: JSON.parse(item).duration, - duration_unit: JSON.parse(item).duration_unit, - duration_in_hour: JSON.parse(item).duration_in_hour, - presentiel: JSON.parse(item).presentiel.presentiel, - distanciel: JSON.parse(item).presentiel.distantiel, - cible: JSON.parse(item).pourqui, - currecny: JSON.parse(item).currecny, - - } - ))} - - columns={columns} - pageSize={10} - className="datagridclass" - - onRowDoubleClick={(newSelectionModel) => { - setgridline_id(newSelectionModel.row.id); - Closecreatetraining(); - closeTrainingForm(); - - var al = JSON.parse(rowss[newSelectionModel.row.id]) - - setselected_row_data_json(JSON.parse(rowss[newSelectionModel.row.id])); - - - setreftrainingtoupdate(newSelectionModel.row.internal_url); - setexternalcodetraining_toupdate(newSelectionModel.row.external_code); - setDialog_formation_open(true); - - } + // Pour la gestion de la couleur de zone double cliquée + if (String(params.row.id) === String(gridline_id)) { + return 'line--statut--selected'; } - rowsPerPageOptions={[10]} - disableSelectionOnClick - components={{ - Toolbar: GridToolbar, - }} - sx={datagridSx} - getCellClassName={(params) => { - if (params.field === 'published' && String(params.value) === "1") { - return 'cell--published'; - } + if (String(params.row.published) === "1") { + return 'line--published'; + } - if (params.field === "published" && String(params.value) !== "1") { - return 'cell--unpublished' - } + if (String(params.row.published) !== "1") { + return 'line--unpublished'; + } - }} - getRowClassName={(params) => { + }} - // Pour la gestion de la couleur de zone double cliquée - if (String(params.row.id) === String(gridline_id)) { - return 'line--statut--selected'; - } - - if (String(params.row.published) === "1") { - return 'line--published'; - } - - if (String(params.row.published) !== "1") { - return 'line--unpublished'; - } - - }} - - /> - -
+ /> +
-
 
+
+
 
+   +
+ + + +   - {!createtraining &&
+ + +
+ {formation_file_name && } - + - +
-
} +
-
} + + + Pour le reste,
+
    +
  • Il s'agit d'un fichier csv. Les colonnes sont separées par des ";"
  • +
  • A l'interieur d'une même colonne, les informations sont separées par des ";"
  • +
  • Champ 'Metier' : les valeurs acceptées sont : IT, RH, vente, dev_perso, Graphisme, Management, Digital, Office, Autre
  • +
  • ...
  • +
+ Télécharger le guide complet pour plus d'informations
+
+
+
 
+ +

diff --git a/src/components/Partner.js b/src/components/Partner.js index b07cec4..d34046f 100644 --- a/src/components/Partner.js +++ b/src/components/Partner.js @@ -1198,9 +1198,11 @@ const Partner = (props) => {
Mes Formations
+ {/* {String(menu) !== "creation" &&
CREER FORMATION
} {String(menu) === "creation" &&
CREER FORMATION
}
+ */} {String(menu) !== "affichage" &&
MES FORMATIONS
} {String(menu) === "affichage" &&
MES FORMATIONS
} @@ -1769,12 +1771,12 @@ const Partner = (props) => {

- + {/* {String(menu) !== "creation" &&
 
} {String(menu) === "creation" &&
}
-
+
*/} diff --git a/src/styles/components/_displaypartnersession.scss b/src/styles/components/_displaypartnersession.scss index 48a08bc..579e27e 100644 --- a/src/styles/components/_displaypartnersession.scss +++ b/src/styles/components/_displaypartnersession.scss @@ -935,7 +935,7 @@ } .icon_excel { - width: 6%; + width: 10%; } @@ -1604,7 +1604,7 @@ } .icon_excel { - width: 6%; + width: 10%; } @@ -2164,7 +2164,7 @@ } .icon_excel { - width: 4%; + width: 10%; } .bton_envoyer { diff --git a/src/styles/components/_displaypartnertrainingpagination.scss b/src/styles/components/_displaypartnertrainingpagination.scss index 43f584d..ec06667 100644 --- a/src/styles/components/_displaypartnertrainingpagination.scss +++ b/src/styles/components/_displaypartnertrainingpagination.scss @@ -5,7 +5,7 @@ z-index: 9999; } - + .mysy_spinner { border-radius: 5px; border: 1px solid black; @@ -480,7 +480,12 @@ background: #c8cfd5; color: black; width: 100%; - } + } + + .icon_excel { + width: 10%; + } + } @@ -918,7 +923,11 @@ background: #c8cfd5; color: black; width: 50%; - } + } + + .icon_excel { + width: 10%; + } } @@ -1356,6 +1365,10 @@ background: #c8cfd5; color: black; width: 40%; + } + + .icon_excel { + width: 10%; } } @@ -1790,6 +1803,10 @@ background: #c8cfd5; color: black; width: 20% !important; + } + + .icon_excel { + width: 10%; } }