From fde7fca6101108132857eb3fc2fef9dff9441a8c Mon Sep 17 00:00:00 2001 From: cherif Date: Thu, 29 Feb 2024 21:41:34 +0100 Subject: [PATCH] 29/02/2024 - 21h30 --- src/components/DisplayPartnerSession.js | 5 +- src/components/DisplayPartnerStagiaires.js | 22 +++- src/components/Partner_Client.js | 146 ++++++++++++++++++--- 3 files changed, 148 insertions(+), 25 deletions(-) diff --git a/src/components/DisplayPartnerSession.js b/src/components/DisplayPartnerSession.js index c61fa0f..624acfd 100644 --- a/src/components/DisplayPartnerSession.js +++ b/src/components/DisplayPartnerSession.js @@ -357,7 +357,7 @@ const DisplayPartnerSession = (props) => { const columns_preinscrit = [ { field: 'id', headerName: 'id', hide: true }, { field: '_id', headerName: '_id', hide: true }, - { field: 'civilite', headerName: 'Civ.', minWidth: 70, flex: 1, maxWidth: 100, hide: false, editable: false, editable: false }, + { field: 'civilite', headerName: 'Civ.', minWidth: 100, flex: 1, maxWidth: 100, hide: false, editable: false, editable: false, renderCell: (params) => , }, { field: 'nom', headerName: 'nom', minWidth: 150, flex: 1, hide: false, editable: true, renderCell: (params) => , }, { field: 'prenom', headerName: 'prenom', minWidth: 150, flex: 1, hide: false, editable: true, renderCell: (params) => , }, { field: 'email', headerName: 'email', minWidth: 150, flex: 1, flex: 1, renderCell: (params) => , }, @@ -618,7 +618,8 @@ const DisplayPartnerSession = (props) => { { field: 'id', headerName: 'id', hide: true }, { field: '_id', headerName: '_id', hide: true }, { field: 'civilite', headerName: 'Civ.', minWidth: 70, flex: 1, maxWidth: 100, hide: false, editable: false, editable: false }, - { field: 'nom', headerName: 'nom', minWidth: 150, flex: 1, hide: false, editable: false, renderCell: (params) => , }, + { field: 'nom', headerName: 'nom', minWidth: 150, flex: 1, hide: false, editable: false, + renderCell: (params) => , }, { field: 'prenom', headerName: 'prenom', minWidth: 150, flex: 1, hide: false, editable: false, renderCell: (params) => , }, { field: 'email', headerName: 'email', minWidth: 150, flex: 1, flex: 1, renderCell: (params) => , }, { field: 'client_rattachement_nom', headerName: 'Client', minWidth: 150, flex: 1, maxWidth: 200, hide: false, editable: true, renderCell: (params) => , }, diff --git a/src/components/DisplayPartnerStagiaires.js b/src/components/DisplayPartnerStagiaires.js index 1101c06..0c2b166 100644 --- a/src/components/DisplayPartnerStagiaires.js +++ b/src/components/DisplayPartnerStagiaires.js @@ -100,7 +100,7 @@ const DisplayPartnerStagiaires = (props) => { { field: 'pays', headerName: 'pays', hide: true, editable: false, Width: 0 }, - { field: 'civilite', headerName: 'Civ.', minWidth: 70, flex: 1, maxWidth: 100, hide: false, editable: false, editable: false }, + { field: 'civilite', headerName: 'Civ.', minWidth: 100, flex: 1, maxWidth: 100, hide: false, editable: false, editable: false, renderCell: (params) => , }, { field: 'nom', headerName: 'Nom', minWidth: 200, flex: 1, hide: false, editable: false, editable: false, renderCell: (params) => , }, { field: 'prenom', headerName: 'Prénom', minWidth: 200, flex: 1, hide: false, editable: false, renderCell: (params) => , }, @@ -7133,6 +7133,9 @@ const DisplayPartnerStagiaires = (props) => { if (value && value._id) { setp_one_detail_session_class(value._id); setp_one_detail_code_session(value.code_session); + }else{ + setp_one_detail_session_class(""); + setp_one_detail_code_session(""); } }} @@ -7871,7 +7874,7 @@ const DisplayPartnerStagiaires = (props) => { } - {String(participant_data_edit_mode) === "1" &&
Client
+ {String(participant_data_edit_mode) === "1" &&
Client 1
{ className="disabled_style" options={New_Get_List_Partner_Clients_result} onChange={(event, value) => { + if (value && value._id) { setp_detail_client_rattachement_id(value._id); setp_detail_client_rattachement_nom(value.nom); @@ -7888,6 +7892,10 @@ const DisplayPartnerStagiaires = (props) => { Dialog_1_handle_change_participant_session(" Attention, vous allez modifier le client de rattachement du participant"); + }else{ + + setp_detail_client_rattachement_id(""); + setp_detail_client_rattachement_nom(""); } }} value={p_detail_client_rattachement_nom} @@ -7955,12 +7963,14 @@ const DisplayPartnerStagiaires = (props) => { if (value && value._id) { setp_detail_financeur_rattachement_id(value._id); setp_detail_financeur_rattachement_nom(value.nom); - - setparticipant_data_changed("1"); Dialog_1_handle_change_participant_session(" Attention, vous allez modifier l'organisme financeur du participant"); - - + }else{ + setp_detail_financeur_rattachement_id(""); + setp_detail_financeur_rattachement_nom(""); + setparticipant_data_changed("1"); + Dialog_1_handle_change_participant_session(" Attention, vous allez modifier l'organisme financeur du participant"); + } }} value={p_detail_financeur_rattachement_nom} diff --git a/src/components/Partner_Client.js b/src/components/Partner_Client.js index aa8e2fe..2699138 100644 --- a/src/components/Partner_Client.js +++ b/src/components/Partner_Client.js @@ -66,6 +66,7 @@ import 'reactjs-popup/dist/index.css'; import Link from '@mui/material/Link'; import { PiDotsThree } from "react-icons/pi"; import { FcOrganization, FcBusinessman } from "react-icons/fc"; +import Autocomplete from '@mui/material/Autocomplete'; const Partner_Client = (props) => { @@ -123,7 +124,7 @@ const Partner_Client = (props) => { { field: 'raison_sociale', headerName: 'Raison sociale', Width: 200, flex: 1, hide: false, editable: false, renderCell: (params) => , }, { field: 'nom', headerName: 'nom', width: 100, hide: false, editable: false, Width: 200, flex: 1, renderCell: (params) => , }, - { field: 'email', headerName: 'email', width: 100, width: 200, flex: 1, renderCell: (params) => , }, + { field: 'email', headerName: 'email', width: 100, width: 200, flex: 1, renderCell: (params) => , }, { field: 'telephone', headerName: 'Téléphone', width: 100, hide: false, editable: false, width: 100, renderCell: (params) => , }, { field: 'adr_adresse', headerName: 'Adresse', width: 100, hide: true, editable: false, width: 100, renderCell: (params) => , }, @@ -336,6 +337,67 @@ const Partner_Client = (props) => { } + const [Get_List_Partner_Clients_With_Filter_api, setGet_List_Partner_Clients_With_Filter_api] = useState(); + const [Get_List_Partner_Clients_With_Filter_message, setGet_List_Partner_Clients_With_Filter_message] = useState(); + const [Get_List_Partner_Clients_With_Filter_result, setGet_List_Partner_Clients_With_Filter_result] = useState(); + function Get_List_Partner_Clients_With_Filter(event) { + + var form = new FormData(); + + // Recuperation des parametres + var filtre1 = p_filtre1; + var filtre2 = p_filtre2; + + var filtre1_value = ""; + var filtre2_value = ""; + + // Recuperation des valeurs de filtres + + if (p_filtre1_value) { + filtre1_value = p_filtre1_value; + form.append(filtre1, filtre1_value); + } + + if (p_filtre2_value) { + filtre2_value = p_filtre2_value; + form.append(filtre2, filtre2_value); + } + + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Partner_List_Partner_Client_with_filter_Like/"; + + axios.post(myurl, form).then(res => { + //console.log(" In Get_List_Partner_Clients_With_Filter res.data.status = " + res.data.status); + //console.log(" In Get_List_Partner_Clients_With_Filter res.data.message r_class = " + res.data.message); + + if (String(res.data.status) === String("true")) { + setGet_List_Partner_Clients_With_Filter_api("true"); + setGet_List_Partner_Clients_With_Filter_result(res.data.message); + setrows_list_clients(res.data.message); + } + else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); + } + else { + setGet_List_Partner_Clients_With_Filter_api("false"); + setGet_List_Partner_Clients_With_Filter_message(res.data.message); + alert(res.data.message) + } + + }).catch((error) => { + console.warn('Not good man :( Get_List_Partner_Clients_With_Filter = ', error); + setGet_List_Partner_Clients_With_Filter_api("false"); + alert(" Impossible de récupérer la liste des client"); + //setmyApimyApiMessage("") + }) + } + + function close_detail_client() { setSelectionModel([]); @@ -523,10 +585,11 @@ const Partner_Client = (props) => { function clean_all_filters() { setp_filtre1(""); - setp_filtre1_value(); - setp_filtre2(); - setp_filtre2_value(); + setp_filtre1_value(""); + setp_filtre2(""); + setp_filtre2_value(""); + Get_List_Partner_Clients(); } @@ -572,6 +635,12 @@ const Partner_Client = (props) => { setDialog_client_open(false); }; + const New_Option_Filter = [ + { "id": "nom", "label": "Nom ", "value": "nom" }, + { "id": "email", "label": "Email ", "value": "email" }, + { "id": "", "label": "", "value": "" }, + { "id": "1", "label": "", "value": "1" }, // Cette ligne pour couvrir l'ajout d'une ligne de filter. C'est fait expres. + ] return ( @@ -594,10 +663,10 @@ const Partner_Client = (props) => { String(selected_id).length > 0 &&
{String(JSON.parse(Get_List_Partner_Clients_result[gridline_id]).is_company) === "1" && } {String(JSON.parse(Get_List_Partner_Clients_result[gridline_id]).is_company) === "0" && } - {String(JSON.parse(Get_List_Partner_Clients_result[gridline_id]).is_company) !== "0" && - String(JSON.parse(Get_List_Partner_Clients_result[gridline_id]).is_company) !== "1" && - ""} - + {String(JSON.parse(Get_List_Partner_Clients_result[gridline_id]).is_company) !== "0" && + String(JSON.parse(Get_List_Partner_Clients_result[gridline_id]).is_company) !== "1" && + ""} +
}
@@ -693,7 +762,29 @@ const Partner_Client = (props) => {
- 0 && (data).value === String(p_filtre1))[0].label} + options={New_Option_Filter} + onChange={(event, value) => { + if (value && value.value) { + setp_filtre1(value.value); + + } + + }} + + renderInput={(params) => + } + />} + + {/*} { Email     - + */}
@@ -756,8 +847,8 @@ const Partner_Client = (props) => {   { - setp_filtre1(); - setp_filtre1_value(); + setp_filtre1(""); + setp_filtre1_value(""); }} /> @@ -769,7 +860,28 @@ const Partner_Client = (props) => { {p_filtre2 &&
- 0 && (data).value === String(p_filtre2))[0].label} + options={New_Option_Filter} + onChange={(event, value) => { + if (value && value.value) { + setp_filtre2(value.value); + + } + + }} + + renderInput={(params) => + } + />} + {/* { Nom    Email   - + */}
{String(p_filtre2).length > 3 && @@ -821,8 +933,8 @@ const Partner_Client = (props) => {   { - setp_filtre2(); - setp_filtre2_value(); + setp_filtre2(""); + setp_filtre2_value(""); }} /> @@ -834,7 +946,7 @@ const Partner_Client = (props) => { {
-