From c283ba01151ccd15da54f69d76190833668a8fbb Mon Sep 17 00:00:00 2001 From: cherif Date: Tue, 19 Sep 2023 19:46:02 +0200 Subject: [PATCH] 19/09/2023 - 19h30 --- src/components/Abonnement.js | 10 +- src/components/Config_Document.js | 8 +- .../DisplayPartnerTrainingsPagination.js | 136 ++++++++++++++++-- src/components/GestionAdministrative.js | 2 +- src/components/Materiels.js | 3 +- src/components/Partner.js | 15 +- src/components/PartnerClient_Activite.js | 52 ++++--- src/styles/components/_partner.scss | 10 +- 8 files changed, 196 insertions(+), 40 deletions(-) diff --git a/src/components/Abonnement.js b/src/components/Abonnement.js index 3fedde7..22107a1 100644 --- a/src/components/Abonnement.js +++ b/src/components/Abonnement.js @@ -33,7 +33,7 @@ import img_loading_spin from "./../mysy_img/mysy_spin_loading.gif"; import 'react-tooltip/dist/react-tooltip.css' import { Tooltip } from 'react-tooltip' import Popup from 'reactjs-popup'; -import 'reactjs-popup/dist/index.css'; +import 'reactjs-popup/dist/index.css'; import { FcCancel, FcApproval, FcAcceptDatabase, FcPrint } from "react-icons/fc"; function Abonnement(props) { @@ -132,7 +132,7 @@ function Abonnement(props) { setmyApiResponse("False"); } - else if (String(data['status']) === String("Err_Connexion")) { + else if (String(data['status']) === String("Err_Connexion")) { alert('Erreur: ' + data['message']); history.push("/Connexion"); return; @@ -189,7 +189,7 @@ function Abonnement(props) { } - } + } else if (String(data['status']) === String("Err_Connexion")) { alert('Erreur: ' + data['message']); history.push("/Connexion"); @@ -1553,8 +1553,8 @@ function Abonnement(props) { {String(testval) === String("false") &&
Impossible de modifier les informations
} -   - :not(style)': { m: 1 }, width: '100%', }}> +   + :not(style)': { m: 1 }, width: '100%', }}> { const columns = [ { field: '_id', headerName: '_id', hide: true }, { field: 'id', headerName: 'id', hide: true }, - { field: 'nom', headerName: 'nom', width: 150, hideable: false, }, - { field: 'ref_interne', headerName: 'ref_interne', width: 150, hideable: false, }, + { field: 'nom', headerName: 'nom', hideable: false, flex:1}, + { field: 'ref_interne', headerName: 'ref_interne', hideable: false, flex:1}, { field: 'type_doc', headerName: 'type_doc', width: 150, hideable: false, }, - { field: 'cible', headerName: 'cible', width: 150, hide: false, editable: true }, - { field: 'sujet', headerName: 'sujet', width: 150, hide: false, editable: true }, + { field: 'cible', headerName: 'cible', width: 150, hide: false, editable: false }, + { field: 'sujet', headerName: 'sujet', hide: false, editable: false, flex:1 }, /*{ diff --git a/src/components/DisplayPartnerTrainingsPagination.js b/src/components/DisplayPartnerTrainingsPagination.js index 21ff16b..eb50891 100644 --- a/src/components/DisplayPartnerTrainingsPagination.js +++ b/src/components/DisplayPartnerTrainingsPagination.js @@ -26,6 +26,7 @@ import Box from '@mui/material/Box'; import 'react-tooltip/dist/react-tooltip.css' import { Tooltip } from 'react-tooltip' import { FcCancel, FcApproval, FcAcceptDatabase, FcPrint } from "react-icons/fc"; +import { CiTrash } from "react-icons/ci"; const DistplayPartnerTraningsPage = (props) => { @@ -229,6 +230,7 @@ const DistplayPartnerTraningsPage = (props) => { const columns = [ { field: 'id', headerName: 'id', hide: true }, + { field: '_id', headerName: '_id', hide: true }, { field: 'lms_class_code', headerName: 'lms_class_code', hide: true }, { field: 'zone_diffusion', headerName: 'zone_diffusion', hide: true }, { field: 'internal_url', headerName: 'internal_url', hide: true }, @@ -372,6 +374,68 @@ const DistplayPartnerTraningsPage = (props) => { ); } }, + { + field: "delete", headerName: 'Supprimer', + renderCell: (cellValues) => { + return ( + + { + // handleClick_delete(event, cellValues); + }} + > + + + } + modal + nested + position="center center" + > + {close => ( +
+ +
MySy Information
+
+ {' '} + + En confirmant cette opération, la formation sera définitivement supprimée.
+ Avant, assurez-vous de n'avoir aucune session rattachée à la formation. + +
+
+
+ + +
+
+ +
+
+
+ )} +
+ + + ); + } + } + ] @@ -629,7 +693,7 @@ const DistplayPartnerTraningsPage = (props) => { } } - function Delete_class(tab_class) { + function Disable_class(tab_class) { var url = process.env.REACT_APP_API_URL + "myclass/api/disable_class/"; @@ -693,7 +757,7 @@ const DistplayPartnerTraningsPage = (props) => { } else if (String(actionenmasse) === String("supprimer")) { - Delete_class(liste_formation); + Disable_class(liste_formation); GetAllClass_WOfilter(); } @@ -721,6 +785,61 @@ const DistplayPartnerTraningsPage = (props) => { } + + + + function handleClick_delete(event, cellValues) { + + var local_class_id = cellValues.row._id; + + Delete_Class(local_class_id); + } + + + const [Delete_Class_api, setDelete_Class_api] = useState(); + const [Delete_Class_message, setDelete_Class_message] = useState(); + const [Delete_Class_result, setDelete_Class_result] = useState(); + function Delete_Class(local_class_id) { + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("class_id", local_class_id); + + + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/delete_Class/"; + + axios.post(myurl, form).then(res => { + //console.log(" In Delete_Class res.data.status = " + res.data.status); + //console.log(" In Delete_Class res.data.message r_class = " + res.data.message); + + if (String(res.data.status) === String("true")) { + setDelete_Class_api("true"); + setDelete_Class_result(res.data.message); + + GetAllClass_new(); + alert(res.data.message) + } + else { + setDelete_Class_api("false"); + setDelete_Class_message(res.data.message); + alert(res.data.message); + + } + + }).catch((error) => { + + console.log('Delete_Class : Not good man :( Delete_Class = ' + error); + setDelete_Class_api("false"); + alert(" Impossible de supprimer la formation"); + }) + } + + + const [isLoading, setLoading] = useState(); @@ -838,7 +957,7 @@ const DistplayPartnerTraningsPage = (props) => { const value = event.target.value; - if (String(value) === "publier" || String(value) === "depublier" || String(value) === "supprmier") { + if (String(value) === "publier" || String(value) === "depublier" || String(value) === "desactiver") { setactionmass_ftion_val(value); } else { @@ -866,8 +985,8 @@ const DistplayPartnerTraningsPage = (props) => { var liste_formation = GetSelectedRowsTraining(); - console.log(" liste_formation = ", liste_formation); - console.log(" actionmass_ftion_val = ", actionmass_ftion_val); + //console.log(" liste_formation = ", liste_formation); + //console.log(" actionmass_ftion_val = ", actionmass_ftion_val); if (String(actionmass_ftion_val) === String("depublier")) { @@ -882,8 +1001,8 @@ const DistplayPartnerTraningsPage = (props) => { window.location.reload(); } - else if (String(actionmass_ftion_val) === String("supprimer")) { - Delete_class(liste_formation); + else if (String(actionmass_ftion_val) === String("desactiver")) { + Disable_class(liste_formation); GetAllClass_WOfilter(); window.location.reload(); } @@ -1201,6 +1320,7 @@ const DistplayPartnerTraningsPage = (props) => { { 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, @@ -1276,7 +1396,7 @@ const DistplayPartnerTraningsPage = (props) => { Action    Publier   Dépublier   - Supprimer   + Désactiver  
diff --git a/src/components/GestionAdministrative.js b/src/components/GestionAdministrative.js index 6202a79..7bec41c 100644 --- a/src/components/GestionAdministrative.js +++ b/src/components/GestionAdministrative.js @@ -4182,7 +4182,7 @@ function GestionAdministrative(props) { const stored_cookie = getCookie('tokenmysypart'); form.append("token", stored_cookie); form.append("class_internal_url", internal_url); - form.append("session_id", code_session); + form.append("session_id", selected_session_id); form.append("nom", one_nom_part); form.append("prenom", one_prenom_part); form.append("email", one_email_part); diff --git a/src/components/Materiels.js b/src/components/Materiels.js index a0056b3..d031877 100644 --- a/src/components/Materiels.js +++ b/src/components/Materiels.js @@ -2408,10 +2408,11 @@ const Materiels = (props) => {
- + */}