diff --git a/src/components/AddClassManual.js b/src/components/AddClassManual.js index 41905af..3a9f921 100644 --- a/src/components/AddClassManual.js +++ b/src/components/AddClassManual.js @@ -8309,11 +8309,11 @@ const AddClassManual = (props) => { {submenu && String(submenu) === "unite_enseignement" &&
-
+
  { ))} columns={columns_list_unite_enseignement} - pageSize={10} + pageSize={20} className="datagridclass" onRowDoubleClick={(newSelectionModel) => { @@ -8420,7 +8420,7 @@ const AddClassManual = (props) => { - rowsPerPageOptions={[10]} + rowsPerPageOptions={[20]} disableSelectionOnClick components={{ Toolbar: GridToolbar, @@ -8494,11 +8494,11 @@ const AddClassManual = (props) => { {submenu && String(submenu) === "note_evaluation" &&
-
+
  { ))} columns={columns_list_evaluation_unite_enseignement} - pageSize={10} + pageSize={20} className="datagridclass" onRowDoubleClick={(newSelectionModel) => { @@ -8584,7 +8584,7 @@ const AddClassManual = (props) => { - rowsPerPageOptions={[10]} + rowsPerPageOptions={[20]} disableSelectionOnClick components={{ Toolbar: GridToolbar, diff --git a/src/components/AddClassManual_ARG.js b/src/components/AddClassManual_ARG.js deleted file mode 100644 index abdd10a..0000000 --- a/src/components/AddClassManual_ARG.js +++ /dev/null @@ -1,10811 +0,0 @@ -import React, { useRef, useState, useEffect } from "react"; -import Box from '@mui/material/Box'; -import TextField from '@mui/material/TextField'; -import TextareaAutosize from '@mui/material/TextareaAutosize'; -import Button from '@mui/material/Button'; -import axios from "axios"; -import DeleteIcon from '@mui/icons-material/Delete'; -import { getCookie, setCookie } from 'react-use-cookie'; -import { AiTwotoneEdit, AiTwotoneSave } from "react-icons/ai"; -import { useHistory } from "react-router-dom"; -import { IoMdAddCircle, IoIosRemoveCircleOutline } from "react-icons/io"; -import "react-draft-wysiwyg/dist/react-draft-wysiwyg.css"; -import { Editor } from '@tinymce/tinymce-react'; -import { IoArrowUndoCircle } from "react-icons/io5"; -import { GrUserAdmin, GrOrderedList } from "react-icons/gr"; -import parse from 'html-react-parser'; -import fileDownload from 'js-file-download'; -import 'react-tooltip/dist/react-tooltip.css'; -import { Tooltip } from 'react-tooltip'; -import Popup from 'reactjs-popup'; -import 'reactjs-popup/dist/index.css'; -import img_loading_spin from "./../mysy_img/mysy_spin_loading.gif"; -import Autocomplete from '@mui/material/Autocomplete'; -import { Fab } from "@material-ui/core"; -import { CiTrash } from "react-icons/ci"; -import { gridClasses } from '@mui/x-data-grid'; -import Link from '@mui/material/Link'; -import { PiDotsThree } from "react-icons/pi"; -import { DataGrid, GridToolbar, frFR } from '@mui/x-data-grid'; -import { IoAddCircleOutline } from "react-icons/io5"; -import Checkbox from '@mui/material/Checkbox'; -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 AttachFileIcon from '@mui/icons-material/AttachFile'; -import { BarChart } from '@mui/x-charts'; -import { axisClasses } from '@mui/x-charts'; -import { LineChart } from '@mui/x-charts/LineChart'; -import BarChartIcon from '@mui/icons-material/BarChart'; -import SsidChartIcon from '@mui/icons-material/SsidChart'; -import { RiFileExcel2Line } from "react-icons/ri"; -import fr from 'date-fns/locale/fr'; -import { registerLocale } from 'react-datepicker'; -import DatePicker from "react-datepicker"; -import "react-datepicker/dist/react-datepicker.css"; -import { format } from 'date-fns' -import moment from "moment"; -import Module_Historique_Action from "./Module_Historique_Action"; -import { IconButton } from '@material-ui/core'; -import AutoAwesomeOutlinedIcon from '@mui/icons-material/AutoAwesomeOutlined'; -import AutoFixHighOutlinedIcon from '@mui/icons-material/AutoFixHighOutlined'; -import CancelPresentationIcon from '@mui/icons-material/CancelPresentation'; -import MySyIA from "./Module_IA"; -import { FcInfo } from "react-icons/fc"; -import { makeStyles } from "@material-ui/core/styles"; -import Paper from '@material-ui/core/Paper'; -import Draggable from 'react-draggable'; - -import Module_Alert_Confirmation from "./Module_Alert_Confirmation"; - -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 AddClassManual_ARG = (props) => { - registerLocale('fr', fr); - const history = useHistory(); - const url = process.env.REACT_APP_API_URL + "/myclass/api/add_partner_account/"; - const [inputs, setInputs] = useState({}); - - const [mypublished, setmypublished] = useState("0"); - const [mypublished_label, setmypublished_label] = useState("-"); - - const [mypublished_catalog_prive, setmypublished_catalog_prive] = useState("0"); - const [mypublished_catalog_prive_label, setmypublished_catalog_prive_label] = useState("-"); - - const [mytrainingsupport, setmytrainingsupport] = useState("n/a"); - const [mytrainingsupport_label, setmytrainingsupport_label] = useState("-"); - - const [mytrainingdurationunit, setmytrainingdurationunit] = useState("heure"); - - - const [mycpf, setmycpf] = useState("0"); - const [mycpf_label, setmycpf_label] = useState("Non"); - - const [mycertif, setmycertif] = useState("0"); - const [mycertif_label, setmycertif_label] = useState("Non"); - - const [mypresence, setmypresence] = useState("0"); - const [mypresence_label, setmypresence_label] = useState("Non"); - - - const [mydistance, setmydistance] = useState("0"); - const [mydistance_label, setmydistance_label] = useState("Non"); - - - var date_today_90j = new Date(); - date_today_90j.setDate(date_today_90j.getDate() + 90); - - - var date_today_30j = new Date(); - date_today_30j.setDate(date_today_30j.getDate() + 30); - - - var date_today_minus_180j = new Date(); - date_today_minus_180j.setDate(date_today_minus_180j.getDate() - 180); - - - - const [default_doc_modification, setdefault_doc_modification] = useState("0"); - - - const [importmessage, setimportmessage] = useState(""); - const [myApiResponse, setmyApiResponse] = useState(""); - const setText = "coucou"; - const [ShowModal, setShowModal] = useState(true); - const [result, setResult] = useState(""); - const [isupdateclass, setisupdateclass] = useState(false); - const [testval, settestval] = useState(""); - const [displayedinternalurl, setdisplayedinternalurl] = useState(""); - const [datamodification, setdatamodification] = useState("0"); - const [datelieu, setdatelieu] = useState(""); - - const [plus_produit_enabled, setplus_produit_enabled] = useState(""); - const [mots_cle_enabled, setmots_cle_enabled] = useState(""); - const [zone_diffusion_enabled, setzone_diffusion_enabled] = useState(""); - - function ExpandableCell_50({ value }) { - const [expanded, setExpanded] = React.useState(false); - - return ( - - ); - } - - - const [selectionModel_list_unite_enseignement, setselectionModel_list_unite_enseignement] = React.useState([]); - - const columns_list_unite_enseignement = [ - { field: 'id', headerName: 'id', hide: true }, - { field: '_id', headerName: '_id', hide: true }, - { field: 'code', headerName: 'Code', minWidth: 150, flex: 1, renderCell: (params) => , }, - { field: 'titre', headerName: 'Titre', minWidth: 150, flex: 1, renderCell: (params) => , }, - { field: 'credit', headerName: 'Credit', minWidth: 100, flex: 1, renderCell: (params) => , }, - { field: 'coefficient', headerName: 'Coef.', minWidth: 100, flex: 1, renderCell: (params) => , }, - { - field: 'pres_dist_hyp', headerName: 'Animation', minWidth: 150, flex: 1, - renderCell: (cellValues) => { - return ( -
- {cellValues.row.pres_dist_hyp && String(cellValues.row.pres_dist_hyp) === "1" && "Distanciel"} - {cellValues.row.pres_dist_hyp && String(cellValues.row.pres_dist_hyp) === "0" && "Présentiel"} - {cellValues.row.pres_dist_hyp && String(cellValues.row.pres_dist_hyp) === "2" && "Hybride"} -
- - ); - } - }, - { - field: 'is_noted', headerName: 'Evalué', minWidth: 100, flex: 1, renderCell: (params) => , - renderCell: (cellValues) => { - return ( -
- {cellValues.row.is_noted && String(cellValues.row.is_noted) === "1" && "Oui"} - {cellValues.row.is_noted && String(cellValues.row.is_noted) === "0" && "Non"} - -
- - ); - } - }, - { field: 'seuil_validation', headerName: 'Seuil val.', minWidth: 100, flex: 1, renderCell: (params) => , }, - - - { field: 'duration_concat', headerName: 'Durée', minWidth: 100, flex: 1, renderCell: (params) => , }, - { field: 'duration', headerName: 'Durée', minWidth: 150, hide: true, flex: 1, renderCell: (params) => , }, - { field: 'duration_unite', headerName: 'Unit.', minWidth: 150, hide: true, editable: false, renderCell: (params) => , }, - - { - field: "delete", headerName: 'Supprimer', - renderCell: (cellValues) => { - return ( - <> - {String(props.check_user_acces_right("formation", "write")) === "1" && - - - } - modal - nested - position="center center" - > - {close => ( -
- -
MySy Information
-
- {' '} - - En confirmant cette opération, l'UE définitivement supprimée de cette formation .
- -
-
-
- - -
-
- -
-
-
- )} -
} - - ); - } - }, - - ] - - const columns_list_finance_data = [ - { field: 'id', headerName: 'id', hide: true }, - { field: '_id', headerName: '_id', hide: true }, - { field: 'code', headerName: 'Code', minWidth: 150, flex: 1, renderCell: (params) => , }, - { field: 'description', headerName: 'Decription', minWidth: 150, flex: 1, renderCell: (params) => , }, - { field: 'montant', headerName: 'Montant', minWidth: 150, flex: 1, renderCell: (params) => , }, - { field: 'type_cout', headerName: 'Type Cout', minWidth: 150, flex: 1, renderCell: (params) => , }, - { - field: 'inclus_calcul', headerName: 'Inclus Calcul', minWidth: 150, flex: 1, renderCell: (params) => , - renderCell: (cellValues) => { - return ( -
- {cellValues.row.inclus_calcul && String(cellValues.row.inclus_calcul) === "1" && "Oui"} - {cellValues.row.inclus_calcul && String(cellValues.row.inclus_calcul) === "0" && "Non"} - -
- - ); - } - }, - { field: 'commentaire', headerName: 'commentaire', minWidth: 150, flex: 1, renderCell: (params) => , }, - - { - field: "delete", headerName: 'Supprimer', - renderCell: (cellValues) => { - return ( - - <> - {String(props.check_user_acces_right("formation", "write")) === "1" && - - - } - modal - nested - position="center center" - > - {close => ( -
- -
MySy Information
-
- {' '} - - En confirmant cette opération, la caractéristique financière sera définitivement supprimée de cette formation .
- -
-
-
- - -
-
- -
-
-
- )} -
} - - - - ); - } - }, - ] - - const [selectionModel_list_finance_data, setselectionModel_list_finance_data] = React.useState([]); - - - const [selectionModel_list_evaluation_nite_enseignement, setselectionModel_list_evaluation_nite_enseignement] = React.useState([]); - - const columns_list_evaluation_unite_enseignement = [ - { field: 'id', headerName: 'id', hide: true }, - { field: '_id', headerName: '_id', hide: true }, - { field: 'class_id', headerName: 'class_id', Width: 0, hide: true, }, - - { field: 'class_ue_id', headerName: 'class_ue_id', Width: 0, hide: true }, - - { - field: 'class_ue_code', headerName: 'Code UE', minWidth: 150, flex: 1, renderCell: (params) => , - renderCell: (cellValues) => { - return ( -
- {New_Getall_Class_List_UE_result && New_Getall_Class_List_UE_result.length > 0 && } - - -
- - ); - } - }, - - - { field: 'type_evaluation_id', headerName: 'type_evaluation_id', Width: 0, hide: true, }, - - { - field: 'type_evaluation_code', headerName: 'Type Eval', minWidth: 150, flex: 1, renderCell: (params) => , - renderCell: (cellValues) => { - return ( -
- {New_Getall_Partner_Type_Evalution_List_result && New_Getall_Partner_Type_Evalution_List_result.length > 0 && } - - -
- - ); - } - }, - { field: 'ponderation_type_eval', headerName: 'Poids. Type Eval.', minWidth: 150, flex: 1, renderCell: (params) => , }, - - - { field: 'max_note', headerName: 'max_note', minWidth: 150, flex: 1, renderCell: (params) => , }, - - { - field: "delete", headerName: 'Supprimer', - renderCell: (cellValues) => { - return ( - - <> - {String(props.check_user_acces_right("formation", "write")) === "1" && - - - } - modal - nested - position="center center" - > - {close => ( -
- -
MySy Information
-
- {' '} - - En confirmant cette opération, l'évaluation définitivement supprimée de l'UE ainsi que de la formation .
- -
-
-
- - -
-
- -
-
-
- )} -
} - - - ); - } - }, - - ] - - - function handleClick_delete_evaluation_ue_class(event, cellValues) { - Delete_Given_Evaluation_UE_Class(cellValues.row._id); - } - - - const [Delete_Given_Evaluation_UE_Class_api, setDelete_Given_Evaluation_UE_Class_api] = useState(); - const [Delete_Given_Evaluation_UE_Class_message, setDelete_Given_Evaluation_UE_Class_message] = useState(); - const [Delete_Given_Evaluation_UE_Class_result, setDelete_Given_Evaluation_UE_Class_result] = useState(); - function Delete_Given_Evaluation_UE_Class(local_evaluation_ue_id) { - - var form = new FormData(); - - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - form.append("class_ue_evaluation_id", local_evaluation_ue_id); - - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Delete_Class_UE_Evaluation/"; - - axios.post(myurl, form).then(res => { - //console.log(" In Delete_Given_Evaluation_UE_Class res.data.status = " + res.data.status); - //console.log(" In Delete_Given_Evaluation_UE_Class res.data.message r_class = " + res.data.message); - - if (String(res.data.status) === String("true")) { - setDelete_Given_Evaluation_UE_Class_api("true"); - setDelete_Given_Evaluation_UE_Class_result(res.data.message); - - Getall_Class_List_Evalution(); - - setadd_ue_evalution(""); - setselected_ue_id(""); - setselected_eu_evalution_id(""); - setsetgridline_evaluation_ue_id(""); - setp_detail_max_note(""); - setp_detail_ponderation_type_eval(""); - setclass_unite_enseignement_type_evaluation_id(""); - - } - else { - setDelete_Given_Evaluation_UE_Class_api("false"); - setDelete_Given_Evaluation_UE_Class_message(res.data.message); - - setdisplay_alert_mysy("1"); - setalert_message(res.data.message); - setalert_type("error"); - - // alert(res.data.message); - - - } - - }).catch((error) => { - - console.warn('Delete_Given_Evaluation_UE_Class : Not good man :( mysearchtext = ' + error); - setDelete_Given_Evaluation_UE_Class_api("false"); - alert(" Impossible de supprimer l'évaluation "); - }) - } - - - function handleClick_delete_UE_From_Class(event, cellValues) { - Delete_Given_UE_From_Class(cellValues.row._id); - } - - const [Delete_Given_UE_From_Class_api, setDelete_Given_UE_From_Class_api] = useState(); - const [Delete_Given_UE_From_Class_message, setDelete_Given_UE_From_Class_message] = useState(); - const [Delete_Given_UE_From_Class_result, setDelete_Given_UE_From_Class_result] = useState(); - function Delete_Given_UE_From_Class(local_ue_id) { - - - var form = new FormData(); - - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - - if (props.mytrainingclass['class_id']) - form.append("class_id", props.mytrainingclass['class_id']); - else - form.append("class_id", selected_class_id); - - - form.append("ue_id", local_ue_id); - - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Delete_UE_From_Class/"; - - axios.post(myurl, form).then(res => { - //console.log(" In Delete_Given_UE_From_Class res.data.status = " + res.data.status); - //console.log(" In Delete_Given_UE_From_Class res.data.message r_class = " + res.data.message); - - if (String(res.data.status) === String("true")) { - setDelete_Given_UE_From_Class_api("true"); - setDelete_Given_UE_From_Class_result(res.data.message); - Getall_Class_List_UE(); - // alert(res.data.message) - setdisplay_alert_mysy("1"); - setalert_message(res.data.message); - setalert_type("success"); - } - else { - setDelete_Given_UE_From_Class_api("false"); - setDelete_Given_UE_From_Class_message(res.data.message); - - setdisplay_alert_mysy("1"); - setalert_message(res.data.message); - setalert_type("error"); - - // alert(res.data.message); - - } - - }).catch((error) => { - - console.warn('Delete_Given_UE_From_Class : Not good man :( mysearchtext = ' + error); - setDelete_Given_UE_From_Class_api("false"); - alert(" Impossible de supprimer l'UE "); - }) - } - - const [ue_gridline_id, setue_gridline_id] = useState(""); - - const [New_Getall_Class_List_UE_result, setNew_Getall_Class_List_UE_result] = useState([]); - - const [Getall_Class_List_UE_api, setGetall_Class_List_UE_api] = useState(); - const [Getall_Class_List_UE_message, setGetall_Class_List_UE_message] = useState(); - const [Getall_Class_List_UE_result, setGetall_Class_List_UE_result] = useState([]); - function Getall_Class_List_UE(event) { - - var form = new FormData(); - - - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - - if (props.mytrainingclass['class_id']) - form.append("class_id", props.mytrainingclass['class_id']); - else if (selected_class_id) - form.append("class_id", selected_class_id); - else - form.append("class_internal_url", props.mytrainingclass['class_internal_url']); - - - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Unite_Enseignement_Of_Given_Class/"; - - setLoading(true); - - axios.post(myurl, form).then(res => { - - setLoading(false); - if (String(res.data.status) === String("true")) { - //console.log(" In Getall_Class_List_UE res.data.status = " + res.data.status); - // console.log(" In Getall_Class_List_UE res.data.message r_class = " + res.data.message); - setGetall_Class_List_UE_api("true"); - setGetall_Class_List_UE_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_titre = JSON.parse(x).titre; - - - var local_credit = JSON.parse(x).credit; - var local_pres_dist_hyp = JSON.parse(x).pres_dist_hyp; - var local_is_noted = JSON.parse(x).is_noted; - var local_coefficient = JSON.parse(x).coefficient; - var local_seuil_validation = JSON.parse(x).seuil_validation; - - - - //--- - var node = { - "_id": local_id, - "id": localid, - "label": local_code + " - " + String(local_titre).substring(0, 20), - "code": local_code, - "titre": local_titre, - "credit": local_credit, - "pres_dist_hyp": local_pres_dist_hyp, - "is_noted": local_is_noted, - "coefficient": local_coefficient, - "seuil_validation": local_seuil_validation, - - }; - new_data2.push(node); - }); - - //--- - var node = { - "_id": "", - "id": "", - "label": "", - "code": "", - "titre": "", - "credit": "", - "pres_dist_hyp": "", - "is_noted": "", - "coefficient": "", - "seuil_validation": "", - - }; - new_data2.push(node); - - if (new_data2.length > 0) - setNew_Getall_Class_List_UE_result(new_data2); - } - else { - setGetall_Class_List_UE_api("false"); - setGetall_Class_List_UE_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_Class_List_UE = ', error); - setGetall_Class_List_UE_api("false"); - alert(" Impossible de recuperer la liste des UE de la formation"); - //setmyApimyApiMessage("") - }) - } - - - // Debut Gestion Finance - const New_Option_Type_Cout = [ - { "id": "fixe", "label": "Charge Fixe", "value": "fixe" }, - { "id": "variable", "label": "Charge Variable", "value": "variable" }, - { "id": "produit", "label": "Produit", "value": "produit" }, - { "id": "autre", "label": "Autre", "value": "autre" }, - { "id": "", "label": "", "value": "" }, - ] - - - const [add_one_finance_data_to_class, setadd_one_finance_data_to_class] = useState(""); - const [display_finance_data_to_class, setdisplay_finance_data_to_class] = useState(""); - const [edit_finance_data_to_class, setedit_finance_data_to_class] = useState(""); - - const [selected_finance_data_id, setselected_finance_data_id] = useState(""); - const [finance_data_gridline_id, setfinance_data_gridline_id] = useState(""); - const [p_detail_fin_data_code, setp_detail_fin_data_code] = useState(""); - const [p_detail_fin_data_description, setp_detail_fin_data_description] = useState(""); - const [p_detail_fin_data_commentaire, setp_detail_fin_data_commentaire] = useState(""); - const [p_detail_fin_data_montant, setp_detail_fin_data_montant] = useState(""); - const [p_detail_fin_data_type_cout, setp_detail_fin_data_type_cout] = useState(""); - - const [p_detail_fin_data_inclus_calcul, setp_detail_fin_data_inclus_calcul] = useState(""); - - function clean_financial_data_fields() { - setp_detail_fin_data_code(""); - setp_detail_fin_data_description(""); - setp_detail_fin_data_commentaire(""); - setp_detail_fin_data_montant(""); - setp_detail_fin_data_type_cout(""); - setadd_one_finance_data_to_class(""); - setdisplay_finance_data_to_class(""); - setedit_finance_data_to_class(""); - setp_detail_fin_data_inclus_calcul(""); - - } - - const [New_Getall_Class_Finance_Caracteristic_result, setNew_Getall_Class_Finance_Caracteristic_result] = useState([]); - - const [Getall_Class_Finance_Caracteristic_api, setGetall_Class_Finance_Caracteristic_api] = useState(); - const [Getall_Class_Finance_Caracteristic_message, setGetall_Class_Finance_Caracteristic_message] = useState(); - const [Getall_Class_Finance_Caracteristic_result, setGetall_Class_Finance_Caracteristic_result] = useState([]); - function Getall_Class_Finance_Caracteristic(event) { - - var form = new FormData(); - - - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - - form.append("related_collection", "myclass"); - - if (props.mytrainingclass['class_id']) - form.append("related_collection_id", props.mytrainingclass['class_id']); - else if (selected_class_id) - form.append("related_collection_id", selected_class_id); - - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Financial_Caracteristique_no_filter/"; - - setLoading(true); - - axios.post(myurl, form).then(res => { - - setLoading(false); - if (String(res.data.status) === String("true")) { - //console.log(" In Getall_Class_Finance_Caracteristic res.data.status = " + res.data.status); - // console.log(" In Getall_Class_Finance_Caracteristic res.data.message r_class = " + res.data.message); - setGetall_Class_Finance_Caracteristic_api("true"); - setGetall_Class_Finance_Caracteristic_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_commentaire = JSON.parse(x).commentaire; - var local_montant = JSON.parse(x).montant; - var local_type_cout = JSON.parse(x).type_cout; - var local_inclus_calcul = JSON.parse(x).inclus_calcul; - - //--- - var node = { - "_id": local_id, - "id": localid, - "label": local_code, - "code": local_code, - "description": local_description, - "commentaire": local_commentaire, - "montant": local_montant, - "type_cout": local_type_cout, - "inclus_calcul": local_inclus_calcul, - }; - new_data2.push(node); - }); - - //--- - var node = { - "_id": "", - "id": "", - "label": "", - "code": "", - "description": "", - "commentaire": "", - "montant": "", - "type_cout": "", - - }; - new_data2.push(node); - - if (new_data2.length > 0) - setNew_Getall_Class_Finance_Caracteristic_result(new_data2); - } - else { - setGetall_Class_Finance_Caracteristic_api("false"); - setGetall_Class_Finance_Caracteristic_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_Class_Finance_Caracteristic = ', error); - setGetall_Class_Finance_Caracteristic_api("false"); - alert(" Impossible de recuperer la liste des UE de la formation"); - //setmyApimyApiMessage("") - }) - } - - - const [Add_Update_Financial_Caracteristic_api, setAdd_Update_Financial_Caracteristic_api] = useState(); - const [Add_Update_Financial_Caracteristic_message, setAdd_Update_Financial_Caracteristic_message] = useState(); - const [Add_Update_Financial_Caracteristic_result, setAdd_Update_Financial_Caracteristic_result] = useState(); - function Add_Update_Financial_Caracteristic() { - setLoading(true); - var form = new FormData(); - //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); - - - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - - form.append("related_collection", "myclass"); - if (props.mytrainingclass['class_id']) - form.append("related_collection_id", props.mytrainingclass['class_id']); - else - form.append("related_collection_id", selected_class_id); - - form.append("code", p_detail_fin_data_code); - form.append("description", p_detail_fin_data_description); - form.append("commentaire", p_detail_fin_data_commentaire); - form.append("montant", p_detail_fin_data_montant); - form.append("type_cout", p_detail_fin_data_type_cout); - - if (p_detail_fin_data_inclus_calcul) { - form.append("inclus_calcul", "1"); - } else { - form.append("inclus_calcul", "0"); - } - - - var myurl = ""; - - if (String(selected_finance_data_id).length < 5) { - - myurl = process.env.REACT_APP_API_URL + "myclass/api/Add_Financial_Caracteristique/"; - - } else { - myurl = process.env.REACT_APP_API_URL + "myclass/api/Update_Financial_Caracteristique/"; - form.append("_id", selected_finance_data_id); - } - - axios.post(myurl, form).then(res => { - setLoading(false); - // console.log(" In Add_Update_Financial_Caracteristic res.data.status = " + res.data.status); - //console.log(" In Add_Update_Financial_Caracteristic res.data.message r_class = " + res.data.message); - - if (String(res.data.status) === String("true")) { - setAdd_Update_Financial_Caracteristic_api("true"); - setAdd_Update_Financial_Caracteristic_result(res.data.message); - clean_financial_data_fields(); - - Getall_Class_Finance_Caracteristic(); - - Dialog_Financial_Data_handleClose_buton(); - // alert(res.data.message) - setdisplay_alert_mysy("1"); - setalert_message(res.data.message); - setalert_type("success"); - - } - else { - setAdd_Update_Financial_Caracteristic_api("false"); - setAdd_Update_Financial_Caracteristic_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('Add_Update_Financial_Caracteristic : Not good man :( mysearchtext = ' + error); - setAdd_Update_Financial_Caracteristic_api("false"); - // alert(" Impossible d'ajouter l'évaluation l'UE "); - setdisplay_alert_mysy("1"); - setalert_message("Impossible d'ajouter l'évaluation l'UE"); - setalert_type("error"); - - }) - } - - const [Delete_Given_Financial_Caracteristique_api, setDelete_Given_Financial_Caracteristique_api] = useState(); - const [Delete_Given_Financial_Caracteristique_message, setDelete_Given_Financial_Caracteristique_message] = useState(); - const [Delete_Given_Financial_Caracteristique_result, setDelete_Given_Financial_Caracteristique_result] = useState(); - function Delete_Given_Financial_Caracteristique(fi_ca_id) { - - - var form = new FormData(); - - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - form.append("tab_id", fi_ca_id); - - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Delete_List_Financial_Caracteristique/"; - - axios.post(myurl, form).then(res => { - //console.log(" In Delete_Given_Financial_Caracteristique res.data.status = " + res.data.status); - //console.log(" In Delete_Given_Financial_Caracteristique res.data.message r_class = " + res.data.message); - - if (String(res.data.status) === String("true")) { - setDelete_Given_Financial_Caracteristique_api("true"); - setDelete_Given_Financial_Caracteristique_result(res.data.message); - clean_financial_data_fields(); - - Getall_Class_Finance_Caracteristic(); - - Dialog_Financial_Data_handleClose_buton(); - // alert(res.data.message) - setdisplay_alert_mysy("1"); - setalert_message(res.data.message); - setalert_type("success"); - } - else { - setDelete_Given_Financial_Caracteristique_api("false"); - setDelete_Given_Financial_Caracteristique_message(res.data.message); - - setdisplay_alert_mysy("1"); - setalert_message(res.data.message); - setalert_type("error"); - - // alert(res.data.message); - - } - - }).catch((error) => { - - console.warn('Delete_Given_Financial_Caracteristique : Not good man :( mysearchtext = ' + error); - setDelete_Given_Financial_Caracteristique_api("false"); - alert(" Impossible de supprimer la donnée "); - }) - } - - function Annule_Add_One_Caracteristique_fina_DetailFields() { - setp_detail_fin_data_code(""); - setp_detail_fin_data_description(""); - setp_detail_fin_data_commentaire(""); - setp_detail_fin_data_montant(""); - setp_detail_fin_data_type_cout(""); - setadd_one_finance_data_to_class(""); - setdisplay_finance_data_to_class(""); - setedit_finance_data_to_class(""); - - } - - // Fin Gestion Finance - - const [New_Getall_Partner_List_UE_result, setNew_Getall_Partner_List_UE_result] = useState([]); - - const [Getall_Partner_List_UE_api, setGetall_Partner_List_UE_api] = useState(); - const [Getall_Partner_List_UE_message, setGetall_Partner_List_UE_message] = useState(); - const [Getall_Partner_List_UE_result, setGetall_Partner_List_UE_result] = useState(); - function Getall_Partner_List_UE(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_Unite_Enseignement_no_filter/"; - - setLoading(true); - - axios.post(myurl, form).then(res => { - - - setLoading(false); - if (String(res.data.status) === String("true")) { - //console.log(" In Getall_Partner_List_UE res.data.status = " + res.data.status); - // console.log(" In Getall_Partner_List_UE res.data.message r_class = " + res.data.message); - setGetall_Partner_List_UE_api("true"); - setGetall_Partner_List_UE_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_titre = JSON.parse(x).titre; - - var local_ects = JSON.parse(x).ects; - var local_seuil_validation = JSON.parse(x).seuil_validation; - - - var local_credit = JSON.parse(x).credit; - var local_pres_dist_hyp = JSON.parse(x).pres_dist_hyp; - var local_is_noted = JSON.parse(x).is_noted; - - - - //--- - var node = { - "_id": local_id, - "id": localid, - "label": local_code, - "code": local_code, - "titre": local_titre, - "credit": local_credit, - "pres_dist_hyp": local_pres_dist_hyp, - "is_noted": local_is_noted, - - "ects": local_ects, - "seuil_validation": local_seuil_validation, - - }; - new_data2.push(node); - }); - - if (new_data2.length > 0) - setNew_Getall_Partner_List_UE_result(new_data2); - } - else { - setGetall_Partner_List_UE_api("false"); - setGetall_Partner_List_UE_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_List_UE = ', error); - setGetall_Partner_List_UE_api("false"); - alert(" Impossible de recuperer la liste des UE de la formation"); - //setmyApimyApiMessage("") - }) - } - - - const [New_Getall_Partner_Type_Evalution_List_result, setNew_Getall_Partner_Type_Evalution_List_result] = useState([]); - - const [Getall_Partner_Type_Evalution_List_api, setGetall_Partner_Type_Evalution_List_api] = useState(); - const [Getall_Partner_Type_Evalution_List_message, setGetall_Partner_Type_Evalution_List_message] = useState(); - const [Getall_Partner_Type_Evalution_List_result, setGetall_Partner_Type_Evalution_List_result] = useState([]); - function Getall_Partner_Type_Evalution_List(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_Type_Evaluation/"; - - setLoading(true); - - axios.post(myurl, form).then(res => { - - - setLoading(false); - if (String(res.data.status) === String("true")) { - //console.log(" In Getall_Partner_Type_Evalution_List res.data.status = " + res.data.status); - //console.log(" In Getall_Partner_Type_Evalution_List res.data.message r_class = " + res.data.message); - setGetall_Partner_Type_Evalution_List_api("true"); - setGetall_Partner_Type_Evalution_List_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_nom = JSON.parse(x).nom; - - //--- - var node = { - "_id": local_id, - "id": localid, - "label": local_code, - "code": local_code, - "nom": local_nom, - - - }; - new_data2.push(node); - }); - - //--- - var node = { - "_id": "", - "id": "", - "label": "", - "code": "", - "nom": "", - - }; - new_data2.push(node); - - if (new_data2.length > 0) - setNew_Getall_Partner_Type_Evalution_List_result(new_data2); - } - else { - setGetall_Partner_Type_Evalution_List_api("false"); - setGetall_Partner_Type_Evalution_List_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_Type_Evalution_List = ', error); - setGetall_Partner_Type_Evalution_List_api("false"); - alert(" Impossible de recuperer la liste des types d'evaluation"); - //setmyApimyApiMessage("") - }) - } - - - const [New_Getall_Class_List_Evalution_result, setNew_Getall_Class_List_Evalution_result] = useState([]); - - const [Getall_Class_List_Evalution_api, setGetall_Class_List_Evalution_api] = useState(); - const [Getall_Class_List_Evalution_message, setGetall_Class_List_Evalution_message] = useState(); - const [Getall_Class_List_Evalution_result, setGetall_Class_List_Evalution_result] = useState([]); - function Getall_Class_List_Evalution(event) { - - var form = new FormData(); - - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - - if (props.mytrainingclass['class_id']) - form.append("class_id", props.mytrainingclass['class_id']); - else - form.append("class_id", selected_class_id); - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Class_Evaluation/"; - - setLoading(true); - - axios.post(myurl, form).then(res => { - - - setLoading(false); - if (String(res.data.status) === String("true")) { - //console.log(" In Getall_Class_List_Evalution res.data.status = " + res.data.status); - // console.log(" In Getall_Class_List_Evalution res.data.message r_class = " + res.data.message); - setGetall_Class_List_Evalution_api("true"); - setGetall_Class_List_Evalution_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_class_id = JSON.parse(x).class_id; - var local_class_ue_id = JSON.parse(x).class_ue_id; - var local_type_evaluation_id = JSON.parse(x).type_evaluation_id; - var local_max_note = JSON.parse(x).max_note; - var local_ponderation_type_eval = JSON.parse(x).ponderation_type_eval; - - - //--- - var node = { - "_id": local_id, - "id": localid, - "label": local_class_id, - "class_id": local_class_id, - "class_ue_id": local_class_ue_id, - "type_evaluation_id": local_type_evaluation_id, - "max_note": local_max_note, - "ponderation_type_eval": local_ponderation_type_eval, - - }; - new_data2.push(node); - }); - - //--- - var node = { - "_id": "", - "id": "", - "label": "", - "class_id": "", - "class_ue_id": "", - "type_evaluation_id": "", - "max_note": "", - "ponderation_type_eval": "" - - }; - new_data2.push(node); - - if (new_data2.length > 0) - setNew_Getall_Class_List_Evalution_result(new_data2); - } - else { - setGetall_Class_List_Evalution_api("false"); - setGetall_Class_List_Evalution_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_Class_List_Evalution = ', error); - setGetall_Class_List_Evalution_api("false"); - alert(" Impossible de recuperer la liste des évaluations de la formation"); - //setmyApimyApiMessage("") - }) - } - - - const presentiel = [ - { - value: '1', - label: 'Oui', - }, - { - value: '0', - label: 'Non', - }, - - ]; - - const support_training_list = [ - { - value: 'video', - label: 'Video', - }, - { - value: 'document', - label: 'Document', - }, - { - value: 'réalité virtuelle', - label: 'Réalité Virtuelle', - }, - { - value: 'mixte', - label: 'Mixte', - }, - { - value: 'autre', - label: 'Autre', - }, - { - value: 'n/a', - label: 'n/a', - }, - - ]; - - - const New_support_training_list = [ - { - value: 'video', - label: 'Video', - }, - { - value: 'document', - label: 'Document', - }, - { - value: 'réalité virtuelle', - label: 'Réalité Virtuelle', - }, - { - value: 'mixte', - label: 'Mixte', - }, - { - value: 'autre', - label: 'Autre', - }, - { - value: 'n/a', - label: 'n/a', - }, - - ]; - const duration_unit_list = [ - { - value: 'heure', - label: 'Heures', - }, - - { - value: 'jour', - label: 'Jours', - }, - { - value: 'semaine', - label: 'Semaines', - }, - { - value: 'mois', - label: 'Mois', - }, - { - value: 'user_rythme', - label: 'Rythme stagiaire', - } - ]; - - - const New_duration_unit_list = [ - { - value: 'heure', - label: 'Heures', - }, - - { - value: 'jour', - label: 'Jours', - }, - { - value: 'semaine', - label: 'Semaines', - }, - { - value: 'mois', - label: 'Mois', - }, - { - value: 'user_rythme', - label: 'Rythme stagiaire', - } - ]; - - - - const publiee = [ - { - value: '1', - label: 'Oui', - }, - { - value: '0', - label: 'Non', - }, - - ]; - - - - function handleOnClose(event) { - setShowModal(false); - } - - - - function DeleteClass(event) { - - var code = document.getElementsByName("external_code")[0].value; - var server_address = "127.0.0.1"; - //var server_address = "89.156.84.196"; - - - - var formData = new FormData(); - const stored_cookie = getCookie('tokenmysypart'); - formData.append("token", stored_cookie); - formData.append("class_internal_url", props.mytrainingclass['ref']); - - - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/delete_Class_by_internal_url/"; - setLoading(true); - fetch( - myurl, - { - method: 'POST', - body: formData, - } - ) - .then((response) => response.json()) - .then((result) => { - setLoading(false); - //console.log('Success:', result['message'], "result['status'] = ", result['status']); - setimportmessage(result['message']); - setmyApiResponse(result['status']); - - - if (String(result['status']) === "true") { - //alert(result['status']+" -- "+myApiResponse+' mess = '+result['message']); - document.getElementsByName("external_code")[0].value = ""; - document.getElementsByName("title")[0].value = ""; - - //document.getElementsByName("objectif")[0].value = ""; - //document.getElementsByName("programme")[0].value = ""; - //document.getElementsByName("prerequis")[0].value = ""; - - - //document.getElementsByName("description2")[0].value = ""; - - document.getElementsByName("distentiel")[0].value = ""; - document.getElementsByName("price")[0].value = ""; - document.getElementsByName("domaine")[0].value = ""; - document.getElementsByName("duree")[0].value = ""; - //document.getElementsByName("mots_cle")[0].value = ""; - //document.getElementsByName("plus_produit")[0].value = ""; - document.getElementsByName("url")[0].value = ""; - document.getElementsByName("lms_class_code")[0].value = ""; - document.getElementsByName("class_inscription_url")[0].value = ""; - document.getElementsByName("metier")[0].value = ""; - - document.getElementsByName("note")[0].value = ""; - - //document.getElementsByName("objectif")[0].value = ""; - //document.getElementsByName("programme")[0].value = ""; - //document.getElementsByName("prerequis")[0].value = ""; - // alert(" La formation a été correctement supprimée."); - - history.push({ - pathname: "/Partner/", - state: { - current_pack: props.currentpack, local_sub_menu: 'affichage', price: "", - period: "", new_pack: "" - } - }); - window.location.reload(); - } else if (String(result['status']) === "false") { - // alert(result['message']); - setdisplay_alert_mysy("1"); - setalert_message(result['message']); - setalert_type("error"); - - } else if (String(result['status']) === String("Err_Connexion")) { - alert('Erreur: ' + result['message']); - history.push("/Connexion"); - } - - - - }) - .catch((error) => { - setLoading(false); - console.error('Error:', error); - setmyApiResponse("false"); - }); - } - - const [New_Getall_Training_Employee_No_Filter_result, setNew_Getall_Training_Employee_No_Filter_result] = useState([]); - - const [Getall_Training_Employee_No_Filter_api, setGetall_Training_Employee_No_Filter_api] = useState(); - const [Getall_Training_Employee_No_Filter_message, setGetall_Training_Employee_No_Filter_message] = useState(); - const [Getall_Training_Employee_No_Filter_result, setGetall_Training_Employee_No_Filter_result] = useState(); - function Getall_Training_Employee_No_Filter(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_Ressource_Humaine_no_filter/"; - - - - axios.post(myurl, form).then(res => { - - setLoading(true); - - if (String(res.data.status) === String("true")) { - setLoading(false); - //console.log(" In Getall_Training_Employee_No_Filter res.data.status = " + res.data.status); - //console.log(" In Getall_Training_Employee_No_Filter res.data.message r_class = " + res.data.message); - setGetall_Training_Employee_No_Filter_api("true"); - setGetall_Training_Employee_No_Filter_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_nom = JSON.parse(x).nom; - var local_prenom = JSON.parse(x).prenom; - var local_ismanager = JSON.parse(x).ismanager; - - - //--- - var node = { - "_id": local_id, - "id": localid, - "label": local_nom + " " + local_prenom, - "nom": local_nom, - "prenom": local_prenom, - "ismanager": local_ismanager - }; - new_data2.push(node); - }); - - if (new_data2.length > 0) - setNew_Getall_Training_Employee_No_Filter_result(new_data2); - - } - else { - setGetall_Training_Employee_No_Filter_api("false"); - setGetall_Training_Employee_No_Filter_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_Training_Employee_No_Filter = ', error); - setGetall_Training_Employee_No_Filter_api("false"); - alert(" Impossible de recuperer la liste des employés"); - //setmyApimyApiMessage("") - }) - } - - const [history_securite_read, sethistory_securite_read] = useState(""); - - useEffect(() => { - - Get_List_Domaines(); - Get_List_Metiers(); - Get_List_Categorie(); - - Get_Partner_Object_Specific_Fields("myclass"); - Getall_Training_Employee_No_Filter(); - Get_List_Niveau_Formation(); - - setfield_description(""); - setfield_objectif(""); - setfield_programme(""); - setfield_prerequis(""); - setfield_mots_cle(""); - setfield_plus_produit(""); - setfield_datelieu(""); - setfield_zone_diffusion(""); - setmyApiResponse(); - Getall_Partner_Type_Evalution_List(); - Getall_Class_List_Evalution(); - setfield_contenu_attestation(""); - Getall_Parter_referentiel_padagogique(); - - fillfield(); - - sethistory_securite_read(props.check_user_acces_right("historique", "read")) - - if (props.mytrainingclass['class_external_code']) { - getClassImage(); - //console.log("props.mytrainingclass['plus_produit'] = " + props.mytrainingclass['plus_produit']); - setplus_produit_enabled(props.mytrainingclass['plus_produit']); - setmots_cle_enabled(props.mytrainingclass['mots_cle']); - setzone_diffusion_enabled(props.mytrainingclass['zone_diffusion']); - Getall_Class_List_UE(); - Getall_Partner_List_UE(); - } - - setdatamodification("0"); - - window.scrollTo({ - top: 0, - behavior: "smooth", - }); - - submenu_detail_formation(); - - }, [props.mytrainingclass['ref'],]); - - - const [mytraining_ref_peda_id, setmytraining_ref_peda_id] = useState(""); - - - const [New_Getall_Parter_referentiel_padagogique_result, setNew_Getall_Parter_referentiel_padagogique_result] = useState([]); - - const [Getall_Parter_referentiel_padagogique_api, setGetall_Parter_referentiel_padagogique_api] = useState(); - const [Getall_Parter_referentiel_padagogique_message, setGetall_Parter_referentiel_padagogique_message] = useState(); - const [Getall_Parter_referentiel_padagogique_result, setGetall_Parter_referentiel_padagogique_result] = useState([]); - function Getall_Parter_referentiel_padagogique(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_Ref_Pedagogique_no_filter/"; - - setLoading(true); - axios.post(myurl, form).then(res => { - setLoading(false); - - if (String(res.data.status) === String("true")) { - //console.log(" In Getall_Parter_referentiel_padagogique res.data.status = " + res.data.status); - //console.log(" In Getall_Parter_referentiel_padagogique res.data.message r_class = " + res.data.message); - setGetall_Parter_referentiel_padagogique_api("true"); - setGetall_Parter_referentiel_padagogique_result(res.data.message); - //setRows(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_commentaire = JSON.parse(x).commentaire; - var local_code = JSON.parse(x).code; - var local_description = JSON.parse(x).description; - - - //--- - var node = { - "_id": local_id, - "id": localid, - "label": local_code, - "commentaire": local_commentaire, - "code": local_code, - "description": local_description, - - }; - new_data2.push(node); - }); - - //--- - var node = { - "_id": "", - "id": "", - "label": "", - "commentaire": "", - "code": "", - "description": "", - - }; - new_data2.push(node); - - if (new_data2.length > 0) - setNew_Getall_Parter_referentiel_padagogique_result(new_data2); - - } - else { - setGetall_Parter_referentiel_padagogique_api("false"); - setGetall_Parter_referentiel_padagogique_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_Parter_referentiel_padagogique = ', error); - setGetall_Parter_referentiel_padagogique_api("false"); - alert(" Impossible de recuperer la liste des référentiels pédagogiques"); - //setmyApimyApiMessage("") - }) - } - - - - const [field_description, setfield_description] = useState(""); - const [field_objectif, setfield_objectif] = useState(""); - const [field_programme, setfield_programme] = useState(""); - - const [field_methode_pedago, setfield_methode_pedago] = useState(""); - const [field_handicap, setfield_handicap] = useState(""); - - const [field_suivi_eval, setfield_suivi_eval] = useState(""); - - - const [field_prerequis, setfield_prerequis] = useState(""); - const [field_pourqui, setfield_pourqui] = useState(""); - const [field_mots_cle, setfield_mots_cle] = useState(""); - const [field_plus_produit, setfield_plus_produit] = useState(""); - - const [field_datelieu, setfield_datelieu] = useState(""); - const [field_zone_diffusion, setfield_zone_diffusion] = useState(""); - - const [selected_class_id, setselected_class_id] = useState(""); - - const [field_contenu_attestation, setfield_contenu_attestation] = useState(""); - - - function fillfield(event) { - setisupdateclass(true); - // DisableTraining(); - var val = props.mytrainingclass['ref']; - - - // si la reference n'est pas rempli, alors on fait de la creation - // si non il s'agit get pour un update/ - if (!val) { - setisupdateclass(false); - return; - } - - - var form = new FormData(); - //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - form.append("internal_url", val); - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/get_partner_class/"; - - setLoading(true); - axios.post(myurl, form).then(res => { - // console.log(" In get_partner_class res.data.status = " + res.data.status); - if (String(res.data.status) === String("true") && res.data.message.length > 0) { - setLoading(false); - // console.log(" In get_partner_class res.data.message r_class = " + res.data.message); - setmyApiResponse("True"); - setResult(res.data.message); - - - var mylocaltraining = JSON.parse(res.data.message); - - - if (mylocaltraining) { - setdisplayedinternalurl(mylocaltraining.internal_url); - - if (mylocaltraining._id) { - setselected_class_id(mylocaltraining._id); - Get_List_Of_All_PJ(mylocaltraining._id); - Get_Class_Catalogue_File(mylocaltraining._id); - } - - //document.getElementsByName("external_code")[0].value = mylocaltraining.external_code; - setp_detail_external_code(mylocaltraining.external_code); - setp_detail_title(mylocaltraining.title); - - //document.getElementsByName("title")[0].value = mylocaltraining.title; - - - - if (mylocaltraining.objectif) { - //document.getElementsByName("objectif")[0].value = mylocaltraining.objectif; - //alert(" laaaaa "); - setfield_objectif(mylocaltraining.objectif); - } - - - if (mylocaltraining.programme) { - //document.getElementsByName("programme")[0].value = mylocaltraining.programme; - setfield_programme(mylocaltraining.programme); - } - - - if (mylocaltraining.methode_pedagogique) { - //document.getElementsByName("programme")[0].value = mylocaltraining.programme; - setfield_methode_pedago(mylocaltraining.methode_pedagogique); - } - - - if (mylocaltraining.suivi_eval) { - //document.getElementsByName("programme")[0].value = mylocaltraining.programme; - setfield_suivi_eval(mylocaltraining.suivi_eval); - } - - if (mylocaltraining.condition_handicape) { - //document.getElementsByName("programme")[0].value = mylocaltraining.programme; - setfield_handicap(mylocaltraining.condition_handicape); - } - - - if (mylocaltraining.pourqui) { - //document.getElementsByName("programme")[0].value = mylocaltraining.programme; - setfield_pourqui(mylocaltraining.pourqui); - } - - - - if (mylocaltraining.note_finale_calculation_rule_id) { - setselected_class_note_calculation_id(mylocaltraining.note_finale_calculation_rule_id); - } else { - setselected_class_note_calculation_id(""); - } - - - - if (mylocaltraining.prerequis) { - //document.getElementsByName("prerequis")[0].value = mylocaltraining.prerequis; - setfield_prerequis(mylocaltraining.prerequis); - } - - //document.getElementsByName("description2")[0].value = mylocaltraining.description; - setfield_description(mylocaltraining.description); - - - setp_formateur_label("-"); - if (mylocaltraining.formateur_id) { - setp_formateur_id(mylocaltraining.formateur_id); - setp_formateur_label(mylocaltraining.formateur_nom_prenom); - //console.log(" #### mylocaltraining.formateur_nom_prenom = ", mylocaltraining.formateur_nom_prenom); - - } else { - setp_formateur_id(""); - setp_formateur_label("-"); - - } - - if (mylocaltraining.presentiel.distantiel) { - - - setmydistance(mylocaltraining.presentiel.distantiel); - var result2 = presentiel.filter((local_mymanager) => local_mymanager.value === String((mylocaltraining.presentiel.distantiel))) - if (result2[0]) { - setmydistance_label(result2[0].label); - - } - } else { - setmydistance("0"); - setmydistance_label("Non"); - } - - - if (mylocaltraining.presentiel.presentiel) { - - - setmypresence(mylocaltraining.presentiel.presentiel); - var result2 = presentiel.filter((local_mymanager) => local_mymanager.value === String((mylocaltraining.presentiel.presentiel))) - if (result2[0]) { - setmypresence_label(result2[0].label); - - - } - } else { - setmypresence("0"); - setmypresence_label("Non"); - } - - - //setmypresence(mylocaltraining.presentiel.presentiel); - - if (mylocaltraining.published) { - setmypublished(mylocaltraining.published); - var result2 = publiee.filter((local_mymanager) => local_mymanager.value === String((mylocaltraining.published))) - if (result2[0]) - setmypublished_label(result2[0].label); - } - else { - setmypublished("0"); - setmypublished_label("Non"); - } - - - if (mylocaltraining.published_catalog_prive) { - - setmypublished_catalog_prive(mylocaltraining.published_catalog_prive); - var result3 = publiee.filter((local_mymanager) => local_mymanager.value === String((mylocaltraining.published_catalog_prive))) - if (result3[0]) { - setmypublished_catalog_prive_label(result3[0].label); - } - } - else { - setmypublished_catalog_prive("0"); - setmypublished_catalog_prive_label("Non"); - } - - - if (mylocaltraining.cpf) { - setmycpf(mylocaltraining.cpf); - var result2 = cpf.filter((local_mymanager) => local_mymanager.value === String((mylocaltraining.cpf))) - if (result2[0]) - setmycpf_label(result2[0].label); - } - else { - setmycpf("0"); - setmycpf_label("Non"); - } - - - if (mylocaltraining.support) { - setmytrainingsupport(mylocaltraining.support); - - var result2 = New_support_training_list.filter((local_mymanager) => local_mymanager.value === String((mylocaltraining.support))) - if (result2[0]) - setmytrainingsupport_label(result2[0].label); - - } - else { - setmytrainingsupport("n/a"); - setmytrainingsupport_label("Autre"); - } - - if (mylocaltraining.duration_unit) { - setmytrainingdurationunit(mylocaltraining.duration_unit); - //console.log(" ### duration_unit = ", mylocaltraining.duration_unit); - } - else { - setmytrainingdurationunit("heure"); - } - - - - if (mylocaltraining.certif) { - setmycertif(mylocaltraining.certif); - var result2 = certif.filter((local_mymanager) => local_mymanager.value === String((mylocaltraining.certif))); - - - if (result2[0]) { - setmycertif_label(result2[0].label); - - } - } - else { - setmycertif("0"); - setmycertif_label("Non"); - } - - if (mylocaltraining.class_level && String(mylocaltraining.class_level).trim() !== "") { - setp_class_level(mylocaltraining.class_level); - setp_class_level_label(mylocaltraining.class_level_description); - - } - else { - setp_class_level("2"); - setp_class_level_label("Aucune certification"); - } - - - if (mylocaltraining.price) { - document.getElementsByName("price")[0].value = mylocaltraining.price; - setp_detail_price(mylocaltraining.price); - } - else - setp_detail_price(""); - - - if (mylocaltraining.archive) { - setp_detail_archive(mylocaltraining.archive); - } - else - setp_detail_archive("0"); - - - - if (mylocaltraining.referentiel_padagogique_id) { - setmytraining_ref_peda_id(mylocaltraining.referentiel_padagogique_id); - } - else - setmytraining_ref_peda_id(""); - - - if (mylocaltraining.domaine) { - setmytrainingdomaine(mylocaltraining.domaine); - //console.log(" ### mylocaltraining.domaine = ", mylocaltraining.domaine); - } - else - setmytrainingdomaine(""); - - - if (mylocaltraining.metier) { - setmytrainingmetier(mylocaltraining.metier); - //console.log(" ### mylocaltraining.metier = ", mylocaltraining.metier); - } - else - setmytrainingmetier(""); - - - if (mylocaltraining.categorie) { - setmytrainingcategorie(mylocaltraining.categorie); - //console.log(" ### mylocaltraining.metier = ", mylocaltraining.metier); - } - else - setmytrainingcategorie(""); - - - - if (mylocaltraining.duration) { - // document.getElementsByName("duree")[0].value = mylocaltraining.duration; - setp_detail_duree(mylocaltraining.duration); - } - else - setp_detail_duree(""); - - - //document.getElementsByName("mots_cle")[0].value = ""; - if (mylocaltraining.mots_cle) { - //document.getElementsByName("mots_cle")[0].value = mylocaltraining.mots_cle; - setfield_mots_cle(mylocaltraining.mots_cle); - } - - - - - document.getElementsByName("note")[0].value = ""; - if (mylocaltraining.note) { - //document.getElementsByName("note")[0].value = mylocaltraining.note; - setp_detail_note(mylocaltraining.note); - } else { - setp_detail_note(""); - } - - //document.getElementsByName("plus_produit")[0].value = ""; - if (mylocaltraining.plus_produit) { - setfield_plus_produit(mylocaltraining.plus_produit); - } - - - if (mylocaltraining.contenu_attestation) { - setfield_contenu_attestation(mylocaltraining.contenu_attestation); - } - - document.getElementsByName("url")[0].value = ""; - if (mylocaltraining.url) { - //document.getElementsByName("url")[0].value = mylocaltraining.url; - setp_detail_url(mylocaltraining.note); - } else { - setp_detail_url(""); - } - - document.getElementsByName("lms_class_code")[0].value = ""; - - if (mylocaltraining.lms_class_code) { - //document.getElementsByName("lms_class_code")[0].value = mylocaltraining.lms_class_code; - setp_detail_lms_class_code(mylocaltraining.lms_class_code); - } else { - setp_detail_lms_class_code(""); - } - - - if (mylocaltraining.version) { - //document.getElementsByName("lms_class_code")[0].value = mylocaltraining.lms_class_code; - setp_detail_version_catalogue(mylocaltraining.version); - } else { - setp_detail_version_catalogue(""); - } - - - if (mylocaltraining.recyclage_delai) { - setp_detail_recyclage_delai(mylocaltraining.recyclage_delai); - } else { - setp_detail_recyclage_delai("0"); - } - - - if (mylocaltraining.recyclage_alert) { - setp_detail_recyclage_alert(mylocaltraining.recyclage_alert); - } else { - setp_detail_recyclage_alert("0"); - } - - - document.getElementsByName("class_inscription_url")[0].value = ""; - if (mylocaltraining.class_inscription_url) { - //document.getElementsByName("class_inscription_url")[0].value = mylocaltraining.class_inscription_url; - setp_detail_class_inscription_url(mylocaltraining.note); - } else { - setp_detail_class_inscription_url(""); - } - - document.getElementsByName("class_banner_img_url")[0].value = ""; - if (mylocaltraining.img_banner_detail_class) { - //document.getElementsByName("class_banner_img_url")[0].value = mylocaltraining.img_banner_detail_class; - setp_detail_class_banner_img_url(mylocaltraining.note); - } else { - setp_detail_class_banner_img_url(""); - } - - //document.getElementsByName("zone_diffusion")[0].value = ""; - if (mylocaltraining.zone_diffusion_str) { - //document.getElementsByName("zone_diffusion")[0].value = mylocaltraining.zone_diffusion_str; - document.getElementsByName("zone_diffusion_v2")[0].value = mylocaltraining.zone_diffusion_str; - } - - - - getClassImage(mylocaltraining._id); - /* - * Update 22/10/2023 : - Gestion des champs spécifiques. ils commencent tous par 'my_' - */ - - //console.log(" #### props.rows_champs_specifics = ", props.rows_champs_specifics); - for (let i = 0; i < rows_champs_specifics.length; i++) { - - var field_name = JSON.parse(rows_champs_specifics[i]).field_name; - var field_type = JSON.parse(rows_champs_specifics[i]).field_type; - var field_label = JSON.parse(rows_champs_specifics[i]).field_label; - var is_mandatory = JSON.parse(rows_champs_specifics[i]).is_mandatory; - - //console.log(" field_name = ", field_name); - - if (mylocaltraining.hasOwnProperty(field_name)) { - var local_valeur = mylocaltraining[String(field_name)] - - if (document.getElementById(String(field_name))) - document.getElementById(String(field_name)).value = local_valeur; - - var new_val = { 'field_name': field_name, 'field_value': local_valeur } - var johnIndex = findIndexByProperty(spec_field_updated_values, 'field_name', field_name); - - if (johnIndex > -1) { - spec_field_updated_values[johnIndex] = new_val; - - } else { - spec_field_updated_values.push(new_val); - } - - } else { - if (document.getElementById(String(field_name))) - document.getElementById(String(field_name)).value = ""; - } - } - - setspec_field_updated_values_hooks(spec_field_updated_values); - /* - * end Update 22/10/2023 : - */ - - } - - } - else if (String(res.data.status) === String("true") && res.data.message.length <= 0) { - setLoading(false); - setdisplay_alert_mysy("1"); - setalert_message("Aucune information récupérées"); - setalert_type("warning"); - } - else { - setLoading(false); - //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) => { - setLoading(false); - console.warn('Not good man :( mysearchtext = ', error); - setmyApiResponse("False"); - //setmyApimyApiMessage("") - }) - } - - - - const [title_limite, settitle_limite] = useState(120); - - const editorRef_description = useRef(null); - const [editorRef_description_limite, seteditorRef_description_limite] = useState(5000); - - - const editorRef_objectif = useRef(null); - const [editorRef_objectif_limite, seteditorRef_objectif] = useState(5000); - - const editorRef_programme = useRef(null); - const [editorRef_programme_limite, seteditorRef_programme] = useState(5000); - - - const editorRef_methode_pedago = useRef(null); - const [editorRef_methode_pedago_limite, seteditorRef_methode_pedago] = useState(2000); - - const editorRef_handicap = useRef(null); - const [editorRef_handicap_limite, seteditorRef_handicap_limite] = useState(2000); - - const editorRef_suivi_eval = useRef(null); - const [editorRef_suivi_eval_limite, seteditorRef_suivi_eval_limite] = useState(2000); - - const editorRef_prerequis = useRef(null); - const editorRef_pourqui = useRef(null); - const editorRef_mots_cle = useRef(null); - const editorRef_plus_produit = useRef(null); - const editorRef_zone_diffusion = useRef(null); - const editorRef_date_lieu = useRef(null); - - const editorRef_contenu_attestation = useRef(null); - const [editorRef_contenu_attestation_limite, seteditorRef_contenu_attestation_limite] = useState(1000); - - - const [waiting_before_redirect, setwaiting_before_redirect] = React.useState(true); - - function RecordTraining(event) { - - var code = document.getElementsByName("external_code")[0].value; - - if (code.length < 1) { - setdisplay_alert_mysy("1"); - setalert_message("Le Champ 'code' est obligatoire"); - setalert_type("error"); - return; - } - - - // console.log(" ### titre = ", p_detail_title); - - var title = p_detail_title; - if (String(title).length > title_limite) { - - setdisplay_alert_mysy("1"); - setalert_message("Champ 'Titre', limite depassée !"); - setalert_type("error"); - - return; - } - - if (title.length < 1) { - // alert(" Le Champ 'Titre' est obligatoire") - setdisplay_alert_mysy("1"); - setalert_message("Le Champ 'Titre' est obligatoire"); - setalert_type("error"); - return; - } - - - var presentiel = mypresence; - var distentiel = mydistance; - var domaine = mytrainingdomaine; - - var mypublier = mypublished; - var mypublier_catalog_prive = mypublished_catalog_prive; - var niveau_ftion = p_class_level; - var price = document.getElementsByName("price")[0].value; - var duree = document.getElementsByName("duree")[0].value; - var url = document.getElementsByName("url")[0].value; - var lms_class_code = p_detail_lms_class_code; - var class_inscription_url = document.getElementsByName("class_inscription_url")[0].value; - - var mymetier = mytrainingmetier; - - var mycategorie = mytrainingcategorie; - var version = p_detail_version_catalogue; - - var mynote = document.getElementsByName("note")[0].value; - var localmycpf = mycpf; - var local_mycertif = mycertif; - - var trainingSupport = mytrainingsupport; - var banniereImg = document.getElementsByName("class_banner_img_url")[0].value; - - - var pourqui = ""; - if (editorRef_pourqui.current) { - pourqui = editorRef_pourqui.current.getContent(); - } - - var objectif = ""; - if (editorRef_objectif.current) { - objectif = editorRef_objectif.current.getContent(); - if (parse(objectif.replace(/(<([^>]+)>)/ig, '')).length > editorRef_objectif_limite) { - // alert(" Champ 'Objectif', limite depassée !"); - setdisplay_alert_mysy("1"); - setalert_message("Champ 'Objectif', limite depassée !"); - setalert_type("error"); - return; - } - } - - if (objectif.length < 1) { - // alert(" Le Champ 'Objectif' est obligatoire"); - setdisplay_alert_mysy("1"); - setalert_message("Le Champ 'Objectif' est obligatoire"); - setalert_type("error"); - return; - } - - var programme = ""; - if (editorRef_programme.current) { - programme = editorRef_programme.current.getContent(); - - if (parse(programme.replace(/(<([^>]+)>)/ig, '')).length > editorRef_programme_limite) { - //alert(" Champ 'Programme', limite depassée !"); - setdisplay_alert_mysy("1"); - setalert_message(" Champ 'Programme', limite depassée !"); - setalert_type("error"); - return; - } - } - - var methode_pedago = ""; - if (editorRef_methode_pedago.current) { - methode_pedago = editorRef_methode_pedago.current.getContent(); - - if (parse(methode_pedago.replace(/(<([^>]+)>)/ig, '')).length > editorRef_methode_pedago_limite) { - // alert(" Champ 'Méthode pédagogique', limite depassée !"); - setdisplay_alert_mysy("1"); - setalert_message("Champ 'Méthode pédagogique', limite depassée !"); - setalert_type("error"); - return; - } - } - - var handicap = ""; - if (editorRef_handicap.current) { - handicap = editorRef_handicap.current.getContent(); - - if (parse(handicap.replace(/(<([^>]+)>)/ig, '')).length > editorRef_handicap_limite) { - // alert(" Champ 'Handicape', limite depassée !"); - setdisplay_alert_mysy("1"); - setalert_message(" Champ 'Handicape', limite depassée !"); - setalert_type("error"); - return; - } - } - - - var suivi_eval = ""; - if (editorRef_suivi_eval.current) { - suivi_eval = editorRef_suivi_eval.current.getContent(); - - if (parse(suivi_eval.replace(/(<([^>]+)>)/ig, '')).length > editorRef_suivi_eval_limite) { - // alert(" Champ 'Suivi et Evaluation', limite depassée !"); - setdisplay_alert_mysy("1"); - setalert_message(" Champ 'Suivi et Evaluation', limite depassée !"); - setalert_type("error"); - return; - } - } - - - var prerequis = ""; - if (editorRef_prerequis.current) { - prerequis = editorRef_prerequis.current.getContent(); - } - - var description = ""; - if (editorRef_description.current) { - description = editorRef_description.current.getContent(); - - if (parse(description.replace(/(<([^>]+)>)/ig, '')).length > editorRef_description_limite) { - //alert(" Champ 'Description', limite depassée !"); - setdisplay_alert_mysy("1"); - setalert_message("Champ 'Description', limite depassée !"); - setalert_type("error"); - return; - } - } - - if (description.length < 1) { - // alert(" Le Champ 'Description' est obligatoire"); - setdisplay_alert_mysy("1"); - setalert_message("Le Champ 'Description' est obligatoire"); - setalert_type("error"); - return; - } - - var mots_cle = ""; - if (editorRef_mots_cle.current) { - mots_cle = editorRef_mots_cle.current.getContent(); - } - - var plus_produit = ""; - if (editorRef_plus_produit.current) { - plus_produit = editorRef_plus_produit.current.getContent(); - } - - var contenu_attestation = ""; - if (editorRef_contenu_attestation.current) { - contenu_attestation = editorRef_contenu_attestation.current.getContent(); - - if (parse(contenu_attestation.replace(/(<([^>]+)>)/ig, '')).length > editorRef_contenu_attestation_limite) { - // alert(" Champ 'Suivi et Evaluation', limite depassée !"); - setdisplay_alert_mysy("1"); - setalert_message(" Champ 'Contenu Attestation', limite depassée !"); - setalert_type("error"); - return; - } - - } - - - // Verification si il y a plus de 3 mot clés separés par des ";" - mots_cle = mots_cle.replace(/(<([^>]+)>)/ig, ''); - mots_cle = mots_cle.replaceAll(" ", ''); - mots_cle = mots_cle.replaceAll(",", ";"); - - - var words = mots_cle.split(';'); - - var traited_list_mot_cle = [] - for (let i = 0; i < words.length; i++) { - //console.log(" ### alanlyse du mot "+String(words[i])) - if (words[i] && String(words[i]).length > 2 && String(words[i]).length < 50) - traited_list_mot_cle.push(String(words[i])); - else if (words[i] && (String(words[i]).length < 2 || String(words[i]).length > 50)) { - // alert(" Chaque mot clé doit faire entre 2 et 50 caractères. Le mot '" + String(words[i]) + "' est incorrecte"); - setdisplay_alert_mysy("1"); - setalert_message("Chaque mot clé doit faire entre 2 et 50 caractères. Le mot '" + String(words[i]) + "' est incorrecte"); - setalert_type("error"); - return; - } - - } - - //console.log(" ## traited_list_mot_cle = ", traited_list_mot_cle); - - if (traited_list_mot_cle.length > 3) { - // alert(" Il a plus de 3 mots clés. le max autorisé est 3"); - setdisplay_alert_mysy("1"); - setalert_message("Il a plus de 3 mots clés. le max autorisé est 3"); - setalert_type("error"); - return; - } - - var list_mot_cle_string = traited_list_mot_cle.toString().replaceAll(",", ";"); - - //console.log(" ## list_mot_cle_string = ", list_mot_cle_string); - - //return; - - - var myurl = ""; - - if (isupdateclass) { - // Il s'agit d'une mise à jour - myurl = process.env.REACT_APP_API_URL + "myclass/api/update_class/"; - //alert("Il s'agit d'une mise à jour"); - - } else { - // Il s'agit d'une creation - myurl = process.env.REACT_APP_API_URL + "myclass/api/create_class/"; - //alert(" Il s'agit d'une creation "); - } - - - //alert(" OK Enreg code = "+code+" distentiel = "+distentiel+" duree = "+duree); - const formData = new FormData(); - - //formData.append('token', 'K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA'); - - const stored_cookie = getCookie('tokenmysypart'); - formData.append("token", stored_cookie); - - if (props.mytrainingclass['class_id']) - formData.append("class_id", props.mytrainingclass['class_id']); - else - formData.append("class_id", selected_class_id); - - - - - formData.append('external_code', code); - formData.append('title', title); - - formData.append('objectif', objectif); - formData.append('programme', programme); - - formData.append('methode_pedagogique', methode_pedago); - formData.append('condition_handicape', handicap); - - formData.append('suivi_eval', suivi_eval); - - formData.append('prerequis', prerequis); - - formData.append('description', description); - formData.append('formateur_id', p_formateur_id); - // formData.append('presentiel', presentiel); - formData.append('domaine', domaine); - // formData.append('distantiel', distentiel); - formData.append('class_level', niveau_ftion); - formData.append('price', price); - formData.append('duration', duree); - formData.append('duration_unit', mytrainingdurationunit); - formData.append('url', url); - formData.append('lms_class_code', lms_class_code); - formData.append('class_inscription_url', class_inscription_url); - formData.append('mots_cle', list_mot_cle_string); - formData.append('plus_produit', plus_produit); - formData.append('internal_url', displayedinternalurl); - formData.append('zone_diffusion', ""); - formData.append('metier', mymetier); - formData.append('categorie', mycategorie); - formData.append('version', version); - formData.append('referentiel_padagogique_id', mytraining_ref_peda_id); - - - - formData.append('recyclage_delai', p_detail_recyclage_delai); - formData.append('recyclage_periodicite', p_detail_recyclage_periodicite); - formData.append('recyclage_alert', p_detail_recyclage_alert); - - formData.append('note', mynote); - - formData.append('published', mypublier); - - formData.append('published_catalog_prive', mypublier_catalog_prive); - - formData.append('cpf', localmycpf); - - formData.append('certif', local_mycertif); - - // console.log(" function mycertif = ", local_mycertif); - - formData.append('pourqui', pourqui); - formData.append('support', trainingSupport); - formData.append('img_banner_detail_class', banniereImg); - formData.append('img_url', banniereImg); - - formData.append('note_finale_calculation_rule_id', selected_class_note_calculation_id); - - formData.append('contenu_attestation', contenu_attestation); - - - console.log(" ### formData = ", formData) - /* - Update du 22/10/2023 - Gestion des champs spécifiques ajoutés par le partenaire - */ - for (let i = 0; i < spec_field_updated_values_hooks.length; i++) { - var local_value = String(spec_field_updated_values_hooks[i].field_value); - - if (String(spec_field_updated_values_hooks[i].field_type) === "float") { - - local_value = local_value.replaceAll(",", "."); - - if (isNaN(local_value)) { - // alert("Le champ " + spec_field_updated_values_hooks[i].field_label + " doit être numérique."); - setdisplay_alert_mysy("1"); - setalert_message("Le champ " + spec_field_updated_values_hooks[i].field_label + " doit être numérique."); - setalert_type("error"); - return; - } - - } - else if (String(spec_field_updated_values_hooks[i].field_type) === "string") { - - } - if (String(spec_field_updated_values_hooks[i].is_mandatory) === "1") { - if (String(local_value).trim().length <= 0) { - // alert("Le champ " + spec_field_updated_values_hooks[i].field_label + " est obligatoire."); - setdisplay_alert_mysy("1"); - setalert_message("Le champ " + spec_field_updated_values_hooks[i].field_label + " est obligatoire."); - setalert_type("error"); - return; - } - - } - - formData.append(String(spec_field_updated_values_hooks[i].field_name), local_value); - } - - //console.log(" formData = "+formData); - setLoading(true); - - fetch( - myurl, - { - method: 'POST', - body: formData, - } - ) - .then((response) => response.json()) - .then((result) => { - //console.log('Success:', result['message'], "result['status'] = ", result['status'], "result['class_id'] = ", result['class_id']); - setLoading(false); - setimportmessage(result['message']); - setmyApiResponse(result['status']); - setdatamodification("0"); - - if (String(result['status']) === "true") { - - - var myclass_id = String(result['class_id']); - - - if (String(userimgclassprofilchanged) === "1") - sendClassImage(myclass_id); - } - - //alert(result['status'] + " -- " + myApiResponse + ' mess = ' + result['message']); - - if (String(result['status']) === "true") { - - - var txt = "La formation a été correctement ajoutée / mise à jour."; - setdisplay_alert_mysy("1"); - setalert_message(txt); - setalert_type("success"); - - // alert(" La formation a été correctement ajoutée / mise à jour. Vous allez être redirigé vers la liste des formations."); - /* - if (waiting_before_redirect === false) { - history.push({ - pathname: "/Partner/", - state: { - current_pack: props.currentpack, local_sub_menu: 'affichage', price: "", - period: "", new_pack: "" - } - }); - window.location.reload(); - }*/ - - - /* history.push({ - pathname: "/Partner/", - state: { - current_pack: props.currentpack, local_sub_menu: 'affichage', price: "", - period: "", new_pack: "" - } - }); - window.location.reload();*/ - } - - else { - setdisplay_alert_mysy("1"); - setalert_message(result['message']); - setalert_type("error"); - } - }) - .catch((error) => { - setLoading(false); - console.error('Error:', error); - setmyApiResponse("false"); - }); - }; - - - - function Record_Training_Calcul_Note(event) { - - const formData = new FormData(); - - const stored_cookie = getCookie('tokenmysypart'); - formData.append("token", stored_cookie); - formData.append('note_finale_calculation_rule_id', selected_class_note_calculation_id); - formData.append('internal_url', props.mytrainingclass['ref']); - if (props.mytrainingclass['class_id']) - formData.append("class_id", props.mytrainingclass['class_id']); - else - formData.append("class_id", selected_class_id); - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/update_class/"; - - // console.log(" formData = ", formData); - setLoading(true); - - fetch( - myurl, - { - method: 'POST', - body: formData, - } - ) - .then((response) => response.json()) - .then((result) => { - //console.log('Success:', result['message'], "result['status'] = ", result['status'], "result['class_id'] = ", result['class_id']); - setLoading(false); - - setdatamodification("0"); - - if (String(result['status']) === "true") { - var myclass_id = String(result['class_id']); - - if (String(userimgclassprofilchanged) === "1") - sendClassImage(myclass_id); - } - - //alert(result['status'] + " -- " + myApiResponse + ' mess = ' + result['message']); - - if (String(result['status']) === "true") { - - - var txt = "La formation a été correctement ajoutée / mise à jour."; - setdisplay_alert_mysy("1"); - setalert_message(txt); - setalert_type("success"); - - - } - - else { - setdisplay_alert_mysy("1"); - setalert_message(result['message']); - setalert_type("error"); - } - }) - .catch((error) => { - setLoading(false); - console.error('Error:', error); - setmyApiResponse("false"); - }); - }; - - function DataUpdated() { - if (String(props.check_user_acces_right("formation", "write")) === "1") { - setdatamodification("1"); - setimportmessage(); - } - - } - - const [mytrainingcategorie, setmytrainingcategorie] = useState(""); - - const [New_Get_List_Categorie_result, setNew_Get_List_Categorie_result] = useState([]); - - const [Get_List_Categorie_api, setGet_List_Categorie_api] = useState(); - const [Get_List_Categorie_message, setGet_List_Categorie_message] = useState(); - const [Get_List_Categorie_result, setGet_List_Categorie_result] = useState(); - function Get_List_Categorie() { - 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_Class_Categorie/"; - setLoading(true); - fetch(myurl, - { - method: 'POST', - body: form, - }) - .then((data) => data.json()) - .then((data) => { - setLoading(false); - // console.log(' IN Get_List_Categorie Success:', data['message'], "data['status'] = ", data['status']); - - if (String(data['status']) === String("true")) { - setGet_List_Categorie_api("true"); - setGet_List_Categorie_result(data['message']); - - var new_data2 = []; - const new_data = data['message'].map((x) => { - - - //--- - var localid = JSON.parse(x).id; - var local_id = JSON.parse(x)._id; - var local_nom = JSON.parse(x).nom; - var local_code = JSON.parse(x).code; - var local_class_domaine_id = JSON.parse(x).class_domaine_id; - var local_class_domaine_nom = JSON.parse(x).class_domaine_nom; - - - //--- - var node = { - "id": localid, - "_id": local_id, - "label": local_nom, - "nom": local_nom, - "code": local_code, - "class_domaine_id": local_class_domaine_id, - "class_domaine_nom": local_class_domaine_nom, - - }; - new_data2.push(node); - }); - - //--- - var node = { - "id": "", - "_id": "", - "label": "", - "nom": "", - "code": "", - "class_domaine_id": "", - "class_domaine_nom": "", - - }; - new_data2.push(node); - - if (new_data2.length > 0) { - setNew_Get_List_Categorie_result(new_data2); - //console.log(" ### new_data2 ", new_data2); - //console.log(" ### setNew_Get_List_Categorie_result ", New_Get_List_Categorie_result); - } else { - setNew_Get_List_Categorie_result([]); - } - - - } - else { - setGet_List_Categorie_api("false"); - setGet_List_Categorie_message(data['message']); - } - - }).catch((error) => { - setLoading(false); - console.error('Error Get_List_Categorie :', error); - setGet_List_Categorie_api("false"); - }); - - } - - - const [mytrainingmetier, setmytrainingmetier] = useState(""); - - const [New_Get_List_Metiers_result, setNew_Get_List_Metiers_result] = useState([]); - - const [Get_List_Metiers_api, setGet_List_Metiers_api] = useState(); - const [Get_List_Metiers_message, setGet_List_Metiers_message] = useState(); - const [Get_List_Metiers_result, setGet_List_Metiers_result] = useState(); - function Get_List_Metiers() { - 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_class_metier/"; - setLoading(true); - fetch(myurl, - { - method: 'POST', - body: form, - }) - .then((data) => data.json()) - .then((data) => { - setLoading(false); - // console.log(' IN Get_List_Metiers Success:', data['message'], "data['status'] = ", data['status']); - - if (String(data['status']) === String("true")) { - setGet_List_Metiers_api("true"); - setGet_List_Metiers_result(data['message']); - - var new_data2 = []; - const new_data = data['message'].map((x) => { - - - //--- - var localid = JSON.parse(x).id; - var local_id = JSON.parse(x)._id; - var local_nom = JSON.parse(x).nom; - var local_code = JSON.parse(x).code; - var local_class_domaine_id = JSON.parse(x).class_domaine_id; - var local_class_domaine_nom = JSON.parse(x).class_domaine_nom; - - - //--- - var node = { - "id": localid, - "_id": local_id, - "label": local_nom, - "nom": local_nom, - "code": local_code, - "class_domaine_id": local_class_domaine_id, - "class_domaine_nom": local_class_domaine_nom, - - }; - new_data2.push(node); - }); - - //--- - var node = { - "id": "", - "_id": "", - "label": "", - "nom": "", - "code": "", - "class_domaine_id": "", - "class_domaine_nom": "", - - }; - new_data2.push(node); - - if (new_data2.length > 0) { - setNew_Get_List_Metiers_result(new_data2); - //console.log(" ### new_data2 ", new_data2); - //console.log(" ### setNew_Get_List_Metiers_result ", New_Get_List_Metiers_result); - } else { - setNew_Get_List_Metiers_result([]); - } - - - } - else { - setGet_List_Metiers_api("false"); - setGet_List_Metiers_message(data['message']); - } - - }).catch((error) => { - setLoading(false); - console.error('Error Get_List_Metiers :', error); - setGet_List_Metiers_api("false"); - }); - - } - - - const handleChangeMetierTraining = (event) => { - const name = event.target.name; - const value = event.target.value; - - setmytrainingmetier(value); - setdatamodification("1"); - - } - - - const [mytrainingdomaine, setmytrainingdomaine] = useState(""); - - - - const [New_Get_List_Domaines_result, setNew_Get_List_Domaines_result] = useState([]); - - const [Get_List_Domaines_api, setGet_List_Domaines_api] = useState(); - const [Get_List_Domaines_message, setGet_List_Domaines_message] = useState(); - const [Get_List_Domaines_result, setGet_List_Domaines_result] = useState(); - function Get_List_Domaines() { - 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_Class_domaine/"; - - fetch(myurl, - { - method: 'POST', - body: form, - }) - .then((data) => data.json()) - .then((data) => { - //console.log(' IN Get_List_Domaines Success:', data['message'], "data['status'] = ", data['status']); - - if (String(data['status']) === String("true")) { - setGet_List_Domaines_api("true"); - setGet_List_Domaines_result(data['message']); - - var new_data2 = []; - const new_data = 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_nom = JSON.parse(x).nom; - - - //--- - var node = { - "id": localid, - "_id": local_id, - "nom": local_nom, - "code": local_code, - "label": local_nom, - - - }; - new_data2.push(node); - }); - - var node = { - "id": "", - "_id": "", - "nom": "", - "code": "", - "label": "", - - - }; - new_data2.push(node); - - if (new_data2.length > 0) { - setNew_Get_List_Domaines_result(new_data2); - - // console.log(" ## new_data2 = ", new_data2); - // console.log(" ## New_Get_List_Domaines_result = ", New_Get_List_Domaines_result); - } else { - setNew_Get_List_Domaines_result([]) - } - } - else { - setGet_List_Domaines_api("false"); - setGet_List_Domaines_message(data['message']); - } - - }).catch((error) => { - console.error('Error Get_List_Domaines :', error); - setGet_List_Domaines_api("false"); - }); - } - - const [New_Get_List_Regle_Calcul_Note_Formation_result, setNew_Get_List_Regle_Calcul_Note_Formation_result] = useState([]); - - const [Get_List_Regle_Calcul_Note_Formation_api, setGet_List_Regle_Calcul_Note_Formation_api] = useState(); - const [Get_List_Regle_Calcul_Note_Formation_message, setGet_List_Regle_Calcul_Note_Formation_message] = useState(); - const [Get_List_Regle_Calcul_Note_Formation_result, setGet_List_Regle_Calcul_Note_Formation_result] = useState(); - function Get_List_Regle_Calcul_Note_Formation() { - var form = new FormData(); - - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - form.append("tab_related_collection", "myclass"); - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_base_calcul_note_class_and_ue_With_Filter"; - - fetch(myurl, - { - method: 'POST', - body: form, - }) - .then((data) => data.json()) - .then((data) => { - // console.log(' IN Get_List_Regle_Calcul_Note_Formation Success:', data['message'], "data['status'] = ", data['status']); - - if (String(data['status']) === String("true")) { - setGet_List_Regle_Calcul_Note_Formation_api("true"); - setGet_List_Regle_Calcul_Note_Formation_result(data['message']); - - var new_data2 = []; - const new_data = data['message'].map((x) => { - - //--- - var localid = JSON.parse(x).id; - var local_id = JSON.parse(x)._id; - var local_related_collection = JSON.parse(x).related_collection; - var local_calcul_rule = JSON.parse(x).calcul_rule; - var local_nom = JSON.parse(x).nom; - var local_fonction_name = JSON.parse(x).fonction_name; - - - //--- - var node = { - "id": localid, - "_id": local_id, - "related_collection": local_related_collection, - "calcul_rule": local_calcul_rule, - "label": local_nom, - "nom": local_nom, - "fonction_name": local_fonction_name, - - }; - new_data2.push(node); - }); - - var node = { - - "id": "", - "_id": "", - "related_collection": "", - "calcul_rule": "", - "label": "", - "nom": "", - "fonction_name": "", - - }; - new_data2.push(node); - - if (new_data2.length > 0) { - setNew_Get_List_Regle_Calcul_Note_Formation_result(new_data2); - - // console.log(" ## new_data2 = ", new_data2); - // console.log(" ## New_Get_List_Regle_Calcul_Note_Formation_result = ", New_Get_List_Regle_Calcul_Note_Formation_result); - } else { - setNew_Get_List_Regle_Calcul_Note_Formation_result([]) - } - } - else { - setGet_List_Regle_Calcul_Note_Formation_api("false"); - setGet_List_Regle_Calcul_Note_Formation_message(data['message']); - } - - }).catch((error) => { - console.error('Error Get_List_Regle_Calcul_Note_Formation :', error); - setGet_List_Regle_Calcul_Note_Formation_api("false"); - }); - } - - - const handleChangeDomaineTraining = (event) => { - const name = event.target.name; - const value = event.target.value; - - setmytrainingdomaine(value); - setdatamodification("1"); - - } - - - function alertactivecompte() { - //alert(" ispending = ===== " + props.ispending); - if (String(props.ispending) === String("1")) { - //alert(" Vous devez ajouter un mode de Paiement pour acceder à cette fonctionnalité"); - setdisplay_alert_mysy("1"); - setalert_message("Vous devez ajouter un mode de Paiement pour acceder à cette fonctionnalité"); - setalert_type("error"); - return; - } - } - - const [isimgclassSelected, setisimgclassSelected] = useState(false); - const [isimgclassSelectedfile, setisimgclassSelectedfile] = useState(false); - const [userimgclassprofil, setuserimgclassprofil] = useState(); - const [userimgclassprofilchanged, setuserimgclassprofilchanged] = useState(""); - - const imglogoclasschangeHandler = (event) => { - - - let file_size = event.target.files[0].size; - - //or if you like to have name and type - //console.log(event.target.files); - - 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 ne doit pas dépasser un 1 Méga octets"); - setdisplay_alert_mysy("1"); - setalert_message("L'image ne doit pas dépasser un 1 Méga octets"); - setalert_type("error"); - return; - } - setisimgclassSelected(event.target.files[0]); - setisimgclassSelectedfile(true); - - setuserimgclassprofil(URL.createObjectURL(event.target.files[0])); - setuserimgclassprofilchanged("1"); - }; - - - const [isimgclassdeleted, setisimgclassdeleted] = useState(""); - const [isimgclassdeleted_message, setisimgclassdeleted_message] = useState(""); - - function removeRecodedClassImage() { - var class_external_code = ""; - if (document.getElementsByName("external_code")[0].value && document.getElementsByName("external_code")[0].value.length > 3) { - class_external_code = document.getElementsByName("external_code")[0].value; - } else { - // alert(" Vous devez saisir le code externe de la formation avant d'enregistrer une image. Le code externe prend au moins 3 caractères"); - setdisplay_alert_mysy("1"); - setalert_message("Vous devez saisir le code externe de la formation avant d'enregistrer une image. Le code externe prend au moins 3 caractères"); - setalert_type("error"); - return; - } - - var form = new FormData(); - - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - form.append("class_external_code", class_external_code); - form.append("related_collection", "myclass"); - form.append("related_collection_recid", selected_class_id); - form.append("type", "partner"); - setLoading(true); - fetch( - process.env.REACT_APP_API_URL + "myclass/api/DeleteRecodedClassImage/", - { - method: 'POST', - body: form, - } - ).then((response) => response.json()) - .then((result) => { - setLoading(false); - - //console.log(' removeRecodedClassImage : status:', result['status']); - //console.log('removeRecodedClassImage : Success:', result['message']); - - setisimgclassSelected(false); - - if (String(result['status']) === String("true")) { - setisimgclassdeleted("1"); - setuserimgclassprofil(""); - } - else if (String(result['status']) === String("Err_Connexion")) { - alert('Erreur: ' + result['message']); - history.push("/Connexion"); - return; - } - - else { - setisimgclassdeleted("0"); - setisimgclassdeleted_message(result['message']); - setisimgclassSelected(true); - } - - }) - .catch((error) => { - setLoading(false); - console.error('Error:'); - setisimgclassSelected(true); - setisimgclassdeleted("0"); - setisimgclassdeleted_message(result['message']); - }); - - } - - const [isimgclassSaved, setisimgclassSaved] = useState(""); - const [isimgclassSaved_message, setisimgclassSaved_message] = useState(""); - function sendClassImage(local_myclass_id) { - - var class_external_code = ""; - - if (document.getElementsByName("external_code")[0].value && document.getElementsByName("external_code")[0].value.length > 3) { - class_external_code = document.getElementsByName("external_code")[0].value; - } else { - // alert(" Vous devez saisir le code externe de la formation avant d'enregistrer une image. Le code externe prend au moins 3 caractères"); - setdisplay_alert_mysy("1"); - setalert_message("Vous devez saisir le code externe de la formation avant d'enregistrer une image. Le code externe prend au moins 3 caractères"); - setalert_type("error"); - return; - } - - - var formData = new FormData(); - formData.append('File', isimgclassSelected); - const stored_cookie = getCookie('tokenmysypart'); - formData.append("token", stored_cookie); - formData.append("class_external_code", class_external_code); - formData.append("related_collection", "myclass"); - formData.append("related_collection_recid", local_myclass_id); - formData.append("type", "myclass"); - - setLoading(true); - fetch( - process.env.REACT_APP_API_URL + "myclass/api/recordClassImage/", - { - method: 'POST', - body: formData, - } - ).then((response) => response.json()) - .then((result) => { - setLoading(false); - //console.log('status:', result['status']); - //console.log('Success:', result['message']); - setisimgclassSelected(false); - - if (String(result['status']) == String("true")) { - setisimgclassSaved("1"); - } - else { - setisimgclassSaved("0"); - setisimgclassSaved_message(result['message']); - setisimgclassSelected(true); - } - - }) - .catch((error) => { - setLoading(false); - console.error('Error:'); - setisimgclassSelected(true); - setisimgclassSaved("0"); - setisimgclassSaved_message(result['message']); - }); - }; - - - const [myclassimage, setmyclassimage] = useState(); - const [isclassimage, setisclassimage] = useState(); - - function getClassImage(local_class_id) { - var myurl = process.env.REACT_APP_API_URL + "myclass/api/getRecodedClassImage/"; - - var class_external_code = props.mytrainingclass['class_external_code']; - - if (class_external_code.length < 3) { - //console.log("Le code externe prend au moins 3 caractères"); - return; - } - - - var form = new FormData(); - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - form.append("type", "partner"); - form.append("related_collection", "myclass"); - form.append("related_collection_recid", local_class_id); - form.append("class_external_code", class_external_code); - - setLoading(true); - axios.post(myurl, form).then(res => { - - if (res.data.status != "False") { - setLoading(false); - //console.log(" getClassImage : In test res.data.status = " + res.data.status); - //console.log(" getClassImage: res.data.message.img = " + res.data.message); - - if (res.data.message && res.data.message.img && res.data.message.img.length > 0) { - setisclassimage("True"); - - setisclassimage(res.data.message.img); - var ch_img = "data:image/png;base64," + res.data.message.img; - setuserimgclassprofil(ch_img); - - } - else { - setisclassimage("False"); - setuserimgclassprofil(); - } - - } - else { - //console.log(" In Erreur res.data.status = " + res.data.status); - //console.log(" In Erreur res.data.message = " + res.data.message); - setisclassimage("False"); - setuserimgclassprofil(); - //alert("4"); - } - }).catch((error) => { - setLoading(false); - console.warn('getClassImage ee: Not good man :( getClassImage = '); - setisclassimage("False"); - setuserimgclassprofil(""); - }) - - } - - - const [activepack, setactivepack] = useState(); - function ActivePackStandard() { - - history.push({ - pathname: "/Partner/", - state: { - current_pack: props.currentpack, local_sub_menu: 'checkout', price: "50", - period: "mensuelle", new_pack: "standard" - } - }); - window.location.reload(); - } - - function ActivePackGold() { - - history.push({ - pathname: "/Partner/", - state: { - current_pack: props.currentpack, local_sub_menu: 'checkout', price: "50", - period: "mensuelle", new_pack: "gold" - } - }); - window.location.reload(); - } - - - - function change_zone_diffsion() { - setfield_zone_diffusion(document.getElementById("zone_diffusion_v2").value) - } - - - function UndoModif() { - setfield_description(""); - setfield_objectif(""); - setfield_programme(""); - - setfield_methode_pedago(""); - setfield_handicap(""); - - - setfield_prerequis(""); - setfield_mots_cle(""); - setfield_plus_produit(""); - setfield_contenu_attestation(""); - setfield_datelieu(""); - setfield_zone_diffusion(""); - seteditor_tochange(""); - - - fillfield(); - if (props.mytrainingclass['class_external_code']) { - - //console.log("props.mytrainingclass['plus_produit'] = " + props.mytrainingclass['plus_produit']); - setplus_produit_enabled(props.mytrainingclass['plus_produit']); - setmots_cle_enabled(props.mytrainingclass['mots_cle']); - setzone_diffusion_enabled(props.mytrainingclass['zone_diffusion']); - } - - setdatamodification("0"); - window.scrollTo({ - top: 0, - behavior: "smooth", - }); - - } - - const [editor_tochange, seteditor_tochange] = useState(""); - function editor_keyup() { - seteditor_tochange("1"); - } - - const cpf = [ - { - value: '1', - label: 'Oui', - }, - { - value: '0', - label: 'Non', - }, - - ]; - - - const certif = [ - { - value: '1', - label: 'Oui', - }, - { - value: '0', - label: 'Non', - }, - - ]; - - function retourList() { - props.closeTrainingForm(); - - } - - const [isLoading, setLoading] = useState(); - - // Gestion champs specifiques - - /* - *** ALGORITHME - 1 - Récuperer la liste des champs specifiques de la collection concernée - Array : list_nom_champs_spec - 2 - Récupérer les caracteristiques de champs champs spécifique : "id, nom, label, type valeur, etc" - - avec un champ 'value' à vide. Mettre dans le tableau JSON, 'spec_champs_valeur' - - 3 - Créer une nouvelle table qui permettra de gerer les hook : const [rows_champs_specifics, setrows_champs_specifics] = useState([]); - 4 - Afficher en html les elements 'rows_champs_specifics' - 5 - Gerer la modification avec la fonction 'change_champs_spec_handle' - 6 - On recuperer les valeur lors du click d'enregistrement. - - */ - - - const list_nom_champs_spec = [] - const [spec_champs_valeur, setspec_champs_valeur] = useState([]); - - //const spec_champs_valeur = "" - - const [Get_Partner_Object_Specific_Fields_api, setGet_Partner_Object_Specific_Fields_api] = useState(); - const [Get_Partner_Object_Specific_Fields_message, setGet_Partner_Object_Specific_Fields_message] = useState(); - const [Get_Partner_Object_Specific_Fields_result, setGet_Partner_Object_Specific_Fields_result] = useState(); - function Get_Partner_Object_Specific_Fields(local_collection_obj_metier) { - - var form = new FormData(); - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - form.append("object_name", local_collection_obj_metier); - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Partner_Object_Specific_Valide_Displayed_Fields/"; - setLoading(true); - axios.post(myurl, form).then(res => { - - if (String(res.data.status) === String("true")) { - setLoading(false); - //console.log(" In Get_Partner_Object_Specific_Fields res.data.status = " + res.data.status); - //console.log(" In Get_Partner_Object_Specific_Fields res.data.message r_class = " + res.data.message); - - setGet_Partner_Object_Specific_Fields_api("true"); - setGet_Partner_Object_Specific_Fields_result(res.data.message); - - - setrows_champs_specifics(res.data.message); - - - } - else { - setGet_Partner_Object_Specific_Fields_api("false"); - setGet_Partner_Object_Specific_Fields_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_Partner_Object_Specific_Fields = ', error); - setGet_Partner_Object_Specific_Fields_api("false"); - //alert(" Impossible de recuperer la liste des collection et champs personnalisables"); - setdisplay_alert_mysy("1"); - setalert_message("Impossible de recuperer la liste des collection et champs personnalisables"); - setalert_type("error"); - //setmyApimyApiMessage("") - }) - } - - const [New_Get_List_Niveau_Formation_result, setNew_Get_List_Niveau_Formation_result] = useState([]); - - const [Get_List_Niveau_Formation_api, setGet_List_Niveau_Formation_api] = useState(); - const [Get_List_Niveau_Formation_message, setGet_List_Niveau_Formation_message] = useState(); - const [Get_List_Niveau_Formation_result, setGet_List_Niveau_Formation_result] = useState([]); - function Get_List_Niveau_Formation() { - var form = new FormData(); - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Class_Niveau_Formation/"; - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - - setLoading(true); - fetch(myurl, - { - method: 'POST', - body: form, - }) - .then((data) => data.json()) - .then((data) => { - setLoading(false); - //console.log(' IN Get_List_Niveau_Formation Success:', data['message'], "data['status'] = ", data['status']); - - if (String(data['status']) === String("true")) { - setGet_List_Niveau_Formation_api("true"); - setGet_List_Niveau_Formation_result(data['message']); - - var new_data2 = []; - const new_data = 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 node = { - "_id": local_id, - "id": localid, - "label": local_description, - "description": local_description, - "code": local_code, - - }; - new_data2.push(node); - }); - - if (new_data2.length > 0) - setNew_Get_List_Niveau_Formation_result(new_data2); - - - - - } - else { - setGet_List_Niveau_Formation_api("false"); - setGet_List_Niveau_Formation_message(data['message']); - // alert(data['message']) - setdisplay_alert_mysy("1"); - setalert_message(data['message']); - setalert_type("error"); - } - - }).catch((error) => { - setLoading(false); - console.error('Error Get_List_Niveau_Formation :', error); - setGet_List_Niveau_Formation_api("false"); - // alert(" Impossible de récupérer la liste des niveaux de formation"); - setdisplay_alert_mysy("1"); - setalert_message("Impossible de récupérer la liste des niveaux de formation"); - setalert_type("error"); - - }); - - } - - - - //const [rows_champs_specifics, setrows_champs_specifics] = useState([]); - - // Cas spécifique de cette page. - const [rows_champs_specifics, setrows_champs_specifics] = useState(props.rows_champs_specifics); - - const [display_champs_specifics, setdisplay_champs_specifics] = useState("0"); - - function afficher_champs_spec() { - - setdisplay_champs_specifics("1"); - //setrows_champs_specifics(spec_champs_valeur); - - } - - function findIndexByProperty(data, key, value) { - for (var i = 0; i < data.length; i++) { - - if (data[i][key] == value) { - return i; - } - } - return -1; - } - - - function findValueByProperty(data, key, value) { - for (var i = 0; i < data.length; i++) { - if (data[i][key] == value) { - - var tmp_val = JSON.parse(data[i]); - - return tmp_val.field_value - - } - } - return ""; - } - - - const spec_field_updated_values = [] - const [spec_field_updated_values_hooks, setspec_field_updated_values_hooks] = useState([]); - - - function change_champs_spec_handle() { - - for (let i = 0; i < rows_champs_specifics.length; i++) { - - var field_name = JSON.parse(rows_champs_specifics[i]).field_name; - var field_type = JSON.parse(rows_champs_specifics[i]).field_type; - var field_label = JSON.parse(rows_champs_specifics[i]).field_label; - var is_mandatory = JSON.parse(rows_champs_specifics[i]).is_mandatory; - - - if (document.getElementsByName(String(field_name))[0]) { - - var field_value = document.getElementsByName(String(field_name))[0].value; - var new_val = { 'field_name': field_name, 'field_value': field_value, 'field_type': field_type, 'field_label': field_label, 'is_mandatory': is_mandatory } - var johnIndex = findIndexByProperty(spec_field_updated_values, 'field_name', field_name); - if (johnIndex > -1) { - spec_field_updated_values[johnIndex] = new_val; - - } else { - spec_field_updated_values.push(new_val); - } - } - - } - - //setrows_champs_specifics(spec_champs_valeur); - - //console.log(" OUTT spec_field_updated_values = ", spec_field_updated_values); - setspec_field_updated_values_hooks(spec_field_updated_values) - } - // -- end champs specifiques - - - const [p_formateur_id, setp_formateur_id] = useState(""); - const [p_formateur_label, setp_formateur_label] = useState("-"); - - const [p_class_level, setp_class_level] = useState("2"); - const [p_class_level_label, setp_class_level_label] = useState("Aucune certification"); - - - - // -- 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 [tab_convention_pieces_jointes_result, settab_convention_pieces_jointes_result] = useState([]); - - 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; - - - - - console.log("file_size 2 = ", file_size, " file_type = ", file_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 [sessions_file_change_1_convention_api, setsessions_file_change_1_convention_api] = useState(); - const [sessions_file_change_1_convention_result, setsessions_file_change_1_convention_result] = useState(); - const [sessions_file_change_1_convention_message, setsessions_file_change_1_convention_message] = useState(); - const sessions_file_change_1_convention = 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_type !== "application/pdf") { - // alert("Le fichier n'est pas de type PDF"); - setdisplay_alert_mysy("1"); - setalert_message("Le fichier n'est pas de type PDF"); - setalert_type("error"); - return; - } - - - - if (file_size > 10000000) { - // alert("Le fichier ne doit pas depasser un 1 Méga octets"); - //console.log("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"); - return; - } - - //var new_node = {'name':event.target.files[0].name, 'type':event.target.files[0].type} - - - var new_tmp = []; - - if (tab_convention_pieces_jointes_result && tab_convention_pieces_jointes_result.length > 0) { - - tab_convention_pieces_jointes_result.map((x) => { - new_tmp.push(x); - - }); - - } - - new_tmp.push(event.target.files[0]) - - settab_convention_pieces_jointes_result(new_tmp); - - console.log(" tab_convention_pieces_jointes_result = ", tab_convention_pieces_jointes_result) - - - 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; - - - console.log("file_size 1 = ", file_size, " file_type = ", file_type); - if (file_size > 10000000) { - //alert("Le fichier ne doit pas depasser un 1 Méga octets"); - //console.log("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"); - 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; - - - }; - - - // Cette fonction permet d'enregister la fiche catalogue d'une formation - const [Record_Class_Catalogue_File_api, setRecord_Class_Catalogue_File_api] = useState(); - const [Record_Class_Catalogue_File_result, setRecord_Class_Catalogue_File_result] = useState(); - const [Record_Class_Catalogue_File_message, setRecord_Class_Catalogue_File_message] = useState(); - - function Record_Class_Catalogue_File() { - - 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) { - //console.log(" ### Traitement de : ", 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", "myclass"); - formData.append("object_owner_id", selected_class_id); - formData.append("type_document", "catalogue_file"); - - //formData.append("class_internal_url", internal_url); - //console.log("token = " + stored_cookie); - - setLoading(true); - fetch( - process.env.REACT_APP_API_URL + "myclass/api/Store_User_Downloaded_File/", - { - method: 'POST', - body: formData, - } - ) - .then((response) => response.json()) - .then((result) => { - - setLoading(false); - //console.log(" ## result['status'] = ", result['status']) - if (String(result['status']) === String("true")) { - //console.log('Success:', result['message']); - setRecord_Class_Catalogue_File_result(result['message']); - setRecord_Class_Catalogue_File_api("true"); - - // Get_List_Of_All_PJ(selected_class_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") - setdisplay_alert_mysy("1"); - setalert_message(" La pièce jointe " + file_1_name.name + " a été bien enregistrée"); - setalert_type("success"); - - } - else { - setRecord_Class_Catalogue_File_message(result['message']); - setRecord_Class_Catalogue_File_api("false"); - //alert(result['message']); - setdisplay_alert_mysy("1"); - setalert_message(result['message']); - setalert_type("error"); - } - - }) - .catch((error) => { - setLoading(false); - console.error(' Record_Class_Catalogue_File Error:', error); - setRecord_Class_Catalogue_File_api("false"); - // alert(" Impossible d'ajouter la pièce jointe"); - setdisplay_alert_mysy("1"); - setalert_message("Impossible d'ajouter la pièce jointe"); - setalert_type("error"); - }); - - } - - - } - - - - - const [add_one_eu_to_class, setadd_one_eu_to_class] = useState(""); - - 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) { - //console.log(" ### Traitement de : ", 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", "myclass"); - formData.append("object_owner_id", selected_class_id); - formData.append("type_document", ""); - - //formData.append("class_internal_url", internal_url); - //console.log("token = " + stored_cookie); - - setLoading(true); - fetch( - process.env.REACT_APP_API_URL + "myclass/api/Store_User_Downloaded_File/", - { - method: 'POST', - body: formData, - } - ) - .then((response) => response.json()) - .then((result) => { - - setLoading(false); - //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(selected_class_id); - Get_Class_Catalogue_File(selected_class_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") - setdisplay_alert_mysy("1"); - setalert_message(" La pièce jointe " + file_1_name.name + " a été bien enregistrée"); - setalert_type("success"); - - } - else { - setRecord_All_PJ_message(result['message']); - setRecord_All_PJ_api("false"); - //alert(result['message']); - setdisplay_alert_mysy("1"); - setalert_message(result['message']); - setalert_type("error"); - } - - }) - .catch((error) => { - setLoading(false); - console.error(' Record_All_PJ Error:', error); - setRecord_All_PJ_api("false"); - // alert(" Impossible d'ajouter la pièce jointe"); - setdisplay_alert_mysy("1"); - setalert_message("Impossible d'ajouter la pièce jointe"); - setalert_type("error"); - }); - - } - - - } - - - 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/"; - - setLoading(true); - fetch( - process.env.REACT_APP_API_URL + "myclass/api/Delete_Stored_Downloaded_File/", - { - method: 'POST', - body: formData, - } - ) - .then((response) => response.json()) - .then((result) => { - setLoading(false); - //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(selected_class_id); - Get_Class_Catalogue_File(selected_class_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"); - // alert(result['message']); - setdisplay_alert_mysy("1"); - setalert_message(result['message']); - setalert_type("error"); - } - - }) - .catch((error) => { - setLoading(false); - console.error(' Record_All_PJ Error:', error); - setDelete_one_attached_document_api("false"); - // alert(" Impossible de supprimer le document"); - setdisplay_alert_mysy("1"); - setalert_message("Impossible de supprimer le document"); - setalert_type("error"); - - }); - - - } - - - const Delete_one_attached_document_convention = (event) => { - var file_name = event.target.id; - - } - - - - const [Get_Class_Catalogue_File_api, setGet_Class_Catalogue_File_api] = useState(); - const [Get_Class_Catalogue_File_result, setGet_Class_Catalogue_File_result] = useState([]); - const [Get_Class_Catalogue_File_message, setGet_Class_Catalogue_File_message] = useState(); - - function Get_Class_Catalogue_File(local_employee_id) { - - const formData = new FormData(); - - //formData.append('token', 'K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA'); - const stored_cookie = getCookie('tokenmysypart'); - - formData.append("token", stored_cookie); - formData.append("filter_object_owner_collection", "myclass"); - formData.append("filter_object_owner_id", local_employee_id); - formData.append("filter_type_document", "catalogue_file"); - - - //formData.append("class_internal_url", internal_url); - //console.log("token = " + stored_cookie); - setLoading(true); - - fetch( - process.env.REACT_APP_API_URL + "myclass/api/Get_List_object_owner_collection_Stored_Files_With_Filter/", - { - method: 'POST', - body: formData, - } - ) - .then((response) => response.json()) - .then((result) => { - setLoading(false); - - //console.log(" ## result['status'] = ", result['status']) - if (String(result['status']) === String("true")) { - //console.log('Message :', result['message']); - setGet_Class_Catalogue_File_result(result['message']); - setGet_Class_Catalogue_File_api("true"); - - } - else { - setGet_Class_Catalogue_File_message(result['message']); - setGet_Class_Catalogue_File_api("false"); - } - - }) - .catch((error) => { - setLoading(false); - console.error(' Get_Class_Catalogue_File Error:', error); - setGet_Class_Catalogue_File_api("false"); - }); - - } - - - - - 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", "myclass"); - formData.append("object_owner_id", local_employee_id); - - - //formData.append("class_internal_url", internal_url); - //console.log("token = " + stored_cookie); - setLoading(true); - - 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) => { - setLoading(false); - - //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) => { - setLoading(false); - 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 [submenu, setsubmenu] = useState(""); - - function submenu_color_management(current_menu) { - const list_sous_menu = ["detail_formation", "unite_enseignement", "admission", "piece_jointe", "note_evaluation", "statistiques", - "historique", "aide_ia", "finance", "documents"] - - for (let i = 0; i < list_sous_menu.length; i++) { - - var sous_menu = list_sous_menu[i]; - if (String(sous_menu) !== current_menu) { - if (document.getElementById(sous_menu)) { - document.getElementById(sous_menu).style.backgroundColor = "#d8edfc"; - document.getElementById(sous_menu).style.color = "black"; - document.getElementById(sous_menu).style.fontWeight = "normal"; - } - } - - } - - if (document.getElementById(current_menu)) { - document.getElementById(current_menu).style.backgroundColor = "#107758"; - document.getElementById(current_menu).style.color = "white"; - document.getElementById(current_menu).style.fontWeight = "bold"; - } - - } - - - function submenu_detail_formation() { - setsubmenu("detail_formation"); - submenu_color_management("detail_formation"); - } - - function submenu_unite_enseignement() { - setsubmenu("unite_enseignement"); - submenu_color_management("unite_enseignement"); - } - - function submenu_admission() { - setsubmenu("admission"); - submenu_color_management("admission"); - } - - function submenu_note_evaluation() { - setsubmenu("note_evaluation"); - submenu_color_management("note_evaluation"); - Getall_Class_List_Evalution(); - - Get_List_Regle_Calcul_Note_Formation(); - } - - - function submenu_piece_jointe() { - setsubmenu("piece_jointe"); - submenu_color_management("piece_jointe"); - } - - function submenu_documents() { - Get_List_Stagiaire_Convocations_Mail(); - Get_List_Stagiaire_Convocations_PDF(); - Get_List_Convention_Individuelle_Mail(); - Get_List_Convention_Individuelle_PDF(); - - Get_List_Convention_Entreprise_Mail(); - Get_List_Convention_Entreprise_PDF(); - - Getall_Partner_Formulaires_Eval_Froid(); - Getall_Partner_Formulaires_Eval_Chaud(); - Getall_Partner_Formulaires_Eval_Formateur(); - - Get_List_Attestation_PDF(); - Get_List_Attestation_Email(); - - Getall_Partner_Formulaires_Q_Position(); - Get_Given_Class_Default_Documents(); - setsubmenu("documents"); - submenu_color_management("documents"); - } - - function submenu_aide_ia() { - setsubmenu("aide_ia"); - submenu_color_management("aide_ia"); - } - - - function submenu_statistiques() { - setsubmenu("statistiques"); - submenu_color_management("statistiques"); - Getall_Employee_Statistic_Question_List(); - Get_Qualiopi_Indic_Apprenant_Formation("1"); - Get_Qualiopi_Indic_Nb_Heure("1"); - Get_Indic_Class_CA_HT("1"); - } - - function submenu_finance() { - setsubmenu("finance"); - submenu_color_management("finance"); - Getall_Class_Finance_Caracteristic(); - } - - function submenu_historique() { - setsubmenu("historique"); - submenu_color_management("historique"); - - } - - - const myRef = useRef(null) - - const [p_detail_external_code, setp_detail_external_code] = useState(""); - const [p_detail_title, setp_detail_title] = useState(""); - const [p_detail_duree, setp_detail_duree] = useState(""); - const [p_detail_url, setp_detail_url] = useState(""); - const [p_detail_lms_class_code, setp_detail_lms_class_code] = useState(""); - - const [p_detail_version_catalogue, setp_detail_version_catalogue] = useState(""); - - const [p_detail_recyclage_delai, setp_detail_recyclage_delai] = useState("0"); - const [p_detail_recyclage_periodicite, setp_detail_recyclage_periodicite] = useState("mois"); - const [p_detail_recyclage_alert, setp_detail_recyclage_alert] = useState("0"); - - const [p_detail_class_inscription_url, setp_detail_class_inscription_url] = useState(""); - const [p_detail_class_banner_img_url, setp_detail_class_banner_img_url] = useState(""); - const [p_detail_note, setp_detail_note] = useState(""); - const [p_detail_price, setp_detail_price] = useState(""); - - const [p_detail_archive, setp_detail_archive] = useState(""); - - const [selected_ue_id, setselected_ue_id] = useState(""); - const [selected_ue_credit_ects, setselected_ue_credit_ects] = useState(""); - const [selected_ue_is_noted, setselected_ue_is_noted] = useState(""); - const [selected_ue_pres_dist_hyp, setselected_ue_pres_dist_hyp] = useState(""); - const [selected_ue_coefficient, setselected_ue_coefficient] = useState(""); - const [selected_ue_seuil_validation, setselected_ue_seuil_validation] = useState(""); - - - const [selected_class_note_calculation_id, setselected_class_note_calculation_id] = useState(""); - - - - const New_Option_Is_Noted = [ - { "id": "1", "label": "Oui", "value": "1" }, - { "id": "0", "label": "Non", "value": "0" }, - { "id": "", "label": "", "value": "" }, - ] - - - - - const New_Option_pres_dist_hyp = [ - { "id": "1", "label": "Distanciel", "value": "1" }, - { "id": "2", "label": "Hybride", "value": "2" }, - { "id": "0", "label": "Présentiel", "value": "0" }, - { "id": "", "label": "", "value": "" }, - ] - - const [Dialog_Unite_Enseignement_open, setDialog_Unite_Enseignement_open] = React.useState(false); - const Dialog_Unite_Enseignement_handleClose = () => { - setDialog_Unite_Enseignement_open(false); - setselected_ue_id(""); - setselected_ue_credit_ects(""); - setselected_ue_is_noted(""); - setselected_ue_pres_dist_hyp(""); - setadd_one_eu_to_class(""); - setselected_ue_coefficient(""); - setselected_ue_seuil_validation(""); - - }; - - - function clean_ue_data() { - setselected_ue_id(""); - setselected_ue_credit_ects(""); - setselected_ue_seuil_validation(""); - setselected_ue_is_noted(""); - setselected_ue_pres_dist_hyp(""); - setadd_one_eu_to_class(""); - setselected_ue_coefficient(""); - - } - - const Dialog_Unite_Enseignement_handleClose_buton = () => { - setDialog_Unite_Enseignement_open(false); - setselected_ue_id(""); - setselected_ue_credit_ects(""); - setselected_ue_seuil_validation(""); - setselected_ue_is_noted(""); - setselected_ue_pres_dist_hyp(""); - setadd_one_eu_to_class(""); - setselected_ue_coefficient(""); - }; - - const [Dialog_1_message, setDialog_1_message] = React.useState(false); - - const [Add_Update_UE_To_Class_api, setAdd_Update_UE_To_Class_api] = useState(); - const [Add_Update_UE_To_Class_message, setAdd_Update_UE_To_Class_message] = useState(); - const [Add_Update_UE_To_Class_result, setAdd_Update_UE_To_Class_result] = useState(); - function Add_Update_UE_To_Class() { - setLoading(true); - var form = new FormData(); - //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); - - - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - - if (props.mytrainingclass['class_id']) - form.append("class_id", props.mytrainingclass['class_id']); - else - form.append("class_id", selected_class_id); - - form.append("ue_id", selected_ue_id); - form.append("credit", selected_ue_credit_ects); - form.append("coefficient", selected_ue_coefficient); - form.append("pres_dist_hyp", selected_ue_pres_dist_hyp); - form.append("is_noted", selected_ue_is_noted); - form.append("seuil_validation", selected_ue_seuil_validation); - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Add_Update_UE_To_Class/"; - - - axios.post(myurl, form).then(res => { - setLoading(false); - // console.log(" In Add_Update_UE_To_Class res.data.status = " + res.data.status); - //console.log(" In Add_Update_UE_To_Class res.data.message r_class = " + res.data.message); - - if (String(res.data.status) === String("true")) { - setAdd_Update_UE_To_Class_api("true"); - setAdd_Update_UE_To_Class_result(res.data.message); - Getall_Class_List_UE(); - Dialog_Unite_Enseignement_handleClose_buton(); - - // alert(res.data.message) - setdisplay_alert_mysy("1"); - setalert_message(res.data.message); - setalert_type("success"); - - - } - else { - setAdd_Update_UE_To_Class_api("false"); - setAdd_Update_UE_To_Class_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('Add_Update_UE_To_Class : Not good man :( mysearchtext = ' + error); - setAdd_Update_UE_To_Class_api("false"); - setdisplay_alert_mysy("1"); - setalert_message("Impossible d'ajouter l'UE à la formation"); - setalert_type("error"); - // alert(" Impossible d'ajouter l'UE à la formation "); - - }) - } - - - const [Add_Update_Evaluation_to_UE_api, setAdd_Update_Evaluation_to_UE_api] = useState(); - const [Add_Update_Evaluation_to_UE_message, setAdd_Update_Evaluation_to_UE_message] = useState(); - const [Add_Update_Evaluation_to_UE_result, setAdd_Update_Evaluation_to_UE_result] = useState(); - function Add_Update_Evaluation_to_UE() { - setLoading(true); - var form = new FormData(); - //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); - - - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - - form.append("max_note", p_detail_max_note); - form.append("ponderation_type_eval", p_detail_ponderation_type_eval); - - var myurl = ""; - - if (String(add_ue_evalution) === "1") { - if (props.mytrainingclass['class_id']) - form.append("class_id", props.mytrainingclass['class_id']); - else - form.append("class_id", selected_class_id); - - form.append("class_ue_id", selected_ue_id); - form.append("type_evaluation_id", selected_eu_evalution_id); - - myurl = process.env.REACT_APP_API_URL + "myclass/api/Add_Class_UE_Evaluation/"; - } else { - form.append("class_ue_evaluation_id", class_unite_enseignement_type_evaluation_id); - myurl = process.env.REACT_APP_API_URL + "myclass/api/Update_Class_UE_Evaluation/"; - } - - axios.post(myurl, form).then(res => { - setLoading(false); - // console.log(" In Add_Update_Evaluation_to_UE res.data.status = " + res.data.status); - //console.log(" In Add_Update_Evaluation_to_UE res.data.message r_class = " + res.data.message); - - if (String(res.data.status) === String("true")) { - setAdd_Update_Evaluation_to_UE_api("true"); - setAdd_Update_Evaluation_to_UE_result(res.data.message); - - setadd_ue_evalution(""); - setselected_ue_id(""); - setselected_eu_evalution_id(""); - setsetgridline_evaluation_ue_id(""); - setp_detail_max_note(""); - setp_detail_ponderation_type_eval(""); - setclass_unite_enseignement_type_evaluation_id(""); - Getall_Class_List_Evalution(); - - - Dialog_Evaluation_Unite_Enseignement_handleClose_buton(); - - // alert(res.data.message) - setdisplay_alert_mysy("1"); - setalert_message(res.data.message); - setalert_type("success"); - - } - else { - setAdd_Update_Evaluation_to_UE_api("false"); - setAdd_Update_Evaluation_to_UE_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('Add_Update_Evaluation_to_UE : Not good man :( mysearchtext = ' + error); - setAdd_Update_Evaluation_to_UE_api("false"); - // alert(" Impossible d'ajouter l'évaluation l'UE "); - setdisplay_alert_mysy("1"); - setalert_message("Impossible d'ajouter l'évaluation l'UE"); - setalert_type("error"); - - }) - } - - - const [gridline_ue_id, setgridline_ue_id] = useState(""); - - const sleep = (milliseconds) => { - return new Promise(resolve => setTimeout(resolve, milliseconds)) - } - - - const filter_New_Get_List_Metiers_result = () => { - - var local_tab = New_Get_List_Metiers_result.filter((data) => data.class_domaine_id === String(String(mytrainingdomaine).trim())) - console.log(" ### local_tab = ", local_tab); - - local_tab.push({ - "id": "", - "_id": "", - "label": "", - "nom": "", - "code": "", - "class_domaine_id": "", - "class_domaine_nom": "", - - }) - - - return local_tab; - - }; - - - const [Dialog_Evaluation_Unite_Enseignement_open, setDialog_Evaluation_Unite_Enseignement_open] = React.useState(false); - - const Dialog_Evaluation_Unite_Enseignement_handleClose = () => { - setDialog_Evaluation_Unite_Enseignement_open(false); - - }; - const Dialog_Evaluation_Unite_Enseignement_handleClose_buton = () => { - setDialog_Evaluation_Unite_Enseignement_open(false); - - }; - - const [selected_eu_evalution_id, setselected_eu_evalution_id] = React.useState(""); - const [setgridline_evaluation_ue_id, setsetgridline_evaluation_ue_id] = React.useState(""); - - const [class_unite_enseignement_type_evaluation_id, setclass_unite_enseignement_type_evaluation_id] = React.useState(""); - - const [p_detail_max_note, setp_detail_max_note] = React.useState(""); - - const [p_detail_ponderation_type_eval, setp_detail_ponderation_type_eval] = React.useState(""); - - - const [add_ue_evalution, setadd_ue_evalution] = React.useState(""); - - - const [New_Getall_Employee_Statistic_Question_List_result, setNew_Getall_Employee_Statistic_Question_List_result] = useState([]); - - const [Getall_Employee_Statistic_Question_List_api, setGetall_Employee_Statistic_Question_List_api] = useState(); - const [Getall_Employee_Statistic_Question_List_message, setGetall_Employee_Statistic_Question_List_message] = useState(); - const [Getall_Employee_Statistic_Question_List_result, setGetall_Employee_Statistic_Question_List_result] = useState([]); - function Getall_Employee_Statistic_Question_List(event) { - - var form = new FormData(); - - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - form.append("related_collection", ""); - form.append("related_collection_id", ""); - form.append("class_id", selected_class_id); - - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Entity_Question_List_With_Stat_For_Given_related_collection_id/"; - - setLoading(true); - axios.post(myurl, form).then(res => { - setLoading(false); - - if (String(res.data.status) === String("true")) { - //console.log(" In Getall_Employee_Statistic_Question_List res.data.status = " + res.data.status); - //console.log(" In Getall_Employee_Statistic_Question_List res.data.message r_class = " + res.data.message); - setGetall_Employee_Statistic_Question_List_api("true"); - setGetall_Employee_Statistic_Question_List_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).question_id; - var local_question_id = JSON.parse(x).question_id; - var local_question_question = JSON.parse(x).question_question; - var local_question_type = JSON.parse(x).question_type; - - - //--- - var node = { - "_id": local_id, - "id": localid, - "question_id": local_question_id, - "label": local_question_question, - "question_question": local_question_question, - "question_type": local_question_type, - }; - new_data2.push(node); - }); - - //--- - var node = { - "_id": "", - "id": "", - "question_id": "", - "label": "", - "question_question": "", - }; - - new_data2.push(node); - - - if (new_data2.length > 0) - setNew_Getall_Employee_Statistic_Question_List_result(new_data2); - - } - else { - setGetall_Employee_Statistic_Question_List_api("false"); - setGetall_Employee_Statistic_Question_List_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_Employee_Statistic_Question_List = ', error); - setGetall_Employee_Statistic_Question_List_api("false"); - // alert(" Impossible de recuperer la liste des questions "); - setdisplay_alert_mysy("1"); - setalert_message("Impossible de recuperer la liste des questions"); - setalert_type("error"); - //setmyApimyApiMessage("") - }) - } - - const [selected_statistic_question_id, setselected_statistic_question_id] = useState(""); - const [selected_statistic_question_type, setselected_statistic_question_type] = useState(""); - - const [p_filter_date_from, setp_filter_date_from] = useState(date_today_minus_180j.toLocaleDateString('fr-FR')); - const [p_filter_date_to, setp_filter_date_to] = useState(date_today_30j.toLocaleDateString('fr-FR')); - - - const [Global_Getall_Qry_Survey_Data_result_JSON, setGlobal_Getall_Qry_Survey_Data_result_JSON] = useState([]); - - const [Getall_Qry_Survey_Data_result_JSON, setGetall_Qry_Survey_Data_result_JSON] = useState([]); - const [Getall_Qry_Survey_Data_api, setGetall_Qry_Survey_Data_api] = useState(); - const [Getall_Qry_Survey_Data_message, setGetall_Qry_Survey_Data_message] = useState(); - const [Getall_Qry_Survey_Data_result, setGetall_Qry_Survey_Data_result] = useState([]); - function Getall_Qry_Survey_Data(event) { - - var form = new FormData(); - const stored_cookie = getCookie('tokenmysypart'); - - var date_from = ""; - if (p_filter_date_from) { - date_from = p_filter_date_from; - - } - - var date_to = ""; - if (p_filter_date_to) { - date_to = p_filter_date_to; - - } - - - form.append("token", stored_cookie); - form.append("periode_start_date", date_from); - form.append("periode_end_date", date_to); - form.append("related_collection", ""); - form.append("related_collection_id", ""); - form.append("question_id", selected_statistic_question_id); - form.append("class_id", selected_class_id); - - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Survey_Stat_Data_For_Given_related_collection_id/"; - - setLoading(true); - axios.post(myurl, form).then(res => { - setLoading(false); - if (String(res.data.status) === String("true")) { - //console.log(" In Getall_Qry_Survey_Data res.data.status = " + res.data.status); - // console.log(" In Getall_Qry_Survey_Data res.data.message r_class = " + res.data.message); - - var json_data = JSON.parse(res.data.message[0]); - - //console.log(" ### json_data = ", json_data); - var jsonObj0 = json_data.data - - //console.log(" ### jsonObj0 = ", jsonObj0); - - var new_data2 = []; - const new_data = jsonObj0.map((x) => { - var month_year = (x).month_year; - var type_question = (x).type_question; - var label = (x).label; - var value = parseFloat((x).value); - var count = (x).count; - var nb_question_response = parseFloat((x).nb_question_response); - var somme_question_response = parseFloat((x).somme_question_response); - var moyenne_question_response = parseFloat((x).moyenne_question_response); - - - //--- - var node = { - "month_year": month_year, - "label": label, - "type_question": type_question, - "value": parseFloat(String(value)), - "count": count, - "nb_question_response": parseInt(String(nb_question_response)), - "somme_question_response": parseFloat(String(somme_question_response)), - "moyenne_question_response": parseFloat(String(moyenne_question_response)), - - }; - new_data2.push(node); - }); - - setGetall_Qry_Survey_Data_result_JSON(new_data2); - //setGetall_Qry_Survey_Data_result_JSON(JSON.parse('[' + res.data.message + ']')); - - //console.log(" ### new_data2 011 = ", new_data2); - - - var jsonObj0_global = json_data.global - //console.log(" ### jsonObj0_global= ", jsonObj0_global); - setGlobal_Getall_Qry_Survey_Data_result_JSON(jsonObj0_global); - - - - setGetall_Qry_Survey_Data_api("true"); - setGetall_Qry_Survey_Data_result(res.data.message); - - - } - else { - setGetall_Qry_Survey_Data_api("false"); - setGetall_Qry_Survey_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('Not good man :( Getall_Qry_Survey_Data = ', error); - setGetall_Qry_Survey_Data_api("false"); - // alert("Impossible de récuperer les données demandées"); - setdisplay_alert_mysy("1"); - setalert_message("Impossible de récuperer les données demandées"); - setalert_type("error"); - //setmyApimyApiMessage("") - }) - } - - - - const [Get_Qualiopi_Indic_Apprenant_Formation_api, setGet_Qualiopi_Indic_Apprenant_Formation_api] = useState(); - const [Get_Qualiopi_Indic_Apprenant_Formation_message, setGet_Qualiopi_Indic_Apprenant_Formation_message] = useState(); - const [Get_Qualiopi_Indic_Apprenant_Formation_result, setGet_Qualiopi_Indic_Apprenant_Formation_result] = useState([]); - function Get_Qualiopi_Indic_Apprenant_Formation(local_from_beginning) { - - var form = new FormData(); - const stored_cookie = getCookie('tokenmysypart'); - - var date_from = ""; - if (p_filter_date_from) { - date_from = p_filter_date_from; - - } - - var date_to = ""; - if (p_filter_date_to) { - date_to = p_filter_date_to; - - } - - - form.append("token", stored_cookie); - form.append("session_start_date", date_from); - form.append("session_end_date", date_to); - form.append("tab_formation_ids", selected_class_id); - form.append("from_beginning", local_from_beginning); - - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Qery_Taux_Success_For_List_Class/"; - - setLoading(true); - axios.post(myurl, form).then(res => { - setLoading(false); - if (String(res.data.status) === String("true")) { - //console.log(" In Get_Qualiopi_Indic_Apprenant_Formation res.data.status = " + res.data.status); - // console.log(" In Get_Qualiopi_Indic_Apprenant_Formation res.data.message r_class = " + res.data.message); - - var json_data = JSON.parse(res.data.message[0]); - - // console.log(" ### json_data = ", json_data); - var jsonObj0 = json_data.data - if (json_data.total_nb_inscrit) { - setqualiopi_indic_nb_apprenant(json_data.total_nb_inscrit) - } else { - setqualiopi_indic_nb_apprenant(""); - } - - if (json_data.taux_success) { - setqualiopi_indic_taux_sucess(json_data.taux_success) - } else { - setqualiopi_indic_taux_sucess(""); - } - - - //console.log(" ### jsonObj0 = ", jsonObj0); - - setGet_Qualiopi_Indic_Apprenant_Formation_api("true"); - setGet_Qualiopi_Indic_Apprenant_Formation_result(res.data.message); - - - } - else { - setGet_Qualiopi_Indic_Apprenant_Formation_api("false"); - setGet_Qualiopi_Indic_Apprenant_Formation_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_Qualiopi_Indic_Apprenant_Formation = ', error); - setGet_Qualiopi_Indic_Apprenant_Formation_api("false"); - // alert("Impossible de récuperer les données demandées"); - setdisplay_alert_mysy("1"); - setalert_message("Impossible de récuperer les données demandées"); - setalert_type("error"); - //setmyApimyApiMessage("") - }) - } - - - - const [Get_Qualiopi_Indic_Nb_Heure_api, setGet_Qualiopi_Indic_Nb_Heure_api] = useState(); - const [Get_Qualiopi_Indic_Nb_Heure_message, setGet_Qualiopi_Indic_Nb_Heure_message] = useState(); - const [Get_Qualiopi_Indic_Nb_Heure_result, setGet_Qualiopi_Indic_Nb_Heure_result] = useState([]); - function Get_Qualiopi_Indic_Nb_Heure(local_from_beginning) { - - var form = new FormData(); - const stored_cookie = getCookie('tokenmysypart'); - - var date_from = ""; - if (p_filter_date_from) { - date_from = p_filter_date_from; - - } - - var date_to = ""; - if (p_filter_date_to) { - date_to = p_filter_date_to; - - } - - - form.append("token", stored_cookie); - form.append("session_start_date", date_from); - form.append("session_end_date", date_to); - form.append("tab_formation_ids", selected_class_id); - form.append("from_beginning", local_from_beginning); - - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Qery_Session_For_List_Class/"; - - setLoading(true); - axios.post(myurl, form).then(res => { - setLoading(false); - if (String(res.data.status) === String("true")) { - //console.log(" In Get_Qualiopi_Indic_Nb_Heure res.data.status = " + res.data.status); - // console.log(" In Get_Qualiopi_Indic_Nb_Heure res.data.message r_class = " + res.data.message); - - var json_data = JSON.parse(res.data.message[0]); - - // console.log(" ### json_data = ", json_data); - var jsonObj0 = json_data.data - - if (json_data.total_nb_heure) { - setqualiopi_indic_nb_heure(json_data.total_nb_heure) - } else { - setqualiopi_indic_nb_heure("") - } - //console.log(" ### jsonObj0 = ", jsonObj0); - - setGet_Qualiopi_Indic_Nb_Heure_api("true"); - setGet_Qualiopi_Indic_Nb_Heure_result(res.data.message); - - - } - else { - setGet_Qualiopi_Indic_Nb_Heure_api("false"); - setGet_Qualiopi_Indic_Nb_Heure_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_Qualiopi_Indic_Nb_Heure = ', error); - setGet_Qualiopi_Indic_Nb_Heure_api("false"); - // alert("Impossible de récuperer les données demandées"); - setdisplay_alert_mysy("1"); - setalert_message("Impossible de récuperer les données demandées"); - setalert_type("error"); - //setmyApimyApiMessage("") - }) - } - - const [Get_Indic_Class_CA_HT_api, setGet_Indic_Class_CA_HT_api] = useState(); - const [Get_Indic_Class_CA_HT_message, setGet_Indic_Class_CA_HT_message] = useState(); - const [Get_Indic_Class_CA_HT_result, setGet_Indic_Class_CA_HT_result] = useState([]); - function Get_Indic_Class_CA_HT(local_from_beginning) { - - var form = new FormData(); - const stored_cookie = getCookie('tokenmysypart'); - - var date_from = ""; - if (p_filter_date_from) { - date_from = p_filter_date_from; - - } - - var date_to = ""; - if (p_filter_date_to) { - date_to = p_filter_date_to; - - } - - - form.append("token", stored_cookie); - form.append("periode_start_date", date_from); - form.append("periode_end_date", date_to); - form.append("tab_formation_ids", selected_class_id); - form.append("from_beginning", local_from_beginning); - - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Qery_List_Factures_For_List_Class/"; - - setLoading(true); - axios.post(myurl, form).then(res => { - setLoading(false); - if (String(res.data.status) === String("true")) { - //console.log(" In Get_Indic_Class_CA_HT res.data.status = " + res.data.status); - console.log(" In Get_Indic_Class_CA_HT res.data.message r_class = " + res.data.message); - - var json_data = JSON.parse(res.data.message[0]); - - // console.log(" ### json_data = ", json_data.data[0]); - - - if (json_data.data[0] && json_data.data[0].TotalAmount_HT) { - setindic_class_ca_ht(json_data.data[0].TotalAmount_HT) - } else { - setindic_class_ca_ht("") - } - //console.log(" ### jsonObj0 = ", jsonObj0); - - setGet_Indic_Class_CA_HT_api("true"); - setGet_Indic_Class_CA_HT_result(res.data.message); - - - } - else { - setGet_Indic_Class_CA_HT_api("false"); - setGet_Indic_Class_CA_HT_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_Indic_Class_CA_HT = ', error); - setGet_Indic_Class_CA_HT_api("false"); - // alert("Impossible de récuperer les données demandées"); - setdisplay_alert_mysy("1"); - setalert_message("Impossible de récuperer les données demandées"); - setalert_type("error"); - //setmyApimyApiMessage("") - }) - } - - - const otherSetting = { - height: 300, - yAxis: [{ label: '' }], - grid: { horizontal: true }, - sx: { - [`& .${axisClasses.left} .${axisClasses.label}`]: { - transform: 'translateX(-10px)', - }, - }, - }; - - const valueFormatter = (value) => `${value}`; - - const [display_view, setdisplay_view] = useState("bars"); - function func_display_line_view() { - setdisplay_view("line"); - } - - function func_display_bars_view() { - setdisplay_view("bars"); - } - - - - function Export_Statistic_to_Excel(local_dashbord_internal_id) { - - const stored_cookie = getCookie('tokenmysypart'); - - var date_from = ""; - if (p_filter_date_from) { - date_from = p_filter_date_from; - date_from = date_from.replaceAll('/', "-") - - } - - var date_to = ""; - if (p_filter_date_to) { - date_to = p_filter_date_to; - date_to = date_to.replaceAll('/', "-") - } - - - - - var nom_fichier_cmd_excel = "export_excel.xlsx"; - var local_related_collection = "inscription"; - //console.log(" nom_fichier_cmd = ", nom_fichier_cmd, " --- local_dashbord_internal_id = ", local_dashbord_internal_id); - - var url = process.env.REACT_APP_API_URL + "myclass/api/Export_Excel_Survey_Stat_Data_For_Given_related_collection_id/" + stored_cookie + "/" + local_related_collection + "/-/" + date_from + "/" + date_to + "/" + selected_statistic_question_id + "/" + selected_class_id + "/"; - - //console.log(" nom_fichier_cmd = ", nom_fichier_cmd, " --- selected_id = ", selected_id, " --- url =", url); - - // console.log(" #### url = ", url) - - setLoading(true); - axios.get(url, { responseType: 'blob', },) - .then((res) => { - setLoading(false); - //console.log(" In Export_Dashbord_to_CSV res.data = " + res.data); - if (String(res.data) === String("false")) { - // alert("Impossible d'exporter les données (2) "); - setdisplay_alert_mysy("1"); - setalert_message("Impossible d'exporter les données (2)"); - setalert_type("error"); - } else { - fileDownload(res.data, nom_fichier_cmd_excel) - - } - }).catch((error) => { - setLoading(false); - console.error('Error:', error); - // alert(" Impossible d'exporter les données "); - setdisplay_alert_mysy("1"); - setalert_message("Impossible d'exporter les données"); - setalert_type("error"); - - }); - - } - - const Dialog_mysy_ia_handleClose = () => { - - setDialog_mysy_ia_open(false) - - }; - - const classes = useStyles(); - - const [text_for_ia, settext_for_ia] = useState(""); - - const [fiels_of_text_replacement_ia, setfiels_of_text_replacement_ia] = useState(""); - - function function_of_text_replacement_ia(text_result) { - if (fiels_of_text_replacement_ia === "description") - setfield_description(text_result); - - else if (fiels_of_text_replacement_ia === "objectif") - setfield_objectif(text_result) - - else if (fiels_of_text_replacement_ia === "programme") - setfield_programme(text_result) - - else if (fiels_of_text_replacement_ia === "prerequis") - setfield_prerequis(text_result) - - else if (fiels_of_text_replacement_ia === "plusproduit") - setfield_plus_produit(text_result) - - else if (fiels_of_text_replacement_ia === "contenuattestation") - setfield_contenu_attestation(text_result) - - DataUpdated(); - } - - const [Dialog_mysy_ia_open, setDialog_mysy_ia_open] = React.useState(false); - - 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(""); - } - - const [Dialog_Financial_Data_open, setDialog_Financial_Data_open] = React.useState(false); - - const Dialog_Financial_Data_handleClose_buton = () => { - setDialog_Financial_Data_open(false); - setp_detail_fin_data_code(""); - setp_detail_fin_data_description(""); - setp_detail_fin_data_commentaire(""); - setp_detail_fin_data_montant(""); - setp_detail_fin_data_type_cout(""); - setadd_one_finance_data_to_class(""); - setdisplay_finance_data_to_class(""); - setedit_finance_data_to_class(""); - setselected_finance_data_id(""); - }; - - - const [qualiopi_indic_nb_apprenant, setqualiopi_indic_nb_apprenant] = React.useState(""); - const [qualiopi_indic_nb_heure, setqualiopi_indic_nb_heure] = React.useState(""); - const [qualiopi_indic_taux_sucess, setqualiopi_indic_taux_sucess] = React.useState(""); - const [indic_class_ca_ht, setindic_class_ca_ht] = React.useState(""); - - - const [selected_default_Convention_individuelle_PDF, setselected_default_Convention_individuelle_PDF] = useState(""); - - const [New_Get_List_Convention_Individuelle_PDF_result, setNew_Get_List_Convention_Individuelle_PDF_result] = useState([]); - - const [Get_List_Convention_Individuelle_PDF_api, setGet_List_Convention_Individuelle_PDF_api] = useState(); - const [Get_List_Convention_Individuelle_PDF_message, setGet_List_Convention_Individuelle_PDF_message] = useState(); - const [Get_List_Convention_Individuelle_PDF_result, setGet_List_Convention_Individuelle_PDF_result] = useState(); - function Get_List_Convention_Individuelle_PDF() { - - var form = new FormData(); - - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - form.append("type_doc", "pdf"); - form.append("courrier_template_type_document_ref_interne", "CONVENTION_STAGIAIRE_INDIVIDUELLE"); - - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Conventions_Stagiaire_With_Filter/"; - setLoading(true); - - - axios.post(myurl, form).then(res => { - //console.log(" In Get_List_Convention_Individuelle_PDF res.data.status = " + res.data.status); - //console.log(" In Get_List_Convention_Individuelle_PDF res.data.message r_class = " + res.data.message); - setLoading(false); - if (String(res.data.status) === String("true")) { - - - setGet_List_Convention_Individuelle_PDF_api("true"); - setGet_List_Convention_Individuelle_PDF_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_ref_interne = JSON.parse(x).ref_interne; - var local_nom = JSON.parse(x).nom; - var local_sujet = JSON.parse(x).sujet; - var local_type_doc = JSON.parse(x).type_doc; - var local_cible = JSON.parse(x).cible; - var local_joint_pdf = JSON.parse(x).joint_pdf; - - //--- - var node = { - "_id": local_id, - "id": localid, - "label": local_nom, - "ref_interne": local_ref_interne, - "nom": local_nom, - "sujet": local_sujet, - "type_doc": local_type_doc, - "cible": local_cible, - "joint_pdf": local_joint_pdf, - - }; - new_data2.push(node); - }); - - var node = { - "_id": "", - "id": "", - "label": "", - "ref_interne": "", - "nom": "", - "sujet": "", - "type_doc": "", - "cible": "", - "joint_pdf": "", - - }; - new_data2.push(node); - - if (new_data2.length > 0) - setNew_Get_List_Convention_Individuelle_PDF_result(new_data2); - else - setNew_Get_List_Convention_Individuelle_PDF_result([]); - - } - else { - setGet_List_Convention_Individuelle_PDF_api("false"); - setGet_List_Convention_Individuelle_PDF_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_List_Convention_Individuelle_PDF = ', error); - setGet_List_Convention_Individuelle_PDF_api("false"); - alert("Impossible de récupérer les modèles de Convention individuelles PDF"); - //setmyApimyApiMessage("") - }) - } - - const [selected_default_Convention_entreprise_PDF, setselected_default_Convention_entreprise_PDF] = useState(""); - - const [New_Get_List_Convention_Entreprise_PDF_result, setNew_Get_List_Convention_Entreprise_PDF_result] = useState([]); - - const [Get_List_Convention_Entreprise_PDF_api, setGet_List_Convention_Entreprise_PDF_api] = useState(); - const [Get_List_Convention_Entreprise_PDF_message, setGet_List_Convention_Entreprise_PDF_message] = useState(); - const [Get_List_Convention_Entreprise_PDF_result, setGet_List_Convention_Entreprise_PDF_result] = useState(); - function Get_List_Convention_Entreprise_PDF() { - - var form = new FormData(); - - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - form.append("type_doc", "pdf"); - form.append("courrier_template_type_document_ref_interne", "CONVENTION_STAGIAIRE_ENTREPRISE"); - - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Conventions_Stagiaire_With_Filter/"; - setLoading(true); - - - axios.post(myurl, form).then(res => { - //console.log(" In Get_List_Convention_Entreprise_PDF res.data.status = " + res.data.status); - //console.log(" In Get_List_Convention_Entreprise_PDF res.data.message r_class = " + res.data.message); - setLoading(false); - if (String(res.data.status) === String("true")) { - - - setGet_List_Convention_Entreprise_PDF_api("true"); - setGet_List_Convention_Entreprise_PDF_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_ref_interne = JSON.parse(x).ref_interne; - var local_nom = JSON.parse(x).nom; - var local_sujet = JSON.parse(x).sujet; - var local_type_doc = JSON.parse(x).type_doc; - var local_cible = JSON.parse(x).cible; - var local_joint_pdf = JSON.parse(x).joint_pdf; - - //--- - var node = { - "_id": local_id, - "id": localid, - "label": local_nom, - "ref_interne": local_ref_interne, - "nom": local_nom, - "sujet": local_sujet, - "type_doc": local_type_doc, - "cible": local_cible, - "joint_pdf": local_joint_pdf, - - }; - new_data2.push(node); - }); - - var node = { - "_id": "", - "id": "", - "label": "", - "ref_interne": "", - "nom": "", - "sujet": "", - "type_doc": "", - "cible": "", - "joint_pdf": "", - - }; - new_data2.push(node); - - if (new_data2.length > 0) - setNew_Get_List_Convention_Entreprise_PDF_result(new_data2); - else - setNew_Get_List_Convention_Entreprise_PDF_result([]); - - } - else { - setGet_List_Convention_Entreprise_PDF_api("false"); - setGet_List_Convention_Entreprise_PDF_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_List_Convention_Entreprise_PDF = ', error); - setGet_List_Convention_Entreprise_PDF_api("false"); - alert("Impossible de récupérer les modèles de Convention Entreprise PDF"); - //setmyApimyApiMessage("") - }) - } - - - const [selected_default_Convention_individuelle_Mail, setselected_default_Convention_individuelle_Mail] = useState(""); - - const [New_Get_List_Convention_Individuelle_Mail_result, setNew_Get_List_Convention_Individuelle_Mail_result] = useState([]); - - const [Get_List_Convention_Individuelle_Mail_api, setGet_List_Convention_Individuelle_Mail_api] = useState(); - const [Get_List_Convention_Individuelle_Mail_message, setGet_List_Convention_Individuelle_Mail_message] = useState(); - const [Get_List_Convention_Individuelle_Mail_result, setGet_List_Convention_Individuelle_Mail_result] = useState(); - function Get_List_Convention_Individuelle_Mail() { - - var form = new FormData(); - - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - form.append("type_doc", "email"); - form.append("courrier_template_type_document_ref_interne", "CONVENTION_STAGIAIRE_INDIVIDUELLE"); - - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Conventions_Stagiaire_With_Filter/"; - setLoading(true); - - - axios.post(myurl, form).then(res => { - //console.log(" In Get_List_Convention_Individuelle_Mail res.data.status = " + res.data.status); - //console.log(" In Get_List_Convention_Individuelle_Mail res.data.message r_class = " + res.data.message); - setLoading(false); - if (String(res.data.status) === String("true")) { - - - setGet_List_Convention_Individuelle_Mail_api("true"); - setGet_List_Convention_Individuelle_Mail_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_ref_interne = JSON.parse(x).ref_interne; - var local_nom = JSON.parse(x).nom; - var local_sujet = JSON.parse(x).sujet; - var local_type_doc = JSON.parse(x).type_doc; - var local_cible = JSON.parse(x).cible; - var local_joint_pdf = JSON.parse(x).joint_pdf; - - //--- - var node = { - "_id": local_id, - "id": localid, - "label": local_nom, - "ref_interne": local_ref_interne, - "nom": local_nom, - "sujet": local_sujet, - "type_doc": local_type_doc, - "cible": local_cible, - "joint_pdf": local_joint_pdf, - - }; - new_data2.push(node); - }); - - var node = { - "_id": "", - "id": "", - "label": "", - "ref_interne": "", - "nom": "", - "sujet": "", - "type_doc": "", - "cible": "", - "joint_pdf": "", - - }; - new_data2.push(node); - - if (new_data2.length > 0) - setNew_Get_List_Convention_Individuelle_Mail_result(new_data2); - else - setNew_Get_List_Convention_Individuelle_Mail_result([]); - - - } - else { - setGet_List_Convention_Individuelle_Mail_api("false"); - setGet_List_Convention_Individuelle_Mail_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_List_Convention_Individuelle_Mail = ', error); - setGet_List_Convention_Individuelle_Mail_api("false"); - alert("Impossible de récupérer les modèles de Convention individuelles mail"); - //setmyApimyApiMessage("") - }) - } - - - const [selected_default_Convention_entreprise_Mail, setselected_default_Convention_entreprise_Mail] = useState(""); - - const [New_Get_List_Convention_Entreprise_Mail_result, setNew_Get_List_Convention_Entreprise_Mail_result] = useState([]); - - const [Get_List_Convention_Entreprise_Mail_api, setGet_List_Convention_Entreprise_Mail_api] = useState(); - const [Get_List_Convention_Entreprise_Mail_message, setGet_List_Convention_Entreprise_Mail_message] = useState(); - const [Get_List_Convention_Entreprise_Mail_result, setGet_List_Convention_Entreprise_Mail_result] = useState(); - function Get_List_Convention_Entreprise_Mail() { - - var form = new FormData(); - - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - form.append("type_doc", "email"); - form.append("courrier_template_type_document_ref_interne", "CONVENTION_STAGIAIRE_ENTREPRISE"); - - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Conventions_Stagiaire_With_Filter/"; - setLoading(true); - - - axios.post(myurl, form).then(res => { - //console.log(" In Get_List_Convention_Entreprise_Mail res.data.status = " + res.data.status); - //console.log(" In Get_List_Convention_Entreprise_Mail res.data.message r_class = " + res.data.message); - setLoading(false); - if (String(res.data.status) === String("true")) { - - - setGet_List_Convention_Entreprise_Mail_api("true"); - setGet_List_Convention_Entreprise_Mail_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_ref_interne = JSON.parse(x).ref_interne; - var local_nom = JSON.parse(x).nom; - var local_sujet = JSON.parse(x).sujet; - var local_type_doc = JSON.parse(x).type_doc; - var local_cible = JSON.parse(x).cible; - var local_joint_pdf = JSON.parse(x).joint_pdf; - - //--- - var node = { - "_id": local_id, - "id": localid, - "label": local_nom, - "ref_interne": local_ref_interne, - "nom": local_nom, - "sujet": local_sujet, - "type_doc": local_type_doc, - "cible": local_cible, - "joint_pdf": local_joint_pdf, - - }; - new_data2.push(node); - }); - - var node = { - "_id": "", - "id": "", - "label": "", - "ref_interne": "", - "nom": "", - "sujet": "", - "type_doc": "", - "cible": "", - "joint_pdf": "", - - }; - new_data2.push(node); - - if (new_data2.length > 0) - setNew_Get_List_Convention_Entreprise_Mail_result(new_data2); - else - setNew_Get_List_Convention_Entreprise_Mail_result([]); - - - } - else { - setGet_List_Convention_Entreprise_Mail_api("false"); - setGet_List_Convention_Entreprise_Mail_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_List_Convention_Entreprise_Mail = ', error); - setGet_List_Convention_Entreprise_Mail_api("false"); - alert("Impossible de récupérer les modèles de Convention entreprise mail"); - //setmyApimyApiMessage("") - }) - } - - const [selected_default_Stagiaire_Convocations_Mail, setselected_default_Stagiaire_Convocations_Mail] = useState(""); - - const [New_Get_List_Stagiaire_Convocations_Mail_result, setNew_Get_List_Stagiaire_Convocations_Mail_result] = useState([]); - - const [Get_List_Stagiaire_Convocations_Mail_api, setGet_List_Stagiaire_Convocations_Mail_api] = useState(); - const [Get_List_Stagiaire_Convocations_Mail_message, setGet_List_Stagiaire_Convocations_Mail_message] = useState(); - const [Get_List_Stagiaire_Convocations_Mail_result, setGet_List_Stagiaire_Convocations_Mail_result] = useState(); - function Get_List_Stagiaire_Convocations_Mail() { - - var form = new FormData(); - - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - form.append("type_doc", "email"); - - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Convocations_Stagiaire_With_Filter/"; - setLoading(true); - - - axios.post(myurl, form).then(res => { - //console.log(" In Get_List_Stagiaire_Convocations_Mail res.data.status = " + res.data.status); - //console.log(" In Get_List_Stagiaire_Convocations_Mail res.data.message r_class = " + res.data.message); - setLoading(false); - if (String(res.data.status) === String("true")) { - - - setGet_List_Stagiaire_Convocations_Mail_api("true"); - setGet_List_Stagiaire_Convocations_Mail_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_ref_interne = JSON.parse(x).ref_interne; - var local_nom = JSON.parse(x).nom; - var local_sujet = JSON.parse(x).sujet; - var local_type_doc = JSON.parse(x).type_doc; - var local_cible = JSON.parse(x).cible; - var local_joint_pdf = JSON.parse(x).joint_pdf; - - //--- - var node = { - "_id": local_id, - "id": localid, - "label": local_nom, - "ref_interne": local_ref_interne, - "nom": local_nom, - "sujet": local_sujet, - "type_doc": local_type_doc, - "cible": local_cible, - "joint_pdf": local_joint_pdf, - - }; - new_data2.push(node); - }); - - var node = { - "_id": "", - "id": "", - "label": "", - "ref_interne": "", - "nom": "", - "sujet": "", - "type_doc": "", - "cible": "", - "joint_pdf": "", - - }; - new_data2.push(node); - - if (new_data2.length > 0) - setNew_Get_List_Stagiaire_Convocations_Mail_result(new_data2); - else - setNew_Get_List_Stagiaire_Convocations_Mail_result([]); - - - } - else { - setGet_List_Stagiaire_Convocations_Mail_api("false"); - setGet_List_Stagiaire_Convocations_Mail_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_List_Stagiaire_Convocations_Mail = ', error); - setGet_List_Stagiaire_Convocations_Mail_api("false"); - alert("Impossible de récupérer les modèles de convocations"); - //setmyApimyApiMessage("") - }) - } - - - - - const [selected_default_attestation_PDF, setselected_default_attestation_PDF] = useState(""); - - const [New_Get_List_Attestation_PDF_result, setNew_Get_List_Attestation_PDF_result] = useState([]); - - const [Get_List_Attestation_PDF_api, setGet_List_Attestation_PDF_api] = useState(); - const [Get_List_Attestation_PDF_message, setGet_List_Attestation_PDF_message] = useState(); - const [Get_List_Attestation_PDF_result, setGet_List_Attestation_PDF_result] = useState(); - function Get_List_Attestation_PDF() { - - var form = new FormData(); - - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - form.append("type_doc", "pdf"); - form.append("courrier_template_type_document_ref_interne", "ATTESTATION_FORMATION"); - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Modele_Attestion_Formation_With_Filter/"; - setLoading(true); - - - axios.post(myurl, form).then(res => { - //console.log(" In Get_List_Attestation_PDF res.data.status = " + res.data.status); - //console.log(" In Get_List_Attestation_PDF res.data.message r_class = " + res.data.message); - setLoading(false); - if (String(res.data.status) === String("true")) { - - - setGet_List_Attestation_PDF_api("true"); - setGet_List_Attestation_PDF_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_ref_interne = JSON.parse(x).ref_interne; - var local_nom = JSON.parse(x).nom; - var local_sujet = JSON.parse(x).sujet; - var local_type_doc = JSON.parse(x).type_doc; - var local_cible = JSON.parse(x).cible; - var local_joint_pdf = JSON.parse(x).joint_pdf; - - - - //--- - var node = { - "_id": local_id, - "id": localid, - "label": local_nom, - "ref_interne": local_ref_interne, - "nom": local_nom, - "sujet": local_sujet, - "type_doc": local_type_doc, - "cible": local_cible, - "joint_pdf": local_joint_pdf, - - }; - new_data2.push(node); - }); - - var node = { - "_id": "", - "id": "", - "label": "", - "ref_interne": "", - "nom": "", - "sujet": "", - "type_doc": "", - "cible": "", - "joint_pdf": "", - - }; - new_data2.push(node); - - if (new_data2.length > 0) - setNew_Get_List_Attestation_PDF_result(new_data2); - else - setNew_Get_List_Attestation_PDF_result([]) - - } - else { - setGet_List_Attestation_PDF_api("false"); - setGet_List_Attestation_PDF_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_List_Attestation_PDF = ', error); - setGet_List_Attestation_PDF_api("false"); - alert("Impossible de récupérer les modèles d'attestation PDF"); - //setmyApimyApiMessage("") - }) - } - - - const [selected_default_attestation_Email, setselected_default_attestation_Email] = useState(""); - - const [New_Get_List_Attestation_Email_result, setNew_Get_List_Attestation_Email_result] = useState([]); - - const [Get_List_Attestation_Email_api, setGet_List_Attestation_Email_api] = useState(); - const [Get_List_Attestation_Email_message, setGet_List_Attestation_Email_message] = useState(); - const [Get_List_Attestation_Email_result, setGet_List_Attestation_Email_result] = useState(); - function Get_List_Attestation_Email() { - - var form = new FormData(); - - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - form.append("type_doc", "email"); - form.append("courrier_template_type_document_ref_interne", "ATTESTATION_FORMATION"); - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Modele_Attestion_Formation_With_Filter/"; - setLoading(true); - - - axios.post(myurl, form).then(res => { - //console.log(" In Get_List_Attestation_Email res.data.status = " + res.data.status); - //console.log(" In Get_List_Attestation_Email res.data.message r_class = " + res.data.message); - setLoading(false); - if (String(res.data.status) === String("true")) { - - - setGet_List_Attestation_Email_api("true"); - setGet_List_Attestation_Email_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_ref_interne = JSON.parse(x).ref_interne; - var local_nom = JSON.parse(x).nom; - var local_sujet = JSON.parse(x).sujet; - var local_type_doc = JSON.parse(x).type_doc; - var local_cible = JSON.parse(x).cible; - var local_joint_pdf = JSON.parse(x).joint_pdf; - - - - //--- - var node = { - "_id": local_id, - "id": localid, - "label": local_nom, - "ref_interne": local_ref_interne, - "nom": local_nom, - "sujet": local_sujet, - "type_doc": local_type_doc, - "cible": local_cible, - "joint_pdf": local_joint_pdf, - - }; - new_data2.push(node); - }); - - var node = { - "_id": "", - "id": "", - "label": "", - "ref_interne": "", - "nom": "", - "sujet": "", - "type_doc": "", - "cible": "", - "joint_pdf": "", - - }; - new_data2.push(node); - - if (new_data2.length > 0) - setNew_Get_List_Attestation_Email_result(new_data2); - else - setNew_Get_List_Attestation_Email_result([]) - - } - else { - setGet_List_Attestation_Email_api("false"); - setGet_List_Attestation_Email_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_List_Attestation_Email = ', error); - setGet_List_Attestation_Email_api("false"); - alert("Impossible de récupérer les modèles d'attestation Email"); - //setmyApimyApiMessage("") - }) - } - - - - const [selected_default_Stagiaire_Convocations_PDF, setselected_default_Stagiaire_Convocations_PDF] = useState(""); - - const [New_Get_List_Stagiaire_Convocations_PDF_result, setNew_Get_List_Stagiaire_Convocations_PDF_result] = useState([]); - - const [Get_List_Stagiaire_Convocations_PDF_api, setGet_List_Stagiaire_Convocations_PDF_api] = useState(); - const [Get_List_Stagiaire_Convocations_PDF_message, setGet_List_Stagiaire_Convocations_PDF_message] = useState(); - const [Get_List_Stagiaire_Convocations_PDF_result, setGet_List_Stagiaire_Convocations_PDF_result] = useState(); - function Get_List_Stagiaire_Convocations_PDF() { - - var form = new FormData(); - - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - form.append("type_doc", "pdf"); - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Convocations_Stagiaire_With_Filter/"; - setLoading(true); - - - axios.post(myurl, form).then(res => { - //console.log(" In Get_List_Stagiaire_Convocations_PDF res.data.status = " + res.data.status); - //console.log(" In Get_List_Stagiaire_Convocations_PDF res.data.message r_class = " + res.data.message); - setLoading(false); - if (String(res.data.status) === String("true")) { - - - setGet_List_Stagiaire_Convocations_PDF_api("true"); - setGet_List_Stagiaire_Convocations_PDF_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_ref_interne = JSON.parse(x).ref_interne; - var local_nom = JSON.parse(x).nom; - var local_sujet = JSON.parse(x).sujet; - var local_type_doc = JSON.parse(x).type_doc; - var local_cible = JSON.parse(x).cible; - var local_joint_pdf = JSON.parse(x).joint_pdf; - - - - //--- - var node = { - "_id": local_id, - "id": localid, - "label": local_nom, - "ref_interne": local_ref_interne, - "nom": local_nom, - "sujet": local_sujet, - "type_doc": local_type_doc, - "cible": local_cible, - "joint_pdf": local_joint_pdf, - - }; - new_data2.push(node); - }); - - var node = { - "_id": "", - "id": "", - "label": "", - "ref_interne": "", - "nom": "", - "sujet": "", - "type_doc": "", - "cible": "", - "joint_pdf": "", - - }; - new_data2.push(node); - - if (new_data2.length > 0) - setNew_Get_List_Stagiaire_Convocations_PDF_result(new_data2); - else - setNew_Get_List_Stagiaire_Convocations_PDF_result([]) - - } - else { - setGet_List_Stagiaire_Convocations_PDF_api("false"); - setGet_List_Stagiaire_Convocations_PDF_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_List_Stagiaire_Convocations_PDF = ', error); - setGet_List_Stagiaire_Convocations_PDF_api("false"); - alert("Impossible de récupérer les modèles de convocations PDF"); - //setmyApimyApiMessage("") - }) - } - - const [selected_default_Formulaires_Eval_Formateur, setselected_default_Formulaires_Eval_Formateur] = useState(""); - - const [New_Getall_Partner_Formulaires_Eval_Formateur, setNew_Getall_Partner_Formulaires_Eval_Formateur] = useState([]); - - const [Getall_Partner_Formulaires_Eval_Formateur_api, setGetall_Partner_Formulaires_Eval_Formateur_api] = useState(); - const [Getall_Partner_Formulaires_Eval_Formateur_message, setGetall_Partner_Formulaires_Eval_Formateur_message] = useState(); - const [Getall_Partner_Formulaires_Eval_Formateur_result, setGetall_Partner_Formulaires_Eval_Formateur_result] = useState([]); - function Getall_Partner_Formulaires_Eval_Formateur(event) { - - var form = new FormData(); - - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - form.append("type", "human_eval"); - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Formulaire_with_filter/"; - - setLoading(true); - axios.post(myurl, form).then(res => { - setLoading(false); - - if (String(res.data.status) === String("true")) { - //console.log(" In Getall_Partner_Formulaires_Eval_Formateur res.data.status = " + res.data.status); - //console.log(" In Getall_Partner_Formulaires_Eval_Formateur res.data.message r_class = " + res.data.message); - setGetall_Partner_Formulaires_Eval_Formateur_api("true"); - setGetall_Partner_Formulaires_Eval_Formateur_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_nom = JSON.parse(x).nom; - - - //--- - var node = { - "_id": local_id, - "id": localid, - "label": local_code + " " + local_nom, - "nom": local_nom, - "code": local_code, - }; - new_data2.push(node); - }); - - var node = { - "_id": "", - "id": "", - "label": "", - "nom": "", - "code": "", - - }; - new_data2.push(node); - - if (new_data2.length > 0) - setNew_Getall_Partner_Formulaires_Eval_Formateur(new_data2); - } - else { - setGetall_Partner_Formulaires_Eval_Formateur_api("false"); - setGetall_Partner_Formulaires_Eval_Formateur_message(res.data.message); - } - - }).catch((error) => { - setLoading(false); - console.warn('Not good man :( Getall_Partner_Formulaires_Eval_Formateur = ', error); - setGetall_Partner_Formulaires_Eval_Formateur_api("false"); - //setmyApimyApiMessage("") - }) - } - - - const [selected_default_Formulaires_Eval_Chaud, setselected_default_Formulaires_Eval_Chaud] = useState(""); - - const [New_Getall_Partner_Formulaires_Eval_Chaud, setNew_Getall_Partner_Formulaires_Eval_Chaud] = useState([]); - - const [Getall_Partner_Formulaires_Eval_Chaud_api, setGetall_Partner_Formulaires_Eval_Chaud_api] = useState(); - const [Getall_Partner_Formulaires_Eval_Chaud_message, setGetall_Partner_Formulaires_Eval_Chaud_message] = useState(); - const [Getall_Partner_Formulaires_Eval_Chaud_result, setGetall_Partner_Formulaires_Eval_Chaud_result] = useState([]); - function Getall_Partner_Formulaires_Eval_Chaud(event) { - - var form = new FormData(); - - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - form.append("type", "hot_eval"); - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Formulaire_with_filter/"; - - setLoading(true); - axios.post(myurl, form).then(res => { - setLoading(false); - - if (String(res.data.status) === String("true")) { - //console.log(" In Getall_Partner_Formulaires_Eval_Chaud res.data.status = " + res.data.status); - //console.log(" In Getall_Partner_Formulaires_Eval_Chaud res.data.message r_class = " + res.data.message); - setGetall_Partner_Formulaires_Eval_Chaud_api("true"); - setGetall_Partner_Formulaires_Eval_Chaud_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_nom = JSON.parse(x).nom; - - - //--- - var node = { - "_id": local_id, - "id": localid, - "label": local_code + " " + local_nom, - "nom": local_nom, - "code": local_code, - }; - new_data2.push(node); - }); - - var node = { - "_id": "", - "id": "", - "label": "", - "nom": "", - "code": "", - - }; - new_data2.push(node); - - if (new_data2.length > 0) - setNew_Getall_Partner_Formulaires_Eval_Chaud(new_data2); - } - else { - setGetall_Partner_Formulaires_Eval_Chaud_api("false"); - setGetall_Partner_Formulaires_Eval_Chaud_message(res.data.message); - } - - }).catch((error) => { - setLoading(false); - console.warn('Not good man :( Getall_Partner_Formulaires_Eval_chaud = ', error); - setGetall_Partner_Formulaires_Eval_Chaud_api("false"); - //setmyApimyApiMessage("") - }) - } - - const [selected_default_Formulaires_Eval_Froid, setselected_default_Formulaires_Eval_Froid] = useState(""); - - const [New_Getall_Partner_Formulaires_Eval_Froid, setNew_Getall_Partner_Formulaires_Eval_Froid] = useState([]); - - const [Getall_Partner_Formulaires_Eval_Froid_api, setGetall_Partner_Formulaires_Eval_Froid_api] = useState(); - const [Getall_Partner_Formulaires_Eval_Froid_message, setGetall_Partner_Formulaires_Eval_Froid_message] = useState(); - const [Getall_Partner_Formulaires_Eval_Froid_result, setGetall_Partner_Formulaires_Eval_Froid_result] = useState([]); - function Getall_Partner_Formulaires_Eval_Froid(event) { - - var form = new FormData(); - - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - form.append("type", "cold_eval"); - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Formulaire_with_filter/"; - - setLoading(true); - axios.post(myurl, form).then(res => { - setLoading(false); - - if (String(res.data.status) === String("true")) { - //console.log(" In Getall_Partner_Formulaires_Eval_Froid res.data.status = " + res.data.status); - //console.log(" In Getall_Partner_Formulaires_Eval_Froid res.data.message r_class = " + res.data.message); - setGetall_Partner_Formulaires_Eval_Froid_api("true"); - setGetall_Partner_Formulaires_Eval_Froid_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_nom = JSON.parse(x).nom; - - - //--- - var node = { - "_id": local_id, - "id": localid, - "label": local_code + " " + local_nom, - "nom": local_nom, - "code": local_code, - }; - new_data2.push(node); - }); - - var node = { - "_id": "", - "id": "", - "label": "", - "nom": "", - "code": "", - - }; - new_data2.push(node); - - if (new_data2.length > 0) - setNew_Getall_Partner_Formulaires_Eval_Froid(new_data2); - } - else { - setGetall_Partner_Formulaires_Eval_Froid_api("false"); - setGetall_Partner_Formulaires_Eval_Froid_message(res.data.message); - } - - }).catch((error) => { - setLoading(false); - console.warn('Not good man :( Getall_Partner_Formulaires_Eval_Froid = ', error); - setGetall_Partner_Formulaires_Eval_Froid_api("false"); - //setmyApimyApiMessage("") - }) - } - - - const [selected_default_Formulaires_Q_Position, setselected_default_Formulaires_Q_Position] = useState(""); - - const [New_Getall_Partner_Formulaires_Q_Position, setNew_Getall_Partner_Formulaires_Q_Position] = useState([]); - - const [Getall_Partner_Formulaires_Q_Position_api, setGetall_Partner_Formulaires_Q_Position_api] = useState(); - const [Getall_Partner_Formulaires_Q_Position_message, setGetall_Partner_Formulaires_Q_Position_message] = useState(); - const [Getall_Partner_Formulaires_Q_Position_result, setGetall_Partner_Formulaires_Q_Position_result] = useState([]); - function Getall_Partner_Formulaires_Q_Position(event) { - - var form = new FormData(); - - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - form.append("type", "pos"); - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Formulaire_with_filter/"; - - setLoading(true); - axios.post(myurl, form).then(res => { - setLoading(false); - - if (String(res.data.status) === String("true")) { - //console.log(" In Getall_Partner_Formulaires_Q_Position res.data.status = " + res.data.status); - //console.log(" In Getall_Partner_Formulaires_Q_Position res.data.message r_class = " + res.data.message); - setGetall_Partner_Formulaires_Q_Position_api("true"); - setGetall_Partner_Formulaires_Q_Position_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_nom = JSON.parse(x).nom; - - - //--- - var node = { - "_id": local_id, - "id": localid, - "label": local_code + " " + local_nom, - "nom": local_nom, - "code": local_code, - }; - new_data2.push(node); - }); - - var node = { - "_id": "", - "id": "", - "label": "", - "nom": "", - "code": "", - - }; - new_data2.push(node); - - if (new_data2.length > 0) - setNew_Getall_Partner_Formulaires_Q_Position(new_data2); - } - else { - setGetall_Partner_Formulaires_Q_Position_api("false"); - setGetall_Partner_Formulaires_Q_Position_message(res.data.message); - } - - }).catch((error) => { - setLoading(false); - console.warn('Not good man :( Getall_Partner_Formulaires_Q_Position = ', error); - setGetall_Partner_Formulaires_Q_Position_api("false"); - //setmyApimyApiMessage("") - }) - } - - - - const [Update_Class_Default_Document_api, setUpdate_Class_Default_Document_api] = useState(); - const [Update_Class_Default_Document_message, setUpdate_Class_Default_Document_message] = useState(); - const [Update_Class_Default_Document_result, setUpdate_Class_Default_Document_result] = useState(); - function Update_Class_Default_Document() { - setLoading(true); - var form = new FormData(); - //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); - const stored_cookie = getCookie('tokenmysypart'); - - form.append("token", stored_cookie); - - form.append("class_id", selected_class_id); - // form.append("to", p_one_internal_email_to); - form.append("EVAL_FORMATION_HOT", selected_default_Formulaires_Eval_Chaud); - form.append("EVAL_FORMATION_COLD", selected_default_Formulaires_Eval_Froid); - form.append("EVAL_FORMATION_FORMATEUR", selected_default_Formulaires_Eval_Formateur); - - form.append("QUESTION_POSITIONNEMENT", selected_default_Formulaires_Q_Position); - - form.append("CONVOCATION_STAGIAIRE_MAIL", selected_default_Stagiaire_Convocations_Mail); - form.append("CONVOCATION_STAGIAIRE_PDF", selected_default_Stagiaire_Convocations_PDF); - - form.append("CONVENTION_STAGIAIRE_INDIVIDUELLE_MAIL", selected_default_Convention_individuelle_Mail); - form.append("CONVENTION_STAGIAIRE_INDIVIDUELLE_PDF", selected_default_Convention_individuelle_PDF); - - form.append("CONVENTION_STAGIAIRE_ENTREPRISE_MAIL", selected_default_Convention_entreprise_Mail); - form.append("CONVENTION_STAGIAIRE_ENTREPRISE_PDF", selected_default_Convention_entreprise_PDF); - - form.append("ATTESTATION_FORMATION_MAIL", selected_default_attestation_Email); - form.append("ATTESTATION_FORMATION_PDF", selected_default_attestation_PDF); - - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Update_Class_Default_Document/"; - - axios.post(myurl, form).then(res => { - setLoading(false); - // console.log(" In Update_Class_Default_Document res.data.status = " + res.data.status); - // console.log(" In Update_Class_Default_Document res.data.message r_class = " + res.data.message); - - if (String(res.data.status) === String("true")) { - - setdisplay_alert_mysy("1"); - setalert_message(res.data.message); - setalert_type("success"); - - setdefault_doc_modification("0"); - - setUpdate_Class_Default_Document_api("true"); - setUpdate_Class_Default_Document_result(res.data.message); - - } - else { - setUpdate_Class_Default_Document_api("false"); - setUpdate_Class_Default_Document_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_Class_Default_Document : Not good man :( mysearchtext = ' + error); - setUpdate_Class_Default_Document_api("false"); - // alert(" Impossible d'ajouter l'évaluation l'UE "); - setdisplay_alert_mysy("1"); - setalert_message("Impossible de mettre à jour les documents par défaut"); - setalert_type("error"); - - }) - } - - const [Get_Given_Class_Default_Documents_api, setGet_Given_Class_Default_Documents_api] = useState(); - const [Get_Given_Class_Default_Documents_message, setGet_Given_Class_Default_Documents_message] = useState(); - const [Get_Given_Class_Default_Documents_result, setGet_Given_Class_Default_Documents_result] = useState(); - function Get_Given_Class_Default_Documents() { - - var form = new FormData(); - //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); - const stored_cookie = getCookie('tokenmysypart'); - form.append("token", stored_cookie); - form.append("class_id", selected_class_id); - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Given_Class_List_Default_Documents/"; - - setLoading(true); - axios.post(myurl, form).then(res => { - - if (String(res.data.status) === "true") { - //console.log(" In Get_Given_Class_Default_Documents res.data.status = " + res.data.status); - //console.log(" In Get_Given_Class_Default_Documents res.data.message r_class = " + res.data.message); - //console.log(" In Get_Given_Class_Default_Documents res.data.message len = " + String(res.data.message).length); - - setLoading(false); - setGet_Given_Class_Default_Documents_api("true"); - setdefault_doc_modification("0"); - - if (String(res.data.message).length > 0) { - setGet_Given_Class_Default_Documents_result(res.data.message); - - const new_data = res.data.message.map((x) => { - var mylocaltraining = JSON.parse(x); - - if (mylocaltraining.CONVOCATION_STAGIAIRE_MAIL) { - setselected_default_Stagiaire_Convocations_Mail(mylocaltraining.CONVOCATION_STAGIAIRE_MAIL); - } - - if (mylocaltraining.CONVOCATION_STAGIAIRE_PDF) { - setselected_default_Stagiaire_Convocations_PDF(mylocaltraining.CONVOCATION_STAGIAIRE_PDF); - } - - if (mylocaltraining.QUESTION_POSITIONNEMENT) { - setselected_default_Formulaires_Q_Position(mylocaltraining.QUESTION_POSITIONNEMENT); - } - - if (mylocaltraining.CONVENTION_STAGIAIRE_INDIVIDUELLE_MAIL) { - setselected_default_Convention_individuelle_Mail(mylocaltraining.CONVENTION_STAGIAIRE_INDIVIDUELLE_MAIL); - } - - if (mylocaltraining.CONVENTION_STAGIAIRE_INDIVIDUELLE_PDF) { - setselected_default_Convention_individuelle_PDF(mylocaltraining.CONVENTION_STAGIAIRE_INDIVIDUELLE_PDF); - } - - if (mylocaltraining.CONVENTION_STAGIAIRE_ENTREPRISE_MAIL) { - setselected_default_Convention_entreprise_Mail(mylocaltraining.CONVENTION_STAGIAIRE_ENTREPRISE_MAIL); - } - - if (mylocaltraining.CONVENTION_STAGIAIRE_ENTREPRISE_PDF) { - setselected_default_Convention_entreprise_PDF(mylocaltraining.CONVENTION_STAGIAIRE_ENTREPRISE_PDF); - } - - if (mylocaltraining.EVAL_FORMATION_HOT) { - setselected_default_Formulaires_Eval_Chaud(mylocaltraining.EVAL_FORMATION_HOT); - } - - if (mylocaltraining.EVAL_FORMATION_COLD) { - setselected_default_Formulaires_Eval_Froid(mylocaltraining.EVAL_FORMATION_COLD); - } - - if (mylocaltraining.EVAL_FORMATION_FORMATEUR) { - setselected_default_Formulaires_Eval_Formateur(mylocaltraining.EVAL_FORMATION_FORMATEUR); - } - - if (mylocaltraining.ATTESTATION_FORMATION_PDF) { - console.log(" ### eeee = ", mylocaltraining.ATTESTATION_FORMATION_PDF) - setselected_default_attestation_PDF(mylocaltraining.ATTESTATION_FORMATION_PDF); - } - - if (mylocaltraining.ATTESTATION_FORMATION_MAIL) { - console.log(" ### iii = ", mylocaltraining.ATTESTATION_FORMATION_MAIL) - setselected_default_attestation_Email(mylocaltraining.ATTESTATION_FORMATION_MAIL); - } - - - }); - - } - - } else if (String(res.data.status) === String("Err_Connexion")) { - setLoading(false); - alert('Erreur: ' + res.data.message); - history.push("/Connexion"); - } - - else { - setLoading(false); - setGet_Given_Class_Default_Documents_api("false"); - setGet_Given_Class_Default_Documents_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_Given_Class_Default_Documents = ', error); - setGet_Given_Class_Default_Documents_api("false"); - alert(" Impossible de récuperer les documents par défaut "); - - }) - } - - - - return ( -
- {isLoading &&
-
-
} - - {/*** Affichage des messages d'alerte*/} - {display_alert_mysy && String(display_alert_mysy) === "1" && - - } - {/*** FIN Affichage des messages d'alerte*/} - - - {/* Dialog pour gerer les Financial_Data */} - null} - - PaperProps={{ - - - className: classes.paper, // Apply the paper style - style: { - overflowY: 'unset', - position: 'absolute', - top: '5rem', - margin: "2px", - }, - }} - hideBackdrop={true} - disableScrollLock - classes={{ - paper: classes.dialog - }} - - PaperComponent={PaperComponent} - aria-labelledby="draggable-dialog-title" - > - - MySy Information - - - {Dialog_1_message} - - - -
Code - { - setp_detail_fin_data_code(e.target.value); - }} - - /> - -
- -
Description - { - setp_detail_fin_data_description(e.target.value); - }} - - /> - -
- -
Montant - { - setp_detail_fin_data_montant(e.target.value); - }} - - /> - -
- - -
Type coût
- (data).id === String(p_detail_fin_data_type_cout))[0].label} - - fullWidth - - options={New_Option_Type_Cout} - onChange={(event, value) => { - if (value && value.value) { - setp_detail_fin_data_type_cout(value.value); - } else { - setp_detail_fin_data_type_cout(""); - } - }} - renderInput={(params) => - } - /> - - -
- - -
Inclus calcul - { - setp_detail_fin_data_inclus_calcul(e.target.checked); - }} - - /> - - -
- - -
Commentaire - { - setp_detail_fin_data_commentaire(e.target.value); - - }} - - /> - -
- -
- - - - - - - -
- {selected_finance_data_id && String(selected_finance_data_id).length < 5 &&
- - -
} - - {(!selected_finance_data_id || String(selected_finance_data_id).length > 5) &&
- - -
} - - - -
- -
-
- -
- -
- {/* FIN Dialog pour gerer les Financial_Data */} - - - - {/*** GESTION IA */} - null} - - PaperProps={{ - - className: classes.paper, // Apply the paper style - style: { - overflowY: 'unset', - position: 'absolute', - top: '5rem', - margin: "2px", - }, - }} - hideBackdrop={true} - disableScrollLock - classes={{ - paper: classes.dialog - }} - - PaperComponent={PaperComponent} - aria-labelledby="draggable-dialog-title" - - > -   - - - - - - - - - - - - - - - - - - - {/*** FIN GESTION IA */} - - - {/* Dialog pour gerer les Unite_Enseignement */} - null} - - PaperProps={{ - - - className: classes.paper, // Apply the paper style - style: { - overflowY: 'unset', - position: 'absolute', - top: '5rem', - margin: "2px", - }, - }} - hideBackdrop={true} - disableScrollLock - classes={{ - paper: classes.dialog - }} - - PaperComponent={PaperComponent} - aria-labelledby="draggable-dialog-title" - > - - MySy Information - - - {Dialog_1_message} - - - - - {add_one_eu_to_class && String(add_one_eu_to_class) === "1" &&
Choisir une unité d'enseignement - {New_Getall_Partner_List_UE_result && New_Getall_Partner_List_UE_result.length > 0 && - (data)._id === String(selected_ue_id))[0].label} - onChange={(event, value) => { - if (value && value._id) { - - setselected_ue_id(value._id); - setselected_ue_credit_ects(value.ects); - setselected_ue_seuil_validation(value.seuil_validation); - } else { - setselected_ue_id(""); - } - }} - - renderInput={(params) => - } - />} - -
} - - - - {add_one_eu_to_class && String(add_one_eu_to_class) !== "1" && - New_Getall_Partner_List_UE_result && New_Getall_Partner_List_UE_result.length > 0 && - selected_ue_id &&
Unité d'enseignement - (data)._id === String(selected_ue_id))[0].label} - - /> - -
- - - } -
Crédits - { - setselected_ue_credit_ects(e.target.value); - } - } - - /> - -
- -
Coefficient - { - setselected_ue_coefficient(e.target.value); - } - } - - /> - -
- -
Seuil validation - { - setselected_ue_seuil_validation(e.target.value); - } - } - - /> - -
- - -
Est Evalué
- - (data).id === String(selected_ue_is_noted))[0].label} - - fullWidth - - options={New_Option_Is_Noted} - onChange={(event, value) => { - if (value && value.value) { - setselected_ue_is_noted(value.value); - } else { - setselected_ue_is_noted(""); - } - }} - renderInput={(params) => } - /> - - -
- - - -
Mode d'animation
- (data).id === String(selected_ue_pres_dist_hyp))[0].label} - - fullWidth - - options={New_Option_pres_dist_hyp} - onChange={(event, value) => { - if (value && value.value) { - setselected_ue_pres_dist_hyp(value.value); - } else { - setselected_ue_pres_dist_hyp(""); - } - }} - renderInput={(params) => - } - /> - - -
- -
- - - - - - - -
-
- - - -
- - - -
- -
-
- -
- -
- {/* FIN Dialog pour gerer les Unite_Enseignement */} - - - - {/* Dialog pour gerer une EVALUATION à une Unite_Enseignement */} - null} - - PaperProps={{ - - - className: classes.paper, // Apply the paper style - style: { - overflowY: 'unset', - position: 'absolute', - top: '5rem', - margin: "2px", - }, - }} - hideBackdrop={true} - disableScrollLock - classes={{ - paper: classes.dialog - }} - - PaperComponent={PaperComponent} - aria-labelledby="draggable-dialog-title" - > - - MySy Information - - - {Dialog_1_message} - - - {add_ue_evalution && String(add_ue_evalution) === "1" &&
Choisir une unité d'enseignement - {New_Getall_Class_List_UE_result && New_Getall_Class_List_UE_result.length > 0 && - (data)._id === String(selected_ue_id))[0].label} - onChange={(event, value) => { - if (value && value._id) { - - setselected_ue_id(value._id); - - } else { - setselected_ue_id(""); - } - }} - - renderInput={(params) => - } - />} - -
} - - {add_ue_evalution && String(add_ue_evalution) !== "1" && New_Getall_Class_List_UE_result && - New_Getall_Class_List_UE_result.length > 0 &&
Unité d'enseignement - (data)._id === String(selected_ue_id))[0].label} - - /> - - -
} - - - - {add_ue_evalution && String(add_ue_evalution) === "1" &&
Choisir un type d'évaluation - {New_Getall_Partner_Type_Evalution_List_result && New_Getall_Partner_Type_Evalution_List_result.length > 0 && - (data)._id === String(selected_ue_id))[0].label} - onChange={(event, value) => { - if (value && value._id) { - - setselected_eu_evalution_id(value._id); - - } else { - setselected_eu_evalution_id(""); - } - }} - - renderInput={(params) => - } - />} - -
} - - - {add_ue_evalution && String(add_ue_evalution) !== "1" && New_Getall_Partner_Type_Evalution_List_result && - New_Getall_Partner_Type_Evalution_List_result.length > 0 && selected_eu_evalution_id &&
Type d'évaluation - - (data)._id === String(selected_eu_evalution_id))[0].label} - - /> -
} - -
Ponderation Type Eval - { - setp_detail_ponderation_type_eval(e.target.value); - } - } - /> -
- - - -
Max Note - { - setp_detail_max_note(e.target.value); - } - } - - /> - -
- - -
- - - - - - -
-
- - - {String(add_ue_evalution) !== "1" && - - } - - {String(add_ue_evalution) === "1" && - - } - - - - -
- - - -
- -
-
- -
- -
- {/* FIN Dialog pour gerer une EVALUATION à une Unite_Enseignement */} - - - - - {String(props.mytrainingclass.ref).trim() !== "" &&
- -
- - -
-
} - {String(props.mytrainingclass.ref).trim() !== "" && p_detail_title &&
- -
} - -
- - -
- - - {props.formation_initiale && String(props.formation_initiale) === "1" && -
- - - - - - - {String(props.mytrainingclass.ref).trim() !== "" && - } - - - - - {String(history_securite_read) === "1" && } - - - {String(props.mytrainingclass.ref).trim() !== "" && - } - - - -
} - - {String(props.formation_initiale) !== "1" && -
- - - {String(props.mytrainingclass.ref).trim() !== "" && } - - {String(props.mytrainingclass.ref).trim() !== "" && - } - -
} - - {submenu && String(submenu) === "unite_enseignement" && -
-
-   - - { - setselectionModel_list_unite_enseignement(newSelectionModel); - /*if (newSelectionModel.length === 1) - handleClick_edit_session_From_Line(newSelectionModel);*/ - if (newSelectionModel.length !== 1) { - - } - }} - selectionModel={selectionModel_list_unite_enseignement} - - localeText={frFR.components.MuiDataGrid.defaultProps.localeText} - rows={Getall_Class_List_UE_result.map((item, index) => ( - { - id: index, - _id: JSON.parse(item)._id, - code: JSON.parse(item).code, - titre: JSON.parse(item).titre, - - credit: JSON.parse(item).credit, - pres_dist_hyp: JSON.parse(item).pres_dist_hyp, - is_noted: JSON.parse(item).is_noted, - coefficient: JSON.parse(item).coefficient, - seuil_validation: JSON.parse(item).seuil_validation, - - duration: JSON.parse(item).duration, - duration_unite: JSON.parse(item).duration_unite, - duration_concat: JSON.parse(item).duration_concat, - - } - ))} - - columns={columns_list_unite_enseignement} - pageSize={10} - className="datagridclass" - - onRowDoubleClick={(newSelectionModel) => { - if (String(props.check_user_acces_right("formation", "write")) === "1") { - clean_ue_data(); - setgridline_ue_id(newSelectionModel.row.id); - setselected_ue_id(newSelectionModel.row._id) - - var current_class_ue_data = New_Getall_Class_List_UE_result.filter((ue_data) => ue_data._id === String((newSelectionModel.row._id))) - - // console.log(" ### current_class_ue_data[0] = ", current_class_ue_data[0]); - setselected_ue_credit_ects(current_class_ue_data[0]['credit']); - setselected_ue_is_noted(current_class_ue_data[0]['is_noted']); - setselected_ue_pres_dist_hyp(current_class_ue_data[0]['pres_dist_hyp']); - setselected_ue_coefficient(current_class_ue_data[0]['coefficient']); - setselected_ue_seuil_validation(current_class_ue_data[0]['seuil_validation']); - setadd_one_eu_to_class("0"); - setDialog_Unite_Enseignement_open(true); - } - - - }} - - - - rowsPerPageOptions={[10]} - disableSelectionOnClick - components={{ - Toolbar: GridToolbar, - }} - //sx={datagridSx} - getCellClassName={(params) => { - - - // Pour la gestion de la couleur de zone double cliquée - if (String(params.row.id) === String(ue_gridline_id)) { - return 'line--statut--selected'; - } - else if (parseInt(String(params.row.id)) % 2 === 0) { - return 'line--statut--pair'; - } - else if (parseInt(String(params.row.id)) % 2 !== 0) { - return 'line--statut--impair'; - } - - }} - - getRowClassName={(params) => { - - // Pour la gestion de la couleur de zone double cliquée - if (String(params.row.id) === String(ue_gridline_id)) { - - return 'line--statut--selected'; - } - else if (parseInt(String(params.row.id)) % 2 === 0) { - return 'line--statut--pair'; - } - else if (parseInt(String(params.row.id)) % 2 !== 0) { - return 'line--statut--impair'; - } - - }} - getEstimatedRowHeight={() => 200} - getRowHeight={() => "auto"} - sx={{ - "& .MuiDataGrid-cellContent": { - minHeight: 50, - - }, - [`& .${gridClasses.cell}`]: { - py: 1, - }, - }} - - - /> - -
-
- - {String(props.check_user_acces_right("formation", "write")) === "1" &&
- -
} -
-
-
} - - {submenu && String(submenu) === "admission" &&
} - - {submenu && String(submenu) === "note_evaluation" &&
- -
-   - - { - setselectionModel_list_evaluation_nite_enseignement(newSelectionModel); - /*if (newSelectionModel.length === 1) - handleClick_edit_session_From_Line(newSelectionModel);*/ - if (newSelectionModel.length !== 1) { - - } - }} - selectionModel={selectionModel_list_evaluation_nite_enseignement} - - localeText={frFR.components.MuiDataGrid.defaultProps.localeText} - rows={Getall_Class_List_Evalution_result.map((item, index) => ( - { - id: index, - _id: JSON.parse(item)._id, - class_id: JSON.parse(item).class_id, - class_ue_id: JSON.parse(item).class_ue_id, - type_evaluation_id: JSON.parse(item).type_evaluation_id, - max_note: JSON.parse(item).max_note, - ponderation_type_eval: JSON.parse(item).ponderation_type_eval, - } - ))} - - columns={columns_list_evaluation_unite_enseignement} - pageSize={10} - className="datagridclass" - - onRowDoubleClick={(newSelectionModel) => { - if (String(props.check_user_acces_right("formation", "write")) === "1") { - setadd_ue_evalution("0"); - setsetgridline_evaluation_ue_id(newSelectionModel.row.id); - setselected_eu_evalution_id(newSelectionModel.row.type_evaluation_id) - setselected_ue_id(newSelectionModel.row.class_ue_id); - setp_detail_max_note(newSelectionModel.row.max_note); - setp_detail_ponderation_type_eval(newSelectionModel.row.ponderation_type_eval); - setclass_unite_enseignement_type_evaluation_id(newSelectionModel.row._id); - - Getall_Partner_Type_Evalution_List(); - - setDialog_Evaluation_Unite_Enseignement_open(true); - } - }} - - - - rowsPerPageOptions={[10]} - disableSelectionOnClick - components={{ - Toolbar: GridToolbar, - }} - //sx={datagridSx} - getCellClassName={(params) => { - - }} - - getRowClassName={(params) => { - - // Pour la gestion de la couleur de zone double cliquée - if (String(params.row.id) === String(ue_gridline_id)) { - - return 'line--statut--selected'; - } - else if (parseInt(String(params.row.id)) % 2 === 0) { - return 'line--statut--pair'; - } - else if (parseInt(String(params.row.id)) % 2 !== 0) { - return 'line--statut--impair'; - } - - }} - getEstimatedRowHeight={() => 200} - getRowHeight={() => "auto"} - sx={{ - "& .MuiDataGrid-cellContent": { - minHeight: 50, - - }, - [`& .${gridClasses.cell}`]: { - py: 1, - }, - }} - - - /> - -
-
- - {String(props.check_user_acces_right("formation", "write")) === "1" &&
- -
} -
- -
-
-
- - {New_Get_List_Regle_Calcul_Note_Formation_result && New_Get_List_Regle_Calcul_Note_Formation_result.length > 0 && } -
-
- - {String(props.ispending) === String("0") &&
- - - {(String(datamodification) === String("1") || String(editor_tochange) === String("1")) &&
- -
- } - - - {(String(datamodification) === String("1") || String(editor_tochange) === String("1")) && String(props.mytrainingclass.ref) !== "" &&
- - -
} - -
} - - - -
} - - {submenu && String(submenu) === "piece_jointe" &&
- - -
- -
-
- - {String(props.check_user_acces_right("formation", "write")) === "1" &&
- -
- -
- {file_1_name && file_1_name.name && - } - - {Record_All_PJ_api && String(Record_All_PJ_api) === "true" &&
Pièce jointe enregistrée
} - - {Record_All_PJ_api && String(Record_All_PJ_api) === "false" &&
{Record_All_PJ_message}
} - - -
} - - - {file_1_name && file_1_name.name &&
- -
- -
- - -
} - - {Get_List_Of_All_PJ_result &&
-
- -
- {Get_List_Of_All_PJ_result && Get_List_Of_All_PJ_result.map((val) => ( -
- - - - - {String(props.check_user_acces_right("formation", "write")) === "1" && Supprimer - - - } - modal - nested - position="center center" - > - {close => ( -
- -
MySy Information
-
- {' '} - - En confirmant cette opération, la pièce jointe sera définitivement supprimée.
- - -
-
-
- - -
-
- -
-
-
- )} -
} - -
- ))} -
-
-
} -
- -
- -
} - - {submenu && String(submenu) === "detail_formation" && -
-   - {p_detail_archive && String(p_detail_archive) === "1" && -
Document Archivé
} -
- -
- -
-
- - -
- { - setp_detail_external_code(e.target.value); - } - } - - - /> -
- -
- { - setp_detail_title(e.target.value); - } - } - /> -
- - -
- { - if (value && value._id) { - setp_formateur_id(value._id); - setp_formateur_label(value.label) - DataUpdated(); - - } else { - setp_formateur_id(""); - setp_formateur_label("") - DataUpdated(); - } - }} - - renderInput={(params) => - } - /> - - - -
- - - - -
- - { - if (value && value.value) { - - setmycpf(value.value); - setmycpf_label(value.label); - setdatamodification("1"); - - } else { - setmycpf(""); - setmycpf_label(""); - setdatamodification("1"); - } - }} - - renderInput={(params) => - } - /> - -
- -
- - { - if (value && value.value) { - - setmycertif(value.value); - setmycertif_label(value.label); - setdatamodification("1"); - - console.log(" ### setmycertif = ", value.value) - - } else { - setmycertif(""); - setmycertif_label(""); - setdatamodification("1"); - } - }} - - renderInput={(params) => - } - /> - - -
- -
- { - if (value && value.code) { - setp_class_level(value.code); - setp_class_level_label(value.description) - DataUpdated(); - - } else { - setp_class_level(""); - setp_class_level_label("") - DataUpdated(); - } - }} - - renderInput={(params) => - } - /> -
- - -
- - { - if (value && value.value) { - // console.log(" value = ", value); - setmypublished(value.value); - setmypublished_label(value.label); - setdatamodification("1"); - - } else { - setmypublished(""); - setmypublished_label(""); - setdatamodification("1"); - } - }} - - renderInput={(params) => - } - /> - - -
- -
- - { - if (value && value.value) { - // console.log(" value = ", value); - setmypublished_catalog_prive(value.value); - setmypublished_catalog_prive_label(value.label); - setdatamodification("1"); - - } else { - setmypublished_catalog_prive(""); - setmypublished_catalog_prive_label(""); - setdatamodification("1"); - } - }} - - renderInput={(params) => - } - /> - - -
- - - - -
- - { - if (value && value.value) { - - setmytrainingsupport(value.value); - setdatamodification("1"); - setmytrainingsupport_label(value.label) - - } else { - setmytrainingsupport(""); - setdatamodification("1"); - setmytrainingsupport_label("") - } - }} - - renderInput={(params) => - } - /> - -
- - - {New_Get_List_Domaines_result && New_Get_List_Domaines_result.length > 0 &&
- (data)._id === String(mytrainingdomaine))[0].label} - - onChange={(event, value) => { - setdatamodification("1"); - if (value && value._id) { - setmytrainingdomaine(value._id); - setmytrainingmetier(""); - setmytrainingcategorie(""); - } else { - setmytrainingdomaine(""); - setmytrainingmetier(""); - setmytrainingcategorie(""); - } - }} - - renderInput={(params) => - } - /> - -
} - - - {New_Get_List_Metiers_result && New_Get_List_Metiers_result.length > 0 && mytrainingdomaine && -
- data.class_domaine_id === String(String(mytrainingdomaine).trim()))} - - value={New_Get_List_Metiers_result.filter((data) => (data)._id === String(mytrainingmetier))[0].label} - - - onChange={(event, value) => { - - if (value && value._id) { - setmytrainingmetier(value._id); - setdatamodification("1"); - } else { - setmytrainingmetier(""); - setdatamodification("1"); - } - }} - - renderInput={(params) => - } - /> - -
} - - - - - {(!mytrainingdomaine || String(mytrainingdomaine).trim().length <= 0 || String(mytrainingdomaine).trim() === "") &&
- { - - - if (value && value._id) { - - setmytrainingmetier(value.metier); - setdatamodification("1"); - } else { - setmytrainingmetier(""); - setdatamodification("1"); - } - }} - - renderInput={(params) => - } - /> - -
} - - - - {New_Get_List_Categorie_result && New_Get_List_Categorie_result.length > 0 && mytrainingdomaine && -
- data.class_domaine_id === String(String(mytrainingdomaine).trim()))} - - value={New_Get_List_Categorie_result.filter((data) => (data)._id === String(mytrainingcategorie))[0].label} - - - onChange={(event, value) => { - - if (value && value._id) { - setmytrainingcategorie(value._id); - setdatamodification("1"); - } else { - setmytrainingcategorie(""); - setdatamodification("1"); - - } - }} - - renderInput={(params) => - } - /> - -
} - - - - {(!mytrainingdomaine || String(mytrainingdomaine).trim().length <= 0 || String(mytrainingdomaine).trim() === "") &&
- { - - if (value && value._id) { - - setmytrainingcategorie(value.metier); - setdatamodification("1"); - } else { - setmytrainingcategorie(""); - setdatamodification("1"); - - - } - }} - - renderInput={(params) => - } - /> - -
} - - - {New_Getall_Parter_referentiel_padagogique_result && New_Getall_Parter_referentiel_padagogique_result.length > 0 &&
- (data)._id === String(mytraining_ref_peda_id))[0].label} - - onChange={(event, value) => { - setdatamodification("1"); - - if (value && value._id) { - setmytraining_ref_peda_id(value._id); - } else { - setmytraining_ref_peda_id(""); - } - }} - - renderInput={(params) => - } - /> - -
} - -
-
- - {/* -- début champs durée & prix **/} -   -
- - -
- -
-
- - -
- - { - setp_detail_duree(e.target.value); - } - } - /> -
- -
- { - if (value && value.value) { - setmytrainingdurationunit(value.value); - setdatamodification("1"); - } else { - setmytrainingdurationunit(""); - setdatamodification("1"); - } - }} - - renderInput={(params) => - } - /> - - -
- - -
- { - setp_detail_price(e.target.value); - } - } - /> -
-
-
- - -   -
- -
- - -
-
- - -
- { - setp_detail_url(e.target.value); - } - } - /> -
- -
- { - setp_detail_lms_class_code(e.target.value); - } - } - /> -
- - -
- { - setp_detail_class_inscription_url(e.target.value); - } - } - /> -
- - - - - - -
- { - setp_detail_note(e.target.value); - } - } - /> -
- -
- { - setp_detail_version_catalogue(e.target.value); - } - } - /> -
- -
- { - setp_detail_recyclage_delai(e.target.value); - } - } - /> -
- -
- { - setp_detail_recyclage_alert(e.target.value); - } - } - /> -
- -
-
- - - - {/* -- début champs specifiques **/} -   - {rows_champs_specifics && - rows_champs_specifics.length > 0 && -
- -
} - -
- -
- {rows_champs_specifics && - rows_champs_specifics.map((champ_spec) => ( - -
- {String(JSON.parse(champ_spec).field_type) === "float" && - { - change_champs_spec_handle(e.target.value); - //setEmployee_data_changed("1"); - }} - />} - - {String(JSON.parse(champ_spec).field_type) === "string" && { - change_champs_spec_handle(e.target.value); - //setEmployee_data_changed("1"); - }} - />} - -
- ))} - -
- -
- {/* -- end champs specifiques **/} - -
} - - {String(history_securite_read) === "1" && String(submenu) === String("historique") &&
- -
} - - {submenu && String(submenu) === "aide_ia" &&
- -
-   - - - - - - - -
- -
- -
} - - {submenu && String(submenu) === "finance" && String(props.check_user_acces_right("formation", "write")) === "1" &&
-
- -
-   - - - { - setselectionModel_list_finance_data(newSelectionModel); - /*if (newSelectionModel.length === 1) - handleClick_edit_session_From_Line(newSelectionModel);*/ - if (newSelectionModel.length !== 1) { - - } - }} - selectionModel={selectionModel_list_finance_data} - - localeText={frFR.components.MuiDataGrid.defaultProps.localeText} - rows={Getall_Class_Finance_Caracteristic_result.map((item, index) => ( - { - id: index, - _id: JSON.parse(item)._id, - code: JSON.parse(item).code, - description: JSON.parse(item).description, - commentaire: JSON.parse(item).commentaire, - montant: JSON.parse(item).montant, - type_cout: JSON.parse(item).type_cout, - inclus_calcul: JSON.parse(item).inclus_calcul, - - } - ))} - - columns={columns_list_finance_data} - pageSize={10} - className="datagridclass" - - onRowDoubleClick={(newSelectionModel) => { - if (String(props.check_user_acces_right("formation", "write")) === "1") { - setfinance_data_gridline_id(newSelectionModel.row.id); - setselected_finance_data_id(newSelectionModel.row._id) - - var current_class_finance_data = New_Getall_Class_Finance_Caracteristic_result.filter((finance_data) => finance_data._id === String((newSelectionModel.row._id))) - - - // console.log(" ### current_class_ue_data = ", current_class_finance_data); - setp_detail_fin_data_code(current_class_finance_data[0]['code']); - setp_detail_fin_data_description(current_class_finance_data[0]['description']); - setp_detail_fin_data_commentaire(current_class_finance_data[0]['commentaire']); - setp_detail_fin_data_montant(current_class_finance_data[0]['montant']); - setp_detail_fin_data_type_cout(current_class_finance_data[0]['type_cout']); - if (String(current_class_finance_data[0]['inclus_calcul']) === "1") - setp_detail_fin_data_inclus_calcul(true); - else - setp_detail_fin_data_inclus_calcul(false); - - - setDialog_Financial_Data_open(true); - } - - }} - - - - rowsPerPageOptions={[10]} - disableSelectionOnClick - components={{ - Toolbar: GridToolbar, - }} - //sx={datagridSx} - getCellClassName={(params) => { - - - // Pour la gestion de la couleur de zone double cliquée - if (String(params.row.id) === String(finance_data_gridline_id)) { - return 'line--statut--selected'; - } - else if (parseInt(String(params.row.id)) % 2 === 0) { - return 'line--statut--pair'; - } - else if (parseInt(String(params.row.id)) % 2 !== 0) { - return 'line--statut--impair'; - } - - }} - - getRowClassName={(params) => { - - // Pour la gestion de la couleur de zone double cliquée - if (String(params.row.id) === String(finance_data_gridline_id)) { - - return 'line--statut--selected'; - } - else if (parseInt(String(params.row.id)) % 2 === 0) { - return 'line--statut--pair'; - } - else if (parseInt(String(params.row.id)) % 2 !== 0) { - return 'line--statut--impair'; - } - - }} - getEstimatedRowHeight={() => 200} - getRowHeight={() => "auto"} - sx={{ - "& .MuiDataGrid-cellContent": { - minHeight: 50, - - }, - [`& .${gridClasses.cell}`]: { - py: 1, - }, - }} - - - /> - -
-
- - {String(props.check_user_acces_right("formation", "write")) === "1" &&
- -
} -
-
- - - -
-
} - - {submenu && String(submenu) === "documents" &&
-
-
- -
-
- -
- - {/*** Question positionnement */} -
- -
Q. Positionnement
- -
- {New_Getall_Partner_Formulaires_Q_Position.length > 0 &&
Choisir un modèle par défault - (data)._id === String(selected_default_Formulaires_Q_Position))[0].label} - - onChange={(event, value) => { - setdefault_doc_modification("1"); - if (value && value._id) - setselected_default_Formulaires_Q_Position(value._id); - else - setselected_default_Formulaires_Q_Position("") - - }} - - renderInput={(params) => - } - /> - -
} -
-
- - {/*** Evaluation à chaud */} -
- -
Evaluation à chaud
- -
- {New_Getall_Partner_Formulaires_Eval_Chaud.length > 0 &&
Choisir un modèle par défault - (data)._id === String(selected_default_Formulaires_Eval_Chaud))[0].label} - - onChange={(event, value) => { - setdefault_doc_modification("1"); - if (value && value._id) - setselected_default_Formulaires_Eval_Chaud(value._id); - else - setselected_default_Formulaires_Eval_Chaud("") - - }} - - renderInput={(params) => - } - /> - -
} -
-
- - - {/*** Evaluation à froid */} -
- -
Evaluation à froid
- - -
- {New_Getall_Partner_Formulaires_Eval_Froid.length > 0 &&
Choisir un modèle par défault - (data)._id === String(selected_default_Formulaires_Eval_Froid))[0].label} - - onChange={(event, value) => { - setdefault_doc_modification("1"); - if (value && value._id) - setselected_default_Formulaires_Eval_Froid(value._id); - else - setselected_default_Formulaires_Eval_Froid("") - - }} - - renderInput={(params) => - } - /> - -
} -
-
- - - {/*** Evaluation formateur */} -
- -
Evaluation formateur
- -
- {New_Getall_Partner_Formulaires_Eval_Formateur.length > 0 &&
Choisir un modèle par défault - (data)._id === String(selected_default_Formulaires_Eval_Formateur))[0].label} - - onChange={(event, value) => { - setdefault_doc_modification("1"); - if (value && value._id) - setselected_default_Formulaires_Eval_Formateur(value._id); - else - setselected_default_Formulaires_Eval_Formateur("") - - }} - - renderInput={(params) => - } - /> - -
} -
-
- -
- - {/*** Convention Individuelle */} -
- -
Conventions Individuelles
-
- {New_Get_List_Convention_Individuelle_PDF_result.length > 0 &&
Choisir un modèle par défault (PDF) - (data)._id === String(selected_default_Convention_individuelle_PDF))[0].label} - - onChange={(event, value) => { - setdefault_doc_modification("1"); - if (value && value._id) - setselected_default_Convention_individuelle_PDF(value._id); - else - setselected_default_Convention_individuelle_PDF("") - - }} - - renderInput={(params) => - } - /> - -
} -
-
- {New_Get_List_Convention_Individuelle_Mail_result.length > 0 &&
Choisir un modèle par défault (Email) - (data)._id === String(selected_default_Convention_individuelle_Mail))[0].label} - - onChange={(event, value) => { - setdefault_doc_modification("1"); - if (value && value._id) - setselected_default_Convention_individuelle_Mail(value._id); - else - setselected_default_Convention_individuelle_Mail("") - - }} - - renderInput={(params) => - } - /> - -
} -
- -
- - - {/*** Convention Entreprise */} -
- -
Conventions Entreprise
-
- {New_Get_List_Convention_Entreprise_PDF_result.length > 0 &&
Choisir un modèle par défault (PDF) - (data)._id === String(selected_default_Convention_entreprise_PDF))[0].label} - - onChange={(event, value) => { - setdefault_doc_modification("1"); - if (value && value._id) - setselected_default_Convention_entreprise_PDF(value._id); - else - setselected_default_Convention_entreprise_PDF("") - - }} - - renderInput={(params) => - } - /> - -
} -
-
- {New_Get_List_Convention_Entreprise_Mail_result.length > 0 &&
Choisir un modèle par défault (Email) - (data)._id === String(selected_default_Convention_entreprise_Mail))[0].label} - - onChange={(event, value) => { - setdefault_doc_modification("1"); - if (value && value._id) - setselected_default_Convention_entreprise_Mail(value._id); - else - setselected_default_Convention_entreprise_Mail("") - - }} - - renderInput={(params) => - } - /> - -
} -
- -
- - - {/*** Convocation */} -
- -
Convocations
-
- {New_Get_List_Stagiaire_Convocations_PDF_result.length > 0 &&
Choisir un modèle par défault (PDF) - (data)._id === String(selected_default_Stagiaire_Convocations_PDF))[0].label} - - onChange={(event, value) => { - setdefault_doc_modification("1"); - if (value && value._id) - setselected_default_Stagiaire_Convocations_PDF(value._id); - else - setselected_default_Stagiaire_Convocations_PDF("") - - }} - - renderInput={(params) => - } - /> - -
} -
-
- {New_Get_List_Stagiaire_Convocations_Mail_result.length > 0 &&
Choisir un modèle par défault (Email) - (data)._id === String(selected_default_Stagiaire_Convocations_Mail))[0].label} - - onChange={(event, value) => { - - setdefault_doc_modification("1"); - if (value && value._id) - setselected_default_Stagiaire_Convocations_Mail(value._id); - else - setselected_default_Stagiaire_Convocations_Mail("") - - }} - - renderInput={(params) => - } - /> - -
} -
- -
- - - {/*** Attestation */} -
- -
Attestation Ftion
-
- {New_Get_List_Attestation_PDF_result.length > 0 &&
Choisir un modèle par défault (PDF) - (data)._id === String(selected_default_attestation_PDF))[0].label} - - onChange={(event, value) => { - setdefault_doc_modification("1"); - if (value && value._id) - setselected_default_attestation_PDF(value._id); - else - setselected_default_attestation_PDF("") - - }} - - renderInput={(params) => - } - /> - -
} -
-
- {New_Get_List_Attestation_Email_result.length > 0 &&
Choisir un modèle par défault (Email) - (data)._id === String(selected_default_attestation_Email))[0].label} - - onChange={(event, value) => { - setdefault_doc_modification("1"); - if (value && value._id) - setselected_default_attestation_Email(value._id); - else - setselected_default_attestation_Email("") - - }} - - renderInput={(params) => - } - /> - -
} -
- -
- - -
- -
-  

-
- - {String(props.check_user_acces_right("formation", "write")) === "1" && String(default_doc_modification) === "1" && -
-
/!\ Pensez à enregistrer les modifications
} - - - {String(props.check_user_acces_right("formation", "write")) === "1" &&
-
- -
-
- -
-
- } - -
} - - -
- - - - - {submenu && String(submenu) === "detail_formation" &&
- {String(props.check_user_acces_right("formation", "write")) === "1" &&
- {String(datamodification) === String("1") &&
-
/!\ Pensez à enregistrer les modifications
-
} - - {String(props.ispending) === String("0") &&
- - {(String(datamodification) === String("1") || String(editor_tochange) === String("1")) &&
- -
- } - - {String(datamodification) !== String("1") && String(editor_tochange) !== String("1") && String(props.mytrainingclass.ref) !== "" && -
- - } className="bton_suppr2"> SUPPRIMER LA FORMATION - - } - modal - nested - position="center center" - > - {close => ( -
- -
MySy Information
-
- {' '} - - En confirmant cette opération, la formation sera définitivement supprimée.
- Avant, assurez-vous de n'avoir aucune session rattachée à la formation. - -
-
-
- - -
-
- -
-
-
- )} -
- -
- } - - - {(String(datamodification) === String("1") || String(editor_tochange) === String("1")) && String(props.mytrainingclass.ref) !== "" &&
- - -
} - -
} - - {String(props.ispending) !== String("0") &&
- - datamodification = {datamodification} - {String(datamodification) === String("1") &&
- ENREGISTRER -
- } - - - {String(datamodification) === String("0") &&
- MODIFICATION -
- } - - -
- - -
- -
} - - - {String(myApiResponse) === String("true") && importmessage && -
- {importmessage} - -
} - - {String(myApiResponse) === String("false") && -
- {importmessage} - -
} -
} - - -
- -
-
- - editorRef_description.current = editor} - initialValue={field_description} - onKeyUp={editor_keyup} - disabled={!Boolean(props.check_user_acces_right("formation", "write"))} - onEditorChange={(newValue, editor) => { - - if (String(editor_tochange) === "1") { - //alert(" change"); - DataUpdated() - seteditor_tochange(""); - } - }} - - init={{ - resize: false, - height: 300, - menubar: true, - plugins: [ - 'advlist', 'autolink', 'lists', 'link', 'image', 'charmap', 'preview', 'anchor', 'searchreplace', - 'visualblocks', 'code', 'fullscreen', 'insertdatetime', 'media', 'table', 'code', 'help', 'wordcount', - 'lists', 'link', 'image', 'charmap', 'preview', 'anchor', 'searchreplace', 'visualblocks', - - ], - toolbar: 'undo redo | casechange blocks | bold italic backcolor | ' + - 'alignleft aligncenter alignright alignjustify | ' + - 'bullist numlist checklist outdent indent | removeformat ', - - content_style: 'body { font-family:DM Sans,sans-serif; font-size:14px; }' - }} - /> - -
-
- -
-
- - editorRef_objectif.current = editor} - initialValue={field_objectif} - onKeyUp={editor_keyup} - disabled={!Boolean(props.check_user_acces_right("formation", "write"))} - onEditorChange={(newValue, editor) => { - if (String(editor_tochange) === "1") { - //alert(" change"); - DataUpdated(); - seteditor_tochange(""); - } - }} - init={{ - resize: false, - height: 300, - menubar: true, - plugins: [ - 'advlist', 'autolink', 'lists', 'link', 'image', 'charmap', 'preview', 'anchor', 'searchreplace', - 'visualblocks', 'code', 'fullscreen', 'insertdatetime', 'media', 'table', 'code', 'help', 'wordcount', - 'lists', 'link', 'image', 'charmap', 'preview', 'anchor', 'searchreplace', 'visualblocks', - - ], - toolbar: 'undo redo | casechange blocks | bold italic backcolor | ' + - 'alignleft aligncenter alignright alignjustify | ' + - 'bullist numlist checklist outdent indent | removeformat ', - - content_style: 'body { font-family:DM Sans,sans-serif; font-size:14px; }' - }} - /> - -
-
- -
-
- - editorRef_programme.current = editor} - initialValue={field_programme} - onKeyUp={editor_keyup} - disabled={!Boolean(props.check_user_acces_right("formation", "write"))} - onEditorChange={(newValue, editor) => { - if (String(editor_tochange) === "1") { - //alert(" change"); - DataUpdated(); - seteditor_tochange(""); - } - }} - init={{ - resize: false, - height: 300, - menubar: true, - plugins: [ - 'advlist', 'autolink', 'lists', 'link', 'image', 'charmap', 'preview', 'anchor', 'searchreplace', - 'visualblocks', 'code', 'fullscreen', 'insertdatetime', 'media', 'table', 'code', 'help', 'wordcount', - 'lists', 'link', 'image', 'charmap', 'preview', 'anchor', 'searchreplace', 'visualblocks', - - ], - toolbar: 'undo redo | casechange blocks | bold italic backcolor | ' + - 'alignleft aligncenter alignright alignjustify | ' + - 'bullist numlist checklist outdent indent | removeformat ', - - content_style: 'body { font-family:DM Sans,sans-serif; font-size:14px; }' - }} - /> - -
-
- -
-
-
Ressources Pédagogiques et techniques (max 1000 caractères)
- editorRef_methode_pedago.current = editor} - initialValue={field_methode_pedago} - onKeyUp={editor_keyup} - disabled={!Boolean(props.check_user_acces_right("formation", "write"))} - onEditorChange={(newValue, editor) => { - if (String(editor_tochange) === "1") { - //alert(" change"); - DataUpdated(); - seteditor_tochange(""); - } - }} - init={{ - resize: false, - height: 300, - menubar: true, - plugins: [ - 'advlist', 'autolink', 'lists', 'link', 'image', 'charmap', 'preview', 'anchor', 'searchreplace', - 'visualblocks', 'code', 'fullscreen', 'insertdatetime', 'media', 'table', 'code', 'help', 'wordcount', - 'lists', 'link', 'image', 'charmap', 'preview', 'anchor', 'searchreplace', 'visualblocks', - - ], - toolbar: 'undo redo | casechange blocks | bold italic backcolor | ' + - 'alignleft aligncenter alignright alignjustify | ' + - 'bullist numlist checklist outdent indent | removeformat ', - - content_style: 'body { font-family:DM Sans,sans-serif; font-size:14px; }' - }} - /> - -
-
- - -
-
-
Suivi et Évaluation (max 1000 caractères)
- editorRef_suivi_eval.current = editor} - initialValue={field_suivi_eval} - onKeyUp={editor_keyup} - disabled={!Boolean(props.check_user_acces_right("formation", "write"))} - onEditorChange={(newValue, editor) => { - if (String(editor_tochange) === "1") { - //alert(" change"); - DataUpdated(); - seteditor_tochange(""); - } - }} - init={{ - resize: false, - height: 300, - menubar: true, - plugins: [ - 'advlist', 'autolink', 'lists', 'link', 'image', 'charmap', 'preview', 'anchor', 'searchreplace', - 'visualblocks', 'code', 'fullscreen', 'insertdatetime', 'media', 'table', 'code', 'help', 'wordcount', - 'lists', 'link', 'image', 'charmap', 'preview', 'anchor', 'searchreplace', 'visualblocks', - - ], - toolbar: 'undo redo | casechange blocks | bold italic backcolor | ' + - 'alignleft aligncenter alignright alignjustify | ' + - 'bullist numlist checklist outdent indent | removeformat ', - - content_style: 'body { font-family:DM Sans,sans-serif; font-size:14px; }' - }} - /> - -
-
- - - -
-
-
Accès handicapé (max 1000 caractères)
- editorRef_handicap.current = editor} - initialValue={field_handicap} - onKeyUp={editor_keyup} - disabled={!Boolean(props.check_user_acces_right("formation", "write"))} - onEditorChange={(newValue, editor) => { - if (String(editor_tochange) === "1") { - //alert(" change"); - DataUpdated(); - seteditor_tochange(""); - } - }} - init={{ - resize: false, - height: 300, - menubar: true, - plugins: [ - 'advlist', 'autolink', 'lists', 'link', 'image', 'charmap', 'preview', 'anchor', 'searchreplace', - 'visualblocks', 'code', 'fullscreen', 'insertdatetime', 'media', 'table', 'code', 'help', 'wordcount', - 'lists', 'link', 'image', 'charmap', 'preview', 'anchor', 'searchreplace', 'visualblocks', - - ], - toolbar: 'undo redo | casechange blocks | bold italic backcolor | ' + - 'alignleft aligncenter alignright alignjustify | ' + - 'bullist numlist checklist outdent indent | removeformat ', - - content_style: 'body { font-family:DM Sans,sans-serif; font-size:14px; }' - }} - /> - -
-
- - -
-
- - editorRef_prerequis.current = editor} - initialValue={field_prerequis} - onKeyUp={editor_keyup} - disabled={!Boolean(props.check_user_acces_right("formation", "write"))} - onEditorChange={(newValue, editor) => { - if (String(editor_tochange) === "1") { - //alert(" change"); - DataUpdated(); - seteditor_tochange(""); - } - }} - init={{ - resize: false, - height: 300, - menubar: true, - plugins: [ - 'advlist', 'autolink', 'lists', 'link', 'image', 'charmap', 'preview', 'anchor', 'searchreplace', - 'visualblocks', 'code', 'fullscreen', 'insertdatetime', 'media', 'table', 'code', 'help', 'wordcount', - 'lists', 'link', 'image', 'charmap', 'preview', 'anchor', 'searchreplace', 'visualblocks', - - ], - toolbar: 'undo redo | casechange blocks | bold italic backcolor | ' + - 'alignleft aligncenter alignright alignjustify | ' + - 'bullist numlist checklist outdent indent | removeformat ', - - content_style: 'body { font-family:DM Sans,sans-serif; font-size:14px; }' - }} - /> - -
-
- -
-
-
Pour Qui ?
- editorRef_pourqui.current = editor} - initialValue={field_pourqui} - onKeyUp={editor_keyup} - disabled={!Boolean(props.check_user_acces_right("formation", "write"))} - onEditorChange={(newValue, editor) => { - if (String(editor_tochange) === "1") { - //alert(" change"); - DataUpdated(); - seteditor_tochange(""); - } - }} - init={{ - resize: false, - height: 300, - menubar: true, - plugins: [ - 'advlist', 'autolink', 'lists', 'link', 'image', 'charmap', 'preview', 'anchor', 'searchreplace', - 'visualblocks', 'code', 'fullscreen', 'insertdatetime', 'media', 'table', 'code', 'help', 'wordcount', - 'lists', 'link', 'image', 'charmap', 'preview', 'anchor', 'searchreplace', 'visualblocks', - - ], - toolbar: 'undo redo | casechange blocks | bold italic backcolor | ' + - 'alignleft aligncenter alignright alignjustify | ' + - 'bullist numlist checklist outdent indent | removeformat ', - - content_style: 'body { font-family:DM Sans,sans-serif; font-size:14px; }' - }} - /> - -
-
- -
-
-
Mots clés
- editorRef_mots_cle.current = editor} - initialValue={field_mots_cle} - onKeyUp={editor_keyup} - disabled={!Boolean(props.check_user_acces_right("formation", "write"))} - onEditorChange={(newValue, editor) => { - if (String(editor_tochange) === "1") { - //alert(" change"); - DataUpdated(); - seteditor_tochange(""); - } - }} - init={{ - resize: false, - height: 300, - menubar: true, - plugins: [ - 'advlist', 'autolink', 'lists', 'link', 'image', 'charmap', 'preview', 'anchor', 'searchreplace', - 'visualblocks', 'code', 'fullscreen', 'insertdatetime', 'media', 'table', 'code', 'help', 'wordcount', - 'lists', 'link', 'image', 'charmap', 'preview', 'anchor', 'searchreplace', 'visualblocks', - - ], - toolbar: 'undo redo | casechange blocks | bold italic backcolor | ' + - 'alignleft aligncenter alignright alignjustify | ' + - 'bullist numlist checklist outdent indent | removeformat ', - - content_style: 'body { font-family:DM Sans,sans-serif; font-size:14px; }' - }} - /> - -
-
- -
-
- - editorRef_plus_produit.current = editor} - initialValue={field_plus_produit} - onKeyUp={editor_keyup} - disabled={!Boolean(props.check_user_acces_right("formation", "write"))} - onEditorChange={(newValue, editor) => { - if (String(editor_tochange) === "1") { - //alert(" change"); - DataUpdated(); - seteditor_tochange(""); - } - }} - init={{ - resize: false, - height: 300, - menubar: true, - plugins: [ - 'advlist', 'autolink', 'lists', 'link', 'image', 'charmap', 'preview', 'anchor', 'searchreplace', - 'visualblocks', 'code', 'fullscreen', 'insertdatetime', 'media', 'table', 'code', 'help', 'wordcount', - 'lists', 'link', 'image', 'charmap', 'preview', 'anchor', 'searchreplace', 'visualblocks', - - ], - toolbar: 'undo redo | casechange blocks | bold italic backcolor | ' + - 'alignleft aligncenter alignright alignjustify | ' + - 'bullist numlist checklist outdent indent | removeformat ', - - content_style: 'body { font-family:DM Sans,sans-serif; font-size:14px; }' - }} - /> - -
-
- -
-
- - editorRef_contenu_attestation.current = editor} - initialValue={field_contenu_attestation} - onKeyUp={editor_keyup} - disabled={!Boolean(props.check_user_acces_right("formation", "write"))} - onEditorChange={(newValue, editor) => { - if (String(editor_tochange) === "1") { - //alert(" change"); - DataUpdated(); - seteditor_tochange(""); - } - }} - init={{ - resize: false, - height: 300, - menubar: true, - plugins: [ - 'advlist', 'autolink', 'lists', 'link', 'image', 'charmap', 'preview', 'anchor', 'searchreplace', - 'visualblocks', 'code', 'fullscreen', 'insertdatetime', 'media', 'table', 'code', 'help', 'wordcount', - 'lists', 'link', 'image', 'charmap', 'preview', 'anchor', 'searchreplace', 'visualblocks', - - ], - toolbar: 'undo redo | casechange blocks | bold italic backcolor | ' + - 'alignleft aligncenter alignright alignjustify | ' + - 'bullist numlist checklist outdent indent | removeformat ', - - content_style: 'body { font-family:DM Sans,sans-serif; font-size:14px; }' - }} - /> - -
-
- - - -
- -   - -
- - {(String(props.currentpack).toLocaleLowerCase() === String("gold") || - String(props.currentpack).toLocaleLowerCase() === String("mesure")) - &&
- - -
} - - - - {String(props.currentpack).toLocaleLowerCase() === String("decouverte") &&
- - - - - {/* */} - - - -
- } - - {String(props.currentpack).toLocaleLowerCase() === String("standard") && -
- - {/* -*/} - - -
- } - - - {String(props.check_user_acces_right("formation", "write")) === "1" &&
- - Fiche catalogue
- {String(props.check_user_acces_right("formation", "write")) === "1" &&
- - {Get_Class_Catalogue_File_result && Get_Class_Catalogue_File_result.length <= 0 &&
- -
} - {file_1_name && file_1_name.name && - } - - {Record_Class_Catalogue_File_api && String(Record_Class_Catalogue_File_api) === "true" &&
Pièce jointe enregistrée
} - - {Record_Class_Catalogue_File_api && String(Record_Class_Catalogue_File_api) === "false" &&
{Record_Class_Catalogue_File_message}
} - - -
} - - - {file_1_name && file_1_name.name &&
- -
- -
- - -
} - - {Get_Class_Catalogue_File_result &&
-
- -
- {Get_Class_Catalogue_File_result && Get_Class_Catalogue_File_result.map((val) => ( -
- - - - - {String(props.check_user_acces_right("formation", "write")) === "1" && Supprimer - - - } - modal - nested - position="center center" - > - {close => ( -
- -
MySy Information
-
- {' '} - - En confirmant cette opération, la pièce jointe sera définitivement supprimée.
- - -
-
-
- - -
-
- -
-
-
- )} -
} - -
- ))} -
-
-
} - - -
} -
- - - - - -
Image de profil
-
- -
-
- {String(props.check_user_acces_right("formation", "write")) === "1" &&
-
-
-
- {/*isimgclassSelected && */} - {isimgclassdeleted && String(isimgclassdeleted) === "1" && } - {isimgclassdeleted && String(isimgclassdeleted) === "0" && } - {isimgclassSelected && String(isimgclassSaved) === "0" && } -
} - -
- {String(props.check_user_acces_right("formation", "write")) === "1" &&
-
  • - L'image doit etre carrée. -
  • -
  • - Les formats autorisés sont : ['jpg', 'jpeg', 'png', 'jpe', 'webp'] -
  • -
  • - Les dimensions recommandées: 128pixels X 128pixels -- 144pixels X 144pixels -- 168pixels X 168pixels
    - Les dimensions maximales sont de 256pixels X 256pixels -
  • -
  • - La taille de l'image ne doit pas dépasser 1 mega octet -
  • -
    } -
    - -
    - -
    -
    -
    -
    - -
    - - - {String(datamodification) === String("1") &&
    -
    /!\ Pensez à enregistrer les modifications
    -
    } - - {String(props.ispending) === String("0") &&
    - - - {(String(datamodification) === String("1") || String(editor_tochange) === String("1")) &&
    - -
    - } - - {/*String(datamodification) === String("0") &&
    - -
    - */ } - - - - {String(datamodification) !== String("1") && String(editor_tochange) !== String("1") && String(props.check_user_acces_right("formation", "write")) === "1" && - String(props.mytrainingclass.ref) !== "" &&
    - - -
    - } - - - {(String(datamodification) === String("1") || String(editor_tochange) === String("1")) && String(props.check_user_acces_right("formation", "write")) === "1" && - String(props.mytrainingclass.ref) !== "" &&
    - - -
    } - -
    } - - {String(props.ispending) !== String("0") && String(props.check_user_acces_right("formation", "write")) === "1" &&
    - {String(datamodification) === String("1") &&
    - ENREGISTRER -
    - } - - - {String(datamodification) === String("0") &&
    - MODIFICATION -
    - } - - -
    - - -
    - -
    } - - - {String(myApiResponse) === String("true") && importmessage && -
    - {importmessage} - -
    } - - {String(myApiResponse) === String("false") && -
    - {importmessage} - -
    } - -
    } - - {submenu && String(submenu) === "statistiques" &&
    -
    - -

    - - -
    - -
    -
    - - -
    - -
    -
    - -
    - - -
    - -
    -
    - -
    - - -
    - -
    -
    - -
    - -
    - -
    -
    - - - -
    - -
    -
    -
    - -
    -   -
    -
    - - -
    - Choisir une question - {New_Getall_Employee_Statistic_Question_List_result && New_Getall_Employee_Statistic_Question_List_result.length > 0 && -
    - - - (data)._id === String(selected_statistic_question_id))[0].label} - - onChange={(event, value) => { - - - if (value && value._id) { - setselected_statistic_question_id(value.question_id); - setselected_statistic_question_type(value.question_type); - } else { - setselected_statistic_question_id(""); - setselected_statistic_question_type(""); - } - }} - - renderInput={(params) => - } - /> -
    } -
    - - {selected_statistic_question_id && String(selected_statistic_question_id) !== "d" && - -
    - -
    -
    - Date Debut - { - setp_filter_date_from(format(date, 'dd/MM/yyyy')); - - } - } - showTimeSelect={false} - dateFormat="dd/MM/yyyy" - className="disabled_style session_caract_Dialog_DatePicker" - locale={'fr'} - - /> - -
    - -
    -
    - -
    - Date Fin - { - setp_filter_date_to(format(date, 'dd/MM/yyyy')); - - } - } - showTimeSelect={false} - dateFormat="dd/MM/yyyy" - className="disabled_style session_caract_Dialog_DatePicker" - /> - -
    - -
    - - - -
    } -
    -
    - {String(selected_statistic_question_id) !== "" &&
    } - -
    - - {Getall_Qry_Survey_Data_result_JSON && Getall_Qry_Survey_Data_result_JSON.length > 0 && - Getall_Qry_Survey_Data_result_JSON &&
    - - {display_view && String(display_view) === "bars" &&
    - Affichage   - - - - -
    } - - {display_view && String(display_view) === "line" &&
    - Affichage   - - - -
    } - - - {display_view && String(display_view) === "bars" && -   - -
    - - {Getall_Qry_Survey_Data_result_JSON && Getall_Qry_Survey_Data_result_JSON.length > 0 && - Getall_Qry_Survey_Data_result_JSON && - - context.location === 'tick' - ? `${month.slice(0, 2)}` + "\n" + `${month.slice(3, 7)}` - : `${month}`, - }]} - series={[ - { dataKey: 'nb_question_response', label: 'NB', valueFormatter }, - { dataKey: 'value', label: `${selected_statistic_question_type}`, color: '#FA7070', valueFormatter }, - - - ]} - {...otherSetting} - margin={{ right: 15, left: 100 }} - height={450} - />} -
    - -
    } - - {display_view && String(display_view) === "line" && -   - -
    - - - {Getall_Qry_Survey_Data_result_JSON && Getall_Qry_Survey_Data_result_JSON.length > 0 && - Getall_Qry_Survey_Data_result_JSON && - - - - context.location === 'tick' - ? `${month.slice(0, 2)}` + " \n" + `${month.slice(3, 7)}` - : `${month}`, - }]} - series={[ - { dataKey: 'nb_question_response', label: 'NB', valueFormatter: (value) => (value == null ? 'NaN' : value.toString()), }, - { dataKey: 'value', label: `${selected_statistic_question_type}`, color: '#FA7070', valueFormatter: (value) => (value == null ? 'NaN' : value.toString()), }, - ]} - - margin={{ right: 15, left: 100 }} - height={450} - /> - - - - } -
    - - - -
    } - -
    - {Global_Getall_Qry_Survey_Data_result_JSON &&
    - - Nombre total d'enquêtes sur la période : {Global_Getall_Qry_Survey_Data_result_JSON['global_nb_question_response']}
    - - {String(selected_statistic_question_type) === "Somme" && - } - - {String(selected_statistic_question_type) === "Moyenne" && - } - -
    } -
    } - -
    -
    } - - -
    - ); -} - -export default AddClassManual_ARG; diff --git a/src/components/AddPartnerClient_ARG_100526.js b/src/components/AddPartnerClient_ARG_100526.js deleted file mode 100644 index d4914b1..0000000 --- a/src/components/AddPartnerClient_ARG_100526.js +++ /dev/null @@ -1,6841 +0,0 @@ -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 = "#f8f9fa"; - } - - if (document.getElementsByName("client_nom") && document.getElementsByName("client_nom")[0]) { - document.getElementsByName("client_nom")[0].disabled = true; - document.getElementsByName("client_nom")[0].style.backgroundColor = "#f8f9fa"; - } - - 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 = "#f8f9fa"; - } - - if (document.getElementsByName("client_adresse") && document.getElementsByName("client_adresse")[0]) { - document.getElementsByName("client_adresse")[0].disabled = true; - document.getElementsByName("client_adresse")[0].style.backgroundColor = "#f8f9fa"; - } - - if (document.getElementsByName("client_ville") && document.getElementsByName("client_ville")[0]) { - document.getElementsByName("client_ville")[0].disabled = true; - document.getElementsByName("client_ville")[0].style.backgroundColor = "#f8f9fa"; - } - - if (document.getElementsByName("client_pays") && document.getElementsByName("client_pays")[0]) { - document.getElementsByName("client_pays")[0].disabled = true; - document.getElementsByName("client_pays")[0].style.backgroundColor = "#f8f9fa"; - } - - if (document.getElementsByName("client_email") && document.getElementsByName("client_pays")[0]) { - document.getElementsByName("client_email")[0].disabled = true; - document.getElementsByName("client_email")[0].style.backgroundColor = "#f8f9fa"; - } - - if (document.getElementsByName("client_siret") && document.getElementsByName("client_pays")[0]) { - document.getElementsByName("client_siret")[0].disabled = true; - document.getElementsByName("client_siret")[0].style.backgroundColor = "#f8f9fa"; - } - - 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 = "#f8f9fa"; - } - - 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 = "#f8f9fa"; - } - - - 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 = "#f8f9fa"; - } - - 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 = "#f8f9fa"; - } - - - - if (document.getElementsByName("client_tva") && document.getElementsByName("client_tva")[0]) { - document.getElementsByName("client_tva")[0].disabled = true; - document.getElementsByName("client_tva")[0].style.backgroundColor = "#f8f9fa"; - } - - if (document.getElementsByName("client_website") && document.getElementsByName("client_website")[0]) { - document.getElementsByName("client_website")[0].disabled = true; - document.getElementsByName("client_website")[0].style.backgroundColor = "#f8f9fa"; - } - - 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 = "#f8f9fa"; - } - - - if (document.getElementsByName("client_comment") && document.getElementsByName("client_comment")[0]) { - document.getElementsByName("client_comment")[0].disabled = true; - document.getElementsByName("client_comment")[0].style.backgroundColor = "#f8f9fa"; - } - - - if (document.getElementsByName("client_telephone") && document.getElementsByName("client_telephone")[0]) { - document.getElementsByName("client_telephone")[0].disabled = true; - document.getElementsByName("client_telephone")[0].style.backgroundColor = "#f8f9fa"; - } - - - - } - - 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 = "#f8f9fa"; - } - - if (document.getElementsByName("contact_nom")) { - document.getElementsByName("contact_nom")[0].disabled = true; - document.getElementsByName("contact_nom")[0].style.backgroundColor = "#f8f9fa"; - } - - if (document.getElementsByName("contact_prenom")) { - document.getElementsByName("contact_prenom")[0].disabled = true; - document.getElementsByName("contact_prenom")[0].style.backgroundColor = "#f8f9fa"; - } - - if (document.getElementsByName("contact_fonction")) { - document.getElementsByName("contact_fonction")[0].disabled = true; - document.getElementsByName("contact_fonction")[0].style.backgroundColor = "#f8f9fa"; - } - - - if (document.getElementsByName("contact_civilite")) { - document.getElementsByName("contact_civilite")[0].disabled = true; - document.getElementsByName("contact_civilite")[0].style.backgroundColor = "#f8f9fa"; - } - - - - if (document.getElementsByName("contact_siret")) { - document.getElementsByName("contact_siret")[0].disabled = true; - document.getElementsByName("contact_siret")[0].style.backgroundColor = "#f8f9fa"; - } - - if (document.getElementsByName("contact_tva")) { - document.getElementsByName("contact_tva")[0].disabled = true; - document.getElementsByName("contact_tva")[0].style.backgroundColor = "#f8f9fa"; - } - - if (document.getElementsByName("contact_adresse")) { - document.getElementsByName("contact_adresse")[0].disabled = true; - document.getElementsByName("contact_adresse")[0].style.backgroundColor = "#f8f9fa"; - } - - if (document.getElementsByName("contact_ville")) { - document.getElementsByName("contact_ville")[0].disabled = true; - document.getElementsByName("contact_ville")[0].style.backgroundColor = "#f8f9fa"; - } - - if (document.getElementsByName("contact_code_postal")) { - document.getElementsByName("contact_code_postal")[0].disabled = true; - document.getElementsByName("contact_code_postal")[0].style.backgroundColor = "#f8f9fa"; - } - - if (document.getElementsByName("contact_pays")) { - document.getElementsByName("contact_pays")[0].disabled = true; - document.getElementsByName("contact_pays")[0].style.backgroundColor = "#f8f9fa"; - } - - if (document.getElementsByName("contact_telephone")) { - document.getElementsByName("contact_telephone")[0].disabled = true; - document.getElementsByName("contact_telephone")[0].style.backgroundColor = "#f8f9fa"; - } - - if (document.getElementsByName("contact_telephone_mobile")) { - document.getElementsByName("contact_telephone_mobile")[0].disabled = true; - document.getElementsByName("contact_telephone_mobile")[0].style.backgroundColor = "#f8f9fa"; - } - - } - - 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 = "#f8f9fa"; - } - - if (document.getElementsByName("client_invoice_nom")) { - document.getElementsByName("client_invoice_nom")[0].disabled = true; - document.getElementsByName("client_invoice_nom")[0].style.backgroundColor = "#f8f9fa"; - } - - 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 = "#f8f9fa"; - } - - if (document.getElementsByName("client_invoice_siret")) { - document.getElementsByName("client_invoice_siret")[0].disabled = true; - document.getElementsByName("client_invoice_siret")[0].style.backgroundColor = "#f8f9fa"; - } - - if (document.getElementsByName("client_invoice_tva")) { - document.getElementsByName("client_invoice_tva")[0].disabled = true; - document.getElementsByName("client_invoice_tva")[0].style.backgroundColor = "#f8f9fa"; - } - - 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 = "#f8f9fa"; - 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 = "#f8f9fa"; - } - - - if (document.getElementsByName("client_invoice_ville")) { - document.getElementsByName("client_invoice_ville")[0].disabled = true; - document.getElementsByName("client_invoice_ville")[0].style.backgroundColor = "#f8f9fa"; - } - - 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 = "#f8f9fa"; - } - - if (document.getElementsByName("client_invoice_pays")) { - document.getElementsByName("client_invoice_pays")[0].disabled = true; - document.getElementsByName("client_invoice_pays")[0].style.backgroundColor = "#f8f9fa"; - //console.log("iiiiii"); - } - - if (document.getElementsByName("facturation_automatique")) { - document.getElementsByName("facturation_automatique")[0].disabled = true; - document.getElementsByName("facturation_automatique")[0].style.backgroundColor = "#f8f9fa"; - - } - - - } - - 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/Apprenant.js b/src/components/Apprenant.js index da3ee7d..928b582 100644 --- a/src/components/Apprenant.js +++ b/src/components/Apprenant.js @@ -731,6 +731,8 @@ const Apprenant = (props) => { const [p_detail_handicap_detail, setp_detail_handicap_detail] = useState(""); const [p_detail_nom, setp_detail_nom] = useState(""); + + const [p_detail_prenom, setp_detail_prenom] = useState(""); const [p_detail_telephone, setp_detail_telephone] = useState(""); const [p_detail_employeur, setp_detail_employeur] = useState(""); @@ -774,6 +776,9 @@ const Apprenant = (props) => { const [p_one_naissance, setp_one_naissance] = useState(new Date().toLocaleDateString('fr-FR')); + const [p_one_is_handicap_detail_amenagement, setp_one_is_handicap_detail_amenagement] = useState(""); + + const [p_one_is_handicap, setp_one_is_handicap] = useState(false); const [p_one_is_droit_image, setp_one_is_droit_image] = useState(false); const [p_one_is_rgpd, setp_one_is_rgpd] = useState(false); @@ -790,6 +795,10 @@ const Apprenant = (props) => { const [p_one_nom, setp_one_nom] = useState(""); + + const [p_one_nom_fille, setp_one_nom_fille] = useState(); + + const [p_one_prenom, setp_one_prenom] = useState(""); const [p_one_telephone, setp_one_telephone] = useState(""); const [p_one_employeur, setp_one_employeur] = useState(""); @@ -1240,6 +1249,19 @@ const Apprenant = (props) => { setp_detail_telephone_bis(""); } + if (mylocaltraining.nom_fille) { + setp_detail_nom_fille(mylocaltraining.nom_fille); + } else { + setp_detail_nom_fille(""); + } + + if (mylocaltraining.handicap_detail) { + setp_detail_handicap_detail(mylocaltraining.handicap_detail); + } else { + setp_detail_handicap_detail(""); + } + + /* * Update 22/10/2023 : Gestion des champs spécifiques. ils commencent tous par 'my_' @@ -1342,7 +1364,7 @@ const Apprenant = (props) => { const formData = new FormData(); formData.append('File', file_1_name); //formData.append('token', 'K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA'); - const stored_cookie = getCookie('tokenmysypart'); + const stored_cookie = getCookie('tokenmysypart'); formData.append("token", stored_cookie); formData.append("file_business_object", p_detail_one_file_to_download_type_name); @@ -1353,7 +1375,7 @@ const Apprenant = (props) => { formData.append("type_document", ""); if (file_date_expiration) { - if (file_date_expiration instanceof Date) { + if (file_date_expiration instanceof Date) { const jour = String(file_date_expiration.getDate()).padStart(2, "0"); const mois = String(file_date_expiration.getMonth() + 1).padStart(2, "0"); const annee = file_date_expiration.getFullYear(); @@ -1866,6 +1888,8 @@ const Apprenant = (props) => { setp_one_naissance(new Date().toLocaleDateString('fr-FR')); setp_one_nom(''); + setp_one_nom_fille(''); + setp_one_prenom(''); setp_one_telephone(''); setp_one_employeur(''); @@ -2006,7 +2030,8 @@ const Apprenant = (props) => { } const list_champs = ["field_detail_lieu_naissance", "field_detail_departement_naissance", "field_detail_pays_naissance", "field_type_pi", "field_num_pi", - "field_type_mobilite", "field_nationalite", "field_droit_image", "field_rgpd", "field_sitation_famille", "field_num_ss", "field_matricule", "field_ine"] + "field_type_mobilite", "field_nationalite", "field_droit_image", "field_rgpd", "field_sitation_famille", "field_num_ss", "field_matricule", "field_ine", + "field_handicape_amenagement"] for (let i = 0; i < list_champs.length; i++) { if (document.getElementsByName(String(list_champs[i])) && document.getElementsByName(String(list_champs[i]))[0]) { @@ -2093,7 +2118,8 @@ const Apprenant = (props) => { } const list_champs = ["field_detail_lieu_naissance", "field_detail_departement_naissance", "field_detail_pays_naissance", "field_type_pi", "field_num_pi", - "field_type_mobilite", "field_nationalite", "field_droit_image", "field_rgpd", "field_sitation_famille", "field_num_ss", "field_matricule", "field_ine"] + "field_type_mobilite", "field_nationalite", "field_droit_image", "field_rgpd", "field_sitation_famille", "field_num_ss", "field_matricule", "field_ine", + "field_handicape_amenagement"] for (let i = 0; i < list_champs.length; i++) { if (document.getElementsByName(String(list_champs[i])) && document.getElementsByName(String(list_champs[i]))[0]) { @@ -2497,6 +2523,11 @@ const Apprenant = (props) => { form.append("ine", ""); + if (p_detail_handicap_detail) + form.append("handicap_detail", p_detail_handicap_detail); + else + form.append("handicap_detail", ""); + /* Update du 22/10/2023 - Gestion des champs spécifiques ajoutés par le partenaire @@ -5008,6 +5039,17 @@ const Apprenant = (props) => { form.append("civilite", p_one_civilite); form.append("date_naissance", p_one_naissance); + if (p_one_nom_fille) + form.append("nom_fille", p_one_nom_fille); + else + form.append("nom_fille", ""); + + + if (p_one_is_handicap_detail_amenagement) + form.append("handicap_detail", p_one_is_handicap_detail_amenagement); + else + form.append("handicap_detail", ""); + if (p_one_telephone) @@ -8073,7 +8115,8 @@ const Apprenant = (props) => { renderInput={(params) => { renderInput={(params) => { - + {/**/} {String(props.formation_initiale) === "1" && } @@ -9124,6 +9168,28 @@ const Apprenant = (props) => {
    + {p_one_civilite !== "m" &&
    Nom jeune fille
    + { + setp_one_nom_fille(e.target.value); + } + } + + /> +
    } + +
    Prénom
    { renderInput={(params) => { renderInput={(params) => { renderInput={(params) => { />
    +
     
    + + {p_one_is_handicap &&
    Aménagement handicape
    + { + setp_one_is_handicap_detail_amenagement(e.target.value); + + }} + /> +
    }
    @@ -9642,28 +9733,28 @@ const Apprenant = (props) => {
    {String(JSON.parse(champ_spec).is_mandatory) === "1" && {JSON.parse(champ_spec).field_label} } {String(JSON.parse(champ_spec).is_mandatory) !== "1" && {JSON.parse(champ_spec).field_label} }
    - {String(JSON.parse(champ_spec).field_type) === "float" && - { - change_champs_spec_handle(e.target.value); + className="disabled_style" + onChange={(e) => { + change_champs_spec_handle(e.target.value); - }} - //onChange={change_champs_spec_handle} + }} + //onChange={change_champs_spec_handle} - />} + />} {String(JSON.parse(champ_spec).field_type) === "string" && { + }}> Situation Handicape
    + {p_detail_civilite !== "m" &&
    Nom jeune fille
    + { + setp_detail_nom_fille(e.target.value); + setapprenant_data_changed("1"); + } + } + + /> +
    } + +
    Prénom
    { renderInput={(params) => { />
    +
     
    + + {p_detail_is_handicap &&
    Aménagement handicape
    + { + setp_detail_handicap_detail(e.target.value); + setapprenant_data_changed("1"); + + }} + /> +
    } + +
    @@ -10474,6 +10614,7 @@ const Apprenant = (props) => { renderInput={(params) => {
    -
    +
      { ))} columns={columns_apprenant_inscriptions} - pageSize={10} + pageSize={20} className="datagridclass" onRowDoubleClick={(newSelectionModel) => { @@ -10726,7 +10867,7 @@ const Apprenant = (props) => { - rowsPerPageOptions={[10]} + rowsPerPageOptions={[20]} disableSelectionOnClick components={{ Toolbar: GridToolbar, @@ -12463,7 +12604,8 @@ const Apprenant = (props) => { }} renderInput={(params) => { renderInput={(params) => { renderInput={(params) => { renderInput={(params) => { setLoading(false); if (String(res.data.status) === String("true")) { //console.log(" In Getall_Class_List_UE res.data.status = " + res.data.status); - // console.log(" In Getall_Class_List_UE res.data.message r_class = " + res.data.message); + // console.log(" In Getall_Class_List_UE res.data.message r_class = " + res.data.message); setGetall_Class_List_UE_api("true"); setGetall_Class_List_UE_result(res.data.message); @@ -15780,7 +15780,7 @@ const DisplayPartnerPromotion = (props) => { setNew_Getall_Class_List_UE_result(new_data2); - // console.log(" ### new_data2 = ", new_data2) + // console.log(" ### new_data2 = ", new_data2) } else { setGetall_Class_List_UE_api("false"); @@ -23066,116 +23066,121 @@ const DisplayPartnerPromotion = (props) => {
    - {String(props.check_user_acces_right("session", "write")) === "1" && selectionModel && selectionModel.length >= 1 &&
    - -   - = 1 && +
    + +   + - Action    - Supprimer   - Dupliquer   - + inputProps={{ min: "0", max: "1", step: "1" }} + disabled={false} + className="block_en_mass_select" + + value={actionmass_ftion_val} + onChange={actionmass_ftion} + > + Action    + Supprimer   + Dupliquer   + - {actionmass_ftion_val && String(actionmass_ftion_val).length > 1 && String(actionmass_ftion_val) !== "dupliquer" && - - } - - -
    } +
    }
    @@ -24940,7 +24945,7 @@ const DisplayPartnerPromotion = (props) => { />
    -
    Prix Scolarité
    +
    Frais Scolarité
    { }} inputProps={{ min: "1", max: "999999", step: "1" }} disabled={false} - className="disabled_style_moitier enable_style" + className="disabled_style" value={p_one_prix_session} onChange={(e) => setp_one_prix_session(e.target.value)} /> - {New_Price_by.length > 0 && (data).value === String(p_one_prix_session_by))[0].label} - options={New_Price_by} - onChange={(event, value) => { - if (value && value.value) { - setp_one_prix_session_by(value.value) - } - - }} - - renderInput={(params) => - } - />}
    @@ -26110,7 +26082,8 @@ const DisplayPartnerPromotion = (props) => { renderInput={(params) => { renderInput={(params) => { renderInput={(params) => { renderInput={(params) => { renderInput={(params) => { renderInput={(params) => { renderInput={(params) => { }} renderInput={(params) => { id="combo-box-demo" className="block_en_mass_select" fullWidth + sx={{ + backgroundColor: "#FFF", + }} options={New_Option_Emargement_Masse} onChange={(event, value) => { if (value && value.value) { diff --git a/src/components/DisplayPartnerSession.js b/src/components/DisplayPartnerSession.js index 3b89cb7..f0daed2 100644 --- a/src/components/DisplayPartnerSession.js +++ b/src/components/DisplayPartnerSession.js @@ -16890,19 +16890,20 @@ const DisplayPartnerSession = (props) => { } }} renderInput={(params) => @@ -17276,19 +17277,20 @@ const DisplayPartnerSession = (props) => { } }} renderInput={(params) => @@ -17442,19 +17444,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -17485,19 +17488,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -17652,19 +17656,20 @@ const DisplayPartnerSession = (props) => { renderInput={(params) => @@ -17807,19 +17812,20 @@ const DisplayPartnerSession = (props) => { } }} renderInput={(params) => @@ -17907,19 +17913,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -18220,19 +18227,20 @@ const DisplayPartnerSession = (props) => { } }} renderInput={(params) => @@ -18278,19 +18286,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => + sx={{ + background: '#FFF', + "& .MuiOutlinedInput-root": { + "& fieldset": { + border: "solid #e8eef6 1px;", + }, + "&:hover fieldset": { + border: "solid #e8eef6 1px;", + }, + "&.Mui-focused fieldset": { + border: "solid #e8eef6 1px;", + }, + }, + }} /> } /> @@ -18820,19 +18829,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -19190,19 +19200,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -19816,19 +19827,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -19941,19 +19953,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => + sx={{ + background: '#FFF', + "& .MuiOutlinedInput-root": { + "& fieldset": { + border: "solid #e8eef6 1px;", + }, + "&:hover fieldset": { + border: "solid #e8eef6 1px;", + }, + "&.Mui-focused fieldset": { + border: "solid #e8eef6 1px;", + }, + }, + }} /> } /> @@ -20255,19 +20268,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -21360,19 +21374,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -21435,19 +21450,20 @@ const DisplayPartnerSession = (props) => { } }} renderInput={(params) => } @@ -21500,19 +21516,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -21567,19 +21584,20 @@ const DisplayPartnerSession = (props) => { } }} renderInput={(params) => } @@ -21890,7 +21908,7 @@ const DisplayPartnerSession = (props) => { ))} columns={columns} - pageSize={10} + pageSize={15} className="datagridclass" onRowDoubleClick={(newSelectionModel) => { @@ -21923,7 +21941,7 @@ const DisplayPartnerSession = (props) => { - rowsPerPageOptions={[10]} + rowsPerPageOptions={[15]} disableSelectionOnClick /*components={{ Toolbar: GridToolbar, @@ -23433,6 +23451,10 @@ const DisplayPartnerSession = (props) => { InputLabelProps={{ shrink: true, }} + + sx={{ + backgroundColor: "#FFF", + }} inputProps={{ min: "0", max: "1", step: "1" }} disabled={false} className="block_en_mass_select" @@ -23743,19 +23765,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -23864,19 +23887,20 @@ const DisplayPartnerSession = (props) => { } }} renderInput={(params) => @@ -23998,19 +24022,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -24062,19 +24087,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -24187,19 +24213,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -24416,19 +24443,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -24568,19 +24596,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -24618,19 +24647,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -24860,19 +24890,20 @@ const DisplayPartnerSession = (props) => { renderInput={(params) => @@ -24938,19 +24969,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -25024,19 +25056,20 @@ const DisplayPartnerSession = (props) => { } }} renderInput={(params) => @@ -25133,19 +25166,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -25177,19 +25211,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -25221,19 +25256,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -25401,19 +25437,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -25490,19 +25527,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -25532,19 +25570,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -26198,19 +26237,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -26341,19 +26381,20 @@ const DisplayPartnerSession = (props) => { } }} renderInput={(params) => @@ -26414,19 +26455,20 @@ const DisplayPartnerSession = (props) => { value={p_one_detail_client_rattachement_nom} renderInput={(params) => @@ -26457,19 +26499,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -26499,19 +26542,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -26538,7 +26582,8 @@ const DisplayPartnerSession = (props) => { renderInput={(params) => { }} renderInput={(params) => @@ -26616,7 +26662,8 @@ const DisplayPartnerSession = (props) => { renderInput={(params) => { }} renderInput={(params) => @@ -27022,7 +27070,7 @@ const DisplayPartnerSession = (props) => { renderInput={(params) => { } }} renderInput={(params) => @@ -27491,19 +27540,20 @@ const DisplayPartnerSession = (props) => { } }} renderInput={(params) => @@ -27637,19 +27687,20 @@ const DisplayPartnerSession = (props) => { } }} renderInput={(params) => @@ -27711,19 +27762,20 @@ const DisplayPartnerSession = (props) => { value={p_one_detail_client_rattachement_nom} renderInput={(params) => @@ -27754,19 +27806,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -27796,19 +27849,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -27835,7 +27889,8 @@ const DisplayPartnerSession = (props) => { renderInput={(params) => { }} renderInput={(params) => @@ -27913,7 +27969,8 @@ const DisplayPartnerSession = (props) => { renderInput={(params) => { }} renderInput={(params) => @@ -28313,6 +28371,9 @@ const DisplayPartnerSession = (props) => { id="combo-box-demo" className="block_en_mass_select" fullWidth + sx={{ + backgroundColor: "#FFF", + }} options={New_Option_Inscription} onChange={(event, value) => { setselected_convocation_id(""); @@ -28338,20 +28399,20 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => @@ -28719,6 +28780,7 @@ const DisplayPartnerSession = (props) => { renderInput={(params) => { renderInput={(params) => @@ -28887,19 +28950,20 @@ const DisplayPartnerSession = (props) => { value={p_detail_financeur_rattachement_nom} renderInput={(params) => @@ -28986,6 +29050,7 @@ const DisplayPartnerSession = (props) => { }} renderInput={(params) => { } }} renderInput={(params) => @@ -30000,6 +30066,9 @@ const DisplayPartnerSession = (props) => { id="combo-box-demo" className="block_en_mass_select" fullWidth + sx={{ + backgroundColor: "#FFF", + }} options={New_Option_Emargement_Masse} onChange={(event, value) => { if (value && value.value) { @@ -30500,6 +30569,9 @@ const DisplayPartnerSession = (props) => { id="combo-box-demo" className="block_en_mass_select" fullWidth + sx={{ + backgroundColor: "#FFF", + }} options={New_Option_Evaluation_Masse} onChange={(event, value) => { if (value && value.value) { diff --git a/src/components/DisplayPartnerStagiaires.js b/src/components/DisplayPartnerStagiaires.js index 3897c18..d365d6a 100644 --- a/src/components/DisplayPartnerStagiaires.js +++ b/src/components/DisplayPartnerStagiaires.js @@ -3966,7 +3966,7 @@ const DisplayPartnerStagiaires = (props) => { if (String(res.data.status) === String("true")) { //console.log(" In Get_Inscrit_Notes_Of_Evaluations res.data.status = " + res.data.status); - // console.log(" In Get_Inscrit_Notes_Of_Evaluations res.data.message r_class = " + res.data.message); + // console.log(" In Get_Inscrit_Notes_Of_Evaluations res.data.message r_class = " + res.data.message); setGet_Inscrit_Notes_Of_Evaluations_api("true"); setGet_Inscrit_Notes_Of_Evaluations_result(res.data.message); } @@ -10181,6 +10181,7 @@ const DisplayPartnerStagiaires = (props) => { }} renderInput={(params) => { }} renderInput={(params) => { }} renderInput={(params) => { renderInput={(params) => { renderInput={(params) => { renderInput={(params) => { }} renderInput={(params) => { }} renderInput={(params) => { }} renderInput={(params) => { }} renderInput={(params) => { }} renderInput={(params) => { }} renderInput={(params) => {
    - {(!display_stagiaire_with_alert || display_stagiaire_with_alert !== true) &&
    + {(!display_stagiaire_with_alert || display_stagiaire_with_alert !== true) && +
      { ))} columns={columns} - pageSize={10} + pageSize={20} className="datagridclass" onRowDoubleClick={(newSelectionModel) => { @@ -13348,7 +13361,7 @@ const DisplayPartnerStagiaires = (props) => { }} - rowsPerPageOptions={[10]} + rowsPerPageOptions={[20]} disableSelectionOnClick /* components={{ Toolbar: GridToolbar, @@ -13670,6 +13683,7 @@ const DisplayPartnerStagiaires = (props) => { renderInput={(params) => { }} renderInput={(params) => { renderInput={(params) => { renderInput={(params) => { renderInput={(params) => { }} renderInput={(params) => { renderInput={(params) => { renderInput={(params) => { renderInput={(params) => { renderInput={(params) => {
    -
    +

    } - {actionmass_ftion_val && String(actionmass_ftion_val) === "print_bulletin" && } + } -
    } +
    }
    @@ -5931,11 +6099,12 @@ const Module_Session_Notes_Classement = (props) => { - {vue_note && String(vue_note) === "detail_note" &&
    + {vue_note && String(vue_note) === "detail_note" && +
    {/***** On n'affiche les filtre que si necessaire */} -
    -
    Filtre Detail note +
    +
    Filtre Détail notes
    @@ -6530,7 +6699,7 @@ const Module_Session_Notes_Classement = (props) => {
      - + {
    - -----------
    diff --git a/src/components/Module_Session_Planification.js b/src/components/Module_Session_Planification.js index 97d61da..269f082 100644 --- a/src/components/Module_Session_Planification.js +++ b/src/components/Module_Session_Planification.js @@ -3824,7 +3824,7 @@ const Module_Session_Planification = (props) => { var node_distinct = { "_id": local_id, "id": localid, - "label": local_code + " - " + String(local_titre).substring(0, 20), + "label": local_code + " - " + String(local_titre).substring(0, 50), "code": local_code, "titre": local_titre, "credit": local_credit, @@ -7341,7 +7341,8 @@ const Module_Session_Planification = (props) => {
    Groupe apprenants - {New_Getall_Partner_Groupe_Inscrit_result && New_Getall_Partner_Groupe_Inscrit_result.length > 0 && 0 && + {
    - {/*
    - {String(show_all_activite_list) === "1" && String(showactivite_detail) !== "1" && String(add_one_activite) !== "1" && -
    -
    Ajouter une activité
    - - - -
    -
    Activité(s) qui me sont Assignée(s)
    -
    - - -
    - -
    - {activite_status_list_pave_affiche.map((channel, index) => ( - - {String(index) === "0" &&
    -
    {Opportunite_chanel_label[channel.id]}
    -
    - {Get_List_Activite_Assign_To_Me_result && Get_List_Activite_Assign_To_Me_result.length > 0 && - Get_List_Activite_Assign_To_Me_result.filter(item => JSON.parse(item).status === channel.id) - .map(item => ( - -
    -
    - - {String(String(JSON.parse(item).status)) === "1" && - } - - {String(String(JSON.parse(item).status)) === "0" && - } - - {String(String(JSON.parse(item).status)) === "-1" && - } -
    - -
    - ))} -
    -
    } - - {String(index) !== "0" &&
    -
    {Opportunite_chanel_label[channel.id]}
    -
    - {Get_List_Activite_Assign_To_Me_result && Get_List_Activite_Assign_To_Me_result.length > 0 && - Get_List_Activite_Assign_To_Me_result.filter(item => JSON.parse(item).status === channel.id) - .map(item => ( - -
    -
    - - {String(String(JSON.parse(item).status)) === "1" && - } - - {String(String(JSON.parse(item).status)) === "0" && - } - - {String(String(JSON.parse(item).status)) === "-1" && - } -
    - -
    - ))} -
    -
    } - - - -
    - ))} - - - - -
    -
    -
     
    - - -
    - - -
    -
    -
    Activté(s) que j'ai créée(s)
    - -
    - -
    - -
    - {activite_status_list_pave_affiche.map((channel, index) => ( - - {String(index) === "0" &&
    -
    {Opportunite_chanel_label[channel.id]}
    -
    - {Get_List_Activite_Of_client_Part_result && Get_List_Activite_Of_client_Part_result.length > 0 && - Get_List_Activite_Of_client_Part_result.filter(item => JSON.parse(item).status === channel.id) - .map(item => ( - -
    - -
    - - {String(String(JSON.parse(item).status)) === "1" && - } - - {String(String(JSON.parse(item).status)) === "0" && - } - - {String(String(JSON.parse(item).status)) === "-1" && - } -
    - -
    - ))} -
    -
    } - - {String(index) !== "0" &&
    -
    {Opportunite_chanel_label[channel.id]}
    -
    - {Get_List_Activite_Of_client_Part_result && Get_List_Activite_Of_client_Part_result.length > 0 && - Get_List_Activite_Of_client_Part_result.filter(item => JSON.parse(item).status === channel.id) - .map(item => ( - -
    - -
    - - {String(String(JSON.parse(item).status)) === "1" && - } - - {String(String(JSON.parse(item).status)) === "0" && - } - - {String(String(JSON.parse(item).status)) === "-1" && - } -
    - -
    - ))} -
    -
    } - -
    - ))} -
    -
    -
     
    - -
    - -
    } - - {String(showactivite_detail) === "ttt1" &&
    -
    Description
    - - setp_activite_description(e.target.value)} - - /> -
    - - - {String(formedit_mode_activite) === "1" &&
    - Date souhaitée 01
    - { - setp_activite_deadline(date); - setdatamodification_activite("1"); - } - } - locale={'fr'} - showTimeSelect - timeFormat="HH:mm" - timeIntervals={15} - dateFormat="dd/MM/yyyy HH:mm" - is24Hour - className="disabled_style enable_style" - - /> - -
    } - - {String(formedit_mode_activite) === "0" &&
    - - Date souhaitée 02
    - - -
    } - - {String(formedit_mode_activite) === "1" && type_activite_list && type_activite_list.length > 0 &&
    - Type d'activité
    - - (data).id === String(p_activite_type))[0].label} - onChange={(event, value) => { - if (value && value.value) { - setp_activite_type(value.value); - } - }} - renderInput={(params) => - } - /> - - -
    } - - {String(formedit_mode_activite) === "0" &&
    - Type d'activité
    - setp_activite_type(e.target.value)} > - - - -
    } - - {String(formedit_mode_activite) === "1" && activite_status_list && activite_status_list.length > 0 && -
    - Statut
    - - (data).id === String(p_activite_status))[0].label} - onChange={(event, value) => { - if (value && value.value) { - setp_activite_status(value.value); - } - }} - renderInput={(params) => - } - /> - -
    } - - {String(formedit_mode_activite) === "0" &&
    - Statut
    - setp_activite_status(e.target.value)} > - -
    } - - - {New_Getall_Training_Employee_No_Filter_result && New_Getall_Training_Employee_No_Filter_result.length > 0 && - String(formedit_mode_activite) === "1" &&
    Assigné à (employé)
    - (data)._id === String(p_activite_employee_assigned_id))[0].label} - onChange={(event, value) => { - if (value && value._id) { - setp_activite_employee_assigned_id(value._id); - - } - }} - - renderInput={(params) => - } - /> - -
    } - - {String(formedit_mode_activite) !== "1" &&
    Assigné à (employé)
    - - - -
    } - - -
    - Détail
    - { - setp_activite_detail(e.target.value); - }} - /> - -
    - -
    -   -
    - {String(datamodification_activite) === "1" &&
    -
    /!\ Pensez à enregistrer les modifications
    } - - {String(formedit_mode_activite) === "1" &&
    -
    - -
    -
    - -
    -
    - } - - {String(formedit_mode_activite) !== "1" &&
    - -
    - -
    - -
    - -
    -
    - } - - -
    } - - {String(add_one_activite) === "1" &&
    -
    Description
    - setone_activite_description(e.target.value)} - - /> -
    - - - -
    - Date souhaitée 03
    - { - setone_activite_deadline(format(date, 'dd/MM/yyyy HH:mm:ss')); - - } - } - locale={'fr'} - showTimeSelect - timeFormat="HH:mm" - timeIntervals={15} - dateFormat="dd/MM/yyyy HH:mm" - is24Hour - className="disabled_style enable_style" - - /> - -
    - - -
    Type d'activité
    - - { - if (value && value.value) { - setone_activite_type(value.value); - } - }} - renderInput={(params) => - } - /> - - - -
    - -
    Statut
    - - { - if (value && value.value) { - setone_activite_status(value.value); - } - }} - renderInput={(params) => - } - /> - -
    - -
    Assigné à (employé)
    - - { - if (value && value._id) { - setp_activite_employee_assigned_id(value._id); - - } - }} - - renderInput={(params) => - } - /> - - -
    - -
    Détail
    - { - setone_activite_detail(e.target.value); - }} - /> - -
    - - - - -
    -   -
    - - -
    -
    - -
    -
    - -
    -
    - -
    } - -
    - - - - -
    -
     
    -
    */} +
    ) diff --git a/src/styles/index.scss b/src/styles/index.scss index 9f5b250..1ba27ab 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -243,4 +243,21 @@ .css-ka7ti6-MuiAutocomplete-root .MuiOutlinedInput-root .MuiAutocomplete-input { color: #0a2a4d !important; +} + +.css-igs3ac { + color: #0a2a4d !important; + font-size: small !important; + font-family: "DM Sans" !important; + border: solid #e8eef6 1px !important; +} + + + +.css-r01yff-MuiNotchedOutlined-root-MuiOutlinedInput-notchedOutline{ + color: #0a2a4d !important; + font-size: small !important; + font-family: "DM Sans" !important; + border: solid #e8eef6 1px !important; + } \ No newline at end of file