@topconsultnpm/sdkui-react 6.19.0-dev2.9 → 6.19.0-test2
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/lib/components/base/TMAccordionNew.d.ts +28 -0
- package/lib/components/base/TMAccordionNew.js +326 -0
- package/lib/components/base/TMButton.d.ts +1 -0
- package/lib/components/base/TMButton.js +6 -6
- package/lib/components/base/TMCustomButton.d.ts +1 -1
- package/lib/components/base/TMCustomButton.js +83 -28
- package/lib/components/base/TMDataGridExportForm.js +9 -3
- package/lib/components/base/TMFileManager.js +11 -2
- package/lib/components/base/TMFileManagerDataGridView.d.ts +2 -0
- package/lib/components/base/TMFileManagerDataGridView.js +12 -3
- package/lib/components/base/TMFileManagerThumbnailItems.d.ts +2 -0
- package/lib/components/base/TMFileManagerThumbnailItems.js +12 -2
- package/lib/components/base/TMFileManagerThumbnailsView.d.ts +2 -0
- package/lib/components/base/TMFileManagerThumbnailsView.js +2 -2
- package/lib/components/base/TMModal.d.ts +2 -0
- package/lib/components/base/TMModal.js +48 -3
- package/lib/components/base/TMPopUp.js +74 -5
- package/lib/components/base/TMWaitPanel.js +8 -2
- package/lib/components/choosers/TMDataListItemChooser.js +1 -1
- package/lib/components/choosers/TMDcmtTypeChooser.js +2 -2
- package/lib/components/choosers/TMMetadataChooser.d.ts +4 -1
- package/lib/components/choosers/TMMetadataChooser.js +31 -8
- package/lib/components/choosers/TMUserChooser.d.ts +4 -0
- package/lib/components/choosers/TMUserChooser.js +21 -5
- package/lib/components/editors/TMMetadataValues.js +45 -4
- package/lib/components/editors/TMTextArea.d.ts +1 -0
- package/lib/components/editors/TMTextArea.js +44 -10
- package/lib/components/editors/TMTextBox.js +34 -4
- package/lib/components/editors/TMTextExpression.js +36 -28
- package/lib/components/features/assistant/ToppyDraggableHelpCenter.d.ts +30 -0
- package/lib/components/features/assistant/ToppyDraggableHelpCenter.js +471 -0
- package/lib/components/features/assistant/ToppySpeechBubble.d.ts +9 -0
- package/lib/components/features/assistant/ToppySpeechBubble.js +117 -0
- package/lib/components/features/blog/TMBlogCommentForm.d.ts +2 -0
- package/lib/components/features/blog/TMBlogCommentForm.js +18 -6
- package/lib/components/features/documents/TMDcmtBlog.js +1 -1
- package/lib/components/features/documents/TMDcmtForm.js +290 -31
- package/lib/components/features/documents/TMDcmtIcon.js +9 -4
- package/lib/components/features/documents/TMDcmtPreview.js +45 -8
- package/lib/components/features/documents/TMRelationViewer.js +55 -22
- package/lib/components/features/search/TMSearch.js +2 -2
- package/lib/components/features/search/TMSearchQueryEditor.js +1 -1
- package/lib/components/features/search/TMSearchQueryPanel.js +10 -28
- package/lib/components/features/search/TMSearchResult.js +102 -33
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +2 -1
- package/lib/components/features/search/TMSearchResultsMenuItems.js +67 -28
- package/lib/components/features/search/TMSignSettingsForm.d.ts +9 -0
- package/lib/components/features/search/TMSignSettingsForm.js +621 -0
- package/lib/components/features/tasks/TMTaskForm.js +10 -4
- package/lib/components/features/tasks/TMTasksAgenda.js +1 -1
- package/lib/components/features/tasks/TMTasksCalendar.js +1 -1
- package/lib/components/features/tasks/TMTasksUtils.d.ts +1 -0
- package/lib/components/features/tasks/TMTasksUtils.js +17 -2
- package/lib/components/features/tasks/TMTasksUtilsView.js +26 -4
- package/lib/components/features/tasks/TMTasksView.js +11 -5
- package/lib/components/features/workflow/TMWorkflowPopup.js +3 -3
- package/lib/components/features/workflow/diagram/WFDiagram.js +19 -1
- package/lib/components/forms/TMSaveForm.js +3 -11
- package/lib/components/grids/TMBlogAttachments.d.ts +0 -14
- package/lib/components/grids/TMBlogAttachments.js +10 -5
- package/lib/components/grids/TMBlogsPost.d.ts +8 -3
- package/lib/components/grids/TMBlogsPost.js +100 -39
- package/lib/components/grids/TMBlogsPostUtils.d.ts +1 -0
- package/lib/components/grids/TMBlogsPostUtils.js +27 -6
- package/lib/components/index.d.ts +2 -1
- package/lib/components/index.js +2 -1
- package/lib/components/layout/panelManager/TMPanelManagerContainer.d.ts +1 -0
- package/lib/components/layout/panelManager/TMPanelManagerContainer.js +2 -2
- package/lib/components/layout/panelManager/TMPanelManagerContext.js +0 -1
- package/lib/components/layout/panelManager/TMPanelManagerToolbar.js +2 -1
- package/lib/components/layout/panelManager/types.d.ts +1 -0
- package/lib/components/settings/SettingsAppearance.js +5 -5
- package/lib/helper/GlobalStyles.d.ts +2 -0
- package/lib/helper/GlobalStyles.js +10 -0
- package/lib/helper/Globalization.d.ts +1 -0
- package/lib/helper/Globalization.js +30 -0
- package/lib/helper/SDKUI_Localizator.d.ts +41 -1
- package/lib/helper/SDKUI_Localizator.js +410 -10
- package/lib/helper/TMIcons.d.ts +4 -1
- package/lib/helper/TMIcons.js +13 -1
- package/lib/helper/TMToppyMessage.d.ts +1 -0
- package/lib/helper/TMToppyMessage.js +4 -3
- package/lib/helper/TMUtils.d.ts +42 -4
- package/lib/helper/TMUtils.js +190 -23
- package/lib/helper/dcmtsHelper.d.ts +2 -1
- package/lib/helper/dcmtsHelper.js +56 -17
- package/lib/helper/helpers.d.ts +1 -1
- package/lib/helper/helpers.js +12 -17
- package/lib/helper/index.d.ts +1 -0
- package/lib/helper/index.js +1 -0
- package/lib/hooks/useDcmtOperations.d.ts +1 -1
- package/lib/hooks/useDcmtOperations.js +10 -6
- package/lib/hooks/useRelatedDocuments.js +35 -26
- package/lib/ts/types.d.ts +2 -0
- package/package.json +8 -8
- package/lib/components/features/assistant/ToppyHelpCenter.d.ts +0 -12
- package/lib/components/features/assistant/ToppyHelpCenter.js +0 -173
|
@@ -0,0 +1,621 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
3
|
+
import TMDropDown from "../../editors/TMDropDown";
|
|
4
|
+
import { calcResponsiveSizes, IconUndo, parseSignatureConfiguration, SDKUI_Localizator } from "../../../helper";
|
|
5
|
+
import TMTooltip from "../../base/TMTooltip";
|
|
6
|
+
import { SDK_Globals, UpdateEngineByID } from "@topconsultnpm/sdk-ts";
|
|
7
|
+
import { ButtonNames, TMExceptionBoxManager, TMMessageBoxManager } from "../../base/TMPopUp";
|
|
8
|
+
import TMSpinner from "../../base/TMSpinner";
|
|
9
|
+
import ShowAlert from "../../base/TMAlert";
|
|
10
|
+
import { TagBox } from "devextreme-react/tag-box";
|
|
11
|
+
import TMSaveForm, { TMSaveFormButtonSave, TMSaveFormButtonUndo } from "../../forms/TMSaveForm";
|
|
12
|
+
import TMCheckBox from "../../editors/TMCheckBox";
|
|
13
|
+
import TMTextBox from "../../editors/TMTextBox";
|
|
14
|
+
import { DeviceType, useDeviceType } from "../../base/TMDeviceProvider";
|
|
15
|
+
import { FormModes } from "../../../ts";
|
|
16
|
+
import TMToppyMessage from "../../../helper/TMToppyMessage";
|
|
17
|
+
const TMSignSettingsForm = (props) => {
|
|
18
|
+
const { fromDTD, inputDcmts, onCloseSignSettingsForm, onSavedAsyncCallback } = props;
|
|
19
|
+
const MODIFIED_COLOR = '#E29000';
|
|
20
|
+
const METADATA_FIELDS = {
|
|
21
|
+
SIGN_TYPE: 's4t_signtype',
|
|
22
|
+
EDITOR_CONFIG: 's4t_editorconfig',
|
|
23
|
+
INFORMATION_SIGN: 's4t_informationsign',
|
|
24
|
+
NAME: 's4t_name',
|
|
25
|
+
SURNAME: 's4t_surname',
|
|
26
|
+
SHARED_SIGN: 's4t_sharedsign',
|
|
27
|
+
MULTI_SIGNERS: 's4t_checksharedsign',
|
|
28
|
+
};
|
|
29
|
+
const defaultConfigValue = {
|
|
30
|
+
signType: null,
|
|
31
|
+
editorConfig: [],
|
|
32
|
+
allowDate: true,
|
|
33
|
+
allowSignerBy: false,
|
|
34
|
+
signerByValue: '',
|
|
35
|
+
allowLocation: false,
|
|
36
|
+
locationValue: SDKUI_Localizator.Torino,
|
|
37
|
+
allowCopyright: false,
|
|
38
|
+
copyrightValue: 'Sign4Top',
|
|
39
|
+
enableSharedSign: false,
|
|
40
|
+
multiSigners: [],
|
|
41
|
+
};
|
|
42
|
+
// Get the current device type (e.g., mobile, tablet, desktop) using a custom hook.
|
|
43
|
+
const deviceType = useDeviceType();
|
|
44
|
+
// This avoids unnecessary re-renders by only recalculating when deviceType changes.
|
|
45
|
+
let isMobile = useMemo(() => { return deviceType === DeviceType.MOBILE; }, [deviceType]);
|
|
46
|
+
const signTypeDataSource = [
|
|
47
|
+
{ value: '', display: '- Non selezionato -' },
|
|
48
|
+
{ value: 'FEQ', display: 'Firma Elettronica Qualificata' },
|
|
49
|
+
{ value: 'FES', display: 'Firma Elettronica Semplice' },
|
|
50
|
+
{ value: 'FES_T', display: 'Firma Elettronica Semplice Testuale' },
|
|
51
|
+
{ value: 'FES_M', display: 'Firma Elettronica Semplice Manuale' },
|
|
52
|
+
{ value: 'FES_C', display: 'Firma Elettronica Semplice con Immagine' },
|
|
53
|
+
];
|
|
54
|
+
const editorConfigDataSource = [
|
|
55
|
+
{ value: 'signature', display: SDKUI_Localizator.SignatureField },
|
|
56
|
+
{ value: 'text', display: SDKUI_Localizator.TextField },
|
|
57
|
+
{ value: 'line', display: SDKUI_Localizator.Line },
|
|
58
|
+
{ value: 'mark', display: SDKUI_Localizator.Mark },
|
|
59
|
+
{ value: 'checkmark', display: SDKUI_Localizator.Checkmark },
|
|
60
|
+
];
|
|
61
|
+
const [currentDcmt, setCurrentDcmt] = useState(null);
|
|
62
|
+
const [metadataByKey, setMetadataByKey] = useState({});
|
|
63
|
+
const [hasFields, setHasFields] = useState({
|
|
64
|
+
signType: false,
|
|
65
|
+
editorConfig: false,
|
|
66
|
+
informationSign: false,
|
|
67
|
+
sharedSign: false,
|
|
68
|
+
multiSigners: false
|
|
69
|
+
});
|
|
70
|
+
const [missingFields, setMissingFields] = useState([]);
|
|
71
|
+
const [hasAvailableFields, setHasAvailableFields] = useState(true);
|
|
72
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
73
|
+
const [modalHeight, setModalHeight] = useState(calcResponsiveSizes(deviceType, '600px', '600px', '95%'));
|
|
74
|
+
const [modalWidth, setModalWidth] = useState(calcResponsiveSizes(deviceType, '600px', '600px', '95%'));
|
|
75
|
+
// form fields
|
|
76
|
+
const [isModified, setIsModified] = useState(false);
|
|
77
|
+
const [formDataOrigin, setFormDataOrigin] = useState({
|
|
78
|
+
signType: defaultConfigValue.signType,
|
|
79
|
+
editorConfig: defaultConfigValue.editorConfig,
|
|
80
|
+
allowDate: defaultConfigValue.allowDate,
|
|
81
|
+
allowSignerBy: defaultConfigValue.allowSignerBy,
|
|
82
|
+
signerByValue: defaultConfigValue.signerByValue,
|
|
83
|
+
allowLocation: defaultConfigValue.allowLocation,
|
|
84
|
+
locationValue: defaultConfigValue.locationValue,
|
|
85
|
+
allowCopyright: defaultConfigValue.allowCopyright,
|
|
86
|
+
copyrightValue: defaultConfigValue.copyrightValue,
|
|
87
|
+
enableSharedSign: defaultConfigValue.enableSharedSign,
|
|
88
|
+
multiSigners: defaultConfigValue.multiSigners,
|
|
89
|
+
});
|
|
90
|
+
const [signTypeSelected, setSignTypeSelected] = useState(defaultConfigValue.signType);
|
|
91
|
+
const [editorConfigSelected, setEditorConfigSelected] = useState(defaultConfigValue.editorConfig);
|
|
92
|
+
const [enableDate, setEnableDate] = useState(defaultConfigValue.allowDate);
|
|
93
|
+
const [enableSignerBy, setEnableSignerBy] = useState(defaultConfigValue.allowSignerBy);
|
|
94
|
+
const [signerBy, setSignerBy] = useState(defaultConfigValue.signerByValue);
|
|
95
|
+
const [enableLocation, setEnableLocation] = useState(defaultConfigValue.allowLocation);
|
|
96
|
+
const [location, setLocation] = useState(defaultConfigValue.locationValue);
|
|
97
|
+
const [enableCopyright, setEnableCopyright] = useState(defaultConfigValue.allowCopyright);
|
|
98
|
+
const [copyright, setCopyright] = useState(defaultConfigValue.copyrightValue);
|
|
99
|
+
const [enableSharedSign, setEnableSharedSign] = useState(false);
|
|
100
|
+
const [multiSigners, setMultiSigners] = useState(defaultConfigValue.multiSigners);
|
|
101
|
+
// Inizializza i campi del form dai metadati
|
|
102
|
+
const initializeFormFields = async (dcmt, metadata) => {
|
|
103
|
+
// Simula asincronicità con breve timeout
|
|
104
|
+
await new Promise(resolve => setTimeout(resolve, 50));
|
|
105
|
+
if (!dcmt || !dcmt.DID || !metadata) {
|
|
106
|
+
throw new Error("Dati del documento o metadati non validi per l'inizializzazione del form");
|
|
107
|
+
}
|
|
108
|
+
;
|
|
109
|
+
// Inizializza signType
|
|
110
|
+
const signTypeMetadata = metadata[METADATA_FIELDS.SIGN_TYPE];
|
|
111
|
+
const signTypeValue = signTypeMetadata?.value || defaultConfigValue.signType;
|
|
112
|
+
// Inizializza editorConfig
|
|
113
|
+
const editorConfig = metadata[METADATA_FIELDS.EDITOR_CONFIG];
|
|
114
|
+
const editorConfigValue = editorConfig?.value || '';
|
|
115
|
+
// Converti la stringa in array
|
|
116
|
+
let configArray = [];
|
|
117
|
+
if (editorConfigValue) {
|
|
118
|
+
const lowerValue = editorConfigValue.toLowerCase().trim();
|
|
119
|
+
// Gestisce i casi speciali "all", "none" e stringa vuota
|
|
120
|
+
if (lowerValue === 'all') {
|
|
121
|
+
// Seleziona tutti i valori disponibili
|
|
122
|
+
configArray = editorConfigDataSource.map(item => item.value);
|
|
123
|
+
}
|
|
124
|
+
else if (lowerValue === 'none' || lowerValue === '') {
|
|
125
|
+
// Deseleziona tutti
|
|
126
|
+
configArray = [];
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
// Comportamento normale: split della stringa
|
|
130
|
+
configArray = editorConfigValue.split(',').map((item) => item.trim().toLowerCase()).filter((item) => item !== '');
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
// Inizializza il valore di default per signerBy
|
|
134
|
+
const firstName = metadata[METADATA_FIELDS.NAME] ? metadata[METADATA_FIELDS.NAME].value : null;
|
|
135
|
+
const lastName = metadata[METADATA_FIELDS.SURNAME] ? metadata[METADATA_FIELDS.SURNAME].value : null;
|
|
136
|
+
if (firstName || lastName) {
|
|
137
|
+
const defaultSignerBy = `${firstName ?? ""} ${lastName ?? ""}`.trim();
|
|
138
|
+
setSignerBy(defaultSignerBy);
|
|
139
|
+
}
|
|
140
|
+
// Inizializza information sign
|
|
141
|
+
const informationSign = metadata[METADATA_FIELDS.INFORMATION_SIGN];
|
|
142
|
+
const did = Number(dcmt.DID);
|
|
143
|
+
const { allowDate, allowSignerBy, signerByValue, allowLocation, locationValue, allowCopyright, copyrightValue } = parseSignatureConfiguration(did, informationSign?.value, firstName, lastName, dcmt.title);
|
|
144
|
+
// Inizializza shared-sign e multi-signers
|
|
145
|
+
const sharedSignMetadata = metadata[METADATA_FIELDS.SHARED_SIGN];
|
|
146
|
+
const allowSharedSign = sharedSignMetadata?.value === 'S' ? true : sharedSignMetadata?.value === 'N' ? false : defaultConfigValue.enableSharedSign;
|
|
147
|
+
setEnableSharedSign(allowSharedSign);
|
|
148
|
+
const multiSignersMetadata = metadata[METADATA_FIELDS.MULTI_SIGNERS];
|
|
149
|
+
const multiSignersValue = (() => {
|
|
150
|
+
if (!multiSignersMetadata?.value)
|
|
151
|
+
return defaultConfigValue.multiSigners;
|
|
152
|
+
if (typeof multiSignersMetadata.value === 'string') {
|
|
153
|
+
return multiSignersMetadata.value.split(',').map((item) => item.trim()).filter((item) => item !== '');
|
|
154
|
+
}
|
|
155
|
+
return defaultConfigValue.multiSigners;
|
|
156
|
+
})();
|
|
157
|
+
setMultiSigners(multiSignersValue);
|
|
158
|
+
setFormDataOrigin({
|
|
159
|
+
signType: signTypeValue,
|
|
160
|
+
editorConfig: configArray.length > 0 ? configArray : defaultConfigValue.editorConfig,
|
|
161
|
+
allowDate: allowDate,
|
|
162
|
+
allowSignerBy: allowSignerBy,
|
|
163
|
+
signerByValue: signerByValue,
|
|
164
|
+
allowLocation: allowLocation,
|
|
165
|
+
locationValue: locationValue,
|
|
166
|
+
allowCopyright: allowCopyright,
|
|
167
|
+
copyrightValue: copyrightValue,
|
|
168
|
+
enableSharedSign: allowSharedSign,
|
|
169
|
+
multiSigners: multiSignersValue
|
|
170
|
+
});
|
|
171
|
+
setSignTypeSelected(signTypeValue);
|
|
172
|
+
setEditorConfigSelected(configArray);
|
|
173
|
+
setEnableDate(allowDate);
|
|
174
|
+
setEnableSignerBy(allowSignerBy);
|
|
175
|
+
setSignerBy(signerByValue);
|
|
176
|
+
setEnableLocation(allowLocation);
|
|
177
|
+
setLocation(locationValue);
|
|
178
|
+
setEnableCopyright(allowCopyright);
|
|
179
|
+
setCopyright(copyrightValue);
|
|
180
|
+
};
|
|
181
|
+
useEffect(() => {
|
|
182
|
+
const initialize = async () => {
|
|
183
|
+
if (inputDcmts && inputDcmts.length > 0) {
|
|
184
|
+
const dcmt = inputDcmts[0];
|
|
185
|
+
setCurrentDcmt(dcmt);
|
|
186
|
+
// Verifica quali campi esistono nel DTD
|
|
187
|
+
const metadataNames = fromDTD?.metadata?.map(m => m.name?.toLowerCase()).filter(Boolean) || [];
|
|
188
|
+
const hasSignTypeField = metadataNames.includes(METADATA_FIELDS.SIGN_TYPE);
|
|
189
|
+
const hasEditorConfigField = metadataNames.includes(METADATA_FIELDS.EDITOR_CONFIG);
|
|
190
|
+
const hasInformationSignField = metadataNames.includes(METADATA_FIELDS.INFORMATION_SIGN);
|
|
191
|
+
const hasSharedSignField = metadataNames.includes(METADATA_FIELDS.SHARED_SIGN);
|
|
192
|
+
const hasMultiSignersField = metadataNames.includes(METADATA_FIELDS.MULTI_SIGNERS);
|
|
193
|
+
setHasFields({
|
|
194
|
+
signType: hasSignTypeField,
|
|
195
|
+
editorConfig: hasEditorConfigField,
|
|
196
|
+
informationSign: hasInformationSignField,
|
|
197
|
+
sharedSign: hasSharedSignField,
|
|
198
|
+
multiSigners: hasMultiSignersField
|
|
199
|
+
});
|
|
200
|
+
// Calcola i campi mancanti
|
|
201
|
+
const missing = [];
|
|
202
|
+
if (!hasSignTypeField)
|
|
203
|
+
missing.push(METADATA_FIELDS.SIGN_TYPE);
|
|
204
|
+
if (!hasEditorConfigField)
|
|
205
|
+
missing.push(METADATA_FIELDS.EDITOR_CONFIG);
|
|
206
|
+
if (!hasInformationSignField)
|
|
207
|
+
missing.push(METADATA_FIELDS.INFORMATION_SIGN);
|
|
208
|
+
if (!hasSharedSignField)
|
|
209
|
+
missing.push(METADATA_FIELDS.SHARED_SIGN);
|
|
210
|
+
if (!hasMultiSignersField)
|
|
211
|
+
missing.push(METADATA_FIELDS.MULTI_SIGNERS);
|
|
212
|
+
setMissingFields(missing);
|
|
213
|
+
const atLeastOneFieldExists = hasSignTypeField || hasEditorConfigField || hasInformationSignField || hasSharedSignField || hasMultiSignersField;
|
|
214
|
+
if (!atLeastOneFieldExists) {
|
|
215
|
+
setHasAvailableFields(false);
|
|
216
|
+
setModalHeight('auto');
|
|
217
|
+
setModalWidth('auto');
|
|
218
|
+
setIsLoading(false);
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
// Carica i metadati dal documento
|
|
222
|
+
const metadata = {};
|
|
223
|
+
if (fromDTD?.metadata && dcmt) {
|
|
224
|
+
fromDTD.metadata.forEach((meta) => {
|
|
225
|
+
if (meta.id && meta.name) {
|
|
226
|
+
const value = dcmt[dcmt.TID + "_" + meta.id];
|
|
227
|
+
if (value === undefined)
|
|
228
|
+
return;
|
|
229
|
+
metadata[meta.name.toLowerCase()] = { value, mid: meta.id };
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
setMetadataByKey(metadata);
|
|
234
|
+
// Inizializza tutti i campi del form
|
|
235
|
+
if (Object.keys(metadata).length > 0) {
|
|
236
|
+
try {
|
|
237
|
+
TMSpinner.show({ description: SDKUI_Localizator.Loading });
|
|
238
|
+
await initializeFormFields(dcmt, metadata);
|
|
239
|
+
}
|
|
240
|
+
catch (e) {
|
|
241
|
+
setHasAvailableFields(false);
|
|
242
|
+
setModalHeight('auto');
|
|
243
|
+
setModalWidth('auto');
|
|
244
|
+
setTimeout(() => TMExceptionBoxManager.show({ exception: e }), 200);
|
|
245
|
+
}
|
|
246
|
+
finally {
|
|
247
|
+
TMSpinner.hide();
|
|
248
|
+
setIsLoading(false);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
initialize();
|
|
254
|
+
}, [inputDcmts, fromDTD]);
|
|
255
|
+
const onSignTypeValueChange = (e) => {
|
|
256
|
+
const value = e?.target?.value;
|
|
257
|
+
// Se il valore è stringa vuota, imposta null, altrimenti usa il valore
|
|
258
|
+
setSignTypeSelected(value === '' ? null : value);
|
|
259
|
+
// Se il tipo di firma è FEQ, imposta sempre enableDate a true
|
|
260
|
+
if (value === 'FEQ') {
|
|
261
|
+
setEnableDate(true);
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
const onEditorConfigValueChange = (e) => {
|
|
265
|
+
const newValues = e.value || [];
|
|
266
|
+
setEditorConfigSelected(newValues);
|
|
267
|
+
};
|
|
268
|
+
const onMultiSignersValueChange = useCallback((e) => {
|
|
269
|
+
const newValues = e.value || [];
|
|
270
|
+
setMultiSigners(newValues);
|
|
271
|
+
}, []);
|
|
272
|
+
// Controlla se editorConfig è stato modificato
|
|
273
|
+
const isEditorConfigModified = () => {
|
|
274
|
+
if (editorConfigSelected.length !== formDataOrigin.editorConfig.length)
|
|
275
|
+
return true;
|
|
276
|
+
const sorted1 = [...editorConfigSelected].sort();
|
|
277
|
+
const sorted2 = [...formDataOrigin.editorConfig].sort();
|
|
278
|
+
return !sorted1.every((val, index) => val === sorted2[index]);
|
|
279
|
+
};
|
|
280
|
+
const isSignatureInformationModified = () => {
|
|
281
|
+
const dateModified = enableDate !== formDataOrigin.allowDate;
|
|
282
|
+
const signerByModified = enableSignerBy !== formDataOrigin.allowSignerBy || (enableSignerBy && signerBy !== formDataOrigin.signerByValue);
|
|
283
|
+
const locationModified = enableLocation !== formDataOrigin.allowLocation || (enableLocation && location !== formDataOrigin.locationValue);
|
|
284
|
+
const copyrightModified = enableCopyright !== formDataOrigin.allowCopyright || (enableCopyright && copyright !== formDataOrigin.copyrightValue);
|
|
285
|
+
return dateModified || signerByModified || locationModified || copyrightModified;
|
|
286
|
+
};
|
|
287
|
+
const isMultiSignersModified = () => {
|
|
288
|
+
if (multiSigners.length !== formDataOrigin.multiSigners.length)
|
|
289
|
+
return true;
|
|
290
|
+
const sorted1 = [...multiSigners].sort();
|
|
291
|
+
const sorted2 = [...formDataOrigin.multiSigners].sort();
|
|
292
|
+
return !sorted1.every((val, index) => val === sorted2[index]);
|
|
293
|
+
};
|
|
294
|
+
useEffect(() => {
|
|
295
|
+
if (signTypeSelected === undefined || isLoading)
|
|
296
|
+
return;
|
|
297
|
+
const signTypeChanged = signTypeSelected !== formDataOrigin.signType;
|
|
298
|
+
const sharedSignChanged = enableSharedSign !== formDataOrigin.enableSharedSign || (enableSharedSign && isMultiSignersModified());
|
|
299
|
+
setIsModified(signTypeChanged || isEditorConfigModified() || isSignatureInformationModified() || sharedSignChanged);
|
|
300
|
+
}, [signTypeSelected, isLoading, formDataOrigin, isEditorConfigModified, isSignatureInformationModified, enableSharedSign, isMultiSignersModified]);
|
|
301
|
+
const renderTag = (tagData) => {
|
|
302
|
+
const handleRemoveTag = () => {
|
|
303
|
+
const newValues = editorConfigSelected.filter(val => val !== tagData.value);
|
|
304
|
+
setEditorConfigSelected(newValues);
|
|
305
|
+
};
|
|
306
|
+
const isModified = isEditorConfigModified();
|
|
307
|
+
return (_jsxs("div", { style: {
|
|
308
|
+
background: '#f5f5f5',
|
|
309
|
+
border: `1px solid ${isModified ? MODIFIED_COLOR : '#d0d0d0'}`,
|
|
310
|
+
borderRadius: '16px',
|
|
311
|
+
padding: '2px 5px',
|
|
312
|
+
fontSize: '12px',
|
|
313
|
+
fontWeight: '500',
|
|
314
|
+
color: isModified ? MODIFIED_COLOR : '#555',
|
|
315
|
+
margin: '3px',
|
|
316
|
+
boxShadow: '0 1px 3px rgba(0, 0, 0, 0.08)',
|
|
317
|
+
display: 'inline-flex',
|
|
318
|
+
alignItems: 'center',
|
|
319
|
+
gap: '6px',
|
|
320
|
+
cursor: 'default'
|
|
321
|
+
}, onMouseEnter: (e) => {
|
|
322
|
+
e.currentTarget.style.background = '#ebebeb';
|
|
323
|
+
e.currentTarget.style.borderColor = isModified ? MODIFIED_COLOR : '#b8b8b8';
|
|
324
|
+
e.currentTarget.style.boxShadow = '0 2px 5px rgba(0, 0, 0, 0.12)';
|
|
325
|
+
}, onMouseLeave: (e) => {
|
|
326
|
+
e.currentTarget.style.background = '#f5f5f5';
|
|
327
|
+
e.currentTarget.style.borderColor = isModified ? MODIFIED_COLOR : '#d0d0d0';
|
|
328
|
+
e.currentTarget.style.boxShadow = '0 1px 3px rgba(0, 0, 0, 0.08)';
|
|
329
|
+
}, children: [_jsx("span", { style: { letterSpacing: '0.2px' }, children: tagData.display }), _jsx("span", { onClick: handleRemoveTag, style: {
|
|
330
|
+
cursor: 'pointer',
|
|
331
|
+
opacity: 0.5,
|
|
332
|
+
fontSize: '16px',
|
|
333
|
+
fontWeight: 'bold',
|
|
334
|
+
color: isModified ? MODIFIED_COLOR : '#777',
|
|
335
|
+
transition: 'opacity 0.2s ease'
|
|
336
|
+
}, onMouseEnter: (e) => { e.currentTarget.style.opacity = '0.9'; }, onMouseLeave: (e) => { e.currentTarget.style.opacity = '0.5'; }, children: "\u00D7" })] }));
|
|
337
|
+
};
|
|
338
|
+
const renderMultiSignerTag = (tagData) => {
|
|
339
|
+
const handleRemoveTag = () => {
|
|
340
|
+
const newValues = multiSigners.filter(val => val !== tagData);
|
|
341
|
+
setMultiSigners(newValues);
|
|
342
|
+
};
|
|
343
|
+
const isModified = isMultiSignersModified();
|
|
344
|
+
return (_jsxs("div", { style: {
|
|
345
|
+
background: '#f5f5f5',
|
|
346
|
+
border: `1px solid ${isModified ? MODIFIED_COLOR : '#d0d0d0'}`,
|
|
347
|
+
borderRadius: '16px',
|
|
348
|
+
padding: '2px 5px',
|
|
349
|
+
fontSize: '12px',
|
|
350
|
+
fontWeight: '500',
|
|
351
|
+
color: isModified ? MODIFIED_COLOR : '#555',
|
|
352
|
+
margin: '3px',
|
|
353
|
+
boxShadow: '0 1px 3px rgba(0, 0, 0, 0.08)',
|
|
354
|
+
display: 'inline-flex',
|
|
355
|
+
alignItems: 'center',
|
|
356
|
+
gap: '6px',
|
|
357
|
+
cursor: 'default'
|
|
358
|
+
}, onMouseEnter: (e) => {
|
|
359
|
+
e.currentTarget.style.background = '#ebebeb';
|
|
360
|
+
e.currentTarget.style.borderColor = isModified ? MODIFIED_COLOR : '#b8b8b8';
|
|
361
|
+
e.currentTarget.style.boxShadow = '0 2px 5px rgba(0, 0, 0, 0.12)';
|
|
362
|
+
}, onMouseLeave: (e) => {
|
|
363
|
+
e.currentTarget.style.background = '#f5f5f5';
|
|
364
|
+
e.currentTarget.style.borderColor = isModified ? MODIFIED_COLOR : '#d0d0d0';
|
|
365
|
+
e.currentTarget.style.boxShadow = '0 1px 3px rgba(0, 0, 0, 0.08)';
|
|
366
|
+
}, children: [_jsx("span", { style: { letterSpacing: '0.2px' }, children: tagData }), _jsx("span", { onClick: handleRemoveTag, style: {
|
|
367
|
+
cursor: 'pointer',
|
|
368
|
+
opacity: 0.5,
|
|
369
|
+
fontSize: '16px',
|
|
370
|
+
fontWeight: 'bold',
|
|
371
|
+
color: isModified ? MODIFIED_COLOR : '#777',
|
|
372
|
+
transition: 'opacity 0.2s ease'
|
|
373
|
+
}, onMouseEnter: (e) => { e.currentTarget.style.opacity = '0.9'; }, onMouseLeave: (e) => { e.currentTarget.style.opacity = '0.5'; }, children: _jsx("i", { className: "dx-icon-close" }) })] }));
|
|
374
|
+
};
|
|
375
|
+
const onResetSettings = () => {
|
|
376
|
+
setSignTypeSelected(formDataOrigin.signType);
|
|
377
|
+
setEditorConfigSelected(formDataOrigin.editorConfig);
|
|
378
|
+
setEnableDate(formDataOrigin.allowDate);
|
|
379
|
+
setEnableSignerBy(formDataOrigin.allowSignerBy);
|
|
380
|
+
setSignerBy(formDataOrigin.signerByValue);
|
|
381
|
+
setEnableLocation(formDataOrigin.allowLocation);
|
|
382
|
+
setLocation(formDataOrigin.locationValue);
|
|
383
|
+
setEnableCopyright(formDataOrigin.allowCopyright);
|
|
384
|
+
setCopyright(formDataOrigin.copyrightValue);
|
|
385
|
+
setEnableSharedSign(formDataOrigin.enableSharedSign);
|
|
386
|
+
setMultiSigners(formDataOrigin.multiSigners);
|
|
387
|
+
};
|
|
388
|
+
const onSaveSignSettings = async () => {
|
|
389
|
+
if (!isModified) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
try {
|
|
393
|
+
TMSpinner.show({ description: 'Aggiornamento in corso...' });
|
|
394
|
+
if (currentDcmt && currentDcmt.TID && currentDcmt.DID) {
|
|
395
|
+
const ue = new UpdateEngineByID(SDK_Globals.tmSession);
|
|
396
|
+
ue.DID = currentDcmt.DID;
|
|
397
|
+
ue.TID = currentDcmt.TID;
|
|
398
|
+
ue.Metadata_ClearAll();
|
|
399
|
+
// Aggiorna signType solo se modificato
|
|
400
|
+
if (signTypeSelected !== formDataOrigin.signType) {
|
|
401
|
+
const signTypeMetadata = metadataByKey[METADATA_FIELDS.SIGN_TYPE];
|
|
402
|
+
const signTypeMid = signTypeMetadata?.mid;
|
|
403
|
+
ue.Metadata_AddString(signTypeMid, signTypeSelected ?? '');
|
|
404
|
+
}
|
|
405
|
+
// Aggiorna editorConfig solo se modificato
|
|
406
|
+
const editorConfigMetadata = metadataByKey[METADATA_FIELDS.EDITOR_CONFIG];
|
|
407
|
+
const editorConfigMid = editorConfigMetadata?.mid;
|
|
408
|
+
if (editorConfigMid && isEditorConfigModified()) {
|
|
409
|
+
const editorConfigValue = editorConfigSelected.join(',');
|
|
410
|
+
ue.Metadata_AddString(editorConfigMid, editorConfigValue);
|
|
411
|
+
}
|
|
412
|
+
// Aggiorna informationSign solo se modificato
|
|
413
|
+
if (isSignatureInformationModified()) {
|
|
414
|
+
const informationSignMetadata = metadataByKey[METADATA_FIELDS.INFORMATION_SIGN];
|
|
415
|
+
const informationSignMid = informationSignMetadata?.mid;
|
|
416
|
+
// Per FEQ, la Data è sempre true; per gli altri tipi, usa enableDate
|
|
417
|
+
const dateEnabled = signTypeSelected === 'FEQ' ? true : enableDate;
|
|
418
|
+
const informationSignValue = `${dateEnabled ? 'date=yes,' : 'date=no,'}${enableSignerBy ? `signerby=${signerBy},` : ''}${enableLocation ? `location=${location},` : ''}${enableCopyright ? `copyright=${copyright},` : ''}`.replace(/,$/, '');
|
|
419
|
+
ue.Metadata_AddString(informationSignMid, informationSignValue);
|
|
420
|
+
}
|
|
421
|
+
// Aggiorna multi-signer solo se modificato
|
|
422
|
+
if (enableSharedSign !== formDataOrigin.enableSharedSign || isMultiSignersModified()) {
|
|
423
|
+
const sharedSignMetadata = metadataByKey[METADATA_FIELDS.SHARED_SIGN];
|
|
424
|
+
const sharedSignMid = sharedSignMetadata?.mid;
|
|
425
|
+
const sharedSignValue = enableSharedSign ? 'S' : 'N';
|
|
426
|
+
ue.Metadata_AddString(sharedSignMid, sharedSignValue);
|
|
427
|
+
const multiSignersMetadata = metadataByKey[METADATA_FIELDS.MULTI_SIGNERS];
|
|
428
|
+
const multiSignersMid = multiSignersMetadata?.mid;
|
|
429
|
+
const multiSignersValue = sharedSignValue === 'N' ? '' : multiSigners.join(',');
|
|
430
|
+
ue.Metadata_AddString(multiSignersMid, multiSignersValue);
|
|
431
|
+
}
|
|
432
|
+
await ue.UpdateAsync();
|
|
433
|
+
// Tenta di ottenere i metadati aggiornati
|
|
434
|
+
let metadataResult = undefined;
|
|
435
|
+
let hasGetMetadataError = false;
|
|
436
|
+
try {
|
|
437
|
+
metadataResult = await SDK_Globals.tmSession?.NewSearchEngine().GetMetadataAsync(currentDcmt.TID, currentDcmt.DID, true);
|
|
438
|
+
}
|
|
439
|
+
catch (metadataError) {
|
|
440
|
+
hasGetMetadataError = true;
|
|
441
|
+
// Estrai ErrorCode dal campo detail se disponibile
|
|
442
|
+
let errorCode = undefined;
|
|
443
|
+
if (metadataError?.isApiException && metadataError?.response?.detail) {
|
|
444
|
+
try {
|
|
445
|
+
const detailObj = JSON.parse(metadataError.response.detail);
|
|
446
|
+
errorCode = detailObj?.ErrorCode;
|
|
447
|
+
}
|
|
448
|
+
catch (parseError) {
|
|
449
|
+
console.log("Impossibile parsare il detail dell'eccezione:", parseError);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
// Se ErrorCode è -5, mostra messaggio personalizzato, altrimenti mostra l'eccezione originale
|
|
453
|
+
if (errorCode === -5) {
|
|
454
|
+
TMMessageBoxManager.show({
|
|
455
|
+
message: SDKUI_Localizator.DcmtOutOfView,
|
|
456
|
+
buttons: [ButtonNames.OK],
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
else {
|
|
460
|
+
TMExceptionBoxManager.show({ exception: metadataError });
|
|
461
|
+
}
|
|
462
|
+
// Usa null per indicare al callback che c'è stato un errore e non deve ritentare
|
|
463
|
+
metadataResult = null;
|
|
464
|
+
}
|
|
465
|
+
await onSavedAsyncCallback?.(currentDcmt.TID, currentDcmt.DID, metadataResult);
|
|
466
|
+
ShowAlert({ mode: 'success', title: SDKUI_Localizator.SignatureSettings, message: 'Le modifiche sono state salvate con successo', duration: 3000 });
|
|
467
|
+
onCloseSignSettingsForm();
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
catch (e) {
|
|
471
|
+
TMExceptionBoxManager.show({ exception: e });
|
|
472
|
+
}
|
|
473
|
+
finally {
|
|
474
|
+
TMSpinner.hide();
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
if (isLoading) {
|
|
478
|
+
return null;
|
|
479
|
+
}
|
|
480
|
+
return _jsx(TMSaveForm, { isModal: true, title: SDKUI_Localizator.SignatureSettings, width: modalWidth, height: modalHeight, isModified: isModified, showTitleFormMode: false, onClose: onCloseSignSettingsForm, onSaveAsync: onSaveSignSettings, showToolbar: false, children: !hasAvailableFields ? (_jsx(TMToppyMessage, { message: _jsxs("div", { style: {
|
|
481
|
+
display: 'flex',
|
|
482
|
+
flexDirection: 'column',
|
|
483
|
+
justifyContent: 'center',
|
|
484
|
+
alignItems: 'center',
|
|
485
|
+
gap: '10px',
|
|
486
|
+
}, children: [_jsx("div", { style: {
|
|
487
|
+
fontSize: '18px',
|
|
488
|
+
fontWeight: '600',
|
|
489
|
+
color: '#555',
|
|
490
|
+
textAlign: 'center'
|
|
491
|
+
}, children: "Configurazione non possibile" }), _jsx("div", { style: {
|
|
492
|
+
fontSize: '14px',
|
|
493
|
+
color: '#888',
|
|
494
|
+
textAlign: 'center',
|
|
495
|
+
lineHeight: '1.5'
|
|
496
|
+
}, children: "Questo tipo di documento non supporta i campi necessari per la configurazione della firma." }), _jsxs("div", { style: {
|
|
497
|
+
fontSize: '13px',
|
|
498
|
+
color: '#999',
|
|
499
|
+
textAlign: 'center',
|
|
500
|
+
}, children: [_jsx("div", { style: { marginBottom: '10px', fontWeight: '500', color: '#666' }, children: "Campi richiesti:" }), _jsx("div", { style: { display: 'flex', gap: '8px', justifyContent: 'center', flexWrap: 'wrap' }, children: missingFields.map(field => (_jsx("span", { style: {
|
|
501
|
+
background: '#fff3e0',
|
|
502
|
+
border: '1px solid #ffcc80',
|
|
503
|
+
borderRadius: '16px',
|
|
504
|
+
padding: '4px 12px',
|
|
505
|
+
fontSize: '11px',
|
|
506
|
+
fontWeight: '500',
|
|
507
|
+
color: '#e65100',
|
|
508
|
+
boxShadow: '0 1px 2px rgba(0, 0, 0, 0.08)',
|
|
509
|
+
letterSpacing: '0.2px'
|
|
510
|
+
}, children: field }, field))) })] })] }), maxWidth: "80%" })) : (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '16px', padding: '6px 12px', height: '100%', width: '100%', overflow: 'auto' }, children: [missingFields.length > 0 && (_jsxs("div", { style: {
|
|
511
|
+
backgroundColor: '#fff5e6',
|
|
512
|
+
border: `1px solid ${MODIFIED_COLOR}`,
|
|
513
|
+
borderRadius: '4px',
|
|
514
|
+
padding: '8px 12px',
|
|
515
|
+
display: 'flex',
|
|
516
|
+
alignItems: 'center',
|
|
517
|
+
gap: '8px',
|
|
518
|
+
flexWrap: 'wrap'
|
|
519
|
+
}, children: [_jsx("i", { className: "dx-icon-warning", style: { fontSize: '18px', color: MODIFIED_COLOR } }), _jsx("span", { style: { fontSize: '13px', color: MODIFIED_COLOR, fontWeight: '500', whiteSpace: 'nowrap' }, children: "Campi mancanti:" }), missingFields.map(field => (_jsx("span", { style: {
|
|
520
|
+
background: '#fff',
|
|
521
|
+
border: `1px solid ${MODIFIED_COLOR}`,
|
|
522
|
+
borderRadius: '12px',
|
|
523
|
+
padding: '2px 8px',
|
|
524
|
+
fontSize: '11px',
|
|
525
|
+
fontWeight: '500',
|
|
526
|
+
color: MODIFIED_COLOR,
|
|
527
|
+
boxShadow: '0 1px 2px rgba(0, 0, 0, 0.05)'
|
|
528
|
+
}, children: field }, field)))] })), _jsx("style", { children: `
|
|
529
|
+
#editorConfigTagBox.dx-editor-outlined .dx-label,
|
|
530
|
+
#multiSignersTagBox.dx-editor-outlined .dx-label {
|
|
531
|
+
border-bottom-color: #e0e0e0 !important;
|
|
532
|
+
}
|
|
533
|
+
#editorConfigTagBox.dx-editor-outlined .dx-label span,
|
|
534
|
+
#multiSignersTagBox.dx-editor-outlined .dx-label span {
|
|
535
|
+
font-size: 0.9rem !important;
|
|
536
|
+
color: rgb(80, 80, 80) !important;
|
|
537
|
+
padding: 0 3px !important;
|
|
538
|
+
}
|
|
539
|
+
#editorConfigTagBox.dx-editor-outlined:hover .dx-label,
|
|
540
|
+
#editorConfigTagBox.dx-editor-outlined.dx-state-hover .dx-label,
|
|
541
|
+
#multiSignersTagBox.dx-editor-outlined:hover .dx-label,
|
|
542
|
+
#multiSignersTagBox.dx-editor-outlined.dx-state-hover .dx-label {
|
|
543
|
+
border-bottom-color: rgba(0, 0, 0, 0.87) !important;
|
|
544
|
+
}
|
|
545
|
+
#multiSignersTagBox .dx-texteditor-input-container {
|
|
546
|
+
align-items: center !important;
|
|
547
|
+
}
|
|
548
|
+
` }), hasFields.signType && (_jsx(TMDropDown, { label: SDKUI_Localizator.SignatureType, value: signTypeSelected ?? '', dataSource: signTypeDataSource, onValueChanged: onSignTypeValueChange, isModifiedWhen: signTypeSelected !== formDataOrigin.signType })), hasFields.editorConfig && (_jsx(TagBox, { id: "editorConfigTagBox", name: "editorConfig", inputAttr: { id: 'editorConfigInput', name: 'editorConfigInput' }, dataSource: editorConfigDataSource, displayExpr: "display", label: SDKUI_Localizator.EditorConfiguration, labelMode: "static", valueExpr: "value", value: editorConfigSelected, onValueChanged: onEditorConfigValueChange, placeholder: "Seleziona", showSelectionControls: true, applyValueMode: "useButtons", searchEnabled: false, stylingMode: "outlined", tagRender: renderTag, acceptCustomValue: false, style: isEditorConfigModified() ? {
|
|
549
|
+
border: '2px solid',
|
|
550
|
+
borderBottom: '3px solid',
|
|
551
|
+
borderColor: MODIFIED_COLOR,
|
|
552
|
+
color: MODIFIED_COLOR
|
|
553
|
+
} : {
|
|
554
|
+
borderColor: undefined,
|
|
555
|
+
color: undefined
|
|
556
|
+
} })), hasFields.informationSign && (_jsxs("div", { style: {
|
|
557
|
+
position: 'relative',
|
|
558
|
+
border: '1px solid #d0d0d0',
|
|
559
|
+
borderRadius: '4px',
|
|
560
|
+
padding: '16px 12px 5px',
|
|
561
|
+
marginTop: '10px'
|
|
562
|
+
}, children: [_jsx("div", { style: {
|
|
563
|
+
position: 'absolute',
|
|
564
|
+
fontSize: '0.9rem',
|
|
565
|
+
top: '-10px',
|
|
566
|
+
left: '10px',
|
|
567
|
+
height: 'max-content',
|
|
568
|
+
lineHeight: 'normal',
|
|
569
|
+
backgroundColor: 'white',
|
|
570
|
+
padding: '0 3px',
|
|
571
|
+
color: 'rgb(80, 80, 80)',
|
|
572
|
+
}, children: SDKUI_Localizator.SignatureInformation }), _jsxs("div", { style: { display: 'flex', alignItems: 'flex-start', gap: '5px', minHeight: '35px' }, children: [_jsx(TMCheckBox, { label: "Abilita Data", value: signTypeSelected === 'FEQ' ? true : enableDate, disabled: signTypeSelected === 'FEQ', isModifiedWhen: signTypeSelected === 'FEQ' ? false : enableDate !== formDataOrigin.allowDate, onValueChanged: () => setEnableDate(prev => !prev) }), signTypeSelected === 'FEQ' && (_jsx(TMTooltip, { content: "La data \u00E8 obbligatoria per la Firma Elettronica Qualificata", children: _jsx("i", { className: "dx-icon-info", style: { fontSize: '18px', color: '#2196F3' } }) }))] }), signTypeSelected !== 'FEQ' && (_jsxs("div", { style: { display: 'flex', flexDirection: isMobile ? 'column' : 'row', alignItems: isMobile ? 'stretch' : 'flex-start', gap: '12px', minHeight: '35px' }, children: [_jsx("div", { style: { minWidth: isMobile ? 'auto' : '130px' }, children: _jsx(TMCheckBox, { label: "Abilita Luogo", value: enableLocation, isModifiedWhen: enableLocation !== formDataOrigin.allowLocation, onValueChanged: () => setEnableLocation(prev => !prev) }) }), enableLocation && (_jsx("div", { style: { flex: 1 }, children: _jsx(TMTextBox, { value: location, onValueChanged: (e) => setLocation(e.target.value), isModifiedWhen: location !== formDataOrigin.locationValue, buttons: [
|
|
573
|
+
{
|
|
574
|
+
icon: _jsx("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'center', width: '22px', height: '22px', borderRadius: '50%', backgroundColor: '#f0f0f0', transition: 'all 0.2s ease' }, onMouseEnter: (e) => { e.currentTarget.style.backgroundColor = '#e0e0e0'; }, onMouseLeave: (e) => { e.currentTarget.style.backgroundColor = '#f0f0f0'; }, children: _jsx(IconUndo, { fontSize: 14 }) }),
|
|
575
|
+
text: SDKUI_Localizator.Undo,
|
|
576
|
+
onClick: () => setLocation(formDataOrigin.locationValue)
|
|
577
|
+
},
|
|
578
|
+
] }) }))] })), _jsxs("div", { style: { display: 'flex', flexDirection: isMobile ? 'column' : 'row', alignItems: isMobile ? 'stretch' : 'flex-start', gap: '12px', minHeight: '35px' }, children: [_jsx("div", { style: { minWidth: isMobile ? 'auto' : '130px' }, children: _jsx(TMCheckBox, { label: "Abilita Copyright", value: enableCopyright, isModifiedWhen: enableCopyright !== formDataOrigin.allowCopyright, onValueChanged: () => setEnableCopyright(prev => !prev) }) }), enableCopyright && (_jsx("div", { style: { flex: 1 }, children: _jsx(TMTextBox, { value: copyright, onValueChanged: (e) => setCopyright(e.target.value), isModifiedWhen: copyright !== formDataOrigin.copyrightValue, buttons: [
|
|
579
|
+
{
|
|
580
|
+
icon: _jsx("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'center', width: '22px', height: '22px', borderRadius: '50%', backgroundColor: '#f0f0f0', transition: 'all 0.2s ease' }, onMouseEnter: (e) => { e.currentTarget.style.backgroundColor = '#e0e0e0'; }, onMouseLeave: (e) => { e.currentTarget.style.backgroundColor = '#f0f0f0'; }, children: _jsx(IconUndo, { fontSize: 14 }) }),
|
|
581
|
+
text: SDKUI_Localizator.Undo,
|
|
582
|
+
onClick: () => setCopyright(formDataOrigin.copyrightValue)
|
|
583
|
+
},
|
|
584
|
+
] }) }))] }), signTypeSelected !== 'FEQ' && (_jsxs("div", { style: { display: 'flex', flexDirection: isMobile ? 'column' : 'row', alignItems: isMobile ? 'stretch' : 'flex-start', gap: '12px', minHeight: '35px' }, children: [_jsx("div", { style: { minWidth: isMobile ? 'auto' : '130px' }, children: _jsx(TMCheckBox, { label: "Abilita 'Firmato da'", value: enableSignerBy, isModifiedWhen: enableSignerBy !== formDataOrigin.allowSignerBy, onValueChanged: () => setEnableSignerBy(prev => !prev) }) }), enableSignerBy && (_jsx("div", { style: { flex: 1 }, children: _jsx(TMTextBox, { value: signerBy, onValueChanged: (e) => setSignerBy(e.target.value), isModifiedWhen: signerBy !== formDataOrigin.signerByValue, buttons: [
|
|
585
|
+
{
|
|
586
|
+
icon: _jsx("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'center', width: '22px', height: '22px', borderRadius: '50%', backgroundColor: '#f0f0f0', transition: 'all 0.2s ease' }, onMouseEnter: (e) => { e.currentTarget.style.backgroundColor = '#e0e0e0'; }, onMouseLeave: (e) => { e.currentTarget.style.backgroundColor = '#f0f0f0'; }, children: _jsx(IconUndo, { fontSize: 14 }) }),
|
|
587
|
+
text: SDKUI_Localizator.Undo,
|
|
588
|
+
onClick: () => setSignerBy(formDataOrigin.signerByValue)
|
|
589
|
+
},
|
|
590
|
+
] }) }))] }))] })), (hasFields.sharedSign && hasFields.multiSigners) && _jsxs("div", { style: {
|
|
591
|
+
position: 'relative',
|
|
592
|
+
border: '1px solid #d0d0d0',
|
|
593
|
+
borderRadius: '4px',
|
|
594
|
+
padding: '16px 12px 5px',
|
|
595
|
+
marginTop: '10px'
|
|
596
|
+
}, children: [_jsx("div", { style: {
|
|
597
|
+
position: 'absolute',
|
|
598
|
+
fontSize: '0.9rem',
|
|
599
|
+
top: '-10px',
|
|
600
|
+
left: '10px',
|
|
601
|
+
height: 'max-content',
|
|
602
|
+
lineHeight: 'normal',
|
|
603
|
+
backgroundColor: 'white',
|
|
604
|
+
padding: '0 3px',
|
|
605
|
+
color: 'rgb(80, 80, 80)',
|
|
606
|
+
}, children: "Configurazione Firmatari Multipli" }), _jsxs("div", { style: { display: 'flex', flexDirection: isMobile ? 'column' : 'row', alignItems: isMobile ? 'stretch' : 'flex-start', gap: '12px', minHeight: '35px' }, children: [_jsx("div", { style: { minWidth: isMobile ? 'auto' : '130px' }, children: _jsx(TMCheckBox, { label: "Abilita Firmatari Multipli", value: enableSharedSign, isModifiedWhen: enableSharedSign !== formDataOrigin.enableSharedSign, onValueChanged: () => setEnableSharedSign(prev => !prev) }) }), enableSharedSign && (_jsx("div", { style: { flex: 1 }, children: _jsx(TagBox, { id: "multiSignersTagBox", name: "multiSigners", inputAttr: { id: 'multiSignersInput', name: 'multiSignersInput' }, dataSource: multiSigners, labelMode: "static", value: multiSigners, onValueChanged: onMultiSignersValueChange, placeholder: "Inserisci firmatari", showSelectionControls: false, searchEnabled: false, stylingMode: "outlined", acceptCustomValue: true, showDropDownButton: false, openOnFieldClick: false, tagRender: renderMultiSignerTag, style: isMultiSignersModified() ? {
|
|
607
|
+
border: '2px solid',
|
|
608
|
+
borderBottom: '3px solid',
|
|
609
|
+
borderColor: MODIFIED_COLOR,
|
|
610
|
+
color: MODIFIED_COLOR
|
|
611
|
+
} : {
|
|
612
|
+
borderColor: undefined,
|
|
613
|
+
color: undefined
|
|
614
|
+
} }) }))] })] }), _jsxs("div", { style: {
|
|
615
|
+
display: 'flex',
|
|
616
|
+
justifyContent: 'center',
|
|
617
|
+
gap: '10px',
|
|
618
|
+
marginTop: '5px'
|
|
619
|
+
}, children: [_jsx(TMSaveFormButtonSave, { showTooltip: false, btnStyle: 'advanced', advancedColor: '#f09c0a', isModified: isModified, formMode: FormModes.Update, errorsCount: 0, onSaveAsync: onSaveSignSettings }), _jsx(TMSaveFormButtonUndo, { btnStyle: 'toolbar', showTooltip: true, color: 'primary', isModified: isModified, formMode: FormModes.Update, onUndo: onResetSettings })] })] })) });
|
|
620
|
+
};
|
|
621
|
+
export default TMSignSettingsForm;
|