16/12/2023 - 23h12

recette2
cherif 2023-12-16 23:13:02 +01:00
parent d9104ba9a6
commit 906ff4aad7
3 changed files with 126 additions and 43 deletions

View File

@ -427,7 +427,7 @@ const AddParnerClient = (props) => {
}
useEffect(() => {
Get_List_Client_Type();
if (String(props.new_customer) !== "1") {
setformedit_mode("0");
@ -440,7 +440,7 @@ const AddParnerClient = (props) => {
setdatamodification_invoice("0");
Get_List_Contact_Of_client_Part();
Get_List_Client_Type();
} else {
@ -900,32 +900,32 @@ const AddParnerClient = (props) => {
}
function Disable_fields() {
if (document.getElementsByName("client_email")) {
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")) {
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")) {
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")) {
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")) {
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")) {
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";
}
@ -1215,6 +1215,7 @@ const AddParnerClient = (props) => {
}
form.append("raison_sociale", client_raison_sociale);
var client_adresse = ""
if (document.getElementsByName("client_adresse")) {
client_adresse = document.getElementsByName("client_adresse")[0].value;
@ -1982,12 +1983,12 @@ const AddParnerClient = (props) => {
setis_contact_include_com(false);
if (mylocalclient_contact.include_com){
if (mylocalclient_contact.include_com) {
if (String(mylocalclient_contact.include_com) === "1")
setis_contact_include_com(true);
}
if (mylocalclient_contact.siret)
@ -2145,7 +2146,7 @@ const AddParnerClient = (props) => {
return (
<div className="add_partner_client">
{String(props.new_customer) === "1" && <div className="div_row" style={{"paddingRight":"5px"}}>
{String(props.new_customer) === "1" && <div className="div_row" style={{ "paddingRight": "5px" }}>
<div className="div_row">
<Button variant="outlined" onClick={submenu_donnee_client} className="detail_submenu" id='submenu_donnee_client' name='submenu_donnee_client'>Données Client</Button>
</div>
@ -2200,6 +2201,36 @@ const AddParnerClient = (props) => {
/>
</div>
<div className="session_caract"> Type client <br />
<TextField
required
name="client_type_id"
id="client_type_id"
select
//label="Raison sociale"
InputLabelProps={{
shrink: true,
}}
disabled={false}
className="disabled_style"
value={p_client_type_id}
onChange={(e) => {
setp_client_type_id(e.target.value);
}}
>
{Get_List_Client_Type_result &&
Get_List_Client_Type_result.map((myclass) => (
<MenuItem key={JSON.parse(myclass)._id} value={JSON.parse(myclass)._id} style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }}>
{JSON.parse(myclass).code}
</MenuItem>
))}
</TextField>
</div>
<div className="session_caract"> N° Siret <br />
<TextField
@ -2303,7 +2334,7 @@ const AddParnerClient = (props) => {
/>
</div>
<div className="session_caract"> Email <br />
<div className="session_caract"> Site web <br />
<TextField
required
name="client_website"
@ -2328,7 +2359,7 @@ const AddParnerClient = (props) => {
<div className="div_row_gauche">
<Popup
trigger={
<Button variant="contained" color="success" className="bton_enreg " >Enregistrer &nbsp; <AiTwotoneSave /> </Button>
<Button variant="contained" color="success" className="bton_enreg " >Enregistrer &nbsp; <AiTwotoneSave /> </Button>
}
modal
@ -2429,7 +2460,7 @@ const AddParnerClient = (props) => {
</div>
<div className="session_caract"> Raison sociale<br />
<div className="session_caract"> Raison sociale <br />
<TextField
required
name="client_raison_sociale"
@ -2460,7 +2491,7 @@ const AddParnerClient = (props) => {
</div>}
{String(formedit_mode) === "1" && <div className="session_caract"> Type client<br />
{String(formedit_mode) === "1" && <div className="session_caract"> Type client <br />
<TextField
required
name="client_type_id"
@ -2798,7 +2829,7 @@ const AddParnerClient = (props) => {
<div >
{(JSON.parse(client).nom || JSON.parse(client).prenom) &&
<nav style={{ "width": "100%", "float": "left" }}>
<nav className="grid_title" style={{ "width": "75%", "float": "left", "cursor":"pointer" }} contactmail={String(JSON.parse(client).email)} contact_id={String(JSON.parse(client)._id)} onClick={Display_Part_Client_Contact}>
<nav className="grid_title" style={{ "width": "75%", "float": "left", "cursor": "pointer" }} contactmail={String(JSON.parse(client).email)} contact_id={String(JSON.parse(client)._id)} onClick={Display_Part_Client_Contact}>
{String(JSON.parse(client).prenom)} &nbsp; {String(JSON.parse(client).nom)}
</nav>
@ -3135,7 +3166,7 @@ const AddParnerClient = (props) => {
//console.log("is_contact_include_com == ", is_contact_include_com);
if (is_contact_include_com === true)
setis_contact_include_com(false)
else{
else {
// 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-]+)*$/;

View File

@ -75,13 +75,14 @@ const Config_Documents = (props) => {
const columns = [
{ field: '_id', headerName: '_id', hide: true },
{ field: 'id', headerName: 'id', hide: true },
{ field: 'nom', headerName: 'nom', hideable: false, flex: 1 },
{ field: 'ref_interne', headerName: 'ref_interne', hideable: false, flex: 1 },
{ field: 'type_doc', headerName: 'type_doc', width: 150, hideable: false, },
{ field: 'cible', headerName: 'cible', width: 150, hide: false, editable: false },
{ field: 'sujet', headerName: 'sujet', hide: false, editable: false, flex: 1 },
{ field: 'nom', headerName: 'nom', hideable: false, minWidth: 150, flex:1, },
{ field: 'ref_interne', headerName: 'ref_interne', hideable: false, minWidth: 50, maxWidth :200,flex:1, },
{ field: 'type_doc', headerName: 'type_doc', minWidth: 50, maxWidth :100,flex:1, hideable: false, },
{ field: 'cible', headerName: 'cible', minWidth: 100, maxWidth :150,flex:1, hide: false, editable: false },
{ field: 'default', headerName: 'par default', minWidth: 100, maxWidth :100,flex:1, hide: false, editable: false },
{ field: 'sujet', headerName: 'sujet', hide: false, editable: false, minWidth: 150,flex:1, },
{
field: 'duplicate', headerName: 'Dupliquer', hide: false, editable: false, flex: 1,
field: 'duplicate', headerName: 'Dupliquer', hide: false, editable: false, minWidth: 50, maxWidth :100,flex:1,
renderCell: (cellValues) => {
return (
@ -115,7 +116,6 @@ const Config_Documents = (props) => {
},
/* {
field: "Dupliquer", headerName: 'Dupliquer',
renderCell: (cellValues) => {
@ -858,10 +858,24 @@ const Config_Documents = (props) => {
const [p_collection, setp_collection] = useState();
function add_selected_fields() {
if (String(p_champ_table).length > 4)
editorRef_programme.current.insertContent(String(p_champ_table));
else
alert(" Le champ est invalide");
if( String(partner_document_data_edit_mode) === "1" ){
// Cas d'un update
if( document_principal_ou_corp_mail && String(document_principal_ou_corp_mail) == "2"){
one_editorRef_corp_mail.current.insertContent(String(p_champ_table));
}else{
one_editorRef_programme.current.insertContent(String(p_champ_table));
}
}else if( String(display_add_one_document) === "1" ){
// Cas de la creation d'un nouveau document
if( document_principal_ou_corp_mail && String(document_principal_ou_corp_mail) == "2"){
one_editorRef_corp_mail.current.insertContent(String(p_champ_table));
}else{
one_editorRef_programme.current.insertContent(String(p_champ_table));
}
}
}
@ -1103,11 +1117,12 @@ const Config_Documents = (props) => {
setAdd_one_Partner_Document_api("true");
setAdd_one_Partner_Document_result(res.data.message);
alert(res.data.message);
clear_one_detail_fields();
setadd_one_document();
setdisplay_add_one_document();
Getall_Partner_Document_No_filter();
alert(res.data.message);
window.scrollTo({
top: 0,
left: 0,
@ -2329,6 +2344,7 @@ const Config_Documents = (props) => {
type_doc: JSON.parse(item).type_doc,
cible: JSON.parse(item).cible,
sujet: JSON.parse(item).sujet,
default: JSON.parse(item).default_version,
duplicate: JSON.parse(item).duplicate,
}
@ -2475,7 +2491,7 @@ const Config_Documents = (props) => {
</div>
{String(partner_document_data_edit_mode) !== "1" && <div className="div_row_gauche texte_area_filter" >
{String(partner_document_data_edit_mode) !== "1" && String(p_detail_type_doc) === "email" && <div className="div_row_gauche texte_area_filter" >
Joindre en PDF <br />
<Checkbox
@ -2510,7 +2526,7 @@ const Config_Documents = (props) => {
{String(partner_document_data_edit_mode) === "1" && <div className="div_row_gauche texte_area_filter" >
{String(partner_document_data_edit_mode) === "1" && String(p_detail_type_doc) === "email" && <div className="div_row_gauche texte_area_filter" >
Joindre en PDF <br />
<Checkbox
@ -2589,8 +2605,9 @@ const Config_Documents = (props) => {
</div>}
{String(partner_document_data_edit_mode) === "1" && <div className="div_row">
<Button className="bton_enreg" onClick={add_selected_fields} style={{ "margin": "1rem" }}
{String(partner_document_data_edit_mode) === "1" &&
<div className="div_row">
<Button className="bton_enreg" onClick={add_selected_fields} style={{ "margin": "1rem", "minWidth":'80%' }}
>Ajouter Champ Choisi &nbsp;
</Button>
@ -3042,7 +3059,7 @@ const Config_Documents = (props) => {
<div className="div_row_gauche">
<div className="div_row_gauche texte_area_filter" >
Type de document 1 <br />
Type de document <br />
<TextField
name="one_document_type"
//label="Type de document"
@ -3082,7 +3099,7 @@ const Config_Documents = (props) => {
</div>
<div className="div_row_gauche texte_area_filter" >
Sujet 1 <br />
Sujet <br />
<TextField
name="one_document_sujet"
//label="Sujet"
@ -3097,8 +3114,8 @@ const Config_Documents = (props) => {
</div>
<div className="div_row_gauche texte_area_filter" >
Joindre en PDF bbb <br />
{String(p_one_detail_type_doc) === "email" && <div className="div_row_gauche texte_area_filter" >
Joindre en PDF <br />
<Checkbox
name="document_join_pdf"
@ -3111,10 +3128,10 @@ const Config_Documents = (props) => {
/>
</div>
</div>}
<div className="div_row_gauche texte_area_filter" >
Version par defaut bbb <br />
Version par defaut <br />
<Checkbox
name="document_join_pdf"

View File

@ -7697,10 +7697,17 @@ Update du 22/10/2023 - Gestion des champs spécifiques ajoutés par le partenair
}
//form.append("File", list_files);
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Prepare_and_Send_Convention_From_Session_By_Email/";
if (String(selected_convention_id) === "default_mail") {
// Il s'agit d'envoyer les convention par defaut de type mail
myurl = process.env.REACT_APP_API_URL + "myclass/api/Prepare_and_Send_Default_Convention_From_Session_By_Email/";
}
setLoading(true);
axios.post(myurl, form).then(res => {
setLoading(false);
if (String(res.data.status) === String("true")) {
//console.log(" In Send_Stagiaire_Conventions_By_Email res.data.status = " + res.data.status);
//console.log(" In Send_Stagiaire_Conventions_By_Email res.data.message r_class = " + res.data.message);
@ -7717,6 +7724,7 @@ Update du 22/10/2023 - Gestion des champs spécifiques ajoutés par le partenair
}
}).catch((error) => {
setLoading(false);
console.warn('Not good man :( Send_Stagiaire_Conventions_By_Email = ', error);
setSend_Stagiaire_Conventions_By_Email_api("false");
alert("Impossible d'envoyer la convention par email");
@ -7733,6 +7741,15 @@ Update du 22/10/2023 - Gestion des champs spécifiques ajoutés par le partenair
var url = process.env.REACT_APP_API_URL + "myclass/api/Prepare_and_Send_Convention_From_Session_By_PDF/" + stored_cookie + "/" + selected_session_id + "/" + selected_convention_id;
console.log(" #### selected_convention_id = ", selected_convention_id);
if (String(selected_convention_id) === "default_pdf") {
// Il s'agit d'envoyer les convention par defaut de type mail
url = process.env.REACT_APP_API_URL + "myclass/api/Prepare_and_Send_Default_Convention_From_Session_By_PDF/" + stored_cookie + "/" + selected_session_id + "/" + selected_convention_id;
}
console.log(" nom_fichier_cmd = ", nom_fichier_cmd, " --- selected_session_id = ", selected_session_id, " --- selected_convention_id =", selected_convention_id);
setLoading(true);
axios.get(url, { responseType: 'blob', },)
@ -8418,9 +8435,17 @@ Update du 22/10/2023 - Gestion des champs spécifiques ajoutés par le partenair
value={selected_convention_id}
onChange={(e) => {
setselected_convention_id(e.target.value);
var result2 = Get_List_Stagiaire_Conventions_result.filter((local_mymanager) => JSON.parse(local_mymanager)._id === String(e.target.value))
setselected_convention_type(JSON.parse(result2).type_doc);
if (String(e.target.value) === "default_mail") {
setselected_convention_type("email");
}
else if (String(e.target.value) === "default_pdf") {
setselected_convention_type("pdf");
} else {
var result2 = Get_List_Stagiaire_Conventions_result.filter((local_mymanager) => JSON.parse(local_mymanager)._id === String(e.target.value))
setselected_convention_type(JSON.parse(result2).type_doc);
}
settab_convention_pieces_jointes_result([]);
}
@ -8435,7 +8460,17 @@ Update du 22/10/2023 - Gestion des champs spécifiques ajoutés par le partenair
</MenuItem>
))}
<MenuItem key="default_mail" value="default_mail"
style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }}>
Email par default &nbsp;<b>Email</b>
</MenuItem>
<MenuItem key="default_pdf" value="default_pdf"
style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }}>
PDF par default &nbsp;<b>PDF</b>
</MenuItem>
</TextField>