- saving progress;

This commit is contained in:
Vitalii Kiiko
2024-12-02 09:47:09 +01:00
parent f8ba6731b4
commit 3759400f19
9 changed files with 124 additions and 94 deletions

View File

@@ -4,52 +4,51 @@
"private": true, "private": true,
"dependencies": { "dependencies": {
"@babel/plugin-proposal-private-property-in-object": "7.21.11", "@babel/plugin-proposal-private-property-in-object": "7.21.11",
"@babel/preset-react": "7.24.7", "@babel/preset-react": "7.25.9",
"@date-fns/tz": "1.1.2", "@date-fns/tz": "1.2.0",
"@emailjs/browser": "^4.4.1", "@emailjs/browser": "4.4.1",
"@emotion/styled": "11.13.0", "@emotion/styled": "11.13.5",
"@number-flow/react": "0.2.0", "@number-flow/react": "0.4.1",
"@sentry/browser": "^8.41.0", "@sentry/browser": "^8.41.0",
"@tanstack/react-table": "^8.20.5", "@tanstack/react-table": "^8.20.5",
"@wordpress/i18n": "5.8.0", "@wordpress/i18n": "5.13.0",
"@wordpress/react-i18n": "4.8.0", "@wordpress/react-i18n": "4.13.0",
"@xyflow/react": "12.3.1",
"codice-fiscale-js": "2.3.22", "codice-fiscale-js": "2.3.22",
"copy-to-clipboard": "^3.3.3", "copy-to-clipboard": "3.3.3",
"deep-object-diff": "^1.1.9", "deep-object-diff": "1.1.9",
"dompurify": "3.1.7", "dompurify": "3.2.2",
"fast-deep-equal": "3.1.3", "fast-deep-equal": "3.1.3",
"hotkeys-js": "^3.13.7", "hotkeys-js": "3.13.7",
"html-react-parser": "5.1.16", "html-react-parser": "5.1.18",
"jwt-decode": "4.0.0", "jwt-decode": "4.0.0",
"klona": "2.0.6", "klona": "2.0.6",
"leader-line": "^1.0.7", "leader-line": "1.0.7",
"luxon": "3.5.0", "luxon": "3.5.0",
"object-path-immutable": "4.1.2", "object-path-immutable": "4.1.2",
"primeicons": "7.0.0", "primeicons": "7.0.0",
"primereact": "10.8.4", "primereact": "10.8.5",
"quill": "2.0.2", "quill": "2.0.3",
"ramda": "0.30.1", "ramda": "0.30.1",
"react": "18.3.1", "react": "18.3.1",
"react-dnd": "16.0.1", "react-dnd": "16.0.1",
"react-dnd-html5-backend": "16.0.1", "react-dnd-html5-backend": "16.0.1",
"react-dom": "18.3.1", "react-dom": "18.3.1",
"react-hook-form": "7.53.0", "react-hook-form": "7.53.2",
"react-router-dom": "6.26.2", "react-router-dom": "7.0.1",
"react-scripts": "5.0.1", "react-scripts": "5.0.1",
"validate.js": "0.13.1", "validate.js": "0.13.1",
"zustand": "4.5.4", "zustand": "4.5.4",
"zustand-x": "3.0.4" "zustand-x": "3.0.4"
}, },
"devDependencies": { "devDependencies": {
"@babel/cli": "7.25.6", "@babel/cli": "7.25.9",
"@babel/core": "7.25.2", "@babel/core": "7.26.0",
"@babel/plugin-syntax-jsx": "7.24.7", "@babel/plugin-syntax-jsx": "7.25.9",
"@wordpress/babel-plugin-makepot": "6.8.0", "@wordpress/babel-plugin-makepot": "6.13.0",
"babel-plugin-macros": "3.1.0", "babel-plugin-macros": "3.1.0",
"node-wp-i18n": "^1.2.7", "node-wp-i18n": "1.2.7",
"sass": "1.79.3", "sass": "1.81.0",
"sass-loader": "16.0.2" "sass-loader": "16.0.3"
}, },
"scripts": { "scripts": {
"start": "GENERATE_SOURCEMAP=false react-scripts start", "start": "GENERATE_SOURCEMAP=false react-scripts start",

View File

@@ -51,9 +51,36 @@
.flowContainer__flowItem { .flowContainer__flowItem {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 20px; width: 100%;
max-width: 280px;
padding: 15px;
border: 1px solid var(--panel-content-borderColor);
}
.flowContainer__flowItemInner {
display: flex;
flex-direction: column;
gap: 10px;
width: 100%; width: 100%;
max-width: 250px; max-width: 250px;
padding: 7px; border: 1px solid var(--panel-content-borderColor);
border: 1px solid var(--table-border-color);
label {
display: flex;
justify-content: center;
padding: 10px 0 5px;
font-size: 14px;
font-style: normal;
font-weight: 400;
line-height: 18px;
}
&.initialForm, &.finalForm {
border-color: var(--card-full-background-color-3);
background-color: var(--card-full-background-color-3);
label {
color: white;
}
}
} }

View File

@@ -21,6 +21,7 @@
--message-warning-color: #cc8925; --message-warning-color: #cc8925;
--message-info-background: rgba(183, 183, 183, 0.7); --message-info-background: rgba(183, 183, 183, 0.7);
--message-info-color: #3B82F6; --message-info-color: #3B82F6;
--panel-content-borderColor: #E5E7EB;
--card-full-background-color-2: #EEC137; --card-full-background-color-2: #EEC137;
--card-full-background-color-3: #FA8E42; --card-full-background-color-3: #FA8E42;

View File

@@ -8,7 +8,7 @@ import { isEmpty } from 'ramda';
import '@xyflow/react/dist/style.css'; import '@xyflow/react/dist/style.css';
// store // store
import { useStore, storeSet, storeGet } from '../../store'; import { useStore, storeSet } from '../../store';
// nodes // nodes
import NodeInitialForm from './components/NodeInitialForm'; import NodeInitialForm from './components/NodeInitialForm';

View File

@@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import { classNames } from 'primereact/utils'; import { classNames } from 'primereact/utils';
import { isEmpty, isNil } from 'ramda'; import { isNil } from 'ramda';
// components // components
import { Controller } from 'react-hook-form'; import { Controller } from 'react-hook-form';

View File

@@ -39,7 +39,7 @@ const BandoApplicationPreview = () => {
const [formData, setFormData] = useState([]); const [formData, setFormData] = useState([]);
const [formInitialData, setFormInitialData] = useState(null); const [formInitialData, setFormInitialData] = useState(null);
const [bandoTitle, setBandoTitle] = useState(''); const [bandoTitle, setBandoTitle] = useState('');
const [bandoId, setBandoId] = useState(0); const [, setBandoId] = useState(0);
const [formId, setFormId] = useState(''); const [formId, setFormId] = useState('');
const [totalSteps, setTotalSteps] = useState(0); const [totalSteps, setTotalSteps] = useState(0);
const [applicationStatus, setApplicationStatus] = useState(''); const [applicationStatus, setApplicationStatus] = useState('');

View File

@@ -15,7 +15,6 @@ import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
// components // components
import { Button } from 'primereact/button'; import { Button } from 'primereact/button';
import { Dropdown } from 'primereact/dropdown'; import { Dropdown } from 'primereact/dropdown';
import FlowBuilder from '../../components/FlowBuilder';
import { Messages } from 'primereact/messages'; import { Messages } from 'primereact/messages';
import FlowService from '../../service/flow-service'; import FlowService from '../../service/flow-service';
import { confirmPopup, ConfirmPopup } from 'primereact/confirmpopup'; import { confirmPopup, ConfirmPopup } from 'primereact/confirmpopup';
@@ -223,6 +222,10 @@ const BandoFlowEdit = () => {
const initialFormObj = head(flowForms.filter(o => String(o.id) === String(initialForm))); const initialFormObj = head(flowForms.filter(o => String(o.id) === String(initialForm)));
let finalFormObj = null; let finalFormObj = null;
if (!initialFormObj) {
return;
}
const relevantFields = initialFormObj const relevantFields = initialFormObj
? initialFormObj.content ? initialFormObj.content
.filter(o => ['radio', 'select'].includes(o.name)) .filter(o => ['radio', 'select'].includes(o.name))
@@ -323,60 +326,6 @@ const BandoFlowEdit = () => {
<div className="appPage__spacer"></div> <div className="appPage__spacer"></div>
<div className="appPageSection">
{forms.length >= 2 && isFlowAllowed
? <div className="flowContainer">
<div className="flowContainer__level">
<div className="flowContainer__flowItem">
<label htmlFor="mainField">{__('Scegli form iniziale', 'gepafin')}</label>
<Dropdown
id="initialForm"
disabled={'PUBLISH' === bandoStatus}
value={initialForm}
onChange={(e) => updateInitialForm(e.value)}
optionDisabled={(opt) => finalForm === opt.value || isEmpty(opt.value)}
options={formOptions}
optionLabel="label"
optionValue="value"
placeholder={__('Scegli il form', 'gepafin')}/>
{initialForm && forms.length > 2 && mainFieldOptions
? <div className="appForm__field">
<label htmlFor="mainField">{__('Scegli il campo principale', 'gepafin')}</label>
<Dropdown
id="mainField"
disabled={'PUBLISH' === bandoStatus}
value={mainField}
onChange={(e) => setMainField(e.value)}
optionDisabled={(opt) => isEmpty(opt.value)}
options={mainFieldOptions}
optionLabel="label"
optionValue="value"
placeholder={__('Scegli il campo', 'gepafin')}/>
</div> : null}
</div>
</div>
{forms.length >= 2 && initialForm
? <div className="flowContainer__level">
<div className="flowContainer__flowItem">
<label htmlFor="mainField">{__('Scegli form finale', 'gepafin')}</label>
<Dropdown
id="finalForm"
disabled={'PUBLISH' === bandoStatus}
value={finalForm}
onChange={(e) => setFinalForm(e.value)}
optionDisabled={(opt) => initialForm === opt.value || isEmpty(opt.value)}
options={formOptions}
optionLabel="label"
optionValue="value"
placeholder={__('Scegli il form', 'gepafin')}/>
</div>
</div> : null}
</div> : null}
</div>
<div className="appPage__spacer"></div>
{/*<div className="appPageSection"> {/*<div className="appPageSection">
<div className="appForm__cols"> <div className="appForm__cols">
<div className="appForm__field"> <div className="appForm__field">
@@ -440,11 +389,61 @@ const BandoFlowEdit = () => {
<div className="appPageSection"> <div className="appPageSection">
<Messages ref={flowMsgs}/> <Messages ref={flowMsgs}/>
{/*{forms.length >= 2 && isFlowAllowed
? <FlowBuilder {forms.length >= 2 && isFlowAllowed
initialForm={initialForm} ? <div className="flowContainer">
finalForm={finalForm} <div className="flowContainer__level">
mainField={mainField}/> : null}*/} <div className="flowContainer__flowItem initialForm">
<div className="flowContainer__flowItemInner initialForm">
<label htmlFor="mainField">{__('Scegli form iniziale', 'gepafin')}</label>
<Dropdown
id="initialForm"
disabled={'PUBLISH' === bandoStatus}
value={initialForm}
onChange={(e) => updateInitialForm(e.value)}
optionDisabled={(opt) => finalForm === opt.value || isEmpty(opt.value)}
options={formOptions}
optionLabel="label"
optionValue="value"
placeholder={__('Scegli il form', 'gepafin')}/>
{initialForm && forms.length > 2 && mainFieldOptions
? <div className="appForm__field">
<label
htmlFor="mainField">{__('Scegli il campo principale', 'gepafin')}</label>
<Dropdown
id="mainField"
disabled={'PUBLISH' === bandoStatus}
value={mainField}
onChange={(e) => setMainField(e.value)}
optionDisabled={(opt) => isEmpty(opt.value)}
options={mainFieldOptions}
optionLabel="label"
optionValue="value"
placeholder={__('Scegli il campo', 'gepafin')}/>
</div> : null}
</div>
</div>
</div>
{forms.length >= 2 && initialForm
? <div className="flowContainer__level">
<div className="flowContainer__flowItem">
<div className="flowContainer__flowItemInner finalForm">
<label htmlFor="mainField">{__('Scegli form finale', 'gepafin')}</label>
<Dropdown
id="finalForm"
disabled={'PUBLISH' === bandoStatus}
value={finalForm}
onChange={(e) => setFinalForm(e.value)}
optionDisabled={(opt) => initialForm === opt.value || isEmpty(opt.value)}
options={formOptions}
optionLabel="label"
optionValue="value"
placeholder={__('Scegli il form', 'gepafin')}/>
</div>
</div>
</div> : null}
</div> : null}
</div> </div>
<div className="appPage__spacer"></div> <div className="appPage__spacer"></div>

View File

@@ -50,7 +50,8 @@ const ArchiveDocument = ({ ndg = '', fileId = 0 }) => {
} }
const submitData = () => { const submitData = () => {
console.log('submitData', modalData) console.log('submitData', modalData);
//setLoading(true);
} }
useEffect(() => { useEffect(() => {

View File

@@ -181,6 +181,7 @@ const DomandaEditPreInstructor = () => {
motivation motivation
} }
setLoading(true);
ApplicationEvaluationService.updateEvaluation(data.assignedApplicationId, formData, updateStatusCallback, errUpdateStatusCallback); ApplicationEvaluationService.updateEvaluation(data.assignedApplicationId, formData, updateStatusCallback, errUpdateStatusCallback);
} }
@@ -194,6 +195,7 @@ const DomandaEditPreInstructor = () => {
motivation motivation
} }
setLoading(true);
ApplicationEvaluationService.updateEvaluation(data.assignedApplicationId, formData, updateStatusCallback, errUpdateStatusCallback); ApplicationEvaluationService.updateEvaluation(data.assignedApplicationId, formData, updateStatusCallback, errUpdateStatusCallback);
} }
@@ -207,7 +209,7 @@ const DomandaEditPreInstructor = () => {
}); });
} }
} }
storeSet.main.unsetAsyncRequest(); setLoading(false);
} }
const errUpdateStatusCallback = (data) => { const errUpdateStatusCallback = (data) => {
@@ -219,7 +221,7 @@ const DomandaEditPreInstructor = () => {
}); });
} }
set404FromErrorResponse(data); set404FromErrorResponse(data);
storeSet.main.unsetAsyncRequest(); setLoading(false);
} }
const displayCriterionData = (id) => { const displayCriterionData = (id) => {
@@ -377,6 +379,7 @@ const DomandaEditPreInstructor = () => {
&& !isEmpty(appointmentData.duration) && appointmentData.duration !== 0 && appointmentData.amount !== 0 && !isEmpty(appointmentData.duration) && appointmentData.duration !== 0 && appointmentData.amount !== 0
) { ) {
console.log(appointmentData); console.log(appointmentData);
//setLoading(true);
} }
} }