From 63c4572f6fa65a3134c98a63d790d899fff3832f Mon Sep 17 00:00:00 2001 From: cherif Date: Wed, 26 Jun 2024 19:36:23 +0200 Subject: [PATCH] 26/06/2024 - 19h30 --- src/components/Apprenant.js | 137 ++++++++++++++------- src/components/DisplayPartnerSession.js | 110 ++++++++++++++--- src/components/DisplayPartnerStagiaires.js | 69 +++++------ src/components/Partner.js | 19 +-- 4 files changed, 229 insertions(+), 106 deletions(-) diff --git a/src/components/Apprenant.js b/src/components/Apprenant.js index 2952ace..035f95e 100644 --- a/src/components/Apprenant.js +++ b/src/components/Apprenant.js @@ -115,11 +115,32 @@ const Apprenant = (props) => { - const columns = [ { field: 'id', headerName: 'id', hide: true }, { field: '_id', headerName: '_id', hide: true }, - { field: 'civilite', headerName: 'Civ.', hide: false, minWidth: 50, flex: 1, renderCell: (params) => , }, + + { + field: 'civilite', headerName: 'Civ.', minWidth: 100, flex: 1, maxWidth: 100, hide: false, editable: false, editable: false, + + renderCell: (cellValues) => { + return ( + +
+ {New_civilite && New_civilite.length > 0 && cellValues.row.civilite && + + } + +
+ + ); + }, + }, + + { field: 'nom', headerName: 'Nom', hide: false, minWidth: 200, flex: 1, renderCell: (params) => , }, { field: 'prenom', headerName: 'Prénom', hide: false, minWidth: 200, flex: 1, renderCell: (params) => , }, { field: 'email', headerName: 'Email', hide: false, minWidth: 200, flex: 1, renderCell: (params) => , }, @@ -1912,6 +1933,11 @@ const Apprenant = (props) => { Export_apprenant(liste_apprenant); } + else if (String(actionmass_ftion_val) === String("inscrire")) { + setDialog_add_inscription_open(true); + } + + } @@ -2533,6 +2559,7 @@ const Apprenant = (props) => { var local_internal_url = JSON.parse(x).class_internal_url; var local_title_session = JSON.parse(x).titre; var local_code_session = JSON.parse(x).code_session; + var local_invoiced_statut = JSON.parse(x).invoiced_statut; @@ -2544,6 +2571,7 @@ const Apprenant = (props) => { "class_internal_url": local_internal_url, "titre": local_title_session, "code_session": local_code_session, + "invoiced_statut": local_invoiced_statut, }; new_data2.push(node); @@ -3839,6 +3867,8 @@ const Apprenant = (props) => { var myurl = process.env.REACT_APP_API_URL + "myclass/api/Apprenant_Inscrire_Session_List/"; + Dialog_add_inscription_handleClose_buton(); + setLoading(true); axios.post(myurl, form).then(res => { //console.log(" In Add_Inscription_List_Apprenant res.data.status = " + res.data.status); @@ -4249,7 +4279,7 @@ const Apprenant = (props) => { ] const New_civilite = [ - { "id": "nme", "label": "Mme", "value": "mme" }, + { "id": "mme", "label": "Mme", "value": "mme" }, { "id": "m", "label": "M", "value": "m" }, { "id": "neutre", "label": "Neutre", "value": "neutre" }, { "id": "", "label": "", "value": "" }, @@ -4425,6 +4455,7 @@ const Apprenant = (props) => { { "id": "0", "label": "Dupliquer", "value": "dupliquer" }, { "id": "1", "label": "Exporter", "value": "exporter" }, + { "id": "3", "label": "(R)Inscrire", "value": "inscrire" }, { "id": "2", "label": "Supprimer", "value": "supprimer" }, ] @@ -4470,7 +4501,7 @@ const Apprenant = (props) => { setadd_one_suivi_ped(""); } - + const [Get_Geven_Suivi_Ped_Data_api, setGet_Geven_Suivi_Ped_Data_api] = useState(); const [Get_Geven_Suivi_Ped_Data_message, setGet_Geven_Suivi_Ped_Data_message] = useState(); @@ -4507,85 +4538,85 @@ const Apprenant = (props) => { if (mylocaltraining.responsable_id) { setp_detail_suivi_ped_responsable_id(mylocaltraining.responsable_id); - }else{ - setp_detail_suivi_ped_responsable_id(""); + } else { + setp_detail_suivi_ped_responsable_id(""); } if (mylocaltraining.class_id) { setp_detail_suivi_ped_class_id(mylocaltraining.class_id); - }else{ - setp_detail_suivi_ped_class_id(""); + } else { + setp_detail_suivi_ped_class_id(""); } if (mylocaltraining.class_eu_id) { setp_detail_suivi_ped_class_eu_id(mylocaltraining.class_eu_id); - }else{ - setp_detail_suivi_ped_class_eu_id(""); + } else { + setp_detail_suivi_ped_class_eu_id(""); } if (mylocaltraining.session_id) { setp_detail_suivi_ped_session_id(mylocaltraining.session_id); - }else{ - setp_detail_suivi_ped_session_id(""); + } else { + setp_detail_suivi_ped_session_id(""); } if (mylocaltraining.date_heure_debut) { setp_detail_suivi_ped_eval_date_heure_debut(mylocaltraining.date_heure_debut); - }else{ - setp_detail_suivi_ped_eval_date_heure_debut(""); + } else { + setp_detail_suivi_ped_eval_date_heure_debut(""); } if (mylocaltraining.date_heure_fin) { setp_detail_suivi_ped_eval_date_heure_fin(mylocaltraining.date_heure_fin); - }else{ - setp_detail_suivi_ped_eval_date_heure_fin(""); + } else { + setp_detail_suivi_ped_eval_date_heure_fin(""); } if (mylocaltraining.observation) { setp_detail_suivi_ped_observation(mylocaltraining.observation); - }else{ - setp_detail_suivi_ped_observation(""); + } else { + setp_detail_suivi_ped_observation(""); } if (mylocaltraining.commentaire) { setp_detail_suivi_ped_comment(mylocaltraining.commentaire); - }else{ - setp_detail_suivi_ped_comment(""); + } else { + setp_detail_suivi_ped_comment(""); } - + if (mylocaltraining.class_internal_url) { setp_detail_suivi_ped_class_internal_url(mylocaltraining.class_internal_url); - }else{ - setp_detail_suivi_ped_class_internal_url(""); + } else { + setp_detail_suivi_ped_class_internal_url(""); } if (mylocaltraining.session_code) { setp_detail_suivi_ped_comment(mylocaltraining.session_code); - }else{ - setp_detail_suivi_ped_comment(""); + } else { + setp_detail_suivi_ped_comment(""); } if (mylocaltraining.ue_code) { setp_detail_suivi_ped_comment(mylocaltraining.ue_code); - }else{ - setp_detail_suivi_ped_comment(""); + } else { + setp_detail_suivi_ped_comment(""); } if (mylocaltraining.ue_titre) { setp_detail_suivi_ped_comment(mylocaltraining.ue_titre); - }else{ - setp_detail_suivi_ped_comment(""); + } else { + setp_detail_suivi_ped_comment(""); } - + if (document.getElementById('detail_apprenant')) { @@ -4746,8 +4777,15 @@ const Apprenant = (props) => { String(selected_apprenant_id).length > 0 && Get_All_Apprenant_result[selected_apprenant_row_id] &&
- {JSON.parse(Get_All_Apprenant_result[selected_apprenant_row_id]).civilite} + {New_civilite && New_civilite.length > 0 && selected_apprenant_row_id && + + }
} + + +
@@ -5243,13 +5281,14 @@ const Apprenant = (props) => { + {/*** Dialog pour reinscrire un apprenant à une session */} - Ajouter une inscription + Inscrire {New_Getall_TrainingSession_result &&
Session @@ -5259,7 +5298,7 @@ const Apprenant = (props) => { id="combo-box-demo" className="session_caract_Dialog" fullWidth - options={New_Getall_TrainingSession_result} + options={New_Getall_TrainingSession_result.filter((data) => (data).invoiced_statut !== "2")} onChange={(event, value) => { if (value && value._id) { setp_dialog_session_id(value._id); @@ -5373,6 +5412,9 @@ const Apprenant = (props) => {
+ + {/*** Fin Dialog pour reinscrire un apprenant à une session */} + { onChange={(event, value) => { if (value && value.value) { if (String(value.value) === "supprimer" - || String(value.value) === "dupliquer" || String(value.value) === "exporter") { + || String(value.value) === "dupliquer" || String(value.value) === "exporter" + || String(value.value) === "inscrire") { setactionmass_ftion_val(value.value); } else { @@ -5825,6 +5868,10 @@ const Apprenant = (props) => { {String(actionmass_ftion_val) === "exporter" && Confirmer l'export excel de {selectionModel.length} apprenant(s). } + + {String(actionmass_ftion_val) === "inscrire" && + Confirmer l'inscription en masse de {selectionModel.length} apprenant(s). + }
@@ -5932,9 +5979,9 @@ const Apprenant = (props) => { } > - M.    - Mme.   - Neutre   + M.    + Mme.   + Neutre  
@@ -6272,7 +6319,7 @@ const Apprenant = (props) => {
-
+ {/*

-
+
*/} @@ -6300,7 +6347,7 @@ const Apprenant = (props) => { }} disabled={false} className="disabled_style enable_style" - value={p_detail_civilite} + value={New_civilite.filter((data) => (data).id === String( p_detail_civilite) )[0].label} /> @@ -6327,9 +6374,9 @@ const Apprenant = (props) => { } > - M.    - Mme.   - Neutre   + M.    + Mme.   + Neutre   } @@ -7037,7 +7084,7 @@ const Apprenant = (props) => { -
+ {/*
{selectionModel && selectionModel.length >= 1 &&
@@ -7114,7 +7161,7 @@ const Apprenant = (props) => { }
} -
+
*/} diff --git a/src/components/DisplayPartnerSession.js b/src/components/DisplayPartnerSession.js index 7041335..44ee359 100644 --- a/src/components/DisplayPartnerSession.js +++ b/src/components/DisplayPartnerSession.js @@ -201,6 +201,7 @@ const DisplayPartnerSession = (props) => { const columns = [ { field: 'id', headerName: 'id', hide: true }, { field: '_id', headerName: '_id', hide: true }, + { field: 'is_bpf', headerName: 'is_bpf', hide: true, }, { field: 'session_alert_message', headerName: 'session_alert_message', hide: true }, { field: 'class_internal_url', headerName: 'class_internal_url', hide: true }, @@ -328,13 +329,18 @@ const DisplayPartnerSession = (props) => { { field: 'invoiced_statut', headerName: 'Facturé', minWidth: 100, flex: 1, maxWidth: 150, hide: false, editable: false, - valueFormatter: (params) => { - if (String(params.value) === "2") - return "Oui"; - else if (String(params.value) === "1") - return "Part."; - else - return "Non"; + renderCell: (cellValues) => { + return ( + +
+ {String(cellValues.row.invoiced_statut) === "2" && "Oui"} + + {String(cellValues.row.invoiced_statut) === "1" && "Part."} + + {String(cellValues.row.invoiced_statut) !== "1" && String(cellValues.row.invoiced_statut) !== "2" && "Non"} +
+ + ); }, }, @@ -429,7 +435,27 @@ const DisplayPartnerSession = (props) => { const columns_preinscrit = [ { field: 'id', headerName: 'id', hide: true }, { field: '_id', headerName: '_id', hide: true }, - { field: 'civilite', headerName: 'Civ.', minWidth: 100, flex: 1, maxWidth: 100, hide: false, editable: false, editable: false, renderCell: (params) => , }, + + { + field: 'civilite', headerName: 'Civ.', minWidth: 90, flex: 1, maxWidth: 100, hide: false, editable: false, editable: false, + + renderCell: (cellValues) => { + return ( + +
+ {New_civilite && New_civilite.length > 0 && cellValues.row.civilite && + + } + +
+ + ); + }, + }, + { 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) => , }, @@ -706,7 +732,28 @@ const DisplayPartnerSession = (props) => { { field: 'id', headerName: 'id', hide: true }, { field: '_id', headerName: '_id', hide: true }, { field: 'has_invoice_split', headerName: 'has_invoice_split', hide: true }, - { field: 'civilite', headerName: 'Civ.', minWidth: 70, flex: 1, maxWidth: 100, hide: false, editable: false, editable: false }, + + { + field: 'civilite', headerName: 'Civ.', minWidth: 90, flex: 1, maxWidth: 100, hide: false, editable: false, editable: false, + + renderCell: (cellValues) => { + return ( + +
+ {New_civilite && New_civilite.length > 0 && cellValues.row.civilite && + + } + +
+ + ); + }, + }, + + { field: 'nom', headerName: 'nom', minWidth: 150, flex: 1, hide: false, editable: false, renderCell: (params) => , @@ -1328,7 +1375,7 @@ const DisplayPartnerSession = (props) => { if (String(res.data.status) === String("true")) { //console.log(" In Getall_TrainingSession res.data.status = " + res.data.status); - console.log(" In Getall_TrainingSession res.data.message r_class = " + res.data.message); + //console.log(" In Getall_TrainingSession res.data.message r_class = " + res.data.message); setGetall_TrainingSession_api("true"); setGetall_TrainingSession_result(res.data.message); setRows(res.data.message); @@ -3968,6 +4015,28 @@ const DisplayPartnerSession = (props) => { let [edit_session_form, setedit_session_form] = useState(false); function enableSessionFields() { + // zzzz + + if (rowss && String(gridline_id).length > 0 && rowss.length > 0) { + var local_session_invoice_status = JSON.parse(rowss[gridline_id]).invoiced_statut; + + + if (String(local_session_invoice_status) === "1") { + var message = " Vous avez commencé à facture cette session, la modification n'est plus autorisée"; + setDialog_1_message(message); + setDialog_1_open(true); + + return; + } + else if (String(local_session_invoice_status) === "2") { + var message = " Vous avez déjà facturé cette session, la modification n'est plus autorisée"; + setDialog_1_message(message); + setDialog_1_open(true); + + return; + } + } + setedit_session_form(true); document.getElementsByName("code_session")[0].disabled = false; @@ -12559,11 +12628,17 @@ const DisplayPartnerSession = (props) => {
- Exclu BPF + Inclus BPF
- {rowss && String(session_selected_row_id).length > 0 &&
- -
} + {rowss && String(session_selected_row_id).length > 0 && String(JSON.parse(rowss[session_selected_row_id]).is_bpf) === "1" && +
+ +
} + + {rowss && String(session_selected_row_id).length > 0 && String(JSON.parse(rowss[session_selected_row_id]).is_bpf) !== "1" && +
+ +
}
@@ -13692,8 +13767,9 @@ const DisplayPartnerSession = (props) => { is_session_alert: JSON.parse(item).is_session_alert, session_alert_message: JSON.parse(item).session_alert_message, + is_bpf: JSON.parse(item).is_bpf, + - } ))} @@ -13820,7 +13896,7 @@ const DisplayPartnerSession = (props) => { } - {(display_session_with_alert && display_session_with_alert === true) && + {(display_session_with_alert && display_session_with_alert === true) &&
  { is_session_alert: JSON.parse(item).is_session_alert, session_alert_message: JSON.parse(item).session_alert_message, - + } ))} diff --git a/src/components/DisplayPartnerStagiaires.js b/src/components/DisplayPartnerStagiaires.js index fd0af54..dddb82b 100644 --- a/src/components/DisplayPartnerStagiaires.js +++ b/src/components/DisplayPartnerStagiaires.js @@ -105,8 +105,27 @@ const DisplayPartnerStagiaires = (props) => { { field: 'ville', headerName: 'ville', hide: true, editable: false, Width: 0 }, { field: 'pays', headerName: 'pays', hide: true, editable: false, Width: 0 }, + { + field: 'civilite', headerName: 'Civ.', minWidth: 100, flex: 1, maxWidth: 100, hide: false, editable: false, editable: false, + + renderCell: (cellValues) => { + return ( + +
+ {New_civilite && New_civilite.length > 0 && cellValues.row.civilite && + + } + +
+ + ); + }, + }, + - { 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) => , }, @@ -6145,12 +6164,9 @@ const DisplayPartnerStagiaires = (props) => { const New_civilite = [ - { "id": "nme", "label": "Mme", "value": "mme" }, + { "id": "mme", "label": "Mme", "value": "mme" }, { "id": "m", "label": "M", "value": "m" }, { "id": "neutre", "label": "Neutre", "value": "neutre" }, - { "id": "Mme", "label": "Mme", "value": "Mme" }, - { "id": "M", "label": "M", "value": "M" }, - { "id": "Neutre", "label": "Neutre", "value": "Neutre" }, { "id": "", "label": "", "value": "" }, ] @@ -6265,11 +6281,11 @@ const DisplayPartnerStagiaires = (props) => { var tab_session_id = []; tab_session_id.push(selected_session_id); - + var nom_fichier_cmd = "export_notes.xlsx"; - var url = process.env.REACT_APP_API_URL + "myclass/api/Export_Excel_List_Participant_Notes/" + stored_cookie + "/" + tab_session_id + "/"+tab_my_inscription_ids+"/"; + var url = process.env.REACT_APP_API_URL + "myclass/api/Export_Excel_List_Participant_Notes/" + stored_cookie + "/" + tab_session_id + "/" + tab_my_inscription_ids + "/"; //console.log(" ### url = ", url); @@ -6318,7 +6334,13 @@ const DisplayPartnerStagiaires = (props) => { Civilite
- {} + + {New_civilite && New_civilite.length > 0 && selected_row_data_json.civilite && + + } +
@@ -8114,8 +8136,6 @@ const DisplayPartnerStagiaires = (props) => {
Civilité
- - { /> } /> - {/* { - setp_one_civilite_part(e.target.value); - - } - } - - > - Mme.   - M.   - Neutre   - */}
@@ -9144,7 +9141,7 @@ const DisplayPartnerStagiaires = (props) => { } {String(participant_data_edit_mode) !== "1" &&
Civilité
- 0 && p_detail_civilite && { disabled={false} className="disabled_style" - value={p_detail_civilite} + value= {New_civilite.filter((data) => (data).id === String(p_detail_civilite))[0].label} - /> + />}
} diff --git a/src/components/Partner.js b/src/components/Partner.js index bcff39f..faa5f03 100644 --- a/src/components/Partner.js +++ b/src/components/Partner.js @@ -46,6 +46,7 @@ import { BsTools } from "react-icons/bs"; import DisplayPartnerSession from "./DisplayPartnerSession"; import DisplayPartnerStagiaires from "./DisplayPartnerStagiaires"; + import Employes from "./Employes"; import Materiels from "./Materiels"; import Partner_Commande from "./Partner_Commande"; @@ -1583,11 +1584,11 @@ const Partner = (props) => { } style={{ overflow: 'hidden' }}> - {String(menu) !== "mes_stagiaires" && }> FICHE APPRENANTS } - {String(menu) === "mes_stagiaires" && }> FICHE APPRENANTS } + {String(menu) !== "mes_apprenants" && }> FICHE APPRENANTS } + {String(menu) === "mes_apprenants" && }> FICHE APPRENANTS } - {String(menu) !== "mes_apprenants" && }> PARCOURS APPRENANTS } - {String(menu) === "mes_apprenants" && }> PARCOURS APPRENANTS } + {String(menu) !== "mes_stagiaires" && }> PARCOURS APPRENANTS } + {String(menu) === "mes_stagiaires" && }> PARCOURS APPRENANTS } {String(formation_initiale) === "1" && String(menu) !== "groupe_apprenant" && }> GROUPE APPRENANTS } {String(formation_initiale) === "1" && String(menu) === "groupe_apprenant" && }> GROUPE APPRENANTS } @@ -2097,14 +2098,16 @@ const Partner = (props) => { } - {String(menu) === "mes_stagiaires" &&
+ {String(menu) === "mes_apprenants" &&
+
} - {String(menu) === "mes_apprenants" &&
+ {String(menu) === "mes_stagiaires" &&
+ {
} - {String(menu) === "mes_stagiaires" &&
+ {String(menu) === "mes_apprenants" &&
} - {String(menu) === "mes_apprenants" &&
+ {String(menu) === "mes_stagiaires" &&