@visns-studio/visns-components 4.7.0 → 4.7.2
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/dist/104e5636d8ddb791614c.woff2 +0 -0
- package/dist/11fe6a83d647de5daf95.woff +0 -0
- package/dist/141e2a8c7836495afe2a.woff +0 -0
- package/dist/2ba5877f7079830b5383.woff +0 -0
- package/dist/2d6836f45b2037be41f3.woff +0 -0
- package/dist/399.0a0f3e0d21be1057d599.css +8 -0
- package/dist/399.b8f57fa3f8c0c10119e4.js +1 -0
- package/dist/47d566c3b1293dfd9d77.woff +0 -0
- package/dist/6282a13cbba671a71913.woff2 +0 -0
- package/dist/78266f551031aa9db127.woff +0 -0
- package/dist/7b7da89f1e3fdcbfe36c.woff2 +0 -0
- package/dist/7e78e8338af7efeda712.woff2 +0 -0
- package/dist/7fa387951673abf164b1.woff2 +0 -0
- package/dist/819d59862c2d0640aad8.woff +0 -0
- package/dist/b615e1a6c838ea059a56.woff +0 -0
- package/dist/b9b1aa739c660c4ce67c.woff2 +0 -0
- package/dist/c5f3640b11df9414facb.woff +0 -0
- package/dist/da26d162ff5af71d6590.woff2 +0 -0
- package/dist/dd5b2912dbf896310865.woff2 +0 -0
- package/dist/f282b331272463c1aa6c.woff2 +0 -0
- package/dist/index.css +2902 -0
- package/dist/index.js +2 -0
- package/dist/index.js.LICENSE.txt +150 -0
- package/dist/main.83b033670d64419bb497.css +1 -0
- package/dist/main.b1723d17cd2d3513ab62.js +1 -0
- package/dist/report.html +39 -0
- package/dist/runtime.33c276593b23f8035b8d.js +1 -0
- package/package.json +26 -6
- package/.idea/codeStyles/Project.xml +0 -50
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/deployment.xml +0 -4
- package/.idea/modules.xml +0 -8
- package/.idea/php.xml +0 -19
- package/.idea/vcs.xml +0 -6
- package/.idea/visns-components.iml +0 -8
- package/.prettierrc.json +0 -7
- package/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +0 -541
- package/.yarn/releases/yarn-3.6.1.cjs +0 -874
- package/.yarnrc.yml +0 -7
- package/components/cms/DataGrid.jsx +0 -1461
- package/components/cms/DropZone.jsx +0 -349
- package/components/cms/Field.jsx +0 -802
- package/components/cms/Form.jsx +0 -476
- package/components/cms/generic/CmsDetail.jsx +0 -36
- package/components/cms/generic/CmsIndex.jsx +0 -73
- package/components/cms/generic/CmsSort.jsx +0 -125
- package/components/cms/sorting/Item.jsx +0 -115
- package/components/cms/sorting/List.jsx +0 -30
- package/components/crm/AsyncSelect.jsx +0 -125
- package/components/crm/Autocomplete.jsx +0 -174
- package/components/crm/Breadcrumb.jsx +0 -52
- package/components/crm/Call.jsx +0 -220
- package/components/crm/DataGrid.jsx +0 -2701
- package/components/crm/Download.jsx +0 -101
- package/components/crm/Fetch.jsx +0 -119
- package/components/crm/Field.jsx +0 -1557
- package/components/crm/Form.jsx +0 -1409
- package/components/crm/Loader.jsx +0 -29
- package/components/crm/MultiSelect.jsx +0 -78
- package/components/crm/Navigation.jsx +0 -619
- package/components/crm/Notification.jsx +0 -197
- package/components/crm/QrCode.jsx +0 -83
- package/components/crm/Select.jsx +0 -58
- package/components/crm/SelectList.jsx +0 -21
- package/components/crm/TableFilter.jsx +0 -198
- package/components/crm/auth/Login.jsx +0 -223
- package/components/crm/auth/Profile.jsx +0 -280
- package/components/crm/auth/Reset.jsx +0 -111
- package/components/crm/auth/Verify.jsx +0 -174
- package/components/crm/auth/styles/Login.module.css +0 -243
- package/components/crm/auth/styles/Profile.module.css +0 -222
- package/components/crm/auth/styles/Reset.module.css +0 -216
- package/components/crm/auth/styles/Verify.module.css +0 -216
- package/components/crm/generic/AuditLog.jsx +0 -108
- package/components/crm/generic/AuditLogs.jsx +0 -115
- package/components/crm/generic/GenericAuth.jsx +0 -166
- package/components/crm/generic/GenericDashboard.jsx +0 -42
- package/components/crm/generic/GenericDetail.jsx +0 -1499
- package/components/crm/generic/GenericDynamic.jsx +0 -915
- package/components/crm/generic/GenericFormBuilder.jsx +0 -1765
- package/components/crm/generic/GenericIndex.jsx +0 -376
- package/components/crm/generic/GenericMain.jsx +0 -129
- package/components/crm/generic/GenericSort.jsx +0 -188
- package/components/crm/generic/NotificationList.jsx +0 -64
- package/components/crm/generic/styles/AuditLog.module.css +0 -147
- package/components/crm/generic/styles/AuditLogs.module.css +0 -92
- package/components/crm/generic/styles/GenericDetail.module.css +0 -634
- package/components/crm/generic/styles/GenericDynamic.module.css +0 -932
- package/components/crm/generic/styles/GenericFormBuilder.module.css +0 -944
- package/components/crm/generic/styles/GenericIndex.module.css +0 -247
- package/components/crm/generic/styles/GenericMain.module.css +0 -91
- package/components/crm/generic/styles/GenericSort.module.css +0 -123
- package/components/crm/generic/styles/NotificationList.module.css +0 -67
- package/components/crm/sorting/Item.jsx +0 -117
- package/components/crm/sorting/List.jsx +0 -32
- package/components/crm/sorting/styles/Item.module.css +0 -68
- package/components/crm/sorting/styles/List.module.css +0 -68
- package/components/crm/styles/AsyncSelect.module.css +0 -8
- package/components/crm/styles/Autocomplete.module.css +0 -44
- package/components/crm/styles/DataGrid.module.css +0 -210
- package/components/crm/styles/Field.module.css +0 -311
- package/components/crm/styles/Form.module.css +0 -499
- package/components/crm/styles/Loader.module.css +0 -94
- package/components/crm/styles/MultiSelect.module.css +0 -8
- package/components/crm/styles/Navigation.module.css +0 -978
- package/components/crm/styles/Notification.module.css +0 -147
- package/components/crm/styles/QrCode.module.css +0 -87
- package/components/crm/styles/TableFilter.module.css +0 -52
- package/components/styles/global.css +0 -73
- package/index.js +0 -86
|
@@ -1,1765 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { useParams } from 'react-router-dom';
|
|
3
|
-
import Popup from 'reactjs-popup';
|
|
4
|
-
import { arrayMoveImmutable } from 'array-move';
|
|
5
|
-
import { confirmAlert } from 'react-confirm-alert';
|
|
6
|
-
import parse from 'html-react-parser';
|
|
7
|
-
import Toggle from 'react-toggle';
|
|
8
|
-
import { toast } from 'react-toastify';
|
|
9
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
10
|
-
import { Editor } from '@tinymce/tinymce-react';
|
|
11
|
-
import { CircleChevronRight, CirclePlus, CircleX, TrashCan } from 'akar-icons';
|
|
12
|
-
|
|
13
|
-
import 'react-toggle/style.css';
|
|
14
|
-
import 'react-datepicker/dist/react-datepicker.css';
|
|
15
|
-
import 'react-confirm-alert/src/react-confirm-alert.css';
|
|
16
|
-
|
|
17
|
-
import Breadcrumb from '../Breadcrumb';
|
|
18
|
-
import CustomFetch from '../Fetch';
|
|
19
|
-
import SortableList from '../../../components/cms/sorting/List';
|
|
20
|
-
|
|
21
|
-
import styles from './styles/GenericFormBuilder.module.css'; // Import the CSS module
|
|
22
|
-
|
|
23
|
-
function GenericFormBuilder({ setting, urlParam, userProfile }) {
|
|
24
|
-
const editorRef = useRef(null);
|
|
25
|
-
const routeParams = useParams();
|
|
26
|
-
|
|
27
|
-
const { dynamicDropdowns, fetchUrl, fields, parentUrl, formTitle } =
|
|
28
|
-
setting;
|
|
29
|
-
|
|
30
|
-
const { dataId } = useParams();
|
|
31
|
-
const [data, setData] = useState({});
|
|
32
|
-
const [dataField, setDataField] = useState({
|
|
33
|
-
id: '',
|
|
34
|
-
label: '',
|
|
35
|
-
description: '',
|
|
36
|
-
type: '',
|
|
37
|
-
options: [],
|
|
38
|
-
rows: [],
|
|
39
|
-
size: 'half',
|
|
40
|
-
required: 'no',
|
|
41
|
-
});
|
|
42
|
-
const [dataOption, setDataOption] = useState({
|
|
43
|
-
id: '',
|
|
44
|
-
label: '',
|
|
45
|
-
type: '',
|
|
46
|
-
});
|
|
47
|
-
const [rowOption, setRowOption] = useState({
|
|
48
|
-
id: '',
|
|
49
|
-
label: '',
|
|
50
|
-
});
|
|
51
|
-
const [modalShow, setModalShow] = useState(false);
|
|
52
|
-
const [modalType, setModalType] = useState({
|
|
53
|
-
type: 'create',
|
|
54
|
-
key: '',
|
|
55
|
-
});
|
|
56
|
-
const [modalFormShow, setModalFormShow] = useState(false);
|
|
57
|
-
const [roles, setRoles] = useState([]);
|
|
58
|
-
|
|
59
|
-
/** Data Option Functionalities */
|
|
60
|
-
const handleDataOption = (e) => {
|
|
61
|
-
const { name, value } = e.target;
|
|
62
|
-
|
|
63
|
-
setDataOption((items) => ({
|
|
64
|
-
...items,
|
|
65
|
-
[name]: value,
|
|
66
|
-
id: `${slugify(value)}-`,
|
|
67
|
-
}));
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const handleAddOption = (e) => {
|
|
71
|
-
e.preventDefault();
|
|
72
|
-
|
|
73
|
-
if (dataOption.label !== '') {
|
|
74
|
-
const isLabelUnique = !dataField.options.some(
|
|
75
|
-
(option) => option.label === dataOption.label
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
if (isLabelUnique) {
|
|
79
|
-
setDataField((items) => ({
|
|
80
|
-
...items,
|
|
81
|
-
options: [...items.options, dataOption],
|
|
82
|
-
}));
|
|
83
|
-
|
|
84
|
-
setDataOption(() => ({
|
|
85
|
-
id: '',
|
|
86
|
-
label: '',
|
|
87
|
-
type: '',
|
|
88
|
-
}));
|
|
89
|
-
} else {
|
|
90
|
-
toast.warn('Option label must be unique.');
|
|
91
|
-
}
|
|
92
|
-
} else {
|
|
93
|
-
toast.warn('Please enter a label for the option.');
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const handleDeleteOption = (e) => {
|
|
98
|
-
e.preventDefault();
|
|
99
|
-
|
|
100
|
-
const { counter } = e.target.dataset;
|
|
101
|
-
|
|
102
|
-
setDataField((prevState) => {
|
|
103
|
-
const options = prevState.options.slice();
|
|
104
|
-
options.splice(counter, 1);
|
|
105
|
-
|
|
106
|
-
return {
|
|
107
|
-
...prevState,
|
|
108
|
-
options: options,
|
|
109
|
-
};
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
/** Row Option Functionalities */
|
|
114
|
-
const handleRowOption = (e) => {
|
|
115
|
-
const { name, value } = e.target;
|
|
116
|
-
|
|
117
|
-
setRowOption((items) => ({
|
|
118
|
-
...items,
|
|
119
|
-
[name]: value,
|
|
120
|
-
id: `${slugify(value)}-`,
|
|
121
|
-
}));
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
const handleAddRowOption = (e) => {
|
|
125
|
-
e.preventDefault();
|
|
126
|
-
|
|
127
|
-
// Initialize rows if it doesn't exist
|
|
128
|
-
if (!dataField.rows) {
|
|
129
|
-
setDataField((items) => ({
|
|
130
|
-
...items,
|
|
131
|
-
rows: [],
|
|
132
|
-
}));
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
if (rowOption.label !== '') {
|
|
136
|
-
const isLabelUnique = dataField.rows
|
|
137
|
-
? !dataField.rows.some(
|
|
138
|
-
(option) => option.label === rowOption.label
|
|
139
|
-
)
|
|
140
|
-
: true;
|
|
141
|
-
|
|
142
|
-
if (isLabelUnique) {
|
|
143
|
-
setDataField((items) => ({
|
|
144
|
-
...items,
|
|
145
|
-
rows: [...(items.rows || []), rowOption],
|
|
146
|
-
}));
|
|
147
|
-
|
|
148
|
-
setRowOption(() => ({
|
|
149
|
-
id: '',
|
|
150
|
-
label: '',
|
|
151
|
-
}));
|
|
152
|
-
} else {
|
|
153
|
-
toast.warn('Option label must be unique.');
|
|
154
|
-
}
|
|
155
|
-
} else {
|
|
156
|
-
toast.warn('Please enter a label for the option.');
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
const handleDeleteRowOption = (e) => {
|
|
161
|
-
e.preventDefault();
|
|
162
|
-
|
|
163
|
-
const { counter } = e.target.dataset;
|
|
164
|
-
|
|
165
|
-
setDataField((prevState) => {
|
|
166
|
-
const rows = prevState.rows.slice();
|
|
167
|
-
rows.splice(counter, 1);
|
|
168
|
-
|
|
169
|
-
return {
|
|
170
|
-
...prevState,
|
|
171
|
-
rows: rows,
|
|
172
|
-
};
|
|
173
|
-
});
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
/** Field Functionalities */
|
|
177
|
-
const onSortEnd = ({ oldIndex, newIndex }) => {
|
|
178
|
-
const newData = arrayMoveImmutable(data.detail, oldIndex, newIndex);
|
|
179
|
-
|
|
180
|
-
setData((items) => ({
|
|
181
|
-
...items,
|
|
182
|
-
detail: newData,
|
|
183
|
-
}));
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
const handleCloseModal = () => {
|
|
187
|
-
setModalShow(false);
|
|
188
|
-
setDataField(() => ({
|
|
189
|
-
label: '',
|
|
190
|
-
type: '',
|
|
191
|
-
options: [],
|
|
192
|
-
// rows: [],
|
|
193
|
-
size: 'half',
|
|
194
|
-
required: 'no',
|
|
195
|
-
}));
|
|
196
|
-
setModalType(() => ({
|
|
197
|
-
type: 'create',
|
|
198
|
-
key: '',
|
|
199
|
-
}));
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
const handleOpenModal = () => {
|
|
203
|
-
setModalShow(true);
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
const slugify = (text) => {
|
|
207
|
-
return text.replace(/\s+/g, '-').toLowerCase();
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
const handleChangeForm = (e) => {
|
|
211
|
-
if (e) {
|
|
212
|
-
const { name, value } = e.target;
|
|
213
|
-
const updatedValue = name === 'id' ? slugify(value) : value;
|
|
214
|
-
|
|
215
|
-
setDataField((items) => ({
|
|
216
|
-
...items,
|
|
217
|
-
[name]: updatedValue,
|
|
218
|
-
}));
|
|
219
|
-
|
|
220
|
-
if (name === 'label') {
|
|
221
|
-
setDataField((items) => ({
|
|
222
|
-
...items,
|
|
223
|
-
id: slugify(value),
|
|
224
|
-
}));
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
const handleChangeFormRichEditor = (e, value, name) => {
|
|
230
|
-
setDataField((items) => ({
|
|
231
|
-
...items,
|
|
232
|
-
[name]: value,
|
|
233
|
-
}));
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
const handleEdit = (key) => {
|
|
237
|
-
const { detail } = data;
|
|
238
|
-
|
|
239
|
-
setDataField(() => ({
|
|
240
|
-
...detail[key],
|
|
241
|
-
}));
|
|
242
|
-
|
|
243
|
-
setModalType(() => ({
|
|
244
|
-
type: 'update',
|
|
245
|
-
key: key,
|
|
246
|
-
}));
|
|
247
|
-
|
|
248
|
-
handleOpenModal();
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
const handleDeleteField = (id, label) => {
|
|
252
|
-
confirmAlert({
|
|
253
|
-
title: `Delete "${label}" Field`,
|
|
254
|
-
message: 'Are you sure you want to delete this field?',
|
|
255
|
-
buttons: [
|
|
256
|
-
{
|
|
257
|
-
label: 'Yes',
|
|
258
|
-
onClick: () => {
|
|
259
|
-
const index = data.detail.findIndex(
|
|
260
|
-
(item) => item.id === id
|
|
261
|
-
);
|
|
262
|
-
|
|
263
|
-
if (index > -1) {
|
|
264
|
-
let newDetail = [...data.detail];
|
|
265
|
-
newDetail.splice(index, 1);
|
|
266
|
-
|
|
267
|
-
setData((items) => ({
|
|
268
|
-
...items,
|
|
269
|
-
detail: newDetail,
|
|
270
|
-
}));
|
|
271
|
-
|
|
272
|
-
handleCloseModal();
|
|
273
|
-
}
|
|
274
|
-
},
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
label: 'No',
|
|
278
|
-
onClick: () => close(),
|
|
279
|
-
},
|
|
280
|
-
],
|
|
281
|
-
});
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
const handleSaveField = (e) => {
|
|
285
|
-
if (e) {
|
|
286
|
-
e.preventDefault();
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
let field = dataField;
|
|
290
|
-
|
|
291
|
-
field.id = formatFieldId(field.id);
|
|
292
|
-
|
|
293
|
-
let errorMessage = validateField(field);
|
|
294
|
-
|
|
295
|
-
if (errorMessage === '') {
|
|
296
|
-
saveFieldData(field);
|
|
297
|
-
handleCloseModal();
|
|
298
|
-
} else {
|
|
299
|
-
displayErrorMessage(errorMessage);
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
|
|
303
|
-
const formatFieldId = (id) => {
|
|
304
|
-
return id.includes('::') ? id : `${id}::${uuidv4()}`;
|
|
305
|
-
};
|
|
306
|
-
|
|
307
|
-
const validateField = (field) => {
|
|
308
|
-
let errors = [];
|
|
309
|
-
|
|
310
|
-
if (!isIdValid(field.id)) {
|
|
311
|
-
errors.push('Please enter a unique id for the field.');
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
if (field.type === 'plaintext') {
|
|
315
|
-
if (!field.label || field.label === '') {
|
|
316
|
-
errors.push('Please enter a label for the field.');
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
if (!field.description || field.description === '') {
|
|
320
|
-
errors.push('Please enter a description for the field.');
|
|
321
|
-
}
|
|
322
|
-
} else {
|
|
323
|
-
if (!field.label || field.label === '') {
|
|
324
|
-
errors.push('Please enter a label for the field.');
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
if (field.type === '') {
|
|
329
|
-
errors.push('Please select a type for the field.');
|
|
330
|
-
} else if (
|
|
331
|
-
field.type === 'dropdown' &&
|
|
332
|
-
(!field.options || field.options.length === 0)
|
|
333
|
-
) {
|
|
334
|
-
errors.push('Please add options for the dropdown.');
|
|
335
|
-
} else if (
|
|
336
|
-
field.type === 'table_text' &&
|
|
337
|
-
(!field.options || field.options.length === 0)
|
|
338
|
-
) {
|
|
339
|
-
errors.push('Please add options for the table.');
|
|
340
|
-
} else if (field.type === 'table_radio') {
|
|
341
|
-
if (!field.options || field.options.length === 0) {
|
|
342
|
-
errors.push('Please add options for the table.');
|
|
343
|
-
}
|
|
344
|
-
if (!field.rows || field.rows.length === 0) {
|
|
345
|
-
errors.push('Please add rows for the table.');
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
if (!field.size || field.size === '') {
|
|
350
|
-
errors.push('Please select a size for the field.');
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
if (field.required === '') {
|
|
354
|
-
errors.push('Is the field a required field?');
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
return errors.join('<br />');
|
|
358
|
-
};
|
|
359
|
-
|
|
360
|
-
const isIdValid = (id) => {
|
|
361
|
-
if (id === '') {
|
|
362
|
-
return false;
|
|
363
|
-
}
|
|
364
|
-
if (
|
|
365
|
-
modalType.type === 'create' ||
|
|
366
|
-
id !== data.detail[modalType.key]?.id
|
|
367
|
-
) {
|
|
368
|
-
return data.detail
|
|
369
|
-
? data.detail.every((field) => field.id !== id)
|
|
370
|
-
: true;
|
|
371
|
-
}
|
|
372
|
-
return true;
|
|
373
|
-
};
|
|
374
|
-
|
|
375
|
-
const saveFieldData = (field) => {
|
|
376
|
-
let newDetail =
|
|
377
|
-
modalType.type === 'create'
|
|
378
|
-
? [...(data.detail || []), field]
|
|
379
|
-
: data.detail.map((f, index) =>
|
|
380
|
-
index === modalType.key ? field : f
|
|
381
|
-
);
|
|
382
|
-
|
|
383
|
-
setData((items) => ({
|
|
384
|
-
...items,
|
|
385
|
-
detail: newDetail,
|
|
386
|
-
}));
|
|
387
|
-
};
|
|
388
|
-
|
|
389
|
-
const displayErrorMessage = (errorMessage) => {
|
|
390
|
-
toast.error(<div>{parse(errorMessage)}</div>);
|
|
391
|
-
};
|
|
392
|
-
|
|
393
|
-
/** Form Functionalities */
|
|
394
|
-
const renderClassName = (d) => {
|
|
395
|
-
const sizeClassMap = {
|
|
396
|
-
full: styles.fwBuilderItem,
|
|
397
|
-
half: styles.halfBuilderItem,
|
|
398
|
-
quarter: styles.qtrBuilderItem,
|
|
399
|
-
};
|
|
400
|
-
|
|
401
|
-
return `${styles.formBuilderItem} ${
|
|
402
|
-
sizeClassMap[d.size] || styles.halfBuilderItem
|
|
403
|
-
}`;
|
|
404
|
-
};
|
|
405
|
-
|
|
406
|
-
const renderField = (field) => {
|
|
407
|
-
switch (field.type) {
|
|
408
|
-
case 'checkbox':
|
|
409
|
-
return (
|
|
410
|
-
<label className={styles.fi__label}>
|
|
411
|
-
<span className={styles.fi__spancheckbox}>
|
|
412
|
-
{field.label}{' '}
|
|
413
|
-
{field.required === 'yes' ? '*' : null}
|
|
414
|
-
</span>
|
|
415
|
-
{field.options.length > 0 ? (
|
|
416
|
-
<div className={styles.fi__optionscontainer}>
|
|
417
|
-
{field.options.map((option, index) => (
|
|
418
|
-
<div
|
|
419
|
-
key={`${field.id}-checkbox-option-${index}`}
|
|
420
|
-
className={styles.fi__checkboxcontainer}
|
|
421
|
-
>
|
|
422
|
-
<input
|
|
423
|
-
type="checkbox"
|
|
424
|
-
className={
|
|
425
|
-
styles.fi__customcheckbox
|
|
426
|
-
}
|
|
427
|
-
/>
|
|
428
|
-
<label
|
|
429
|
-
className={styles.fi__checkboxlabel}
|
|
430
|
-
>
|
|
431
|
-
{option.label}
|
|
432
|
-
</label>{' '}
|
|
433
|
-
</div>
|
|
434
|
-
))}
|
|
435
|
-
</div>
|
|
436
|
-
) : null}
|
|
437
|
-
</label>
|
|
438
|
-
);
|
|
439
|
-
case 'date':
|
|
440
|
-
return (
|
|
441
|
-
<label className={styles.fi__label}>
|
|
442
|
-
<input type="date" />
|
|
443
|
-
<span className={styles.fi__span}>
|
|
444
|
-
{field.label}{' '}
|
|
445
|
-
{field.required === 'yes' ? '*' : null}
|
|
446
|
-
</span>
|
|
447
|
-
</label>
|
|
448
|
-
);
|
|
449
|
-
case 'datetime':
|
|
450
|
-
return (
|
|
451
|
-
<label className={styles.fi__label}>
|
|
452
|
-
<input type="datetime-local" />
|
|
453
|
-
<span className={styles.fi__span}>
|
|
454
|
-
{field.label}{' '}
|
|
455
|
-
{field.required === 'yes' ? '*' : null}
|
|
456
|
-
</span>
|
|
457
|
-
</label>
|
|
458
|
-
);
|
|
459
|
-
case 'dropdown':
|
|
460
|
-
case 'dynamicDropdown':
|
|
461
|
-
return (
|
|
462
|
-
<label className={styles.fi__label}>
|
|
463
|
-
<select>
|
|
464
|
-
<option>Please Select an Option</option>
|
|
465
|
-
</select>
|
|
466
|
-
<span className={styles.fi__span}>
|
|
467
|
-
{field.label}{' '}
|
|
468
|
-
{field.required === 'yes' ? '*' : null}
|
|
469
|
-
</span>
|
|
470
|
-
</label>
|
|
471
|
-
);
|
|
472
|
-
case 'dynamicdata':
|
|
473
|
-
return (
|
|
474
|
-
<label className={styles.fi__label}>
|
|
475
|
-
<strong>{field.label}</strong> [Dynamic Data]
|
|
476
|
-
</label>
|
|
477
|
-
);
|
|
478
|
-
case 'file':
|
|
479
|
-
return (
|
|
480
|
-
<label className={styles.fi__label}>
|
|
481
|
-
<input type="file" />
|
|
482
|
-
<span className={styles.fi__span}>
|
|
483
|
-
{field.label}{' '}
|
|
484
|
-
{field.required === 'yes' ? '*' : null}
|
|
485
|
-
</span>
|
|
486
|
-
</label>
|
|
487
|
-
);
|
|
488
|
-
case 'image':
|
|
489
|
-
return (
|
|
490
|
-
<label className={styles.fi__label}>
|
|
491
|
-
<input type="file" />
|
|
492
|
-
<span className={styles.fi__span}>
|
|
493
|
-
{field.label}{' '}
|
|
494
|
-
{field.required === 'yes' ? '*' : null}
|
|
495
|
-
</span>
|
|
496
|
-
</label>
|
|
497
|
-
);
|
|
498
|
-
case 'plaintextheading':
|
|
499
|
-
return (
|
|
500
|
-
<label className={styles.fi__label}>
|
|
501
|
-
<h2>{field.label}</h2>
|
|
502
|
-
</label>
|
|
503
|
-
);
|
|
504
|
-
case 'plaintext':
|
|
505
|
-
return (
|
|
506
|
-
<label className={styles.fi__label}>
|
|
507
|
-
{field.description ? parse(field.description) : null}
|
|
508
|
-
</label>
|
|
509
|
-
);
|
|
510
|
-
case 'number':
|
|
511
|
-
return (
|
|
512
|
-
<label className={styles.fi__label}>
|
|
513
|
-
<input type="number" />
|
|
514
|
-
<span className={styles.fi__span}>
|
|
515
|
-
{field.label}{' '}
|
|
516
|
-
{field.required === 'yes' ? '*' : null}
|
|
517
|
-
</span>
|
|
518
|
-
</label>
|
|
519
|
-
);
|
|
520
|
-
case 'section':
|
|
521
|
-
return (
|
|
522
|
-
<div className={styles.gridtxt__header}>
|
|
523
|
-
<span>{field.label}</span>
|
|
524
|
-
</div>
|
|
525
|
-
);
|
|
526
|
-
case 'signature':
|
|
527
|
-
return (
|
|
528
|
-
<label className={styles.fi__label}>
|
|
529
|
-
<span
|
|
530
|
-
className={`${styles.fi__span} ${styles.prefocus}`}
|
|
531
|
-
>
|
|
532
|
-
{field.label}{' '}
|
|
533
|
-
{field.required === 'yes' ? '*' : null}
|
|
534
|
-
</span>
|
|
535
|
-
<button
|
|
536
|
-
type="button"
|
|
537
|
-
className={styles.signButton}
|
|
538
|
-
onClick={() => {
|
|
539
|
-
// Handle signature logic here
|
|
540
|
-
}}
|
|
541
|
-
>
|
|
542
|
-
Click to Sign
|
|
543
|
-
</button>
|
|
544
|
-
<div className={styles.signaturePlaceholder}>
|
|
545
|
-
<p>
|
|
546
|
-
<strong>Name:</strong> [Placeholder]
|
|
547
|
-
</p>
|
|
548
|
-
<p>
|
|
549
|
-
<strong>Date:</strong> [Placeholder]
|
|
550
|
-
</p>
|
|
551
|
-
</div>
|
|
552
|
-
</label>
|
|
553
|
-
);
|
|
554
|
-
case 'table_radio':
|
|
555
|
-
return (
|
|
556
|
-
<label className={styles.fi__label}>
|
|
557
|
-
<table className={styles.contentTable}>
|
|
558
|
-
<thead>
|
|
559
|
-
<tr>
|
|
560
|
-
<th></th>
|
|
561
|
-
{field.options.map((option, index) => (
|
|
562
|
-
<th
|
|
563
|
-
key={`${field.id}-table-text-option-${index}`}
|
|
564
|
-
>
|
|
565
|
-
{option.label}
|
|
566
|
-
</th>
|
|
567
|
-
))}
|
|
568
|
-
</tr>
|
|
569
|
-
</thead>
|
|
570
|
-
<tbody>
|
|
571
|
-
{field.rows.map((row, rowKey) => (
|
|
572
|
-
<tr
|
|
573
|
-
key={`${field.id}-table-text-row-data-${rowKey}`}
|
|
574
|
-
>
|
|
575
|
-
<td>{row.label}</td>
|
|
576
|
-
{field.options.map(
|
|
577
|
-
(option, optionKey) => (
|
|
578
|
-
<td
|
|
579
|
-
key={`${field.id}-table-text-data-${optionKey}-${rowKey}`}
|
|
580
|
-
></td>
|
|
581
|
-
)
|
|
582
|
-
)}
|
|
583
|
-
</tr>
|
|
584
|
-
))}
|
|
585
|
-
</tbody>
|
|
586
|
-
</table>
|
|
587
|
-
<span
|
|
588
|
-
className={`${styles.fi__span} ${styles.prefocus}`}
|
|
589
|
-
>
|
|
590
|
-
{field.label}{' '}
|
|
591
|
-
{field.required === 'yes' ? '*' : null}
|
|
592
|
-
</span>
|
|
593
|
-
</label>
|
|
594
|
-
);
|
|
595
|
-
case 'table_text':
|
|
596
|
-
return (
|
|
597
|
-
<label className={styles.fi__label}>
|
|
598
|
-
<table className={styles.contentTable}>
|
|
599
|
-
<thead>
|
|
600
|
-
<tr>
|
|
601
|
-
{field.options.map((option, index) => (
|
|
602
|
-
<th
|
|
603
|
-
key={`${field.id}-table-text-option-${index}`}
|
|
604
|
-
>
|
|
605
|
-
{option.label}
|
|
606
|
-
</th>
|
|
607
|
-
))}
|
|
608
|
-
</tr>
|
|
609
|
-
</thead>
|
|
610
|
-
<tbody>
|
|
611
|
-
<tr>
|
|
612
|
-
{field.options.map((option, index) => (
|
|
613
|
-
<td
|
|
614
|
-
key={`${field.id}-table-text-data-${index}`}
|
|
615
|
-
>
|
|
616
|
-
[Placeholder Data]]
|
|
617
|
-
</td>
|
|
618
|
-
))}
|
|
619
|
-
</tr>
|
|
620
|
-
</tbody>
|
|
621
|
-
</table>
|
|
622
|
-
<span
|
|
623
|
-
className={`${styles.fi__span} ${styles.prefocus}`}
|
|
624
|
-
>
|
|
625
|
-
{field.label}{' '}
|
|
626
|
-
{field.required === 'yes' ? '*' : null}
|
|
627
|
-
</span>
|
|
628
|
-
</label>
|
|
629
|
-
);
|
|
630
|
-
case 'textarea':
|
|
631
|
-
return (
|
|
632
|
-
<label className={styles.fi__label}>
|
|
633
|
-
<textarea rows="5"></textarea>
|
|
634
|
-
<span className={styles.fi__span}>
|
|
635
|
-
{field.label}{' '}
|
|
636
|
-
{field.required === 'yes' ? '*' : null}
|
|
637
|
-
</span>
|
|
638
|
-
</label>
|
|
639
|
-
);
|
|
640
|
-
case 'time':
|
|
641
|
-
return (
|
|
642
|
-
<label className={styles.fi__label}>
|
|
643
|
-
<input type="time" />
|
|
644
|
-
<span className={styles.fi__span}>
|
|
645
|
-
{field.label}{' '}
|
|
646
|
-
{field.required === 'yes' ? '*' : null}
|
|
647
|
-
</span>
|
|
648
|
-
</label>
|
|
649
|
-
);
|
|
650
|
-
case 'toggle':
|
|
651
|
-
return (
|
|
652
|
-
<div>
|
|
653
|
-
<Toggle />
|
|
654
|
-
<span className={styles.fi__toggletxt}>
|
|
655
|
-
{field.label}{' '}
|
|
656
|
-
{field.required === 'yes' ? '*' : null}
|
|
657
|
-
</span>
|
|
658
|
-
</div>
|
|
659
|
-
);
|
|
660
|
-
default:
|
|
661
|
-
return (
|
|
662
|
-
<label className={styles.fi__label}>
|
|
663
|
-
<input type="text" />
|
|
664
|
-
<span className={styles.fi__span}>
|
|
665
|
-
{field.label}{' '}
|
|
666
|
-
{field.required === 'yes' ? '*' : null}
|
|
667
|
-
</span>
|
|
668
|
-
</label>
|
|
669
|
-
);
|
|
670
|
-
}
|
|
671
|
-
};
|
|
672
|
-
|
|
673
|
-
const handleCloseModalForm = () => {
|
|
674
|
-
setModalFormShow(false);
|
|
675
|
-
};
|
|
676
|
-
|
|
677
|
-
const handleOpenModalForm = () => {
|
|
678
|
-
setModalFormShow(true);
|
|
679
|
-
};
|
|
680
|
-
|
|
681
|
-
const handleChange = (e) => {
|
|
682
|
-
if (e) {
|
|
683
|
-
const { name, value } = e.target;
|
|
684
|
-
|
|
685
|
-
setData((prevState) => ({
|
|
686
|
-
...prevState,
|
|
687
|
-
[name]: value,
|
|
688
|
-
}));
|
|
689
|
-
}
|
|
690
|
-
};
|
|
691
|
-
|
|
692
|
-
const handleSubmit = async (e) => {
|
|
693
|
-
try {
|
|
694
|
-
if (e) {
|
|
695
|
-
e.preventDefault();
|
|
696
|
-
|
|
697
|
-
let _error = '';
|
|
698
|
-
|
|
699
|
-
if (data.label === '') {
|
|
700
|
-
_error += 'Please a label for the form.<br />';
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
if (_error === '') {
|
|
704
|
-
const res = await CustomFetch(
|
|
705
|
-
`${fetchUrl}/${dataId}`,
|
|
706
|
-
'PUT',
|
|
707
|
-
{
|
|
708
|
-
...data,
|
|
709
|
-
}
|
|
710
|
-
);
|
|
711
|
-
|
|
712
|
-
if (res.data.error === '') {
|
|
713
|
-
toast.success(
|
|
714
|
-
"You have successfully updated the form's detail."
|
|
715
|
-
);
|
|
716
|
-
|
|
717
|
-
handleCloseModalForm();
|
|
718
|
-
} else {
|
|
719
|
-
toast.error(String(res.data.error));
|
|
720
|
-
}
|
|
721
|
-
} else {
|
|
722
|
-
toast.error(<div>{parse(_error)}</div>);
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
} catch (err) {
|
|
726
|
-
toast.error(`Error: ${err}`);
|
|
727
|
-
}
|
|
728
|
-
};
|
|
729
|
-
|
|
730
|
-
const fetchData = async () => {
|
|
731
|
-
try {
|
|
732
|
-
const res = await CustomFetch(
|
|
733
|
-
`${fetchUrl}/${routeParams[urlParam]}`,
|
|
734
|
-
'GET',
|
|
735
|
-
{}
|
|
736
|
-
);
|
|
737
|
-
|
|
738
|
-
setData(res.data);
|
|
739
|
-
} catch (err) {
|
|
740
|
-
toast.error(`Error: ${err}`);
|
|
741
|
-
}
|
|
742
|
-
};
|
|
743
|
-
|
|
744
|
-
const saveOnSort = async () => {
|
|
745
|
-
try {
|
|
746
|
-
const res = await CustomFetch(
|
|
747
|
-
`${fetchUrl}/sort/${dataId}`,
|
|
748
|
-
'POST',
|
|
749
|
-
{
|
|
750
|
-
detail: data.detail,
|
|
751
|
-
}
|
|
752
|
-
);
|
|
753
|
-
|
|
754
|
-
if (res.data.error !== '') {
|
|
755
|
-
toast.error(String(res.data.error));
|
|
756
|
-
}
|
|
757
|
-
} catch (err) {
|
|
758
|
-
toast.error(`Error: ${err}`);
|
|
759
|
-
}
|
|
760
|
-
};
|
|
761
|
-
|
|
762
|
-
const fetchRoles = async () => {
|
|
763
|
-
try {
|
|
764
|
-
const res = await CustomFetch('/ajax/roles/dropdown', 'POST', {});
|
|
765
|
-
|
|
766
|
-
setRoles(res.data.data);
|
|
767
|
-
} catch (err) {
|
|
768
|
-
console.info(err);
|
|
769
|
-
}
|
|
770
|
-
};
|
|
771
|
-
|
|
772
|
-
useEffect(() => {
|
|
773
|
-
if (data.detail && data.detail.length > 0) {
|
|
774
|
-
saveOnSort();
|
|
775
|
-
}
|
|
776
|
-
}, [data.detail]);
|
|
777
|
-
|
|
778
|
-
useEffect(() => {
|
|
779
|
-
fetchData();
|
|
780
|
-
fetchRoles();
|
|
781
|
-
}, []);
|
|
782
|
-
|
|
783
|
-
return (
|
|
784
|
-
<div>
|
|
785
|
-
<div className={styles.grid__row}>
|
|
786
|
-
<div className={`${styles.grid__full} ${styles.crmtitle}`}>
|
|
787
|
-
<Breadcrumb
|
|
788
|
-
data={data}
|
|
789
|
-
page={{
|
|
790
|
-
previousUrl: parentUrl,
|
|
791
|
-
title: 'Forms',
|
|
792
|
-
titleKey: 'label',
|
|
793
|
-
}}
|
|
794
|
-
/>
|
|
795
|
-
</div>
|
|
796
|
-
</div>
|
|
797
|
-
<div className={styles.grid}>
|
|
798
|
-
<div className={styles.grid__subrow}>
|
|
799
|
-
<div className={styles.grid__subnav}>
|
|
800
|
-
{data.detail && data.detail.length > 0 ? (
|
|
801
|
-
<SortableList
|
|
802
|
-
handleClick={handleEdit}
|
|
803
|
-
handleDelete={handleDeleteField}
|
|
804
|
-
items={data.detail}
|
|
805
|
-
onSortEnd={onSortEnd}
|
|
806
|
-
axis="xy"
|
|
807
|
-
helperClass={styles.dragitem}
|
|
808
|
-
transitionDuration={250}
|
|
809
|
-
showImage={false}
|
|
810
|
-
useDragHandle
|
|
811
|
-
/>
|
|
812
|
-
) : null}
|
|
813
|
-
</div>
|
|
814
|
-
<div className={styles.grid__subcontent}>
|
|
815
|
-
<div className={styles.formSplit}>
|
|
816
|
-
<div className={styles.gridtxt__header}>
|
|
817
|
-
<span>{formTitle ? formTitle : null}</span>
|
|
818
|
-
</div>
|
|
819
|
-
{data.detail && data.detail.length > 0 ? (
|
|
820
|
-
<div className={styles.modal__content}>
|
|
821
|
-
<div className={styles.formcontainer}>
|
|
822
|
-
<form className={styles.modalForm}>
|
|
823
|
-
{data.detail.map((a, b) => (
|
|
824
|
-
<div
|
|
825
|
-
key={`form-preview-field-${b}`}
|
|
826
|
-
className={renderClassName(
|
|
827
|
-
a
|
|
828
|
-
)}
|
|
829
|
-
style={{
|
|
830
|
-
minHeight: '64.2px',
|
|
831
|
-
}}
|
|
832
|
-
>
|
|
833
|
-
{renderField(a)}
|
|
834
|
-
</div>
|
|
835
|
-
))}
|
|
836
|
-
</form>
|
|
837
|
-
</div>
|
|
838
|
-
</div>
|
|
839
|
-
) : null}
|
|
840
|
-
</div>
|
|
841
|
-
<div className={styles.polActions}>
|
|
842
|
-
<button
|
|
843
|
-
className={styles.btn}
|
|
844
|
-
onClick={handleOpenModal}
|
|
845
|
-
>
|
|
846
|
-
Add Field
|
|
847
|
-
</button>
|
|
848
|
-
<button
|
|
849
|
-
className={styles.btn}
|
|
850
|
-
onClick={handleOpenModalForm}
|
|
851
|
-
>
|
|
852
|
-
Edit Form
|
|
853
|
-
</button>
|
|
854
|
-
</div>
|
|
855
|
-
</div>
|
|
856
|
-
</div>
|
|
857
|
-
</div>
|
|
858
|
-
|
|
859
|
-
<Popup
|
|
860
|
-
open={modalShow}
|
|
861
|
-
onClose={handleCloseModal}
|
|
862
|
-
closeOnDocumentClick={false}
|
|
863
|
-
>
|
|
864
|
-
<div className={styles.modalwrap}>
|
|
865
|
-
<div className={styles.modal}>
|
|
866
|
-
<div className={styles.modal__header}>
|
|
867
|
-
<h1>
|
|
868
|
-
{modalType.type === 'create'
|
|
869
|
-
? 'Add new Field'
|
|
870
|
-
: 'Update existing Field'}
|
|
871
|
-
</h1>
|
|
872
|
-
<button
|
|
873
|
-
className={styles.modal__close}
|
|
874
|
-
onClick={handleCloseModal}
|
|
875
|
-
>
|
|
876
|
-
<CircleX strokeWidth={1} size={24} />
|
|
877
|
-
</button>
|
|
878
|
-
</div>
|
|
879
|
-
<div className={styles.modal__content}>
|
|
880
|
-
<div className={styles.formcontainer}>
|
|
881
|
-
<form className={styles.modalForm}>
|
|
882
|
-
<div className={styles.formItem}>
|
|
883
|
-
<label className={styles.fi__label}>
|
|
884
|
-
<select
|
|
885
|
-
name="type"
|
|
886
|
-
value={dataField.type}
|
|
887
|
-
onChange={handleChangeForm}
|
|
888
|
-
>
|
|
889
|
-
<option>
|
|
890
|
-
Please Select an Option
|
|
891
|
-
</option>
|
|
892
|
-
<option value="checkbox">
|
|
893
|
-
Checkbox
|
|
894
|
-
</option>
|
|
895
|
-
<option value="html5_date">
|
|
896
|
-
Date
|
|
897
|
-
</option>
|
|
898
|
-
<option value="html5_datetime">
|
|
899
|
-
Date & Time
|
|
900
|
-
</option>
|
|
901
|
-
<option value="dropdown">
|
|
902
|
-
Dropdown
|
|
903
|
-
</option>
|
|
904
|
-
{dynamicDropdowns &&
|
|
905
|
-
dynamicDropdowns.length > 0 ? (
|
|
906
|
-
<option value="dynamicDropdown">
|
|
907
|
-
Dynamic Dropdown
|
|
908
|
-
</option>
|
|
909
|
-
) : null}
|
|
910
|
-
<option value="dynamicdata">
|
|
911
|
-
Dynamic Data
|
|
912
|
-
</option>
|
|
913
|
-
<option value="file">
|
|
914
|
-
File
|
|
915
|
-
</option>
|
|
916
|
-
<option value="plaintextheading">
|
|
917
|
-
Heading
|
|
918
|
-
</option>
|
|
919
|
-
<option value="image">
|
|
920
|
-
Image
|
|
921
|
-
</option>
|
|
922
|
-
<option value="number">
|
|
923
|
-
Number
|
|
924
|
-
</option>
|
|
925
|
-
<option value="plaintext">
|
|
926
|
-
Plain Text
|
|
927
|
-
</option>
|
|
928
|
-
<option value="section">
|
|
929
|
-
Section
|
|
930
|
-
</option>
|
|
931
|
-
<option value="signature">
|
|
932
|
-
Signature
|
|
933
|
-
</option>
|
|
934
|
-
<option value="table_radio">
|
|
935
|
-
Table (Radio)
|
|
936
|
-
</option>
|
|
937
|
-
<option value="table_text">
|
|
938
|
-
Table (Text)
|
|
939
|
-
</option>
|
|
940
|
-
<option value="text">
|
|
941
|
-
Text
|
|
942
|
-
</option>
|
|
943
|
-
<option value="textarea">
|
|
944
|
-
Textarea
|
|
945
|
-
</option>
|
|
946
|
-
<option value="html5_time">
|
|
947
|
-
Time
|
|
948
|
-
</option>
|
|
949
|
-
<option value="toggle">
|
|
950
|
-
Toggle
|
|
951
|
-
</option>
|
|
952
|
-
</select>
|
|
953
|
-
<span className={styles.fi__span}>
|
|
954
|
-
Type *
|
|
955
|
-
</span>
|
|
956
|
-
</label>
|
|
957
|
-
</div>
|
|
958
|
-
<div className={styles.formItem}>
|
|
959
|
-
<label className={styles.fi__label}>
|
|
960
|
-
<input
|
|
961
|
-
type="text"
|
|
962
|
-
name="label"
|
|
963
|
-
value={
|
|
964
|
-
dataField.label
|
|
965
|
-
? dataField.label
|
|
966
|
-
: ''
|
|
967
|
-
}
|
|
968
|
-
onChange={handleChangeForm}
|
|
969
|
-
placeholder=" "
|
|
970
|
-
/>
|
|
971
|
-
<span className={styles.fi__span}>
|
|
972
|
-
Label *
|
|
973
|
-
</span>
|
|
974
|
-
</label>
|
|
975
|
-
</div>
|
|
976
|
-
{dataField.type === 'dynamicdata' && (
|
|
977
|
-
<div className={styles.formItem}>
|
|
978
|
-
<label className={styles.fi__label}>
|
|
979
|
-
<select
|
|
980
|
-
name="dynamicfield"
|
|
981
|
-
value={
|
|
982
|
-
dataField.dynamicfield
|
|
983
|
-
}
|
|
984
|
-
onChange={handleChangeForm}
|
|
985
|
-
>
|
|
986
|
-
<option value="">
|
|
987
|
-
Please select an option
|
|
988
|
-
</option>
|
|
989
|
-
{fields.map((category) => (
|
|
990
|
-
<optgroup
|
|
991
|
-
label={
|
|
992
|
-
category.label
|
|
993
|
-
}
|
|
994
|
-
key={`dynamic-field-category-${category.id}`}
|
|
995
|
-
>
|
|
996
|
-
{category.data.map(
|
|
997
|
-
(field) => (
|
|
998
|
-
<option
|
|
999
|
-
value={`${category.id}::${field.value}`}
|
|
1000
|
-
key={`dynamic-field-category-${category.id}-${field.value}`}
|
|
1001
|
-
>
|
|
1002
|
-
{
|
|
1003
|
-
field.label
|
|
1004
|
-
}
|
|
1005
|
-
</option>
|
|
1006
|
-
)
|
|
1007
|
-
)}
|
|
1008
|
-
</optgroup>
|
|
1009
|
-
))}
|
|
1010
|
-
</select>
|
|
1011
|
-
<span
|
|
1012
|
-
className={styles.fi__span}
|
|
1013
|
-
>
|
|
1014
|
-
Dynamic Field *
|
|
1015
|
-
</span>
|
|
1016
|
-
</label>
|
|
1017
|
-
</div>
|
|
1018
|
-
)}
|
|
1019
|
-
{dataField.type === 'dynamicDropdown' && (
|
|
1020
|
-
<div className={styles.formItem}>
|
|
1021
|
-
<label className={styles.fi__label}>
|
|
1022
|
-
<select
|
|
1023
|
-
name="dynamicDropdown"
|
|
1024
|
-
value={
|
|
1025
|
-
dataField.dynamicDropdown
|
|
1026
|
-
}
|
|
1027
|
-
onChange={handleChangeForm}
|
|
1028
|
-
>
|
|
1029
|
-
<option value="">
|
|
1030
|
-
Please select an option
|
|
1031
|
-
</option>
|
|
1032
|
-
{dynamicDropdowns.map(
|
|
1033
|
-
(
|
|
1034
|
-
dropdown,
|
|
1035
|
-
dropdownKey
|
|
1036
|
-
) => (
|
|
1037
|
-
<option
|
|
1038
|
-
value={`${dropdown.url}`}
|
|
1039
|
-
key={`dynamic-dropdown-${dropdownKey}`}
|
|
1040
|
-
>
|
|
1041
|
-
{dropdown.label}
|
|
1042
|
-
</option>
|
|
1043
|
-
)
|
|
1044
|
-
)}
|
|
1045
|
-
</select>
|
|
1046
|
-
<span
|
|
1047
|
-
className={styles.fi__span}
|
|
1048
|
-
>
|
|
1049
|
-
Dropdown *
|
|
1050
|
-
</span>
|
|
1051
|
-
</label>
|
|
1052
|
-
</div>
|
|
1053
|
-
)}
|
|
1054
|
-
|
|
1055
|
-
<div className={styles.formItem}>
|
|
1056
|
-
<label className={styles.fi__label}>
|
|
1057
|
-
<select
|
|
1058
|
-
name="size"
|
|
1059
|
-
value={dataField.size}
|
|
1060
|
-
onChange={handleChangeForm}
|
|
1061
|
-
>
|
|
1062
|
-
<option>
|
|
1063
|
-
Please Select an Option
|
|
1064
|
-
</option>
|
|
1065
|
-
<option value="quarter">
|
|
1066
|
-
Quarter
|
|
1067
|
-
</option>
|
|
1068
|
-
<option value="half">
|
|
1069
|
-
Half
|
|
1070
|
-
</option>
|
|
1071
|
-
<option value="full">
|
|
1072
|
-
Full
|
|
1073
|
-
</option>
|
|
1074
|
-
</select>
|
|
1075
|
-
<span className={styles.fi__span}>
|
|
1076
|
-
Size *
|
|
1077
|
-
</span>
|
|
1078
|
-
</label>
|
|
1079
|
-
</div>
|
|
1080
|
-
<div className={styles.formItem}>
|
|
1081
|
-
<label className={styles.fi__label}>
|
|
1082
|
-
<select
|
|
1083
|
-
name="required"
|
|
1084
|
-
value={dataField.required}
|
|
1085
|
-
onChange={handleChangeForm}
|
|
1086
|
-
>
|
|
1087
|
-
{dataField.type ===
|
|
1088
|
-
'section' ? (
|
|
1089
|
-
<option value="no">
|
|
1090
|
-
No
|
|
1091
|
-
</option>
|
|
1092
|
-
) : (
|
|
1093
|
-
<>
|
|
1094
|
-
<option>
|
|
1095
|
-
Please Select an
|
|
1096
|
-
Option
|
|
1097
|
-
</option>
|
|
1098
|
-
<option value="no">
|
|
1099
|
-
No
|
|
1100
|
-
</option>
|
|
1101
|
-
<option value="yes">
|
|
1102
|
-
Yes
|
|
1103
|
-
</option>
|
|
1104
|
-
</>
|
|
1105
|
-
)}
|
|
1106
|
-
</select>
|
|
1107
|
-
<span className={styles.fi__span}>
|
|
1108
|
-
Required? *
|
|
1109
|
-
</span>
|
|
1110
|
-
</label>
|
|
1111
|
-
</div>
|
|
1112
|
-
|
|
1113
|
-
{dataField.type === 'image' && (
|
|
1114
|
-
<div className={styles.formItem}>
|
|
1115
|
-
<label className={styles.fi__label}>
|
|
1116
|
-
<select
|
|
1117
|
-
name="image_qty"
|
|
1118
|
-
value={dataField.image_qty}
|
|
1119
|
-
onChange={handleChangeForm}
|
|
1120
|
-
>
|
|
1121
|
-
<option>
|
|
1122
|
-
Please Select an Option
|
|
1123
|
-
</option>
|
|
1124
|
-
<option value="single">
|
|
1125
|
-
Single
|
|
1126
|
-
</option>
|
|
1127
|
-
<option value="bulk">
|
|
1128
|
-
Bulk
|
|
1129
|
-
</option>
|
|
1130
|
-
</select>
|
|
1131
|
-
<span
|
|
1132
|
-
className={styles.fi__span}
|
|
1133
|
-
>
|
|
1134
|
-
Single or Bulk Image?
|
|
1135
|
-
</span>
|
|
1136
|
-
</label>
|
|
1137
|
-
</div>
|
|
1138
|
-
)}
|
|
1139
|
-
|
|
1140
|
-
{dataField.type === 'plaintext' && (
|
|
1141
|
-
<div
|
|
1142
|
-
className={`${styles.formItem} ${styles.fwItem}`}
|
|
1143
|
-
>
|
|
1144
|
-
<label className={styles.fi__label}>
|
|
1145
|
-
<Editor
|
|
1146
|
-
tinymceScriptSrc="https://d16lktya8ojp5z.cloudfront.net/generic/packages/tinymce_v701/tinymce.min.js"
|
|
1147
|
-
licenseKey="gpl"
|
|
1148
|
-
onEditorChange={(
|
|
1149
|
-
value,
|
|
1150
|
-
e
|
|
1151
|
-
) => {
|
|
1152
|
-
handleChangeFormRichEditor(
|
|
1153
|
-
e,
|
|
1154
|
-
value,
|
|
1155
|
-
'description'
|
|
1156
|
-
);
|
|
1157
|
-
}}
|
|
1158
|
-
onInit={(evt, editor) =>
|
|
1159
|
-
(editorRef.current =
|
|
1160
|
-
editor)
|
|
1161
|
-
}
|
|
1162
|
-
value={
|
|
1163
|
-
dataField.description ||
|
|
1164
|
-
''
|
|
1165
|
-
}
|
|
1166
|
-
init={{
|
|
1167
|
-
branding: false,
|
|
1168
|
-
height: 500,
|
|
1169
|
-
menubar: false,
|
|
1170
|
-
plugins: [
|
|
1171
|
-
'advlist',
|
|
1172
|
-
'autolink',
|
|
1173
|
-
'lists',
|
|
1174
|
-
'link',
|
|
1175
|
-
'image',
|
|
1176
|
-
'charmap',
|
|
1177
|
-
'preview',
|
|
1178
|
-
'anchor',
|
|
1179
|
-
'searchreplace',
|
|
1180
|
-
'visualblocks',
|
|
1181
|
-
'code',
|
|
1182
|
-
'fullscreen',
|
|
1183
|
-
'insertdatetime',
|
|
1184
|
-
'media',
|
|
1185
|
-
'table',
|
|
1186
|
-
'code',
|
|
1187
|
-
],
|
|
1188
|
-
toolbar:
|
|
1189
|
-
'undo redo | blocks | ' +
|
|
1190
|
-
'bold italic forecolor | alignleft aligncenter ' +
|
|
1191
|
-
'alignright alignjustify | bullist numlist outdent indent | ' +
|
|
1192
|
-
'removeformat | table',
|
|
1193
|
-
content_style:
|
|
1194
|
-
'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }',
|
|
1195
|
-
}}
|
|
1196
|
-
/>
|
|
1197
|
-
<span
|
|
1198
|
-
className={styles.fi__span}
|
|
1199
|
-
>
|
|
1200
|
-
Description *
|
|
1201
|
-
</span>
|
|
1202
|
-
</label>
|
|
1203
|
-
</div>
|
|
1204
|
-
)}
|
|
1205
|
-
|
|
1206
|
-
{[
|
|
1207
|
-
'checkbox',
|
|
1208
|
-
'dropdown',
|
|
1209
|
-
'table_radio',
|
|
1210
|
-
].includes(dataField.type) ? (
|
|
1211
|
-
<div
|
|
1212
|
-
className={`${styles.formItem} ${styles.fwItem}`}
|
|
1213
|
-
>
|
|
1214
|
-
<table
|
|
1215
|
-
className={styles.contentTable}
|
|
1216
|
-
>
|
|
1217
|
-
<thead
|
|
1218
|
-
className={
|
|
1219
|
-
styles.gridHeaders
|
|
1220
|
-
}
|
|
1221
|
-
>
|
|
1222
|
-
<tr>
|
|
1223
|
-
<th
|
|
1224
|
-
style={{
|
|
1225
|
-
width: '450px',
|
|
1226
|
-
}}
|
|
1227
|
-
>
|
|
1228
|
-
{dataField.type ===
|
|
1229
|
-
'table_text' ||
|
|
1230
|
-
dataField.type ===
|
|
1231
|
-
'table_radio'
|
|
1232
|
-
? 'Column Header'
|
|
1233
|
-
: 'Label'}
|
|
1234
|
-
</th>
|
|
1235
|
-
<th></th>
|
|
1236
|
-
</tr>
|
|
1237
|
-
</thead>
|
|
1238
|
-
<tbody>
|
|
1239
|
-
{dataField.options.length >
|
|
1240
|
-
0 ? (
|
|
1241
|
-
dataField.options.map(
|
|
1242
|
-
(
|
|
1243
|
-
option,
|
|
1244
|
-
optionKey
|
|
1245
|
-
) => (
|
|
1246
|
-
<tr
|
|
1247
|
-
key={`option-${optionKey}`}
|
|
1248
|
-
>
|
|
1249
|
-
<td>
|
|
1250
|
-
{
|
|
1251
|
-
option.label
|
|
1252
|
-
}
|
|
1253
|
-
</td>
|
|
1254
|
-
<td
|
|
1255
|
-
style={{
|
|
1256
|
-
textAlign:
|
|
1257
|
-
'center',
|
|
1258
|
-
}}
|
|
1259
|
-
>
|
|
1260
|
-
<button
|
|
1261
|
-
className={
|
|
1262
|
-
styles.btn
|
|
1263
|
-
}
|
|
1264
|
-
style={{
|
|
1265
|
-
padding:
|
|
1266
|
-
'5px 20px',
|
|
1267
|
-
}}
|
|
1268
|
-
onClick={
|
|
1269
|
-
handleDeleteOption
|
|
1270
|
-
}
|
|
1271
|
-
data-counter={
|
|
1272
|
-
optionKey
|
|
1273
|
-
}
|
|
1274
|
-
data-tooltip-id="system-tooltip"
|
|
1275
|
-
data-tooltip-content={
|
|
1276
|
-
'Delete Option'
|
|
1277
|
-
}
|
|
1278
|
-
>
|
|
1279
|
-
<TrashCan
|
|
1280
|
-
strokeWidth={
|
|
1281
|
-
2
|
|
1282
|
-
}
|
|
1283
|
-
size={
|
|
1284
|
-
12
|
|
1285
|
-
}
|
|
1286
|
-
/>
|
|
1287
|
-
</button>
|
|
1288
|
-
</td>
|
|
1289
|
-
</tr>
|
|
1290
|
-
)
|
|
1291
|
-
)
|
|
1292
|
-
) : (
|
|
1293
|
-
<tr>
|
|
1294
|
-
<td colSpan="2">
|
|
1295
|
-
No entry have
|
|
1296
|
-
been added.
|
|
1297
|
-
</td>
|
|
1298
|
-
</tr>
|
|
1299
|
-
)}
|
|
1300
|
-
</tbody>
|
|
1301
|
-
<tfoot>
|
|
1302
|
-
<tr>
|
|
1303
|
-
<td>
|
|
1304
|
-
<input
|
|
1305
|
-
type="text"
|
|
1306
|
-
style={{
|
|
1307
|
-
padding:
|
|
1308
|
-
'5px',
|
|
1309
|
-
}}
|
|
1310
|
-
name="label"
|
|
1311
|
-
onChange={
|
|
1312
|
-
handleDataOption
|
|
1313
|
-
}
|
|
1314
|
-
value={
|
|
1315
|
-
dataOption.label
|
|
1316
|
-
}
|
|
1317
|
-
/>
|
|
1318
|
-
</td>
|
|
1319
|
-
<td
|
|
1320
|
-
style={{
|
|
1321
|
-
textAlign:
|
|
1322
|
-
'center',
|
|
1323
|
-
}}
|
|
1324
|
-
>
|
|
1325
|
-
<button
|
|
1326
|
-
className={
|
|
1327
|
-
styles.btn
|
|
1328
|
-
}
|
|
1329
|
-
style={{
|
|
1330
|
-
padding:
|
|
1331
|
-
'5px 20px',
|
|
1332
|
-
}}
|
|
1333
|
-
onClick={
|
|
1334
|
-
handleAddOption
|
|
1335
|
-
}
|
|
1336
|
-
data-tooltip-id="system-tooltip"
|
|
1337
|
-
data-tooltip-content={
|
|
1338
|
-
'Add Option'
|
|
1339
|
-
}
|
|
1340
|
-
>
|
|
1341
|
-
<CirclePlus
|
|
1342
|
-
strokeWidth={
|
|
1343
|
-
2
|
|
1344
|
-
}
|
|
1345
|
-
size={12}
|
|
1346
|
-
/>
|
|
1347
|
-
</button>
|
|
1348
|
-
</td>
|
|
1349
|
-
</tr>
|
|
1350
|
-
</tfoot>
|
|
1351
|
-
</table>
|
|
1352
|
-
</div>
|
|
1353
|
-
) : null}
|
|
1354
|
-
|
|
1355
|
-
{['table_text'].includes(dataField.type) ? (
|
|
1356
|
-
<div
|
|
1357
|
-
className={`${styles.formItem} ${styles.fwItem}`}
|
|
1358
|
-
>
|
|
1359
|
-
<table
|
|
1360
|
-
className={styles.contentTable}
|
|
1361
|
-
>
|
|
1362
|
-
<thead
|
|
1363
|
-
className={
|
|
1364
|
-
styles.gridHeaders
|
|
1365
|
-
}
|
|
1366
|
-
>
|
|
1367
|
-
<tr>
|
|
1368
|
-
<th
|
|
1369
|
-
style={{
|
|
1370
|
-
width: '450px',
|
|
1371
|
-
}}
|
|
1372
|
-
>
|
|
1373
|
-
Column Header
|
|
1374
|
-
</th>
|
|
1375
|
-
<th>Column Type</th>
|
|
1376
|
-
<th></th>
|
|
1377
|
-
</tr>
|
|
1378
|
-
</thead>
|
|
1379
|
-
<tbody>
|
|
1380
|
-
{dataField.options.length >
|
|
1381
|
-
0 ? (
|
|
1382
|
-
dataField.options.map(
|
|
1383
|
-
(
|
|
1384
|
-
option,
|
|
1385
|
-
optionKey
|
|
1386
|
-
) => (
|
|
1387
|
-
<tr
|
|
1388
|
-
key={`option-${optionKey}`}
|
|
1389
|
-
>
|
|
1390
|
-
<td>
|
|
1391
|
-
{
|
|
1392
|
-
option.label
|
|
1393
|
-
}
|
|
1394
|
-
</td>
|
|
1395
|
-
<td>
|
|
1396
|
-
{
|
|
1397
|
-
option.type
|
|
1398
|
-
}
|
|
1399
|
-
</td>
|
|
1400
|
-
<td
|
|
1401
|
-
style={{
|
|
1402
|
-
textAlign:
|
|
1403
|
-
'center',
|
|
1404
|
-
}}
|
|
1405
|
-
>
|
|
1406
|
-
<button
|
|
1407
|
-
className={
|
|
1408
|
-
styles.btn
|
|
1409
|
-
}
|
|
1410
|
-
style={{
|
|
1411
|
-
padding:
|
|
1412
|
-
'5px 20px',
|
|
1413
|
-
}}
|
|
1414
|
-
onClick={
|
|
1415
|
-
handleDeleteOption
|
|
1416
|
-
}
|
|
1417
|
-
data-counter={
|
|
1418
|
-
optionKey
|
|
1419
|
-
}
|
|
1420
|
-
data-tooltip-id="system-tooltip"
|
|
1421
|
-
data-tooltip-content={
|
|
1422
|
-
'Delete Option'
|
|
1423
|
-
}
|
|
1424
|
-
>
|
|
1425
|
-
<TrashCan
|
|
1426
|
-
strokeWidth={
|
|
1427
|
-
2
|
|
1428
|
-
}
|
|
1429
|
-
size={
|
|
1430
|
-
12
|
|
1431
|
-
}
|
|
1432
|
-
/>
|
|
1433
|
-
</button>
|
|
1434
|
-
</td>
|
|
1435
|
-
</tr>
|
|
1436
|
-
)
|
|
1437
|
-
)
|
|
1438
|
-
) : (
|
|
1439
|
-
<tr>
|
|
1440
|
-
<td colSpan="2">
|
|
1441
|
-
No entry have
|
|
1442
|
-
been added.
|
|
1443
|
-
</td>
|
|
1444
|
-
</tr>
|
|
1445
|
-
)}
|
|
1446
|
-
</tbody>
|
|
1447
|
-
<tfoot>
|
|
1448
|
-
<tr>
|
|
1449
|
-
<td>
|
|
1450
|
-
<input
|
|
1451
|
-
type="text"
|
|
1452
|
-
style={{
|
|
1453
|
-
padding:
|
|
1454
|
-
'5px',
|
|
1455
|
-
}}
|
|
1456
|
-
name="label"
|
|
1457
|
-
onChange={
|
|
1458
|
-
handleDataOption
|
|
1459
|
-
}
|
|
1460
|
-
value={
|
|
1461
|
-
dataOption.label
|
|
1462
|
-
}
|
|
1463
|
-
/>
|
|
1464
|
-
</td>
|
|
1465
|
-
<td>
|
|
1466
|
-
<select
|
|
1467
|
-
name="type"
|
|
1468
|
-
value={
|
|
1469
|
-
dataOption.type
|
|
1470
|
-
}
|
|
1471
|
-
onChange={
|
|
1472
|
-
handleDataOption
|
|
1473
|
-
}
|
|
1474
|
-
>
|
|
1475
|
-
<option>
|
|
1476
|
-
Please
|
|
1477
|
-
Select an
|
|
1478
|
-
Option
|
|
1479
|
-
</option>
|
|
1480
|
-
<option value="text">
|
|
1481
|
-
Text
|
|
1482
|
-
</option>
|
|
1483
|
-
<option value="checkbox">
|
|
1484
|
-
Checkbox
|
|
1485
|
-
</option>
|
|
1486
|
-
</select>
|
|
1487
|
-
</td>
|
|
1488
|
-
<td
|
|
1489
|
-
style={{
|
|
1490
|
-
textAlign:
|
|
1491
|
-
'center',
|
|
1492
|
-
}}
|
|
1493
|
-
>
|
|
1494
|
-
<button
|
|
1495
|
-
className={
|
|
1496
|
-
styles.btn
|
|
1497
|
-
}
|
|
1498
|
-
style={{
|
|
1499
|
-
padding:
|
|
1500
|
-
'5px 20px',
|
|
1501
|
-
}}
|
|
1502
|
-
onClick={
|
|
1503
|
-
handleAddOption
|
|
1504
|
-
}
|
|
1505
|
-
data-tooltip-id="system-tooltip"
|
|
1506
|
-
data-tooltip-content={
|
|
1507
|
-
'Add Option'
|
|
1508
|
-
}
|
|
1509
|
-
>
|
|
1510
|
-
<CirclePlus
|
|
1511
|
-
strokeWidth={
|
|
1512
|
-
2
|
|
1513
|
-
}
|
|
1514
|
-
size={12}
|
|
1515
|
-
/>
|
|
1516
|
-
</button>
|
|
1517
|
-
</td>
|
|
1518
|
-
</tr>
|
|
1519
|
-
</tfoot>
|
|
1520
|
-
</table>
|
|
1521
|
-
</div>
|
|
1522
|
-
) : null}
|
|
1523
|
-
|
|
1524
|
-
{['signature'].includes(dataField.type) ? (
|
|
1525
|
-
<div className={styles.formItem}>
|
|
1526
|
-
<label className={styles.fi__label}>
|
|
1527
|
-
<select
|
|
1528
|
-
name="role"
|
|
1529
|
-
value={dataField.role}
|
|
1530
|
-
onChange={handleChangeForm}
|
|
1531
|
-
>
|
|
1532
|
-
<option>
|
|
1533
|
-
No Role Associated
|
|
1534
|
-
</option>
|
|
1535
|
-
{roles.map(
|
|
1536
|
-
(role, roleKey) => (
|
|
1537
|
-
<option
|
|
1538
|
-
value={role.id}
|
|
1539
|
-
key={roleKey}
|
|
1540
|
-
>
|
|
1541
|
-
{role.label}
|
|
1542
|
-
</option>
|
|
1543
|
-
)
|
|
1544
|
-
)}
|
|
1545
|
-
</select>
|
|
1546
|
-
<span
|
|
1547
|
-
className={styles.fi__span}
|
|
1548
|
-
>
|
|
1549
|
-
Single or Bulk Image?
|
|
1550
|
-
</span>
|
|
1551
|
-
</label>
|
|
1552
|
-
</div>
|
|
1553
|
-
) : null}
|
|
1554
|
-
|
|
1555
|
-
{['table_radio'].includes(
|
|
1556
|
-
dataField.type
|
|
1557
|
-
) ? (
|
|
1558
|
-
<div
|
|
1559
|
-
className={`${styles.formItem} ${styles.fwItem}`}
|
|
1560
|
-
>
|
|
1561
|
-
<table
|
|
1562
|
-
className={styles.contentTable}
|
|
1563
|
-
>
|
|
1564
|
-
<thead
|
|
1565
|
-
className={
|
|
1566
|
-
styles.gridHeaders
|
|
1567
|
-
}
|
|
1568
|
-
>
|
|
1569
|
-
<tr>
|
|
1570
|
-
<th
|
|
1571
|
-
style={{
|
|
1572
|
-
width: '450px',
|
|
1573
|
-
}}
|
|
1574
|
-
>
|
|
1575
|
-
Row Label
|
|
1576
|
-
</th>
|
|
1577
|
-
<th></th>
|
|
1578
|
-
</tr>
|
|
1579
|
-
</thead>
|
|
1580
|
-
<tbody>
|
|
1581
|
-
{dataField.rows?.length >
|
|
1582
|
-
0 ? (
|
|
1583
|
-
dataField.rows.map(
|
|
1584
|
-
(row, rowKey) => (
|
|
1585
|
-
<tr
|
|
1586
|
-
key={`row-${rowKey}`}
|
|
1587
|
-
>
|
|
1588
|
-
<td>
|
|
1589
|
-
{
|
|
1590
|
-
row.label
|
|
1591
|
-
}
|
|
1592
|
-
</td>
|
|
1593
|
-
<td
|
|
1594
|
-
style={{
|
|
1595
|
-
textAlign:
|
|
1596
|
-
'center',
|
|
1597
|
-
}}
|
|
1598
|
-
>
|
|
1599
|
-
<button
|
|
1600
|
-
className={
|
|
1601
|
-
styles.btn
|
|
1602
|
-
}
|
|
1603
|
-
style={{
|
|
1604
|
-
padding:
|
|
1605
|
-
'5px 20px',
|
|
1606
|
-
}}
|
|
1607
|
-
onClick={
|
|
1608
|
-
handleDeleteRowOption
|
|
1609
|
-
}
|
|
1610
|
-
data-counter={
|
|
1611
|
-
rowKey
|
|
1612
|
-
}
|
|
1613
|
-
data-tooltip-id="system-tooltip"
|
|
1614
|
-
data-tooltip-content={
|
|
1615
|
-
'Delete Option'
|
|
1616
|
-
}
|
|
1617
|
-
>
|
|
1618
|
-
<TrashCan
|
|
1619
|
-
strokeWidth={
|
|
1620
|
-
2
|
|
1621
|
-
}
|
|
1622
|
-
size={
|
|
1623
|
-
12
|
|
1624
|
-
}
|
|
1625
|
-
/>
|
|
1626
|
-
</button>
|
|
1627
|
-
</td>
|
|
1628
|
-
</tr>
|
|
1629
|
-
)
|
|
1630
|
-
)
|
|
1631
|
-
) : (
|
|
1632
|
-
<tr>
|
|
1633
|
-
<td colSpan="2">
|
|
1634
|
-
No entry have
|
|
1635
|
-
been added.
|
|
1636
|
-
</td>
|
|
1637
|
-
</tr>
|
|
1638
|
-
)}
|
|
1639
|
-
</tbody>
|
|
1640
|
-
<tfoot>
|
|
1641
|
-
<tr>
|
|
1642
|
-
<td>
|
|
1643
|
-
<input
|
|
1644
|
-
type="text"
|
|
1645
|
-
style={{
|
|
1646
|
-
padding:
|
|
1647
|
-
'5px',
|
|
1648
|
-
}}
|
|
1649
|
-
name="label"
|
|
1650
|
-
onChange={
|
|
1651
|
-
handleRowOption
|
|
1652
|
-
}
|
|
1653
|
-
value={
|
|
1654
|
-
rowOption.label
|
|
1655
|
-
}
|
|
1656
|
-
/>
|
|
1657
|
-
</td>
|
|
1658
|
-
<td
|
|
1659
|
-
style={{
|
|
1660
|
-
textAlign:
|
|
1661
|
-
'center',
|
|
1662
|
-
}}
|
|
1663
|
-
>
|
|
1664
|
-
<button
|
|
1665
|
-
className={
|
|
1666
|
-
styles.btn
|
|
1667
|
-
}
|
|
1668
|
-
style={{
|
|
1669
|
-
padding:
|
|
1670
|
-
'5px 20px',
|
|
1671
|
-
}}
|
|
1672
|
-
onClick={
|
|
1673
|
-
handleAddRowOption
|
|
1674
|
-
}
|
|
1675
|
-
data-tooltip-id="system-tooltip"
|
|
1676
|
-
data-tooltip-content={
|
|
1677
|
-
'Add Option'
|
|
1678
|
-
}
|
|
1679
|
-
>
|
|
1680
|
-
<CirclePlus
|
|
1681
|
-
strokeWidth={
|
|
1682
|
-
2
|
|
1683
|
-
}
|
|
1684
|
-
size={12}
|
|
1685
|
-
/>
|
|
1686
|
-
</button>
|
|
1687
|
-
</td>
|
|
1688
|
-
</tr>
|
|
1689
|
-
</tfoot>
|
|
1690
|
-
</table>
|
|
1691
|
-
</div>
|
|
1692
|
-
) : null}
|
|
1693
|
-
|
|
1694
|
-
<div
|
|
1695
|
-
className={`${styles.formItem} ${styles.fwItem} ${styles.lastItem}`}
|
|
1696
|
-
>
|
|
1697
|
-
<button
|
|
1698
|
-
className={`${styles.btn}`}
|
|
1699
|
-
onClick={handleSaveField}
|
|
1700
|
-
>
|
|
1701
|
-
Save
|
|
1702
|
-
</button>
|
|
1703
|
-
</div>
|
|
1704
|
-
</form>
|
|
1705
|
-
</div>
|
|
1706
|
-
</div>
|
|
1707
|
-
</div>
|
|
1708
|
-
</div>
|
|
1709
|
-
</Popup>
|
|
1710
|
-
|
|
1711
|
-
<Popup
|
|
1712
|
-
open={modalFormShow}
|
|
1713
|
-
onClose={handleCloseModalForm}
|
|
1714
|
-
closeOnDocumentClick={false}
|
|
1715
|
-
>
|
|
1716
|
-
<div className={styles.modalwrap}>
|
|
1717
|
-
<div className={styles.modal}>
|
|
1718
|
-
<div className={styles.modal__header}>
|
|
1719
|
-
<h1>Update Form Detail</h1>
|
|
1720
|
-
<button
|
|
1721
|
-
className={styles.modal__close}
|
|
1722
|
-
onClick={handleCloseModalForm}
|
|
1723
|
-
>
|
|
1724
|
-
<CircleX strokeWidth={1} size={24} />
|
|
1725
|
-
</button>
|
|
1726
|
-
</div>
|
|
1727
|
-
<div className={styles.modal__content}>
|
|
1728
|
-
<div className={styles.formcontainer}>
|
|
1729
|
-
<form className={styles.modalForm}>
|
|
1730
|
-
<div className={styles.formItem}>
|
|
1731
|
-
<label className={styles.fi__label}>
|
|
1732
|
-
<input
|
|
1733
|
-
type="text"
|
|
1734
|
-
name="label"
|
|
1735
|
-
value={
|
|
1736
|
-
data.label ? data.label : ''
|
|
1737
|
-
}
|
|
1738
|
-
onChange={handleChange}
|
|
1739
|
-
/>
|
|
1740
|
-
<span className={styles.fi__span}>
|
|
1741
|
-
Label *
|
|
1742
|
-
</span>
|
|
1743
|
-
</label>
|
|
1744
|
-
</div>
|
|
1745
|
-
<div
|
|
1746
|
-
className={`${styles.formItem} ${styles.fwItem} ${styles.lastItem}`}
|
|
1747
|
-
>
|
|
1748
|
-
<button
|
|
1749
|
-
className={`${styles.btn}`}
|
|
1750
|
-
onClick={handleSubmit}
|
|
1751
|
-
>
|
|
1752
|
-
Save
|
|
1753
|
-
</button>
|
|
1754
|
-
</div>
|
|
1755
|
-
</form>
|
|
1756
|
-
</div>
|
|
1757
|
-
</div>
|
|
1758
|
-
</div>
|
|
1759
|
-
</div>
|
|
1760
|
-
</Popup>
|
|
1761
|
-
</div>
|
|
1762
|
-
);
|
|
1763
|
-
}
|
|
1764
|
-
|
|
1765
|
-
export default GenericFormBuilder;
|