20/12/22 - 11h30

recette2
cherif 2022-12-20 11:47:42 +01:00
parent e4bd79b6ac
commit 7531b8d0c0
5 changed files with 329 additions and 50 deletions

48
package-lock.json generated
View File

@ -127,6 +127,9 @@
"semantic-ui-react": "^2.1.2",
"state-pool": "^0.6.0",
"styled-components": "^5.3.5",
"survey-core": "^1.9.64",
"survey-react": "^1.9.64",
"survey-react-ui": "^1.9.64",
"swr": "^1.2.1",
"use-global-state": "^0.1.2",
"victory": "^36.6.6",
@ -38797,6 +38800,30 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/survey-core": {
"version": "1.9.64",
"resolved": "https://registry.npmjs.org/survey-core/-/survey-core-1.9.64.tgz",
"integrity": "sha512-4ge3WRvfQptFDP940uTqOwe7VBpGuxVkp1I+gLzf1fvmW1f6I78vLvx4YILBwJhgBgz65CFR/9uGjic11AcznA=="
},
"node_modules/survey-react": {
"version": "1.9.64",
"resolved": "https://registry.npmjs.org/survey-react/-/survey-react-1.9.64.tgz",
"integrity": "sha512-i5KYjeL73SEjrz9dXgZ+k765w4w3rJnPX5uaF5CEkme1ru/Vv7OpJ8oFE06EPX0PfM4S9aT3FYOrpco8plMNZA==",
"peerDependencies": {
"react": "^16.5.0 || ^17.0.1 || ^18.1.0",
"react-dom": "^16.5.0 || ^17.0.1 || ^18.1.0"
}
},
"node_modules/survey-react-ui": {
"version": "1.9.64",
"resolved": "https://registry.npmjs.org/survey-react-ui/-/survey-react-ui-1.9.64.tgz",
"integrity": "sha512-1hON6NBMufUkpw55LT5IdOSMqs20EMlK0N1fAYSRgFRqDZjDWApkHzeiU2rYBjixHOpDhvnzT/3EeMsVVonyXA==",
"dependencies": {
"react": "^16.5.0 || ^17.0.1 || ^18.1.0",
"react-dom": "^16.5.0 || ^17.0.1 || ^18.1.0",
"survey-core": "*"
}
},
"node_modules/svg-parser": {
"version": "2.0.4",
"license": "MIT"
@ -67831,6 +67858,27 @@
"supports-preserve-symlinks-flag": {
"version": "1.0.0"
},
"survey-core": {
"version": "1.9.64",
"resolved": "https://registry.npmjs.org/survey-core/-/survey-core-1.9.64.tgz",
"integrity": "sha512-4ge3WRvfQptFDP940uTqOwe7VBpGuxVkp1I+gLzf1fvmW1f6I78vLvx4YILBwJhgBgz65CFR/9uGjic11AcznA=="
},
"survey-react": {
"version": "1.9.64",
"resolved": "https://registry.npmjs.org/survey-react/-/survey-react-1.9.64.tgz",
"integrity": "sha512-i5KYjeL73SEjrz9dXgZ+k765w4w3rJnPX5uaF5CEkme1ru/Vv7OpJ8oFE06EPX0PfM4S9aT3FYOrpco8plMNZA==",
"requires": {}
},
"survey-react-ui": {
"version": "1.9.64",
"resolved": "https://registry.npmjs.org/survey-react-ui/-/survey-react-ui-1.9.64.tgz",
"integrity": "sha512-1hON6NBMufUkpw55LT5IdOSMqs20EMlK0N1fAYSRgFRqDZjDWApkHzeiU2rYBjixHOpDhvnzT/3EeMsVVonyXA==",
"requires": {
"react": "^16.5.0 || ^17.0.1 || ^18.1.0",
"react-dom": "^16.5.0 || ^17.0.1 || ^18.1.0",
"survey-core": "*"
}
},
"svg-parser": {
"version": "2.0.4"
},

View File

@ -3,6 +3,25 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@dr.pogodin/react-global-state": "^0.6.5",
"@fortawesome/fontawesome": "^1.1.8",
"@fortawesome/fontawesome-free-solid": "^5.0.13",
"@fortawesome/fontawesome-svg-core": "^6.1.1",
"@fortawesome/free-brands-svg-icons": "^6.1.1",
"@fortawesome/free-regular-svg-icons": "^6.1.1",
"@fortawesome/free-solid-svg-icons": "^6.1.1",
"@fortawesome/react-fontawesome": "^0.1.18",
"@mantine/core": "^4.2.10",
"@mantine/hooks": "^4.2.10",
"@mantine/rte": "^4.2.10",
"@material-ui/core": "^4.12.4",
"@mui/icons-material": "^5.4.2",
"@mui/material": "^5.4.2",
"@mui/x-data-grid": "^5.5.1",
"@mui/x-date-pickers": "^5.0.0",
"@mui/x-date-pickers-pro": "^5.0.0",
"@stripe/react-stripe-js": "^1.12.0",
"@stripe/stripe-js": "^1.35.0",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.8.3",
@ -90,8 +109,6 @@
"react-social-login-buttons": "^3.6.0",
"react-stripe-elements": "^6.1.2",
"react-swipeable-views": "^0.14.0",
"web-vitals": "^2.1.4",
"react-time-picker": "^4.5.0",
"react-toastify": "^9.0.0",
"react-use-cookie": "^1.3.0",
@ -105,31 +122,16 @@
"semantic-ui-react": "^2.1.2",
"state-pool": "^0.6.0",
"styled-components": "^5.3.5",
"survey-core": "^1.9.64",
"survey-react": "^1.9.64",
"survey-react-ui": "^1.9.64",
"swr": "^1.2.1",
"use-global-state": "^0.1.2",
"victory": "^36.6.6",
"video-react": "^0.15.0",
"web-vitals": "^2.1.4",
"webpack-bundle-analyzer": "^4.5.0",
"wysiwyg": "^2.0.0",
"@mantine/core": "^4.2.10",
"@mantine/hooks": "^4.2.10",
"@mantine/rte": "^4.2.10",
"@material-ui/core": "^4.12.4",
"@mui/icons-material": "^5.4.2",
"@mui/material": "^5.4.2",
"@mui/x-data-grid": "^5.5.1",
"@mui/x-date-pickers": "^5.0.0",
"@mui/x-date-pickers-pro": "^5.0.0",
"@dr.pogodin/react-global-state": "^0.6.5",
"@fortawesome/fontawesome": "^1.1.8",
"@fortawesome/fontawesome-free-solid": "^5.0.13",
"@fortawesome/fontawesome-svg-core": "^6.1.1",
"@fortawesome/free-brands-svg-icons": "^6.1.1",
"@fortawesome/free-regular-svg-icons": "^6.1.1",
"@fortawesome/free-solid-svg-icons": "^6.1.1",
"@fortawesome/react-fontawesome": "^0.1.18",
"@stripe/react-stripe-js": "^1.12.0",
"@stripe/stripe-js": "^1.35.0"
"wysiwyg": "^2.0.0"
},
"scripts": {
"start": "react-scripts start",

View File

@ -75,8 +75,54 @@ const DisplayDetailClassAction = (props) => {
const stored_partner = cookie_part.tokenmysypart;
const stored_user = cookie.tokenmysych;
// Cette fonction verifier si le token de l'evaluation est valide
//si $action != 'information' et 'inscription', alors la valeur est forcement celle d'un token.
const [tokenEval_api, settokenEval_api] = useState();
const [tokenEval_message, settokenEval_message] = useState();
const [tokenEval_result, settokenEval_result] = useState();
function CheckEvaluationToken() {
var form = new FormData();
//form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA");
form.append("eval_token", action);
form.append("class_internal_url", classId);
var myurl = process.env.REACT_APP_API_URL + "myclass/api/MySyckeckEvaluationToken/";
axios.post(myurl, form).then(res => {
if (res.data.status != "false") {
console.log(" In tokenEval_trainingsession res.data.status = " + res.data.status);
console.log(" In tokenEval_trainingsession res.data.message r_class = " + res.data.message);
settokenEval_api("true");
settokenEval_result(res.data.message);
}
else {
settokenEval_api("false");
settokenEval_message(res.data.message);
}
}).catch((error) => {
console.warn('Not good man :( CheckEvaluationToken = ', error);
settokenEval_api("false");
//setmyApimyApiMessage("")
})
}
useEffect(() => {
async function funclocaltoken() {
if (String(props.action).toLocaleLowerCase() !== "inscription" &&
String(props.action).toLocaleLowerCase() !== "information") {
CheckEvaluationToken();
}
}
var local_user_connect = 0;
var local_part_connect = 0;
@ -114,6 +160,7 @@ const DisplayDetailClassAction = (props) => {
Display();
GetAssociatedTraning();
funclocaltoken();
window.scrollTo(0, 0);
document.getElementsByName('mytitle')[0].focus();
@ -528,11 +575,20 @@ const DisplayDetailClassAction = (props) => {
{(String(action).toLocaleLowerCase() === "inscription" || String(action).toLocaleLowerCase() === "information")
&& String(action).toLocaleLowerCase() !== "evaluation"
&& <div className="description detail_element" name='section_info'>
<Inscription_Information internal_url={classId} action={action} />
</div>
}
{String(action).toLocaleLowerCase() !== "inscription" && String(action).toLocaleLowerCase() !== "information" && String(tokenEval_api) === "true"
&& <div className="description detail_element" name='section_info'>
Zone evaluation : <button> fermer</button>
<br/>
<Inscription_Information internal_url={classId} action={"evaluation"} />
</div>
}
<div className="titre_formation" id="mytitle" name="mytitle">
{parse(String(DetailTraining["title"]))}
@ -551,8 +607,7 @@ const DisplayDetailClassAction = (props) => {
<b className="sous_titre">Objectif </b>
<p>
{parse(String(DetailTraining["objectif"]))} &nbsp; laa
{String(DetailTraining["objectif"]).length}
{parse(String(DetailTraining["objectif"]))} &nbsp;
</p>
</div>}

View File

@ -27,6 +27,12 @@ import { Redirect } from 'react-router-dom'
import { Editor } from '@tinymce/tinymce-react';
import SendIcon from '@mui/icons-material/Send';
import { IoAddCircleOutline, IoCloseCircleOutline } from "react-icons/io5";
import Rating from '@mui/material/Rating';
import parse from 'html-react-parser'
import { StylesManager, Model } from "survey-core";
import { Survey } from "survey-react-ui";
import "survey-core/defaultV2.css";
function Inscription_Information(props) {
@ -276,11 +282,56 @@ function Inscription_Information(props) {
}
useEffect(() => {
if (String(props.action).toLocaleLowerCase() !== "inscription" &&
String(props.action).toLocaleLowerCase() !== "information") {
CheckEvaluationToken();
}
GetCurrentClass_trainingsession();
GetListOpco();
}, []);
// Cette fonction verifier si le token de l'evaluation est valide
//si $action != 'information' et 'inscription', alors la valeur est forcement celle d'un token.
const [tokenEval_api, settokenEval_api] = useState();
const [tokenEval_message, settokenEval_message] = useState();
const [tokenEval_result, settokenEval_result] = useState();
function CheckEvaluationToken() {
var form = new FormData();
//form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA");
const stored_cookie = getCookie('tokenmysych');
form.append("eval_token", props.action);
form.append("class_internal_url", props.internal_url);
var myurl = process.env.REACT_APP_API_URL + "myclass/api/ckeckEvaluationToken/";
axios.post(myurl, form).then(res => {
if (res.data.status != "false") {
console.log(" In tokenEval_trainingsession res.data.status = " + res.data.status);
console.log(" In tokenEval_trainingsession res.data.message r_class = " + res.data.message);
settokenEval_api("true");
settokenEval_result(res.data.message);
}
else {
settokenEval_api("false");
settokenEval_message(res.data.message);
}
}).catch((error) => {
console.warn('Not good man :( CheckEvaluationToken = ', error);
settokenEval_api("false");
//setmyApimyApiMessage("")
})
}
function clearfileds() {
if (document.getElementsByName("nom")[0]) {
@ -443,9 +494,6 @@ function Inscription_Information(props) {
};
function AnnulerInformationRequest() {
}
return (
<div className='inscription'>
@ -676,6 +724,103 @@ function Inscription_Information(props) {
</Box>}
</div>}
{/* Gestion de la note/evaluation */}
{(String(RecordData_status) === "false" ||
String(RecordData_status).length === 0) &&
String(action).toLocaleLowerCase() === "evaluation" &&
String(AnnulerFction_status) !== "1" && <div className="survey_page">
<h3> Demande d'evaluation </h3>
<div className="div_row22">
<Rating name="half-rating-read" defaultValue={0} precision={0.5} /> <br />
</div>
<div className="div_row22 survey_block">
<fieldset>
<nav className="survey_title"> 1 .Title </nav>
<nav className="survey_desc"> Satisfaction globale</nav>
<div class="some-class">
<input type="radio" class="radio" name="x" value="y" id="y" />
<label for="y">Un peu</label> &nbsp;&nbsp;
<input type="radio" class="radio" name="x" value="z" id="z" />
<label for="z">Bcp</label>&nbsp;&nbsp;
<input type="radio" class="radio" name="x" value="z" id="z" />
<label for="z">Tres</label>&nbsp;&nbsp;
</div>
</fieldset>
</div>
<div className="div_row22 survey_block">
<fieldset>
<nav className="survey_title"> 2 .La pedagogie du formateur </nav>
<nav className="survey_desc"> Satisfaction globale</nav>
<div class="some-class">
<input type="radio" class="radio" name="x" value="y" id="y" />
<label for="y">Un peu</label> &nbsp;&nbsp;
<input type="radio" class="radio" name="x" value="z" id="z" />
<label for="z">Bcp</label>&nbsp;&nbsp;
<input type="radio" class="radio" name="x" value="z" id="z" />
<label for="z">Tres</label>&nbsp;&nbsp;
</div>
</fieldset>
</div>
<div className="div_row22 survey_block">
<fieldset style={{"maxHeight":'200px'}}>
<nav className="survey_title"> 3 .Votre avis general</nav>
<Editor
onInit={(evt, editor) => editorRef_description.current = editor}
initialValue={field_description}
onKeyUp={editor_keyup}
onEditorChange={(newValue, editor) => {
if (String(editor_tochange) === "1") {
//alert(" change");
DataUpdated()
seteditor_tochange("");
}
}}
init={{
resize: false,
height: 100,
menubar: false,
plugins: [
'advlist autolink lists link image charmap print preview anchor',
'searchreplace visualblocks code fullscreen',
'insertdatetime media table paste code help wordcount'
],
toolbar: false,
content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:14px; }'
}}
/>
</fieldset>
</div>
<div className="div_row22">
{<div className="div_row">
<div className="div_row_droite" style={{ "textAlign": "right", "marginTop": "0.5rem" }}>
<Button variant="contained" className="bton_envoyer"
onClick={SendInformationRequest}
startIcon={<SendIcon />}>Envoyer &nbsp; &nbsp; {<SendIcon />}</Button>
</div>
{/* <div className="div_row_droite" style={{ "textAlign": "right" }}>
<Button variant="contained" color="success" className="bton_fermer"
onClick={AnnulerFction_info}>Fermer &nbsp; &nbsp;{<IoCloseCircleOutline />}</Button>
</div>*/}
</div>
}
</div>
</div>}
{/* Gestion des demandes d'information */}
@ -813,7 +958,7 @@ function Inscription_Information(props) {
<div className="div_row22">
{<div className="div_row">
<div className="div_row_droite" style={{ "textAlign": "right", "marginTop":"0.5rem" }}>
<div className="div_row_droite" style={{ "textAlign": "right", "marginTop": "0.5rem" }}>
<Button variant="contained" className="bton_envoyer"
onClick={SendInformationRequest}
startIcon={<SendIcon />}>Envoyer &nbsp; &nbsp; {<SendIcon />}</Button>

View File

@ -448,5 +448,34 @@
background-color: white;
color: #104277 !important;
}
.survey_block{
background-color: white;
margin: 10px;
}
.survey_page{
background-color: #f7f7f7;
display: block;
margin: 10px;
}
.survey_title{
font-size: calc(2 * var(--base-unit, 8px));
line-height: calc(3 * var(--base-unit, 8px));
padding: 5px;
}
.survey_desc{
font-family: var(--font-family);
font-style: normal;
font-weight: normal;
color: var(--foreground-light, #909090);
white-space: normal;
word-break: break-word;
padding: 5px;
}
}
}