From c79a114eebad46e91da81c195ec7389665607b19 Mon Sep 17 00:00:00 2001 From: Cherif Date: Sun, 10 May 2026 20:17:24 +0200 Subject: [PATCH] sddsf --- src/components/AddPartnerClient.js | 2205 +++++- src/components/AddPartnerClient_ARG_100526.js | 6697 +++++++++++++++++ src/components/Partner_ARG_140326.js | 4161 ---------- src/components/Partner_Client.js | 4 +- 4 files changed, 8887 insertions(+), 4180 deletions(-) create mode 100644 src/components/AddPartnerClient_ARG_100526.js delete mode 100644 src/components/Partner_ARG_140326.js diff --git a/src/components/AddPartnerClient.js b/src/components/AddPartnerClient.js index 2c0c3a6..02a000d 100644 --- a/src/components/AddPartnerClient.js +++ b/src/components/AddPartnerClient.js @@ -71,6 +71,29 @@ import { } from '@mui/x-data-grid'; import Module_Alert_Confirmation from "./Module_Alert_Confirmation"; import Module_Relance_Client_Facture from "./Module_Relance_Client_Facture"; +import { + Home, + Users, + FileText, + CreditCard, + GraduationCap, + BarChart3, + Settings, + Mail, + Phone, + MapPin, + User, + Pencil, + MoreVertical, + ReceiptText, + Euro, + Wallet, + Building2, + CalendarDays, + Plus, + Download, + Eye, +} from "lucide-react"; function PaperComponent(props) { return ( @@ -2617,13 +2640,13 @@ const AddParnerClient = (props) => { document.getElementsByName("client_invoice_code_postal")[0].style.backgroundColor = "#ECEFF1"; } - if (document.getElementsByName("client_invoice_pays")) { + if (document.getElementsByName("client_invoice_pays") && document.getElementsByName("client_invoice_pays")[0]) { document.getElementsByName("client_invoice_pays")[0].disabled = true; document.getElementsByName("client_invoice_pays")[0].style.backgroundColor = "#ECEFF1"; //console.log("iiiiii"); } - if (document.getElementsByName("facturation_automatique")) { + if (document.getElementsByName("facturation_automatique") && document.getElementsByName("facturation_automatique")[0]) { document.getElementsByName("facturation_automatique")[0].disabled = true; document.getElementsByName("facturation_automatique")[0].style.backgroundColor = "#ECEFF1"; @@ -2683,7 +2706,7 @@ const AddParnerClient = (props) => { document.getElementsByName("client_invoice_pays")[0].style.backgroundColor = "#FFFFFF"; } - if (document.getElementsByName("facturation_automatique")) { + if (document.getElementsByName("facturation_automatique") && document.getElementsByName("facturation_automatique")[0]) { document.getElementsByName("facturation_automatique")[0].disabled = false; document.getElementsByName("facturation_automatique")[0].style.backgroundColor = "#FFFFFF"; } @@ -4039,6 +4062,117 @@ const AddParnerClient = (props) => { } + function SidebarItem({ icon, label, active }) { + return ( + + ); + } + + function MetaItem({ icon, label, value }) { + return ( +
+
{icon}
+
+ {label} + {value} +
+
+ ); + } + + function KpiCard({ icon, label, value, detail, evolution, color }) { + return ( +
+
{icon}
+
+ {label} + {value} +

+ {detail} + {evolution && {evolution}} +

+
+
+ ); + } + + function InfoBlock({ label, value }) { + return ( +
+ {label} + {value} +
+ ); + } + + function BalanceLine({ color, label, value }) { + return ( +
+ + + {label} + + {value} +
+ ); + } + + const invoices = [ + { + ref: "FAC-2024-845", + date: "06/05/2024", + echeance: "05/06/2024", + montant: "4 200,00 €", + statut: "Payée", + type: "success", + }, + { + ref: "FAC-2024-744", + date: "18/04/2024", + echeance: "18/05/2024", + montant: "2 850,00 €", + statut: "En attente", + type: "warning", + }, + { + ref: "FAC-2024-632", + date: "18/03/2024", + echeance: "17/04/2024", + montant: "2 600,00 €", + statut: "Payée", + type: "success", + }, + ]; + + const activities = [ + { + icon: , + title: "Relance facture envoyée", + text: "Facture n°FAC-2024-744, échéance 18/05/2024", + date: "16/05/2024", + time: "10:34", + color: "blue", + }, + { + icon: , + title: "Appel effectué", + text: "Échange avec Julien Lefèvre sur le suivi des formations à venir.", + date: "12/05/2024", + time: "14:20", + color: "green", + }, + { + icon: , + title: "Session inscrite", + text: "Inscription à la session Management d’équipe à Lyon.", + date: "30/04/2024", + time: "09:32", + color: "purple", + }, + ]; return (
@@ -4815,8 +4949,8 @@ const AddParnerClient = (props) => {
} - {String(props.new_customer) !== "1" &&
-
+ {String(props.new_customer) !== "1" &&
+
- {String(submenu).trim() === "submenu_donnee_client" &&
+ {String(submenu).trim() === "submenu_donnee_client ee" &&
{p_detail_archive && String(p_detail_archive) === "1" &&
Document Archivé
} @@ -5479,7 +5613,7 @@ const AddParnerClient = (props) => {
} - {String(submenu).trim() === "submenu_donnees_facturation" &&
+ {String(submenu).trim() === "submenu_donnees_facturation ee" &&
@@ -5814,7 +5948,7 @@ const AddParnerClient = (props) => {
} - {String(submenu).trim() === "submenu_contact" &&
+ {String(submenu).trim() === "submenu_contact ee" &&
{String(addcontact) !== "1" &&
{String(props.check_user_acces_right("client", "write")) === "1" &&
Ajouter un contact
} @@ -6249,13 +6383,13 @@ const AddParnerClient = (props) => {
} - {String(submenu).trim() === "submenu_activite" &&
+ {String(submenu).trim() === "submenu_activite ee" &&
} - {String(submenu).trim() === "submenu_piece_jointe" &&
+ {String(submenu).trim() === "submenu_piece_jointe ee" &&
@@ -6523,17 +6657,1228 @@ const AddParnerClient = (props) => { client_id={props.client_id} />
} -
-   Fermer -
+
} +   +
+
+
+
JM
+ +
+
+
+

JMJ Formation

+
+ Entreprise + Compte prioritaire + {p_detail_archive && String(p_detail_archive) === "1" && Archivé} +
+
+
+ +
+ } label="SIRET" value={p_client_siret} /> + } label="Email" value={p_client_email} /> + } label="Téléphone" value={p_client_telephone} /> + } label="Ville" value={p_client_ville} /> + } label="Commercial référent" value="Julien Lefèvre" /> +
+
+
+
+
+ {String(submenu).trim() === "submenu_donnee_client" &&
+
+ +
+
+ +
+ Informations générales +
+ +
+ + + +
Raison sociale
+ setclient_raison_sociale(e.target.value)} + /> +
+ +
Nom
+ setclient_nom(e.target.value)} + + /> +
+ + +
N° Siret
+ setclient_siret(e.target.value)} + /> +
+ +
N° TVA
+ setclient_tva(e.target.value)} + /> +
+ + + + +
+
+
+ +
 
+ +
+
+ +
+ Coordonnées +
+ +
+ +
+ Email
+ setclient_email(e.target.value)} + + /> +
+ +
Téléphone
+ setclient_telephone(e.target.value)} + /> +
+ +
Site web
+ setclient_website(e.target.value)} + /> +
+ + +
Adresse
+ setclient_adresse(e.target.value)} + /> +
+
ville
+ setclient_ville(e.target.value)} + /> +
+
Code Postal
+ setclient_code_postal(e.target.value)} + /> +
+
Pays
+ setclient_pays(e.target.value)} + /> +
+ +
 
+
Commentaire
+ { + setp_client_comment(e.target.value); + + }} + /> +
+ + + +
+
+
+ +
+ +
+   +
+ + {String(props.check_user_acces_right("client", "write")) === "1" && String(datamodification) === "1" &&
+
/!\ Pensez à enregistrer les modifications
} + + + {String(props.check_user_acces_right("client", "write")) === "1" && String(formedit_mode) === "1" &&
+
+ +
+
+ +
+
+ } + + + {String(formedit_mode) !== "1" &&
+ +
+ +
+ + {String(props.check_user_acces_right("client", "write")) === "1" &&
+ +
} +
+ } +
} + + {String(submenu).trim() === "submenu_donnees_facturation" &&
+ +
+
+ + + Client facturé   + +
+ + {String(formedit_mode_invoice) !== "1" && New_Get_List_Partner_Clients_except_current_result && New_Get_List_Partner_Clients_except_current_result.length > 0 && + (data)._id === String(p_detail_client_facturation_id))[0].label} + + />} + + {String(formedit_mode_invoice) === "1" && New_Get_List_Partner_Clients_except_current_result && New_Get_List_Partner_Clients_except_current_result.length > 0 && + (data)._id === String(p_detail_client_facturation_id))[0].label} + options={New_Get_List_Partner_Clients_except_current_result} + onChange={(event, value) => { + if (value && value._id) { + setp_detail_client_facturation_id(value._id); + setclient_invoice_nom(value.invoice_nom); + setclient_invoice_email(value.invoice_email); + setclient_invoice_adresse(value.invoice_adresse); + setclient_invoice_ville(value.invoice_ville); + setclient_invoice_code_postal(value.invoice_code_postal); + setclient_invoice_pays(value.invoice_pays); + + + DataUpdated_Invoice_Data(); + } else { + setp_detail_client_facturation_id(""); + + setp_detail_client_facturation_id(""); + setclient_invoice_nom(""); + setclient_invoice_email(""); + setclient_invoice_adresse(""); + setclient_invoice_ville(""); + setclient_invoice_code_postal(""); + setclient_invoice_pays(""); + + DataUpdated_Invoice_Data(); + } + }} + renderInput={(params) => + } + />} +
+ +
+
+
+ +
+
+
+
+ +
+ Contact de facturation +
+ +
+ + +
Nom de Facturation
+ setclient_invoice_nom(e.target.value)} + /> +
+ +
Email de Facturation
+ setclient_invoice_email(e.target.value)} + /> +
+ +
N° Siret Facturation
+ setclient_invoice_siret(e.target.value)} + /> +
+ +
N° TVA Facturation
+ setclient_invoice_tva(e.target.value)} + /> +
+ +
Conditions Paiement
+ + {New_Getall_Partner_Paiement_Condition_result && New_Getall_Partner_Paiement_Condition_result.length > 0 && + (data).label === String(p_client_invoice_paiement_condition_code))[0].label} + options={New_Getall_Partner_Paiement_Condition_result} + className="disabled_style" + + onChange={(event, value) => { + if (value && value._id) { + setp_client_invoice_paiement_condition_code(value.code); + setp_client_invoice_paiement_condition_id(value._id); + DataUpdated_Invoice_Data(); + } + + }} + + renderInput={(params) => + } + />} +
+ + +
+
+
+
+   +
+ +
+
+ +
+ Adresse de facturation +
+ +
+ +
Adresse
+ setclient_invoice_adresse(e.target.value)} + /> +
+ + +
Ville
+ setclient_invoice_ville(e.target.value)} + /> +
+
Code Postal
+ setclient_invoice_code_postal(e.target.value)} + /> +
+
Pays
+ { + setclient_invoice_pays(e.target.value); + DataUpdated_Invoice_Data(); + }} + /> +
+ +
+
+
+
+
+ +
+
+   +
+ + {String(datamodification_invoice) === "1" &&
+
/!\ Pensez à enregistrer les modifications
} + {String(formedit_mode_invoice) === "1" &&
+
+ +
+
+ +
+
+ } + {String(props.check_user_acces_right("client", "write")) === "1" && String(formedit_mode_invoice) !== "1" &&
+ +
+ +
+
+ } +
} + + {String(submenu).trim() === "submenu_contact" &&
+ +
+ + {String(addcontact) !== "1" &&
+ {String(props.check_user_acces_right("client", "write")) === "1" &&
Ajouter un contact
} +
+
+ + {Get_List_Contact_Of_client_Part_result && String(Get_List_Contact_Of_client_Part_api) === "true" && + Get_List_Contact_Of_client_Part_result.map((client) => ( + +
+ {(JSON.parse(client).nom || JSON.parse(client).prenom) && + + + + } + modal + nested + position="center center" + > + {close => ( +
+ +
MySy Information
+
+ {' '} + + En confirmant cette opération, le contact sera définitivement supprimé.
+ + +
+
+
+ + +
+
+ +
+
+
+ )} + } + + + + + + } + +
+
+
+ + +
+ + + ))} +
+
+
} + + {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)} + /> +
+ + + + + +
+
+
+ + +
+ + + +
+
+
+   +
+ + + {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 &&
+ +
+ +
+ + + +
} + + +
+ +
+ +
+ + +
} + + + +
+ + {String(submenu).trim() !== "submenu_activite" && } +
+ +
 
+
+
+ } + label="CA généré (12 mois)" + value="76 845,30 €" + detail="vs 67 210,00 € (N-1)" + evolution="+14,4 %" + color="blue" + /> + } + label="Factures ouvertes" + value="3" + detail="dont 1 en retard" + color="orange" + /> + } + label="Reste à encaisser" + value="9 480,00 €" + detail="12,3 % du CA" + color="purple" + /> +
+ +
+ + +
+
+
+   Fermer +
+
); @@ -6694,4 +8039,832 @@ width: 100%; background: var(--mtt-teal-100); } +:root { + --elyos-blue: #104277; + --elyos-blue-dark: #062f5f; + --elyos-blue-light: #eaf2ff; + --bg: #f6f8fb; + --card: #ffffff; + --text: #14213d; + --muted: #6b7280; + --border: #e5eaf0; + --green: #12b76a; + --green-bg: #eafaf2; + --orange: #f79009; + --orange-bg: #fff4e5; + --red: #d92d20; + --red-bg: #fff1f0; + --purple: #7c3aed; + --purple-bg: #f2edff; + --shadow: 0 16px 40px rgba(16, 66, 119, 0.08); +} + +* { + box-sizing: border-box; +} + +body { + margin: 0; + font-family: "DM Sans", Inter, Arial, Helvetica, sans-serif; + background: var(--bg); + color: var(--text); +} + +button { + font-family: inherit; +} + +.elyos-layout { + min-height: 100vh; + display: flex; + background: + radial-gradient(circle at top right, rgba(16, 66, 119, 0.07), transparent 30%), + var(--bg); +} + +/* SIDEBAR */ + +.elyos-sidebar { + width: 260px; + min-height: 100vh; + padding: 28px 18px; + background: linear-gradient(180deg, #073461 0%, #052544 100%); + color: #fff; + display: flex; + flex-direction: column; + justify-content: space-between; +} + +.sidebar-brand { + display: flex; + align-items: flex-start; + gap: 14px; + margin-bottom: 46px; + padding-left: 8px; +} + +.sidebar-brand h1 { + margin: 0; + font-size: 34px; + letter-spacing: -0.04em; +} + +.sidebar-brand p { + margin: 6px 0 0; + color: rgba(255, 255, 255, 0.72); + font-size: 14px; +} + +.hamburger { + width: 26px; + margin-top: 8px; + display: flex; + flex-direction: column; + gap: 6px; +} + +.hamburger span { + height: 3px; + border-radius: 20px; + background: #fff; + opacity: 0.9; +} + +.sidebar-nav { + display: flex; + flex-direction: column; + gap: 8px; +} + +.sidebar-item { + width: 100%; + height: 52px; + border: 0; + border-radius: 14px; + padding: 0 16px; + display: flex; + align-items: center; + gap: 14px; + color: rgba(255, 255, 255, 0.82); + background: transparent; + cursor: pointer; + font-size: 15px; + transition: 0.2s ease; +} + +.sidebar-item:hover { + background: rgba(255, 255, 255, 0.08); + color: #fff; +} + +.sidebar-item.active { + background: #0b5ecf; + color: #fff; + box-shadow: 0 14px 30px rgba(0, 80, 180, 0.28); +} + +.sidebar-user { + display: flex; + align-items: center; + gap: 12px; + padding: 18px 8px 4px; + border-top: 1px solid rgba(255, 255, 255, 0.12); +} + +.user-avatar { + width: 42px; + height: 42px; + border-radius: 50%; + background: linear-gradient(135deg, #fff, #d9e9ff); + color: var(--elyos-blue); + font-weight: 800; + display: flex; + align-items: center; + justify-content: center; +} + +.sidebar-user strong { + display: block; + font-size: 15px; +} + +.sidebar-user span { + color: rgba(255, 255, 255, 0.64); + font-size: 13px; +} + +/* MAIN */ + +.elyos-main { + flex: 1; + padding: 28px 36px 40px; + overflow-x: hidden; +} + +.page-header { + display: flex; + align-items: center; + justify-content: space-between; + gap: 24px; + margin-bottom: 22px; +} + +.page-header h2 { + margin: 0; + font-size: 30px; + letter-spacing: -0.04em; + color: #101828; +} + +.page-header p { + margin: 6px 0 0; + color: var(--muted); + font-size: 15px; +} + +.header-actions { + display: flex; + gap: 12px; +} + +.btn { + height: 42px; + border-radius: 12px; + padding: 0 18px; + border: 1px solid var(--border); + display: inline-flex; + align-items: center; + gap: 9px; + font-weight: 700; + cursor: pointer; + background: #fff; + color: var(--text); + transition: 0.18s ease; +} + +.btn:hover { + transform: translateY(-1px); + box-shadow: 0 10px 24px rgba(16, 66, 119, 0.1); +} + +.btn-primary { + background: #0b55c4; + color: #fff; + border-color: #0b55c4; +} + +.btn-light { + background: rgba(255, 255, 255, 0.86); +} + +/* CARDS */ + +.card { + background: rgba(255, 255, 255, 0.92); + border: 1px solid var(--border); + border-radius: 22px; + box-shadow: var(--shadow); +} + +.client-hero { + padding: 26px 32px; + display: flex; + align-items: center; + gap: 30px; + margin-bottom: 22px; + flex-direction: row; +} + +.client-avatar { + width: 104px; + height: 104px; + border-radius: 50%; + background: linear-gradient(135deg, #eaf2ff, #f6f9ff); + color: #0b55c4; + display: flex; + align-items: center; + justify-content: center; + font-size: 38px; + font-weight: 900; + letter-spacing: -0.06em; + flex: 0 0 auto; +} + +.client-hero-content { + flex: 1; +} + +.client-title-row h3 { + margin: 0; + font-size: 29px; + letter-spacing: -0.04em; +} + +.client-badges { + margin-top: 10px; + display: flex; + gap: 10px; + flex-wrap: wrap; +} + +.badge, +.status { + display: inline-flex; + align-items: center; + height: 26px; + padding: 0 11px; + border-radius: 999px; + font-size: 12px; + font-weight: 800; +} + +.badge-green, +.status-success { + color: #027a48; + background: var(--green-bg); +} + +.badge-orange, +.status-warning { + color: #b54708; + background: var(--orange-bg); +} + +.status-danger { + color: var(--red); + background: var(--red-bg); +} + +.client-meta-grid { + margin-top: 24px; + display: grid; + grid-template-columns: repeat(5, minmax(140px, 1fr)); + gap: 18px; +} + +.meta-item { + display: flex; + gap: 11px; + align-items: flex-start; +} + +.meta-icon { + color: #667085; + margin-top: 2px; +} + +.meta-item span { + display: block; + color: var(--muted); + font-size: 13px; + margin-bottom: 4px; +} + +.meta-item strong { + display: block; + font-size: 14px; + color: #111827; +} + +/* KPI */ + +.kpi-grid { + display: grid; + grid-template-columns: repeat(3, minmax(180px, 1fr)); + gap: 16px; + margin-bottom: 20px; +} + +.kpi-card { + padding: 22px; + display: flex; + align-items: center; + gap: 18px; + flex-direction: row; +} + +.kpi-icon { + width: 54px; + height: 54px; + border-radius: 18px; + display: flex; + align-items: center; + justify-content: center; +} + +.kpi-icon.blue { + color: #0b55c4; + background: var(--elyos-blue-light); +} + +.kpi-icon.orange { + color: var(--orange); + background: var(--orange-bg); +} + +.kpi-icon.purple { + color: var(--purple); + background: var(--purple-bg); +} + +.kpi-card span { + display: block; + color: var(--muted); + font-weight: 700; + font-size: 13px; +} + +.kpi-card strong { + display: block; + margin-top: 5px; + font-size: 24px; + letter-spacing: -0.04em; +} + +.kpi-card p { + margin: 6px 0 0; + color: var(--muted); + font-size: 13px; +} + +.kpi-card em { + margin-left: 10px; + color: var(--green); + font-style: normal; + font-weight: 800; +} + +/* TABS */ + +.tabs { + height: 48px; + display: flex; + align-items: flex-end; + gap: 28px; + border-bottom: 1px solid var(--border); + margin-bottom: 20px; +} + +.tab { + height: 48px; + border: 0; + background: transparent; + color: var(--muted); + font-weight: 800; + cursor: pointer; + position: relative; +} + +.tab.active { + color: #0b55c4; +} + +.tab.active::after { + content: ""; + position: absolute; + left: 0; + right: 0; + bottom: -1px; + height: 3px; + border-radius: 999px; + background: #0b55c4; +} + +/* CONTENT */ + +.content-grid { + display: grid; + grid-template-columns: minmax(0, 1fr) 390px; + gap: 22px; + align-items: start; +} + +.left-column, +.right-column { + display: flex; + flex-direction: column; + gap: 18px; +} + +.info-card, +.invoices-card, +.activity-card, +.note-card, +.balance-card { + padding: 24px; +} + +.section-title, +.card-header-row { + display: flex; + align-items: center; + justify-content: space-between; + gap: 14px; + margin-bottom: 18px; +} + +.section-title { + justify-content: flex-start; +} + +.section-title h4, +.card-header-row h4, +.balance-card h4 { + margin: 0; + font-size: 18px; + letter-spacing: -0.02em; +} + +.section-icon { + width: 38px; + height: 38px; + border-radius: 14px; + background: var(--elyos-blue-light); + color: #0b55c4; + display: flex; + align-items: center; + justify-content: center; +} + +.info-grid { + display: grid; + grid-template-columns: repeat(2, minmax(220px, 1fr)); + gap: 24px 42px; +} + +.info-block span { + display: block; + color: var(--muted); + font-size: 13px; + margin-bottom: 7px; +} + +.info-block strong { + display: block; + font-size: 15px; + line-height: 1.45; + color: #111827; +} + +.link-button { + border: 0; + background: transparent; + color: #0b55c4; + font-weight: 800; + display: inline-flex; + align-items: center; + gap: 6px; + cursor: pointer; +} + +/* INVOICE TABLE */ + +.invoice-table { + width: 100%; +} + +.invoice-row { + display: grid; + grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr 70px; + align-items: center; + gap: 14px; + padding: 15px 4px; + border-bottom: 1px solid #eef2f7; + color: #344054; + font-size: 14px; +} + +.invoice-row:last-child { + border-bottom: 0; +} + +.invoice-head { + color: var(--muted); + font-size: 12px; + font-weight: 900; + text-transform: uppercase; + letter-spacing: 0.03em; +} + +.invoice-ref { + color: #0b55c4; + font-weight: 800; +} + +.invoice-actions { + display: flex; + justify-content: flex-end; + gap: 8px; +} + +.invoice-actions button { + width: 32px; + height: 32px; + border: 1px solid var(--border); + background: #fff; + border-radius: 10px; + color: #667085; + display: inline-flex; + align-items: center; + justify-content: center; + cursor: pointer; +} + +/* ACTIVITY */ + +.activity-list { + display: flex; + flex-direction: column; + gap: 20px; +} + +.activity-item { + display: grid; + grid-template-columns: 42px 1fr; + gap: 14px; +} + +.activity-icon { + width: 38px; + height: 38px; + border-radius: 14px; + display: flex; + align-items: center; + justify-content: center; +} + +.activity-icon.blue { + background: var(--elyos-blue-light); + color: #0b55c4; +} + +.activity-icon.green { + background: var(--green-bg); + color: var(--green); +} + +.activity-icon.purple { + background: var(--purple-bg); + color: var(--purple); +} + +.activity-top { + display: flex; + justify-content: space-between; + gap: 14px; +} + +.activity-top strong { + font-size: 14px; +} + +.activity-top span { + color: var(--muted); + font-size: 12px; + text-align: right; + line-height: 1.45; +} + +.activity-content p { + margin: 5px 0 0; + color: #475467; + font-size: 13px; + line-height: 1.5; +} + +/* NOTES */ + +.note-box { + background: linear-gradient(180deg, #fff9ed, #fff5df); + border: 1px solid #ffe1a8; + border-radius: 18px; + padding: 18px; +} + +.note-box p { + margin: 0 0 8px; + color: #344054; + font-size: 14px; + line-height: 1.5; +} + +.note-footer { + margin-top: 16px; + padding-top: 12px; + border-top: 1px solid rgba(247, 144, 9, 0.22); + display: flex; + justify-content: space-between; + align-items: center; + color: var(--muted); + font-size: 12px; +} + +/* BALANCE */ + +.balance-content { + display: flex; + align-items: center; + gap: 24px; + margin-top: 18px; +} + +.donut { + width: 116px; + height: 116px; + border-radius: 50%; + background: conic-gradient( + #0b55c4 0 48%, + #12b76a 48% 88%, + #d92d20 88% 100% + ); + position: relative; + flex: 0 0 auto; +} + +.donut-hole { + position: absolute; + inset: 26px; + background: #fff; + border-radius: 50%; +} + +.balance-legend { + flex: 1; + display: flex; + flex-direction: column; + gap: 12px; +} + +.balance-line { + display: flex; + align-items: center; + justify-content: space-between; + gap: 14px; + font-size: 14px; +} + +.balance-line span { + color: #475467; + display: flex; + align-items: center; + gap: 8px; +} + +.balance-line strong { + color: #111827; +} + +.dot { + width: 9px; + height: 9px; + border-radius: 50%; + display: inline-block; +} + +.dot.blue { + background: #0b55c4; +} + +.dot.green { + background: #12b76a; +} + +.dot.red { + background: #d92d20; +} + +.cash-rate { + margin-top: 22px; + padding-top: 16px; + border-top: 1px solid var(--border); + display: flex; + justify-content: space-between; + color: var(--muted); + font-size: 14px; +} + +.cash-rate strong { + color: var(--green); +} + +/* RESPONSIVE */ + +@media (max-width: 1280px) { + .client-meta-grid { + grid-template-columns: repeat(3, minmax(160px, 1fr)); + } + + .content-grid { + grid-template-columns: 1fr; + } + + .right-column { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + } + + .balance-card { + grid-column: span 2; + } +} + +@media (max-width: 920px) { + .elyos-layout { + flex-direction: column; + } + + .elyos-sidebar { + width: 100%; + min-height: auto; + } + + .sidebar-nav { + display: grid; + grid-template-columns: repeat(2, 1fr); + } + + .elyos-main { + padding: 24px 18px; + } + + .page-header, + .client-hero { + flex-direction: column; + align-items: flex-start; + } + + .header-actions { + width: 100%; + flex-wrap: wrap; + } + + .kpi-grid { + grid-template-columns: 1fr; + } + + .client-meta-grid, + .info-grid, + .right-column { + grid-template-columns: 1fr; + } + + .balance-card { + grid-column: auto; + } + + .invoice-row { + grid-template-columns: 1fr; + gap: 6px; + } + + .invoice-head { + display: none; + } + + .invoice-actions { + justify-content: flex-start; + } +} + + `; diff --git a/src/components/AddPartnerClient_ARG_100526.js b/src/components/AddPartnerClient_ARG_100526.js new file mode 100644 index 0000000..206872c --- /dev/null +++ b/src/components/AddPartnerClient_ARG_100526.js @@ -0,0 +1,6697 @@ +import React, { useRef, useState, useEffect } from "react"; + +import TextField from '@mui/material/TextField'; +import ToggleSwitch_v2_mysy from "./ToggleSwitch_v2_mysy"; +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 { FcCancel } from "react-icons/fc"; +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"; +import "react-draft-wysiwyg/dist/react-draft-wysiwyg.css"; +import { IoMdAddCircle, IoIosRemoveCircleOutline } from "react-icons/io"; +import { GrOrderedList } from "react-icons/gr"; +import { Fab } from "@material-ui/core"; +import 'react-tooltip/dist/react-tooltip.css' +import { Tooltip } from 'react-tooltip' +import { CiEdit, CiTrash } from "react-icons/ci"; +import Modules_Mes_Documents from "./Modules_Mes_Documents"; +import { AiOutlineUserAdd } from "react-icons/ai"; +import PartnerClient_Activite_For_Client from "./PartnerClient_Activite_For_Client"; +import Popup from 'reactjs-popup'; +import 'reactjs-popup/dist/index.css'; +import ToggleSwitch from "./ToggleSwitch"; +import ToggleSwitch_text_left from "./ToggleSwitch_text_left"; +import { FcSpeaker } from "react-icons/fc"; +import Autocomplete from '@mui/material/Autocomplete'; +import { gridClasses } from '@mui/x-data-grid'; +import Link from '@mui/material/Link'; +import { PiDotsThree } from "react-icons/pi"; +import { IoCloseCircleOutline } from "react-icons/io5"; +import AttachFileIcon from '@mui/icons-material/AttachFile'; +import Radio from '@mui/material/Radio'; +import { FcOpenedFolder } from "react-icons/fc"; +import { MdManageAccounts } from "react-icons/md"; +import { FcInfo } from "react-icons/fc"; +import { + DataGrid, frFR, GridToolbar, + +} from '@mui/x-data-grid'; +import Box from '@mui/material/Box'; +import Dialog from '@mui/material/Dialog'; +import DialogActions from '@mui/material/DialogActions'; +import DialogContent from '@mui/material/DialogContent'; +import DialogContentText from '@mui/material/DialogContentText'; +import DialogTitle from '@mui/material/DialogTitle'; +import { IconButton } from '@material-ui/core'; +import CancelPresentationIcon from '@mui/icons-material/CancelPresentation'; +import MenuItem from '@mui/material/MenuItem'; +import { makeStyles } from "@material-ui/core/styles"; +import Paper from '@material-ui/core/Paper'; +import Draggable from 'react-draggable'; +import Visibility from '@mui/icons-material/Visibility'; +import VisibilityOff from '@mui/icons-material/VisibilityOff'; +import * as XLSX from 'xlsx'; + +import { LiaDharmachakraSolid } from "react-icons/lia"; +import WarningAmberIcon from '@mui/icons-material/WarningAmber'; +import BlockIcon from '@mui/icons-material/Block'; +import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline'; + +import { + GridToolbarContainer, GridToolbarExport, GridToolbarColumnsButton, + GridToolbarFilterButton, GridToolbarDensitySelector, GridToolbarExportContainer, useGridApiContext, + gridFilteredSortedRowIdsSelector, + gridVisibleColumnFieldsSelector, + + +} from '@mui/x-data-grid'; +import Module_Alert_Confirmation from "./Module_Alert_Confirmation"; +import Module_Relance_Client_Facture from "./Module_Relance_Client_Facture"; + +function PaperComponent(props) { + return ( + + + + ); +} + +const useStyles = makeStyles((theme) => ({ + + dialog: { + position: 'absolute', + // left: 10, + top: 400 + }, + + paper: { + overflowY: 'unset', + }, + customizedButton: { + position: 'absolute', + left: '98%', + top: '-3%', + backgroundColor: 'lightgray', + color: 'gray', + }, +})); + + + +const AddPartnerClient_ARG_100526 = (props) => { + + const classes = useStyles(); + + const history = useHistory(); + const [submenu, setsubmenu] = useState(""); + + const [gridline_id_paiement, setgridline_id_paiement] = useState(""); + + const [current_contact_recid, setcurrent_contact_recid] = useState(""); + + const [datamodification, setdatamodification] = useState("0"); + const [formedit_mode, setformedit_mode] = useState("0"); + + const [datamodification_invoice, setdatamodification_invoice] = useState("0"); + const [formedit_mode_invoice, setformedit_mode_invoice] = useState("0"); + + const [datamodification_contact, setdatamodification_contact] = useState("0"); + const [formedit_mode_contact, setformedit_mode_contact] = useState("0"); + + const [p_client_email, setclient_email] = useState(""); + const [p_client_nom, setclient_nom] = useState(""); + + const [p_client_intranet_account_id, setp_client_intranet_account_id] = useState("0"); + + const [p_client_type_id, setp_client_type_id] = useState(""); + + const [p_client_goupe_client_id, setp_client_goupe_client_id] = useState(""); + + const [p_client_goupe_client_id_label, setp_client_goupe_client_id_label] = useState(""); + + const [p_client_type_label, setp_client_type_label] = useState(""); + + const [p_client_type_financeur, setp_client_type_financeur] = useState(""); + const [p_client_type_pouvoir_public, setp_client_type_pouvoir_public] = useState(""); + + const [p_client_raison_sociale, setclient_raison_sociale] = useState(""); + + const [p_client_is_company, setp_client_is_company] = useState(""); + 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(""); + const [p_client_adresse, setclient_adresse] = useState(""); + const [p_client_ville, setclient_ville] = useState(""); + const [p_client_code_postal, setclient_code_postal] = useState(""); + const [p_client_pays, setclient_pays] = useState(""); + const [p_client_telephone, setclient_telephone] = useState(""); + const [p_client_website, setclient_website] = useState(""); + + // Données de facturation + const [p_client_invoice_email, setclient_invoice_email] = useState(""); + const [p_client_invoice_nom, setclient_invoice_nom] = useState(""); + const [p_client_invoice_siret, setclient_invoice_siret] = useState(""); + const [p_client_invoice_tva, setclient_invoice_tva] = useState(""); + const [p_client_invoice_adresse, setclient_invoice_adresse] = useState(""); + + const [p_client_invoice_paiement_condition_code, setp_client_invoice_paiement_condition_code] = useState(""); + const [p_client_invoice_paiement_condition_id, setp_client_invoice_paiement_condition_id] = useState(""); + + const [p_client_invoice_ville, setclient_invoice_ville] = useState(""); + const [p_client_invoice_code_postal, setclient_invoice_code_postal] = useState(""); + const [p_client_invoice_pays, setclient_invoice_pays] = useState(""); + + // Données contact + const [p_contact_email, setp_contact_email] = useState(""); + const [p_contact_nom, setp_contact_nom] = useState(""); + const [p_contact_prenom, setp_contact_prenom] = useState(""); + const [p_contact_siret, setcontact_siret] = useState(""); + const [p_contact_tva, setcontact_tva] = useState(""); + const [p_contact_adresse, setcontact_adresse] = useState(""); + const [p_contact_ville, setcontact_ville] = useState(""); + const [p_contact_code_postal, setcontact_code_postal] = useState(""); + const [p_contact_pays, setcontact_pays] = useState(""); + const [p_contact_telephone, setcontact_telephone] = useState(""); + const [p_contact_telephone_mobile, setp_contact_telephone_mobile] = useState(""); + + const [p_contact_fonction, setp_contact_fonction] = useState(""); + const [p_contact_civilite, setp_contact_civilite] = useState("neutre"); + + + const [selected_contact_id, setelected_contact_id] = useState(""); + + + + function ExpandableCell_50({ value }) { + const [expanded, setExpanded] = React.useState(false); + + return ( + + ); + } + + + function Display_Colunm_text({ value }) { + + return ( +
+ {value}  + +
+ ); + } + function ExpandableCell_String_to_monetaire({ value }) { + const [expanded, setExpanded] = React.useState(false); + + const number = parseFloat(value); + var new_value = "" + if (isNaN(number)) { + new_value = "—" + } else { + new_value = new Intl.NumberFormat('fr-FR', { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }).format(number); + } + + + + return ( + + ); + } + + function local_format_monetaire(local_amount) { + return new Intl.NumberFormat('fr-FR', { + style: 'currency', + currency: 'EUR', + }).format(Number(local_amount)); + } + + + const [selectionModel_paiement, setselectionModel_paiement] = React.useState([]); + + const columns_paiement = [ + { field: '_id', headerName: '_id', hide: true, disableExport: true, }, + { field: 'id', headerName: 'id', hide: true, disableExport: true }, + { field: 'invoice_id', headerName: 'invoice_id', hide: true, disableExport: true }, + { field: 'paiement_date', headerName: 'Date Paiement', width: 150, hide: false, editable: false }, + { field: 'paiement_ref', headerName: 'paiement_ref', hide: false, minWidth: 200, flex: 1, editable: false, renderCell: (params) => , align: 'center', headerAlign: "center" }, + { + field: 'paiement_amount', headerName: 'Montant TTC', width: 150, hide: false, editable: false, align: 'right', headerAlign: "right", + renderCell: (params) => , + }, + + { field: 'invoice_ref', headerName: 'invoice_ref', hide: false, minWidth: 200, flex: 1, editable: false, renderCell: (params) => , align: 'left', headerAlign: 'left' }, + + + { field: 'paiement_mode', headerName: 'paiement_mode', width: 150, hide: false, editable: false, maxWidth: 200, flex: 1, }, + + { field: 'commentaire', headerName: 'commentaire', flex: 1, editable: false, hide: false, renderCell: (params) => , }, + + + + { + field: "delete", headerName: 'Supprimer', disableExport: true, + renderCell: (cellValues) => { + return ( +
+ {String(props.check_user_acces_right("facture", "write")) === "1" && + cellValues.row.invoice_header_type !== "brouillon" && } + {String(props.check_user_acces_right("facture", "write")) === "1" && + cellValues.row.invoice_header_type === "brouillon" && { + // handleClick_delete(event, cellValues); + }} + > + + + } + modal + nested + position="center center" + > + {close => ( +
+ +
MySy Information
+
+ {' '} + + En confirmant cette opération, le document sera définitivement supprimé.
+ +
+
+
+ + +
+
+ +
+
+
+ )} +
} +
+ + ); + } + } + + + ] + + function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); + } + + + function inactive_active_menu_header(current_menu_header) { + + const list_fields = ['submenu_devis', 'submenu_factures', 'submenu_piece_jointe', + 'submenu_activite', 'submenu_contact', 'submenu_donnee_facturation', 'submenu_donnee_client', 'submenu_relance', + 'submenu_paiement'] + + for (let i = 0; i < list_fields.length; i++) { + if (document.getElementsByName(String(list_fields[i])) && document.getElementsByName(String(list_fields[i]))[0]) { + document.getElementsByName(String(list_fields[i]))[0].style.background = "#d8edfc"; + document.getElementsByName(String(list_fields[i]))[0].style.color = "#3b3e40"; + + } + } + + if (document.getElementsByName(String(current_menu_header)) && document.getElementsByName(String(current_menu_header))[0]) { + document.getElementsByName(String(current_menu_header))[0].style.background = "#107758"; + document.getElementsByName(String(current_menu_header))[0].style.color = "white"; + } + + + } + + const [importmessage, setimportmessage] = useState(""); + async function submenu_donnee_client() { + setsubmenu("submenu_donnee_client"); + /* + Ceci est super crade, fair eun wait de pour attendre l'afficage avant de desacitcation si on a desactiver, mais bon ... on avance. + */ + await sleep(5); + if (String(formedit_mode) !== "1") { + Disable_fields(); + } else { + Enable_fields(); + } + + inactive_active_menu_header("submenu_donnee_client"); + + } + + + async function submenu_relance() { + setsubmenu("submenu_relance"); + /* + Ceci est super crade, fair eun wait de pour attendre l'afficage avant de desacitcation si on a desactiver, mais bon ... on avance. + */ + await sleep(5); + if (String(formedit_mode) !== "1") { + Disable_fields(); + } else { + Enable_fields(); + } + + inactive_active_menu_header("submenu_relance"); + + } + + + async function submenu_paiement() { + Get_All_Paiement_of_Client(); + setsubmenu("submenu_paiement"); + /* + Ceci est super crade, fair eun wait de pour attendre l'afficage avant de desacitcation si on a desactiver, mais bon ... on avance. + */ + await sleep(5); + if (String(formedit_mode) !== "1") { + Disable_fields(); + } else { + Enable_fields(); + } + + inactive_active_menu_header("submenu_paiement"); + + } + + + async function submenu_donnee_facturation() { + + Get_List_Partner_Clients_except_current(); + + setsubmenu("submenu_donnees_facturation"); + /* + Ceci est super crade, fair eun wait de pour attendre l'afficage avant de desacitcation si on a desactiver, mais bon ... on avance. + */ + await sleep(5); + if (String(formedit_mode_invoice) !== "1") { + Disable_invoice_fields(); + } else { + Enable_invoice_fields(); + } + + inactive_active_menu_header("submenu_donnee_facturation"); + + } + + async function submenu_contact() { + setsubmenu("submenu_contact"); + /* + Ceci est super crade, fair eun wait de pour attendre l'afficage avant de desacitcation si on a desactiver, mais bon ... on avance. + */ + await sleep(5); + + inactive_active_menu_header("submenu_contact"); + + } + + async function submenu_activite() { + + setsubmenu("submenu_activite"); + /* + Ceci est super crade, fair eun wait de pour attendre l'afficage avant de desacitcation si on a desactiver, mais bon ... on avance. + */ + await sleep(5); + if (String(formedit_mode_invoice) !== "1") { + //Disable_invoice_fields(); + } else { + //Enable_invoice_fields(); + } + inactive_active_menu_header("submenu_activite"); + + + } + + + async function submenu_piece_jointe() { + + setsubmenu("submenu_piece_jointe"); + /* + Ceci est super crade, fair eun wait de pour attendre l'afficage avant de desacitcation si on a desactiver, mais bon ... on avance. + */ + await sleep(5); + if (String(formedit_mode_invoice) !== "1") { + //Disable_invoice_fields(); + } else { + //Enable_invoice_fields(); + } + inactive_active_menu_header("submenu_piece_jointe"); + // Refresh affichage des pièces jointes + Get_List_Of_All_PJ(props.client_id); + } + + + async function submenu_devis() { + setsubmenu("submenu_devis"); + /* + Ceci est super crade, fair eun wait de pour attendre l'afficage avant de desacitcation si on a desactiver, mais bon ... on avance. + */ + await sleep(5); + inactive_active_menu_header("submenu_devis"); + } + + async function submenu_cmd() { + setsubmenu("submenu_cmd"); + /* + Ceci est super crade, fair eun wait de pour attendre l'afficage avant de desacitcation si on a desactiver, mais bon ... on avance. + */ + await sleep(5); + } + + async function submenu_factures() { + setsubmenu("submenu_factures"); + /* + Ceci est super crade, fair eun wait de pour attendre l'afficage avant de desacitcation si on a desactiver, mais bon ... on avance. + */ + await sleep(5); + inactive_active_menu_header("submenu_factures"); + } + + + async function submenu_stagiaires() { + setsubmenu("submenu_stagiaires"); + /* + Ceci est super crade, fair eun wait de pour attendre l'afficage avant de desacitcation si on a desactiver, mais bon ... on avance. + */ + await sleep(5); + } + + function DataUpdated() { + if (String(props.check_user_acces_right("client", "write")) === "1") { + setdatamodification("1"); + } + } + + function DataEditMode() { + if (String(props.check_user_acces_right("client", "write")) === "1") { + setformedit_mode("1"); + Enable_fields(); + } + } + + function AnnulerEdit() { + setformedit_mode("0"); + setdatamodification("0"); + Disable_fields(); + clear_fields(); + fillfield_Only_Main_Data(props.client_mail); + + } + + function DataUpdated_Invoice_Data() { + if (String(props.check_user_acces_right("client", "write")) === "1") { + setdatamodification_invoice("1"); + } + } + + function DataEditMode_Invoice_Data() { + + + if (String(props.check_user_acces_right("client", "write")) === "1") { + setformedit_mode_invoice("1"); + Enable_invoice_fields(); + } + } + + + + function DataUpdated_Contact_Data() { + if (String(props.check_user_acces_right("client", "write")) === "1") { + setdatamodification_contact("1"); + } + } + + function DataEditMode_Contact_Data() { + if (String(props.check_user_acces_right("client", "write")) === "1") { + setformedit_mode_contact("1"); + Enable_contact_fields(); + } + } + + + function AnnulerEdit_Invoice_Data() { + setformedit_mode_invoice("0"); + setdatamodification_invoice("0"); + Disable_invoice_fields(); + clear_invoice_fields(); + fillfield_Invoice_Data(props.client_mail); + } + + + function SetTabFocus() { + + document.getElementById("submenu_donnee_client").style.background = "#d8edfc"; + document.getElementById("submenu_donnee_client").style.color = "#3b3e40"; + document.getElementById("submenu_donnee_facturation").style.background = "#d8edfc"; + document.getElementById("submenu_donnee_facturation").style.color = "#3b3e40"; + + + if (String(submenu) === "submenu_donnee_client") { + document.getElementById("submenu_donnee_client").style.background = "#107758"; + document.getElementById("submenu_donnee_client").style.color = "white"; + } + else if (String(submenu) === "submenu_donnees_facturation") { + document.getElementById("submenu_donnee_facturation").style.background = "#107758"; + document.getElementById("submenu_donnee_facturation").style.color = "white"; + } + + else if (String(submenu) === "submenu_piece_jointe") { + document.getElementById("submenu_piece_jointe").style.background = "#107758"; + document.getElementById("submenu_piece_jointe").style.color = "white"; + } + + } + + const [addcontact, setaddcontact] = useState("0"); + function Add_Contact() { + setis_contact_include_com(false); + setdatamodification_contact("0"); + setformedit_mode_contact("1"); + clean_contact_set_values(); + setaddcontact("1"); + setcurrent_contact_recid(""); + } + + function Close_Contact() { + setaddcontact("0"); + setdatamodification_contact("0"); + setformedit_mode_contact("0"); + clear_contact_fields(); + clean_contact_set_values(); + setdatamodification_invoice("0"); + setformedit_mode_contact("0"); + setcurrent_contact_recid(""); + setis_contact_include_com(false); + } + + const [New_Get_List_Client_Type_result, setNew_Get_List_Client_Type_result] = useState([]); + + const [Get_List_Client_Type_api, setGet_List_Client_Type_api] = useState(); + const [Get_List_Client_Type_message, setGet_List_Client_Type_message] = useState(); + const [Get_List_Client_Type_result, setGet_List_Client_Type_result] = useState(); + function Get_List_Client_Type(event) { + + var form = new FormData(); + const stored_cookie = getCookie('tokenmysypart'); + const related_collection = "partner_client" + + + form.append("token", stored_cookie); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Client_Type_List/"; + + axios.post(myurl, form).then(res => { + //console.log(" In Get_List_Client_Type res.data.status = " + res.data.status); + //console.log(" In Get_List_Client_Type res.data.message r_class = " + res.data.message); + + if (String(res.data.status) === String("true")) { + setGet_List_Client_Type_api("true"); + setGet_List_Client_Type_result(res.data.message); + + var new_data2 = []; + const new_data = res.data.message.map((x) => { + + //--- + var localid = JSON.parse(x).id; + var local_id = JSON.parse(x)._id; + var local_code = JSON.parse(x).code; + + + //--- + var node = { + "_id": local_id, + "id": localid, + "label": local_code, + "code": local_code, + + }; + new_data2.push(node); + }); + + //--- + var node = { + "_id": "", + "id": "", + "label": "", + "code": "", + + }; + new_data2.push(node); + if (new_data2.length > 0) + setNew_Get_List_Client_Type_result(new_data2); + + + } + else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); + } + else { + setGet_List_Client_Type_api("false"); + setGet_List_Client_Type_message(res.data.message); + //alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + console.warn('Not good man :( Get_List_Client_Type = ', error); + setGet_List_Client_Type_api("false"); + //alert(" Impossible de récupérer les types de clients"); + + setdisplay_alert_mysy("1"); + setalert_message(" Impossible de récupérer les types de clients"); + setalert_type("error"); + }) + } + + + const [New_Get_List_Client_Groupe_result, setNew_Get_List_Client_Groupe_result] = useState([]); + + const [Get_List_Client_Groupe_api, setGet_List_Client_Groupe_api] = useState(); + const [Get_List_Client_Groupe_message, setGet_List_Client_Groupe_message] = useState(); + const [Get_List_Client_Groupe_result, setGet_List_Client_Groupe_result] = useState(); + function Get_List_Client_Groupe(event) { + + var form = new FormData(); + const stored_cookie = getCookie('tokenmysypart'); + const related_collection = "partner_client" + + + form.append("token", stored_cookie); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Groupe_Client/"; + + axios.post(myurl, form).then(res => { + //console.log(" In Get_List_Client_Groupe res.data.status = " + res.data.status); + //console.log(" In Get_List_Client_Groupe res.data.message r_class = " + res.data.message); + + if (String(res.data.status) === String("true")) { + setGet_List_Client_Groupe_api("true"); + setGet_List_Client_Groupe_result(res.data.message); + + var new_data2 = []; + const new_data = res.data.message.map((x) => { + + //--- + var localid = JSON.parse(x).id; + var local_id = JSON.parse(x)._id; + var local_code = JSON.parse(x).code; + + + //--- + var node = { + "_id": local_id, + "id": localid, + "label": local_code, + "code": local_code, + + }; + new_data2.push(node); + }); + + //--- + var node = { + "_id": "", + "id": "", + "label": "", + "code": "", + + }; + new_data2.push(node); + if (new_data2.length > 0) + setNew_Get_List_Client_Groupe_result(new_data2); + + } + else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); + } + else { + setGet_List_Client_Groupe_api("false"); + setGet_List_Client_Groupe_message(res.data.message); + //alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + console.warn('Not good man :( Get_List_Client_Groupe = ', error); + setGet_List_Client_Groupe_api("false"); + setdisplay_alert_mysy("1"); + setalert_message(" Impossible de récupérer les groupes de clients"); + setalert_type("error") + }) + } + + + const [New_Getall_Partner_Paiement_Condition_result, setNew_Getall_Partner_Paiement_Condition_result] = useState([]); + + const [Getall_Partner_Paiement_Condition_api, setGetall_Partner_Paiement_Condition_api] = useState(); + const [Getall_Partner_Paiement_Condition_message, setGetall_Partner_Paiement_Condition_message] = useState(); + const [Getall_Partner_Paiement_Condition_result, setGetall_Partner_Paiement_Condition_result] = useState([]); + function Getall_Partner_Paiement_Condition(event) { + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Paiement_Condition/"; + + //setLoading(true); + axios.post(myurl, form).then(res => { + //setLoading(false); + + if (String(res.data.status) === String("true")) { + //console.log(" In Getall_Partner_Paiement_Condition res.data.status = " + res.data.status); + //console.log(" In Getall_Partner_Paiement_Condition res.data.message r_class = " + res.data.message); + setGetall_Partner_Paiement_Condition_api("true"); + setGetall_Partner_Paiement_Condition_result(res.data.message); + + var new_data2 = []; + const new_data = res.data.message.map((x) => { + + //--- + var localid = JSON.parse(x).id; + var local_id = JSON.parse(x)._id; + var local_code = JSON.parse(x).code; + var local_description = JSON.parse(x).description; + var local_nb_jour = JSON.parse(x).nb_jour; + var local_depart = JSON.parse(x).depart; + + + //--- + var node = { + "_id": local_id, + "id": localid, + "label": local_code, + "code": local_code, + "description": local_description, + "nb_jour": local_nb_jour, + "depart": local_depart, + + }; + new_data2.push(node); + }); + + //--- + var node = { + "_id": "", + "id": "", + "label": "", + "code": "", + "description": "", + "nb_jour": "", + "depart": "", + + }; + new_data2.push(node); + + + if (new_data2.length > 0) + setNew_Getall_Partner_Paiement_Condition_result(new_data2); + + + } + else { + setGetall_Partner_Paiement_Condition_api("false"); + setGetall_Partner_Paiement_Condition_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 :( Getall_Partner_Paiement_Condition = ', error); + setGetall_Partner_Paiement_Condition_api("false"); + alert(" Impossible de recuperer la liste des conditions de paiement"); + //setmyApimyApiMessage("") + }) + } + + + const [New_Get_List_Partner_Clients_except_current_result, setNew_Get_List_Partner_Clients_except_current_result] = useState([]); + + const [Get_List_Partner_Clients_except_current_api, setGet_List_Partner_Clients_except_current_api] = useState(); + const [Get_List_Partner_Clients_except_current_message, setGet_List_Partner_Clients_except_current_message] = useState(); + const [Get_List_Partner_Clients_except_current_result, setGet_List_Partner_Clients_except_current_result] = useState([]); + function Get_List_Partner_Clients_except_current(event) { + + + var form = new FormData(); + const stored_cookie = getCookie('tokenmysypart'); + + form.append("token", stored_cookie); + form.append("archive", "0"); + form.append("not_id", props.client_id); + + + 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_except_current res.data.status = " + res.data.status); + //console.log(" In Get_List_Partner_Clients_except_current res.data.message r_class = " + res.data.message); + + if (String(res.data.status) === String("true")) { + setGet_List_Partner_Clients_except_current_api("true"); + setGet_List_Partner_Clients_except_current_result(res.data.message); + + var new_data2 = []; + const new_data = res.data.message.map((x) => { + //--- + var localid = JSON.parse(x).id; + var local_id = JSON.parse(x)._id; + var raison_sociale = JSON.parse(x).raison_sociale; + var invoice_nom = JSON.parse(x).invoice_nom; + var invoice_adresse = JSON.parse(x).invoice_adresse; + var invoice_code_postal = JSON.parse(x).invoice_code_postal; + var invoice_ville = JSON.parse(x).invoice_ville; + var invoice_pays = JSON.parse(x).invoice_pays; + var invoice_email = JSON.parse(x).invoice_email; + var telephone = JSON.parse(x).telephone; + + + //--- + var node = { + "_id": local_id, + "id": localid, + "raison_sociale": raison_sociale, + "invoice_nom": invoice_nom, + "invoice_adresse": invoice_adresse, + "invoice_code_postal": invoice_code_postal, + "invoice_ville": invoice_ville, + "invoice_pays": invoice_pays, + "invoice_email": invoice_email, + "telephone": telephone, + + "label": raison_sociale + " " + invoice_nom + }; + 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" }; + + }); + + var node = { + "_id": "", + "id": "", + "raison_sociale": "", + "invoice_nom": "", + "invoice_adresse": "", + "invoice_code_postal": "", + "invoice_ville": "", + "invoice_pays": "", + "invoice_email": "", + "telephone": "", + "label": "", + }; + new_data2.push(node); + + if (new_data2.length > 0) { + setNew_Get_List_Partner_Clients_except_current_result(new_data2); + + } else { + setNew_Get_List_Partner_Clients_except_current_result({ + "_id": "", + "id": "", + "raison_sociale": "", + "invoice_nom": "", + "invoice_adresse": "", + "invoice_code_postal": "", + "invoice_ville": "", + "invoice_pays": "", + "invoice_email": "", + "telephone": "", + "label": "", + }); + } + + + } + else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); + + } + else { + setGet_List_Partner_Clients_except_current_api("false"); + setGet_List_Partner_Clients_except_current_message(res.data.message); + + } + + }).catch((error) => { + console.warn('Not good man :( Get_List_Partner_Clients_except_current = ', error); + setGet_List_Partner_Clients_except_current_api("false"); + + //setmyApimyApiMessage("") + }) + } + + + + useEffect(() => { + Get_List_Client_Type(); + Get_List_Client_Groupe(); + Getall_Partner_Paiement_Condition(); + Get_List_Of_All_PJ(props.client_id); + Get_List_Type_Financeur(); + Get_List_Type_Pouvoir_Public(); + + + + if (String(props.new_customer) !== "1") { + setformedit_mode("0"); + setformedit_mode_invoice("0"); + + submenu_donnee_client(); + fillfield(); + + setdatamodification("0"); + setdatamodification_invoice("0"); + + Get_List_Contact_Of_client_Part(); + + + } else { + setformedit_mode("1"); + setformedit_mode_invoice("1"); + } + + setp_new_pwd(""); + setp_conf_new_login(""); + + + }, [props.client_mail,]); + + + + const [has_client_invoice_email, sethas_client_invoice_email] = useState(); + + + const [fillfield_api, setfillfield_api] = useState(""); + const [fillfield_result, setfillfield_result] = useState(""); + const [fillfield_message, setfillfield_message] = useState(""); + function fillfield() { + + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("_id", props.client_id); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Given_Partner_Client_From_Id/"; + + axios.post(myurl, form).then(res => { + if (String(res.data.status) === String("true")) { + //console.log(" In fillfield res.data.status = " + res.data.status); + //console.log(" In fillfield res.data.message = " + res.data.message); + setfillfield_api("true"); + setfillfield_result(res.data.message); + var mylocalclient = JSON.parse(res.data.message); + + + if (mylocalclient) { + + + if (mylocalclient.nom) { + setclient_nom(mylocalclient.nom); + } else { + setclient_nom(""); + } + + if (mylocalclient.email) { + setclient_email(mylocalclient.email); + } else { + setclient_email(""); + } + + + if (mylocalclient.intranet_account_id) { + setp_client_intranet_account_id(mylocalclient.intranet_account_id); + } else { + setp_client_intranet_account_id("0"); + } + + if (mylocalclient.raison_sociale) { + setclient_raison_sociale(mylocalclient.raison_sociale); + } else { + setclient_raison_sociale(""); + } + + setp_client_is_company("0"); + if (mylocalclient.is_company) { + setp_client_is_company(mylocalclient.is_company); + } + + + setp_detail_archive("0"); + if (mylocalclient.archive) { + setp_detail_archive(mylocalclient.archive); + } + + + + if (String(mylocalclient.is_financeur) === "1") + setp_client_is_financeur(true); + else + setp_client_is_financeur(false); + + + if (String(mylocalclient.is_client) === "1") + setp_client_is_client(true); + else + setp_client_is_client(false); + + + if (String(mylocalclient.is_fournisseur) === "1") + setp_client_is_fournisseur(true); + else + setp_client_is_fournisseur(false); + + + + if (mylocalclient.adr_adresse) + setclient_adresse(mylocalclient.adr_adresse); + else + setclient_adresse(""); + + + if (mylocalclient.comment) + setp_client_comment(mylocalclient.comment); + else + setp_client_comment(""); + + + if (mylocalclient.adr_ville) + setclient_ville(mylocalclient.adr_ville); + else + setclient_ville(""); + + if (mylocalclient.adr_pays) + setclient_pays(mylocalclient.adr_pays); + else + setclient_pays(""); + + if (mylocalclient.siret) + setclient_siret(mylocalclient.siret); + else + setclient_siret(""); + + + if (mylocalclient.client_type_id) { + setp_client_type_id(mylocalclient.client_type_id); + setp_client_type_label(mylocalclient.client_type_code); + } else { + setp_client_type_id(""); + setp_client_type_label(""); + } + + if (mylocalclient.partner_groupe_client_id) { + setp_client_goupe_client_id(mylocalclient.partner_groupe_client_id); + } else { + setp_client_goupe_client_id(""); + + } + + if (mylocalclient.partner_groupe_client_code) { + setp_client_goupe_client_id_label(mylocalclient.partner_groupe_client_code); + } else { + setp_client_goupe_client_id_label(""); + + } + + if (mylocalclient.tva) + setclient_tva(mylocalclient.tva); + else + setclient_tva(""); + + + if (mylocalclient.type_financeur_id) + setp_client_type_financeur(mylocalclient.type_financeur_id); + else + setp_client_type_financeur(""); + + + if (mylocalclient.type_pouvoir_public_id) + setp_client_type_pouvoir_public(mylocalclient.type_pouvoir_public_id); + + else + setp_client_type_pouvoir_public(""); + + + + + if (mylocalclient.website) + setclient_website(mylocalclient.website); + else + setclient_website(""); + + if (mylocalclient.telephone) + setclient_telephone(mylocalclient.telephone); + else + setclient_telephone(""); + + // Remplissage des doonées de facturation + if (mylocalclient.invoice_email) + setclient_invoice_email(mylocalclient.invoice_email); + else { + setclient_invoice_email(""); + sethas_client_invoice_email("0"); + } + + if (mylocalclient.invoice_nom) + setclient_invoice_nom(mylocalclient.invoice_nom); + else + setclient_invoice_nom(""); + + + if (mylocalclient.invoice_siret) + setclient_invoice_siret(mylocalclient.invoice_siret); + else + setclient_invoice_siret(""); + + if (mylocalclient.invoice_tva) + setclient_invoice_tva(mylocalclient.invoice_tva); + else + setclient_invoice_tva(""); + + if (mylocalclient.invoice_adresse) + setclient_invoice_adresse(mylocalclient.invoice_adresse); + else + setclient_invoice_adresse(""); + + if (mylocalclient.invoice_condition_paiement_id) + setp_client_invoice_paiement_condition_id(mylocalclient.invoice_condition_paiement_id); + else { + setp_client_invoice_paiement_condition_id(""); + sethas_client_invoice_email("0"); + } + + if (mylocalclient.invoice_condition_paiement_code) + setp_client_invoice_paiement_condition_code(mylocalclient.invoice_condition_paiement_code); + else + setp_client_invoice_paiement_condition_code(""); + + if (mylocalclient.invoice_ville) + setclient_invoice_ville(mylocalclient.invoice_ville); + else + setclient_invoice_ville(""); + + if (mylocalclient.invoice_code_postal) + setclient_invoice_code_postal(mylocalclient.invoice_code_postal); + else + setclient_invoice_code_postal(""); + + if (mylocalclient.invoice_pays) + setclient_invoice_pays(mylocalclient.invoice_pays); + else + setclient_invoice_pays(""); + + if (mylocalclient.invoice_automatique) + setp_detail_facturation_automatique(mylocalclient.invoice_automatique); + else + setp_detail_facturation_automatique(""); + + if (mylocalclient.client_facturation_id) + setp_detail_client_facturation_id(mylocalclient.client_facturation_id); + else + setp_detail_client_facturation_id(""); + + setdatamodification("0"); + setdatamodification_invoice("0"); + + Disable_fields(); + //Disable_invoice_fields(); + } + } + else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); + return; + } + else { + + setfillfield_api("false"); + setfillfield_message(res.data.message); + } + + + }).catch((error) => { + console.warn('Not good man :( fillfield = ', error); + setfillfield_result("false"); + setfillfield_message(" Impossible de recuperer les informations du client") + + }) + } + + + const [fillfield_Invoice_Data_api, setfillfield_Invoice_Data_api] = useState(""); + const [fillfield_Invoice_Data_result, setfillfield_Invoice_Data_result] = useState(""); + const [fillfield_Invoice_Data_message, setfillfield_Invoice_Data_message] = useState(""); + function fillfield_Invoice_Data(cust_email) { + + var val = cust_email; + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("_id", props.client_id); + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Given_Partner_Client_From_Id/"; + + axios.post(myurl, form).then(res => { + if (String(res.data.status) === String("true")) { + //console.log(" In fillfield_Invoice_Data res.data.status = " + res.data.status); + //console.log(" In fillfield_Invoice_Data res.data.message = " + res.data.message); + setfillfield_Invoice_Data_api("true"); + setfillfield_Invoice_Data_result(res.data.message); + var mylocalclient = JSON.parse(res.data.message); + + + if (mylocalclient) { + + // Remplissage des doonées de facturation + if (mylocalclient.invoice_email) + setclient_invoice_email(mylocalclient.invoice_email); + else + setclient_invoice_email(""); + + if (mylocalclient.invoice_nom) + setclient_invoice_nom(mylocalclient.invoice_nom); + else + setclient_invoice_nom(""); + + if (mylocalclient.invoice_siret) + setclient_invoice_siret(mylocalclient.invoice_siret); + else + setclient_invoice_siret(""); + + if (mylocalclient.invoice_tva) + setclient_invoice_tva(mylocalclient.invoice_tva); + else + setclient_invoice_tva(""); + + if (mylocalclient.invoice_adresse) + setclient_invoice_adresse(mylocalclient.invoice_adresse); + else + setclient_invoice_adresse(""); + + if (mylocalclient.invoice_condition_paiement_id) + setp_client_invoice_paiement_condition_id(mylocalclient.invoice_condition_paiement_id); + else + setp_client_invoice_paiement_condition_id(""); + + if (mylocalclient.invoice_condition_paiement_code) + setp_client_invoice_paiement_condition_code(mylocalclient.invoice_condition_paiement_code); + else + setp_client_invoice_paiement_condition_code(""); + + if (mylocalclient.invoice_ville) + setclient_invoice_ville(mylocalclient.invoice_ville); + else + setclient_invoice_ville(""); + + if (mylocalclient.comment) + setp_client_comment(mylocalclient.comment); + else + setp_client_comment(""); + + if (mylocalclient.invoice_code_postal) + setclient_invoice_code_postal(mylocalclient.invoice_code_postal); + else + setclient_invoice_code_postal(""); + + if (mylocalclient.invoice_pays) + setclient_invoice_pays(mylocalclient.invoice_pays); + else + setclient_invoice_pays(""); + + if (mylocalclient.invoice_automatique) + setp_detail_facturation_automatique(mylocalclient.invoice_automatique); + else + setp_detail_facturation_automatique(""); + + if (mylocalclient.client_facturation_id) + setp_detail_client_facturation_id(mylocalclient.client_facturation_id); + else + setp_detail_client_facturation_id(""); + + Disable_invoice_fields(); + } + } + else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); + return; + } + else { + + setfillfield_Invoice_Data_api("false"); + setfillfield_Invoice_Data_message(res.data.message); + } + + + }).catch((error) => { + console.warn('Not good man :( fillfield_Invoice_Data = ', error); + setfillfield_Invoice_Data_result("false"); + setfillfield_Invoice_Data_message(" Impossible de recuperer les informations du client") + + }) + } + + const [fillfield_Only_Main_Data_api, setfillfield_Only_Main_Data_api] = useState(""); + const [fillfield_Only_Main_Data_result, setfillfield_Only_Main_Data_result] = useState(""); + const [fillfield_Only_Main_Data_message, setfillfield_Only_Main_Data_message] = useState(""); + function fillfield_Only_Main_Data(cust_email) { + + var val = cust_email; + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("_id", props.client_id); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Given_Partner_Client_From_Id/"; + + axios.post(myurl, form).then(res => { + if (String(res.data.status) === String("true")) { + //console.log(" In fillfield_Only_Main_Data res.data.status = " + res.data.status); + //console.log(" In fillfield_Only_Main_Data res.data.message = " + res.data.message); + setfillfield_Only_Main_Data_api("true"); + setfillfield_Only_Main_Data_result(res.data.message); + var mylocalclient = JSON.parse(res.data.message); + + + if (mylocalclient) { + + if (mylocalclient.raison_sociale) { + setclient_raison_sociale(mylocalclient.raison_sociale); + } else { + setclient_raison_sociale(""); + } + + setp_client_is_company("0"); + if (mylocalclient.is_company) { + setp_client_is_company(mylocalclient.is_company); + } + + if (mylocalclient.adr_adresse) + setclient_adresse(mylocalclient.adr_adresse); + else + setclient_adresse(""); + + + if (mylocalclient.adr_ville) + setclient_ville(mylocalclient.adr_ville); + else + setclient_ville(""); + + if (mylocalclient.adr_pays) + setclient_pays(mylocalclient.adr_pays); + else + setclient_pays(""); + + if (mylocalclient.comment) + setp_client_comment(mylocalclient.comment); + else + setp_client_comment(""); + + if (mylocalclient.siret) + setclient_siret(mylocalclient.siret); + else + setclient_siret(""); + + if (mylocalclient.tva) + setclient_tva(mylocalclient.tva); + else + setclient_tva(""); + + if (mylocalclient.website) + setclient_website(mylocalclient.website); + else + setclient_website(""); + + if (mylocalclient.telephone) + setclient_telephone(mylocalclient.telephone); + else + setclient_telephone(""); + + + Disable_fields(); + + } + } + else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); + return; + } + else { + + setfillfield_Only_Main_Data_api("false"); + setfillfield_Only_Main_Data_message(res.data.message); + } + + + }).catch((error) => { + console.warn('Not good man :( fillfield_Only_Main_Data = ', error); + setfillfield_Only_Main_Data_result("false"); + setfillfield_Only_Main_Data_message(" Impossible de recuperer les informations du client") + + }) + } + + + const [client_has_communication_contact, setclient_has_communication_contact] = useState(); + + const [Get_List_Contact_Of_client_Part_api, setGet_List_Contact_Of_client_Part_api] = useState(); + const [Get_List_Contact_Of_client_Part_message, setGet_List_Contact_Of_client_Part_message] = useState(); + const [Get_List_Contact_Of_client_Part_result, setGet_List_Contact_Of_client_Part_result] = useState(); + function Get_List_Contact_Of_client_Part(event) { + + var form = new FormData(); + const stored_cookie = getCookie('tokenmysypart'); + const related_collection = "partner_client" + + + form.append("token", stored_cookie); + form.append("related_collection", related_collection); + form.append("related_collection_owner_id", props.client_id); + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Entity_Contact/"; + + axios.post(myurl, form).then(res => { + //console.log(" In Get_List_Contact_Of_client_Part res.data.status = " + res.data.status); + //console.log(" In Get_List_Contact_Of_client_Part res.data.message r_class = " + res.data.message); + + if (String(res.data.status) === String("true")) { + setGet_List_Contact_Of_client_Part_api("true"); + setGet_List_Contact_Of_client_Part_result(res.data.message); + + var contact_com = "0"; + + const new_data = res.data.message.map((x) => { + + //--- + var include_com = JSON.parse(x).include_com; + if (String(include_com) === "1") { + contact_com = "1" + } + }); + + setclient_has_communication_contact(contact_com); + } + else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); + } + else { + setGet_List_Contact_Of_client_Part_api("false"); + setGet_List_Contact_Of_client_Part_message(res.data.message); + } + + }).catch((error) => { + console.warn('Not good man :( Get_List_Contact_Of_client_Part = ', error); + setGet_List_Contact_Of_client_Part_api("false"); + //setmyApimyApiMessage("") + }) + } + + + function clear_fields() { + if (document.getElementsByName("client_email")) { + document.getElementsByName("client_email")[0].value = ""; + } + + if (document.getElementsByName("client_nom")) { + document.getElementsByName("client_nom")[0].value = ""; + } + + if (document.getElementsByName("client_raison_sociale")) { + document.getElementsByName("client_raison_sociale")[0].value = ""; + } + + if (document.getElementsByName("client_adresse")) { + document.getElementsByName("client_adresse")[0].value = ""; + } + + if (document.getElementsByName("client_ville")) { + document.getElementsByName("client_ville")[0].value = ""; + } + + if (document.getElementsByName("client_pays")) { + document.getElementsByName("client_pays")[0].value = ""; + } + + if (document.getElementsByName("client_email")) { + document.getElementsByName("client_email")[0].value = ""; + } + + if (document.getElementsByName("client_siret")) { + document.getElementsByName("client_siret")[0].value = ""; + } + + if (document.getElementsByName("client_type_id") && document.getElementsByName("client_type_id")[0]) { + document.getElementsByName("client_type_id")[0].value = ""; + } + + if (document.getElementsByName("client_type_financeur_id") && document.getElementsByName("client_type_financeur_id")[0]) { + document.getElementsByName("client_type_financeur_id")[0].value = ""; + } + + if (document.getElementsByName("client_type_pouvoir_public_id") && document.getElementsByName("client_type_pouvoir_public_id")[0]) { + document.getElementsByName("client_type_pouvoir_public_id")[0].value = ""; + } + + + + if (document.getElementsByName("client_tva")) { + document.getElementsByName("client_tva")[0].value = ""; + } + + if (document.getElementsByName("client_website")) { + document.getElementsByName("client_website")[0].value = ""; + } + + if (document.getElementsByName("client_code_postal")) { + document.getElementsByName("client_code_postal")[0].value = ""; + } + + if (document.getElementsByName("client_comment")) { + document.getElementsByName("client_comment")[0].value = ""; + } + + if (document.getElementsByName("client_telephone")) { + document.getElementsByName("client_telephone")[0].value = ""; + } + + } + + function Disable_fields() { + if (document.getElementsByName("client_email") && document.getElementsByName("client_email")[0]) { + document.getElementsByName("client_email")[0].disabled = true; + document.getElementsByName("client_email")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("client_nom") && document.getElementsByName("client_nom")[0]) { + document.getElementsByName("client_nom")[0].disabled = true; + document.getElementsByName("client_nom")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("client_raison_sociale") && document.getElementsByName("client_raison_sociale")[0]) { + document.getElementsByName("client_raison_sociale")[0].disabled = true; + document.getElementsByName("client_raison_sociale")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("client_adresse") && document.getElementsByName("client_adresse")[0]) { + document.getElementsByName("client_adresse")[0].disabled = true; + document.getElementsByName("client_adresse")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("client_ville") && document.getElementsByName("client_ville")[0]) { + document.getElementsByName("client_ville")[0].disabled = true; + document.getElementsByName("client_ville")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("client_pays") && document.getElementsByName("client_pays")[0]) { + document.getElementsByName("client_pays")[0].disabled = true; + document.getElementsByName("client_pays")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("client_email") && document.getElementsByName("client_pays")[0]) { + document.getElementsByName("client_email")[0].disabled = true; + document.getElementsByName("client_email")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("client_siret") && document.getElementsByName("client_pays")[0]) { + document.getElementsByName("client_siret")[0].disabled = true; + document.getElementsByName("client_siret")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("client_type_id") && document.getElementsByName("client_type_id")[0]) { + document.getElementsByName("client_type_id")[0].disabled = true; + document.getElementsByName("client_type_id")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("client_groupe_id") && document.getElementsByName("client_groupe_id")[0]) { + document.getElementsByName("client_groupe_id")[0].disabled = true; + document.getElementsByName("client_groupe_id")[0].style.backgroundColor = "#ECEFF1"; + } + + + if (document.getElementsByName("client_type_financeur_id") && document.getElementsByName("client_type_financeur_id")[0]) { + document.getElementsByName("client_type_financeur_id")[0].disabled = true; + document.getElementsByName("client_type_financeur_id")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("client_type_pouvoir_public_id") && document.getElementsByName("client_type_pouvoir_public_id")[0]) { + document.getElementsByName("client_type_pouvoir_public_id")[0].disabled = true; + document.getElementsByName("client_type_pouvoir_public_id")[0].style.backgroundColor = "#ECEFF1"; + } + + + + if (document.getElementsByName("client_tva") && document.getElementsByName("client_tva")[0]) { + document.getElementsByName("client_tva")[0].disabled = true; + document.getElementsByName("client_tva")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("client_website") && document.getElementsByName("client_website")[0]) { + document.getElementsByName("client_website")[0].disabled = true; + document.getElementsByName("client_website")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("client_code_postal") && document.getElementsByName("client_code_postal")[0]) { + document.getElementsByName("client_code_postal")[0].disabled = true; + document.getElementsByName("client_code_postal")[0].style.backgroundColor = "#ECEFF1"; + } + + + if (document.getElementsByName("client_comment") && document.getElementsByName("client_comment")[0]) { + document.getElementsByName("client_comment")[0].disabled = true; + document.getElementsByName("client_comment")[0].style.backgroundColor = "#ECEFF1"; + } + + + if (document.getElementsByName("client_telephone") && document.getElementsByName("client_telephone")[0]) { + document.getElementsByName("client_telephone")[0].disabled = true; + document.getElementsByName("client_telephone")[0].style.backgroundColor = "#ECEFF1"; + } + + + + } + + function Enable_fields() { + if (document.getElementsByName("client_email")) { + document.getElementsByName("client_email")[0].disabled = false; + document.getElementsByName("client_email")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("client_nom")) { + document.getElementsByName("client_nom")[0].disabled = false; + document.getElementsByName("client_nom")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("client_raison_sociale")) { + document.getElementsByName("client_raison_sociale")[0].disabled = false; + document.getElementsByName("client_raison_sociale")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("client_adresse")) { + document.getElementsByName("client_adresse")[0].disabled = false; + document.getElementsByName("client_adresse")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("client_ville")) { + document.getElementsByName("client_ville")[0].disabled = false; + document.getElementsByName("client_ville")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("client_pays")) { + document.getElementsByName("client_pays")[0].disabled = false; + document.getElementsByName("client_pays")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("client_email")) { + document.getElementsByName("client_email")[0].disabled = false; + document.getElementsByName("client_email")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("client_siret")) { + document.getElementsByName("client_siret")[0].disabled = false; + document.getElementsByName("client_siret")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("client_type_id") && document.getElementsByName("client_type_id")[0]) { + document.getElementsByName("client_type_id")[0].disabled = false; + document.getElementsByName("client_type_id")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("client_groupe_id") && document.getElementsByName("client_groupe_id")[0]) { + document.getElementsByName("client_groupe_id")[0].disabled = false; + document.getElementsByName("client_groupe_id")[0].style.backgroundColor = "#FFFFFF"; + } + + + if (document.getElementsByName("client_type_financeur_id") && document.getElementsByName("client_type_financeur_id")[0]) { + document.getElementsByName("client_type_financeur_id")[0].disabled = false; + document.getElementsByName("client_type_financeur_id")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("client_type_pouvoir_public_id") && document.getElementsByName("client_type_pouvoir_public_id")[0]) { + document.getElementsByName("client_type_pouvoir_public_id")[0].disabled = false; + document.getElementsByName("client_type_pouvoir_public_id")[0].style.backgroundColor = "#FFFFFF"; + } + + + + if (document.getElementsByName("client_tva")) { + document.getElementsByName("client_tva")[0].disabled = false; + document.getElementsByName("client_tva")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("client_website")) { + document.getElementsByName("client_website")[0].disabled = false; + document.getElementsByName("client_website")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("client_code_postal")) { + document.getElementsByName("client_code_postal")[0].disabled = false; + document.getElementsByName("client_code_postal")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("client_comment")) { + document.getElementsByName("client_comment")[0].disabled = false; + document.getElementsByName("client_comment")[0].style.backgroundColor = "#FFFFFF"; + } + + + if (document.getElementsByName("client_telephone")) { + document.getElementsByName("client_telephone")[0].disabled = false; + document.getElementsByName("client_telephone")[0].style.backgroundColor = "#FFFFFF"; + } + + + } + + + async function Disable_contact_fields() { + + await sleep(5); + + if (document.getElementsByName("contact_email")) { + document.getElementsByName("contact_email")[0].disabled = true; + document.getElementsByName("contact_email")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("contact_nom")) { + document.getElementsByName("contact_nom")[0].disabled = true; + document.getElementsByName("contact_nom")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("contact_prenom")) { + document.getElementsByName("contact_prenom")[0].disabled = true; + document.getElementsByName("contact_prenom")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("contact_fonction")) { + document.getElementsByName("contact_fonction")[0].disabled = true; + document.getElementsByName("contact_fonction")[0].style.backgroundColor = "#ECEFF1"; + } + + + if (document.getElementsByName("contact_civilite")) { + document.getElementsByName("contact_civilite")[0].disabled = true; + document.getElementsByName("contact_civilite")[0].style.backgroundColor = "#ECEFF1"; + } + + + + if (document.getElementsByName("contact_siret")) { + document.getElementsByName("contact_siret")[0].disabled = true; + document.getElementsByName("contact_siret")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("contact_tva")) { + document.getElementsByName("contact_tva")[0].disabled = true; + document.getElementsByName("contact_tva")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("contact_adresse")) { + document.getElementsByName("contact_adresse")[0].disabled = true; + document.getElementsByName("contact_adresse")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("contact_ville")) { + document.getElementsByName("contact_ville")[0].disabled = true; + document.getElementsByName("contact_ville")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("contact_code_postal")) { + document.getElementsByName("contact_code_postal")[0].disabled = true; + document.getElementsByName("contact_code_postal")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("contact_pays")) { + document.getElementsByName("contact_pays")[0].disabled = true; + document.getElementsByName("contact_pays")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("contact_telephone")) { + document.getElementsByName("contact_telephone")[0].disabled = true; + document.getElementsByName("contact_telephone")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("contact_telephone_mobile")) { + document.getElementsByName("contact_telephone_mobile")[0].disabled = true; + document.getElementsByName("contact_telephone_mobile")[0].style.backgroundColor = "#ECEFF1"; + } + + } + + function Enable_contact_fields() { + if (document.getElementsByName("contact_email")) { + document.getElementsByName("contact_email")[0].disabled = false; + document.getElementsByName("contact_email")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("contact_nom")) { + document.getElementsByName("contact_nom")[0].disabled = false; + document.getElementsByName("contact_nom")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("contact_prenom")) { + document.getElementsByName("contact_prenom")[0].disabled = false; + document.getElementsByName("contact_prenom")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("contact_civilite")) { + document.getElementsByName("contact_civilite")[0].disabled = false; + document.getElementsByName("contact_civilite")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("contact_fonction")) { + document.getElementsByName("contact_fonction")[0].disabled = false; + document.getElementsByName("contact_fonction")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("contact_siret")) { + document.getElementsByName("contact_siret")[0].disabled = false; + document.getElementsByName("contact_siret")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("contact_tva")) { + document.getElementsByName("contact_tva")[0].disabled = false; + document.getElementsByName("contact_tva")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("contact_adresse")) { + document.getElementsByName("contact_adresse")[0].disabled = false; + document.getElementsByName("contact_adresse")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("contact_ville")) { + document.getElementsByName("contact_ville")[0].disabled = false; + document.getElementsByName("contact_ville")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("contact_code_postal")) { + document.getElementsByName("contact_code_postal")[0].disabled = false; + document.getElementsByName("contact_code_postal")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("contact_pays")) { + document.getElementsByName("contact_pays")[0].disabled = false; + document.getElementsByName("contact_pays")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("contact_telephone")) { + document.getElementsByName("contact_telephone")[0].disabled = false; + document.getElementsByName("contact_telephone")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("contact_telephone_mobile")) { + document.getElementsByName("contact_telephone_mobile")[0].disabled = false; + document.getElementsByName("contact_telephone_mobile")[0].style.backgroundColor = "#FFFFFF"; + } + + } + + + + + const [Add_New_PartnerClient_api, setAdd_New_PartnerClient_api] = useState(""); + const [Add_New_PartnerClient_result, setAdd_New_PartnerClient_result] = useState(""); + const [Add_New_PartnerClient_message, setAdd_New_PartnerClient_message] = useState(""); + function Add_New_PartnerClient(event) { + + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + + // Recupeation des données à enregister + + var client_email = "" + if (document.getElementsByName("client_email")) { + client_email = String(document.getElementsByName("client_email")[0].value).trim(); + } + var validRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/; + + + if (!client_email.match(validRegex)) { + // alert("L'adresse email est invalide."); + setdisplay_alert_mysy("1"); + setalert_message("L'adresse email est invalide."); + setalert_type("error"); + return; + } + + form.append("email", client_email); + + + var client_nom = "" + if (document.getElementsByName("client_nom")) { + client_nom = String(document.getElementsByName("client_nom")[0].value).trim(); + } + form.append("nom", client_nom); + if (String(client_nom).trim() === "") { + // alert("Le nom du client est invalide."); + setdisplay_alert_mysy("1"); + setalert_message("Le nom du client est invalide."); + setalert_type("error"); + return; + } + + + var client_raison_sociale = "" + if (document.getElementsByName("client_raison_sociale")) { + client_raison_sociale = document.getElementsByName("client_raison_sociale")[0].value; + } + form.append("raison_sociale", client_raison_sociale); + + form.append("is_company", p_client_is_company); + + var client_adresse = "" + if (document.getElementsByName("client_adresse")) { + client_adresse = document.getElementsByName("client_adresse")[0].value; + } + form.append("adr_adresse", client_adresse); + + var client_code_postal = "" + if (document.getElementsByName("client_code_postal")) { + client_code_postal = document.getElementsByName("client_code_postal")[0].value; + } + form.append("adr_code_postal", client_code_postal); + + + form.append("comment", p_client_comment); + + + var client_ville = "" + if (document.getElementsByName("client_ville")) { + client_ville = document.getElementsByName("client_ville")[0].value; + } + form.append("adr_ville", client_ville); + + var client_pays = "" + if (document.getElementsByName("client_pays")) { + client_pays = document.getElementsByName("client_pays")[0].value; + } + form.append("adr_pays", client_pays); + + + + var client_telephone = "" + if (document.getElementsByName("client_telephone")) { + client_telephone = document.getElementsByName("client_telephone")[0].value; + } + form.append("telephone", client_telephone); + + + var client_siret = "" + if (document.getElementsByName("client_siret")) { + client_siret = document.getElementsByName("client_siret")[0].value; + } + form.append("siret", client_siret); + + var client_tva = "" + if (document.getElementsByName("client_tva")) { + client_tva = document.getElementsByName("client_tva")[0].value; + } + form.append("tva", client_tva); + + var client_website = "" + if (document.getElementsByName("client_website")) { + client_website = document.getElementsByName("client_website")[0].value; + } + form.append("website", client_website); + + if (p_client_type_id) + form.append("client_type_id", p_client_type_id); + else + form.append("client_type_id", ""); + + if (p_client_goupe_client_id) + form.append("partner_groupe_client_id", p_client_goupe_client_id); + else + form.append("partner_groupe_client_id", ""); + + if (String(p_client_is_financeur) === "true") + form.append("is_financeur", "1"); + else + form.append("is_financeur", "0"); + + + if (String(p_client_is_fournisseur) === "true") + form.append("is_fournisseur", "1"); + else + form.append("is_fournisseur", "0"); + + + if (String(p_client_is_client) === "true") + form.append("is_client", "1"); + else + form.append("is_client", "0"); + + form.append("invoice_automatique", p_detail_facturation_automatique); + form.append("type_financeur_id", p_client_type_financeur); + + form.append("type_pouvoir_public_id", p_client_type_pouvoir_public); + + + form.append("client_facturation_id", p_detail_client_facturation_id); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Add_Partner_Client/"; + + axios.post(myurl, form).then(res => { + if (String(res.data.status) === String("true")) { + //console.log(" In Add_New_PartnerClient res.data.status = " + res.data.status); + // console.log(" In Add_New_PartnerClient res.data.message = " + res.data.message); + + props.display_child_alert_success(res.data.message); + + setAdd_New_PartnerClient_api("true"); + setAdd_New_PartnerClient_result(res.data.message); + setformedit_mode("0"); + setdatamodification("0"); + Disable_fields(); + + props.Get_List_Partner_Clients(); + props.father_scroll_to_top(); + props.close_detail_client(); + + // alert(res.data.message); + + + } + else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); + return; + } + else { + + setAdd_New_PartnerClient_api("false"); + setAdd_New_PartnerClient_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + + } + + + }).catch((error) => { + console.warn('Not good man :( Add_New_PartnerClient = ', error); + setAdd_New_PartnerClient_result("false"); + setAdd_New_PartnerClient_message(" Impossible de recuperer les informations du client") + alert(" Impossible de recuperer les informations du client"); + + }) + } + + function close_current_form() { + props.father_scroll_to_top(); + props.close_detail_client(); + } + + const [recordPartnerClient_api, setrecordPartnerClient_api] = useState(""); + const [recordPartnerClient_result, setrecordPartnerClient_result] = useState(""); + const [recordPartnerClient_message, setrecordPartnerClient_message] = useState(""); + function recordPartnerClient(event) { + + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + + form.append("_id", props.client_id); + + // Recupeation des données à enregister + + var client_email = "" + if (document.getElementsByName("client_email")) { + client_email = String(document.getElementsByName("client_email")[0].value).trim(); + } + var validRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/; + if (!client_email.match(validRegex)) { + // alert("L'adresse email est invalide."); + setdisplay_alert_mysy("1"); + setalert_message("L'adresse email est invalide."); + setalert_type("error"); + return; + } + + form.append("email", client_email); + + + var client_nom = "" + if (document.getElementsByName("client_nom")) { + client_nom = document.getElementsByName("client_nom")[0].value; + } + if (String(client_nom).trim() === "") { + // alert("Le nom du client est invalide."); + setdisplay_alert_mysy("1"); + setalert_message("Le nom du client est invalide."); + setalert_type("error"); + return; + } + + form.append("nom", client_nom); + + var client_raison_sociale = "" + if (document.getElementsByName("client_raison_sociale")) { + client_raison_sociale = document.getElementsByName("client_raison_sociale")[0].value; + } + form.append("raison_sociale", client_raison_sociale); + + + form.append("is_company", p_client_is_company); + + + var client_adresse = "" + if (document.getElementsByName("client_adresse")) { + client_adresse = document.getElementsByName("client_adresse")[0].value; + } + form.append("adr_adresse", client_adresse); + + var client_code_postal = "" + if (document.getElementsByName("client_code_postal")) { + client_code_postal = document.getElementsByName("client_code_postal")[0].value; + } + form.append("adr_code_postal", client_code_postal); + + form.append("comment", p_client_comment); + + var client_ville = "" + if (document.getElementsByName("client_ville")) { + client_ville = document.getElementsByName("client_ville")[0].value; + } + form.append("adr_ville", client_ville); + + var client_pays = "" + if (document.getElementsByName("client_pays")) { + client_pays = document.getElementsByName("client_pays")[0].value; + } + form.append("adr_pays", client_pays); + + + + var client_telephone = "" + if (document.getElementsByName("client_telephone")) { + client_telephone = document.getElementsByName("client_telephone")[0].value; + } + form.append("telephone", client_telephone); + + + var client_siret = "" + if (document.getElementsByName("client_siret")) { + client_siret = document.getElementsByName("client_siret")[0].value; + } + form.append("siret", client_siret); + + + + + var client_tva = "" + if (document.getElementsByName("client_tva")) { + client_tva = document.getElementsByName("client_tva")[0].value; + } + form.append("tva", client_tva); + + var client_website = "" + if (document.getElementsByName("client_website")) { + client_website = document.getElementsByName("client_website")[0].value; + } + form.append("website", client_website); + + if (p_client_type_id) + form.append("client_type_id", p_client_type_id); + else + form.append("client_type_id", ""); + + if (p_client_goupe_client_id) + form.append("partner_groupe_client_id", p_client_goupe_client_id); + else + form.append("partner_groupe_client_id", ""); + + + if (String(p_client_is_financeur) === "true") + form.append("is_financeur", "1"); + else + form.append("is_financeur", "0"); + + + if (String(p_client_is_fournisseur) === "true") + form.append("is_fournisseur", "1"); + else + form.append("is_fournisseur", "0"); + + + if (String(p_client_is_client) === "true") + form.append("is_client", "1"); + else + form.append("is_client", "0"); + + + form.append("type_financeur_id", p_client_type_financeur); + + form.append("type_pouvoir_public_id", p_client_type_pouvoir_public); + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Update_Partner_Client/"; + + axios.post(myurl, form).then(res => { + if (String(res.data.status) === String("true")) { + //console.log(" In recordPartnerClient res.data.status = " + res.data.status); + //console.log(" In recordPartnerClient res.data.message = " + res.data.message); + props.Get_List_Partner_Clients(); + setrecordPartnerClient_api("true"); + setrecordPartnerClient_result(res.data.message); + setformedit_mode("0"); + setdatamodification("0"); + fillfield(); + Disable_fields(); + // alert(res.data.message); + + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("success"); + + } + else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); + return; + } + else { + + setrecordPartnerClient_api("false"); + setrecordPartnerClient_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + + } + + + }).catch((error) => { + console.warn('Not good man :( recordPartnerClient = ', error); + setrecordPartnerClient_result("false"); + setrecordPartnerClient_message(" Impossible de recuperer les informations du client") + // alert(" Impossible de recuperer les informations du client"); + + setdisplay_alert_mysy("1"); + setalert_message("Impossible de recuperer les informations du client"); + setalert_type("error"); + + }) + } + + + // Fonction de mise à jour des données de facturation + const [recordPartnerClient_Invoice_Data_api, setrecordPartnerClient_Invoice_Data_api] = useState(""); + const [recordPartnerClient_Invoice_Data_result, setrecordPartnerClient_Invoice_Data_result] = useState(""); + const [recordPartnerClient_Invoice_Data_message, setrecordPartnerClient_Invoice_Data_message] = useState(""); + function recordPartnerClient_Invoice_Data(event) { + + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + + // Recupeation des données à enregister + form.append("email", p_client_email); + form.append("nom", p_client_nom); + + // Données de facturation + var client_invoice_email = p_client_invoice_email + + var validRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/; + + if (String(client_invoice_email) === "" || !client_invoice_email.match(validRegex)) { + // alert("L'adresse email de facturation est invalide."); + setdisplay_alert_mysy("1"); + setalert_message("L'adresse email de facturation est invalide."); + setalert_type("error"); + return; + } + + + if (String(p_client_invoice_paiement_condition_id).trim() === "") { + // alert(" Vous devez choisir une condition de paiement"); + setdisplay_alert_mysy("1"); + setalert_message(" Vous devez choisir une condition de paiement"); + setalert_type("error"); + return; + } + + + form.append("invoice_email", client_invoice_email); + + var client_invoice_nom = p_client_invoice_nom; + + form.append("invoice_nom", client_invoice_nom); + + var client_invoice_siret = p_client_invoice_siret; + + + form.append("invoice_siret", client_invoice_siret); + + var client_invoice_tva = p_client_invoice_tva; + + + form.append("invoice_tva", client_invoice_tva); + + form.append("invoice_condition_paiement_id", p_client_invoice_paiement_condition_id); + + + + var client_invoice_adresse = p_client_invoice_adresse; + + + form.append("invoice_adresse", client_invoice_adresse); + + var client_invoice_ville = p_client_invoice_ville; + + form.append("invoice_ville", client_invoice_ville); + + var client_invoice_code_postal = p_client_invoice_code_postal; + + + form.append("invoice_code_postal", client_invoice_code_postal); + + + var client_invoice_pays = p_client_invoice_pays; + + + form.append("invoice_pays", client_invoice_pays); + + + + form.append("invoice_automatique", p_detail_facturation_automatique); + + form.append("client_facturation_id", p_detail_client_facturation_id); + + form.append("_id", props.client_id); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Update_Partner_Client/"; + + axios.post(myurl, form).then(res => { + if (String(res.data.status) === String("true")) { + //console.log(" In recordPartnerClient_Invoice_Data res.data.status = " + res.data.status); + //console.log(" In recordPartnerClient_Invoice_Data res.data.message = " + res.data.message); + setrecordPartnerClient_Invoice_Data_api("true"); + setrecordPartnerClient_Invoice_Data_result(res.data.message); + setformedit_mode_invoice("0"); + setdatamodification_invoice("0"); + // alert(" Les données de facturation ont été mises à jour.") + Disable_invoice_fields(); + sethas_client_invoice_email(""); + // alert(res.data.message); + + + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("success"); + + + } + else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); + return; + } + else { + + setrecordPartnerClient_Invoice_Data_api("false"); + setrecordPartnerClient_Invoice_Data_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + + } + + + }).catch((error) => { + console.warn('Not good man :( recordPartnerClient_Invoice_Data = ', error); + setrecordPartnerClient_Invoice_Data_result("false"); + setrecordPartnerClient_Invoice_Data_message(" Impossible de recuperer les informations du client") + // alert(" Impossible de recuperer les informations du client"); + setdisplay_alert_mysy("1"); + setalert_message(" Impossible de recuperer les informations du client"); + setalert_type("error"); + + }) + } + + function clear_invoice_fields() { + if (document.getElementsByName("client_invoice_email")) { + document.getElementsByName("client_invoice_email")[0].value = ""; + } + + if (document.getElementsByName("client_invoice_nom")) { + document.getElementsByName("client_invoice_nom")[0].value = ""; + } + + if (document.getElementsByName("client_invoice_siret")) { + document.getElementsByName("client_invoice_siret")[0].value = ""; + } + + if (document.getElementsByName("client_invoice_tva")) { + document.getElementsByName("client_invoice_tva")[0].value = ""; + } + + if (document.getElementsByName("client_invoice_adresse")) { + document.getElementsByName("client_invoice_adresse")[0].value = ""; + } + + + if (document.getElementsByName("client_invoice_paiement_condition")) { + document.getElementsByName("client_invoice_paiement_condition")[0].value = ""; + } + + + if (document.getElementsByName("client_invoice_ville")) { + document.getElementsByName("client_invoice_ville")[0].value = ""; + } + + if (document.getElementsByName("client_invoice_code_postal")) { + document.getElementsByName("client_invoice_code_postal")[0].value = ""; + } + + if (document.getElementsByName("client_invoice_pays")) { + document.getElementsByName("client_invoice_pays")[0].value = ""; + } + + } + + function Disable_invoice_fields() { + if (document.getElementsByName("client_invoice_email")) { + document.getElementsByName("client_invoice_email")[0].disabled = true; + document.getElementsByName("client_invoice_email")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("client_invoice_nom")) { + document.getElementsByName("client_invoice_nom")[0].disabled = true; + document.getElementsByName("client_invoice_nom")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("field_client_facture_id") && document.getElementsByName("field_client_facture_id")[0]) { + document.getElementsByName("field_client_facture_id")[0].disabled = true; + document.getElementsByName("field_client_facture_id")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("client_invoice_siret")) { + document.getElementsByName("client_invoice_siret")[0].disabled = true; + document.getElementsByName("client_invoice_siret")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("client_invoice_tva")) { + document.getElementsByName("client_invoice_tva")[0].disabled = true; + document.getElementsByName("client_invoice_tva")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("client_invoice_paiement_condition")) { + console.log(" client_invoice_paiement_condition") + // document.getElementsByName("client_invoice_paiement_condition")[0].disabled = true; + document.getElementsByName("client_invoice_paiement_condition")[0].style.backgroundColor = "#ECEFF1"; + console.log(" client_invoice_paiement_condition 022") + } + + if (document.getElementsByName("client_invoice_adresse")) { + document.getElementsByName("client_invoice_adresse")[0].disabled = true; + document.getElementsByName("client_invoice_adresse")[0].style.backgroundColor = "#ECEFF1"; + } + + + if (document.getElementsByName("client_invoice_ville")) { + document.getElementsByName("client_invoice_ville")[0].disabled = true; + document.getElementsByName("client_invoice_ville")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("client_invoice_code_postal")) { + document.getElementsByName("client_invoice_code_postal")[0].disabled = true; + document.getElementsByName("client_invoice_code_postal")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("client_invoice_pays")) { + document.getElementsByName("client_invoice_pays")[0].disabled = true; + document.getElementsByName("client_invoice_pays")[0].style.backgroundColor = "#ECEFF1"; + //console.log("iiiiii"); + } + + if (document.getElementsByName("facturation_automatique")) { + document.getElementsByName("facturation_automatique")[0].disabled = true; + document.getElementsByName("facturation_automatique")[0].style.backgroundColor = "#ECEFF1"; + + } + + + } + + function Enable_invoice_fields() { + if (document.getElementsByName("client_invoice_email")) { + document.getElementsByName("client_invoice_email")[0].disabled = false; + document.getElementsByName("client_invoice_email")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("client_invoice_nom")) { + document.getElementsByName("client_invoice_nom")[0].disabled = false; + document.getElementsByName("client_invoice_nom")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("field_client_facture_id")) { + document.getElementsByName("field_client_facture_id")[0].disabled = false; + document.getElementsByName("field_client_facture_id")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("client_invoice_siret")) { + document.getElementsByName("client_invoice_siret")[0].disabled = false; + document.getElementsByName("client_invoice_siret")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("client_invoice_tva")) { + document.getElementsByName("client_invoice_tva")[0].disabled = false; + document.getElementsByName("client_invoice_tva")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("client_invoice_paiement_condition")) { + // document.getElementsByName("client_invoice_paiement_condition")[0].disabled = false; + document.getElementsByName("client_invoice_paiement_condition")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("client_invoice_adresse")) { + document.getElementsByName("client_invoice_adresse")[0].disabled = false; + document.getElementsByName("client_invoice_adresse")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("client_invoice_ville")) { + document.getElementsByName("client_invoice_ville")[0].disabled = false; + document.getElementsByName("client_invoice_ville")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("client_invoice_code_postal")) { + document.getElementsByName("client_invoice_code_postal")[0].disabled = false; + document.getElementsByName("client_invoice_code_postal")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("client_invoice_pays")) { + document.getElementsByName("client_invoice_pays")[0].disabled = false; + document.getElementsByName("client_invoice_pays")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("facturation_automatique")) { + document.getElementsByName("facturation_automatique")[0].disabled = false; + document.getElementsByName("facturation_automatique")[0].style.backgroundColor = "#FFFFFF"; + } + } + + function close_detail_client() { + props.close_detail_client(); + } + + function retour_liste_contact() { + setaddcontact("0"); + setdatamodification_contact('0'); + } + + + function clean_contact_set_values() { + setp_contact_email(""); + setp_contact_nom(""); + setp_contact_prenom(""); + setcontact_siret(""); + setcontact_tva(""); + setcontact_adresse(""); + setcontact_ville(""); + setcontact_code_postal(""); + setcontact_pays(""); + + setcontact_telephone(""); + setp_contact_telephone_mobile(""); + + setp_contact_fonction(""); + setp_contact_civilite("neutre"); + + } + + function clear_contact_fields() { + if (document.getElementsByName("contact_email")) { + document.getElementsByName("contact_email")[0].value = ""; + } + + if (document.getElementsByName("contact_nom")) { + document.getElementsByName("contact_nom")[0].value = ""; + } + + if (document.getElementsByName("contact_prenom")) { + document.getElementsByName("contact_prenom")[0].value = ""; + } + + if (document.getElementsByName("contact_siret")) { + document.getElementsByName("contact_siret")[0].value = ""; + } + + if (document.getElementsByName("contact_tva")) { + document.getElementsByName("contact_tva")[0].value = ""; + } + + if (document.getElementsByName("contact_adresse")) { + document.getElementsByName("contact_adresse")[0].value = ""; + } + + if (document.getElementsByName("contact_ville")) { + document.getElementsByName("contact_ville")[0].value = ""; + } + + if (document.getElementsByName("contact_code_postal")) { + document.getElementsByName("contact_code_postal")[0].value = ""; + } + + if (document.getElementsByName("contact_pays")) { + document.getElementsByName("contact_pays")[0].value = ""; + } + + if (document.getElementsByName("contact_telephone")) { + document.getElementsByName("contact_telephone")[0].value = ""; + } + + if (document.getElementsByName("contact_telephone_mobile")) { + document.getElementsByName("contact_telephone_mobile")[0].value = ""; + } + + } + + // Fonction de mise à jour des données de facturation + const [recordPartnerClient_Contact_Data_api, setrecordPartnerClient_Contact_Data_api] = useState(""); + const [recordPartnerClient_Contact_Data_result, setrecordPartnerClient_Contact_Data_result] = useState(""); + const [recordPartnerClient_Contact_Data_message, setrecordPartnerClient_Contact_Data_message] = useState(""); + function recordPartnerClient_Contact_Data(event) { + + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + + // Recupeation des données à enregister + + var myurl = ""; + if (current_contact_recid && String(current_contact_recid).length > 3) { + // Il s'agit d'un mise à jour. on a une valeur dans le current_activite_recid + myurl = process.env.REACT_APP_API_URL + "myclass/api/Update_Contact/"; + form.append("_id", selected_contact_id); + + } else { + // Il s'agit d'un ajout d'une nouvelle activité. on a rien dans le current_activite_recid + myurl = process.env.REACT_APP_API_URL + "myclass/api/Add_Contact/"; + form.append("related_collection", "partner_client"); + form.append("related_collection_owner_id", props.client_id); + } + + + //console.log(" ### current_contact_recid = ", current_contact_recid, " myurl = ", myurl) + + // Données de contact du client du partner + var contact_email = "" + if (document.getElementsByName("contact_email")) { + contact_email = String(document.getElementsByName("contact_email")[0].value).trim(); + } + + // Pour activier la fontion de "include com", le contact foit avoir une adresse email + var validRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/; + + if (!contact_email.match(validRegex)) { + // alert("L'adresse email est invalide. Pour créer un contact l'adresse email est obligatoire"); + setdisplay_alert_mysy("1"); + setalert_message("L'adresse email est invalide. Pour créer un contact l'adresse email est obligatoire"); + setalert_type("error"); + + return; + } + + form.append("email", contact_email); + + var contact_nom = "" + if (document.getElementsByName("contact_nom")) { + contact_nom = String(document.getElementsByName("contact_nom")[0].value).trim(); + } + form.append("nom", contact_nom); + if (contact_nom.length < 2) { + // alert("Le nom du contact est invalide "); + setdisplay_alert_mysy("1"); + setalert_message("Le nom du contact est invalide "); + setalert_type("error"); + + return; + } + + + var contact_prenom = "" + if (document.getElementsByName("contact_prenom")) { + contact_prenom = document.getElementsByName("contact_prenom")[0].value; + } + form.append("prenom", contact_prenom); + + + var contact_fonction = "" + if (document.getElementsByName("contact_fonction")) { + contact_fonction = document.getElementsByName("contact_fonction")[0].value; + } + form.append("fonction", contact_fonction); + + var contact_civilite = "neutre" + if (p_contact_civilite) { + contact_civilite = p_contact_civilite; + } + form.append("civilite", contact_civilite); + + + + var contact_siret = "" + if (document.getElementsByName("contact_siret")) { + contact_siret = document.getElementsByName("contact_siret")[0].value; + } + form.append("siret", contact_siret); + + var contact_tva = "" + if (document.getElementsByName("contact_tva")) { + contact_tva = document.getElementsByName("contact_tva")[0].value; + } + form.append("tva", contact_tva); + + var contact_adresse = "" + if (document.getElementsByName("contact_adresse")) { + contact_adresse = document.getElementsByName("contact_adresse")[0].value; + } + form.append("adr_adresse", contact_adresse); + + var contact_ville = "" + if (document.getElementsByName("contact_ville")) { + contact_ville = document.getElementsByName("contact_ville")[0].value; + } + form.append("adr_ville", contact_ville); + + + var contact_code_postal = "" + if (document.getElementsByName("contact_code_postal")) { + contact_code_postal = document.getElementsByName("contact_code_postal")[0].value; + } + form.append("adr_code_postal", contact_code_postal); + + + var contact_pays = "" + if (document.getElementsByName("contact_pays")) { + contact_pays = document.getElementsByName("contact_pays")[0].value; + } + form.append("adr_pays", contact_pays); + + var include_com = "0" + if (is_contact_include_com) { + include_com = "1"; + setclient_has_communication_contact(""); + } + form.append("include_com", include_com); + + + var contact_telephone = "" + if (document.getElementsByName("contact_telephone")) { + contact_telephone = document.getElementsByName("contact_telephone")[0].value; + } + form.append("telephone", contact_telephone); + + + var contact_telephone_mobile = "" + if (document.getElementsByName("contact_telephone_mobile")) { + contact_telephone_mobile = document.getElementsByName("contact_telephone_mobile")[0].value; + } + form.append("telephone_mobile", contact_telephone_mobile); + + + axios.post(myurl, form).then(res => { + if (String(res.data.status) === String("true")) { + //console.log(" In recordPartnerClient_Contact_Data res.data.status = " + res.data.status); + //console.log(" In recordPartnerClient_Contact_Data res.data.message = " + res.data.message); + setrecordPartnerClient_Contact_Data_api("true"); + setrecordPartnerClient_Contact_Data_result(res.data.message); + Get_List_Contact_Of_client_Part(); + + setaddcontact("0"); + setdatamodification_contact(""); + setis_contact_include_com(false) + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("success"); + + + } + else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); + return; + } + else { + + setrecordPartnerClient_Contact_Data_api("false"); + setrecordPartnerClient_Contact_Data_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + + } + + + }).catch((error) => { + console.warn('Not good man :( recordPartnerClient_Contact_Data = ', error); + setrecordPartnerClient_Contact_Data_result("false"); + setrecordPartnerClient_Contact_Data_message(" Impossible d'enregistrer les doonées du contact") + // alert(" Impossible d'enregistrer les doonées du contact"); + setdisplay_alert_mysy("1"); + setalert_message(" Impossible d'enregistrer les doonées du contact"); + setalert_type("error"); + + + }) + } + + + const [Display_Part_Client_Contact_api, setDisplay_Part_Client_Contact_api] = useState(""); + const [Display_Part_Client_Contact_result, setDisplay_Part_Client_Contact_result] = useState(""); + const [Display_Part_Client_Contact_message, setDisplay_Part_Client_Contact_message] = useState(""); + function Display_Part_Client_Contact(event) { + + + var form = new FormData(); + + var contactmail = event.currentTarget.getAttribute('contactmail'); + + var contact_id = event.currentTarget.getAttribute('contact_id'); + + setelected_contact_id(contact_id); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("_id", contact_id); + + // Recupeation des données à enregister + form.append("related_collection", "partner_client"); + form.append("related_collection_owner_id", props.client_id); + + //console.log(" ### contactmail = ", contactmail); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Given_Contact/"; + + axios.post(myurl, form).then(res => { + if (String(res.data.status) === String("true")) { + //console.log(" In Display_Part_Client_Contact res.data.status = " + res.data.status); + //console.log(" In Display_Part_Client_Contact res.data.message = " + res.data.message); + setDisplay_Part_Client_Contact_api("true"); + setDisplay_Part_Client_Contact_result(res.data.message); + Get_List_Contact_Of_client_Part(); + + setaddcontact("1"); + var mylocalclient_contact = JSON.parse(res.data.message); + + + if (mylocalclient_contact) { + + // Remplissage des doonées du contact + if (mylocalclient_contact.nom) + setp_contact_nom(mylocalclient_contact.nom); + else + setp_contact_nom(""); + + if (mylocalclient_contact.email) + setp_contact_email(mylocalclient_contact.email); + else + setp_contact_email(""); + + if (mylocalclient_contact.prenom) + setp_contact_prenom(mylocalclient_contact.prenom); + else + setp_contact_prenom(""); + + + setis_contact_include_com(false); + if (mylocalclient_contact.include_com) { + + if (String(mylocalclient_contact.include_com) === "1") + setis_contact_include_com(true); + } + + + + if (mylocalclient_contact.siret) + setcontact_siret(mylocalclient_contact.siret); + else + setcontact_siret(""); + + + if (mylocalclient_contact.tva) + setcontact_tva(mylocalclient_contact.tva); + else + setcontact_tva(""); + + + if (mylocalclient_contact.adr_adresse) + setcontact_adresse(mylocalclient_contact.adr_adresse); + else + setcontact_adresse(""); + + if (mylocalclient_contact.adr_ville) + setcontact_ville(mylocalclient_contact.adr_ville); + else + setcontact_ville(""); + + if (mylocalclient_contact.adr_code_postal) + setcontact_code_postal(mylocalclient_contact.adr_code_postal); + else + setcontact_code_postal(""); + + if (mylocalclient_contact.adr_pays) + setcontact_pays(mylocalclient_contact.adr_pays); + else + setcontact_pays(""); + + if (mylocalclient_contact.telephone) + setcontact_telephone(mylocalclient_contact.telephone); + else + setcontact_telephone(""); + + if (mylocalclient_contact.telephone_mobile) + setp_contact_telephone_mobile(mylocalclient_contact.telephone_mobile); + else + setp_contact_telephone_mobile(""); + + + if (mylocalclient_contact.fonction) + setp_contact_fonction(mylocalclient_contact.fonction); + else + setp_contact_fonction(""); + + if (mylocalclient_contact.civilite) + setp_contact_civilite(mylocalclient_contact.civilite); + else + setp_contact_civilite("neutre"); + + + + + if (mylocalclient_contact.recid) + setcurrent_contact_recid(mylocalclient_contact.recid); + else + setcurrent_contact_recid(""); + + } + + + Disable_contact_fields(); + setformedit_mode_contact("0"); + + } + else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); + return; + } + else { + + setDisplay_Part_Client_Contact_api("false"); + setDisplay_Part_Client_Contact_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + + } + + + }).catch((error) => { + console.warn('Not good man :( Display_Part_Client_Contact = ', error); + setDisplay_Part_Client_Contact_result("false"); + setDisplay_Part_Client_Contact_message(" Impossible de recuperer les detail du contact") + alert(" Impossible de recuperer les details du contact"); + + }) + } + + + const [Delete_Part_Client_Contact_api, setDelete_Part_Client_Contact_api] = useState(""); + const [Delete_Part_Client_Contact_result, setDelete_Part_Client_Contact_result] = useState(""); + const [Delete_Part_Client_Contact_message, setDelete_Part_Client_Contact_message] = useState(""); + function Delete_Part_Client_Contact(event) { + + + var form = new FormData(); + + var contactmail = event.currentTarget.getAttribute('contactmail'); + + var contact_id = event.currentTarget.getAttribute('contact_id'); + + setelected_contact_id(contact_id); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("_id", contact_id); + + form.append("related_collection", "partner_client"); + form.append("related_collection_owner_id", props.client_id); + + //console.log(" ### contactmail = ", contactmail); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Delete_Given_Contact/"; + + axios.post(myurl, form).then(res => { + if (String(res.data.status) === String("true")) { + //console.log(" In Delete_Part_Client_Contact res.data.status = " + res.data.status); + //console.log(" In Delete_Part_Client_Contact res.data.message = " + res.data.message); + setDelete_Part_Client_Contact_api("true"); + setDelete_Part_Client_Contact_result(res.data.message); + Get_List_Contact_Of_client_Part(); + + + } + else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); + return; + } + else { + + setDelete_Part_Client_Contact_api("false"); + setDelete_Part_Client_Contact_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + + } + + + }).catch((error) => { + console.warn('Not good man :( Delete_Part_Client_Contact = ', error); + setDelete_Part_Client_Contact_result("false"); + setDelete_Part_Client_Contact_message(" Impossible de recuperer les detail du contact") + alert(" Impossible de supprimer le contact"); + + }) + } + const [is_contact_include_com, setis_contact_include_com] = useState(false); + + const New_civilite = [ + { "id": "mme", "label": "Mme", "value": "mme" }, + { "id": "m", "label": "M", "value": "m" }, + { "id": "neutre", "label": "Neutre", "value": "neutre" }, + { "id": "", "label": "", "value": "" }, + ] + + const New_Option_Facturation_Automatique = [ + { "id": "mois", "label": "Mensuelle", "value": "mois" }, + { "id": "0", "label": "Facturation Manuelle", "value": "0" }, + + { "id": "", "label": "", "value": "" }, + ] + + const [p_detail_facturation_automatique, setp_detail_facturation_automatique] = useState(""); + + const [p_detail_client_facturation_id, setp_detail_client_facturation_id] = useState(""); + + const [p_client_is_financeur, setp_client_is_financeur] = useState(false); + const [p_client_is_fournisseur, setp_client_is_fournisseur] = useState(false); + const [p_client_is_client, setp_client_is_client] = useState(true); + + const [isLoading, setLoading] = useState(); + + // -- Gestion pièces jointes + + const [Download_one_attached_document_api, setDownload_one_attached_document_api] = useState(); + const [Download_one_attached_document_result, setDownload_one_attached_document_result] = useState(); + const [Download_one_attached_document_message, setDownload_one_attached_document_message] = useState(); + const Download_one_attached_document = (event) => { + const stored_cookie = getCookie('tokenmysypart'); + + + var nom_fiche_detaillee = "Fiche_Detaillee.pdf"; + var token = stored_cookie; + var file_name = event.target.id; + + + var url = process.env.REACT_APP_API_URL + "myclass/api/Get_Stored_Downloaded_File/" + token + "/" + file_name; + setLoading(true); + + axios.get(url, { responseType: 'blob', },) + .then((res) => { + setLoading(false); + fileDownload(res.data, nom_fiche_detaillee); + setDownload_one_attached_document_api("true"); + }).catch((error) => { + setLoading(false); + console.error('Error:', error); + setDownload_one_attached_document_api("false"); + + }); + } + + + const editorRef_competence = useRef(null); + const [editorRef_competence_limite, seteditorRef_competence_limite] = useState(800); + + + const [file_1_name, setfile_1_name] = useState(); + + const [sessions_file_change_1_api, setsessions_file_change_1_api] = useState(); + const [sessions_file_change_1_result, setsessions_file_change_1_result] = useState(); + const [sessions_file_change_1_message, setsessions_file_change_1_message] = useState(); + const sessions_file_change_1 = event => { + + const fileUploaded = event.target.files[0]; + let file_size = event.target.files[0].size; + let file_type = event.target.files[0].type; + + + if (file_size > 10000000) { + // alert("Le fichier ne doit pas depasser un 1 Méga octets"); + setdisplay_alert_mysy("1"); + setalert_message("Le fichier ne doit pas depasser un 1 Méga octets"); + setalert_type("error"); + + // console.log("Le fichier ne doit pas depasser un 1 Méga octets"); + return; + } + + setfile_1_name(event.target.files[0]); + const formData = new FormData(); + formData.append('File', fileUploaded); + //formData.append('token', 'K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA'); + const stored_cookie = getCookie('tokenmysypart'); + + //formData.append("token", stored_cookie); + //formData.append("class_internal_url", internal_url); + //console.log("token = " + stored_cookie); + + return; + + }; + + + const [file_2_name, setfile_2_name] = useState(); + + const [sessions_file_change_2_api, setsessions_file_change_2_api] = useState(); + const [sessions_file_change_2_result, setsessions_file_change_2_result] = useState(); + const [sessions_file_change_2_message, setsessions_file_change_2_message] = useState(); + const sessions_file_change_2 = event => { + + const fileUploaded = event.target.files[0]; + let file_size = event.target.files[0].size; + let file_type = event.target.files[0].type; + + + + if (file_size > 10000000) { + // alert("Le fichier ne doit pas depasser un 1 Méga octets"); + setdisplay_alert_mysy("1"); + setalert_message("Le fichier ne doit pas depasser un 1 Méga octets"); + setalert_type("error"); + + // console.log("Le fichier ne doit pas depasser un 1 Méga octets"); + return; + } + + setfile_2_name(event.target.files[0]); + const formData = new FormData(); + formData.append('File', fileUploaded); + //formData.append('token', 'K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA'); + const stored_cookie = getCookie('tokenmysypart'); + + //formData.append("token", stored_cookie); + //formData.append("class_internal_url", internal_url); + //console.log("token = " + stored_cookie); + + return; + + fetch( + process.env.REACT_APP_API_URL + "myclass/api/Add_Update_SessionFormation_mass/", + { + method: 'POST', + body: formData, + } + ) + .then((response) => response.json()) + .then((result) => { + + //console.log(" ## result['status'] = ", result['status']) + if (String(result['status']) === String("true")) { + //console.log('Success:', result['message']); + setsessions_file_change_2_result(result['message']); + setsessions_file_change_2_api("true"); + //GetCurrentClass_trainingsession(); + + } + else { + setsessions_file_change_2_message(result['message']); + setsessions_file_change_2_api("false"); + } + + }) + .catch((error) => { + console.error('Error:', error); + setsessions_file_change_2_api("false"); + }); + }; + + const [Record_All_PJ_api, setRecord_All_PJ_api] = useState(); + const [Record_All_PJ_result, setRecord_All_PJ_result] = useState(); + const [Record_All_PJ_message, setRecord_All_PJ_message] = useState(); + function Record_All_PJ() { + + if (!p_detail_one_file_to_download_type_name) { + // alert(" Vous devez donner un nom à la pièce jointe"); + setdisplay_alert_mysy("1"); + setalert_message(" Vous devez donner un nom à la pièce jointe"); + setalert_type("error"); + + return; + } + + if (file_1_name && file_1_name.name) { + + + const formData = new FormData(); + formData.append('File', file_1_name); + //formData.append('token', 'K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA'); + const stored_cookie = getCookie('tokenmysypart'); + + formData.append("token", stored_cookie); + formData.append("file_business_object", p_detail_one_file_to_download_type_name); + formData.append("file_name", file_1_name.name); + formData.append("status", "0"); + formData.append("object_owner_collection", "partner_client"); + formData.append("object_owner_id", props.client_id); + formData.append("type_document", ""); + + //formData.append("class_internal_url", internal_url); + //console.log("token = " + stored_cookie); + + + fetch( + process.env.REACT_APP_API_URL + "myclass/api/Store_User_Downloaded_File/", + { + method: 'POST', + body: formData, + } + ) + .then((response) => response.json()) + .then((result) => { + + //console.log(" ## result['status'] = ", result['status']) + if (String(result['status']) === String("true")) { + //console.log('Success:', result['message']); + setRecord_All_PJ_result(result['message']); + setRecord_All_PJ_api("true"); + + Get_List_Of_All_PJ(props.client_id); + setfile_1_name(); + setp_detail_one_file_to_download_type_name(); + //GetCurrentClass_trainingsession(); + // alert(" La pièce jointe " + file_1_name.name + " a été bien enregistrée") + var txt = "La pièce jointe " + file_1_name.name + " a été bien enregistrée"; + setdisplay_alert_mysy("1"); + setalert_message(txt); + setalert_type("success"); + + } + else { + setRecord_All_PJ_message(result['message']); + setRecord_All_PJ_api("false"); + } + + }) + .catch((error) => { + console.error(' Record_All_PJ Error:', error); + setRecord_All_PJ_api("false"); + }); + + } + + if (file_2_name && file_2_name.name) { + console.log(" ### Traitement de : ", file_2_name.name); + } + + } + + + const [Delete_one_attached_document_api, setDelete_one_attached_document_api] = useState(); + const [Delete_one_attached_document_result, setDelete_one_attached_document_result] = useState(); + const [Delete_one_attached_document_message, setDelete_one_attached_document_message] = useState(); + const Delete_one_attached_document = (event) => { + const stored_cookie = getCookie('tokenmysypart'); + + var formData = new FormData(); + var nom_fiche_detaillee = "Fiche_Detaillee.pdf"; + var file_name = event.target.id; + + + formData.append("token", stored_cookie); + formData.append("file_name", file_name); + + var url = process.env.REACT_APP_API_URL + "myclass/api/Delete_Stored_Downloaded_File/"; + + + fetch( + process.env.REACT_APP_API_URL + "myclass/api/Delete_Stored_Downloaded_File/", + { + method: 'POST', + body: formData, + } + ) + .then((response) => response.json()) + .then((result) => { + + //console.log(" ## result['status'] = ", result['status']) + if (String(result['status']) === String("true")) { + //console.log('Success:', result['message']); + setDelete_one_attached_document_result(result['message']); + setDelete_one_attached_document_api("true"); + Get_List_Of_All_PJ(props.client_id); + // alert(result['message']) + + setdisplay_alert_mysy("1"); + setalert_message(result['message']); + setalert_type("success"); + + } + else { + setDelete_one_attached_document_message(result['message']); + setDelete_one_attached_document_api("false"); + } + + }) + .catch((error) => { + console.error(' Record_All_PJ Error:', error); + setDelete_one_attached_document_api("false"); + alert(" Impossible de supprimer le document") + + }); + + + } + + const [Get_List_Of_All_PJ_api, setGet_List_Of_All_PJ_api] = useState(); + const [Get_List_Of_All_PJ_result, setGet_List_Of_All_PJ_result] = useState(); + const [Get_List_Of_All_PJ_message, setGet_List_Of_All_PJ_message] = useState(); + function Get_List_Of_All_PJ(local_employee_id) { + + const formData = new FormData(); + + //formData.append('token', 'K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA'); + const stored_cookie = getCookie('tokenmysypart'); + + formData.append("token", stored_cookie); + formData.append("object_owner_collection", "partner_client"); + formData.append("object_owner_id", local_employee_id); + + + //formData.append("class_internal_url", internal_url); + //console.log("token = " + stored_cookie); + + + fetch( + process.env.REACT_APP_API_URL + "myclass/api/Get_List_object_owner_collection_Stored_Files/", + { + method: 'POST', + body: formData, + } + ) + .then((response) => response.json()) + .then((result) => { + + //console.log(" ## result['status'] = ", result['status']) + if (String(result['status']) === String("true")) { + //console.log('Message :', result['message']); + setGet_List_Of_All_PJ_result(result['message']); + setGet_List_Of_All_PJ_api("true"); + + } + else { + setGet_List_Of_All_PJ_message(result['message']); + setGet_List_Of_All_PJ_api("false"); + } + + }) + .catch((error) => { + console.error(' Get_List_Of_All_PJ Error:', error); + setGet_List_Of_All_PJ_api("false"); + }); + + } + + + + function Delete_file_1_name() { + setfile_1_name(); + } + + function Delete_file_2_name() { + setfile_2_name(); + } + + const [p_detail_one_file_to_download_type_name, setp_detail_one_file_to_download_type_name] = useState(); + + // -- end gestion pièces jointes + + const [New_Get_List_Type_Financeur_result, setNew_Get_List_Type_Financeur_result] = useState([]); + + const [Get_List_Type_Financeur_api, setGet_List_Type_Financeur_api] = useState(); + const [Get_List_Type_Financeur_message, setGet_List_Type_Financeur_message] = useState(); + const [Get_List_Type_Financeur_result, setGet_List_Type_Financeur_result] = useState(); + function Get_List_Type_Financeur() { + + var form = new FormData(); + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Type_Organisme_Financement/"; + + axios.post(myurl, form).then(res => { + + if (String(res.data.status) === "true") { + //console.log(" In Get_List_Type_Financeur res.data.status = " + res.data.status); + //console.log(" In Get_List_Type_Financeur res.data.message r_class = " + res.data.message); + setGet_List_Type_Financeur_api("true"); + setGet_List_Type_Financeur_result(res.data.message); + + var new_data2 = []; + const new_data = res.data.message.map((x) => { + + //--- + + var _id = JSON.parse(x)._id; + var code = JSON.parse(x).code; + var description = JSON.parse(x).description; + + + //--- + var node = { + "_id": _id, + "code": code, + "description": description, + "label": code, + }; + //console.log(" --- node = ", node); + new_data2.push(node); + }); + + var node = { + "_id": "", + "code": "", + "description": "", + "label": "", + }; + //console.log(" --- node = ", node); + new_data2.push(node); + if (new_data2.length > 0) + setNew_Get_List_Type_Financeur_result(new_data2); + } + else { + setGet_List_Type_Financeur_api("false"); + setGet_List_Type_Financeur_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + console.warn('Not good man :( Get_List_Type_Financeur = ', error); + setGet_List_Type_Financeur_api("false"); + alert(" Impossible de recuperer Get_List_Type_Financeur"); + //setmyApimyApiMessage("") + }) + } + + + const [New_Get_List_Type_Pouvoir_Public_result, setNew_Get_List_Type_Pouvoir_Public_result] = useState([]); + + const [Get_List_Type_Pouvoir_Public_api, setGet_List_Type_Pouvoir_Public_api] = useState(); + const [Get_List_Type_Pouvoir_Public_message, setGet_List_Type_Pouvoir_Public_message] = useState(); + const [Get_List_Type_Pouvoir_Public_result, setGet_List_Type_Pouvoir_Public_result] = useState(); + function Get_List_Type_Pouvoir_Public() { + + var form = new FormData(); + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Type_Pouvoir_Public/"; + + axios.post(myurl, form).then(res => { + + if (String(res.data.status) === "true") { + //console.log(" In Get_List_Type_Pouvoir_Public res.data.status = " + res.data.status); + //console.log(" In Get_List_Type_Pouvoir_Public res.data.message r_class = " + res.data.message); + setGet_List_Type_Pouvoir_Public_api("true"); + setGet_List_Type_Pouvoir_Public_result(res.data.message); + + var new_data2 = []; + const new_data = res.data.message.map((x) => { + + //--- + + var _id = JSON.parse(x)._id; + var code = JSON.parse(x).code; + var description = JSON.parse(x).description; + + + //--- + var node = { + "_id": _id, + "code": code, + "description": description, + "label": code + " - " + description, + }; + //console.log(" --- node = ", node); + new_data2.push(node); + }); + + var node = { + "_id": "", + "code": "", + "description": "", + "label": "", + }; + //console.log(" --- node = ", node); + new_data2.push(node); + if (new_data2.length > 0) + setNew_Get_List_Type_Pouvoir_Public_result(new_data2); + } + else { + setGet_List_Type_Pouvoir_Public_api("false"); + setGet_List_Type_Pouvoir_Public_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + console.warn('Not good man :( Get_List_Type_Pouvoir_Public = ', error); + setGet_List_Type_Pouvoir_Public_api("false"); + alert(" Impossible de recuperer Get_List_Type_Pouvoir_Public"); + //setmyApimyApiMessage("") + }) + } + + const [Dialog_mysy_intranet_account_open, setDialog_mysy_intranet_account_open] = React.useState(false); + const Dialog_mysy_intranet_account_handleClose = () => { + setp_new_pwd(""); + setp_conf_new_login(""); + setDialog_mysy_intranet_account_open(false) + }; + + const [p_new_login, setp_new_login] = React.useState(""); + const [p_new_pwd, setp_new_pwd] = React.useState(""); + const [p_conf_new_login, setp_conf_new_login] = React.useState(""); + + const [p_detail_user_login_locked, setp_detail_user_login_locked] = useState(""); + + const [p_detail_user_login, setp_detail_user_login] = useState(""); + + function Generate_Pwd() { + var randomstring = Math.random().toString(36).slice(-8); + setp_new_pwd(randomstring); + setp_conf_new_login(randomstring); + } + + const [currentpawdvisible, setcurrentpawdvisible] = useState(false); + + + const handleClickShowPassword = () => { + if (currentpawdvisible == false) { + document.getElementsByName("new_pwd011")[0].type = "text"; + document.getElementsByName("conf_new_login011")[0].type = "text"; + setcurrentpawdvisible(true); + } + else if (currentpawdvisible == true) { + document.getElementsByName("new_pwd011")[0].type = "password"; + document.getElementsByName("conf_new_login011")[0].type = "password"; + setcurrentpawdvisible(false); + } + }; + + const [Add_Update_Client_Intranet_Login_Pass_Data_api, setAdd_Update_Client_Intranet_Login_Pass_Data_api] = useState(); + const [Add_Update_Client_Intranet_Login_Pass_Data_message, setAdd_Update_Client_Intranet_Login_Pass_Data_message] = useState(); + const [Add_Update_Client_Intranet_Login_Pass_Data_result, setAdd_Update_Client_Intranet_Login_Pass_Data_result] = useState(); + function Add_Update_Client_Intranet_Login_Pass_Data() { + var form = new FormData(); + //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); + + // Controle sur les champs + + + if (p_new_pwd.trim() == "") { + // alert(" Vous devez saisir un mot de passe"); + setdisplay_alert_mysy("1"); + setalert_message(" Vous devez saisir un mot de passe"); + setalert_type("error"); + + return; + } + + + if (p_conf_new_login.trim() == "") { + // alert(" Vous devez confirmer le mot de passe"); + setdisplay_alert_mysy("1"); + setalert_message(" Vous devez confirmer le mot de passe"); + setalert_type("error"); + + return; + } + + + /*var validRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/; + if (!p_new_login.match(validRegex)) { + alert("L'adresse email est invalide."); + return; + }*/ + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("partner_client_id", props.client_id); + form.append("default_pwd", p_new_pwd); + // form.append("ressource_humaine_id", selected_id); + + + + //console.log(" form == ", form); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Create_Partner_Client_Intranet_Account/"; + + if (p_client_intranet_account_id && String(p_client_intranet_account_id).length > 3) { + // Il s'agit d'une mise à jour de mot de passe + myurl = process.env.REACT_APP_API_URL + "myclass/api/Update_Pwd_Partner_Client_Intranet_Account/"; + // console.log(" ### mise à jour INTRANET "); + + } + + setLoading(true); + axios.post(myurl, form).then(res => { + setLoading(false); + //console.log(" In Add_Update_Client_Intranet_Login_Pass_Data res.data.status = " + res.data.status); + //console.log(" In Add_Update_Client_Intranet_Login_Pass_Data res.data.message r_class = " + res.data.message); + + if (String(res.data.status) === String("true")) { + setAdd_Update_Client_Intranet_Login_Pass_Data_api("true"); + setAdd_Update_Client_Intranet_Login_Pass_Data_result(res.data.message); + + //setp_detail_user_login(p_new_login); + + Dialog_mysy_intranet_account_handleClose(); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("success"); + + setp_new_login(''); + setp_new_pwd(''); + setp_conf_new_login(''); + + } + else { + setAdd_Update_Client_Intranet_Login_Pass_Data_api("false"); + setAdd_Update_Client_Intranet_Login_Pass_Data_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 :( Add_Update_Client_Intranet_Login_Pass_Data = ' + error); + setAdd_Update_Client_Intranet_Login_Pass_Data_api("false"); + alert(" Impossible de créer ou mettre à jour le compte intranet "); + + }) + } + + + const [New_Get_All_Paiement_of_Client_result, setNew_Get_All_Paiement_of_Client_result] = useState([]); + + const [New_Get_All_Paiement_Total_Payed, setNew_Get_All_Paiement_Total_Payed] = useState(""); + + const [Get_All_Paiement_of_Client_api, setGet_All_Paiement_of_Client_api] = useState(); + const [Get_All_Paiement_of_Client_message, setGet_All_Paiement_of_Client_message] = useState(); + const [Get_All_Paiement_of_Client_result, setGet_All_Paiement_of_Client_result] = useState([]); + function Get_All_Paiement_of_Client(event) { + + var form = new FormData(); + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Invoice_Liste_Payement_And_Total_Amount/"; + + setLoading(true); + axios.post(myurl, form).then(res => { + + setLoading(false); + if (String(res.data.status) === String("true")) { + //console.log(" In Get_All_Paiement_of_Client res.data.status = " + res.data.status); + console.log(" In Get_All_Paiement_of_Client res.data.message r_class = " + res.data.message); + console.log(" In Get_All_Paiement_of_Client res.data.total_payed_amount r_class = " + res.data.total_payed_amount); + setGet_All_Paiement_of_Client_api("true"); + setGet_All_Paiement_of_Client_result(res.data.message); + setNew_Get_All_Paiement_Total_Payed(res.data.total_payed_amount); + + var new_data2 = []; + const new_data = res.data.message.map((x) => { + + var local_id = JSON.parse(x)._id; + var local_invoice_id = JSON.parse(x).invoice_id; + var local_paiement_amount = JSON.parse(x).paiement_amount; + var local_paiement_mode = JSON.parse(x).paiement_mode; + var local_paiement_ref = JSON.parse(x).paiement_ref; + var local_paiement_date = JSON.parse(x).paiement_date; + var local_commentaire = JSON.parse(x).commentaire; + + var local_client_id = JSON.parse(x).client_id; + var local_invoice_ref = JSON.parse(x).invoice_ref; + + + //--- + var node = { + "_id": local_id, + "invoice_id": local_invoice_id, + "paiement_amount": local_paiement_amount, + "paiement_mode": local_paiement_mode, + "paiement_ref": local_paiement_ref, + "paiement_date": local_paiement_date, + "commentaire": local_commentaire, + "client_id": local_client_id, + "invoice_ref": local_invoice_ref, + }; + new_data2.push(node); + }); + + if (new_data2.length > 0) { + setNew_Get_All_Paiement_of_Client_result(new_data2); + } else { + setNew_Get_All_Paiement_of_Client_result([]) + } + + } + else { + setGet_All_Paiement_of_Client_api("false"); + setGet_All_Paiement_of_Client_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_Paiement_of_Client = ', error); + setGet_All_Paiement_of_Client_api("false"); + + setdisplay_alert_mysy("1"); + setalert_message(" Impossible de récuperer la liste des paiements"); + setalert_type("error"); + //setmyApimyApiMessage("") + }) + } + + // DEBUT EXPORT EXCEL DATAGRID + + function CustomToolbar(props) { + + return ( + + + + + + + + + + + ); + } + + function getExcelData(apiRef) { + // Select rows and columns + const filteredSortedRowIds = gridFilteredSortedRowIdsSelector(apiRef); + const visibleColumnsField = gridVisibleColumnFieldsSelector(apiRef).filter((data) => (data) !== "__check__"); + + // Format the data. Here we only keep the value + + const data = filteredSortedRowIds.map((id) => { + const row = {}; + visibleColumnsField.forEach((field) => { + var val = apiRef.current.getCellParams(id, field).value; + if (String(field) !== "__check__") + row[field] = apiRef.current.getCellParams(id, field).value; + }); + return row; + }); + + + return data; + } + + + function ExportButton(props) { + return ( + + + + ); + } + + + function handleExport(apiRef, data_colums) { + const data = getExcelData(apiRef); + const visibleColumnsField = gridVisibleColumnFieldsSelector(apiRef).filter((data) => (data) !== "__check__"); + + const local_config = { + keys: visibleColumnsField, + + columnNames: data_colums.filter((mydata) => (mydata).disableExport !== true).map(function (mydata) { + + if (mydata.headerName && visibleColumnsField.includes(mydata.field)) { + if (mydata.headerName) { + return mydata.headerName; + } + } + + }), + + fileName: 'data_' + String(new Date().toJSON().slice(0, 10)).replaceAll("-", "_") + '.xlsx', + sheetName: 'Export_' + String(new Date().toJSON().slice(0, 10)).replaceAll("-", "_"), + }; + + + local_config.columnNames = local_config.columnNames.filter(function (element) { + return element !== undefined; + }); + + + const rows = data.map((row) => { + const mRow = {}; + for (const key of local_config.keys) { + mRow[key] = row[key]; + } + return mRow; + }); + + const worksheet = XLSX.utils.json_to_sheet(rows); + XLSX.utils.sheet_add_aoa(worksheet, [[...local_config.columnNames]], { + origin: 'A1', + }); + + const workbook = XLSX.utils.book_new(); + XLSX.utils.book_append_sheet(workbook, worksheet, local_config.sheetName); + XLSX.writeFile(workbook, local_config.fileName, { compression: true }); + } + + function ExportMenuItem(props) { + const apiRef = useGridApiContext(); + const { hideMenu } = props; + + return ( + { + handleExport(apiRef, props.data_colums); + // Hide the export menu after the export + hideMenu?.(); + }} + > + Export Excel + + ); + } + + // FIN EXPORT EXCEL DATAGRID + + + const [display_alert_mysy, setdisplay_alert_mysy] = useState(""); + const [alert_message, setalert_message] = useState(""); + const [alert_type, setalert_type] = useState(""); + + function clear_alert_message() { + setalert_message(""); + } + function clear_alert_type() { + setalert_type(""); + } + function clear_display_alert_mysy() { + setdisplay_alert_mysy(""); + } + + + return ( +
+ + {/*** Affichage des messages d'alerte*/} + + {display_alert_mysy && String(display_alert_mysy) === "1" && + + } + + + {/*** FIN Affichage des messages d'alerte*/} + + {/*** GESTION Compte Intranet */} + null} + + PaperProps={{ + + + className: classes.paper, // Apply the paper style + style: { + overflowY: 'unset', + position: 'absolute', + top: '10rem', + margin: "2px", + }, + }} + hideBackdrop={true} + disableScrollLock + classes={{ + paper: classes.dialog + }} + + PaperComponent={PaperComponent} + aria-labelledby="draggable-dialog-title" + + > + Gestion compte intranet + + + +
Login + +
+ + +
Mot de passe + { + setp_new_pwd(e.target.value); + + } + } + inputProps={{ + autocomplete: 'new-password', + form: { + autocomplete: 'off', + }, + }} + + /> + + +
+
Confirmer Mot de passe + { + setp_conf_new_login(e.target.value); + + } + } + inputProps={{ + autocomplete: 'new-password', + form: { + autocomplete: 'off', + }, + }} + /> + +
+ +
+ + + + + + + + + + + + + +
+ {/*** FIN GESTION Compte Intranet */} + + + {String(props.new_customer) === "1" &&
+
+ +
+ + + +
+
+ +
+
+ +
+ Infos générales +
+ +
+ + + +
Raison sociale
+ setclient_raison_sociale(e.target.value)} + /> +
+ +
Nom
+ setclient_nom(e.target.value)} + + /> +
+ + +
N° Siret
+ setclient_siret(e.target.value)} + /> +
+ +
N° TVA
+ setclient_tva(e.target.value)} + /> +
+ +
 
+ +
+ Email
+ setclient_email(e.target.value)} + + /> +
+ +
Téléphone
+ setclient_telephone(e.target.value)} + /> +
+ +
Site web
+ setclient_website(e.target.value)} + /> +
+ +
+
+
+ +
+
+ +
+ Coordonnées +
+ +
+ +
Adresse
+ setclient_adresse(e.target.value)} + /> +
+
ville
+ setclient_ville(e.target.value)} + /> +
+
Code Postal
+ setclient_code_postal(e.target.value)} + /> +
+
Pays
+ setclient_pays(e.target.value)} + /> +
+ +
 
+
Commentaire
+ { + setp_client_comment(e.target.value); + + }} + /> +
+ + + +
+
+
+ + + +
+
+ +
+
+ +
+
+ +
+ Caracteristiques +
+ +
+ + + +
+  

+ +
+ + +
+  

+ +
+ + +
+  

+ +
+ + + + + +
 
+ +
Type client
+ + { + if (value && value._id) { + setp_client_type_id(value._id); + + } else { + setp_client_type_id(""); + } + }} + //value={p_one_detail_client_rattachement_nom} + + renderInput={(params) => + } + /> + + +
+ +
Groupe client
+ { + if (value && value._id) { + setp_client_goupe_client_id(value._id); + + } else { + setp_client_goupe_client_id(""); + } + }} + //value={p_one_detail_client_rattachement_nom} + + renderInput={(params) => + } + /> + + +
+ + + + {p_client_is_financeur === true &&
Type Financeur
+ + { + if (value && value._id) { + setp_client_type_financeur(value._id); + + } else { + + setp_client_type_financeur(""); + + } + }} + //value={p_one_detail_client_rattachement_nom} + + renderInput={(params) => + } + /> + + +
} + + {p_client_is_company && String(p_client_is_company) === "2" &&
Type P. Public
+ + { + if (value && value._id) { + setp_client_type_pouvoir_public(value._id); + + } else { + + setp_client_type_pouvoir_public(""); + + } + }} + //value={p_one_detail_client_rattachement_nom} + + renderInput={(params) => + } + /> + + +
} + + + +
+
+
+ + + + + +
+
+ + +
+   +
+
+
+ Enregistrer   + + } + modal + nested + position="center center" + > + {close => ( +
+ +
MySy Information
+
+ {' '} + + Confirmez la création du nouveau partenaire
+ +
+
+
+ + +
+
+ +
+
+
+ )} +
+ + +
+
+ +
+
+
+ } + + {String(props.new_customer) !== "1" &&
+
+ + + + + {} + + + + + + + + + + +
+ + + {String(submenu).trim() === "submenu_donnee_client" &&
+ {p_detail_archive && String(p_detail_archive) === "1" && +
Document Archivé
} + + +
+
+ +
+
+ +
+ Infos générales +
+ +
+ +
Raison sociale
+ setclient_raison_sociale(e.target.value)} + /> +
+ + +
Nom
+ setclient_nom(e.target.value)} + + /> +
+ +
N° Siret
+ setclient_siret(e.target.value)} + /> +
+ +
N° TVA
+ setclient_tva(e.target.value)} + /> +
+ +
 
+
Email
+ setclient_email(e.target.value)} + + /> +
+ +
Telephone
+ setclient_telephone(e.target.value)} + /> +
+ +
Site web
+ setclient_website(e.target.value)} + /> +
+ + + +
+
+
+ +
+
+ +
+ Coordonnées +
+ +
+ +
Adresse
+ setclient_adresse(e.target.value)} + /> +
+
Ville
+ setclient_ville(e.target.value)} + /> +
+
Code Postal
+ setclient_code_postal(e.target.value)} + /> +
+
Pays
+ setclient_pays(e.target.value)} + /> +
+ +
 
+
Commentaire
+ { + setp_client_comment(e.target.value); + + }} + /> +
+ + + +
+
+
+ +
+
+ + +
+
+ +
+
+ +
+ Caracteristiques +
+ +
+ + +
+ { + DataEditMode(); + setp_client_is_company('1'); + }} + value="1" + name="radio-buttons" + inputProps={{ 'aria-label': 'A' }} + sx={{ + color: '#FF1493', + '&.Mui-checked': { + color: '#FF1493', + }, + }} + + /> Société   +
+ +
+ { + DataEditMode(); + setp_client_is_company('0'); + }} + value="0" + name="radio-buttons" + inputProps={{ 'aria-label': 'B' }} + + />   Particulier +
+ +
+ { + DataEditMode(); + setp_client_is_company('2'); + }} + value="2" + name="radio-buttons" + inputProps={{ 'aria-label': 'C' }} + + />   P. Public +
+ + + +
 
+ {String(formedit_mode) !== "1" &&
Type client
+ +
} + + {New_Get_List_Client_Type_result && New_Get_List_Client_Type_result.length > 1 && + String(formedit_mode) === "1" &&
Type client
+ (data)._id === String(p_client_type_id))[0].label} + + onChange={(event, value) => { + if (value && value._id) { + setp_client_type_id(value._id); + DataUpdated(); + } else { + setp_client_type_id(""); + DataUpdated(); + } + }} + + + renderInput={(params) => + } + /> + +
} + + + + + + {String(formedit_mode) !== "1" &&
Groupe client
+ +
} + + {New_Get_List_Client_Groupe_result && New_Get_List_Client_Groupe_result.length > 0 && + String(formedit_mode) === "1" &&
Groupe client
+ (data)._id === String(p_client_goupe_client_id))[0].label} + + onChange={(event, value) => { + if (value && value._id) { + setp_client_goupe_client_id(value._id); + setp_client_goupe_client_id_label(New_Get_List_Client_Groupe_result.filter((data) => (data)._id === String(p_client_goupe_client_id))[0].label) + DataUpdated(); + + } else { + setp_client_goupe_client_id(""); + DataUpdated(); + setp_client_goupe_client_id_label(""); + } + }} + + + renderInput={(params) => + } + /> + +
} + + + + {p_client_is_financeur === true &&
Type Financeur
+ + { + if (value && value._id) { + setp_client_type_financeur(value._id); + + } else { + + setp_client_type_financeur(""); + + } + }} + //value={p_one_detail_client_rattachement_nom} + + renderInput={(params) => + } + /> + + +
} + +
+
+
+ +
+
+ +
+ Typologie +
+ +
+ + + + + + + + + +
+
+
+ + + +
+
+ + +
+   +
+ + {String(props.check_user_acces_right("client", "write")) === "1" && String(datamodification) === "1" &&
+
/!\ Pensez à enregistrer les modifications
} + + + {String(props.check_user_acces_right("client", "write")) === "1" && String(formedit_mode) === "1" &&
+
+ +
+
+ +
+
+ } + + + {String(formedit_mode) !== "1" &&
+ +
+ +
+ + {String(props.check_user_acces_right("client", "write")) === "1" &&
+ +
} +
+ } + +
} + + {String(submenu).trim() === "submenu_donnees_facturation" &&
+ + +
+ + + Client facturé   + +
+ + {String(formedit_mode_invoice) !== "1" && New_Get_List_Partner_Clients_except_current_result && New_Get_List_Partner_Clients_except_current_result.length > 0 && + (data)._id === String(p_detail_client_facturation_id))[0].label} + + />} + + {String(formedit_mode_invoice) === "1" && New_Get_List_Partner_Clients_except_current_result && New_Get_List_Partner_Clients_except_current_result.length > 0 && + (data)._id === String(p_detail_client_facturation_id))[0].label} + options={New_Get_List_Partner_Clients_except_current_result} + onChange={(event, value) => { + if (value && value._id) { + setp_detail_client_facturation_id(value._id); + setclient_invoice_nom(value.invoice_nom); + setclient_invoice_email(value.invoice_email); + setclient_invoice_adresse(value.invoice_adresse); + setclient_invoice_ville(value.invoice_ville); + setclient_invoice_code_postal(value.invoice_code_postal); + setclient_invoice_pays(value.invoice_pays); + + + DataUpdated_Invoice_Data(); + } else { + setp_detail_client_facturation_id(""); + + setp_detail_client_facturation_id(""); + setclient_invoice_nom(""); + setclient_invoice_email(""); + setclient_invoice_adresse(""); + setclient_invoice_ville(""); + setclient_invoice_code_postal(""); + setclient_invoice_pays(""); + + DataUpdated_Invoice_Data(); + } + }} + renderInput={(params) => + } + />} +
+ +
+
+
+ +
+
+ +
+
+ +
+ Contact +
+ +
+ + +
Nom de Facturation
+ setclient_invoice_nom(e.target.value)} + /> +
+ +
Email de Facturation
+ setclient_invoice_email(e.target.value)} + /> +
+ +
N° Siret Facturation
+ setclient_invoice_siret(e.target.value)} + /> +
+ +
N° TVA Facturation
+ setclient_invoice_tva(e.target.value)} + /> +
+ +
Conditions Paiement
+ + {New_Getall_Partner_Paiement_Condition_result && New_Getall_Partner_Paiement_Condition_result.length > 0 && + (data).label === String(p_client_invoice_paiement_condition_code))[0].label} + options={New_Getall_Partner_Paiement_Condition_result} + className="disabled_style" + + onChange={(event, value) => { + if (value && value._id) { + setp_client_invoice_paiement_condition_code(value.code); + setp_client_invoice_paiement_condition_id(value._id); + DataUpdated_Invoice_Data(); + } + + }} + + renderInput={(params) => + } + />} +
+ + +
+
+
+ +
+
+ +
+ Coordonnées +
+ +
+ +
Adresse
+ setclient_invoice_adresse(e.target.value)} + /> +
+ + +
Ville
+ setclient_invoice_ville(e.target.value)} + /> +
+
Code Postal
+ setclient_invoice_code_postal(e.target.value)} + /> +
+
Pays
+ { + setclient_invoice_pays(e.target.value); + DataUpdated_Invoice_Data(); + }} + /> +
+ +
+
+
+ + + +
+
+ + + +
+
+
+ +
Facturation automatique
+ + {New_Option_Facturation_Automatique && String(formedit_mode_invoice) !== "1" && (data).value === String(p_detail_facturation_automatique))[0].label} + + />} + + {String(formedit_mode_invoice) === "1" && New_Option_Facturation_Automatique && (data).value === String(p_detail_facturation_automatique))[0].label} + options={New_Option_Facturation_Automatique} + onChange={(event, value) => { + if (value && value.value) { + setp_detail_facturation_automatique(value.value); + DataUpdated_Invoice_Data(); + } else { + setp_detail_facturation_automatique(""); + DataUpdated_Invoice_Data(); + } + }} + renderInput={(params) => + } + />} +
+ +
+   +
+ + {String(datamodification_invoice) === "1" &&
+
/!\ Pensez à enregistrer les modifications
} + {String(formedit_mode_invoice) === "1" &&
+
+ +
+
+ +
+
+ } + {String(props.check_user_acces_right("client", "write")) === "1" && String(formedit_mode_invoice) !== "1" &&
+ +
+ +
+
+ } + +
} + + {String(submenu).trim() === "submenu_contact" &&
+ + {String(addcontact) !== "1" &&
+ {String(props.check_user_acces_right("client", "write")) === "1" &&
Ajouter un contact
} +
+
+ + {Get_List_Contact_Of_client_Part_result && String(Get_List_Contact_Of_client_Part_api) === "true" && + Get_List_Contact_Of_client_Part_result.map((client) => ( + +
+ {(JSON.parse(client).nom || JSON.parse(client).prenom) && + + + + } + modal + nested + position="center center" + > + {close => ( +
+ +
MySy Information
+
+ {' '} + + En confirmant cette opération, le contact sera définitivement supprimé.
+ + +
+
+
+ + +
+
+ +
+
+
+ )} + } + + + + + + } + +
+
+
+ + +
+ + + ))} +
+
+
} + + {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)} + /> +
+ + + + + +
+
+
+ + +
+ + + +
+
+
+   +
+ + + {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 &&
+ +
+ +
+ + + +
} + + +
+ +
+ +
+ + +
} + + + {String(submenu).trim() === "submenu_paiement" &&
+ Total Paiement - {local_format_monetaire(New_Get_All_Paiement_Total_Payed)} * Paiement en attente --- * paiement en retard
+
+ +
+ + {/*rowss_total_data && rowss_total_data.length > 0 && rowss_total_data.map((val) => ())*/} + +
+
+   + + { + setselectionModel_paiement(newSelectionModel); + /*if (newSelectionModel.length === 1) + handleClick_edit_invoice_From_Line(newSelectionModel);*/ + if (newSelectionModel.length !== 1) { + //clean_order_detail_fields(); + //setsubmenu(); + // setdisplay_detail_invoice(); + + } + }} + + + + onRowDoubleClick={(newSelectionModel) => { + + } + } + selectionModel={selectionModel_paiement} + + localeText={frFR.components.MuiDataGrid.defaultProps.localeText} + rows={Get_All_Paiement_of_Client_result.map((item, index) => ( + { + id: index, + _id: JSON.parse(item)._id, + invoice_id: JSON.parse(item).invoice_id, + + paiement_amount: JSON.parse(item).paiement_amount, + paiement_mode: JSON.parse(item).paiement_mode, + paiement_ref: JSON.parse(item).paiement_ref, + paiement_date: JSON.parse(item).paiement_date, + commentaire: JSON.parse(item).commentaire, + client_id: JSON.parse(item).client_id, + invoice_ref: JSON.parse(item).invoice_ref, + + } + ))} + + columns={columns_paiement} + pageSize={10} + className="datagridclass" + + 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_paiement)) { + 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'; + } + }} + + + /> + +
+ +
+ + +
+ +
+ + ICIII FAIRE UN HISTOGRAMME DES PAIEMENT SUR LES 6 DERNIMER MOIS + +
+ +
} + + + {String(submenu).trim() === "submenu_relance" &&
+ submenu_relance
+ + +
} + +
+   Fermer +
+
} + + + + + +
+ ); +} + +export default AddPartnerClient_ARG_100526; + + +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_1_col{ + margin-top: 12px; + display:grid; + grid-template-columns: 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; + } + + +/* ========================= + MAIN LAYOUT +========================= */ + +.mtt-main { + width: min(100%, 1780px); + margin: 0 auto; + padding: 24px 48px 42px; + display: grid; + grid-template-columns: minmax(0, 1fr) 420px; + gap: 24px; +} + +.mtt-left-column, +.mtt-right-column { + display: flex; + flex-direction: column; + gap: 20px; +} + +.mtt-card { + background: rgba(255, 255, 255, 0.92); + border: var(--mtt-border); + border-radius: var(--mtt-radius-md); + box-shadow: var(--mtt-shadow-sm); + padding: 26px; +} + +.mtt-card-title { + display: flex; + align-items: center; + gap: 13px; + margin-bottom: 22px; +} + +.mtt-card-title h3 { + margin: 0; + color: var(--mtt-navy-850); + font-size: 21px; + font-weight: 800; + letter-spacing: -0.03em; +} + +.mtt-card-icon { + width: 32px; + height: 32px; + display: grid; + place-items: center; + border-radius: 12px; + color: var(--mtt-teal-600); + background: var(--mtt-teal-100); +} + +`; diff --git a/src/components/Partner_ARG_140326.js b/src/components/Partner_ARG_140326.js deleted file mode 100644 index 77a47e3..0000000 --- a/src/components/Partner_ARG_140326.js +++ /dev/null @@ -1,4161 +0,0 @@ -import React, { useState, useEffect } from "react"; -import axios from "axios"; -import profileimg from "../mysy_img/MYSY-profil-2.png"; -import TrainingForm from "./AddClassManual" -import PartnerTranings from "./DisplayPartnerTrainingsPagination"; -import HebergementLms from "./HebergementLms"; -import Button from '@mui/material/Button'; -import SendIcon from '@mui/icons-material/Send'; -import { getCookie } from 'react-use-cookie'; -import { useHistory } from "react-router-dom"; -import PartnerInfo from "./UpdatePartnerInfo"; - -import PartnerInfo_v2 from "./UpdatePartnerInfo_v2"; -import UpdatePartnerInfo_v2_ARG from "./UpdatePartnerInfo_v2_ARG"; - -import { FiBookOpen } from "react-icons/fi"; -import SettingsInputComponentIcon from '@mui/icons-material/SettingsInputComponent'; -import { FaDraftingCompass } from "react-icons/fa"; -import PartenairStat from "./PartenairStat"; -import { GrUserAdmin } from "react-icons/gr"; -import ApartmentIcon from '@mui/icons-material/Apartment'; -import DialpadIcon from '@mui/icons-material/Dialpad'; -import { Helmet } from "react-helmet"; -import RocketIcon from '@mui/icons-material/Rocket'; -import img_loading_spin from "./../mysy_img/mysy_spin_loading.gif"; -import { GiTeacher } from "react-icons/gi"; -import { confirmAlert } from 'react-confirm-alert'; // Import -import { useCookies } from "react-cookie"; -import Facture from "./Facture"; -import Abonnement from "./Abonnement"; -import { useLocation } from "react-router-dom"; -import { useParams } from 'react-router-dom'; -import CheckOut from "./CheckOut"; - - - -import { FaHandPointRight } from "react-icons/fa"; -import OrderConfirmation from "./OrderConfirmation"; -import Partner_Client from "./Partner_Client"; -import Pricing from "./Pricing"; -import { MdAddShoppingCart } from "react-icons/md"; -import { - FcHome, FcBullish, - FcList, FcCurrencyExchange, - FcFeedback, FcKey, FcVideoCall, - FcBusinesswoman, FcServices, FcCollect, FcKindle, - FcFlowChart, FcReading, FcFinePrint, FcCalendar, FcOrgUnit, - FcEngineering -} from "react-icons/fc"; - -import CircleNotificationsIcon from '@mui/icons-material/CircleNotifications'; -import { PiStudent } from "react-icons/pi"; -import { BiPurchaseTag } from "react-icons/bi"; -import { BsTools } from "react-icons/bs"; -import DisplayPartnerPromotion from "./DisplayPartnerPromotion"; -import DisplayPartnerSession from "./DisplayPartnerSession"; -import DisplayPartnerStagiaires from "./DisplayPartnerStagiaires"; -import Module_Alert_Confirmation from "./Module_Alert_Confirmation"; -import Employes from "./Employes"; -import Autre_RH from "./Autre_RH"; -import Materiels from "./Materiels"; -import Partner_Commande from "./Partner_Commande"; -import Config_Documents from "./Config_Document"; -import Config_Documents_Super_Admin from "./Config_Document_Super_Admin"; -import Factures_Client from "./Partner_Facture"; -import Configuration_Technique from "./Partner_Config_Technique"; -import Config_Champs_Personnalise from "./Config_Champs_Personnalise"; -import Module_Agenda from "./Module_Agenda"; -import Partner_Configuration_Session_Steps from "./Partner_Config_Session_Steps"; -import Partner_Configuration_Jours_Travail from "./Partner_Config_Jours_Travail"; -import Dashbord_Session from "./Dashbord_Session"; -import Dashbord_Ressources_Humaines from "./Dashbord_Ressources_Humaines"; -import Dashbord_Inscriptions from "./Dashbord_Inscription"; -import Dashbord_Factures from "./Dashbord_Factures"; -import Materiel_Salle from "./Materiel_Salle"; -import CRM_Opportunite from "./Crm_Opportunite"; -import Partner_Config_Formulaires from "./Partner_Config_Formulaires"; -import PartnerClientActivite from "./PartnerClient_Activite"; -import Jury from "./Jurys"; -import Conseil_Classe from "./Conseil_Classe"; -import Module_Internal_Email_Management from "./Module_Internal_Email_Management"; - -import CompareArrowsIcon from '@mui/icons-material/CompareArrows'; -import Mon_Tableau_De_Bord from "./Mon_Tableau_De_Bord"; -import Dashbord_Formation from "./Dashbord_Formation"; -import Partner_Prix_Achat from "./Partner_Prix_Achat"; -import Apprenant from "./Apprenant"; -import { PiSlideshowFill, PiSlideshowThin } from "react-icons/pi"; -import Dialog from '@mui/material/Dialog'; -import DialogActions from '@mui/material/DialogActions'; -import DialogContent from '@mui/material/DialogContent'; -import DialogContentText from '@mui/material/DialogContentText'; -import DialogTitle from '@mui/material/DialogTitle'; -import { ImWarning } from "react-icons/im"; -import 'react-tooltip/dist/react-tooltip.css' -import { Tooltip } from 'react-tooltip' -import { AiOutlineDashboard } from "react-icons/ai"; -import ListAltIcon from '@mui/icons-material/ListAlt'; -import SchoolIcon from '@mui/icons-material/School'; -import { Sidebar, Menu, MenuItem, SubMenu } from 'react-pro-sidebar'; -import { FcBusinessContact } from "react-icons/fc"; -import { FcVideoProjector } from "react-icons/fc"; -import HandymanIcon from '@mui/icons-material/Handyman'; -import HubIcon from '@mui/icons-material/Hub'; -import EuroSharpIcon from '@mui/icons-material/EuroSharp'; -import CameraOutdoorSharpIcon from '@mui/icons-material/CameraOutdoorSharp'; -import SettingsIcon from '@mui/icons-material/Settings'; -import { createTheme, ThemeProvider } from '@mui/material/styles'; -import AccountBalanceIcon from '@mui/icons-material/AccountBalance'; -import CalendarMonthIcon from '@mui/icons-material/CalendarMonth'; -import CoPresentIcon from '@mui/icons-material/CoPresent'; -import LocalOfferIcon from '@mui/icons-material/LocalOffer'; -import DisplayPartnerUnite_Enseignement from "./DisplayPartnerUnite_Enseignement"; -import Partner_Domaine_Categorie_Metier from "./Partner_Domaine_Categorie_Metier"; -import Partner_Config_Ftion_Initiale from "./Partner_Config_Ftion_Initiale"; -import Partner_Admission_Process_Ftion_Initiale from "./Partner_Admission_Process_Ftion_Initiale"; -import Admission_Pedagogique_Ftion_Initiale from "./Config_Ref_Pedagogique_Ftion_Initiale"; -import Config_Competence_Pedagogique_Ftion_Initiale from "./Config_Competence_Pedagogique_Ftion_Initiale"; -import Notes_Evaluation from "./Notes_Evaluation"; -import ScoreboardIcon from '@mui/icons-material/Scoreboard'; -import Groupe_Apprenant from "./Groupe_Apprenant"; -import Session_Admission_FI from "./Session_Admission_FI"; -import Module_Plateform_Admin_Partners from "./Module_Plateform_Admin_Partners"; - - -import Equipe_Team from "./Equipe_Team"; -import Groups2Icon from '@mui/icons-material/Groups2'; -import Diversity3Icon from '@mui/icons-material/Diversity3'; -import { LiaProductHunt } from "react-icons/lia"; -import Partner_Product_Service from "./Partner_Product_Service"; -import Module_Email_Management from "./Module_Email_Management"; -import ForwardToInboxIcon from '@mui/icons-material/ForwardToInbox'; -import Badge from '@mui/material/Badge'; -import { styled } from '@mui/material/styles'; -import Modules_Mes_Documents from "./Modules_Mes_Documents"; -import FolderZipIcon from '@mui/icons-material/FolderZip'; -import MailIcon from '@mui/icons-material/Mail'; -import ReduceCapacityIcon from '@mui/icons-material/ReduceCapacity'; -import { FcPodiumWithAudience } from "react-icons/fc"; -import { FcConferenceCall } from "react-icons/fc"; - - -const Partner_ARG_140326 = (props) => { - - const stored_cookie_menu_gauche_reduit = getCookie('mysy_menu_gauche_reduit'); - - const { commingmenu, commingpack } = useParams(); - const [myApiResponse, setmyApiResponse] = useState(""); - const [result, setResult] = useState(""); - const [cookie_part, setCookie_part, removeCookie_part] = useCookies(['tokenmysypart']); - const stored_part = getCookie('tokenmysypart'); - const [parntername, setparntername] = useState(""); - const [parnter_user_employee, setparnter_user_employee] = useState(""); - const [parnternbformation, setparnternbformation] = useState(""); - const [selectedfilt1, setselectedfilt1] = useState(""); - const [selectedfilt2, setselectedfilt2] = useState(""); - const [selectedfilt3, setselectedfilt3] = useState(""); - const [excelimportmessage, setexcelimportmessage] = useState(""); - const [apiexcelimportmessage, setapiexcelimportmessage] = useState(""); - - const [cookie, setCookie, removeCookie] = useCookies(['tokenmysych'], { path: '/' }); - - const [cookie_menu_gauche_reduit, setcookie_menu_gauche_reduit, removecookie_menu_gauche_reduit] = useCookies(['mysy_menu_gauche_reduit']); - - const theme = createTheme({ - palette: { - primary: { - light: '#F0E68C', - main: '#F0E68C', - dark: '#F0E68C', - contrastText: '#fff', - }, - secondary: { - light: '#99ffcc', - main: '#99ffcc', - dark: '#ba000d', - contrastText: '#000', - }, - - tercier: { - light: '#dbff75', - main: '#dbff75', - dark: '#dbff75', - contrastText: '#000', - }, - - quatro: { - light: '#E08A8B', - main: '#E08A8B', - dark: '#E08A8B', - contrastText: '#000', - }, - - cinqo: { - light: '#D2691E', - main: '#D2691E', - dark: '#D2691E', - contrastText: '#000', - }, - }, - }); - - const StyledBadge = styled(Badge)(({ theme }) => ({ - '& .MuiBadge-badge': { - right: 0, - top: 0, - border: `2px solid ${theme.palette.background.paper}`, - padding: '0 4px', - }, - })); - - - const StyledBadge_mysy_color1 = styled(Badge)(({ }) => ({ - '& .MuiBadge-badge': { - right: 0, - top: 0, - border: '2px solid #ffffff', - padding: '0 4px', - background: '#6a329f', - color: "#ffffff" - }, - })); - - - const StyledBadge_mysy_red = styled(Badge)(({ }) => ({ - '& .MuiBadge-badge': { - right: 0, - top: 0, - border: '2px solid ', - padding: '0 4px', - background: '#f44336', - color: "#ffffff", - }, - })); - - - - // Constante permet de savoir a fonction du menu on a faire - const [menu, setmenu] = useState(); - const [selectedFile, setSelectedFile] = useState(); - const [isSelected, setIsSelected] = useState(false); - - const [partnerPackService, setpartnerPackService] = useState(""); - - const [isimgSelected, setisimgSelected] = useState(false); - const [isimgSelectedfile, setisimgSelectedfile] = useState(false); - const [userimgprofil, setuserimgprofil] = useState(); - - const [partnerstatus, setpartnerstatus] = useState(); - const [refesh, setrefesh] = useState("init"); - - const [firstConnexion, setfirstConnexion] = useState(""); - const [part_is_partner_admin_account, setpart_is_partner_admin_account] = useState(""); - - const { action, orderid, packs, object_key, class_internal_url } = useParams() - - const [previous_action, setprevious_action] = useState(""); - - - const changeHandler = (event) => { - setSelectedFile(event.target.files[0]); - setIsSelected(true); - setapiexcelimportmessage(""); - }; - - const changeHandler2 = (event) => { - setapiexcelimportmessage(); - setformation_file_name(); - sethandleSubmission_api(); - hiddenFileInput_formation.current.click(); - }; - - const hiddenFileInput_formation = React.useRef(null); - - const history = useHistory(); - - - const stored_cookie = getCookie('tokenmysypart'); - const location = useLocation(); - - // Si le partenaire n'est pas connecté, il est renvoyé vers la page de connexion - if (!stored_cookie || stored_cookie.length <= 0) { - if (location && location.state && location.state.mysy_arg) { - //alert(" mysy arg (dans partner) = " + location.state.mysy_arg); - history.push("/Connexion", { mysy_arg: location.state.mysy_arg }); - } - else { - history.push("/Connexion"); - } - } - - - const formData = new FormData(); - - const [handleSubmission_api, sethandleSubmission_api] = useState(); - const [handleSubmission_result, sethandleSubmission_result] = useState(); - const [handleSubmission_message, sethandleSubmission_message] = useState(); - - const handleSubmission = event => { - - - 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 > 10000000) { - 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"); - var local_message = result['message'] + " Vous allez être redirigé vers la liste des formations" - 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']); - alert(result['message']); - } - //alert("result['status'] " + result['status']); - }) - .catch((error) => { - setLoading(false); - console.error('Error:', result); - setmyApiResponse("false"); - setapiexcelimportmessage("-1"); - sethandleSubmission_api("false"); - alert(" Impossible d'importer/mettre à jour les formations"); - }); - }; - - const [myimage, setmyimage] = useState(); - const [isimage, setisimage] = useState(); - - function getImage(e) { - var myurl = process.env.REACT_APP_API_URL + "myclass/api/getRecodedImage/"; - var form = new FormData(); - form.append("token", stored_cookie); - form.append("type", "partner"); - - axios.post(myurl, form).then(res => { - //console.log(" getImage : In test res.data.status = " + res.data.status); - //console.log(" getImage: res.data.message.img = " + res.data.message); - - if (String(res.data.status) === "true") { - - if (res.data.message && res.data.message.img && res.data.message.img.length > 0) { - setisimage("True"); - } - else { - setisimage("False"); - } - setmyimage(res.data.message.img); - var ch_img = "data:image/png;base64," + res.data.message.img; - setuserimgprofil(ch_img); - } - else { - //console.log(" In Erreur res.data.status = " + res.data.status); - //console.log(" In Erreur res.data.message = " + res.data.message); - setisimage("False"); - setuserimgprofil(); - //alert("4"); - } - }).catch((error) => { - console.warn('Not good man :( mysearchtext = '); - setisimage("False"); - setuserimgprofil(profileimg); - }) - - } - - - // Cette fonction recuperer les droits d'acces stocké en cookie - const [connected_user_access_right, setconnected_user_access_right] = React.useState(null); - function retrieve_user_acces_right() { - const stored_cookie = getCookie('tokenmysypart'); - - if (!stored_cookie || String(stored_cookie).trim() === "") { - history.push("/Connexion"); - return; - } - - var acces_right_token_name = stored_cookie + "_uar"; - - - - var acces_right_token_val = getCookie(acces_right_token_name, { path: '/' }); - - var tab_json_access_right = JSON.parse(acces_right_token_val); - - setconnected_user_access_right(tab_json_access_right); - - } - - // check du droit d'acces de l'utilisateur - function check_user_acces_right(local_module, local_action) { - - //console.log(" ### connected_user_access_right = ", connected_user_access_right); - //console.log(" #### check_user_acces_right = ", local_module, " --- local_action = ", local_action); - - if (String(local_action) === "read") { - for (let i = 0; i < connected_user_access_right.length; i++) { - if (String(connected_user_access_right[i].module) === String(local_module) - && String(connected_user_access_right[i].read) === "true") { - - return 1; - } - } - return 0; - } else if (String(local_action) === "write") { - for (let i = 0; i < connected_user_access_right.length; i++) { - if (String(connected_user_access_right[i].module) === String(local_module) - && String(connected_user_access_right[i].write) === "true") { - - return 1; - } - } - return 0; - } else { - return 0; - } - - } - - - useEffect(() => { - - - if (String(stored_cookie_menu_gauche_reduit) === "1") - setleft_menu(false); - else - setleft_menu(true); - - setapiexcelimportmessage(); - - if (location && location.state && location.state.local_sub_menu) { - setmenu(location.state.local_sub_menu); - setpartnerPackService(location.state.currentpack); - //alert(" le pack = "+location.state.currentpack); - } - - var list_menu = ['creation', 'infopartner', 'infopartner_v2', 'statistique', 'abonnement', 'affichage', 'ordervalide', - 'mes_sessions', 'setuplms', 'facture', 'pricing', 'mes_clients', 'mes_devis', 'mes_cmd', - 'mes_stagiaires', 'mes_employes', 'mon_materiel', 'config_document', 'factures_client', "setuplms", "config_technique", - "config_champ_specific", "module_agenda", "config_session_steps", "config_jours_heures", "dashbord_formation", - "dashbord_session", "mon_tableau_de_bord", "prix_achat", "mes_apprenants", "dashbord_ressources_humaines", - "dashbord_inscriptions", "mes_salles", "mes_opportunites", "config_formulaires", "dashbord_factures", "mes_ue", - "domaine_categorie_metier", "config_formation_initiale", "note_evaluation", "groupe_apprenant", - "part_produit_service", "config_document_super_admin", "tous_mes_document", "equipe_team", - "jurys", "mes_promotions", "autre_rh", "conseil_classe", "admission_process", "admission_session", - 'config_plateforme_partners', 'administration_pedagogique', 'competence_pedagogique'] - - - if (action && list_menu.includes(action)) { - - setmenu(action); - - // /!\ il faudra terminer la fonction ci-dessous. aller dans la fonction pour voir le commentaire - inactive_active_menu_header_from_url_action(action); - - if (action && orderid && packs && String(action) === "ordervalide") { - CheckSalesOrder(); - } - - /* if (action && orderid && packs && String("abonnement")) { - //console.log(" abonnement : payement intent = ", orderid, " pack = ", packs); - }*/ - } else { - DiplaytrainingList(); - - } - - getImage(); - GetPartnerNameFromToken(); - setformation_file_name(); - GetPartnerLMSData(); - retrieve_user_acces_right(); - Get_Nb_Unread_Emails(); - }, []) - - const [Get_Nb_Unread_Emails_api, setGet_Nb_Unread_Emails_api] = useState(); - const [Get_Nb_Unread_Emails_message, setGet_Nb_Unread_Emails_message] = useState(); - const [Get_Nb_Unread_Emails_result, setGet_Nb_Unread_Emails_result] = useState([]); - function Get_Nb_Unread_Emails(event) { - - var form = new FormData(); - - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - form.append("related_collection_recid", props.conntected_account_id); - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Nb_User_Internal_Mail_Not_Read/"; - - setLoading(true); - axios.post(myurl, form).then(res => { - setLoading(false); - if (String(res.data.status) === String("true")) { - //console.log(" In Get_Nb_Unread_Emails res.data.status = " + res.data.status); - // console.log(" In Get_Nb_Unread_Emails res.data.message r_class = " + res.data.message); - setGet_Nb_Unread_Emails_api("true"); - setGet_Nb_Unread_Emails_result(res.data.message); - } - else { - setGet_Nb_Unread_Emails_api("false"); - setGet_Nb_Unread_Emails_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_Unread_Emails = ', error); - setGet_Nb_Unread_Emails_api("false"); - alert("Impossible de récuperer la liste des emails"); - //setmyApimyApiMessage("") - }) - } - - - - // Cette fontion desactive tous les menu header et reactive just le menu_header concerné - function inactive_active_menu_header(current_menu_header) { - const list_menu_header_names = ['my_account', 'my_class', 'my_session', 'my_apprenant', 'my_ressource', 'my_planning', - 'my_partners', 'my_invoices', 'my_prix_achat', 'my_e_learning', 'my_configuration', 'my_tbd', 'my_ue', 'domaine_categorie_metier', - 'config_formation_initiale', 'note_evaluation', 'groupe_apprenant', 'part_produit_service', 'monactivite', 'mon_tableau_de_bord', - 'tous_mes_document', 'equipe_team', 'conseil_class', 'autre_rh', 'jury', 'conseil_classe', 'internal_email', "admission_process", - "admission_session", 'config_plateforme_partners', 'administration_pedagogique', 'competence_pedagogique'] - for (let i = 0; i < list_menu_header_names.length; i++) { - if (document.getElementsByName(String(list_menu_header_names[i])) && document.getElementsByName(String(list_menu_header_names[i]))[0]) { - document.getElementsByName(String(list_menu_header_names[i]))[0].style.fontWeight = "400"; - } - } - - - if (document.getElementsByName(String(current_menu_header)) && document.getElementsByName(String(current_menu_header))[0]) { - document.getElementsByName(String(current_menu_header))[0].style.fontWeight = "700"; - } - } - - function inactive_active_menu_header_from_url_action(url_action) { - const list_menu_header_names = ['my_account', 'my_class', 'my_session', 'my_apprenant', 'my_ressource', 'my_planning', - 'my_partners', 'my_invoices', 'my_prix_achat', 'my_e_learning', 'my_configuration', 'my_tbd', 'my_ue', 'domaine_categorie_metier', - 'config_formation_initiale', 'note_evaluation', 'groupe_apprenant', 'part_produit_service', 'monactivite', 'mon_tableau_de_bord', - 'tous_mes_document', 'equipe_team', 'conseil_class', 'autre_rh', 'jury', 'conseil_classe', 'internal_email', "admission_process", - "admission_session", 'config_plateforme_partners', 'administration_pedagogique', 'competence_pedagogique'] - for (let i = 0; i < list_menu_header_names.length; i++) { - if (document.getElementsByName(String(list_menu_header_names[i])) && document.getElementsByName(String(list_menu_header_names[i]))[0]) { - document.getElementsByName(String(list_menu_header_names[i]))[0].style.fontWeight = "400"; - } - } - - // plus tard, il faudra mettre en brillance le menu et le soumenu concerné - } - - function CreateTraining(event) { - var security_retval = check_user_acces_right("formation", "read"); - if (security_retval === 1) { - setmenu("creation"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/creation"); - document.body.style.backgroundColor = "#ffffff"; - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des formations"); - } - } - - function PersonnalData(event) { - - setmenu("infopartner"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/infopartner"); - document.body.style.backgroundColor = "#ffffff"; - - inactive_active_menu_header("my_account"); - - } - - function PersonnalData_v2(event) { - - setmenu("infopartner_v2"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/infopartner_v2"); - document.body.style.backgroundColor = "#ffffff"; - - inactive_active_menu_header("my_account"); - - } - - function monactivite_func(event) { - - setmenu("monactivite"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/monactivite"); - document.body.style.backgroundColor = "#ffffff"; - - inactive_active_menu_header("monactivite"); - - } - - - function Display_Tous_Documents(event) { - setmenu("tous_mes_document"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/tous_mes_document"); - document.body.style.backgroundColor = "#ffffff"; - inactive_active_menu_header("tous_mes_document"); - } - - - function Display_Internal_Boite_Email(event) { - setmenu("internal_email"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/internal_email"); - document.body.style.backgroundColor = "#ffffff"; - inactive_active_menu_header("internal_email"); - } - - - - function config_document_func(event) { - var security_retval = check_user_acces_right("config_document", "read"); - if (security_retval === 1) { - setmenu("config_document"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/config_document"); - document.body.style.backgroundColor = "#ffffff"; - inactive_active_menu_header("my_configuration"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des documents"); - } - } - - function config_document_super_admin_func(event) { - setmenu("config_document_super_admin"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/config_document_super_admin"); - document.body.style.backgroundColor = "#ffffff"; - inactive_active_menu_header("my_configuration"); - } - - function config_ftion_initale_general_func(event) { - var security_retval = check_user_acces_right("config_document", "read"); - if (security_retval === 1) { - setmenu("config_formation_initiale"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/config_formation_initiale"); - document.body.style.backgroundColor = "#ffffff"; - inactive_active_menu_header("config_formation_initiale"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des documents"); - } - } - - - function config_ftion_plateforme_partners_func(event) { - var security_retval = check_user_acces_right("config_document", "read"); - if (security_retval === 1) { - setmenu("config_plateforme_partners"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/config_plateforme_partners"); - document.body.style.backgroundColor = "#ffffff"; - inactive_active_menu_header("config_plateforme_partners"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion de ce menu"); - } - } - - function config_admission_process_func(event) { - var security_retval = check_user_acces_right("ftion_initial_admin", "read"); - if (security_retval === 1) { - setmenu("admission_process"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/admission_process"); - document.body.style.backgroundColor = "#ffffff"; - inactive_active_menu_header("admission_process"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des documents"); - } - } - - - function config_tache_pedagogique_func(event) { - var security_retval = check_user_acces_right("ftion_initial_admin", "read"); - if (security_retval === 1) { - setmenu("tache_pedagogique"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/tache_pedagogique"); - document.body.style.backgroundColor = "#ffffff"; - inactive_active_menu_header("tache_pedagogique"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des documents"); - } - } - - function config_administration_pedagogique_func(event) { - var security_retval = check_user_acces_right("ftion_initial_admin", "read"); - if (security_retval === 1) { - setmenu("administration_pedagogique"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/administration_pedagogique"); - document.body.style.backgroundColor = "#ffffff"; - inactive_active_menu_header("administration_pedagogique"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des documents"); - } - } - - - function config_competence_pedagogique_func(event) { - var security_retval = check_user_acces_right("ftion_initial_admin", "read"); - if (security_retval === 1) { - setmenu("competence_pedagogique"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/competence_pedagogique"); - document.body.style.backgroundColor = "#ffffff"; - inactive_active_menu_header("competence_pedagogique"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des documents"); - } - } - - - function config_specfic_fields_func(event) { - var security_retval = check_user_acces_right("config_document", "read"); - if (security_retval === 1) { - setmenu("config_champ_specific"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/config_champ_specific"); - document.body.style.backgroundColor = "#ffffff"; - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des documents"); - } - } - - function module_agenda_func(event) { - var security_retval = check_user_acces_right("module_agenda", "read"); - if (security_retval === 1) { - setmenu("module_agenda"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/module_agenda"); - document.body.style.backgroundColor = "#ffffff"; - inactive_active_menu_header("my_planning"); - - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des documents"); - } - } - - function mon_tableau_de_bord_func(event) { - setmenu("mon_tableau_de_bord"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/mon_tableau_de_bord"); - document.body.style.backgroundColor = "#ffffff"; - - inactive_active_menu_header("mon_tableau_de_bord"); - } - - - function prix_achat_func(event) { - setmenu("prix_achat"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/prix_achat"); - document.body.style.backgroundColor = "#ffffff"; - inactive_active_menu_header("my_prix_achat"); - - } - - - - - - function config_technique_func(event) { - var security_retval = check_user_acces_right("config_document", "read"); - if (security_retval === 1) { - setmenu("config_technique"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/config_technique"); - document.body.style.backgroundColor = "#ffffff"; - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des documents"); - } - } - - function config_session_steps_func(event) { - var security_retval = check_user_acces_right("config_document", "read"); - if (security_retval === 1) { - setmenu("config_session_steps"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/config_session_steps"); - document.body.style.backgroundColor = "#ffffff"; - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des documents"); - } - } - - - function config_jours_travaille_func(event) { - var security_retval = check_user_acces_right("config_document", "read"); - if (security_retval === 1) { - setmenu("config_jours_heures"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/config_jours_heures"); - document.body.style.backgroundColor = "#ffffff"; - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des documents"); - } - } - - - function config_formulaires_func(event) { - var security_retval = check_user_acces_right("config_document", "read"); - if (security_retval === 1) { - setmenu("config_formulaires"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/config_formulaires"); - document.body.style.backgroundColor = "#ffffff"; - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des documents"); - } - } - - - function mes_factures_client_func(event) { - var security_retval = check_user_acces_right("facture_client", "read"); - if (security_retval === 1) { - setmenu("factures_client"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/factures_client"); - document.body.style.backgroundColor = "#ffffff"; - inactive_active_menu_header("my_invoices"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des documents"); - } - } - - - function DisplayStat(event) { - var security_retval = check_user_acces_right("formation", "read"); - if (security_retval === 1) { - setmenu("statistique"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/statistique"); - document.body.style.backgroundColor = "#ffffff"; - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des formations"); - } - } - - function DisplaySetUpLMS(event) { - var security_retval = check_user_acces_right("lms", "read"); - if (security_retval === 1) { - setmenu("setuplms"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/setuplms"); - document.body.style.backgroundColor = "#ffffff"; - inactive_active_menu_header("my_e_learning"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion du E-Learning"); - } - - } - - function DisplayFacure(event) { - var security_retval = check_user_acces_right("commande", "read"); - if (security_retval === 1) { - setmenu("facture"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/facture"); - document.body.style.backgroundColor = "#ffffff"; - - inactive_active_menu_header("facture"); - - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des commandes"); - } - - } - - - - - - - function Abonnement_func(event) { - var security_retval = check_user_acces_right("abonnement", "read"); - if (security_retval === 1) { - setmenu("abonnement"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/abonnement"); - document.body.style.backgroundColor = "#ffffff"; - - inactive_active_menu_header("abonnement"); - - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des abonnements"); - } - - } - - function pricing_func(event) { - var security_retval = check_user_acces_right("prix", "read"); - if (security_retval === 1) { - setmenu("pricing"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/pricing"); - document.body.style.backgroundColor = "#ffffff"; - inactive_active_menu_header("my_partners"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des prix"); - } - - } - - function mes_clients_func(event) { - var security_retval = check_user_acces_right("client", "read"); - - if (security_retval === 1) { - setmenu("mes_clients"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/mes_clients"); - document.body.style.backgroundColor = "#ffffff"; - inactive_active_menu_header("my_partners"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des clients"); - } - } - - function mes_devis_func(event) { - var security_retval = check_user_acces_right("commande", "read"); - if (security_retval === 1) { - setmenu("mes_devis"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/mes_devis"); - document.body.style.backgroundColor = "#ffffff"; - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des commandes"); - } - } - - - function mes_cmd_func(event) { - var security_retval = check_user_acces_right("commande", "read"); - if (security_retval === 1) { - setmenu("mes_cmd"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/mes_cmd"); - document.body.style.backgroundColor = "#ffffff"; - inactive_active_menu_header("my_invoices"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des commandes"); - } - } - - - function DiplayPartner_UE(event) { - var security_retval = check_user_acces_right("formation", "read"); - - if (security_retval === 1) { - setmenu("mes_ue"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/mes_ue"); - document.body.style.backgroundColor = "#ffffff"; - - inactive_active_menu_header("my_ue"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à cette fonctionnalité"); - } - } - - - function DiplayPartner_Domaine_Categorie_Metier(event) { - var security_retval = check_user_acces_right("formation", "read"); - - if (security_retval === 1) { - setmenu("domaine_categorie_metier"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/domaine_categorie_metier"); - document.body.style.backgroundColor = "#ffffff"; - - inactive_active_menu_header("domaine_categorie_metier"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à cette fonctionnalité"); - } - } - - - function DiplayPartner_Produits_Services(event) { - var security_retval = check_user_acces_right("formation", "read"); - - if (security_retval === 1) { - setmenu("part_produit_service"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/part_produit_service"); - document.body.style.backgroundColor = "#ffffff"; - - inactive_active_menu_header("part_produit_service"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à cette fonctionnalité"); - } - } - - - function DiplaySessionList(event) { - var security_retval = check_user_acces_right("session", "read"); - - if (security_retval === 1) { - setmenu("mes_sessions"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/mes_sessions"); - document.body.style.backgroundColor = "#ffffff"; - - inactive_active_menu_header("my_session"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à cette fonctionnalité"); - } - } - - function DiplayPromotionList(event) { - var security_retval = check_user_acces_right("session", "read"); - - if (security_retval === 1) { - setmenu("mes_promotions"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/mes_promotions"); - document.body.style.backgroundColor = "#ffffff"; - - inactive_active_menu_header("my_promotion"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à cette fonctionnalité"); - } - } - - - function Display_note_evaluation_func(event) { - var security_retval = check_user_acces_right("note_evaluation", "read"); - - if (security_retval === 1) { - setmenu("note_evaluation"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/note_evaluation"); - document.body.style.backgroundColor = "#ffffff"; - - inactive_active_menu_header("note_evaluation"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à cette fonctionnalité"); - } - } - - function Display_jurys_func(event) { - var security_retval = check_user_acces_right("jury", "read"); - - if (security_retval === 1) { - setmenu("jurys"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/jurys"); - document.body.style.backgroundColor = "#ffffff"; - - inactive_active_menu_header("jurys"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à cette fonctionnalité"); - } - } - - - function Display_conseil_classe_func(event) { - var security_retval = check_user_acces_right("jury", "read"); - - if (security_retval === 1) { - setmenu("conseil_classe"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/conseil_classe"); - document.body.style.backgroundColor = "#ffffff"; - - inactive_active_menu_header("conseil_classe"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à cette fonctionnalité"); - } - } - - - - function Display_conseil_class_func(event) { - var security_retval = check_user_acces_right("jury", "read"); - - if (security_retval === 1) { - setmenu("conseil_class"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/conseil_class"); - document.body.style.backgroundColor = "#ffffff"; - - inactive_active_menu_header("conseil_class"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à cette fonctionnalité"); - } - } - - - function DiplayStagiaireList(event) { - var security_retval = check_user_acces_right("stagiaire", "read"); - if (security_retval === 1) { - setmenu("mes_stagiaires"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/mes_stagiaires"); - document.body.style.backgroundColor = "#ffffff"; - inactive_active_menu_header("my_apprenant"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des stagiaires"); - } - } - - function mes_apprenants_func(event) { - var security_retval = check_user_acces_right("stagiaire", "read"); - if (security_retval === 1) { - setmenu("mes_apprenants"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/mes_apprenants"); - document.body.style.backgroundColor = "#ffffff"; - inactive_active_menu_header("my_apprenant"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des apprenants"); - } - } - - function groupe_apprenant_func(event) { - var security_retval = check_user_acces_right("stagiaire", "read"); - if (security_retval === 1) { - setmenu("groupe_apprenant"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/groupe_apprenant"); - document.body.style.backgroundColor = "#ffffff"; - inactive_active_menu_header("groupe_apprenant"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des stagiaires"); - } - } - - function admission_session_func(event) { - var security_retval = check_user_acces_right("stagiaire", "read"); - if (security_retval === 1) { - setmenu("admission_session"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/admission_session"); - document.body.style.backgroundColor = "#ffffff"; - inactive_active_menu_header("admission_session"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des stagiaires"); - } - } - - function equipe_team_func(event) { - var security_retval = check_user_acces_right("equipe", "read"); - if (security_retval === 1) { - setmenu("equipe_team"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/equipe_team"); - document.body.style.backgroundColor = "#ffffff"; - inactive_active_menu_header("equipe_team"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des équipes"); - } - } - - function DisplayeEmployeList(event) { - var security_retval = check_user_acces_right("employe", "read"); - if (security_retval === 1) { - setmenu("mes_employes"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/mes_employes"); - document.body.style.backgroundColor = "#ffffff"; - inactive_active_menu_header("mes_employes"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des employés"); - } - } - - - function Display_Autre_RH_List(event) { - var security_retval = check_user_acces_right("employe", "read"); - if (security_retval === 1) { - setmenu("autre_rh"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/autre_rh"); - document.body.style.backgroundColor = "#ffffff"; - inactive_active_menu_header("autre_rh"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion des employés"); - } - } - - function DisplayeMaterielList(event) { - var security_retval = check_user_acces_right("materiel", "read"); - - if (security_retval === 1) { - setmenu("mon_materiel"); - setapiexcelimportmessage(); - setformation_file_name(); - document.body.style.backgroundColor = "#ffffff"; - inactive_active_menu_header("my_ressource"); - history.push("/Partner/mon_materiel"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion du matériel pédagogique"); - } - } - - function Display_mes_salles_func(event) { - var security_retval = check_user_acces_right("materiel", "read"); - - if (security_retval === 1) { - setmenu("mes_salles"); - setapiexcelimportmessage(); - setformation_file_name(); - document.body.style.backgroundColor = "#ffffff"; - inactive_active_menu_header("my_ressource"); - history.push("/Partner/mes_salles"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion du matériel pédagogique"); - } - } - - - function Display_mes_opportunites_func(event) { - var security_retval = check_user_acces_right("client", "read"); - - if (security_retval === 1) { - setmenu("mes_opportunites"); - setapiexcelimportmessage(); - setformation_file_name(); - document.body.style.backgroundColor = "#ffffff"; - history.push("/Partner/mes_opportunites"); - inactive_active_menu_header("my_partners"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion du matériel pédagogique"); - } - } - - function config_dashbord_formation_func(event) { - var security_retval = check_user_acces_right("dashbord", "read"); - - if (security_retval === 1) { - setmenu("dashbord_formation"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/dashbord_formation"); - document.body.style.backgroundColor = "#ffffff"; - inactive_active_menu_header("my_tbd"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion du matériel pédagogique"); - } - } - - function config_dashbord_session_func(event) { - var security_retval = check_user_acces_right("dashbord", "read"); - - if (security_retval === 1) { - setmenu("dashbord_session"); - setapiexcelimportmessage(); - setformation_file_name(); - document.body.style.backgroundColor = "#ffffff"; - history.push("/Partner/dashbord_session"); - inactive_active_menu_header("my_tbd"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion du matériel pédagogique"); - } - } - - - function config_dashbord_ressources_humaines_func(event) { - var security_retval = check_user_acces_right("dashbord", "read"); - - if (security_retval === 1) { - setmenu("dashbord_ressources_humaines"); - setapiexcelimportmessage(); - setformation_file_name(); - document.body.style.backgroundColor = "#ffffff"; - history.push("/Partner/dashbord_ressources_humaines"); - inactive_active_menu_header("my_tbd"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion du matériel pédagogique"); - } - } - - - - function config_dashbord_inscriptions_func(event) { - var security_retval = check_user_acces_right("dashbord", "read"); - - if (security_retval === 1) { - setmenu("dashbord_inscriptions"); - setapiexcelimportmessage(); - setformation_file_name(); - document.body.style.backgroundColor = "#ffffff"; - history.push("/Partner/dashbord_inscriptions"); - inactive_active_menu_header("my_tbd"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion du matériel pédagogique"); - } - } - - function config_dashbord_factures_func(event) { - var security_retval = check_user_acces_right("dashbord", "read"); - - if (security_retval === 1) { - setmenu("dashbord_factures"); - setapiexcelimportmessage(); - setformation_file_name(); - document.body.style.backgroundColor = "#ffffff"; - history.push("/Partner/dashbord_factures"); - inactive_active_menu_header("my_tbd"); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion du matériel pédagogique"); - } - } - - function DiplaytrainingList(event) { - - inactive_active_menu_header("my_class"); - setmenu("affichage"); - setapiexcelimportmessage(); - setformation_file_name(); - history.push("/Partner/affichage"); - - inactive_active_menu_header("my_class"); - var server_address = "127.0.0.1"; - //var server_address = "89.156.84.196"; - var form = new FormData(); - - // Recuperation des parametres - var filtre1 = selectedfilt1; - var filtre2 = selectedfilt2; - var filtre3 = selectedfilt3; - - var filtre1_value = ""; - var filtre2_value = ""; - var filtre3_value = ""; - - // Recuperation des valeurs de filtres - - if (selectedfilt1) { - filtre1_value = document.getElementsByName("filtre1")[0].value; - form.append(filtre1, filtre1_value); - } - - if (selectedfilt2) { - filtre2_value = document.getElementsByName("filtre2")[0].value; - form.append(filtre2, filtre2_value); - } - - if (selectedfilt3) { - filtre3_value = document.getElementsByName("filtre3")[0].value; - form.append(filtre3, filtre3_value); - } - - //console.log(" filtres1 = " + filtre1 + " = " + filtre1_value); - //console.log(" filtres2 = " + filtre2 + " = " + filtre2_value); - //console.log(" filtres3 = " + filtre3 + " = " + filtre3_value); - - - form.append("token", stored_cookie); - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/get_partner_class/"; - - axios.post(myurl, form).then(res => { - if (res.data.status !== "False") { - //console.log(" In test res.data.status = " + res.data.status); - //console.log(" In test res.data.message = " + res.data.message); - setmyApiResponse("true"); - setResult(res.data.message) - //setmyApimyApiMessage("OK") - } - else { - //console.log(" In test res.data.status = " + res.data.status); - //console.log(" In test res.data.message = " + res.data.message); - setmyApiResponse("false"); - //setmyApimyApiMessage("") - } - - - }).catch((error) => { - console.warn('Not good man :( mysearchtext = '); - setmyApiResponse("false"); - //setmyApimyApiMessage("") - }) - } - - function logout_confirmation() { - /* si c'est une connexion partner qui est active */ - if (typeof (stored_part) != "undefined") { - removeCookie_part('tokenmysypart', { path: '/' }); - history.push("/recherche-formation"); - } - - const stored_cookie = getCookie('tokenmysypart'); - - if (stored_cookie) { - var acces_right_token_name = stored_cookie + "_uar"; - - removeCookie(acces_right_token_name,); - } - - removeCookie("tokenmysychapprenant"); - removeCookie("tokenmysych"); - removeCookie("tokenmysychconnecteduserid"); - removeCookie("tokenmysytypeconnexion"); - - removeCookie("__stripe_sid"); - removeCookie("__stripe_mid"); - - - removeCookie("tokenmysypart"); - removeCookie("mysy_session_display_view",); - removeCookie("mysy_menu_gauche_reduit",); - removeCookie("mysy_catalog_data_row_grouped_by",); - removeCookie("tokenmysytuteurrhid"); - removeCookie("tokenmysychclient"); - - } - - function logout() { - confirmAlert({ - title: 'Déconnexion ?', - message: 'Confirmez la déconnexion', - buttons: [ - { - label: 'Oui', - onClick: () => logout_confirmation() - }, - { - label: 'Non', - onClick: () => { return } - } - ] - }); - } - - - const imgchangeHandler = (event) => { - let file_size = event.target.files[0].size; - - //or if you like to have name and type - let file_name = event.target.files[0].name; - let file_type = event.target.files[0].type; - - - //alert("file_size = "+file_size+" file_type = "+file_type+" a = "+a); - if (file_size > 10000000) { - alert("L'image doit faire moins de 1 mega Kilo Octets"); - return; - } - setisimgSelectedfile(event.target.files[0]); - setisimgSelected(true); - setuserimgprofil(URL.createObjectURL(event.target.files[0])); - }; - - const [plateforme_super_admin, setplateforme_super_admin] = useState(""); - - const [formation_initiale, setformation_initiale] = useState(""); - const [document_super_admin, setdocument_super_admin] = useState(""); - - const [conntected_employee_activite_retard, setconntected_employee_activite_retard] = useState("0"); - const [conntected_employee_activite_new, setconntected_employee_activite_new] = useState(""); - - const [conntected_employee_email, setconntected_employee_email] = useState(""); - const [conntected_employee_id, setconntected_employee_id] = useState(""); - const [conntected_account_id, setconntected_account_id] = useState(""); - const [conntected_account_partner_owner_recid, setconntected_account_partner_owner_recid] = useState(""); - - - const [GetPartnerNameFromToken_api_result, setGetPartnerNameFromToken_api_result] = useState(); - - function GetPartnerNameFromToken(event) { - - var form = new FormData(); - - //console.log(" GetPartnerNameFromToken stored_cookie = ", stored_cookie); - - form.append("token", stored_cookie); - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/get_partner_account/"; - - axios.post(myurl, form).then(res => { - if (String(res.data.status) === String("true")) { - setGetPartnerNameFromToken_api_result(true); - //console.log(" In GetPartnerNameFromToken res.data.status = " + res.data.status); - // console.log(" In GetPartnerNameFromToken res.data.message = " + res.data.message); - setparntername(JSON.parse(res.data.message).nom); - - setconntected_employee_email(JSON.parse(res.data.message).email); - - if (JSON.parse(res.data.message).nb_activite_retard) - setconntected_employee_activite_retard(JSON.parse(res.data.message).nb_activite_retard) - else - setconntected_employee_activite_retard("0") - - - if (JSON.parse(res.data.message).nb_activite_new) - setconntected_employee_activite_new(JSON.parse(res.data.message).nb_activite_new) - else - setconntected_employee_activite_new("") - - - - if (JSON.parse(res.data.message)._id) { - setconntected_account_id(JSON.parse(res.data.message)._id); - } - else { - setconntected_account_id(""); - } - - - if (JSON.parse(res.data.message).recid) { - setconntected_account_partner_owner_recid(JSON.parse(res.data.message).recid); - } - else { - setconntected_account_partner_owner_recid(""); - } - - if (JSON.parse(res.data.message).pack_service) { - setpartnerPackService(JSON.parse(res.data.message).pack_service); - } - else { - setpartnerPackService("Aucun Service"); - } - - if (JSON.parse(res.data.message).nb_formation) { - setparnternbformation(JSON.parse(res.data.message).nb_formation); - } - else { - setparnternbformation(""); - } - - if (JSON.parse(res.data.message).ressource_humaine_id) { - setconntected_employee_id(JSON.parse(res.data.message).ressource_humaine_id); - } - else { - setconntected_employee_id(""); - } - - - if (JSON.parse(res.data.message).formation_initiale) { - setformation_initiale(JSON.parse(res.data.message).formation_initiale); - } else { - setformation_initiale(""); - } - - if (JSON.parse(res.data.message).document_super_admin) { - setdocument_super_admin(JSON.parse(res.data.message).document_super_admin); - } else { - setdocument_super_admin(""); - } - - if (JSON.parse(res.data.message).plateforme_super_admin) { - setplateforme_super_admin(JSON.parse(res.data.message).plateforme_super_admin); - } else { - setplateforme_super_admin(""); - } - - - - var partner_employee_user_name = "Inconnu"; - - if (JSON.parse(res.data.message).contact_nom) { - partner_employee_user_name = (JSON.parse(res.data.message).contact_nom); - } - - - if (JSON.parse(res.data.message).contact_prenom) { - partner_employee_user_name = partner_employee_user_name + " " + (JSON.parse(res.data.message).contact_prenom); - } - - setparnter_user_employee(partner_employee_user_name); - - - if (JSON.parse(res.data.message).ispending) { - setpartnerstatus(JSON.parse(res.data.message).ispending); - } - - if (JSON.parse(res.data.message).firstconnexion && - String(JSON.parse(res.data.message).firstconnexion) === "0") { - setfirstConnexion("0"); - } else { - setfirstConnexion("1"); - } - - if (JSON.parse(res.data.message).is_partner_admin_account && - String(JSON.parse(res.data.message).is_partner_admin_account) === "1") { - setpart_is_partner_admin_account("1"); - } else { - setpart_is_partner_admin_account("0"); - } - - } - else { - //console.log(" In GetPartnerNameFromToken res.data.status = " + res.data.status); - //console.log(" In GetPartnerNameFromToken res.data.message = " + res.data.message); - - } - - - }).catch((error) => { - console.warn('In GetPartnerNameFromToken Not good man :( mysearchtext = '); - - }) - } - - function sendImage(e) { - var formData = new FormData(); - - formData.append('File', isimgSelectedfile); - formData.append("token", stored_part); - formData.append("type", "partner"); - fetch( - process.env.REACT_APP_API_URL + "myclass/api/recordImage/", - { - method: 'POST', - body: formData, - } - ).then((response) => response.json()) - .then((result) => { - //console.log('Success:', result['message']); - setisimgSelected(false); - - }) - .catch((error) => { - console.error('Error:'); - setisimgSelected(true); - }); - }; - - - - - // Create a reference to the hidden file input element - const hiddenFileInput = React.useRef(null); - - // Programatically click the hidden file input element - // when the Button component is clicked - const handleClick = event => { - hiddenFileInput.current.click(); - }; - // Call a function (passed as a prop from the parent component) - // to handle the user-selected file - const handleChange = event => { - const fileUploaded = event.target.files[0]; - props.handleFile(fileUploaded); - }; - - function alertactivecompte() { - alert(" Vous devez ajouter un mode de Paiement pour acceder à cette fonctionnalité"); - } - - function ValideFirstConnexion() { - setfirstConnexion(""); - setmenu("abonnement"); - } - - const [formation_file_name, setformation_file_name] = useState(); - const [CheckSalesOrder_api, setCheckSalesOrder_api] = useState(""); - const [CheckSalesOrder_message, setCheckSalesOrder_message] = useState(""); - function CheckSalesOrder(event) { - - var form = new FormData(); - - formData.append("token", stored_part); - formData.append("orderid", orderid); - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/CheckSalesOrder/"; - - axios.post(myurl, form).then(res => { - if (String(res.data.status) === String("true")) { - setCheckSalesOrder_api("true") - } - else { - setCheckSalesOrder_api("false") - setCheckSalesOrder_message(String(res.data.message)) - } - - - }).catch((error) => { - //console.log('In CheckSalesOrder ', error); - setCheckSalesOrder_api("false") - - }) - } - - const [isLoading, setLoading] = useState(); - - - const [GetPartnerLMSData_api, setGetPartnerLMSData_api] = useState(); - const [GetPartnerLMSData_result, setGetPartnerLMSData_result] = useState(); - const [GetPartnerLMSData_message, setGetPartnerLMSData_message] = useState(); - - const [partner_lms_virtualhost_url, setpartner_lms_virtualhost_url] = useState(); - const [partner_lms_url, setpartner_lms_url] = useState(); - const [has_partner_lms_url, sethas_partner_lms_url] = useState(); - - function GetPartnerLMSData(event) { - - var form = new FormData(); - - form.append("token", stored_cookie); - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/LMS_Get_Partner_Data/"; - - axios.post(myurl, form).then(res => { - if (String(res.data.status) === String("true")) { - //console.log(" In GetPartnerLMSData res.data.status = " + res.data.status); - //console.log(" In GetPartnerLMSData res.data.message = " + res.data.message); - setGetPartnerLMSData_api("true"); - setGetPartnerLMSData_result(res.data.message); - var my_lms_url = ""; - if (JSON.parse(res.data.message).lms_account && - String(JSON.parse(res.data.message).lms_account) === "1") { - sethas_partner_lms_url(JSON.parse(res.data.message).lms_account); - my_lms_url = (JSON.parse(res.data.message).lms_virtualhost_url) + "user_portal.php?recid=" + encodeURIComponent(JSON.parse(res.data.message).lms_part_recid) + - "&mysytoken=" + encodeURIComponent(JSON.parse(res.data.message).lms_pwd_mask); - - // console.log(" ### LMS url = ", my_lms_url); - setpartner_lms_url(my_lms_url); - - setpartner_lms_virtualhost_url((JSON.parse(res.data.message).lms_virtualhost_url)); - } - - } - else { - setGetPartnerLMSData_api("false"); - setGetPartnerLMSData_message(res.data.message); - } - - - }).catch((error) => { - console.warn('In GetPartnerLMSData Not good man :( mysearchtext = ', error); - setGetPartnerLMSData_api("false"); - - }) - } - - const [deplie_hebergement, setdeplie_hebergement] = useState(); - function ftion_deplie_hebergement() { - if (String(deplie_hebergement) === "1") { - setdeplie_hebergement(); - } else { - setdeplie_hebergement("1"); - } - - } - const [deplie_mes_clients, setdeplie_mes_clients] = useState(); - function ftion_deplie_mes_clients() { - if (String(deplie_mes_clients) === "1") { - setdeplie_mes_clients(); - } else { - setdeplie_mes_clients("1"); - } - - } - - const [Dialog_1_message, setDialog_1_message] = React.useState(false); - const [Dialog_1_open, setDialog_1_open] = React.useState(false); - function Dialog_1_handle_acces_insuffisant(message) { - setDialog_1_message(message); - setDialog_1_open(true); - } - - const Dialog_1_handleClose = () => { - //alert(" Utiliser le bouton 'fermer' "); - //setOpen(false); - }; - - const Dialog_1_handleClose_buton = () => { - setDialog_1_open(false); - }; - - const [Update_Connexion_Context_api, setUpdate_Connexion_Context_api] = useState(); - const [Update_Connexion_Context_message, setUpdate_Connexion_Context_message] = useState(); - const [Update_Connexion_Context_result, setUpdate_Connexion_Context_result] = useState([]); - function Update_Connexion_Context(local_key, local_value) { - - var form = new FormData(); - - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - form.append("partner_id", conntected_account_id); - - var my_key = local_key; - - var local_node = {}; - - local_node[String(my_key)] = local_value; - - var tab_node = []; - tab_node.push(local_node) - - var tab_context_json_str = JSON.stringify(tab_node); - form.append("tab_context_json", tab_context_json_str); - - - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Update_Context_Partner_Account/"; - setLoading(true); - axios.post(myurl, form).then(res => { - //console.log(" In Update_Connexion_Context res.data.status = " + res.data.status); - //console.log(" In Update_Connexion_Context res.data.message r_class = " + res.data.message); - - setLoading(false); - if (String(res.data.status) === String("true")) { - setUpdate_Connexion_Context_api("true"); - setUpdate_Connexion_Context_result(res.data.message); - - - } - else { - setUpdate_Connexion_Context_api("false"); - setUpdate_Connexion_Context_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('Update_Connexion_Context : Not good man :( mysearchtext = ' + error); - setUpdate_Connexion_Context_api("false"); - alert(" Impossible de mettre à jour le contexte de connexion"); - - }) - } - - const [left_menu, setleft_menu] = React.useState(); - - const open_close_left_menu = () => { - if (left_menu === true) { - setleft_menu(false); - setcookie_menu_gauche_reduit("mysy_menu_gauche_reduit", "1", { path: '/' }); - // Mettre à jour le context de connexion, coté backoffice - Update_Connexion_Context("mysy_menu_gauche_reduit", "1"); - } - else { - setleft_menu(true); - setcookie_menu_gauche_reduit("mysy_menu_gauche_reduit", "0", { path: '/' }); - // Mettre à jour le context de connexion, coté backoffice - Update_Connexion_Context("mysy_menu_gauche_reduit", "0"); - } - - }; - - - const [selected_menu_header, setselected_menu_header] = React.useState(""); - const [Dialog_SEND_EMAIL_open, setDialog_SEND_EMAIL_open] = React.useState(false); - - - const Dialog_SEND_EMAIL_handleClose = () => { - setDialog_SEND_EMAIL_open(false); - } - - const Clean_Selected_Rows_For_Email = () => { - //setSelectionModel([]) - } - - - function update_nb_activite_en_retard(new_val) { - setconntected_employee_activite_retard(String(new_val)); - } - - function update_nb_activite_en_new(new_val) { - setconntected_employee_activite_new(String(new_val)); - } - - const [display_alert_mysy, setdisplay_alert_mysy] = useState(""); - const [alert_message, setalert_message] = useState(""); - const [alert_type, setalert_type] = useState(""); - - function clear_alert_message() { - setalert_message(""); - } - function clear_alert_type() { - setalert_type(""); - } - function clear_display_alert_mysy() { - setdisplay_alert_mysy(""); - } - - - return ( - -
- - - - Partenaires editeurs formations - - - - -
- {isLoading &&
-
-
} - - - {/*** Affichage des messages d'alerte*/} - {display_alert_mysy && String(display_alert_mysy) === "1" && - - } - {/*** FIN Affichage des messages d'alerte*/} - - - - MySy Warning - - - {Dialog_1_message} - - - - - - - - - - - { /********* Dialog redaction email */} - null} - > - - - - - {Dialog_1_message} - - - - - - - - - - { /********* Fin Dialog redaction email */} - - - {left_menu === true &&
-
- - - - - - {!isimgSelected && String(part_is_partner_admin_account) === "1" &&
- - - - - -
} - - {isimgSelected &&
- -
} - - - {String(part_is_partner_admin_account) === "1" && } - - - {String(part_is_partner_admin_account) !== "1" &&
- {parnter_user_employee} - {!parntername && Utilisateur }
- {GetPartnerNameFromToken_api_result && conntected_employee_activite_retard && parseFloat(conntected_employee_activite_retard) > 0 && - { - monactivite_func(); - - }}> - - -     - }     - - {GetPartnerNameFromToken_api_result && conntected_employee_activite_new && parseFloat(conntected_employee_activite_new) > 0 && - { - monactivite_func(); - - }}> - - -     - - } - -
} - - {String(formation_initiale) === "1" &&
Ftion Initiale - - -
} - - - -
- - - } style={{ overflow: 'hidden' }}> - {String(menu) !== "infopartner" && }> MES INFORMATIONS } - {String(menu) === "infopartner" && }> MES INFORMATIONS } - - - {String(menu) !== "monactivite" && }> MON ACTIVITE } - {String(menu) === "monactivite" && }> MON ACTIVITE } - - - {String(menu) !== "mon_tableau_de_bord" && }> MON TABLEAU DE BORD } - {String(menu) === "mon_tableau_de_bord" && }> MON TABLEAU DE BORD } - - - {String(menu) !== "abonnement" && } > ABONNEMENT } - {String(menu) === "abonnement" && }> ABONNEMENT } - - - {String(menu) !== "facture" && }> FACTURE MYSY} - {String(menu) === "facture" && }>FACTURE MYSY} - - - - - -
-
- - {String(menu) !== "internal_email" &&   - -   EMAILS    { - // monactivite_func(); - }}> - - - } - {String(menu) === "internal_email" &&     EMAILS    { - // monactivite_func(); - }}>} - -
- - -
- - {String(menu) !== "tous_mes_document" &&     DOCUMENTS (GED) } - {String(menu) === "tous_mes_document" &&     DOCUMENTS (GED) } - -
- - - -
- -
- - - } style={{ overflow: 'hidden' }}> - {String(menu) !== "affichage" && }> CATALOGUE } - {String(menu) === "affichage" && }> CATALOGUE } - - {String(menu) !== "mes_ue" && }> UNIT. ENSEI. } - {String(menu) === "mes_ue" && }> UNIT. ENSEI. } - - {String(menu) !== "domaine_categorie_metier" && }> CARACTERISTIQUES } - {String(menu) === "domaine_categorie_metier" && }> CARACTERISTIQUES } - - {String(menu) !== "part_produit_service" && }> PRODUITS & SERVICES } - {String(menu) === "part_produit_service" && }> PRODUITS & SERVICES } - - - - - -
- - - -
- - {String(menu) !== "mes_sessions" &&    SESSIONS } - {String(menu) === "mes_sessions" &&    SESSIONS } - -
- - {String(formation_initiale) === "1" &&
- - {String(menu) !== "mes_promotions" &&    PROMOTIONS } - {String(menu) === "mes_promotions" &&    PROMOTIONS } - -
} - - - {String(formation_initiale) === "1" && -
- - {String(menu) !== "note_evaluation" &&    NOTES & EVAL. } - {String(menu) === "note_evaluation" &&    NOTES & EVAL. } - -
} - - - -
- - - } style={{ overflow: 'hidden' }}> - {String(menu) !== "mes_apprenants" && }> FICHE APPRENANTS } - {String(menu) === "mes_apprenants" && }> FICHE APPRENANTS } - - {String(menu) !== "mes_stagiaires" && }> INSCRIPTIONS } - {String(menu) === "mes_stagiaires" && }> INSCRIPTIONS } - - {String(formation_initiale) === "1" && String(menu) !== "admission_session" && }> ADMISSIONS } - {String(formation_initiale) === "1" && String(menu) === "admission_session" && }> ADMISSIONS } - - - {String(formation_initiale) === "1" && String(menu) !== "groupe_apprenant" && }> GROUPE APPRENANTS } - {String(formation_initiale) === "1" && String(menu) === "groupe_apprenant" && }> GROUPE APPRENANTS } - - - - - - - -
- -
- - - } style={{ overflow: 'hidden' }}> - {String(menu) !== "mes_employes" && }> EMPLOYES } - {String(menu) === "mes_employes" && }> EMPLOYES } - - {String(formation_initiale) === "1" && String(menu) !== "autre_rh" && }> AUTRE RH } - {String(formation_initiale) === "1" && String(menu) === "autre_rh" && }> AUTRE RH } - - - - {String(menu) !== "mes_salles" && }> SALLES } - {String(menu) === "mes_salles" && }> SALLES } - - {String(menu) !== "mon_materiel" && }> MON MATERIEL } - {String(menu) === "mon_materiel" && }> MON MATERIEL } - - - - - - - -
- -
- - {String(menu) !== "module_agenda" &&    PLANNING } - {String(menu) === "module_agenda" &&    PLANNING } - - - - - { - setDialog_SEND_EMAIL_open(true); - }} >    MARKET. MAIL - - - - -
- - - -
-
- - - } style={{ overflow: 'hidden' }}> - {String(menu) !== "mes_clients" && }> CLIENTS / FINANCEURS} - {String(menu) === "mes_clients" && }>CLIENTS / FINANCEURS } - - {String(menu) !== "mes_opportunites" && }> OPPORTUNITES } - {String(menu) === "mes_opportunites" && }> OPPORTUNITES } - - {String(menu) !== "pricing" && }> PRIX CLIENT } - {String(menu) === "pricing" && }> PRIX CLIENT } - - - - - - - -
- -
- - {String(menu) !== "equipe_team" &&    EQUIPE } - {String(menu) === "equipe_team" &&    EQUIPE } - - -
- -
- - - } style={{ overflow: 'hidden' }}> - {String(menu) !== "mes_cmd" && }> DEVIS} - {String(menu) === "mes_cmd" && }>DEVIS } - - {String(menu) !== "factures_client" && }> FACTURES & AVOIRS } - {String(menu) === "factures_client" && }> FACTURES & AVOIRS } - - - - - - -
- - -
- - {String(menu) !== "prix_achat" &&    PRIX ACHAT } - {String(menu) === "prix_achat" &&    PRIX ACHAT } - - -
- - {String(formation_initiale) === "1" &&
} - - {/*String(formation_initiale) === "1" && -
- - {String(menu) !== "jurys" &&    JURYS } - {String(menu) === "jurys" &&    JURYS } - -
*/} - - - {String(formation_initiale) === "1" &&
- - - } style={{ overflow: 'hidden' }}> - - {String(menu) !== "jurys" &&    JURYS } - {String(menu) === "jurys" &&    JURYS } - - {String(menu) !== "conseil_class" &&    CONSEILS } - {String(menu) === "conseil_class" &&    CONSEILS } - - - - - - - - -
} - - - - - -
- -
- - - } style={{ overflow: 'hidden' }}> - - {String(has_partner_lms_url) === "1" && { - if (String(check_user_acces_right("lms", "write")) === "1") { - e.preventDefault(); - window.open( - partner_lms_url, - '_blank' - ); - } else { - Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour accéder à la gestion du E-Learning"); - } - }} className="sousmenu" icon={}> MON HEBERGEMENT } - - - - {String(has_partner_lms_url) === "1" && String(menu) !== "setuplms" && }> CONFIGURATION } - {String(has_partner_lms_url) === "1" && String(menu) === "setuplms" && }> CONFIGURATION } - - - - - - -
- - {/*
-
- - - } style={{ overflow: 'hidden' }}> - {String(menu) !== "dashbord_formation" && }> FORMATION } - {String(menu) === "dashbord_formation" && }> FORMATION } - - {String(menu) !== "dashbord_session" && }>PROMOTIONS } - {String(menu) === "dashbord_session" && }> PROMOTIONS } - - {String(menu) !== "dashbord_ressources_humaines" && }> RES. HUMAINES } - {String(menu) === "dashbord_ressources_humaines" && }> RES. HUMAINES } - - {String(menu) !== "dashbord_inscriptions" && }> INSCRIPTIONS } - {String(menu) === "dashbord_inscriptions" && }> INSCRIPTIONS } - - {String(menu) !== "dashbord_factures" && }> FACTURES } - {String(menu) === "dashbord_factures" && }> FACTURES } - - - - - - - -
*/} - -
-
- - - } style={{ overflow: 'hidden' }}> - {String(menu) !== "config_document" && }> DOCUMENTS & MAILS} - {String(menu) === "config_document" && }> DOCUMENTS & MAILS } - - - {String(document_super_admin) === "1" && String(menu) !== "super_admin_config_document" && }> DOCUMENTS SUPERADMIN} - {String(document_super_admin) === "1" && String(menu) === "super_admin_config_document" && }> DOCUMENTS SUPERADMIN } - - - - {String(menu) !== "config_champ_specific" && }> CHAMP SPECIFIQUE } - {String(menu) === "config_champ_specific" && }> CHAMP SPECIFIQUE } - - {String(menu) !== "config_technique" && }> TECHNIQUE } - {String(menu) === "config_technique" && }> TECHNIQUE } - - - - {String(menu) !== "config_session_steps" && }> SESSION ETAPE } - {String(menu) === "config_session_steps" && }> SESSION ETAPE } - - - {String(menu) !== "config_jours_heures" && }> JOURS & HEURES } - {String(menu) === "config_jours_heures" && }> JOURS & HEURES } - - - {String(menu) !== "config_formulaires" && }> FORMULAIRES } - {String(menu) === "config_formulaires" && }> FORMULAIRES } - - - - - - - -
- - {String(formation_initiale) === "1" &&
-
-
- - - } style={{ overflow: 'hidden' }}> - {String(menu) !== "config_formation_initiale" && }> GENERAL } - {String(menu) === "config_formation_initiale" && }> GENERAL } - - {String(menu) !== "admission_process" && }> PROCESS ADMINISSION } - {String(menu) === "admission_process" && }> ADMINISSION } - - {String(menu) !== "administration_pedagogique" && }> ADMIN PEDAGOGIQUE } - {String(menu) === "administration_pedagogique" && }> ADMIN PEDAGOGIQUE } - - {String(menu) !== "competence_pedagogique" && }> COMPETENCE PEDAGOGIQUE } - {String(menu) === "competence_pedagogique" && }> COMPETENCE PEDAGOGIQUE } - - - - - - - -
-
} - - {String(plateforme_super_admin) === "1" &&
-
-
- - - } style={{ overflow: 'hidden' }}> - {String(menu) !== "config_plateforme_partners" && }> BUSINESS PART. } - {String(menu) === "config_plateforme_partners" && }> BUSINESS PART. } - - - - - - -
-
} - -
-
- -
} - - { - left_menu === true &&
- {String(firstConnexion) === "1" && String(part_is_partner_admin_account) === "1" && -
-
- Bienvenue chez MySy, cher partenaire !
 
- C'est votre première connexion, et toute l'équipe est ravie de vous accueillir dans l'aventure.
- Pour commencer à publier vos formations et profiter pleinement de notre plateforme, il vous suffit de choisir une formule d'abonnement en cliquant
-  
Et merci de faire partie du voyage ! -
- -
} - - {String(firstConnexion) === "1" && String(part_is_partner_admin_account) !== "1" && -
-
- Bienvenue chez MySy, cher Utilisateur
 
- C'est votre première connexion, et toute l'équipe est ravie de vous accueillir dans l'aventure.
- Nous vous invitons à modifier votre mot de passe à partir du menu "MES INFORMATIONS" ==> Bouton "SECURITE"

-
-  
Merci. -
- -
} - - - {String(myApiResponse) === String("false") &&
-
Impossible de contacter l'hote distant. Merci de contacter votre administrateur
-
- - } - - {String(menu) === "affichage" && -
- - -
- } - - {String(menu) === "tous_mes_document" && -
- -
- } - - - {String(menu) === "internal_email" && -
- -
- } - - - - - - {String(menu) === "mes_ue" && -
- - -
- } - - {String(menu) === "domaine_categorie_metier" && -
- - -
- } - - {String(menu) === "part_produit_service" && -
- - -
- } - - - {String(menu) === "config_formation_initiale" && -
- - -
- } - - {String(menu) === "admission_process" && -
- - -
- } - - - {String(menu) === "administration_pedagogique" && -
- - - -
- } - - {String(menu) === "competence_pedagogique" && -
- - - -
- } - - - - {String(menu) === "config_plateforme_partners" && -
- - -
- } - - - - - {String(menu) === "note_evaluation" && -
- - -
- } - - {String(menu) === "jurys" && -
- - -
- } - - {String(menu) === "conseil_classe" && -
- - -
- } - - - {String(menu) === "groupe_apprenant" && -
- - -
- } - - {String(menu) === "admission_session" && -
- - -
- } - - - - - {String(menu) === "checkout" &&
- - -
- - } - - {String(menu) === "creation" && -
- - -
- {String(apiexcelimportmessage) === String("true") && -
- {excelimportmessage}
 
- -
- - } - {String(apiexcelimportmessage) === String("false") && -
- Impossible de traiter le fichier
- {excelimportmessage} -
 
-
- - } - - {String(apiexcelimportmessage) === String("-1") && -
- Impossible de traiter le fichier
 
-
- - } - - -
-
- - - {String(partnerstatus) === String("0") &&
- -
- {formation_file_name && } - - - - - Télécharger un fichier modèle - -
- - {/*
*/} -
  -
- - - - 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
-
-
 
- - - - - -
} - - {String(partnerstatus) !== String("0") &&
- - - Import excel d'une formation Télécharger un fichier modèle - -
- - - - -
-
- -
- -
} -
- -
- -
-
- {/*
-
Création manuelle d'une formation
- - -
*/} - -
- } - - - {String(menu) === "infopartner" && -
- -
- } - - - - {String(menu) === "statistique" && -
- -
- } - - {String(menu) === "setuplms" && -
- -
- } - - - {String(menu) === "mes_sessions" && -
- - -
- } - - - - {String(menu) === "mes_promotions" && -
- - -
- } - - - {String(menu) === "mes_employes" && -
- -
- } - - {String(menu) === "autre_rh" && -
- -
- } - - {String(menu) === "factures_client" && -
- -
- } - - {String(menu) === "prix_achat" && -
- -
- } - - - {String(menu) === "mon_materiel" && -
- -
- } - - - {String(menu) === "mes_salles" && -
- -
- } - - {String(menu) === "mes_opportunites" && -
- - -
- } - - {String(menu) === "equipe_team" && -
- - -
- } - - - {String(menu) === "mes_cmd" && -
- -
- } - - - {String(menu) === "facture" &&
- - -
- } - - {String(menu) === "pricing" &&
- - -
- } - - {String(menu) === "mes_apprenants" &&
- - - -
- } - - {String(menu) === "mes_stagiaires" &&
- - -
- } - - - {String(menu) === "abonnement" &&
- - -
- } - - {String(menu) === "ordervalide" && orderid && packs &&
- -
- } - - {String(menu) === "mes_clients" &&
- - -
- } - - - - {String(menu) === "config_document" &&
- - -
- } - - {String(menu) === "config_document_super_admin" &&
- - -
- } - - - {String(menu) === "config_technique" &&
- - -
- } - - - {String(menu) === "config_session_steps" &&
- - -
- } - - - - {String(menu) === "config_jours_heures" &&
- - -
- } - - - {String(menu) === "config_formulaires" &&
- - - -
- } - - - {String(menu) === "config_champ_specific" &&
- - -
- } - - - {String(menu) === "module_agenda" &&
- - -
- } - - - {String(menu) === "dashbord_session" &&
- - -
- } - - {String(menu) === "dashbord_formation" &&
- - -
- } - - {String(menu) === "dashbord_ressources_humaines" &&
- - -
- } - - {String(menu) === "dashbord_inscriptions" &&
- -
- } - - - {String(menu) === "dashbord_factures" &&
- -
- } - - {String(menu) === "mon_tableau_de_bord" &&
- - - -
- } - - {String(menu) === "monactivite" &&
- -
- } - - - -
- } - - - {/* div_gauche div_gauche_reduit */} - { - left_menu === false &&
-
- - - -

- - - - {String(menu) !== "infopartner" &&
 
} - {String(menu) === "infopartner" &&
 
} -
-
- - - - {String(menu) !== "monactivite" &&
 
} - {String(menu) === "monactivite" &&
 
} -
-
- - - - - {String(menu) !== "mon_tableau_de_bord" &&
 
} - {String(menu) === "mon_tableau_de_bord" &&
 
} -
-
- - - - {String(menu) !== "module_agenda" &&
 
} - {String(menu) === "module_agenda" &&
 
} -
-
- - - - {String(menu) !== "abonnement" &&
 
} - {String(menu) === "abonnement" &&
 
} -
-
- - - - {String(menu) !== "facture" &&
 
} - {String(menu) === "facture" &&
 
} -
-
- - - - {String(menu) !== "internal_email" &&
 
} - {String(menu) === "internal_email" &&
 
} -
-
- - - - - - {String(menu) !== "tous_mes_document" &&
 
} - {String(menu) === "tous_mes_document" &&
 
} -
-
- - -

- - {/* - - {String(menu) !== "creation" &&
 
} - {String(menu) === "creation" &&
} -
-
*/} - - - - {String(menu) !== "affichage" &&
 
} - {String(menu) === "affichage" &&
 
} -
-
- - - - {String(menu) !== "mes_ue" &&
 
} - {String(menu) === "mes_ue" &&
 
} -
-
- - - - - {String(menu) !== "domaine_categorie_metier" &&
 
} - {String(menu) === "domaine_categorie_metier" &&
 
} -
-
- - - - {String(menu) !== "part_produit_service" &&
 
} - {String(menu) === "part_produit_service" &&
 
} -
-
- - - - - - {String(menu) !== "mes_sessions" &&
 
} - {String(menu) === "mes_sessions" &&
 
} -
-
- - - {String(formation_initiale) === "1" && - {String(menu) !== "mes_promotions" &&
 
} - {String(menu) === "mes_promotions" &&
 
} -
-
} - - - - - {String(formation_initiale) === "1" && - {String(menu) !== "jurys" &&
 
} - {String(menu) === "jurys" &&
 
} -
-
} - - - {String(formation_initiale) === "1" && - {String(menu) !== "conseil_classe" &&
 
} - {String(menu) === "conseil_classe" &&
 
} -
-
} - - - - {String(formation_initiale) === "1" && - {String(menu) !== "note_evaluation" &&
 
} - {String(menu) === "note_evaluation" &&
 
} -
} -
- - - - - {String(menu) !== "mes_stagiaires" &&
 
} - {String(menu) === "mes_stagiaires" &&
 
} -
-
- - - - {String(menu) !== "mes_apprenants" &&
 
} - {String(menu) === "mes_apprenants" &&
 
} -
-
- - - -
{ - setDialog_SEND_EMAIL_open(true); - }} >  
-
-
- - - {String(formation_initiale) === "1" && - {String(menu) !== "admission_session" &&
 
} - {String(menu) === "admission_session" &&
 
} -
} -
- - - - {String(formation_initiale) === "1" && - {String(menu) !== "groupe_apprenant" &&
 
} - {String(menu) === "groupe_apprenant" &&
 
} -
} -
- - - - - {String(menu) !== "mes_employes" &&
 
} - {String(menu) === "mes_employes" &&
 
} -
-
- - {String(formation_initiale) === "1" && <> - - - {String(menu) !== "autre_rh" &&
 
} - {String(menu) === "autre_rh" &&
 
} -
-
- - } - - - - {String(menu) !== "mon_materiel" &&
 
} - {String(menu) === "mon_materiel" &&
 
} -
-
- - - - - {String(menu) !== "statistique" &&
 
} - {String(menu) === "statistique" &&
 
} -
-
- - -

- - - - - - - - - - - - - - - - - -

- - - {String(has_partner_lms_url) === "1" &&
{ - e.preventDefault(); - window.open( - partner_lms_url, - '_blank' - ); - }}> - - - - -
} - - {String(has_partner_lms_url) === "1" && } - - - -
-
- } - - {/* div_droite div_droite_ralonge */} - { - left_menu === false &&
- - {String(firstConnexion) === "1" && String(part_is_partner_admin_account) === "1" && -
-
- Bienvenue chez MySy, cher partenaire !
 
- C'est votre première connexion, et toute l'équipe est ravie de vous accueillir dans l'aventure.
- Pour commencer à publier vos formations et profiter pleinement de notre plateforme, il vous suffit de choisir une formule d'abonnement en cliquant
-  
Et merci de faire partie du voyage ! -
- -
} - - {String(firstConnexion) === "1" && String(part_is_partner_admin_account) !== "1" && -
-
- Bienvenue chez MySy, cher Utilisateur
 
- C'est votre première connexion, et toute l'équipe est ravie de vous accueillir dans l'aventure.
- Nous vous invitons à modifier votre mot de passe à partir du menu "MES INFORMATIONS" ==> Bouton "SECURITE"

-
-  
Merci. -
- -
} - - - {String(myApiResponse) === String("false") &&
-
Impossible de contacter l'hote distant. Merci de contacter votre administrateur
-
- - } - - {String(menu) === "affichage" && -
- - -
- } - - {String(menu) === "mes_ue" && -
- -
- } - - - {String(menu) === "domaine_categorie_metier" && -
- -
- } - - {String(menu) === "part_produit_service" && -
- -
- } - - - - {String(menu) === "config_formation_initiale" && -
- - -
- } - - {String(menu) === "admission_process" && -
- - -
- } - - {String(menu) === "administration_pedagogique" && -
- - -
- } - - {String(menu) === "competence_pedagogique" && -
- - -
- } - - - - {String(menu) === "note_evaluation" && -
- - -
- } - - {String(menu) === "jurys" && String(formation_initiale) === "1" && -
- - -
- } - - - {String(menu) === "internal_email" && -
- - -
- } - - {String(menu) === "tous_mes_document" && -
- -
- } - - - {String(menu) === "conseil_classe" && String(formation_initiale) === "1" && -
- - -
- } - - {String(menu) === "groupe_apprenant" && -
- - -
- } - - - {String(menu) === "admission_session" && -
- - -
- } - - - {String(menu) === "checkout" &&
- - -
- - } - - {String(menu) === "creation" && -
- - -
- {String(apiexcelimportmessage) === String("true") && -
- {excelimportmessage}
 
- -
- - } - {String(apiexcelimportmessage) === String("false") && -
- Impossible de traiter le fichier
- {excelimportmessage} -
 
-
- - } - - {String(apiexcelimportmessage) === String("-1") && -
- Impossible de traiter le fichier
 
-
- - } - - -
-
- - - {String(partnerstatus) === String("0") &&
- -
- {formation_file_name && } - - - - - Télécharger un fichier modèle - -
- - {/*
*/} -
  -
- - - - 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
-
-
 
- - - - - -
} - - {String(partnerstatus) !== String("0") &&
- - - Import excel d'une formation Télécharger un fichier modèle - -
- - - - -
-
- -
- -
} -
- -
- -
-
-
-
Création manuelle d'une formation
- - -
- -
- } - - - {String(menu) === "infopartner" && -
- - - -
- } - - {String(menu) === "statistique" && -
- -
- } - - {String(menu) === "setuplms" && -
- -
- } - - - {String(menu) === "mes_sessions" && -
- - -
- } - - {String(menu) === "mes_sessions" && -
- - -
- } - - - {String(menu) === "mes_employes" && -
- -
- } - - {String(menu) === "autre_rh" && -
- -
- } - - - {String(menu) === "factures_client" && -
- -
- } - - {String(menu) === "prix_achat" && -
- -
- } - - - {String(menu) === "mon_materiel" && -
- -
- } - - - {String(menu) === "mes_salles" && -
- -
- } - - {String(menu) === "mes_opportunites" && -
- -
- } - - {String(menu) === "equipe_team" && -
- -
- } - - - {String(menu) === "mes_cmd" && -
- -
- } - - - {String(menu) === "facture" &&
- - -
- } - - {String(menu) === "pricing" &&
- - -
- } - - {String(menu) === "mes_apprenants" &&
- - -
- } - - {String(menu) === "mes_stagiaires" &&
- - -
- } - - - {String(menu) === "abonnement" &&
- - -
- } - - {String(menu) === "ordervalide" && orderid && packs &&
- -
- } - - {String(menu) === "mes_clients" &&
- - -
- } - - - - {String(menu) === "config_document" &&
- - -
- } - - {String(menu) === "config_technique" &&
- - -
- } - - - {String(menu) === "config_session_steps" &&
- - -
- } - - - - {String(menu) === "config_jours_heures" &&
- - -
- } - - - {String(menu) === "config_formulaires" &&
- - - -
- } - - - {String(menu) === "config_champ_specific" &&
- - -
- } - - - {String(menu) === "module_agenda" &&
- - -
- } - - - {String(menu) === "dashbord_session" &&
- - -
- } - - {String(menu) === "dashbord_formation" &&
- - -
- } - - {String(menu) === "dashbord_ressources_humaines" &&
- - -
- } - - - {String(menu) === "mon_tableau_de_bord" &&
- - -
- } - - {String(menu) === "monactivite" &&
- -
- } - - - -
- } -
-
- - - ) -} - - -export default Partner_ARG_140326; \ No newline at end of file diff --git a/src/components/Partner_Client.js b/src/components/Partner_Client.js index ff188d2..25ecf75 100644 --- a/src/components/Partner_Client.js +++ b/src/components/Partner_Client.js @@ -2053,9 +2053,7 @@ const Partner_Client = (props) => {
- {String(Edite_Client) === "1" &&
- -
Détail client / Financeur {Client_nom} - {Client_email}
+ {String(Edite_Client) === "1" &&