diff --git a/package-lock.json b/package-lock.json index dbcb9ea..029b816 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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" }, diff --git a/package.json b/package.json index bf42382..ba25619 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/components/DisplayDetailClass_new_Action.js b/src/components/DisplayDetailClass_new_Action.js index b5f158c..8afcef8 100644 --- a/src/components/DisplayDetailClass_new_Action.js +++ b/src/components/DisplayDetailClass_new_Action.js @@ -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" &&
} + {String(action).toLocaleLowerCase() !== "inscription" && String(action).toLocaleLowerCase() !== "information" && String(tokenEval_api) === "true" + &&
+ Zone evaluation : +
+ +
+ } +
{parse(String(DetailTraining["title"]))} @@ -551,8 +607,7 @@ const DisplayDetailClassAction = (props) => { Objectif

- {parse(String(DetailTraining["objectif"]))}   laa - {String(DetailTraining["objectif"]).length} + {parse(String(DetailTraining["objectif"]))}  

} diff --git a/src/components/Inscription_Information.js b/src/components/Inscription_Information.js index 7443d64..18f85b4 100644 --- a/src/components/Inscription_Information.js +++ b/src/components/Inscription_Information.js @@ -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) { @@ -90,7 +96,7 @@ function Inscription_Information(props) { function handleChangeFinancement(event) { setmonfinancement(event.target.value); - }; + }; const [RecordData_api, setRecordData_api] = useState(""); @@ -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,10 +494,7 @@ function Inscription_Information(props) { }; - function AnnulerInformationRequest() { - - } - + return (
{String(RecordData_status) === "true" && @@ -625,25 +673,25 @@ function Inscription_Information(props) {
 
- {monfinancement && String(monfinancement) !== "perso" && - :not(style)': { m: 1 }, width: '100%', }}> -
-
- Choisir votre centre de rattachement + {monfinancement && String(monfinancement) !== "perso" && + :not(style)': { m: 1 }, width: '100%', }}> +
+
+ Choisir votre centre de rattachement +
+
+ +
+
*Choisir "00-Inconnu" si vous ne le connaissez pas. +
-
- -
-
*Choisir "00-Inconnu" si vous ne le connaissez pas. -
-
- } + } @@ -658,7 +706,7 @@ function Inscription_Information(props) { }} onClick={RecordData}>Se prĂ©-inscrire     {}
- {/*
+ {/*
} + {/* Gestion de la note/evaluation */} + + {(String(RecordData_status) === "false" || + String(RecordData_status).length === 0) && + String(action).toLocaleLowerCase() === "evaluation" && + String(AnnulerFction_status) !== "1" &&
+ +

Demande d'evaluation

+
+
+
+ +
+
+ + +
+ +    + +    + +    +
+
+
+ +
+
+ + +
+ +    + +    + +    +
+
+
+ +
+
+ + + 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; }' + }} + /> +
+
+
+ {
+
+ + +
+ + {/*
+ +
*/} +
+ + } + +
+ + + +
} + {/* Gestion des demandes d'information */} @@ -813,14 +958,14 @@ function Inscription_Information(props) {
{
-
-
- {/*
+ {/*
*/} diff --git a/src/styles/components/_inscription.scss b/src/styles/components/_inscription.scss index c0cdeae..9619f7c 100644 --- a/src/styles/components/_inscription.scss +++ b/src/styles/components/_inscription.scss @@ -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; + } } } \ No newline at end of file