- merged with master;
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { classNames } from 'primereact/utils';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { isEmpty, pathOr, pluck } from 'ramda';
|
||||
import { isEmpty, isNil, pathOr, pluck } from 'ramda';
|
||||
|
||||
// service
|
||||
import FileUploadService from '../../../../service/file-upload-service';
|
||||
@@ -27,7 +27,8 @@ const FileSelect = ({
|
||||
sourceId = 0,
|
||||
source = 'DOCUMENT',
|
||||
documentCategories = [],
|
||||
saveFormCallback
|
||||
saveFormCallback,
|
||||
attachFilesCallback,
|
||||
}) => {
|
||||
//const [stateFieldData, setStateFieldData] = useState([]);
|
||||
const stateFieldData = useRef([]);
|
||||
@@ -52,6 +53,16 @@ const FileSelect = ({
|
||||
setAddNewMode(false);
|
||||
}, [selectedUnconfirmed]);
|
||||
|
||||
const attachSelectedFilesCallback = useCallback(() => {
|
||||
const existingIds = pluck('id', stateFieldData.current);
|
||||
const selectedToBeAdded = selectedUnconfirmed.filter(o => !existingIds.includes(o.id));
|
||||
setSelectedUnconfirmed([]);
|
||||
|
||||
// eslint-disable-next-line array-callback-return
|
||||
selectedToBeAdded.map(o => attachFilesCallback(o));
|
||||
setAddNewMode(false);
|
||||
}, [selectedUnconfirmed]);
|
||||
|
||||
const doGoBackToListOfFiles = () => {
|
||||
setSelectedUnconfirmed([]);
|
||||
setAddNewMode(false);
|
||||
@@ -100,7 +111,8 @@ const FileSelect = ({
|
||||
defaultFocus: 'reject',
|
||||
acceptClassName: 'p-button-danger',
|
||||
accept: () => removeAttached(id),
|
||||
reject: () => {}
|
||||
reject: () => {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -137,13 +149,14 @@ const FileSelect = ({
|
||||
useEffect(() => {
|
||||
stateFieldData.current = defaultValue;
|
||||
}, [defaultValue]);
|
||||
//console.log([...stateFieldData.current])
|
||||
|
||||
return (
|
||||
<>
|
||||
<label htmlFor={fieldName} className={classNames({ 'p-error': errors[fieldName] })}>
|
||||
{!isNil(label)
|
||||
? <label htmlFor={fieldName} className={classNames({ 'p-error': errors[fieldName] })}>
|
||||
{label}{config.required || config.isRequired ?
|
||||
<span className="appForm__field--required">*</span> : null}
|
||||
</label>
|
||||
</label> : null}
|
||||
<div className="fileselectInner">
|
||||
{addNewMode
|
||||
? <div className="fileselectInner__selectionBox">
|
||||
@@ -160,7 +173,7 @@ const FileSelect = ({
|
||||
? <Button
|
||||
severity="success"
|
||||
disabled={loading}
|
||||
onClick={attachSelectedFiles}
|
||||
onClick={!isNil(attachFilesCallback) ? attachSelectedFilesCallback : attachSelectedFiles}
|
||||
label={__('Conferma i file scelti', 'gepafin')}
|
||||
icon="pi pi-arrow-right" size="small" iconPos="right"/>
|
||||
: <Button
|
||||
@@ -172,19 +185,21 @@ const FileSelect = ({
|
||||
</div> : null}
|
||||
{!isEmpty(optionsTransformed) && !addNewMode
|
||||
? <div className="fileselectInner__selectedFiles">
|
||||
<p>{__('I file selezionati')}</p>
|
||||
<p><strong>{__('I file selezionati:')}</strong></p>
|
||||
<ul>
|
||||
{[...stateFieldData.current].map(o => <li key={o.id}>
|
||||
{!isEmpty(stateFieldData.current)
|
||||
? [...stateFieldData.current].map(o => <li key={o.id}>
|
||||
{o.name}
|
||||
<div className="appPageSection__iconActions">
|
||||
{isNil(attachFilesCallback)
|
||||
? <div className="appPageSection__iconActions">
|
||||
<Button icon="pi pi-times" rounded
|
||||
type="button"
|
||||
size="small"
|
||||
onClick={(e) => confirmDelete(e, o.id)}
|
||||
outlined severity="danger"
|
||||
aria-label={__('Cancella', 'gepafin')}/>
|
||||
</div>
|
||||
</li>)}
|
||||
</div> : null}
|
||||
</li>) : <li>{__('Nessun file selezionato', 'gepafin')}</li>}
|
||||
</ul>
|
||||
<Button
|
||||
severity="success"
|
||||
@@ -205,7 +220,7 @@ const FileSelect = ({
|
||||
</div>
|
||||
: null}
|
||||
{infoText ? <small>{infoText}</small> : null}
|
||||
<ConfirmPopup />
|
||||
<ConfirmPopup/>
|
||||
</>)
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ import { InputTextarea } from 'primereact/inputtextarea';
|
||||
import { InputText } from 'primereact/inputtext';
|
||||
import { Dropdown } from 'primereact/dropdown';
|
||||
import ListOfFiles from '../DomandaEditPreInstructor/components/ListOfFiles';
|
||||
import RepeaterFields from '../DomandaEditPreInstructor/components/RepeaterFields';
|
||||
import EvaluationExtraFiles from '../DomandaEditPreInstructor/components/EvaluationExtraFiles';
|
||||
import ApplicationInfo from '../DomandaEditPreInstructor/components/ApplicationInfo';
|
||||
import ApplicationDownloadFiles from '../DomandaEditPreInstructor/components/ApplicationDownloadFiles';
|
||||
import FormField from '../../components/FormField';
|
||||
@@ -1337,9 +1337,9 @@ const DomandaEditInstructorManager = () => {
|
||||
useEffect(() => {
|
||||
const maxScore = pathOr(0, ['minScore'], data);
|
||||
const criteria = pathOr([], ['criteria'], data);
|
||||
const scoreSum = sum(criteria.map(o => o.score));
|
||||
const scoreSum = pathOr(0, [], sum(criteria.map(o => o.score)));
|
||||
|
||||
setIsAdmissible(scoreSum !== 0 && scoreSum >= maxScore);
|
||||
setIsAdmissible(scoreSum >= maxScore);
|
||||
}, [data]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -1397,7 +1397,7 @@ const DomandaEditInstructorManager = () => {
|
||||
|
||||
<div className="appPageSection">
|
||||
<h2>{__('Documenti aggiuntivi', 'gepafin')}</h2>
|
||||
<RepeaterFields
|
||||
<EvaluationExtraFiles
|
||||
defaultValue={data.evaluationDocument ?? []}
|
||||
updateFn={(data) => updateEvaluationValue(
|
||||
data,
|
||||
@@ -1414,6 +1414,8 @@ const DomandaEditInstructorManager = () => {
|
||||
})}
|
||||
shouldDisable={['APPROVED', 'REJECTED'].includes(data.applicationStatus) || evaluationBlockedForUser(data)}
|
||||
sourceId={data.id}
|
||||
applicationId={data.applicationId}
|
||||
companyId={data.companyId}
|
||||
sourceName="evaluation"/>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,300 @@
|
||||
import React, { useMemo, useState, useCallback, useEffect, useRef } from 'react';
|
||||
import { useForm, useFieldArray } from 'react-hook-form';
|
||||
import { isEmpty, head, pluck } from 'ramda';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { klona } from 'klona';
|
||||
|
||||
// tools
|
||||
import uniqid from '../../../../helpers/uniqid';
|
||||
|
||||
// components
|
||||
import FormField from '../../../../components/FormField';
|
||||
import { Button } from 'primereact/button';
|
||||
import { Dialog } from 'primereact/dialog';
|
||||
import { Toast } from 'primereact/toast';
|
||||
import CompanyService from '../../../../service/company-service';
|
||||
import FileSelect from '../../../../components/FormField/components/FileSelect';
|
||||
import ApplicationService from '../../../../service/application-service';
|
||||
import set404FromErrorResponse from '../../../../helpers/set404FromErrorResponse';
|
||||
import { storeSet } from '../../../../store';
|
||||
|
||||
const EvaluationExtraFiles = ({
|
||||
sourceId,
|
||||
applicationId,
|
||||
companyId,
|
||||
sourceName,
|
||||
updateFn = () => {
|
||||
},
|
||||
updateCallbackFn = () => {
|
||||
},
|
||||
defaultValue = [],
|
||||
shouldDisable = false
|
||||
}) => {
|
||||
const [chosen, setChosen] = useState('');
|
||||
const [isVisibleCompanyDocsDialog, setIsVisibleCompanyDocsDialog] = useState(false);
|
||||
const [companyDocs, setCompanyDocs] = useState([]);
|
||||
const [companyDocsSelected, setCompanyDocsSelected] = useState([]);
|
||||
const toast = useRef(null);
|
||||
const {
|
||||
control,
|
||||
handleSubmit,
|
||||
formState: { errors },
|
||||
setValue,
|
||||
register,
|
||||
trigger,
|
||||
getValues,
|
||||
watch
|
||||
} = useForm({
|
||||
defaultValues: useMemo(() => {
|
||||
return {
|
||||
items: defaultValue || []
|
||||
};
|
||||
}, [defaultValue]), mode: 'onChange'
|
||||
});
|
||||
const { fields, append, remove } = useFieldArray({
|
||||
control,
|
||||
name: 'items'
|
||||
});
|
||||
|
||||
const watchFields = watch('items');
|
||||
|
||||
const onSubmit = () => {
|
||||
}
|
||||
|
||||
const doUpdateAfterFileUploaded = () => {
|
||||
const formData = getValues();
|
||||
updateFn(formData.items);
|
||||
updateCallbackFn(formData.items);
|
||||
}
|
||||
|
||||
const addNew = () => {
|
||||
const uid = uniqid('f');
|
||||
const newItem = {
|
||||
fieldId: uid,
|
||||
nameValue: '',
|
||||
fileValue: []
|
||||
}
|
||||
append(newItem);
|
||||
setChosen(newItem.fieldId);
|
||||
trigger();
|
||||
};
|
||||
|
||||
const setNewChosen = useCallback((id) => {
|
||||
const chosenObj = head(fields.filter(o => id === o.fieldId));
|
||||
if (chosenObj) {
|
||||
setChosen(chosen === id ? '' : id);
|
||||
}
|
||||
}, [fields, chosen]);
|
||||
|
||||
const removeItem = useCallback((index) => {
|
||||
const chosenObj = klona(fields[index]);
|
||||
remove(index);
|
||||
if (chosen === chosenObj.fieldId) {
|
||||
setChosen('');
|
||||
}
|
||||
const formData = getValues();
|
||||
updateFn(formData.items);
|
||||
updateCallbackFn(formData.items);
|
||||
}, [fields, chosen]);
|
||||
|
||||
const openCompanyArchive = () => {
|
||||
setIsVisibleCompanyDocsDialog(true);
|
||||
}
|
||||
|
||||
const headerCompanyDocsDialog = () => {
|
||||
return <span>{__('Documenti aziendale', 'gepafin')}</span>;
|
||||
}
|
||||
|
||||
const hideCompanyDocsDialog = () => {
|
||||
setIsVisibleCompanyDocsDialog(false);
|
||||
setCompanyDocsSelected([]);
|
||||
}
|
||||
|
||||
const footerPreTecEvalDialog = useCallback(() => {
|
||||
return <div>
|
||||
<Button type="button" label={__('Annulla', 'gepafin')} onClick={hideCompanyDocsDialog} outlined/>
|
||||
<Button
|
||||
type="button"
|
||||
disabled={isEmpty(companyDocsSelected)}
|
||||
label={__('Aggiungi', 'gepafin')} onClick={doImportCompanyDocs}/>
|
||||
</div>
|
||||
}, [companyDocsSelected]);
|
||||
|
||||
const doImportCompanyDocs = useCallback(() => {
|
||||
if (!isEmpty(companyDocsSelected)) {
|
||||
const ids = pluck('id', companyDocsSelected);
|
||||
ApplicationService.setApplicationDocuments(applicationId, setDocsCallback, errSetDocsCallback, [
|
||||
['companyDocumentIds', ids]
|
||||
])
|
||||
}
|
||||
}, [companyDocsSelected]);
|
||||
|
||||
const setDocsCallback = (resp) => {
|
||||
if (resp.status === 'SUCCESS') {
|
||||
if (toast.current && resp.message) {
|
||||
toast.current.show({
|
||||
severity: 'success',
|
||||
summary: '',
|
||||
detail: resp.message
|
||||
});
|
||||
}
|
||||
}
|
||||
setIsVisibleCompanyDocsDialog(false);
|
||||
setCompanyDocsSelected([]);
|
||||
storeSet('unsetAsyncRequest');
|
||||
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 2500);
|
||||
}
|
||||
|
||||
const errSetDocsCallback = (resp) => {
|
||||
if (toast.current && resp.message) {
|
||||
toast.current.show({
|
||||
severity: resp.status === 'SUCCESS' ? 'info' : 'error',
|
||||
summary: '',
|
||||
detail: resp.message
|
||||
});
|
||||
}
|
||||
setIsVisibleCompanyDocsDialog(false);
|
||||
setCompanyDocsSelected([]);
|
||||
set404FromErrorResponse(resp);
|
||||
storeSet('unsetAsyncRequest');
|
||||
}
|
||||
|
||||
const getDocsCallback = (resp) => {
|
||||
if (resp.status === 'SUCCESS') {
|
||||
setCompanyDocs(resp.data);
|
||||
}
|
||||
}
|
||||
|
||||
const errGetDocsCallback = (resp) => {
|
||||
if (toast.current && resp.message) {
|
||||
toast.current.show({
|
||||
severity: resp.status === 'SUCCESS' ? 'info' : 'error',
|
||||
summary: '',
|
||||
detail: resp.message
|
||||
});
|
||||
}
|
||||
set404FromErrorResponse(resp);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
CompanyService.getCompanyDocuments(companyId, getDocsCallback, errGetDocsCallback, [
|
||||
['documentType', 'COMPANY_DOCUMENT']
|
||||
])
|
||||
}, [companyId]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="fieldsRepeater">
|
||||
<form className="appForm" onSubmit={handleSubmit(onSubmit)}>
|
||||
{watchFields
|
||||
? watchFields.map((o, index) => <div key={o.fieldId}
|
||||
className="fieldsRepeater__panel p-panel p-component">
|
||||
<div className="fieldsRepeater__heading p-panel p-panel-header">
|
||||
<span onClick={() => setNewChosen(o.fieldId)}>{o.nameValue}</span>
|
||||
<Button icon="pi pi-times"
|
||||
disabled={shouldDisable}
|
||||
outlined
|
||||
severity="danger"
|
||||
className="actionBtn"
|
||||
type="button"
|
||||
aria-label={__('Cancella', 'gepafin')}
|
||||
onClick={() => removeItem(index)}/>
|
||||
</div>
|
||||
<div className="fieldsRepeater__fields p-panel-content" data-hide={chosen !== o.fieldId}>
|
||||
<FormField
|
||||
type="textinput"
|
||||
disabled={shouldDisable}
|
||||
fieldName={`items.${index}.nameValue`}
|
||||
label={__('Titolo del file', 'gepafin')}
|
||||
control={control}
|
||||
errors={errors}
|
||||
defaultValue={o.nameValue}
|
||||
config={{ required: __('È obbligatorio', 'gepafin') }}
|
||||
/>
|
||||
<FormField
|
||||
type="fileupload"
|
||||
disabled={isEmpty(o.nameValue) || shouldDisable}
|
||||
setDataFn={setValue}
|
||||
saveFormCallback={doUpdateAfterFileUploaded}
|
||||
fieldName={`items.${index}.fileValue`}
|
||||
label={__('File', 'gepafin')}
|
||||
control={control}
|
||||
register={register}
|
||||
errors={errors}
|
||||
defaultValue={o.fileValue ? o.fileValue : []}
|
||||
accept={[]}
|
||||
source={sourceName}
|
||||
sourceId={sourceId}
|
||||
multiple={false}
|
||||
deleteOnBackend={true}
|
||||
config={{ required: __('È obbligatorio', 'gepafin') }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</form>
|
||||
<div style={{ display: 'flex', gap: '10px' }}>
|
||||
<Button
|
||||
className="fieldsRepeater__addNew"
|
||||
outlined
|
||||
type="button"
|
||||
disabled={(watchFields && watchFields.filter(o => isEmpty(o.nameValue) || isEmpty(o.fileValue)).length > 0) || shouldDisable}
|
||||
onClick={addNew}
|
||||
label={__('Aggiungi nuovo file', 'gepafin')}
|
||||
/>
|
||||
<Button
|
||||
className="fieldsRepeater__addNew"
|
||||
outlined
|
||||
type="button"
|
||||
disabled={(watchFields && watchFields.filter(o => isEmpty(o.nameValue) || isEmpty(o.fileValue)).length > 0) || shouldDisable}
|
||||
onClick={openCompanyArchive}
|
||||
label={__('Documenti aziendale', 'gepafin')}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<Toast ref={toast}/>
|
||||
<Dialog
|
||||
visible={isVisibleCompanyDocsDialog}
|
||||
modal
|
||||
header={headerCompanyDocsDialog}
|
||||
footer={footerPreTecEvalDialog}
|
||||
style={{ maxWidth: '600px', width: '100%' }}
|
||||
onHide={hideCompanyDocsDialog}>
|
||||
<div className="appForm__field">
|
||||
{/*<label
|
||||
className={classNames({
|
||||
'p-error': isEmpty(companyDocsSelected)
|
||||
})}>
|
||||
{__('Documenti', 'gepafin')}
|
||||
</label>*/}
|
||||
<FileSelect
|
||||
fieldName="companyDocsSelected"
|
||||
label={null}
|
||||
errors={{}}
|
||||
register={() => {}}
|
||||
key={companyDocsSelected}
|
||||
defaultValue={companyDocsSelected}
|
||||
options={companyDocs}
|
||||
sourceId="0"
|
||||
source="DOCUMENT"
|
||||
documentCategories={[]}
|
||||
attachFilesCallback={(o) => {
|
||||
setCompanyDocsSelected(prev => {
|
||||
const newSelected = [...prev];
|
||||
if (!newSelected.find(s => s.id === o.id)) {
|
||||
newSelected.push(o);
|
||||
}
|
||||
return newSelected;
|
||||
})
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default EvaluationExtraFiles;
|
||||
@@ -1,163 +0,0 @@
|
||||
import React, { useMemo, useState, useCallback } from 'react';
|
||||
import { useForm, useFieldArray } from 'react-hook-form';
|
||||
import { isEmpty, head } from 'ramda';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { klona } from 'klona';
|
||||
|
||||
// tools
|
||||
import uniqid from '../../../../helpers/uniqid';
|
||||
|
||||
// components
|
||||
import FormField from '../../../../components/FormField';
|
||||
import { Button } from 'primereact/button';
|
||||
|
||||
const RepeaterFields = ({
|
||||
sourceId,
|
||||
sourceName,
|
||||
updateFn = () => {
|
||||
},
|
||||
updateCallbackFn = () => {
|
||||
},
|
||||
defaultValue = [],
|
||||
shouldDisable = false
|
||||
}) => {
|
||||
const [chosen, setChosen] = useState('');
|
||||
const {
|
||||
control,
|
||||
handleSubmit,
|
||||
formState: { errors },
|
||||
setValue,
|
||||
register,
|
||||
trigger,
|
||||
getValues,
|
||||
watch
|
||||
} = useForm({
|
||||
defaultValues: useMemo(() => {
|
||||
return {
|
||||
items: defaultValue || []
|
||||
};
|
||||
}, [defaultValue]), mode: 'onChange'
|
||||
});
|
||||
const { fields, append, remove } = useFieldArray({
|
||||
control,
|
||||
name: 'items'
|
||||
});
|
||||
|
||||
const watchFields = watch('items');
|
||||
|
||||
const onSubmit = () => {
|
||||
}
|
||||
|
||||
const doUpdateAfterFileUploaded = () => {
|
||||
const formData = getValues();
|
||||
updateFn(formData.items);
|
||||
updateCallbackFn(formData.items);
|
||||
}
|
||||
|
||||
const addNew = () => {
|
||||
const uid = uniqid('f');
|
||||
const newItem = {
|
||||
fieldId: uid,
|
||||
nameValue: '',
|
||||
fileValue: []
|
||||
}
|
||||
append(newItem);
|
||||
setChosen(newItem.fieldId);
|
||||
trigger();
|
||||
};
|
||||
|
||||
const setNewChosen = useCallback((id) => {
|
||||
const chosenObj = head(fields.filter(o => id === o.fieldId));
|
||||
if (chosenObj) {
|
||||
setChosen(chosen === id ? '' : id);
|
||||
}
|
||||
}, [fields, chosen]);
|
||||
|
||||
const removeItem = useCallback((index) => {
|
||||
const chosenObj = klona(fields[index]);
|
||||
remove(index);
|
||||
if (chosen === chosenObj.fieldId) {
|
||||
setChosen('');
|
||||
}
|
||||
const formData = getValues();
|
||||
updateFn(formData.items);
|
||||
updateCallbackFn(formData.items);
|
||||
}, [fields, chosen]);
|
||||
|
||||
const openCompanyArchive = () => {
|
||||
console.log('openCompanyArchive');
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="fieldsRepeater">
|
||||
<form className="appForm" onSubmit={handleSubmit(onSubmit)}>
|
||||
{watchFields
|
||||
? watchFields.map((o, index) => <div key={o.fieldId}
|
||||
className="fieldsRepeater__panel p-panel p-component">
|
||||
<div className="fieldsRepeater__heading p-panel p-panel-header">
|
||||
<span onClick={() => setNewChosen(o.fieldId)}>{o.nameValue}</span>
|
||||
<Button icon="pi pi-times"
|
||||
disabled={shouldDisable}
|
||||
outlined
|
||||
severity="danger"
|
||||
className="actionBtn"
|
||||
type="button"
|
||||
aria-label={__('Cancella', 'gepafin')}
|
||||
onClick={() => removeItem(index)}/>
|
||||
</div>
|
||||
<div className="fieldsRepeater__fields p-panel-content" data-hide={chosen !== o.fieldId}>
|
||||
<FormField
|
||||
type="textinput"
|
||||
disabled={shouldDisable}
|
||||
fieldName={`items.${index}.nameValue`}
|
||||
label={__('Titolo del file', 'gepafin')}
|
||||
control={control}
|
||||
errors={errors}
|
||||
defaultValue={o.nameValue}
|
||||
config={{ required: __('È obbligatorio', 'gepafin') }}
|
||||
/>
|
||||
<FormField
|
||||
type="fileupload"
|
||||
disabled={isEmpty(o.nameValue) || shouldDisable}
|
||||
setDataFn={setValue}
|
||||
saveFormCallback={doUpdateAfterFileUploaded}
|
||||
fieldName={`items.${index}.fileValue`}
|
||||
label={__('File', 'gepafin')}
|
||||
control={control}
|
||||
register={register}
|
||||
errors={errors}
|
||||
defaultValue={o.fileValue ? o.fileValue : []}
|
||||
accept={[]}
|
||||
source={sourceName}
|
||||
sourceId={sourceId}
|
||||
multiple={false}
|
||||
deleteOnBackend={true}
|
||||
config={{ required: __('È obbligatorio', 'gepafin') }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</form>
|
||||
<div style={{display: 'flex', gap: '10px'}}>
|
||||
<Button
|
||||
className="fieldsRepeater__addNew"
|
||||
outlined
|
||||
type="button"
|
||||
disabled={(watchFields && watchFields.filter(o => isEmpty(o.nameValue) || isEmpty(o.fileValue)).length > 0) || shouldDisable}
|
||||
onClick={addNew}
|
||||
label={__('Aggiungi nuovo file', 'gepafin')}
|
||||
/>
|
||||
<Button
|
||||
className="fieldsRepeater__addNew"
|
||||
outlined
|
||||
type="button"
|
||||
disabled={(watchFields && watchFields.filter(o => isEmpty(o.nameValue) || isEmpty(o.fileValue)).length > 0) || shouldDisable}
|
||||
onClick={openCompanyArchive}
|
||||
label={__('Documenti aziendale', 'gepafin')}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default RepeaterFields;
|
||||
@@ -51,7 +51,7 @@ import { InputTextarea } from 'primereact/inputtextarea';
|
||||
import { InputText } from 'primereact/inputtext';
|
||||
import { Dropdown } from 'primereact/dropdown';
|
||||
import ListOfFiles from './components/ListOfFiles';
|
||||
import RepeaterFields from './components/RepeaterFields';
|
||||
import EvaluationExtraFiles from './components/EvaluationExtraFiles';
|
||||
import ApplicationInfo from './components/ApplicationInfo';
|
||||
import ApplicationDownloadFiles from './components/ApplicationDownloadFiles';
|
||||
import FormField from '../../components/FormField';
|
||||
@@ -1337,9 +1337,9 @@ const DomandaEditPreInstructor = () => {
|
||||
useEffect(() => {
|
||||
const maxScore = pathOr(0, ['minScore'], data);
|
||||
const criteria = pathOr([], ['criteria'], data);
|
||||
const scoreSum = sum(criteria.map(o => o.score));
|
||||
const scoreSum = pathOr(0, [], sum(criteria.map(o => o.score)));
|
||||
|
||||
setIsAdmissible(scoreSum !== 0 && scoreSum >= maxScore);
|
||||
setIsAdmissible(scoreSum >= maxScore);
|
||||
}, [data]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -1397,7 +1397,7 @@ const DomandaEditPreInstructor = () => {
|
||||
|
||||
<div className="appPageSection">
|
||||
<h2>{__('Documenti aggiuntivi', 'gepafin')}</h2>
|
||||
<RepeaterFields
|
||||
<EvaluationExtraFiles
|
||||
defaultValue={data.evaluationDocument ?? []}
|
||||
updateFn={(data) => updateEvaluationValue(
|
||||
data,
|
||||
@@ -1414,6 +1414,8 @@ const DomandaEditPreInstructor = () => {
|
||||
})}
|
||||
shouldDisable={['APPROVED', 'REJECTED'].includes(data.applicationStatus) || evaluationBlockedForUser(data)}
|
||||
sourceId={data.id}
|
||||
applicationId={data.applicationId}
|
||||
companyId={data.companyId}
|
||||
sourceName="evaluation"/>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ console.log('data', data.amendmentType)
|
||||
const entityId = !isNaN(parsedId) ? parsedId : 0;
|
||||
|
||||
AmendmentsService.getSoccorsoByApplId(entityId, getCallback, errGetCallback, [
|
||||
['statuses', 'AWAITING,RESPONSE_RECEIVED']
|
||||
['statuses', 'AWAITING, RESPONSE_RECEIVED']
|
||||
]);
|
||||
}, [id]);
|
||||
|
||||
|
||||
@@ -232,9 +232,17 @@ const SoccorsoEditInstructorManager = () => {
|
||||
</div>
|
||||
}
|
||||
|
||||
const doCloseAmendment = () => {
|
||||
const doCloseAmendment = useCallback(() => {
|
||||
if (data.status === 'AWAITING') {
|
||||
const submitData = {
|
||||
internalNote
|
||||
}
|
||||
storeSet('setAsyncRequest');
|
||||
AmendmentsService.closeSoccorso(amendmentId, submitData, closeAmendmentCallback, errCloseAmendmentCallback);
|
||||
} else {
|
||||
doUpdateAmendment(true);
|
||||
}
|
||||
}, [data]);
|
||||
|
||||
const closeAmendmentCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
|
||||
@@ -232,9 +232,17 @@ const SoccorsoEditPreInstructor = () => {
|
||||
</div>
|
||||
}
|
||||
|
||||
const doCloseAmendment = () => {
|
||||
const doCloseAmendment = useCallback(() => {
|
||||
if (data.status === 'AWAITING') {
|
||||
const submitData = {
|
||||
internalNote
|
||||
}
|
||||
storeSet('setAsyncRequest');
|
||||
AmendmentsService.closeSoccorso(amendmentId, submitData, closeAmendmentCallback, errCloseAmendmentCallback);
|
||||
} else {
|
||||
doUpdateAmendment(true);
|
||||
}
|
||||
}, [data]);
|
||||
|
||||
const closeAmendmentCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
|
||||
@@ -71,4 +71,8 @@ export default class ApplicationService {
|
||||
static downloadRanking = (callId, callback, errCallback)=> {
|
||||
NetworkService.getBlob(`${API_BASE_URL}/application/call/${callId}/ranking-csv`, callback, errCallback);
|
||||
}
|
||||
|
||||
static setApplicationDocuments = (id, callback, errCallback, queryParams) => {
|
||||
NetworkService.get(`${API_BASE_URL}/application/${id}/companyDocuments`, callback, errCallback, queryParams);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -39,4 +39,8 @@ export default class CompanyService {
|
||||
static deleteCompany = (id, callback, errCallback) => {
|
||||
NetworkService.delete(`${API_BASE_URL}/company/user/${id}`, {}, callback, errCallback);
|
||||
};
|
||||
|
||||
static getCompanyDocuments = (id, callback, errCallback, queryParams) => {
|
||||
NetworkService.get(`${API_BASE_URL}/companyDocument/company/${id}`, callback, errCallback, queryParams);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user