recette2
cherif 2024-12-29 13:28:05 +01:00
parent 41873af9db
commit a6a62132b0
12 changed files with 224 additions and 76 deletions

View File

@ -35,7 +35,7 @@ import { Tooltip } from 'react-tooltip'
import Popup from 'reactjs-popup';
import 'reactjs-popup/dist/index.css';
import { FcCancel, FcApproval, FcAcceptDatabase, FcPrint } from "react-icons/fc";
function Abonnement(props) {
const [myApiResponse, setmyApiResponse] = useState("");

View File

@ -26,7 +26,7 @@ import Modules_Mes_Documents from "./Modules_Mes_Documents";
import Intranet_Mes_Stagiaires from "./Intranet_Mes_Stagiaires";
function Account() {
const [menu, setmenu] = useState("affichage");
const [menu, setmenu] = useState("mes_stagiaires");
const [cookie, setCookie, removeCookie] = useCookies(['tokenmysych']);
const [result, setResult] = useState("");
const [myApiResponse, setmyApiResponse] = useState("");

View File

@ -6040,7 +6040,7 @@ const DisplayPartnerSession = (props) => {
}
const [display_detail_insc, setdisplay_detail_insc] = React.useState();
const [getPartnerImages_api, setgetPartnerImages_api] = useState();
const [getPartnerImages_message, setgetPartnerImages_message] = useState();
const [getPartnerImages_result, setgetPartnerImages_result] = useState();

View File

@ -3670,11 +3670,11 @@ const options_menu_vertical = [
{rowss_total_data && rowss_total_data.length > 0 && rowss_total_data.map((val) => (<nav style={{ "textAlign": 'right', 'marginRight': '15px', "fontWeight": "600", "fontSize": "15px", "paddingTop": "2px" }}> {parseFloat(String(val.somme_header_ca_ht)).toLocaleString()} () / {val.nb_header_invoice} Factures </nav>))}
<div style={{ "border": "None" }}>
<div style={{ height: 550, width: '100%', paddingRight: '5px' }}>
<div style={{ height: 650, width: '100%', paddingRight: '5px' }}>
&nbsp;
<Box
sx={{
height: 500,
height: 600,
width: '100%',
paddingRight: '1px',

View File

@ -7887,11 +7887,11 @@ function ExportMenuItem(props) {
<div style={{ "border": "None", paddingRight: '10px' }}>
{(!display_stagiaire_with_alert || display_stagiaire_with_alert !== true) && <div style={{ height: 550, width: '100%', paddingRight: '5px' }}>
{(!display_stagiaire_with_alert || display_stagiaire_with_alert !== true) && <div style={{ height: 750, width: '100%', paddingRight: '5px' }}>
&nbsp;
<Box
sx={{
height: 500,
height: 600,
width: '100%',
paddingRight: '1px',
@ -8117,12 +8117,12 @@ function ExportMenuItem(props) {
</div>}
{(display_stagiaire_with_alert && display_stagiaire_with_alert === true) && <div style={{ height: 550, width: '100%', paddingRight: '5px' }}>
{(display_stagiaire_with_alert && display_stagiaire_with_alert === true) && <div style={{ height: 650, width: '100%', paddingRight: '5px' }}>
&nbsp;
<Box
sx={{
height: 500,
height: 600,
width: '100%',
paddingRight: '1px',
@ -10882,11 +10882,11 @@ function ExportMenuItem(props) {
<div className="session_data">
<div style={{ "border": "None", paddingRight: '10px' }}>
<div style={{ height: 550, width: '100%', paddingRight: '5px' }}>
<div style={{ height: 650, width: '100%', paddingRight: '5px' }}>
&nbsp;
<Box
sx={{
height: 500,
height: 650,
width: '100%',
paddingRight: '1px',

View File

@ -480,8 +480,7 @@ const Modules_Mes_Documents = (props) => {
{ "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_create_start_date", "label": "Crée après (jj/mm/aaaa) ", "value": "date_create_start_date" },
{ "id": "date_create_end_date", "label": "Crée avant (jj/mm/aaaa)", "value": "date_create_end_date" },
{ "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": "" },
@ -764,6 +763,10 @@ const Modules_Mes_Documents = (props) => {
const [Get_All_Documents_With_Filter_result, setGet_All_Documents_With_Filter_result] = useState();
function Get_All_Documents_With_Filter() {
console.log(" ### p_date_au = ", p_date_au, " ### p_date_du = ", p_date_du);
setgridline_id("");
var form = new FormData();
@ -795,19 +798,32 @@ const Modules_Mes_Documents = (props) => {
var filtre2_value = "";
var filtre3_value = "";
// Recuperation des valeurs de filtres
if (p_filtre1_value) {
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_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) {
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);
}
@ -822,8 +838,6 @@ const Modules_Mes_Documents = (props) => {
}
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 => {
@ -850,6 +864,9 @@ const Modules_Mes_Documents = (props) => {
})
}
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'));
/***
* IMPORTANT
* Ce module permet d'afficher et telecharger tous les documents qui sont dans la collection 'download_files', c'est à dire :
@ -905,7 +922,7 @@ const Modules_Mes_Documents = (props) => {
<div className="div_row_droite texte_area_filter_value" >
{p_filtre1 && String(p_filtre1) !== "filter_type_document" &&
{p_filtre1 && String(p_filtre1) !== "filter_type_document" && String(p_filtre1) !== "date_creation" &&
<TextField
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
required
@ -959,6 +976,54 @@ const Modules_Mes_Documents = (props) => {
/>
}
{p_filtre1 && String(p_filtre1) === "date_creation" &&
<div className="disabled_style autocomplete_float_right">
<div style={{ width: "45%", float: "left", textAlign: "left" }}>
<DatePicker
name="date_du"
id="date_du"
selected={new Date(moment(p_date_du, "DD/MM/YYYY"))}
onChange={(date) => {
setp_date_du(format(date, 'd/MM/yyyy'));
}
}
showTimeSelect={false}
dateFormat="dd/MM/yyyy"
className="disabled_style enable_style datepicker_complement"
locale='fr-FR'
/>
</div>
<div style={{ width: "5%", float: "left", textAlign: "center", paddingTop: "20px", fontSize: "12px" }}>
Au
</div>
<div style={{ width: "45%", float: "right", textAlign: "right" }}>
<DatePicker
name="date_du"
id="date_du"
selected={new Date(moment(p_date_au, "DD/MM/YYYY"))}
onChange={(date) => {
setp_date_au(format(date, 'd/MM/yyyy'));
}
}
showTimeSelect={false}
dateFormat="dd/MM/yyyy"
className="disabled_style enable_style datepicker_complement"
locale='fr-FR'
/>
</div>
</div>
}
</div>
{p_filtre1 && <div className='filter_bton_add'>
@ -1219,11 +1284,11 @@ const Modules_Mes_Documents = (props) => {
<div style={{ "border": "None" }}>
<div style={{ height: 550, width: '100%', paddingRight: '5px' }}>
<div style={{ height: 650, width: '100%', paddingRight: '5px' }}>
&nbsp;
<Box
sx={{
height: 500,
height: 600,
width: '100%',
paddingRight: '1px',

View File

@ -1284,7 +1284,7 @@ const Partner = (props) => {
if (String(res.data.status) === String("true")) {
setGetPartnerNameFromToken_api_result(true);
//console.log(" In GetPartnerNameFromToken res.data.status = " + res.data.status);
console.log(" In GetPartnerNameFromToken res.data.message = " + res.data.message);
// console.log(" In GetPartnerNameFromToken res.data.message = " + res.data.message);
setparntername(JSON.parse(res.data.message).nom);
setconntected_employee_email(JSON.parse(res.data.message).email);

View File

@ -41,6 +41,7 @@ import Module_Attestation_Formation from "./Module_Attestation_Formation";
import Module_Email_Management from "./Module_Email_Management";
import ReactPlayer from "react-player";
import ReactAudioPlayer from 'react-audio-player';
import AudioPlayer from 'react-audio-player';
import Paper from '@material-ui/core/Paper';
import { makeStyles } from '@material-ui/core/styles';
@ -51,7 +52,7 @@ import { IconButton } from '@material-ui/core';
import ReactDOM from 'react-dom';
import Draggable from 'react-draggable';
import img_loading_spin from "./../mysy_img/mysy_spin_loading.gif";
import { useDemoData } from '@mui/x-data-grid-generator';
import SignatureCanvas from 'react-signature-canvas';
@ -73,6 +74,7 @@ import * as XLSX from 'xlsx';
//import SpeechRecognition, { useSpeechRecognition } from 'react-speech-recognition';
import useSound from 'use-sound';
const useStyles = makeStyles((theme) => ({
paper: {
overflowY: 'unset',
@ -890,66 +892,120 @@ const TestUrl_New = (props) => {
setblob_recorded_file(audio.attributes.src.nodeValue);
console.log(" ### Envoie du fichier audio au server ");
send_audio_file_to_server_blob(audio.attributes.src.nodeValue);
};
async function send_audi_blob(e) {
const audioBlob = await fetch(blob_recorded_file).then((r) => r.blob());
const [collection_instruction_id, setcollection_instruction_id] = React.useState("");
async function send_audio_file_to_server_blob(file_audio) {
const audioBlob = await fetch(file_audio).then((r) => r.blob());
const audiofile = new File([audioBlob], "audiofile.mp3", {
type: "audio/mp3",
});
setLoading(true);
var formData = new FormData();
formData.append("file", audiofile);
var api_url = process.env.REACT_APP_API_URL + "myclass/api/mysy_openai_get_voice_file/";
/*
Verifier si on a une instruction en cours. si c'est le cas on fait appeler une api differente
*/
if (collection_instruction_id && String(collection_instruction_id).length > 5) {
console.log(" #### une instruction est en cours : _id = ", collection_instruction_id);
api_url = process.env.REACT_APP_API_URL + "myclass/api/mysy_openai_confirme_voice_instruction_api/";
formData.append("instruction_id", collection_instruction_id);
const stored_cookie = getCookie('tokenmysypart');
formData.append("token", stored_cookie);
// On efface l'_id de l'instruction en cours
setcollection_instruction_id("");
console.log(" #### formData = ", formData);
}
fetch(
process.env.REACT_APP_API_URL + "myclass/api/Get_Audio_File/",
api_url,
{
method: 'POST',
body: formData,
}
).then((response) => response.json())
.then((result) => {
//console.log('Success:', result['message']);
setLoading(false);
console.log('send_audio_file_to_server_blob status == :', result['status']);
console.log('send_audio_file_to_server_blob message == :', result['message']);
console.log('send_audio_file_to_server_blob collection_instruction_id == :', result['collection_instruction_id']);
console.log('send_audio_file_to_server_blob result == :', result);
//setisimgSelected(false);
if (String(result['status']) === "true") {
//alert(" L'instruction a été correctement transferée au serveur");
if (JSON.parse(result['message']).document_mp3) {
var document_mp3 = "data:audio/mp3;base64," + JSON.parse(result['message']).document_mp3;
let local_audio_file = new Audio(document_mp3);
local_audio_file.play();
}
if (result['collection_instruction_id']) {
setcollection_instruction_id(result['collection_instruction_id']);
}else{
setcollection_instruction_id("");
}
} else {
alert(" ERRR : L'instruction N'a PAS été correctement transferée au serveur");
}
})
.catch((error) => {
setLoading(false);
console.error('Error - send_audi_blob:');
// setisimgSelected(true);
});
};
const [audi_file, setaudi_file] = React.useState("");
const audioRef = useRef(null);
function Get_and_launch_audio_file() {
var filedetail = "audio.mp3"
var url = process.env.REACT_APP_API_URL + "myclass/api/mysy_openai_get_voice_file/";
var url = process.env.REACT_APP_API_URL + "myclass/api/send_mysy_openai_to_voice_file/";
axios.post(url).then(res => {
var fileName = "cherifffff.mp3";
axios.get(url, { responseType: 'blob', },)
.then((res) => {
fileDownload(res.data, filedetail);
if (String(res.data.status) === "true") {
if (JSON.parse(res.data.message).document_mp3) {
var document_mp3 = "data:audio/mp3;base64," + JSON.parse(res.data.message).document_mp3;
let local_audio_file = new Audio(document_mp3);
local_audio_file.play();
const url = window.URL.createObjectURL(new Blob([res]));
const link = document.createElement("a");
link.href = url;
link.download = fileName || "downloaded-file";
document.body.appendChild(link);
}
console.log(" ### link = ", link);
} else {
// lire un message d'erreur
console.log(" returrrr FALSE");
}
link.click();
}).catch((error) => {
document.body.removeChild(link);
window.URL.revokeObjectURL(url);
console.warn('Get_and_launch_audio_file ee: Not good man :( = ', error);
})
})
}
let audio = new Audio("/audio2.mp3");
const lecture_fichier_local = () => {
audio.play()
}
const [blob_recorded_file, setblob_recorded_file] = React.useState("");
const [playbackRate, setPlaybackRate] = React.useState(0.75);
@ -959,10 +1015,9 @@ const TestUrl_New = (props) => {
const handleClick_play = async () => {
console.log(" iiiiiiiiiiii ");
// var path = "blob:http://localhost:3009/5b14dae1-d402-47cd-b71b-fa3938563265";
// var path = "audio.mp3";
// var path = "blob:http://localhost:3009/5b14dae1-d402-47cd-b71b-fa3938563265";
// var path = "audio.mp3";
let path = require("./audio.mp3").default;
const audio = new Audio(path);
const audioPromise = audio.play();
@ -980,9 +1035,16 @@ const TestUrl_New = (props) => {
};
const [isLoading, setLoading] = useState();
return (
<div className="testurl_new">
{isLoading && <div className="loader-container">
<div className="mysy_spinner"> <img src={img_loading_spin} /> </div>
</div>}
<Helmet>
<title>testurl_new</title>
<meta name="description" content="{this.metaDetails.description}" />
@ -1170,42 +1232,37 @@ const TestUrl_New = (props) => {
</div>
))}
<button onClick={display_data}> display data </button>
<div>
<h2> enregistrement audio </h2> <br />
<AudioRecorder
onRecordingComplete={(blob) => addAudioElement(blob)}
recorderControls={recorderControls}
// downloadOnSavePress={true}
downloadFileExtension="mp3"
showVisualizer={true}
/>
< div >
<button onClick={lecture_fichier_local}>Playiiii</button>
</div >
<div style={{ width: '50%', margin: 'auto' }}>
collection_instruction_id = '{collection_instruction_id}' <br />
{ String(collection_instruction_id).length > 5 && <nav> Confirmation instruction en cours</nav>}
{ String(collection_instruction_id).length <= 5 && <nav> Enregistrer une instruction &nbsp;</nav>}
<AudioRecorder
onRecordingComplete={(blob) => addAudioElement(blob)}
recorderControls={recorderControls}
// downloadOnSavePress={true}
downloadFileExtension="mp3"
showVisualizer="false"
/>
</div>
<br />
<button onClick={recorderControls.stopRecording}>Stop recording</button>
<br />
file = {blob_recorded_file} <br />
<button onClick={send_audi_blob}> envoyer fichier</button><br />
<button onClick={send_audio_file_to_server_blob}> envoyer fichier</button><br />
<button onClick={Get_and_launch_audio_file}> recuperer un fichier audio yy</button><br />
<audio ref={audioRef} controls >
<source src="blob:audio.mp3" type="audio/mp3" />
Your browser does not support the audio element.
</audio>
aaa
<ReactAudioPlayer
src="blob:audio.mp3"
autoPlay={true}
controls
/> bb
<ReactAudioPlayer
src={"blob:audio.mp3"}
controls
preload="none"
/>

View File

@ -27,7 +27,7 @@
height: 100vh;
display: flex;
//justify-content: center;
align-items: center;
align-items: center;
left: -5%;
position: fixed;
z-index: 1;

View File

@ -2317,8 +2317,13 @@
// end media
.autocomplete_float_right{
.autocomplete_float_right {
float: right !important;
border: none;
}
.datepicker_complement{
margin: 0px !important;
}
.disabled_style_with_visualiser_icone {

View File

@ -10,7 +10,7 @@
padding-left: 5px !important;
}
@media screen and (max-width: 600px) {
.okUpdateData {
@ -2171,6 +2171,27 @@
// end media
.loader-container {
width: 100%;
height: 100vh;
display: flex;
//justify-content: center;
align-items: center;
left: -5%;
position: fixed;
z-index: 1;
top: 0px;
background: white;
background-color: transparent;
}
.mysy_spinner {
border-radius: 5px;
//border: 1px solid black;
opacity: 100%;
}
.css-1v4ccyo {
height: 3.5rem !important;
}