design-comuni-plone-theme 11.33.1 → 11.34.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.yarn/cache/@tanstack-react-table-npm-8.21.2-f809795b71-3cda97794c.zip +0 -0
- package/.yarn/cache/@tanstack-table-core-npm-8.21.2-0f1fa83089-21573388b2.zip +0 -0
- package/.yarn/cache/{tar-fs-npm-2.1.3-32d6d6fb31-8dd66c2077.zip → tar-fs-npm-2.1.4-90a454735f-a9e18e2e61.zip} +0 -0
- package/.yarn/cache/volto-blocks-widget-npm-3.4.7-1bc2eeb4b5-4350a9c54b.zip +0 -0
- package/.yarn/cache/{volto-form-block-npm-3.12.0-0e050cb6bf-878c6f6af8.zip → volto-form-block-npm-3.13.0-f978a02e9c-0ce41843f5.zip} +0 -0
- package/.yarn/install-state.gz +0 -0
- package/CHANGELOG.md +38 -0
- package/RELEASE.md +26 -0
- package/locales/de/LC_MESSAGES/volto.po +82 -2
- package/locales/en/LC_MESSAGES/volto.po +84 -4
- package/locales/es/LC_MESSAGES/volto.po +82 -2
- package/locales/fr/LC_MESSAGES/volto.po +82 -2
- package/locales/it/LC_MESSAGES/volto.po +84 -4
- package/locales/volto.pot +83 -3
- package/package.json +3 -3
- package/publiccode.yml +2 -2
- package/src/actions/contacts.js +13 -0
- package/src/actions/index.js +3 -0
- package/src/components/ItaliaTheme/Blocks/Common/SearchFilters/DateFilter.jsx +50 -44
- package/src/components/ItaliaTheme/Blocks/Common/SearchFilters/SelectFilter.jsx +3 -2
- package/src/components/ItaliaTheme/Blocks/Common/SearchFilters/TextFilter.jsx +44 -16
- package/src/components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate.jsx +2 -0
- package/src/components/ItaliaTheme/Blocks/Listing/CardWithSlideUpTextTemplate.jsx +4 -1
- package/src/components/ItaliaTheme/Blocks/Listing/RibbonCardTemplate.jsx +1 -0
- package/src/components/ItaliaTheme/Blocks/Listing/SimpleCard/Card/SimpleCardDefault.jsx +1 -0
- package/src/components/ItaliaTheme/Blocks/Listing/TemplatesSkeletons/BandiInEvidenceTemplateSkeleton.jsx +2 -0
- package/src/components/ItaliaTheme/ContactsBlock/ContactsBlock.jsx +77 -0
- package/src/components/ItaliaTheme/View/Commons/PageHeader/PageHeaderTassonomiaArgomenti.jsx +2 -2
- package/src/components/ItaliaTheme/index.js +4 -0
- package/src/components/ItaliaTheme/manage/Widgets/ConditionallyRequiredDateWidget.jsx +25 -0
- package/src/components/ItaliaTheme/manage/Widgets/ContactsWidget/ContactsConfigForm.jsx +90 -0
- package/src/components/ItaliaTheme/manage/Widgets/ContactsWidget/ContactsConfigWidget.jsx +394 -0
- package/src/components/SelectInput/SelectInput.jsx +7 -2
- package/src/config/Widgets/widgets.js +11 -0
- package/src/config/italiaConfig.js +3 -1
- package/src/customizations/volto/components/manage/Widgets/FileWidget.jsx +1 -1
- package/src/customizations/volto/components/theme/Footer/Footer.jsx +8 -1
- package/src/customizations/volto-form-block/components/Edit.jsx +100 -49
- package/src/customizations/volto-form-block/components/Field.jsx +71 -62
- package/src/customizations/volto-form-block/components/FormResult.jsx +25 -18
- package/src/customizations/volto-form-block/components/FormView.jsx +192 -194
- package/src/customizations/volto-form-block/components/Sidebar.jsx +7 -172
- package/src/customizations/volto-form-block/components/View.jsx +9 -5
- package/src/overrideTranslations.jsx +7 -2
- package/src/reducers/contacts.js +38 -0
- package/src/reducers/index.js +2 -0
- package/src/theme/ItaliaTheme/Blocks/_form.scss +20 -1
- package/src/theme/ItaliaTheme/Blocks/common/_searchBlockFilters.scss +56 -0
- package/src/theme/ItaliaTheme/Components/_contactsBlock.scss +40 -0
- package/src/theme/ItaliaTheme/Widgets/_contactsConfigWidget.scss +39 -0
- package/src/theme/site.scss +2 -0
- package/.yarn/cache/volto-blocks-widget-npm-3.4.1-c4d451e2c2-4f5c183698.zip +0 -0
|
@@ -124,216 +124,214 @@ const FormView = ({
|
|
|
124
124
|
return (
|
|
125
125
|
<div className="block form">
|
|
126
126
|
<div className="public-ui">
|
|
127
|
-
<
|
|
128
|
-
|
|
129
|
-
{data
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
<
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
<
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
{
|
|
158
|
-
<
|
|
159
|
-
<
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
getFieldsToSendWithValue(subblock);
|
|
127
|
+
{data?.title && <h2>{data.title}</h2>}
|
|
128
|
+
{data?.description && (
|
|
129
|
+
<div className="block-description">{data.description}</div>
|
|
130
|
+
)}
|
|
131
|
+
<Card className="card-bg rounded py-3" noWrapper={false} tag="div">
|
|
132
|
+
<CardBody tag="div">
|
|
133
|
+
{formState.result ? (
|
|
134
|
+
<FormResult
|
|
135
|
+
formState={formState}
|
|
136
|
+
data={data}
|
|
137
|
+
resetFormState={resetFormState}
|
|
138
|
+
/>
|
|
139
|
+
) : (
|
|
140
|
+
<form
|
|
141
|
+
onSubmit={submit}
|
|
142
|
+
noValidate
|
|
143
|
+
autoComplete="off"
|
|
144
|
+
method="post"
|
|
145
|
+
>
|
|
146
|
+
{/* Controlla che ci siano campi obbligatori al suo interno e applica una legenda */}
|
|
147
|
+
{data.subblocks.some((item) => item.required === true) && (
|
|
148
|
+
<legend className="text-muted text-end mb-3">
|
|
149
|
+
<small>
|
|
150
|
+
{intl.formatMessage(messages.legend_required)}
|
|
151
|
+
</small>
|
|
152
|
+
</legend>
|
|
153
|
+
)}
|
|
154
|
+
{data.static_fields && (
|
|
155
|
+
<fieldset disabled>
|
|
156
|
+
{data.static_fields?.map((field) => (
|
|
157
|
+
<Row key={field.field_id} className="static-field">
|
|
158
|
+
<Col className="py-2">
|
|
159
|
+
<Field
|
|
160
|
+
{...field}
|
|
161
|
+
field_type={field.field_type || 'text'}
|
|
162
|
+
name={
|
|
163
|
+
'static_field_' +
|
|
164
|
+
(field.field_id ??
|
|
165
|
+
field.name?.toLowerCase()?.replace(' ', ''))
|
|
166
|
+
}
|
|
167
|
+
value={field.value}
|
|
168
|
+
onChange={() => {}}
|
|
169
|
+
valid
|
|
170
|
+
disabled
|
|
171
|
+
formHasErrors={formErrors.length > 0}
|
|
172
|
+
/>
|
|
173
|
+
</Col>
|
|
174
|
+
</Row>
|
|
175
|
+
))}
|
|
176
|
+
</fieldset>
|
|
177
|
+
)}
|
|
178
|
+
{data.subblocks.map((subblock, index) => {
|
|
179
|
+
let name = getFieldName(subblock.label, subblock.id);
|
|
180
|
+
const fields_to_send_with_value =
|
|
181
|
+
getFieldsToSendWithValue(subblock);
|
|
183
182
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
183
|
+
return (
|
|
184
|
+
evaluateAllConditions(
|
|
185
|
+
subblock?.visibility_conditions,
|
|
186
|
+
formData,
|
|
187
|
+
) && (
|
|
188
|
+
<Row key={'row' + index}>
|
|
189
|
+
<Col className="py-2">
|
|
190
|
+
<Field
|
|
191
|
+
{...subblock}
|
|
192
|
+
name={name}
|
|
193
|
+
onChange={(field, value) =>
|
|
194
|
+
onChangeFormData(
|
|
195
|
+
subblock.id,
|
|
196
|
+
field,
|
|
197
|
+
value,
|
|
198
|
+
fields_to_send_with_value,
|
|
199
|
+
)
|
|
200
|
+
}
|
|
201
|
+
value={
|
|
202
|
+
subblock.field_type === 'static_text'
|
|
203
|
+
? subblock.value
|
|
204
|
+
: formData[name]?.value
|
|
205
|
+
}
|
|
206
|
+
valid={isValidField(name)}
|
|
207
|
+
errorMessage={getErrorMessage(name)}
|
|
208
|
+
formHasErrors={formErrors.length > 0}
|
|
209
|
+
/>
|
|
210
|
+
</Col>
|
|
211
|
+
</Row>
|
|
212
|
+
)
|
|
213
|
+
);
|
|
214
|
+
})}
|
|
215
|
+
|
|
216
|
+
{/*OTP*/}
|
|
217
|
+
{data.email_otp_verification ? (
|
|
218
|
+
data.subblocks
|
|
219
|
+
.filter((subblock) => subblock.use_as_bcc)
|
|
220
|
+
.map((subblock, index) => {
|
|
221
|
+
const fieldName = getFieldName(
|
|
222
|
+
subblock.label,
|
|
223
|
+
subblock.id,
|
|
224
|
+
);
|
|
225
|
+
const name = fieldName + OTP_FIELDNAME_EXTENDER;
|
|
226
|
+
const fieldValue = formData[fieldName]?.value;
|
|
227
|
+
const value = formData[fieldName]?.otp;
|
|
228
|
+
const fields_to_send_with_value =
|
|
229
|
+
getFieldsToSendWithValue(subblock);
|
|
230
|
+
|
|
231
|
+
return (
|
|
232
|
+
<Row key={'row_otp' + index}>
|
|
190
233
|
<Col className="py-2">
|
|
191
|
-
<
|
|
234
|
+
<OTPWidget
|
|
192
235
|
{...subblock}
|
|
193
|
-
|
|
194
|
-
onChange={(field, value) =>
|
|
236
|
+
fieldValue={fieldValue}
|
|
237
|
+
onChange={(field, value) => {
|
|
195
238
|
onChangeFormData(
|
|
196
239
|
subblock.id,
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
240
|
+
fieldName,
|
|
241
|
+
fieldValue,
|
|
242
|
+
{
|
|
243
|
+
...fields_to_send_with_value,
|
|
244
|
+
otp: value,
|
|
245
|
+
},
|
|
246
|
+
);
|
|
247
|
+
}}
|
|
248
|
+
value={value}
|
|
207
249
|
valid={isValidField(name)}
|
|
208
250
|
errorMessage={getErrorMessage(name)}
|
|
209
|
-
formHasErrors={formErrors
|
|
251
|
+
formHasErrors={formErrors?.length > 0}
|
|
252
|
+
path={path}
|
|
253
|
+
block_id={block_id}
|
|
210
254
|
/>
|
|
211
255
|
</Col>
|
|
212
256
|
</Row>
|
|
213
|
-
)
|
|
214
|
-
)
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
{data.email_otp_verification ? (
|
|
219
|
-
data.subblocks
|
|
220
|
-
.filter((subblock) => subblock.use_as_bcc)
|
|
221
|
-
.map((subblock, index) => {
|
|
222
|
-
const fieldName = getFieldName(
|
|
223
|
-
subblock.label,
|
|
224
|
-
subblock.id,
|
|
225
|
-
);
|
|
226
|
-
const name = fieldName + OTP_FIELDNAME_EXTENDER;
|
|
227
|
-
const fieldValue = formData[fieldName]?.value;
|
|
228
|
-
const value = formData[fieldName]?.otp;
|
|
229
|
-
const fields_to_send_with_value =
|
|
230
|
-
getFieldsToSendWithValue(subblock);
|
|
231
|
-
|
|
232
|
-
return (
|
|
233
|
-
<Row key={'row_otp' + index}>
|
|
234
|
-
<Col className="py-2">
|
|
235
|
-
<OTPWidget
|
|
236
|
-
{...subblock}
|
|
237
|
-
fieldValue={fieldValue}
|
|
238
|
-
onChange={(field, value) => {
|
|
239
|
-
onChangeFormData(
|
|
240
|
-
subblock.id,
|
|
241
|
-
fieldName,
|
|
242
|
-
fieldValue,
|
|
243
|
-
{
|
|
244
|
-
...fields_to_send_with_value,
|
|
245
|
-
otp: value,
|
|
246
|
-
},
|
|
247
|
-
);
|
|
248
|
-
}}
|
|
249
|
-
value={value}
|
|
250
|
-
valid={isValidField(name)}
|
|
251
|
-
errorMessage={getErrorMessage(name)}
|
|
252
|
-
formHasErrors={formErrors?.length > 0}
|
|
253
|
-
path={path}
|
|
254
|
-
block_id={block_id}
|
|
255
|
-
/>
|
|
256
|
-
</Col>
|
|
257
|
-
</Row>
|
|
258
|
-
);
|
|
259
|
-
})
|
|
260
|
-
) : (
|
|
261
|
-
<></>
|
|
262
|
-
)}
|
|
257
|
+
);
|
|
258
|
+
})
|
|
259
|
+
) : (
|
|
260
|
+
<></>
|
|
261
|
+
)}
|
|
263
262
|
|
|
264
|
-
|
|
263
|
+
{enableCaptcha && <>{captcha.render()}</>}
|
|
265
264
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
265
|
+
{formErrors.length > 0 && (
|
|
266
|
+
<Alert
|
|
267
|
+
color="danger"
|
|
268
|
+
fade
|
|
269
|
+
isOpen
|
|
270
|
+
tag="div"
|
|
271
|
+
transition={alertTransition}
|
|
272
|
+
>
|
|
273
|
+
<h4>{intl.formatMessage(messages.error)}</h4>
|
|
274
|
+
<p>{intl.formatMessage(messages.form_errors)}</p>
|
|
275
|
+
</Alert>
|
|
276
|
+
)}
|
|
277
|
+
{formState.error && (
|
|
278
|
+
<Alert
|
|
279
|
+
color="danger"
|
|
280
|
+
fade
|
|
281
|
+
isOpen
|
|
282
|
+
tag="div"
|
|
283
|
+
transition={alertTransition}
|
|
284
|
+
>
|
|
285
|
+
<h4>{intl.formatMessage(messages.error)}</h4>
|
|
286
|
+
<p>{formState.error}</p>
|
|
287
|
+
</Alert>
|
|
288
|
+
)}
|
|
290
289
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
<Button
|
|
295
|
-
color="secondary"
|
|
296
|
-
type="button"
|
|
297
|
-
onClick={(e) => {
|
|
298
|
-
e.preventDefault();
|
|
299
|
-
e.stopPropagation();
|
|
300
|
-
resetFormState();
|
|
301
|
-
}}
|
|
302
|
-
className="me-2"
|
|
303
|
-
>
|
|
304
|
-
{data.cancel_label ||
|
|
305
|
-
intl.formatMessage(messages.default_cancel_label)}
|
|
306
|
-
</Button>
|
|
307
|
-
)}
|
|
290
|
+
<Row>
|
|
291
|
+
<Col align="center">
|
|
292
|
+
{data?.show_cancel && (
|
|
308
293
|
<Button
|
|
309
|
-
color="
|
|
310
|
-
type="
|
|
311
|
-
|
|
312
|
-
(
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
}
|
|
294
|
+
color="secondary"
|
|
295
|
+
type="button"
|
|
296
|
+
onClick={(e) => {
|
|
297
|
+
e.preventDefault();
|
|
298
|
+
e.stopPropagation();
|
|
299
|
+
resetFormState();
|
|
300
|
+
}}
|
|
301
|
+
className="me-2"
|
|
316
302
|
>
|
|
317
|
-
{data.
|
|
318
|
-
intl.formatMessage(messages.
|
|
319
|
-
|
|
320
|
-
{formState.loading && (
|
|
321
|
-
<span>
|
|
322
|
-
<Progress
|
|
323
|
-
indeterminate={true}
|
|
324
|
-
role="progressbar"
|
|
325
|
-
tag="div"
|
|
326
|
-
/>
|
|
327
|
-
</span>
|
|
328
|
-
)}
|
|
303
|
+
{data.cancel_label ||
|
|
304
|
+
intl.formatMessage(messages.default_cancel_label)}
|
|
329
305
|
</Button>
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
306
|
+
)}
|
|
307
|
+
<Button
|
|
308
|
+
color="primary"
|
|
309
|
+
type="submit"
|
|
310
|
+
disabled={
|
|
311
|
+
(enableCaptcha &&
|
|
312
|
+
!captcha?.props?.captchaToken?.current) ||
|
|
313
|
+
formState.loading
|
|
314
|
+
}
|
|
315
|
+
>
|
|
316
|
+
{data.submit_label ||
|
|
317
|
+
intl.formatMessage(messages.default_submit_label)}
|
|
318
|
+
|
|
319
|
+
{formState.loading && (
|
|
320
|
+
<span>
|
|
321
|
+
<Progress
|
|
322
|
+
indeterminate={true}
|
|
323
|
+
role="progressbar"
|
|
324
|
+
tag="div"
|
|
325
|
+
/>
|
|
326
|
+
</span>
|
|
327
|
+
)}
|
|
328
|
+
</Button>
|
|
329
|
+
</Col>
|
|
330
|
+
</Row>
|
|
331
|
+
</form>
|
|
332
|
+
)}
|
|
333
|
+
</CardBody>
|
|
334
|
+
</Card>
|
|
337
335
|
</div>
|
|
338
336
|
</div>
|
|
339
337
|
);
|
|
@@ -1,65 +1,27 @@
|
|
|
1
1
|
// CUSTOMIZATION:
|
|
2
2
|
// - 112-113 reset subscription limit to default when set_limit is not active
|
|
3
3
|
|
|
4
|
-
import React, {
|
|
4
|
+
import React, { useEffect } from 'react';
|
|
5
|
+
import { useDispatch } from 'react-redux';
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
Segment,
|
|
9
|
-
Accordion,
|
|
10
|
-
Form,
|
|
11
|
-
Button,
|
|
12
|
-
Grid,
|
|
13
|
-
Confirm,
|
|
14
|
-
Dimmer,
|
|
15
|
-
Loader,
|
|
16
|
-
} from 'semantic-ui-react';
|
|
7
|
+
import { Segment, Accordion, Form, Grid } from 'semantic-ui-react';
|
|
17
8
|
import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
|
|
18
9
|
|
|
19
|
-
import
|
|
10
|
+
import Icon from '@plone/volto/components/theme/Icon/Icon';
|
|
20
11
|
|
|
21
12
|
import upSVG from '@plone/volto/icons/up-key.svg';
|
|
22
13
|
import downSVG from '@plone/volto/icons/down-key.svg';
|
|
23
|
-
import downloadSVG from '@plone/volto/icons/download.svg';
|
|
24
|
-
import deleteSVG from '@plone/volto/icons/delete.svg';
|
|
25
14
|
|
|
26
|
-
import
|
|
15
|
+
import config from '@plone/volto/registry';
|
|
27
16
|
|
|
28
|
-
import {
|
|
29
|
-
getFormData,
|
|
30
|
-
exportCsvFormData,
|
|
31
|
-
clearFormData,
|
|
32
|
-
setSubblocksIDList,
|
|
33
|
-
} from 'volto-form-block/actions';
|
|
17
|
+
import { setSubblocksIDList } from 'volto-form-block/actions';
|
|
34
18
|
|
|
35
19
|
import { BlockDataForm } from '@plone/volto/components';
|
|
36
|
-
import { flattenToAppURL } from '@plone/volto/helpers';
|
|
37
20
|
import { getFieldName } from 'volto-form-block/components/utils';
|
|
38
21
|
|
|
39
22
|
import 'volto-form-block/components/Sidebar.css';
|
|
40
|
-
import config from '@plone/volto/registry';
|
|
41
23
|
|
|
42
24
|
const messages = defineMessages({
|
|
43
|
-
exportCsv: {
|
|
44
|
-
id: 'form_edit_exportCsv',
|
|
45
|
-
defaultMessage: 'Export data',
|
|
46
|
-
},
|
|
47
|
-
clearData: {
|
|
48
|
-
id: 'form_clear_data',
|
|
49
|
-
defaultMessage: 'Clear data',
|
|
50
|
-
},
|
|
51
|
-
formDataCount: {
|
|
52
|
-
id: 'form_formDataCount',
|
|
53
|
-
defaultMessage: '{formDataCount} item(s) stored',
|
|
54
|
-
},
|
|
55
|
-
confirmClearData: {
|
|
56
|
-
id: 'form_confirmClearData',
|
|
57
|
-
defaultMessage: 'Are you sure you want to delete all saved items?',
|
|
58
|
-
},
|
|
59
|
-
cancel: {
|
|
60
|
-
id: 'Cancel',
|
|
61
|
-
defaultMessage: 'Cancel',
|
|
62
|
-
},
|
|
63
25
|
fieldId: {
|
|
64
26
|
id: 'fieldId',
|
|
65
27
|
defaultMessage: 'Field ID',
|
|
@@ -91,22 +53,6 @@ const Sidebar = ({
|
|
|
91
53
|
}) => {
|
|
92
54
|
const intl = useIntl();
|
|
93
55
|
const dispatch = useDispatch();
|
|
94
|
-
const [confirmOpen, setConfirmOpen] = useState(false);
|
|
95
|
-
|
|
96
|
-
const formData = useSelector((state) => state.formData);
|
|
97
|
-
const clearFormDataState = useSelector(
|
|
98
|
-
(state) => state.clearFormData?.loaded,
|
|
99
|
-
);
|
|
100
|
-
useEffect(() => {
|
|
101
|
-
if (properties?.['@id'])
|
|
102
|
-
dispatch(
|
|
103
|
-
getFormData({
|
|
104
|
-
path: flattenToAppURL(properties['@id']),
|
|
105
|
-
block_id: block,
|
|
106
|
-
}),
|
|
107
|
-
);
|
|
108
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
109
|
-
}, [clearFormDataState]);
|
|
110
56
|
|
|
111
57
|
if (data.send_email === undefined) data.send_email = true;
|
|
112
58
|
|
|
@@ -149,117 +95,7 @@ const Sidebar = ({
|
|
|
149
95
|
/>
|
|
150
96
|
{properties?.['@components']?.form_data && (
|
|
151
97
|
<Form.Field inline>
|
|
152
|
-
<Grid>
|
|
153
|
-
<Grid.Row stretched centered style={{ padding: '1rem 0' }}>
|
|
154
|
-
<Dimmer active={formData?.loading}>
|
|
155
|
-
<Loader size="tiny" />
|
|
156
|
-
</Dimmer>
|
|
157
|
-
<p>
|
|
158
|
-
{intl.formatMessage(messages.formDataCount, {
|
|
159
|
-
formDataCount: formData?.result?.items_total ?? 0,
|
|
160
|
-
})}
|
|
161
|
-
</p>
|
|
162
|
-
</Grid.Row>
|
|
163
|
-
<Grid.Row
|
|
164
|
-
stretched
|
|
165
|
-
centered
|
|
166
|
-
columns={2}
|
|
167
|
-
style={{ marginBottom: '0.5rem' }}
|
|
168
|
-
>
|
|
169
|
-
<Grid.Column>
|
|
170
|
-
<Button
|
|
171
|
-
compact
|
|
172
|
-
onClick={() =>
|
|
173
|
-
dispatch(
|
|
174
|
-
exportCsvFormData(
|
|
175
|
-
flattenToAppURL(properties['@id']),
|
|
176
|
-
`export-${properties.id ?? 'form'}.csv`,
|
|
177
|
-
block,
|
|
178
|
-
),
|
|
179
|
-
)
|
|
180
|
-
}
|
|
181
|
-
size="tiny"
|
|
182
|
-
style={{ display: 'flex', alignItems: 'center' }}
|
|
183
|
-
>
|
|
184
|
-
<Icon name={downloadSVG} size="1.5rem" />{' '}
|
|
185
|
-
{intl.formatMessage(messages.exportCsv)}
|
|
186
|
-
</Button>
|
|
187
|
-
</Grid.Column>
|
|
188
|
-
<Grid.Column>
|
|
189
|
-
<Button
|
|
190
|
-
compact
|
|
191
|
-
onClick={() => setConfirmOpen(true)}
|
|
192
|
-
size="tiny"
|
|
193
|
-
style={{ display: 'flex', alignItems: 'center' }}
|
|
194
|
-
>
|
|
195
|
-
<Icon name={deleteSVG} size="1.5rem" />{' '}
|
|
196
|
-
{intl.formatMessage(messages.clearData)}
|
|
197
|
-
</Button>
|
|
198
|
-
<Confirm
|
|
199
|
-
open={confirmOpen}
|
|
200
|
-
content={intl.formatMessage(messages.confirmClearData)}
|
|
201
|
-
cancelButton={intl.formatMessage(messages.cancel)}
|
|
202
|
-
onCancel={() => setConfirmOpen(false)}
|
|
203
|
-
onConfirm={() => {
|
|
204
|
-
dispatch(
|
|
205
|
-
clearFormData({
|
|
206
|
-
path: flattenToAppURL(properties['@id']),
|
|
207
|
-
block_id: block,
|
|
208
|
-
}),
|
|
209
|
-
);
|
|
210
|
-
setConfirmOpen(false);
|
|
211
|
-
}}
|
|
212
|
-
/>
|
|
213
|
-
</Grid.Column>
|
|
214
|
-
</Grid.Row>
|
|
215
|
-
{data.remove_data_after_days > 0 && (
|
|
216
|
-
<Grid.Row>
|
|
217
|
-
<div class="ui message info tiny">
|
|
218
|
-
{formData.loaded &&
|
|
219
|
-
formData.result?.expired_total > 0 && (
|
|
220
|
-
<>
|
|
221
|
-
<p>
|
|
222
|
-
<Icon name={warningSVG} size="18px" />
|
|
223
|
-
{intl.formatMessage(
|
|
224
|
-
messages.remove_data_warning,
|
|
225
|
-
{
|
|
226
|
-
record: formData.result.expired_total,
|
|
227
|
-
},
|
|
228
|
-
)}
|
|
229
|
-
</p>
|
|
230
|
-
<p>
|
|
231
|
-
<Button
|
|
232
|
-
onClick={() =>
|
|
233
|
-
dispatch(
|
|
234
|
-
clearFormData({
|
|
235
|
-
path: flattenToAppURL(properties['@id']),
|
|
236
|
-
expired: true,
|
|
237
|
-
block_id: block,
|
|
238
|
-
}),
|
|
239
|
-
)
|
|
240
|
-
}
|
|
241
|
-
size="tiny"
|
|
242
|
-
compact
|
|
243
|
-
style={{
|
|
244
|
-
display: 'flex',
|
|
245
|
-
alignItems: 'center',
|
|
246
|
-
}}
|
|
247
|
-
>
|
|
248
|
-
<Icon name={deleteSVG} size="1.5rem" />{' '}
|
|
249
|
-
{intl.formatMessage(
|
|
250
|
-
messages.remove_data_button,
|
|
251
|
-
)}
|
|
252
|
-
</Button>
|
|
253
|
-
</p>
|
|
254
|
-
</>
|
|
255
|
-
)}
|
|
256
|
-
<p>
|
|
257
|
-
{intl.formatMessage(messages.remove_data_cron_info)}
|
|
258
|
-
</p>
|
|
259
|
-
</div>
|
|
260
|
-
</Grid.Row>
|
|
261
|
-
)}
|
|
262
|
-
</Grid>
|
|
98
|
+
<Grid></Grid>
|
|
263
99
|
</Form.Field>
|
|
264
100
|
)}
|
|
265
101
|
</Segment>
|
|
@@ -307,7 +143,6 @@ const Sidebar = ({
|
|
|
307
143
|
if (subblock.field_type === 'static_text') {
|
|
308
144
|
update_values.required = false;
|
|
309
145
|
}
|
|
310
|
-
|
|
311
146
|
onChangeSubBlock(index, {
|
|
312
147
|
...subblock,
|
|
313
148
|
[name]: value,
|
|
@@ -242,8 +242,8 @@ const View = ({ data, id, path }) => {
|
|
|
242
242
|
.verify()
|
|
243
243
|
.then(() => {
|
|
244
244
|
if (isValidForm()) {
|
|
245
|
-
|
|
246
|
-
|
|
245
|
+
const attachments = {};
|
|
246
|
+
const captcha = {
|
|
247
247
|
provider: data.captcha,
|
|
248
248
|
token: captchaToken.current,
|
|
249
249
|
};
|
|
@@ -251,9 +251,9 @@ const View = ({ data, id, path }) => {
|
|
|
251
251
|
captcha.value = formData[data.captcha_props.id]?.value ?? '';
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
-
|
|
254
|
+
const formattedFormData = { ...formData };
|
|
255
255
|
data.subblocks.forEach((subblock) => {
|
|
256
|
-
|
|
256
|
+
const name = getFieldName(subblock.label, subblock.id);
|
|
257
257
|
if (formattedFormData[name]?.value) {
|
|
258
258
|
formattedFormData[name].field_id = subblock.field_id;
|
|
259
259
|
const isAttachment =
|
|
@@ -263,7 +263,11 @@ const View = ({ data, id, path }) => {
|
|
|
263
263
|
// const isDate = subblock.field_type === 'date';
|
|
264
264
|
|
|
265
265
|
if (isAttachment) {
|
|
266
|
-
attachments[name] =
|
|
266
|
+
attachments[name] = {
|
|
267
|
+
...formattedFormData[name].value,
|
|
268
|
+
label: formattedFormData[name].label,
|
|
269
|
+
field_id: subblock.field_id,
|
|
270
|
+
};
|
|
267
271
|
delete formattedFormData[name];
|
|
268
272
|
}
|
|
269
273
|
|