- added setting for documents category selection for fileselect;
- added confirmation popup for fileselect and fileinput;
This commit is contained in:
@@ -3,7 +3,7 @@ import { __ } from '@wordpress/i18n';
|
||||
import { head, is, isEmpty, isNil, uniq } from 'ramda';
|
||||
|
||||
// store
|
||||
import { storeGet } from '../../../../../../store';
|
||||
import { storeGet, useStore } from '../../../../../../store';
|
||||
|
||||
// tools
|
||||
import renderHtmlContent from '../../../../../../helpers/renderHtmlContent';
|
||||
@@ -23,6 +23,7 @@ import { mimeTypes } from '../../../../../../configData';
|
||||
|
||||
const ElementSetting = ({ setting, changeFn, updateDataFn, bandoStatus }) => {
|
||||
const [existingVars, setExistingVars] = useState([]);
|
||||
const documentCategories = useStore().main.documentCategories();
|
||||
|
||||
const settingLabels = {
|
||||
label: __('Label', 'gepafin'),
|
||||
@@ -32,6 +33,7 @@ const ElementSetting = ({ setting, changeFn, updateDataFn, bandoStatus }) => {
|
||||
isDelegation: __('Delega', 'gepafin'),
|
||||
options: __('Opzioni', 'gepafin'),
|
||||
mime: __('Tipo di file', 'gepafin'),
|
||||
documentCategories: __('Categorie dei documenti', 'gepafin'),
|
||||
text: __('Testo formattato', 'gepafin'),
|
||||
table_columns: '',
|
||||
criteria_table_columns: '',
|
||||
@@ -79,6 +81,13 @@ const ElementSetting = ({ setting, changeFn, updateDataFn, bandoStatus }) => {
|
||||
optionLabel="name"
|
||||
display="chip"
|
||||
placeholder={__('Scegli', 'gepafin')}/>
|
||||
} else if (setting.name === 'documentCategories') {
|
||||
return <MultiSelect
|
||||
value={is(Array, setting.value) ? setting.value : []}
|
||||
onChange={(e) => updateDataFn(setting.name, e.value)}
|
||||
options={documentCategories}
|
||||
display="chip"
|
||||
placeholder={__('Scegli', 'gepafin')}/>
|
||||
} else if (setting.name === 'text') {
|
||||
return <Editor
|
||||
value={setting.value}
|
||||
|
||||
@@ -25,6 +25,7 @@ import BandoService from '../../service/bando-service';
|
||||
|
||||
// TODO temp data
|
||||
import { elementItems } from '../../tempData';
|
||||
import DocumentCategoryService from '../../service/document-category-service';
|
||||
|
||||
const BandoFormsEdit = () => {
|
||||
const { id, formId } = useParams();
|
||||
@@ -257,6 +258,15 @@ const BandoFormsEdit = () => {
|
||||
set404FromErrorResponse(data);
|
||||
}
|
||||
|
||||
const getCategories = (resp) => {
|
||||
if (resp.status === 'SUCCESS') {
|
||||
storeSet.main.documentCategories(resp.data.map(o => ({value: o.id, label: o.description})));
|
||||
}
|
||||
}
|
||||
|
||||
const errGetCategories = () => {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const bandoId = getBandoId();
|
||||
const parsedFormId = parseInt(formId)
|
||||
@@ -283,6 +293,10 @@ const BandoFormsEdit = () => {
|
||||
}
|
||||
}, [id, formId]);
|
||||
|
||||
useEffect(() => {
|
||||
DocumentCategoryService.getCategories(getCategories, errGetCategories)
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="appPage">
|
||||
<div className="appPage__pageHeader">
|
||||
|
||||
Reference in New Issue
Block a user