diff --git a/src/components/AddPartnerClient.js b/src/components/AddPartnerClient.js index 6742fa6..9cbeb47 100644 --- a/src/components/AddPartnerClient.js +++ b/src/components/AddPartnerClient.js @@ -6,7 +6,7 @@ import fileDownload from 'js-file-download'; import 'react-confirm-alert/src/react-confirm-alert.css'; // Import css import Button from '@mui/material/Button'; import axios from "axios"; - +import TextareaAutosize from '@mui/material/TextareaAutosize'; import { getCookie, setCookie } from 'react-use-cookie'; import { AiTwotoneSave } from "react-icons/ai"; import { useHistory } from "react-router-dom"; @@ -129,6 +129,8 @@ const AddParnerClient = (props) => { const [p_detail_archive, setp_detail_archive] = useState(""); + const [p_client_comment, setp_client_comment] = useState(""); + const [p_client_siret, setclient_siret] = useState(""); const [p_client_tva, setclient_tva] = useState(""); @@ -179,7 +181,7 @@ const AddParnerClient = (props) => { return ( + + + } + +
+
+
+ + + + + + ))} + + + } + + {String(addcontact) === "1" &&
+ + {String(formedit_mode_contact) === "1" &&
+ Civilité
+ + (data).value === String(p_contact_civilite))[0].label} + options={New_civilite} + onChange={(event, value) => { + if (value && value.value) { + setp_contact_civilite(value.value); + setdatamodification_contact("1"); + } + }} + renderInput={(params) => + } + /> + + +
} + + {String(formedit_mode_contact) !== "1" &&
+ Civilité
+ {New_civilite.length > 0 && (data).value === String(p_contact_civilite))[0].label} + + />} + +
} + + +
+ Nom
+ setp_contact_nom(e.target.value)} + + /> +
+ + +
+ Prénom
+ setp_contact_prenom(e.target.value)} + /> +
+
Email
+ setp_contact_email(e.target.value)} + + /> +
+ + +
+ Fonction
+ setp_contact_fonction(e.target.value)} + + /> +
+ + + + +
+ Téléphone Fixe
+ setcontact_telephone(e.target.value)} + /> +
+ +
+ Téléphone Mobile
+ setp_contact_telephone_mobile(e.target.value)} + /> +
+ + +
+ Adresse
+ setcontact_adresse(e.target.value)} + /> +
+
+ ville
+ setcontact_ville(e.target.value)} + /> +
+
+ Code Postal
+ setcontact_code_postal(e.target.value)} + /> +
+
+ Pays
+ setcontact_pays(e.target.value)} + /> +
+ +
+ + + N° Siret
+ setcontact_siret(e.target.value)} + /> +
+
+ +
+ + + N° TVA
+ setcontact_tva(e.target.value)} + /> +
+
+ +
+
+
+ + +
+ + + +
+
+
+   +
+ + + {String(datamodification_contact) === "1" &&
+
/!\ Pensez à enregistrer les modifications
} + + {String(formedit_mode_contact) === "1" &&
+
+ +
+
+ +
+
+ } + {String(formedit_mode_contact) !== "1" &&
+ +
+ +
+ + {String(props.check_user_acces_right("client", "write")) === "1" &&
+ +
} +
+ } + +
} + + } + + + {String(submenu).trim() === "submenu_activite" &&
+ +
} + + {String(submenu).trim() === "submenu_piece_jointe" &&
+ + +
+
+ + {String(props.check_user_acces_right("client", "write")) === "1" &&
+ +
} + {file_1_name && file_1_name.name && + } + + {Record_All_PJ_api && String(Record_All_PJ_api) === "true" &&
Pièce jointe enregistrée
} + + {Record_All_PJ_api && String(Record_All_PJ_api) === "false" &&
{Record_All_PJ_message}
} + + +
+ + + + {file_1_name && file_1_name.name &&
+ +
+ +
+ + + +
} + + {/*Get_List_Of_All_PJ_result &&
+
+ Liste des pièces jointes
+
+ {Get_List_Of_All_PJ_result && Get_List_Of_All_PJ_result.map((val) => ( +
+ + + {String(props.check_user_acces_right("client", "write")) === "1" && Supprimer + + + } + modal + nested + position="center center" + > + {close => ( +
+ +
MySy Information
+
+ {' '} + + En confirmant cette opération, la pièce jointe sera définitivement supprimée.
+ + +
+
+
+ + +
+
+ +
+
+
+ )} +
} + +
+ ))} +
+
+
*/} +
+ +
+ +
+ + +
} + + +
+   Fermer +
+ } + + + + ); +} + +export default AddPartnerClient_ARG; + + +const local_css = ` +:root { + --bg: #f6f8fb; + --card: #ffffff; + --text: #0f172a; + --muted: #64748b; + --border: #e5e7eb; + --shadow: 0 10px 25px rgba(2, 6, 23, .06); + --green-700: #0f6b53; + --green-600: #167a5e; + --green-100: #e9f7f1; + --blue-600: #2563eb; + --radius: 14px; + --radius-sm: 10px; +} + .Grid_2_col{ + margin-top: 12px; + display:grid; + grid-template-columns: 1.2fr 1fr; + gap: 14px; + padding:5px; +} + +.Grid_2_col_sub_colone { + background: #fff; + border: 1px solid #e5e7eb; + border-radius: 14px; + box-shadow: 0 6px 18px rgba(2,6,23,.04); + padding: 0px; + display: flex; + flex-direction: column; + gap: 14px; +} + + +.Grid_2_col_sub_colone_header { + background: #dbeafe; + border-top-right-radius: 10px; + border-top-left-radius: 10px; + text-align: center; + font-family: DM Sans; + font-weight: 700; + height: 2rem; + padding-top: 5px; + font-size: 15px; +} + +.Grid_2_col_sub_colone_bottom_menu{ + +} + +.card__header{ +background: #e2e8f0; + font-size: small; + text-align: center; +} + +.card__title{ + display:flex; + align-items:center; + gap: 10px; +} + +.card__icon{ + width: 34px; + height: 34px; + display:grid; + place-items:center; + border-radius: 12px; + background:#eff6ff; + border:1px solid #dbeafe; +} + +.card__header h2{ + margin:0; + font-size: 15px; + letter-spacing: -0.01em; +} + +.card__actions{ display:flex; align-items:center; gap:8px; } + +.block_detail_action{ +width: 100%; + float: left; + background: #fafafa; + padding: 10px; + border: unset; + border-radius: 10px; + } +`; diff --git a/src/components/Apprenant.js b/src/components/Apprenant.js index 3953a8f..7cdfb1a 100644 --- a/src/components/Apprenant.js +++ b/src/components/Apprenant.js @@ -19,6 +19,8 @@ import fileDownload from 'js-file-download' import { FcInfo } from "react-icons/fc"; import Popup from 'reactjs-popup'; import 'reactjs-popup/dist/index.css'; +import VisibilityIcon from '@mui/icons-material/Visibility'; +import ArrowCircleDownIcon from '@mui/icons-material/ArrowCircleDown'; import TextareaAutosize from '@mui/material/TextareaAutosize'; import { FcAcceptDatabase, } from "react-icons/fc"; import { format } from 'date-fns' @@ -570,6 +572,45 @@ const Apprenant = (props) => { ] + const columns_facture = [ + { field: '_id', headerName: '_id', hide: true, disableExport: true, }, + { field: 'id', headerName: 'id', hide: true, disableExport: true }, + { field: 'invoice_header_ref_interne', headerName: 'Num Facture', minWidth: 200, flex: 1, hide: false, editable: false, }, + { field: 'order_header_ref_interne', headerName: 'Réf. Cmd', minWidth: 200, flex: 1, hide: true, editable: false }, + { field: 'invoice_header_type', headerName: 'Type', width: 100, hide: false, editable: false }, + { field: 'invoice_date', headerName: 'Date Facture', width: 150, hide: false, editable: false }, + { field: 'invoice_date_echeance', headerName: 'Echéance', width: 150, hide: false, editable: false }, + + { field: 'order_header_client_id', headerName: 'Client_Id', width: 150, hide: true, editable: false, disableExport: true }, + { field: 'order_header_client_nom', headerName: 'Nom Client', minWidth: 150, flex: 1 }, + { field: 'order_header_vendeur_id', headerName: 'Vendeur Id', width: 0, hide: true, editable: false, disableExport: true, disableExport: true }, + { field: 'order_header_vendeur_nom_prenom', headerName: 'Vendeur', width: 0, hide: true, editable: false, disableExport: true }, + { field: 'order_header_date_cmd', headerName: 'Date Cmd', width: 150, hide: true, editable: false }, + { field: 'total_header_hors_taxe_before_header_reduction', headerName: 'Montant HT', width: 150, hide: false, editable: false }, + { field: 'order_header_tax_amount', headerName: 'Taxe', width: 150, hide: false, editable: false }, + { field: 'total_header_toutes_taxes', headerName: 'Montant TTC', width: 150, hide: false, editable: false }, + { field: 'reste_to_paye', headerName: 'A payer', width: 150, hide: false, editable: false }, + { field: 'credit_note_ref', headerName: 'Ref. Avoir', width: 150, hide: true, editable: false, }, + { field: 'invoice_header_origin', headerName: 'Fact. Orig.', width: 150, hide: false, editable: false, }, + + { + field: 'Télécharger', headerName: 'Télécharger', minWidth: 50, flex: 1, maxWidth: 100, hide: false, editable: false, + renderCell: (cellValues) => { + return ( + + ) + }, + + }, + + ] + function handleClick_delete_suivi_pedago(event, cellValues) { @@ -3083,6 +3124,51 @@ const Apprenant = (props) => { } + const [Get_All_Apprenant_Invoices_api, setGet_All_Apprenant_Invoices_api] = useState(); + const [Get_All_Apprenant_Invoices_message, setGet_All_Apprenant_Invoices_message] = useState(); + const [Get_All_Apprenant_Invoices_result, setGet_All_Apprenant_Invoices_result] = useState([]); + function Get_All_Apprenant_Invoices(event) { + + var form = new FormData(); + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("tab_apprenant_ids", selected_apprenant_id); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Tab_Apprenant_List_Invoices/"; + + + setLoading(true); + axios.post(myurl, form).then(res => { + setLoading(false); + if (String(res.data.status) === String("true")) { + //console.log(" In Get_All_Apprenant_Invoices res.data.status = " + res.data.status); + console.log(" In Get_All_Apprenant_Invoices res.data.message r_class = " + res.data.message); + setGet_All_Apprenant_Invoices_api("true"); + setGet_All_Apprenant_Invoices_result(res.data.message); + } + else { + setGet_All_Apprenant_Invoices_api("false"); + setGet_All_Apprenant_Invoices_message(res.data.message); + // alert(res.data.message) + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + setLoading(false); + console.warn('Not good man :( Get_All_Apprenant_Invoices = ', error); + setGet_All_Apprenant_Invoices_api("false"); + alert("Impossible de récuperer la liste des factures"); + //setmyApimyApiMessage("") + }) + } + + + + const [New_Get_List_Partner_Clients_result, setNew_Get_List_Partner_Clients_result] = useState([]); const [Get_List_Partner_Clients_api, setGet_List_Partner_Clients_api] = useState(); @@ -3926,12 +4012,12 @@ const Apprenant = (props) => { const [New_Getall_Partner_Default_Paiement_Mode_result, setNew_Getall_Partner_Default_Paiement_Mode_result] = useState([{ - "_id": "", - "id": "", - "label": "", - "code": "", - "description": "", - }]); + "_id": "", + "id": "", + "label": "", + "code": "", + "description": "", + }]); const [Getall_Partner_Default_Paiement_Mode_api, setGetall_Partner_Default_Paiement_Mode_api] = useState(); const [Getall_Partner_Default_Paiement_Mode_message, setGetall_Partner_Default_Paiement_Mode_message] = useState(); @@ -4089,6 +4175,8 @@ const Apprenant = (props) => { const [selectionModel_apprenant_inscription, setselectionModel_apprenant_inscription] = React.useState([]); const [selectionModel_suivi_pedagogique, setselectionModel_suivi_pedagogique] = React.useState([]); + const [selectionModel_facture_apprenant, setselectionModel_facture_apprenant] = React.useState([]); + const [p_filtre1, setp_filtre1] = useState(""); const [p_filtre1_value, setp_filtre1_value] = useState(""); @@ -4465,6 +4553,9 @@ const Apprenant = (props) => { async function submenu_facturation() { + + Get_All_Apprenant_Invoices(); + Getall_Partner_Paiement_Condition(); setsubmenu("facturation"); @@ -6794,6 +6885,28 @@ const Apprenant = (props) => { }) } + + function print_invoice_pdf(local_seleced_invoice_id) { + const stored_cookie = getCookie('tokenmysypart'); + + var nom_fichier_cmd = "Facture.pdf"; + // console.log(" nom_fichier_cmd = ", nom_fichier_cmd, " --- selected_id = ", selected_id); + + var url = process.env.REACT_APP_API_URL + "myclass/api/GerneratePDF_Partner_Invoice/" + stored_cookie + "/" + local_seleced_invoice_id; + + //console.log(" nom_fichier_cmd = ", nom_fichier_cmd, " --- selected_id = ", selected_id, " --- url =", url); + + axios.get(url, { responseType: 'blob', },) + .then((res) => { + fileDownload(res.data, nom_fichier_cmd) + }).catch((error) => { + console.error('Error:', error); + + }); + } + + + return (
@@ -11296,19 +11409,191 @@ const Apprenant = (props) => { {String(display_detail_facturation) === "1" && String(add_One_Apprenant) !== "1" && selected_apprenant_id &&
-
-
-
+ {/*<> +
+
+
-
- -
- Détail facturation -
-
- - {String(facturation_data_edit_mode) !== "1" &&
+ +
+ Détail facturation +
+
+ + {String(facturation_data_edit_mode) !== "1" && +
+
+ +
Entreprise ?
+ + + +
+ + + {!p_detail_invoice_is_company &&
Civilité
+ (data).id === String(p_detail_invoice_civilite))[0].label} + /> +
} + +
{p_detail_invoice_is_company && " Nom Entreprise"} + {!p_detail_invoice_is_company && " Nom "}
+ +
+ + {!p_detail_invoice_is_company &&
Prénom
+ +
} + +
Email
+ +
+ +
Téléphone
+ +
+
 
+ +
Mode Paiement
+ {New_Getall_Partner_Default_Paiement_Mode_result && New_Getall_Partner_Default_Paiement_Mode_result.length > 0 && (data)._id === String(p_detail_invoice_mode_paiement))[0].label} + + + />} +
+ + +
Conditions Paiement
+ + + {New_Getall_Partner_Paiement_Condition_result && New_Getall_Partner_Paiement_Condition_result.length > 0 && (data)._id === String(p_detail_invoice_condition_paiement))[0].label} + + + />} +
+ +
Fréquence Facturation
+ + + {New_Option_Frequence_Facture && New_Option_Frequence_Facture.length > 0 && (data).id === String(p_detail_invoice_frequence))[0].label} + + + />} +
+ + +
+
} + + {String(facturation_data_edit_mode) === "1" &&
{ id="invoice_is_company" checked={p_detail_invoice_is_company} + onChange={(e) => { + setp_detail_invoice_is_company(e.target.checked); + } + } inputProps={{ 'aria-label': 'controlled' }} />
+ {!p_detail_invoice_is_company &&
Civilité
- (data).id === String(p_detail_invoice_civilite))[0].label} + value={New_civilite.filter((data) => (data).value === String(p_detail_invoice_civilite))[0].label} + options={New_civilite} + onChange={(event, value) => { + if (value && value.value) { + setp_detail_invoice_civilite(value.value); + } else { + setp_detail_invoice_civilite(""); + } + + setfacturation_data_changed("1"); + }} + renderInput={(params) => + } /> + +
} -
{p_detail_invoice_is_company && " Nom Entreprise"} - {!p_detail_invoice_is_company && " Nom "}
+
{p_detail_invoice_is_company && " Nom Entreprise"} + {!p_detail_invoice_is_company && " Nom "}
{ disabled={false} className="disabled_style enable_style" value={p_detail_invoice_nom} + onChange={(e) => { + setp_detail_invoice_nom(e.target.value); + setfacturation_data_changed("1"); + + }} />
@@ -11374,6 +11681,11 @@ const Apprenant = (props) => { disabled={false} className="disabled_style enable_style" value={p_detail_invoice_prenom} + onChange={(e) => { + setp_detail_invoice_prenom(e.target.value); + setfacturation_data_changed("1"); + + }} />
} @@ -11391,6 +11703,11 @@ const Apprenant = (props) => { disabled={false} className="disabled_style enable_style" value={p_detail_invoice_email} + onChange={(e) => { + setp_detail_invoice_email(e.target.value); + setfacturation_data_changed("1"); + + }} />
@@ -11408,593 +11725,392 @@ const Apprenant = (props) => { disabled={false} className="disabled_style enable_style" value={p_detail_invoice_telephone} + onChange={(e) => { + setp_detail_invoice_telephone(e.target.value); + setfacturation_data_changed("1"); + }} />
+
 
Mode Paiement
- {New_Getall_Partner_Default_Paiement_Mode_result && New_Getall_Partner_Default_Paiement_Mode_result.length > 0 && 0 && - InputLabelProps={{ - shrink: true, - }} - disabled={false} - className="disabled_style enable_style" - value={New_Getall_Partner_Default_Paiement_Mode_result.filter((data) => (data)._id === String(p_detail_invoice_mode_paiement))[0].label} + (data)._id === String(p_detail_invoice_mode_paiement))[0].label} + options={New_Getall_Partner_Default_Paiement_Mode_result} + className="disabled_style" + onChange={(event, value) => { + if (value && value._id) { + setp_detail_invoice_mode_paiement(value._id); + setfacturation_data_changed("1"); + } else { + setp_detail_invoice_mode_paiement(""); + setfacturation_data_changed("1"); + } + + }} + + renderInput={(params) => + } + /> - />} + }
-
Conditions Paiement
+ {New_Getall_Partner_Paiement_Condition_result && New_Getall_Partner_Paiement_Condition_result.length > 0 && + (data)._id === String(p_detail_invoice_condition_paiement))[0].label} + options={New_Getall_Partner_Paiement_Condition_result} + className="disabled_style" + onChange={(event, value) => { + if (value && value._id) { + setp_detail_invoice_condition_paiement(value._id); + setfacturation_data_changed("1"); + } else { + setp_detail_invoice_condition_paiement(""); + setfacturation_data_changed("1"); + } - {New_Getall_Partner_Paiement_Condition_result && New_Getall_Partner_Paiement_Condition_result.length > 0 && (data)._id === String(p_detail_invoice_condition_paiement))[0].label} + /> + } + />} - - />}
Fréquence Facturation
+ {New_Option_Frequence_Facture && New_Option_Frequence_Facture.length > 0 && + (data).id === String(p_detail_invoice_frequence))[0].label} + options={New_Option_Frequence_Facture} + className="disabled_style" + onChange={(event, value) => { + if (value && value.id) { + setp_detail_invoice_frequence(value.id); + setfacturation_data_changed("1"); + } else { + setp_detail_invoice_frequence(""); + setfacturation_data_changed("1"); + } - {New_Option_Frequence_Facture && New_Option_Frequence_Facture.length > 0 && + } + />} + +
+ + + +
+
} + +
+ +
+ +
+ +
+ Adresse de facturation +
+
+ + {String(facturation_data_edit_mode) !== "1" &&
+
+ +
Adresse
+ (data).id === String(p_detail_invoice_frequence))[0].label} + /> +
+ +
Code Postal
+ +
+ + +
Ville
+ +
+ + +
Pays
+ +
+ +
+   +
+
Commentaire
+ + + +
+ +
+
} + + {String(facturation_data_edit_mode) === "1" &&
+
+ +
Adresse
+ { + setp_detail_invoice_adresse(e.target.value); + setfacturation_data_changed("1"); + + }} + + /> +
+ +
Code Postal
+ { + setp_detail_invoice_code_postal(e.target.value); + setfacturation_data_changed("1"); + + }} + + /> +
+ + +
Ville
+ { + setp_detail_invoice_ville(e.target.value); + setfacturation_data_changed("1"); + + }} + + /> +
+ + +
Pays
+ { + setp_detail_invoice_pays(e.target.value); + setfacturation_data_changed("1"); + + }} + + /> +
+ +
+   +
+
Commentaire
+ { + setp_detail_invoice_comment(e.target.value); + setfacturation_data_changed("1"); + }} + + /> - />}
} - {String(facturation_data_edit_mode) === "1" &&
-
- -
Entreprise ?
- - { - setp_detail_invoice_is_company(e.target.checked); - } - } - inputProps={{ 'aria-label': 'controlled' }} - /> - -
- - - - {!p_detail_invoice_is_company &&
Civilité
- - (data).value === String(p_detail_invoice_civilite))[0].label} - options={New_civilite} - onChange={(event, value) => { - if (value && value.value) { - setp_detail_invoice_civilite(value.value); - } else { - setp_detail_invoice_civilite(""); - } - - setfacturation_data_changed("1"); - }} - renderInput={(params) => - } - /> - - -
} - -
{p_detail_invoice_is_company && " Nom Entreprise"} - {!p_detail_invoice_is_company && " Nom "}
- { - setp_detail_invoice_nom(e.target.value); - setfacturation_data_changed("1"); - - }} - - /> -
- - {!p_detail_invoice_is_company &&
Prénom
- { - setp_detail_invoice_prenom(e.target.value); - setfacturation_data_changed("1"); - - }} - - /> -
} - -
Email
- { - setp_detail_invoice_email(e.target.value); - setfacturation_data_changed("1"); - - }} - - /> -
- -
Téléphone
- { - setp_detail_invoice_telephone(e.target.value); - setfacturation_data_changed("1"); - - }} - - /> -
- -
 
- -
Mode Paiement
- {New_Getall_Partner_Default_Paiement_Mode_result && New_Getall_Partner_Default_Paiement_Mode_result.length > 0 && - - (data)._id === String(p_detail_invoice_mode_paiement))[0].label} - options={New_Getall_Partner_Default_Paiement_Mode_result} - className="disabled_style" - onChange={(event, value) => { - if (value && value._id) { - setp_detail_invoice_mode_paiement(value._id); - setfacturation_data_changed("1"); - } else { - setp_detail_invoice_mode_paiement(""); - setfacturation_data_changed("1"); - } - - }} - - renderInput={(params) => - } - /> - - - } -
- -
Conditions Paiement
- - {New_Getall_Partner_Paiement_Condition_result && New_Getall_Partner_Paiement_Condition_result.length > 0 && - (data)._id === String(p_detail_invoice_condition_paiement))[0].label} - options={New_Getall_Partner_Paiement_Condition_result} - className="disabled_style" - onChange={(event, value) => { - if (value && value._id) { - setp_detail_invoice_condition_paiement(value._id); - setfacturation_data_changed("1"); - } else { - setp_detail_invoice_condition_paiement(""); - setfacturation_data_changed("1"); - } - - }} - - renderInput={(params) => - } - />} - -
- -
Fréquence Facturation
- - {New_Option_Frequence_Facture && New_Option_Frequence_Facture.length > 0 && - (data).id === String(p_detail_invoice_frequence))[0].label} - options={New_Option_Frequence_Facture} - className="disabled_style" - onChange={(event, value) => { - if (value && value.id) { - setp_detail_invoice_frequence(value.id); - setfacturation_data_changed("1"); - } else { - setp_detail_invoice_frequence(""); - setfacturation_data_changed("1"); - } - - }} - - renderInput={(params) => - } - />} - -
- - - -
-
} - -
- -
- -
- -
- Adresse de facturation -
- {String(facturation_data_edit_mode) !== "1" &&
-
-
Adresse
- -
- -
Code Postal
- -
- - -
Ville
- -
- - -
Pays
- -
- -
-   -
-
Commentaire
- - - -
- -
-
} - - {String(facturation_data_edit_mode) === "1" &&
-
- -
Adresse
- { - setp_detail_invoice_adresse(e.target.value); - setfacturation_data_changed("1"); - - }} - - /> -
- -
Code Postal
- { - setp_detail_invoice_code_postal(e.target.value); - setfacturation_data_changed("1"); - - }} - - /> -
- - -
Ville
- { - setp_detail_invoice_ville(e.target.value); - setfacturation_data_changed("1"); - - }} - - /> -
- - -
Pays
- { - setp_detail_invoice_pays(e.target.value); - setfacturation_data_changed("1"); - - }} - - /> -
- -
-   -
-
Commentaire
- { - setp_detail_invoice_comment(e.target.value); - setfacturation_data_changed("1"); - }} - - /> - - -
- - -
-
}
- - -
-
-
-   -
+
+   +
- {String(props.check_user_acces_right("stagiaire", "write")) === "1" && String(facturation_data_changed) === "1" && String(facturation_data_edit_mode) === "1" &&
- /!\ Pensez à enregistrer les modifications -
} -
+ {String(props.check_user_acces_right("stagiaire", "write")) === "1" && String(facturation_data_changed) === "1" && String(facturation_data_edit_mode) === "1" &&
+ /!\ Pensez à enregistrer les modifications +
} +
- {String(props.check_user_acces_right("stagiaire", "write")) === "1" && String(facturation_data_edit_mode) === "1" &&
+ {String(props.check_user_acces_right("stagiaire", "write")) === "1" && String(facturation_data_edit_mode) === "1" &&
- + +
} + + {String(props.check_user_acces_right("stagiaire", "write")) === "1" && String(facturation_data_edit_mode) === "1" &&
+ +
} +
+ + + {String(props.check_user_acces_right("stagiaire", "write")) === "1" && String(facturation_data_edit_mode) !== "1" &&
+ +
} + */} - {String(props.check_user_acces_right("stagiaire", "write")) === "1" && String(facturation_data_edit_mode) === "1" &&
- -
} -
- - - {String(props.check_user_acces_right("stagiaire", "write")) === "1" && String(facturation_data_edit_mode) !== "1" &&
- - - -
}
 
@@ -12008,6 +12124,169 @@ const Apprenant = (props) => {
Liste des factures
+ +
+
+ +
+   + + { + setselectionModel_facture_apprenant(newSelectionModel); + + if (newSelectionModel.length > 1) { + + } + }} + selectionModel={selectionModel_facture_apprenant} + + localeText={frFR.components.MuiDataGrid.defaultProps.localeText} + rows={Get_All_Apprenant_Invoices_result.map((item, index) => ( + { + id: index, + _id: JSON.parse(item)._id, + order_header_ref_interne: JSON.parse(item).order_header_ref_interne, + + invoice_header_ref_interne: JSON.parse(item).invoice_header_ref_interne, + invoice_header_type: JSON.parse(item).invoice_header_type, + order_header_date_expiration: JSON.parse(item).order_header_date_expiration, + invoice_date: JSON.parse(item).invoice_date, + total_header_hors_taxe_after_header_reduction: JSON.parse(item).total_header_hors_taxe_after_header_reduction, + total_header_hors_taxe_before_header_reduction: JSON.parse(item).total_header_hors_taxe_before_header_reduction, + + invoice_date_echeance: JSON.parse(item).invoice_date_echeance, + + order_header_tax_amount: JSON.parse(item).order_header_tax_amount, + total_header_toutes_taxes: JSON.parse(item).total_header_toutes_taxes, + order_header_client_id: JSON.parse(item).order_header_client_id, + order_header_client_nom: JSON.parse(item).order_header_client_nom, + order_header_vendeur_id: JSON.parse(item).order_header_vendeur_id, + order_header_vendeur_nom_prenom: JSON.parse(item).order_header_vendeur_nom_prenom, + order_header_date_cmd: JSON.parse(item).order_header_date_cmd, + + reste_to_paye: JSON.parse(item).reste_to_paye, + credit_note_ref: JSON.parse(item).credit_note_ref, + invoice_header_origin: JSON.parse(item).invoice_header_origin, + + } + ))} + + columns={columns_facture} + pageSize={10} + className="datagridclass" + + onRowDoubleClick={(newSelectionModel) => { + + + + }} + + + + rowsPerPageOptions={[10]} + disableSelectionOnClick + /* components={{ + Toolbar: GridToolbar, + }}*/ + //sx={datagridSx} + getCellClassName={(params) => { + + }} + getRowClassName={(params) => { + + if (parseInt(parseFloat(params.row.reste_to_paye)) <= 0 && String(params.row.invoice_header_type) === "facture") { + + return 'line--statut--payed'; + } + + // Pour la gestion de la couleur de zone double cliquée + if (String(params.row.id) === String(gridline_id)) { + return 'line--statut--selected'; + } + else if (parseInt(String(params.row.id)) % 2 === 0) { + return 'line--statut--pair'; + } + else if (parseInt(String(params.row.id)) % 2 !== 0) { + return 'line--statut--impair'; + } + }} + + + /> + +
+ +
+ + +
+ +
+ + +
diff --git a/src/components/Dashbord_Factures_Devis_Par_Periode.js b/src/components/Dashbord_Factures_Devis_Par_Periode.js index 2584921..75f0ace 100644 --- a/src/components/Dashbord_Factures_Devis_Par_Periode.js +++ b/src/components/Dashbord_Factures_Devis_Par_Periode.js @@ -35,7 +35,7 @@ import { axisClasses } from '@mui/x-charts'; import { pieArcLabelClasses } from '@mui/x-charts/PieChart'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import { PieChart } from '@mui/x-charts/PieChart'; +import { PieChart } from '@mui/x-charts/PieChart'; import fileDownload from 'js-file-download' const pieParams = { height: 200, margin: { right: 5 } }; const palette = ['red', 'blue', 'green']; diff --git a/src/components/DisplayPartnerSession.js b/src/components/DisplayPartnerSession.js index aabd358..84143c0 100644 --- a/src/components/DisplayPartnerSession.js +++ b/src/components/DisplayPartnerSession.js @@ -4,6 +4,7 @@ import MenuItem from '@mui/material/MenuItem'; import 'react-confirm-alert/src/react-confirm-alert.css'; // Import css import Button from '@mui/material/Button'; import axios from "axios"; +import { Pie, ResponsivePie } from "@nivo/pie"; import { getCookie, setCookie } from 'react-use-cookie'; import { useHistory } from "react-router-dom"; import { DataGrid, GridToolbar, frFR } from '@mui/x-data-grid'; @@ -135,6 +136,44 @@ function PaperComponent(props) { ); } +const ProgressBar = ({ bgColor, progress }) => { + const containerStyles = { + height: 30, + + backgroundColor: "#e0e0de", + borderRadius: 10, + margin: 10 + }; + + const fillerStyles = { + height: "100%", + width: `${progress}%`, + backgroundColor: bgColor, + borderRadius: "inherit", + textAlign: "center", + paddingTop: '5px', + }; + + const labelStyles = { + padding: 5, + color: "white", + fontWeight: "bold" + }; + + return ( +
+
+ {progress}% +
+
+ ); +}; + +const appStyles = { + height: 20, + width: 500, + margin: 50 +}; const useStyles = makeStyles((theme) => ({ @@ -1282,6 +1321,7 @@ const DisplayPartnerSession = (props) => { 'Mémo & Comment.', 'Env. Code LMS', 'Fin Accès LMS', + 'Suivi LMS', 'Annuler Insc.', ]; @@ -1540,6 +1580,12 @@ const DisplayPartnerSession = (props) => { setDialog_MAJ_Acces_LMS_open(true); } + else if (option && String(option) === "Suivi LMS") { + if (working_cellValues.row._id && String(working_cellValues.row._id).length > 5) { + Get_LMS_Process_And_Connexion(working_cellValues.row._id) + setDialog_Suivi_LMS_open(true); + } + } }} > @@ -15762,6 +15808,130 @@ const DisplayPartnerSession = (props) => { const [p_detail_inscription_comment, setp_detail_inscription_comment] = useState(""); const [p_detail_inscription_memo, setp_detail_inscription_memo] = useState(""); + const [Dialog_Suivi_LMS_open, setDialog_Suivi_LMS_open] = useState(false); + + const Close_Dialog_Suivi_LMS_open = () => { + // clean_order_detail_fields(); + setDialog_Suivi_LMS_open(false); + }; + + + + const [user_lms_suivi_progess, setuser_lms_suivi_progess] = useState(""); + + const [user_lms_suivi_connexion, setuser_lms_suivi_connexion] = useState(""); + const [Newuser_lms_suivi_connexion, setNewuser_lms_suivi_connexion] = useState([]); + + + const [NewGet_LMS_Process_And_Connexion_result, setNewGet_LMS_Process_And_Connexion_result] = useState([]); + + const [Get_LMS_Process_And_Connexion_api, setGet_LMS_Process_And_Connexion_api] = useState(); + const [Get_LMS_Process_And_Connexion_message, setGet_LMS_Process_And_Connexion_message] = useState(); + const [Get_LMS_Process_And_Connexion_result, setGet_LMS_Process_And_Connexion_result] = useState([]); + function Get_LMS_Process_And_Connexion(local_inscrit_id) { + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("tab_inscription_id", local_inscrit_id); + + //console.log(" ### Get_LMS_Process_And_Connexion form = ", form) + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_LMS_Connexion_List_And_Progress_Inscrit/"; + + //var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_LMS_Connexion_List_And_Progress_Inscrit_localhost/"; + + + setLoading(true); + axios.post(myurl, form).then(res => { + + setLoading(false); + if (String(res.data.status) === String("true")) { + setLoading(false); + //console.log(" In Get_LMS_Process_And_Connexion res.data.status = " + res.data.status); + //console.log(" In Get_LMS_Process_And_Connexion res.data.message r_class = " + res.data.message); + setGet_LMS_Process_And_Connexion_api("true"); + setGet_LMS_Process_And_Connexion_result(res.data.message); + + var local_json = JSON.parse(res.data.message); + + + + setuser_lms_suivi_connexion(local_json.tab_connexion); + setuser_lms_suivi_progess(local_json.tab_process); + + var new_data2 = []; + const new_data = local_json.tab_connexion.map((x) => { + + //--- + var date_connexion = (x).date_connexion; + var ip_connexion = (x).ip_connexion; + var nom = (x).nom; + var prenom = (x).prenom; + var inscription_id = (x).inscription_id; + + + + //--- + var node = { + "date_connexion": date_connexion, + "ip_connexion": ip_connexion, + "nom": nom, + "prenom": prenom, + "inscription_id": inscription_id, + }; + new_data2.push(node); + + + + // return {"_id": " + str(local_id) + ", "label": " + local_courrier_template_ref_interne + '" , "courrier_template_ref_interne": "' + local_courrier_template_ref_interne + '", "nom_champ_technique": "' + local_nom_champ_technique + '", "nom_champ_fonctionel": "' + local_nom_champ_fonctionel + '","valide": "1" }; + + }); + + + if (new_data2.length > 0) + setNewuser_lms_suivi_connexion(new_data2); + + + } + else { + setLoading(false); + setGet_LMS_Process_And_Connexion_api("false"); + setGet_LMS_Process_And_Connexion_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + setLoading(false); + + console.warn('Not good man :( Get_LMS_Process_And_Connexion = ', error); + setGet_LMS_Process_And_Connexion_api("false"); + setdisplay_alert_mysy("1"); + setalert_message(" Impossible de recuperer le suivi LMS"); + setalert_type("error"); + + }) + } + + + const data = [ + + { + id: "vu", + label: "vu", + value: 5, + color: "hsl(186, 70%, 50%)" + }, + { + id: "non_vu", + label: "non_vu", + value: 2, + color: "hsl(104, 70%, 50%)" + } + ]; return (
@@ -15782,6 +15952,148 @@ const DisplayPartnerSession = (props) => { {/*** FIN Affichage des messages d'alerte*/} + + {/********** Dialog pour recherche Apprenant puis facture */} + null} + + PaperProps={{ + + + className: classes.paper, // Apply the paper style + style: { + overflowY: 'unset', + position: 'absolute', + top: '10rem', + margin: "2px", + maxWidth: 'unset', + width: '50rem' + }, + }} + hideBackdrop={true} + disableScrollLock + classes={{ + paper: classes.dialog + }} + + PaperComponent={PaperComponent} + aria-labelledby="draggable-dialog-title" + > + + {user_lms_suivi_progess && user_lms_suivi_progess.length > 0 && Suivi LMS de {user_lms_suivi_progess[0].prenom} {user_lms_suivi_progess[0].nom} } + + + + {user_lms_suivi_progess &&
+ +
+ +
+
+ +
+ Progression +
+ + + {parseFloat(String(user_lms_suivi_progess[0].pourcentage_progress)/100).toFixed(2) < 0.6 && } + + {parseFloat(String(user_lms_suivi_progess[0].pourcentage_progress)/100).toFixed(2) >= 0.6 && parseFloat(String(user_lms_suivi_progess[0].pourcentage_progress)/100).toFixed(2) <= 0.9 && } + + + {parseFloat(String(user_lms_suivi_progess[0].pourcentage_progress)/100).toFixed(2) > 0.9 && } + + + +
+
+ + + +
+ + +
} +
 
+ {Newuser_lms_suivi_connexion && Newuser_lms_suivi_connexion.length > 0 &&
+
+ +
+
+ +
+ {Newuser_lms_suivi_connexion.length} Connexions +
+ +
+ {Newuser_lms_suivi_connexion.map((connexion) => ( +
    Le {String(connexion.date_connexion).substring(0, 16)} == > IP. {connexion.ip_connexion}
+ ))} + +
+
+
+ + + +
+
} + + {Newuser_lms_suivi_connexion && Newuser_lms_suivi_connexion.length <= 0 &&
+
+ +
+
+ +
+ Aucune Connexion +
+ +
+ ----------------- + +
+
+
+ + + +
+
} + + +
+ + + + + + + + + +
+ + {/********** FIN Dialog pour recherche Apprenant puis facture */} + + + + {/* Dialog pour gerer les Memo_Comment */} { fontWeight: '700' }, - - '& .line--statut--selected': { backgroundColor: '#e9f7f1', color: '#0a2a4d', @@ -25782,7 +26092,7 @@ const DisplayPartnerSession = (props) => { {String(addOneParticipant) === "1" &&
Ajout d'un nouveau participant à la session {selected_code_session} de la formation {selected_class_title}
-
Civilité aa
+
Civilité
{New_civilite.length > 0 && { {New_Get_List_Partner_Clients_result && New_Get_List_Partner_Clients_result.length > 0 && - String(participant_data_edit_mode) === "1" &&
A Facturer 2
+ String(participant_data_edit_mode) === "1" &&
A Facturer
{ ))} - - - - -
diff --git a/src/components/Partner_Client.js b/src/components/Partner_Client.js index 9ba9adf..c9e44d1 100644 --- a/src/components/Partner_Client.js +++ b/src/components/Partner_Client.js @@ -273,9 +273,18 @@ const Partner_Client = (props) => { const [Edite_Client, setEdite_Client] = useState(""); const [Client_email, setClient_email] = useState(""); + + const [Client_nom, setClient_nom] = useState(""); + + + function handleClick_modifier(event, cellValues) { var clientmail = String(cellValues.row.email); setClient_email(clientmail); + + setClient_nom(cellValues.row.nom); + + setEdite_Client("1"); window.scrollTo({ top: 600, @@ -700,6 +709,8 @@ const Partner_Client = (props) => { setselected_id(client_id); setClient_email(clientmail); + setClient_nom(line.nom); + setEdite_Client("1"); window.scrollTo({ @@ -1647,9 +1658,10 @@ const Partner_Client = (props) => { {String(Edite_Client) === "1" &&
-
Detail client / Financeur {Client_email}
+
Détail client / Financeur {Client_nom} - {Client_email}
{
Nouveau client / financeur
 
{ if (String(res.data.status) === "true") { //console.log(" In Get_Given_Line_Of_Partner_Invoice_Line_Data res.data.status = " + res.data.status); - // console.log(" In Get_Given_Line_Of_Partner_Invoice_Line_Data res.data.message r_class = " + res.data.message); + console.log(" In Get_Given_Line_Of_Partner_Invoice_Line_Data res.data.message r_class = " + res.data.message); setGet_Given_Line_Of_Partner_Invoice_Line_Data_api("true"); setGet_Given_Line_Of_Partner_Invoice_Line_Data_result(res.data.message); @@ -1051,12 +1061,10 @@ const Partner_Facture = (props) => { } - ; - } else { - setdisplay_alert_mysy("1"); - setalert_message(" Aucune ligne de facture recuperée"); - setalert_type("error"); + //setdisplay_alert_mysy("1"); + //setalert_message(" Aucune ligne de facture recuperée"); + //setalert_type("error"); } @@ -3061,6 +3069,83 @@ const Partner_Facture = (props) => { }) } + const [Create_Inscrit_Invoice_api, setCreate_Inscrit_Invoice_api] = useState(); + const [Create_Inscrit_Invoice_message, setCreate_Inscrit_Invoice_message] = useState(); + const [Create_Inscrit_Invoice_result, setCreate_Inscrit_Invoice_result] = useState(); + function Create_Inscrit_Invoice() { + var form = new FormData(); + //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("inscription_id", invoice_inscrit_selected_inscrit_id); + form.append("invoice_amount", invoice_inscrit_selected_montant_a_facture); + form.append("session_id", invoice_inscrit_selected_session_id); + form.append("invoice_date", ""); + + + + //console.log(" form == ", form); + + var myurl = myurl = process.env.REACT_APP_API_URL + "myclass/api/Create_Inscrit_Invoice/"; + + setLoading(true); + + axios.post(myurl, form).then(res => { + setLoading(false); + //console.log(" In Create_Inscrit_Invoice res.data.status = " + res.data.status); + //console.log(" In Create_Inscrit_Invoice res.data.message r_class = " + res.data.message); + + if (String(res.data.status) === String("true")) { + + setCreate_Inscrit_Invoice_api("true"); + setCreate_Inscrit_Invoice_result(res.data.message); + + Close_Dialog_Rech_Apprenant_Et_Facture_open(); + + Get_List_Partner_Clients(); + Getall_Parter_Invoice_No_Filter(); + + + // alert(res.data.message) + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("success"); + + if (document.getElementById('myRef_head')) { + var divh = document.getElementById('myRef_head').offsetTop; + window.scrollTo({ + top: divh, + behavior: "smooth", + }); + } + + + } + else { + setCreate_Inscrit_Invoice_api("false"); + setCreate_Inscrit_Invoice_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + setLoading(false); + console.warn('UpdateStagiaireData : Not good man :( Create_Inscrit_Invoice = ' + error); + setCreate_Inscrit_Invoice_api("false"); + // alert(" Impossible d'ajouter ou mettre à jour le paiement "); + setdisplay_alert_mysy("1"); + setalert_message(" Impossible de créer la facture "); + setalert_type("error"); + + }) + } + + + const [Dialog_annotation_1_message, setDialog_annotation_1_message] = React.useState(false); const [Dialog_annotation_1_open, setDialog_annotation_1_open] = React.useState(false); @@ -4799,19 +4884,44 @@ const Partner_Facture = (props) => { const Close_Dialog_Rech_Apprenant_Et_Facture_open = () => { // clean_order_detail_fields(); setDialog_Rech_Apprenant_Et_Facture_open(false); + + clear_apprenant_invoice_fields(); }; + function clear_apprenant_invoice_fields() { + setinvoice_inscrit_selected_montant_a_facture("0"); + setinvoice_inscrit_selected_session_id(""); + setinvoice_inscrit_selected_inscrit_id(""); + setinvoice_inscrit_selected_reste_a_facture(""); + setinvoice_inscrit_selected_frais_inscription(""); + + setinvoice_inscrit_selected_total_facture(""); + setNewGetall_TrainingParticipant_List_Invoices_result([]) + setNewGetall_TrainingParticipant_Reduce_Fields_With_Remaining_Paiment_result([{ + "_id": "", + "id": "", + "label": "", + "email": "", + "nom": "", + "prenom": "", + "apprenant_id": "", + }]); + setNewGetall_TrainingParticipant_List_Invoices_result([]); + + } const [invoice_inscrit_selected_session_id, setinvoice_inscrit_selected_session_id] = useState(""); const [invoice_inscrit_selected_inscrit_id, setinvoice_inscrit_selected_inscrit_id] = useState(""); const [invoice_inscrit_selected_total_facture, setinvoice_inscrit_selected_total_facture] = useState(""); + const [invoice_inscrit_selected_montant_a_facture, setinvoice_inscrit_selected_montant_a_facture] = useState(""); + const [invoice_inscrit_selected_reste_a_facture, setinvoice_inscrit_selected_reste_a_facture] = useState(""); const [invoice_inscrit_selected_frais_inscription, setinvoice_inscrit_selected_frais_inscription] = useState(""); - const [NewGetall_TrainingParticipant_Reduce_Fields_result, setNewGetall_TrainingParticipant_Reduce_Fields_result] = useState([{ + const [NewGetall_TrainingParticipant_Reduce_Fields_With_Remaining_Paiment_result, setNewGetall_TrainingParticipant_Reduce_Fields_With_Remaining_Paiment_result] = useState([{ "_id": "", "id": "", "label": "", @@ -4821,10 +4931,11 @@ const Partner_Facture = (props) => { "apprenant_id": "", }]); - const [Getall_TrainingParticipant_Reduce_Fields_api, setGetall_TrainingParticipant_Reduce_Fields_api] = useState(); - const [Getall_TrainingParticipant_Reduce_Fields_message, setGetall_TrainingParticipant_Reduce_Fields_message] = useState(); - const [Getall_TrainingParticipant_Reduce_Fields_result, setGetall_TrainingParticipant_Reduce_Fields_result] = useState([]); - function Getall_TrainingParticipant_Reduce_Fields(local_session_id) { + // Important, ici on ne va recuperer que la liste des inscrit a une session / promo pour qui il reste de choses a facturer + const [Getall_TrainingParticipant_Reduce_Fields_With_Remaining_Paiment_api, setGetall_TrainingParticipant_Reduce_Fields_With_Remaining_Paiment_api] = useState(); + const [Getall_TrainingParticipant_Reduce_Fields_With_Remaining_Paiment_message, setGetall_TrainingParticipant_Reduce_Fields_With_Remaining_Paiment_message] = useState(); + const [Getall_TrainingParticipant_Reduce_Fields_With_Remaining_Paiment_result, setGetall_TrainingParticipant_Reduce_Fields_With_Remaining_Paiment_result] = useState([]); + function Getall_TrainingParticipant_Reduce_Fields_With_Remaining_Paiment(local_session_id) { var form = new FormData(); @@ -4832,8 +4943,8 @@ const Partner_Facture = (props) => { form.append("token", stored_cookie); form.append("session_id", local_session_id); - //console.log(" ### Getall_TrainingParticipant_Reduce_Fields form = ", form) - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Insription_From_Session_id_Reduice_Fields_With_Filter/"; + //console.log(" ### Getall_TrainingParticipant_Reduce_Fields_With_Remaining_Paiment form = ", form) + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Insription_From_Session_id_Reduice_Fields_With_Filter_With_To_Paie/"; setLoading(true); @@ -4842,10 +4953,10 @@ const Partner_Facture = (props) => { setLoading(false); if (String(res.data.status) === String("true")) { setLoading(false); - //console.log(" In Getall_TrainingParticipant_Reduce_Fields res.data.status = " + res.data.status); - //console.log(" In Getall_TrainingParticipant_Reduce_Fields res.data.message r_class = " + res.data.message); - setGetall_TrainingParticipant_Reduce_Fields_api("true"); - setGetall_TrainingParticipant_Reduce_Fields_result(res.data.message); + //console.log(" In Getall_TrainingParticipant_Reduce_Fields_With_Remaining_Paiment res.data.status = " + res.data.status); + //console.log(" In Getall_TrainingParticipant_Reduce_Fields_With_Remaining_Paiment res.data.message r_class = " + res.data.message); + setGetall_TrainingParticipant_Reduce_Fields_With_Remaining_Paiment_api("true"); + setGetall_TrainingParticipant_Reduce_Fields_With_Remaining_Paiment_result(res.data.message); var new_data2 = []; const new_data = res.data.message.map((x) => { @@ -4887,14 +4998,14 @@ const Partner_Facture = (props) => { new_data2.push(node); if (new_data2.length > 0) - setNewGetall_TrainingParticipant_Reduce_Fields_result(new_data2); + setNewGetall_TrainingParticipant_Reduce_Fields_With_Remaining_Paiment_result(new_data2); } else { setLoading(false); - setGetall_TrainingParticipant_Reduce_Fields_api("false"); - setGetall_TrainingParticipant_Reduce_Fields_message(res.data.message); + setGetall_TrainingParticipant_Reduce_Fields_With_Remaining_Paiment_api("false"); + setGetall_TrainingParticipant_Reduce_Fields_With_Remaining_Paiment_message(res.data.message); // alert(res.data.message); setdisplay_alert_mysy("1"); setalert_message(res.data.message); @@ -4904,8 +5015,8 @@ const Partner_Facture = (props) => { }).catch((error) => { setLoading(false); - console.warn('Not good man :( Getall_TrainingParticipant_Reduce_Fields = ', error); - setGetall_TrainingParticipant_Reduce_Fields_api("false"); + console.warn('Not good man :( Getall_TrainingParticipant_Reduce_Fields_With_Remaining_Paiment = ', error); + setGetall_TrainingParticipant_Reduce_Fields_With_Remaining_Paiment_api("false"); setdisplay_alert_mysy("1"); setalert_message(" Impossible de recuperer la liste des inscrits"); setalert_type("error"); @@ -4915,6 +5026,59 @@ const Partner_Facture = (props) => { + const [Nb_Invoiced_Inscrit_Of_Session, setNb_Invoiced_Inscrit_Of_Session] = useState(""); + + const [Get_Nb_Invoiced_Inscrit_Of_Session_api, setGet_Nb_Invoiced_Inscrit_Of_Session_api] = useState(); + const [Get_Nb_Invoiced_Inscrit_Of_Session_message, setGet_Nb_Invoiced_Inscrit_Of_Session_message] = useState(); + const [Get_Nb_Invoiced_Inscrit_Of_Session_result, setGet_Nb_Invoiced_Inscrit_Of_Session_result] = useState([]); + function Get_Nb_Invoiced_Inscrit_Of_Session(local_session_id) { + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("session_id", local_session_id); + + //console.log(" ### Get_Nb_Invoiced_Inscrit_Of_Session form = ", form) + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Nb_Insription_From_Session_Full_Invoiced/"; + + + setLoading(true); + axios.post(myurl, form).then(res => { + + setLoading(false); + if (String(res.data.status) === String("true")) { + setLoading(false); + //console.log(" In Get_Nb_Invoiced_Inscrit_Of_Session res.data.status = " + res.data.status); + // console.log(" In Get_Nb_Invoiced_Inscrit_Of_Session res.data.message r_class = " + res.data.message); + setGet_Nb_Invoiced_Inscrit_Of_Session_api("true"); + setGet_Nb_Invoiced_Inscrit_Of_Session_result(res.data.message); + + setNb_Invoiced_Inscrit_Of_Session(res.data.message); + + } + else { + setLoading(false); + setGet_Nb_Invoiced_Inscrit_Of_Session_api("false"); + setGet_Nb_Invoiced_Inscrit_Of_Session_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + setLoading(false); + + console.warn('Not good man :( Get_Nb_Invoiced_Inscrit_Of_Session = ', error); + setGet_Nb_Invoiced_Inscrit_Of_Session_api("false"); + setdisplay_alert_mysy("1"); + setalert_message(" Impossible de recuperer le nombre d'inscrits completement facturé"); + setalert_type("error"); + + }) + } + const [NewGetall_TrainingParticipant_List_Invoices_result, setNewGetall_TrainingParticipant_List_Invoices_result] = useState([]); const [Getall_TrainingParticipant_List_Invoices_api, setGetall_TrainingParticipant_List_Invoices_api] = useState(); @@ -4978,6 +5142,8 @@ const Partner_Facture = (props) => { if (new_data2.length > 0) setNewGetall_TrainingParticipant_List_Invoices_result(new_data2); + else + setNewGetall_TrainingParticipant_List_Invoices_result([]); } @@ -5074,10 +5240,13 @@ const Partner_Facture = (props) => { if (value && value._id) { setinvoice_inscrit_selected_session_id(value._id); - Getall_TrainingParticipant_Reduce_Fields(value._id); + Getall_TrainingParticipant_Reduce_Fields_With_Remaining_Paiment(value._id); + Get_Nb_Invoiced_Inscrit_Of_Session(value._id); + } else { setinvoice_inscrit_selected_session_id(""); - setGetall_TrainingParticipant_Reduce_Fields_result([[{ + setNb_Invoiced_Inscrit_Of_Session("") + setGetall_TrainingParticipant_Reduce_Fields_With_Remaining_Paiment_result([[{ "_id": "", "id": "", "label": "", @@ -5085,7 +5254,9 @@ const Partner_Facture = (props) => { "nom": "", "prenom": "", "apprenant_id": "", - }]]) + }]]); + + } @@ -5099,30 +5270,38 @@ const Partner_Facture = (props) => { />
-
Inscrit
- {NewGetall_TrainingParticipant_Reduce_Fields_result && NewGetall_TrainingParticipant_Reduce_Fields_result.length > 0 && + + + Inscrit  + +
+ {NewGetall_TrainingParticipant_Reduce_Fields_With_Remaining_Paiment_result && NewGetall_TrainingParticipant_Reduce_Fields_With_Remaining_Paiment_result.length > 0 && (data)._id === String(invoice_inscrit_selected_inscrit_id))[0].label} + value={NewGetall_TrainingParticipant_Reduce_Fields_With_Remaining_Paiment_result.filter((data) => (data)._id === String(invoice_inscrit_selected_inscrit_id))[0].label} onChange={(event, value) => { if (value && value._id) { setinvoice_inscrit_selected_inscrit_id(value._id); - Getall_TrainingParticipant_List_Invoices(value._id) + Getall_TrainingParticipant_List_Invoices(value._id); + } else { setinvoice_inscrit_selected_inscrit_id(""); setNewGetall_TrainingParticipant_List_Invoices_result([]); - setGetall_TrainingParticipant_List_Invoices_result([]); + setGetall_TrainingParticipant_List_Invoices_result([]); + setNb_Invoiced_Inscrit_Of_Session("") + + } - }} renderInput={(params) => } @@ -5131,6 +5310,11 @@ const Partner_Facture = (props) => {
+ {Nb_Invoiced_Inscrit_Of_Session && Nb_Invoiced_Inscrit_Of_Session.length > 0 && + JSON.parse(Nb_Invoiced_Inscrit_Of_Session).nb_fully_invoiced_inscrit > 0 &&
+ Insciptions complétement Facturées : {JSON.parse(Nb_Invoiced_Inscrit_Of_Session).nb_fully_invoiced_inscrit} sur / {JSON.parse(Nb_Invoiced_Inscrit_Of_Session).session_nb_inscrit} +
} + {NewGetall_TrainingParticipant_List_Invoices_result && NewGetall_TrainingParticipant_List_Invoices_result.length > 0 &&
@@ -5142,16 +5326,36 @@ const Partner_Facture = (props) => { Liste des factures - {invoice_inscrit_selected_total_facture} €
-
- {NewGetall_TrainingParticipant_List_Invoices_result.map((invoice) => ( -
    Le {invoice.invoice_date}, ref. {invoice.invoice_header_ref_interne}, - montant : {invoice.order_line_montant_hors_taxes} €
- ))} -
+ + + + {NewGetall_TrainingParticipant_List_Invoices_result && + NewGetall_TrainingParticipant_List_Invoices_result.map((invoice) => ( + + + + {invoice.invoice_date} + + + + + + {invoice.invoice_header_ref_interne} : {invoice.order_line_montant_hors_taxes} € + + + ))} + + + + +
@@ -5162,7 +5366,7 @@ const Partner_Facture = (props) => {
 
{invoice_inscrit_selected_inscrit_id && invoice_inscrit_selected_inscrit_id.length > 5 &&
-
Saisir le montant à facturer ( reste à facturer = {invoice_inscrit_selected_reste_a_facture} € )
+
Saisir le montant à facturer ( reste à facturer = {invoice_inscrit_selected_reste_a_facture} € )
{ fullWidth //value={p_detail_fin_data_montant} onChange={(e) => { - - }} + setinvoice_inscrit_selected_montant_a_facture(e.target.value); + } + } />
@@ -5201,7 +5406,7 @@ const Partner_Facture = (props) => {
- +
@@ -8082,6 +8287,7 @@ const Partner_Facture = (props) => {