-
-
-
-
-
- Pièces jointes
-
-
-
-
+ {/*
{Get_List_Of_All_PJ_result &&
- Liste des pièces jointes
+
Liste des pièces jointes
{Get_List_Of_All_PJ_result && Get_List_Of_All_PJ_result.map((val) => (
-
-
Télécharger {(JSON.parse(val).file_business_object)}
+
+
{(JSON.parse(val).file_business_object)} Télécharger
+
Supprimer
+
+
+ }
+ modal
+ nested
+ position="center center"
+ >
+ {close => (
+
+
+ ×
+
+
MySy Information
+
+ {' '}
+
+ En confirmant cette opération, la pièce jointe sera définitivement supprimée .
+
+
+
+
+
+ {
+
+ // Delete_one_attached_document(event);
+ close();
+ }}
+ name={(JSON.parse(val).file_name)} id={(JSON.parse(val).file_name)}
+ > Valider
+
+
+
+ {
+ //console.log('modal closed ');
+ close();
+ }}
+ >
+ Annuler
+
+
+
+
+ )}
+
))}
}
+
*/}
-
-
+
diff --git a/src/components/Modules_Mes_Documents_old.js b/src/components/Modules_Mes_Documents_old.js
new file mode 100644
index 0000000..08c3e1f
--- /dev/null
+++ b/src/components/Modules_Mes_Documents_old.js
@@ -0,0 +1,1397 @@
+import React, { useRef, useState, useEffect } from "react";
+import TextField from '@mui/material/TextField';
+import MenuItem from '@mui/material/MenuItem';
+import 'react-confirm-alert/src/react-confirm-alert.css'; // Import css
+import Button from '@mui/material/Button';
+import axios from "axios";
+import { useParams } from 'react-router-dom';
+import { getCookie, setCookie } from 'react-use-cookie';
+import { useHistory } from "react-router-dom";
+
+import {
+ DataGrid, frFR, GridToolbar,
+
+} from '@mui/x-data-grid';
+import * as XLSX from 'xlsx';
+
+import "react-draft-wysiwyg/dist/react-draft-wysiwyg.css";
+import 'react-tooltip/dist/react-tooltip.css'
+import { Tooltip } from 'react-tooltip'
+import fileDownload from 'js-file-download'
+
+import 'reactjs-popup/dist/index.css';
+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 InputAdornment from '@mui/material/InputAdornment';
+import { AiFillCloseCircle } from "react-icons/ai";
+import Box from '@mui/material/Box';
+import { MdAddCircleOutline, MdRemoveCircleOutline } from "react-icons/md";
+import Autocomplete from '@mui/material/Autocomplete';
+import img_loading_spin from "./../mysy_img/mysy_spin_loading.gif";
+
+import Link from '@mui/material/Link';
+import { PiDotsThree } from "react-icons/pi";
+import { gridClasses } from '@mui/x-data-grid';
+import {
+ GridToolbarContainer, GridToolbarExport, GridToolbarColumnsButton,
+ GridToolbarFilterButton, GridToolbarDensitySelector, GridToolbarExportContainer, useGridApiContext,
+ gridFilteredSortedRowIdsSelector,
+ gridVisibleColumnFieldsSelector,
+ GridValueGetterParams,
+ GridPreferencePanelsValue,
+
+} from '@mui/x-data-grid';
+import AttachFileIcon from '@mui/icons-material/AttachFile';
+//import { utils, writeFileXLSX } from "xlsx";
+import { IconButton } from '@material-ui/core';
+import MoreVertIcon from '@mui/icons-material/MoreVert';
+import Menu from '@mui/material/Menu';
+
+const Modules_Mes_Documents_old = (props) => {
+ registerLocale('fr', fr);
+ const { action, orderid } = useParams();
+
+
+ const history = useHistory();
+ const [submenu, setsubmenu] = useState("");
+ const [rowss, setRows] = useState([]);
+ const [rowss_total_data, setRows_total_data] = useState([]);
+ const [selectionModel, setSelectionModel] = React.useState([]);
+
+ const [myprops_type_document, setmyprops_type_document] = React.useState("");
+
+ const [rows_invoice_lines, setrows_invoice_lines] = useState([]);
+ const [selectionModel_invoice_lines, setselectionModel_invoice_lines] = React.useState([]);
+ const [gridline_id, setgridline_id] = useState("");
+ var date_today_90j = new Date();
+ date_today_90j.setDate(date_today_90j.getDate() + 90);
+
+ const [p_filtre1, setp_filtre1] = useState("");
+ const [p_filtre1_value, setp_filtre1_value] = useState();
+
+ const [p_filtre2, setp_filtre2] = useState("");
+ const [p_filtre2_value, setp_filtre2_value] = useState();
+
+ const [p_filtre3, setp_filtre3] = useState("");
+ const [p_filtre3_value, setp_filtre3_value] = useState();
+
+ const [p_filtre4, setp_filtre4] = useState("");
+ const [p_filtre4_value, setp_filtre4_value] = useState();
+
+ function ExpandableCell_50({ value }) {
+ const [expanded, setExpanded] = React.useState(false);
+
+ return (
+
+ {value &&
+
+ {expanded ? value : String(value).slice(0, 50)}
+ {value.length > 50 && (
+ // eslint-disable-next-line jsx-a11y/anchor-is-valid
+
setExpanded(!expanded)}
+ >
+ {expanded ?
Réduire :
Voir }
+
+ )}
+
}
+
+ {!value &&
+
+
+ }
+
+ );
+ }
+
+
+ const options_menu_vertical = [
+ '',
+ 'Télécharger',
+ ];
+
+ const ITEM_HEIGHT = 48;
+ const [anchorEl, setAnchorEl] = React.useState(null);
+ const open = Boolean(anchorEl);
+ const handleClick_option_button_vertical = (event) => {
+ setAnchorEl(event.currentTarget);
+ };
+ const handleClose_option_button_vertical = (event, value) => {
+ setAnchorEl(null);
+ };
+
+
+ const columns = [
+ { field: '_id', headerName: '_id', hide: true, editable: false },
+ { field: 'id', headerName: 'id', hide: true, editable: false },
+ { field: 'file_extention', hide: true, editable: false },
+ { field: 'file_name', headerName: 'tech_file_name', hide: true, disableExport: true },
+ {
+ field: 'creation_date', headerName: 'Date Création', Width: 100, flex: 1, hide: false, editable: false,
+ renderCell: (cellValues) => {
+ return (
+
+
+ {String(cellValues.row.creation_date).substring(0, 10)}
+ )
+ },
+
+ },
+ { field: 'file_business_object', headerName: 'Nom Fichier', minWidth: 200, flex: 1, hide: false, editable: false, },
+ { field: 'object_owner_collection', headerName: 'System_Pro', minWidth: 200, flex: 1, hide: true, editable: false },
+ { field: 'client_raison_sociale', headerName: 'Client Raison Soc.', minWidth: 200, flex: 1, hide: true, editable: false },
+ { field: 'client_nom', headerName: 'Client Nom', minWidth: 150, flex: 1, hide: false, editable: false },
+ {
+ field: 'type_document', headerName: 'Type doc.', minWidth: 100, flex: 1, hide: false, editable: false,
+ renderCell: (cellValues) => {
+ return (
+
+
+ {String(cellValues.row.type_document).charAt(0).toUpperCase() + String(cellValues.row.type_document).slice(1)}
+ )
+ },
+
+ },
+ {
+ field: 'bton_vertif', headerName: 'Gestion', minWidth: 50, flex: 1, maxWidth: 100, hideable: true, hide: false, editable: false, align: "center",
+ renderCell: (cellValues,) => {
+ return (
+
+
+
+
+ {
+ handleClick_option_button_vertical(e);
+
+ setprint_doc_id(cellValues.row._id);
+ setprint_file_extention(cellValues.row.file_extention);
+ setprint_file_business_object(cellValues.row.file_business_object);
+
+ }}
+ >
+
+
+
+
+
+ );
+ },
+ },
+ ]
+
+
+ const [print_doc_id, setprint_doc_id] = useState("");
+ const [print_file_extention, setprint_file_extention] = useState("");
+ const [print_file_business_object, setprint_file_business_object] = useState("");
+
+ function print_document_pdf(doc_id, file_extention, file_business_object) {
+ var user_cookie = getCookie('tokenmysych');
+ var part_cookie = getCookie('tokenmysypart');
+
+
+ var stored_cookie = "";
+
+ if (props.type_user_connected && String(props.type_user_connected) === "partner_account")
+ stored_cookie = part_cookie;
+ else if (props.type_user_connected && String(props.type_user_connected) === "user_account")
+ stored_cookie = user_cookie;
+
+
+ var nom_fichier_cmd = String(file_business_object) + "." + String(file_extention);
+ console.log(" nom_fichier_cmd = ", nom_fichier_cmd, " --- doc_id = ", doc_id);
+
+ var url = process.env.REACT_APP_API_URL + "myclass/api/Get_Stored_Downloaded_File_From_Id/" + stored_cookie + "/" + doc_id;
+
+ //console.log(" nom_fichier_cmd = ", nom_fichier_cmd, " --- selected_id = ", selected_id, " --- url =", url);
+
+ axios.get(url, { responseType: 'blob', },)
+ .then((res) => {
+ fileDownload(res.data, nom_fichier_cmd)
+ }).catch((error) => {
+ console.error('Error:', error);
+
+ });
+ }
+
+ const [isLoading, setLoading] = useState();
+
+
+ const [p_detail_header_client_nom_id, setp_detail_header_client_nom_id] = useState();
+
+
+
+ const myRef = useRef(null);
+
+ const [history_securite_read, sethistory_securite_read] = useState("");
+
+ const autorized_type_document = ['devis', 'convention', 'convocation', 'attestation'];
+
+ const [New_Get_List_Ent_Session_Promotion_result, setNew_Get_List_Ent_Session_Promotion_result] = useState([]);
+
+ const [Get_List_Ent_Session_Promotion_api, setGet_List_Ent_Session_Promotion_api] = useState();
+ const [Get_List_Ent_Session_Promotion_message, setGet_List_Ent_Session_Promotion_message] = useState();
+ const [Get_List_Ent_Session_Promotion_result, setGet_List_Ent_Session_Promotion_result] = useState();
+ function Get_List_Ent_Session_Promotion(event) {
+
+ var form = new FormData();
+ const stored_cookie = getCookie('tokenmysych');
+ const stored_apprenant_id = getCookie('tokenmysychapprenant');
+
+ form.append("token", stored_cookie);
+ form.append("apprenant_id", stored_apprenant_id);
+
+
+ var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Ent_Student_List_Session_Promotion/";
+
+ setLoading(true);
+ axios.post(myurl, form).then(res => {
+ //console.log(" In Get_List_Ent_Session_Promotion res.data.status = " + res.data.status);
+ // console.log(" In Get_List_Ent_Session_Promotion res.data.message r_class = " + res.data.message);
+
+ setLoading(false);
+
+ if (String(res.data.status) === String("true")) {
+ setGet_List_Ent_Session_Promotion_api("true");
+ setGet_List_Ent_Session_Promotion_result(res.data.message);
+
+ var new_data2 = [];
+ const new_data = res.data.message.map((x) => {
+
+ //---
+ var localid = JSON.parse(x).id;
+ var inscription_id = JSON.parse(x).inscription_id;
+ var session_id = JSON.parse(x).session_id;
+ var session_code_session = JSON.parse(x).session_code_session;
+ var session_titre = JSON.parse(x).session_titre;
+ var session_date_du = JSON.parse(x).session_date_du;
+ var session_date_au = JSON.parse(x).session_date_au;
+ var class_id = JSON.parse(x).class_id;
+ var class_title = JSON.parse(x).class_title;
+
+ //---
+ var node = {
+ "id": localid,
+ "label": session_code_session + " " + session_titre + " - " + session_date_du + " au " + session_date_au,
+ "inscription_id": inscription_id,
+ "session_id": session_id,
+ "session_code_session": session_code_session,
+ "session_titre": session_titre,
+ "session_date_du": session_date_du,
+ "session_date_au": session_date_au,
+ "class_id": class_id,
+ "class_title": class_title,
+
+ };
+ new_data2.push(node);
+ });
+
+ var node = {
+ "id": "",
+ "label": "",
+ "inscription_id": "",
+ "session_id": "",
+ "session_code_session": "",
+ "session_titre": "",
+ "session_date_du": "",
+ "session_date_au": "",
+ "class_id": "",
+ "class_title": "",
+
+ };
+ new_data2.push(node);
+
+ if (new_data2.length > 0)
+ setNew_Get_List_Ent_Session_Promotion_result(new_data2);
+
+ }
+ else if (String(res.data.status) === String("Err_Connexion")) {
+ alert('Erreur: ' + res.data.message);
+ history.push("/ent_student");
+ }
+ else {
+ setGet_List_Ent_Session_Promotion_api("false");
+ setGet_List_Ent_Session_Promotion_message(res.data.message);
+ alert('Erreur: ' + res.data.message);
+ }
+
+ }).catch((error) => {
+ setLoading(false);
+ console.warn('Not good man :( Get_List_Ent_Session_Promotion = ', error);
+ setGet_List_Ent_Session_Promotion_api("false");
+ alert('Erreur: Impossible de recuperer la liste des promotions et sessions');
+ })
+ }
+
+
+ useEffect(() => {
+
+ Get_List_Ent_Session_Promotion();
+ window.scrollTo({
+ top: 0,
+ behavior: "smooth",
+ });
+
+ }, [])
+
+ const [display_detail_invoice, setdisplay_detail_invoice] = React.useState();
+
+ const myRef_head = useRef(null);
+ const [selected_id, setselected_id] = useState("");
+ const [selected_order_line_id, setselected_order_line_id] = useState("");
+ const [selected_order_header_type, setselected_order_header_type] = useState();
+
+ const [order_internal_ref, setorder_internal_ref] = useState("");
+ const [invoice_internal_ref, setinvoice_internal_ref] = useState("");
+
+
+ function submenu_color_management(current_menu) {
+ const list_sous_menu = ["order_header_facturation", "order_header_detail", "order_header_main", "order_header_detail", "paiement"]
+
+ 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";
+ }
+
+ }
+
+ const sleep = (milliseconds) => {
+ return new Promise(resolve => setTimeout(resolve, milliseconds))
+ }
+
+
+ function print_invoice_pdf() {
+ var user_cookie = getCookie('tokenmysych');
+ var part_cookie = getCookie('tokenmysypart');
+
+
+ var stored_cookie = "";
+
+ if (props.type_user_connected && String(props.type_user_connected) === "partner_account")
+ stored_cookie = part_cookie;
+ else if (props.type_user_connected && String(props.type_user_connected) === "user_account")
+ stored_cookie = user_cookie;
+
+ var nom_fichier_cmd = "Facture_" + invoice_internal_ref + ".pdf";
+ // console.log(" nom_fichier_cmd = ", nom_fichier_cmd, " --- selected_id = ", selected_id);
+
+ var url = process.env.REACT_APP_API_URL + "myclass/api/GerneratePDF_Partner_Invoice/" + stored_cookie + "/" + selected_id;
+
+ //console.log(" nom_fichier_cmd = ", nom_fichier_cmd, " --- selected_id = ", selected_id, " --- url =", url);
+
+ axios.get(url, { responseType: 'blob', },)
+ .then((res) => {
+ fileDownload(res.data, nom_fichier_cmd)
+ }).catch((error) => {
+ console.error('Error:', error);
+
+ });
+ }
+
+
+
+
+ function clean_all_filters() {
+ setp_filtre1("");
+ setp_filtre1_value();
+
+ setp_filtre2("");
+ setp_filtre2_value();
+
+ setp_filtre3("");
+ setp_filtre3_value();
+
+ setp_filtre4("");
+ setp_filtre4_value();
+
+ clean_order_detail_fields();
+ setsubmenu();
+
+ setSelectionModel([]);
+
+ setgridline_id("");
+
+ Get_List_Of_All_PJ();
+
+ }
+
+ function clean_order_detail_fields() {
+
+ }
+
+ const [Dialog_Detail_Article_open, setDialog_Detail_Article_open] = React.useState(false);
+
+ const Close_Dialog_Detail_Article_open = () => {
+
+ setDialog_Detail_Article_open(false);
+ };
+
+ const Dialog_1_handleClose = () => {
+ //alert(" Utiliser le bouton 'fermer' ");
+ //setOpen(false);
+ };
+
+ const Dialog_1_handleClose_buton = () => {
+ setDialog_1_open(false);
+ };
+
+ const [Dialog_1_open, setDialog_1_open] = React.useState(false);
+
+
+
+
+
+
+ const [Dialog_annotation_1_message, setDialog_annotation_1_message] = React.useState(false);
+ const [Dialog_annotation_1_open, setDialog_annotation_1_open] = React.useState(false);
+
+ function Dialog_1_handle_change_annotation(message) {
+ setDialog_annotation_1_message(message);
+ setDialog_annotation_1_open(true);
+ }
+
+ const Dialog_annotation_1_handleClose = () => {
+ //alert(" Utiliser le bouton 'fermer' ");
+ //setOpen(false);
+ };
+
+ const Dialog_annotation_1_handleClose_buton = () => {
+
+ setDialog_annotation_1_open(false);
+
+ /* if (document.getElementById('myRef')) {
+ var divh = document.getElementById('myRef').offsetTop;
+ window.scrollTo({
+ top: divh,
+ behavior: "smooth",
+ });
+ }*/
+
+ };
+
+
+
+ const New_Option_Filter = [
+ { "id": "filter_file_business_object", "label": "Nom Document", "value": "filter_file_business_object" },
+ { "id": "filter_type_document", "label": "Type Document", "value": "filter_type_document" },
+ { "id": "filter_nom_client", "label": "Nom Client", "value": "filter_nom_client" },
+ { "id": "date_creation", "label": "Date Création (jj/mm/aaaa) ", "value": "date_creation" },
+ /*{ "id": "filter_formation_external_code", "label": "Lié a la Formation (code externe)", "value": "filter_formation_external_code" },
+ { "id": "filter_session_code", "label": "Lié a la session (code session)", "value": "filter_session_code" },*/
+ { "id": "", "label": "", "value": "" },
+ { "id": "1", "label": "", "value": "1" }, // Cette ligne pour couvrir l'ajout d'une ligne de filter. C'est fait expres.
+ ]
+
+
+
+
+ const Option_Type_Document = [
+ { "id": "devis", "label": "Devis", "value": "devis" },
+ { "id": "convention", "label": "Convention", "value": "convention" },
+ { "id": "convocation", "label": "Convocation", "value": "convocation" },
+ { "id": "attestation", "label": "Attestation", "value": "attestation" },
+ { "id": "autre", "label": "Autre", "value": "autre" },
+ { "id": "alltypedocument", "label": "Tous les types", "value": "alltypedocument" },
+ { "id": "", "label": "", "value": "" },
+ { "id": "1", "label": "", "value": "1" }, // Cette ligne pour couvrir l'ajout d'une ligne de filter. C'est fait expres.
+ ]
+
+
+ function handleClick_menu_droite_facture(e) {
+ console.log(" III ");
+ }
+
+ const New_type_apprenant = [
+ { "id": "0", "label": "Autre", "value": "0" },
+ { "id": "1", "label": "Salariés", "value": "1" },
+ { "id": "2", "label": "Apprentis", "value": "2" },
+ { "id": "3", "label": "Particuliers", "value": "3" },
+ { "id": "4", "label": "Rech. Emploi", "value": "4" },
+ { "id": "", "label": "", "value": "" },
+ ]
+
+
+ // 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) => {
+ 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 [Dialog_send_invoice_with_PJ_message, setDialog_send_invoice_with_PJ_message] = React.useState(false);
+ const [Dialog_send_invoice_with_PJ_open, setDialog_send_invoice_with_PJ_open] = React.useState(false);
+ function Dialog_send_invoice_with_PJ_handle_change_participant_session(message) {
+ setDialog_send_invoice_with_PJ_message(message);
+ setDialog_send_invoice_with_PJ_open(true);
+ }
+
+
+ const [tab_invoice_mail_pieces_jointes_result, settab_invoice_mail_pieces_jointes_result] = useState([]);
+
+ const [Dialog_invoice_history_message, setDialog_invoice_history_message] = React.useState(false);
+ const [Dialog_invoice_history_open, setDialog_invoice_history_open] = React.useState(false);
+ function Dialog_invoice_history_handle_change_participant_session(message) {
+ setDialog_invoice_history_message(message);
+ setDialog_invoice_history_open(true);
+ }
+
+ const Dialog_invoice_history_handleClose = () => {
+ //alert(" Utiliser le bouton 'fermer' ");
+ //setOpen(false);
+ };
+
+ const Dialog_invoice_history_handleClose_buton = () => {
+ setDialog_invoice_history_open(false);
+ settab_invoice_mail_pieces_jointes_result([]);
+
+ if (document.getElementsByName("invoice_history_bton") && document.getElementsByName("invoice_history_bton")[0]) {
+ document.getElementsByName("invoice_history_bton")[0].style.backgroundColor = "#d8edfc";
+ document.getElementsByName("invoice_history_bton")[0].style.color = "#3b3e40";
+ }
+ };
+
+ 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_selected_inscription_id) {
+
+ var form = new FormData();
+
+ const formData = new FormData();
+ const stored_cookie = getCookie('tokenmysych');
+
+ formData.append("token", stored_cookie);
+ formData.append("object_owner_collection", "inscription");
+ formData.append("object_owner_id", local_selected_inscription_id);
+ formData.append("apprenant_id", props.apprenant_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_Ent_Student_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");
+
+ setRows(result['message']);
+
+
+ }
+ 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");
+ });
+
+ }
+
+ // -- 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('tokenmysych');
+
+
+ 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_Ent_Student_Stored_Downloaded_File/" + token + "/" + file_name + "/" + props.apprenant_id;
+
+ 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 [Get_All_Documents_With_Filter_api, setGet_All_Documents_With_Filter_api] = useState();
+ const [Get_All_Documents_With_Filter_message, setGet_All_Documents_With_Filter_message] = useState();
+ const [Get_All_Documents_With_Filter_result, setGet_All_Documents_With_Filter_result] = useState();
+ function Get_All_Documents_With_Filter() {
+
+
+ setgridline_id("");
+
+ var form = new FormData();
+ var user_cookie = getCookie('tokenmysych');
+ var part_cookie = getCookie('tokenmysypart');
+
+
+ var stored_cookie = "";
+
+ if (props.type_user_connected && String(props.type_user_connected) === "partner_account") {
+ stored_cookie = part_cookie;
+ }
+
+ else if (props.type_user_connected && String(props.type_user_connected) === "user_account") {
+ // vu que c'est un user, ajouter obligatorement le filtre : filter_object_owner_id
+ form.append("filter_object_owner_id", props.partner_client_id);
+ stored_cookie = user_cookie;
+ }
+
+ form.append("token", stored_cookie);
+
+ // Recuperation des parametres
+ var filtre1 = p_filtre1;
+ var filtre2 = p_filtre2;
+ var filtre3 = p_filtre3;
+
+
+ var filtre1_value = "";
+ var filtre2_value = "";
+ var filtre3_value = "";
+
+
+ // Recuperation des valeurs de filtres
+
+ if (p_filtre1 && String(p_filtre1) === "date_creation") {
+ form.append("date_create_start_date", String(p_date_du));
+ form.append("date_create_end_date", String(p_date_au));
+ }
+ else if (p_filtre1_value && p_filtre1 && String(p_filtre1) !== "date_creation") {
+ filtre1_value = p_filtre1_value;
+ form.append(filtre1, filtre1_value);
+ }
+
+ if (p_filtre2 && String(p_filtre2) === "date_creation") {
+ form.append("date_create_start_date", String(p_date_du));
+ form.append("date_create_end_date", String(p_date_au));
+ }
+ else if (p_filtre2 && String(p_filtre2) !== "date_creation") {
+ filtre2_value = p_filtre2_value;
+ form.append(filtre2, filtre2_value);
+ }
+
+ if (p_filtre3_value && p_filtre3 && String(p_filtre3) === "date_creation") {
+ form.append("date_create_start_date", String(p_date_du));
+ form.append("date_create_end_date", String(p_date_au));
+ }
+ else if (p_filtre3_value && p_filtre3 && String(p_filtre3) !== "date_creation") {
+ filtre3_value = p_filtre3_value;
+ form.append(filtre3, filtre3_value);
+ }
+
+
+ /*** Si le formulaire est appelé avec un type de document;
+ * on va forcer dans les argument un champ avec filter_type_document
+ */
+ if (props.type_document && autorized_type_document.includes(String(props.type_document))) {
+ form.delete("filter_type_document");
+ form.append("filter_type_document", props.type_document);
+ }
+
+
+ var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_object_owner_collection_Stored_Files_With_Filter/";
+
+ axios.post(myurl, form).then(res => {
+
+ if (String(res.data.status) === String("true")) {
+ //console.log(" In Get_All_Documents_With_Filter res.data.status = " + res.data.status);
+ // console.log(" In Get_All_Documents_With_Filter res.data.message r_class = " + res.data.message);
+ setGet_All_Documents_With_Filter_api("true");
+ setGet_All_Documents_With_Filter_result(res.data.message);
+ setRows(res.data.message);
+ //setRows_total_data(JSON.parse(res.data.total_data));
+ }
+ else {
+ setGet_All_Documents_With_Filter_api("false");
+ setGet_All_Documents_With_Filter_message(res.data.message);
+ alert(res.data.message);
+ }
+
+ }).catch((error) => {
+ console.warn('Not good man :( Get_All_Documents_With_Filter = ', error);
+ setGet_All_Documents_With_Filter_api("false");
+ alert(" Impossible de recuperer la liste des factures");
+ //setm yApimyApiMessage("")
+ })
+ }
+
+ const [p_date_du, setp_date_du] = useState(new Date().toLocaleDateString('fr-FR'));
+ const [p_date_au, setp_date_au] = useState(new Date().toLocaleDateString('fr-FR'));
+
+
+ const [selected_session_id, setselected_session_id] = useState("");
+ const [selected_inscription_id, setselected_inscription_id] = useState("");
+
+
+ return (
+
+
+ {isLoading &&
}
+
+ {props.my_title &&
{props.my_title} }
+ {!props.my_title &&
Tous vos documents }
+
+
Utilisez les filtres !
+
+
+
+
+ {New_Option_Filter && New_Option_Filter.length > 0 &&
(data).value === String(p_filtre1))[0].label}
+ options={New_Option_Filter}
+ onChange={(event, value) => {
+ if (value && value.value) {
+ setp_filtre1(value.value);
+ } else {
+ setp_filtre1("");
+ }
+
+ }}
+
+ renderInput={(params) =>
+ }
+ />}
+
+
+
+
+
+
+ {p_filtre1 && String(p_filtre1) !== "filter_type_document" && String(p_filtre1) !== "date_creation" &&
+
{ setp_filtre1_value(e.target.value); }}
+ InputProps={{
+ endAdornment: (
+
+ {
+ setp_filtre1_value("");
+ }} />
+
+ ),
+ }}
+
+ />
+
+ }
+
+ {p_filtre1 && String(p_filtre1) === "filter_type_document" &&
+ {
+ if (value && value.value) {
+ setp_filtre1_value(value.value);
+ } else {
+ setp_filtre1_value("");
+ }
+
+ }}
+
+ renderInput={(params) =>
+ }
+ />
+ }
+
+ {p_filtre1 && String(p_filtre1) === "date_creation" &&
+
+
+
+ {
+ setp_date_du(format(date, 'd/MM/yyyy'));
+
+ }
+ }
+ showTimeSelect={false}
+ dateFormat="dd/MM/yyyy"
+ className="disabled_style enable_style datepicker_complement"
+ locale={'fr'}
+
+ />
+
+
+
+ Au
+
+
+
+
+ {
+ setp_date_au(format(date, 'd/MM/yyyy'));
+
+ }
+ }
+ showTimeSelect={false}
+ dateFormat="dd/MM/yyyy"
+ className="disabled_style enable_style datepicker_complement"
+ locale={'fr'}
+
+ />
+
+
+
+ }
+
+
+
+
+ {p_filtre1 &&
}
+ {p_filtre1 &&
}
+
+
+
+
+ {p_filtre2 &&
+
+
+ {New_Option_Filter && New_Option_Filter.length > 0 &&
(data).value === String(p_filtre2))[0].label}
+ options={New_Option_Filter}
+ onChange={(event, value) => {
+ if (value && value.value) {
+ setp_filtre2(value.value);
+ }
+
+ }}
+
+ renderInput={(params) =>
+ }
+ />}
+
+
+ {String(p_filtre2).length > 2 && String(p_filtre2) !== "filter_type_document" &&
+
setp_filtre2_value(e.target.value)}
+ InputProps={{
+ endAdornment: (
+
+ {
+ setp_filtre2_value("");
+ }} />
+
+ ),
+ }}
+
+ />}
+
+ {String(p_filtre2).length > 2 && String(p_filtre2) === "filter_type_document" &&
+ {
+ if (value && value.value) {
+ setp_filtre2_value(value.value);
+ } else {
+ setp_filtre2_value("");
+ }
+
+ }}
+
+ renderInput={(params) =>
+ }
+ />}
+
+
+
+ {String(p_filtre2).length > 2 &&
}
+
+ {String(p_filtre2).length > 2 &&
}
+
+
+ }
+
+
+ {p_filtre3 &&
+
+
+ {New_Option_Filter && New_Option_Filter.length > 0 &&
(data).value === String(p_filtre3))[0].label}
+ options={New_Option_Filter}
+ onChange={(event, value) => {
+ if (value && value.value) {
+ setp_filtre3(value.value);
+
+ }
+
+ }}
+
+ renderInput={(params) =>
+ }
+ />}
+
+
+
+ {String(p_filtre3).length > 2 && String(p_filtre3) !== "filter_type_document" &&
+
setp_filtre3_value(e.target.value)}
+ InputProps={{
+ endAdornment: (
+
+ {
+ setp_filtre3_value("");
+ }} />
+
+ ),
+ }}
+
+ />}
+
+ {String(p_filtre3).length > 2 && String(p_filtre3) === "filter_type_document" &&
+ {
+ if (value && value.value) {
+ setp_filtre3_value(value.value);
+ } else {
+ setp_filtre3_value("");
+ }
+
+ }}
+
+ renderInput={(params) =>
+ }
+ />}
+
+
+
+ {String(p_filtre2).length > 2 &&
}
+
+ {String(p_filtre3).length > 2 &&
}
+
+ }
+
+
+
+
+
+ Rechercher
+
+
+
+
+ Annuler
+
+
+
+
+
+
+
+
+
+
+
Choisir une Session ou une Promotion
+ {New_Get_List_Ent_Session_Promotion_result && New_Get_List_Ent_Session_Promotion_result.length > 0 &&
+
{
+ if (value && value.session_id) {
+ setselected_session_id(value.session_id);
+ setselected_inscription_id(value.inscription_id);
+ Get_List_Of_All_PJ( value.inscription_id);
+
+ } else {
+ setselected_session_id("");
+ setselected_inscription_id("");
+ setGet_List_Of_All_PJ_result([]);
+ }
+
+
+
+ }}
+ renderInput={(params) =>
+ }
+ />}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Pièces jointes
+
+
+
+
+
+ {Get_List_Of_All_PJ_result &&
+
+ Liste des pièces jointes
+
+ {Get_List_Of_All_PJ_result && Get_List_Of_All_PJ_result.map((val) => (
+
+ Télécharger {(JSON.parse(val).file_business_object)}
+
+
+
+ ))}
+
+
+
}
+
+
+
+
+
+
+
+ )
+}
+
+
+export default Modules_Mes_Documents_old;
diff --git a/src/components/Notes_Evaluation.js b/src/components/Notes_Evaluation.js
index aca1c8f..19cd1ec 100644
--- a/src/components/Notes_Evaluation.js
+++ b/src/components/Notes_Evaluation.js
@@ -56,39 +56,39 @@ import { makeStyles } from "@material-ui/core/styles";
import { IconButton } from '@material-ui/core';
function PaperComponent(props) {
- return (
-
-
-
- );
+ return (
+
+
+
+ );
}
const useStyles = makeStyles((theme) => ({
- dialog: {
- position: 'absolute',
- // left: 10,
- top: 400
- },
+ dialog: {
+ position: 'absolute',
+ // left: 10,
+ top: 400
+ },
- paper: {
- overflowY: 'unset',
- },
- customizedButton: {
- position: 'absolute',
- left: '98%',
- top: '-3%',
- backgroundColor: 'lightgray',
- color: 'gray',
- },
+ paper: {
+ overflowY: 'unset',
+ },
+ customizedButton: {
+ position: 'absolute',
+ left: '98%',
+ top: '-3%',
+ backgroundColor: 'lightgray',
+ color: 'gray',
+ },
}));
const Notes_Evaluation = (props) => {
registerLocale('fr', fr);
- const classes = useStyles();
+ const classes = useStyles();
const history = useHistory();
const [submenu, setsubmenu] = useState("");
const [rowss, setRows] = useState([]);
@@ -547,6 +547,10 @@ const Notes_Evaluation = (props) => {
{ field: 'groupe', headerName: 'groupe', flex: 1, hide: false, minWidth: 180, renderCell: (params) =>
, },
{ field: 'note', headerName: 'Note', width: 200, editable: Boolean(props.check_user_acces_right("note_evaluation", "write")), renderCell: (params) =>
, align: "center", },
+ {
+ field: 'publish', headerName: 'Publié (ENT)', width: 100, hide: false, editable: false, type: 'boolean',
+
+ },
{ field: 'convocation_send_date', headerName: 'Conv. Envoyé', width: 200, editable: false, renderCell: (params) =>
, align: "center", },
{ field: 'convocation_send_type', headerName: 'Conv. Par', width: 200, editable: false, renderCell: (params) =>
, align: "center", },
@@ -1107,6 +1111,7 @@ const Notes_Evaluation = (props) => {
var local_prenom = JSON.parse(x).prenom;
var local_email = JSON.parse(x).email;
var local_note = JSON.parse(x).note;
+ var local_publish = JSON.parse(x).publish;
var local_inscription_id = JSON.parse(x).inscription_id;
var local_group_inscription_id = JSON.parse(x).group_inscription_id;
@@ -1123,6 +1128,7 @@ const Notes_Evaluation = (props) => {
"prenom": local_prenom,
"email": local_email,
"note": local_note,
+ "publish": local_publish,
"note_changed": "0",
"inscription_id": local_inscription_id,
"group_inscription_id": local_group_inscription_id,
@@ -1142,6 +1148,7 @@ const Notes_Evaluation = (props) => {
"prenom": "",
"email": "",
"note": "",
+ "publish": "",
"note_changed": "0",
"inscription_id": "",
"group_inscription_id": "",
@@ -2358,6 +2365,15 @@ const Notes_Evaluation = (props) => {
setDialog_CONVOCATION_EVAL_open(true);
setactionmass_eval_inscr_val("");
}
+
+ if (String(actionmass_eval_inscr_val) === String("publish_note")) {
+ Publish_ENT_Evaluation_Participants_Notes(tab_mongo_preins_ids, "1"); // zzzzzzzzzzzzzzzzzz
+ setactionmass_eval_inscr_val("");
+ }
+ if (String(actionmass_eval_inscr_val) === String("un_publish_note")) {
+ Publish_ENT_Evaluation_Participants_Notes(tab_mongo_preins_ids, "0"); // zzzzzzzzzzzzzzzzzz
+ setactionmass_eval_inscr_val("");
+ }
}
const [actionmass_eval_inscr_val, setactionmass_eval_inscr_val] = useState();
@@ -2365,6 +2381,8 @@ const Notes_Evaluation = (props) => {
const New_Option_PreInscription = [
{ "id": "send_convocation", "label": "Envoyer Convocation", "value": "send_convocation" },
+ { "id": "publish_note", "label": "Publier les notes sur l'ENT", "value": "publish_note" },
+ { "id": "un_publish_note", "label": "De-publier les notes sur l'ENT", "value": "un_publish_note" },
{ "id": "delete_inscr", "label": "Supprimer", "value": "delete_inscr" },
{ "id": "", "label": "", "value": "" },
]
@@ -2429,6 +2447,65 @@ const Notes_Evaluation = (props) => {
})
}
+
+ const [Publish_ENT_Evaluation_Participants_Notes_api, setPublish_ENT_Evaluation_Participants_Notes_api] = useState();
+ const [Publish_ENT_Evaluation_Participants_Notes_message, setPublish_ENT_Evaluation_Participants_Notes_message] = useState();
+ const [Publish_ENT_Evaluation_Participants_Notes_result, setPublish_ENT_Evaluation_Participants_Notes_result] = useState([]);
+ function Publish_ENT_Evaluation_Participants_Notes(selected_note_lines_id, local_publish_status) {
+ var form = new FormData();
+
+
+ const stored_cookie = getCookie('tokenmysypart');
+ form.append("token", stored_cookie);
+ form.append("evaluation_id", selected_id);
+ form.append("tab_inscription_id", selected_note_lines_id);
+ form.append("publish_status", local_publish_status);
+
+
+ var myurl = process.env.REACT_APP_API_URL + "myclass/api/Publish_Unpublish_Participant_Evaluation_Note/";
+
+ setLoading(true);
+ axios.post(myurl, form).then(res => {
+ // console.log(" In Publish_ENT_Evaluation_Participants_Notes res.data.status = " + res.data.status);
+ // console.log(" In Publish_ENT_Evaluation_Participants_Notes res.data.message r_class = " + res.data.message);
+
+ setLoading(false);
+ if (String(res.data.status) === String("true")) {
+
+ setnoted_changed("");
+ Getall_Evaluation_Participant_List(selected_id);
+ setselectionModel_evalutions_participant([]);
+ settab_convention_pieces_jointes_result([]);
+ // alert(res.data.message)
+ setdisplay_alert_mysy("1");
+ setalert_message(res.data.message);
+ setalert_type("success");
+
+
+ }
+ else {
+ setPublish_ENT_Evaluation_Participants_Notes_api("false");
+ setPublish_ENT_Evaluation_Participants_Notes_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('Publish_ENT_Evaluation_Participants_Notes : Not good man :( Publish_ENT_Evaluation_Participants_Notes = ' + error);
+ setPublish_ENT_Evaluation_Participants_Notes_api("false");
+ // alert(" Impossible de mettre à jour les données des participants ");
+ setdisplay_alert_mysy("1");
+ setalert_message(" Impossible de mettre à jour les données ");
+ setalert_type("error");
+
+ })
+ }
+
+
+
function OnchangeCellDataGrid(params) {
@@ -2455,12 +2532,30 @@ const Notes_Evaluation = (props) => {
tmp['prenom'] = (x).prenom;
tmp['email'] = (x).email;
tmp['groupe'] = (x).groupe;
+ tmp['publish'] = (x).publish;
tmp['note_changed'] = "1";
tmp['note'] = new_value;
return tmp;
}
+ if (String(num_line) === String(localid) && colomn === "publish") {
+ var tmp = {};
+ tmp['id'] = (x).id;
+ tmp['_id'] = (x)._id;
+ tmp['nom'] = (x).nom;
+ tmp['prenom'] = (x).prenom;
+ tmp['email'] = (x).email;
+ tmp['groupe'] = (x).groupe;
+
+ tmp['publish'] = new_value;
+
+ tmp['note_changed'] = "1";
+ tmp['note'] = (x).note;
+
+ return tmp;
+ }
+
var tmp = {};
tmp['id'] = (x).id;
@@ -2469,6 +2564,7 @@ const Notes_Evaluation = (props) => {
tmp['prenom'] = (x).prenom;
tmp['email'] = (x).email;
tmp['groupe'] = (x).groupe;
+ tmp['publish'] = (x).publish;
tmp['note_changed'] = (x).note_changed;
tmp['note'] = (x).note;
@@ -4511,7 +4607,7 @@ const Notes_Evaluation = (props) => {