@controleonline/ui-customers 1.0.85 → 1.0.87
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/package.json
CHANGED
|
@@ -63,11 +63,24 @@ const DocumentsTab = ({ client, customStyles, isEditing, onUpdateClient }) => {
|
|
|
63
63
|
const getters = documentsTypesStore.getters || {};
|
|
64
64
|
const { items = [] } = getters;
|
|
65
65
|
|
|
66
|
-
const resolveTypeLabel = typeIri =>
|
|
67
|
-
|
|
66
|
+
const resolveTypeLabel = (typeIri, rawDocument) => {
|
|
67
|
+
const rawType = rawDocument?.documentType;
|
|
68
|
+
const embeddedLabel =
|
|
69
|
+
rawType && typeof rawType === 'object' ? rawType.documentType : '';
|
|
70
|
+
if (embeddedLabel) {
|
|
71
|
+
return String(embeddedLabel);
|
|
72
|
+
}
|
|
73
|
+
const storeLabel = items.find(item => item['@id'] === typeIri)?.documentType;
|
|
74
|
+
if (storeLabel) {
|
|
75
|
+
return String(storeLabel);
|
|
76
|
+
}
|
|
77
|
+
return /^\/?document_types\/\d+$/.test(String(typeIri || ''))
|
|
78
|
+
? ''
|
|
79
|
+
: String(typeIri || '');
|
|
80
|
+
};
|
|
68
81
|
|
|
69
|
-
const applyMask = (value, type) =>
|
|
70
|
-
applyDocumentMask(value, resolveTypeLabel(type));
|
|
82
|
+
const applyMask = (value, type, rawDocument) =>
|
|
83
|
+
applyDocumentMask(value, resolveTypeLabel(type, rawDocument));
|
|
71
84
|
|
|
72
85
|
const syncClientDocuments = nextDocuments => {
|
|
73
86
|
if (typeof onUpdateClient !== 'function') {
|
|
@@ -77,7 +90,10 @@ const DocumentsTab = ({ client, customStyles, isEditing, onUpdateClient }) => {
|
|
|
77
90
|
'@id': `/documents/${documentItem.id}`,
|
|
78
91
|
id: documentItem.id,
|
|
79
92
|
document: documentItem.value,
|
|
80
|
-
documentType:
|
|
93
|
+
documentType:
|
|
94
|
+
documentItem.raw?.documentType?.['@id'] === documentItem.type
|
|
95
|
+
? documentItem.raw.documentType
|
|
96
|
+
: documentItem.type,
|
|
81
97
|
documentFiles: documentItem.files || [],
|
|
82
98
|
file: documentItem.files?.[0]?.file || null,
|
|
83
99
|
}));
|
|
@@ -122,7 +138,7 @@ const DocumentsTab = ({ client, customStyles, isEditing, onUpdateClient }) => {
|
|
|
122
138
|
setEditingItem(item);
|
|
123
139
|
setFormData(
|
|
124
140
|
item
|
|
125
|
-
? { type: item.type, value: applyMask(String(item.value || ''), item.type) }
|
|
141
|
+
? { type: item.type, value: applyMask(String(item.value || ''), item.type, item.raw) }
|
|
126
142
|
: { type: '', value: '' },
|
|
127
143
|
);
|
|
128
144
|
setShowModal(true);
|
|
@@ -320,9 +336,13 @@ const DocumentsTab = ({ client, customStyles, isEditing, onUpdateClient }) => {
|
|
|
320
336
|
<Icon name="description" size={20} color={customStyles.cardItemIcon.color} />
|
|
321
337
|
<View>
|
|
322
338
|
<Text style={customStyles.itemText}>
|
|
323
|
-
{
|
|
339
|
+
{[
|
|
340
|
+
resolveTypeLabel(doc.type, doc.raw),
|
|
341
|
+
applyMask(String(doc.value || ''), doc.type, doc.raw),
|
|
342
|
+
]
|
|
343
|
+
.filter(Boolean)
|
|
344
|
+
.join(': ')}
|
|
324
345
|
</Text>
|
|
325
|
-
<Text style={customStyles.itemSubtext}>{resolveTypeLabel(doc.type)}</Text>
|
|
326
346
|
</View>
|
|
327
347
|
</View>
|
|
328
348
|
{isEditing && (
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
} from 'react-native';
|
|
8
8
|
import { useStore } from '@store';
|
|
9
9
|
import DefaultUpload from '@controleonline/ui-default/src/react/components/upload/DefaultUpload';
|
|
10
|
-
import DefaultFile from '@controleonline/ui-default/src/react/components/files/DefaultFile';
|
|
11
10
|
import { extractFileId } from '@controleonline/ui-default/src/react/components/upload/fileUpload';
|
|
12
11
|
import { useMessage } from '@controleonline/ui-common/src/react/components/MessageService';
|
|
13
12
|
import { resolveThemePalette, withOpacity } from '@controleonline/../../src/styles/branding';
|
|
@@ -215,46 +214,6 @@ const MediaTab = ({ client, onChanged = null }) => {
|
|
|
215
214
|
},
|
|
216
215
|
]}
|
|
217
216
|
>
|
|
218
|
-
<View
|
|
219
|
-
style={[
|
|
220
|
-
styles.mediaPreviewFrame,
|
|
221
|
-
styles.mediaPreviewTransparencyGrid,
|
|
222
|
-
{
|
|
223
|
-
borderColor: withOpacity(palette.primary || '#2563EB', 0.14),
|
|
224
|
-
},
|
|
225
|
-
]}>
|
|
226
|
-
{(() => {
|
|
227
|
-
const rawFile = currentMedia?.file;
|
|
228
|
-
const fileId = extractFileId(rawFile);
|
|
229
|
-
const file =
|
|
230
|
-
rawFile && typeof rawFile === 'object' && !Array.isArray(rawFile)
|
|
231
|
-
? rawFile
|
|
232
|
-
: fileId
|
|
233
|
-
? {id: fileId, '@id': `/files/${fileId}`}
|
|
234
|
-
: null;
|
|
235
|
-
if (!file) {
|
|
236
|
-
return (
|
|
237
|
-
<View style={styles.mediaEmptyState}>
|
|
238
|
-
<Text
|
|
239
|
-
style={[
|
|
240
|
-
styles.mediaEmptyText,
|
|
241
|
-
{color: palette.textSecondary || '#64748B'},
|
|
242
|
-
]}>
|
|
243
|
-
Sem imagem
|
|
244
|
-
</Text>
|
|
245
|
-
</View>
|
|
246
|
-
);
|
|
247
|
-
}
|
|
248
|
-
return (
|
|
249
|
-
<DefaultFile
|
|
250
|
-
file={file}
|
|
251
|
-
company={client}
|
|
252
|
-
resizeMode="cover"
|
|
253
|
-
style={styles.mediaPreviewImage}
|
|
254
|
-
/>
|
|
255
|
-
);
|
|
256
|
-
})()}
|
|
257
|
-
</View>
|
|
258
217
|
<DefaultUpload
|
|
259
218
|
relationStoreName="people"
|
|
260
219
|
relationField="people"
|
|
@@ -360,38 +319,6 @@ const styles = StyleSheet.create({
|
|
|
360
319
|
fontSize: 12,
|
|
361
320
|
fontWeight: '700',
|
|
362
321
|
},
|
|
363
|
-
// app-community#813: preview 320x320
|
|
364
|
-
mediaPreviewFrame: {
|
|
365
|
-
width: 320,
|
|
366
|
-
height: 320,
|
|
367
|
-
maxWidth: 320,
|
|
368
|
-
alignSelf: 'center',
|
|
369
|
-
borderRadius: 14,
|
|
370
|
-
borderWidth: 1,
|
|
371
|
-
overflow: 'hidden',
|
|
372
|
-
alignItems: 'center',
|
|
373
|
-
justifyContent: 'center',
|
|
374
|
-
},
|
|
375
|
-
mediaPreviewTransparencyGrid: {
|
|
376
|
-
// RN StyleSheet (web) rejects multi-value backgroundPosition / CSS backgroundImage gradients.
|
|
377
|
-
// Keep solid preview background; checkerboard was cosmetic only.
|
|
378
|
-
backgroundColor: '#F8FAFC',
|
|
379
|
-
},
|
|
380
|
-
mediaPreviewImage: {
|
|
381
|
-
width: 320,
|
|
382
|
-
height: 320,
|
|
383
|
-
},
|
|
384
|
-
mediaEmptyState: {
|
|
385
|
-
width: 320,
|
|
386
|
-
height: 320,
|
|
387
|
-
alignItems: 'center',
|
|
388
|
-
justifyContent: 'center',
|
|
389
|
-
gap: 8,
|
|
390
|
-
},
|
|
391
|
-
mediaEmptyText: {
|
|
392
|
-
fontSize: 13,
|
|
393
|
-
fontWeight: '500',
|
|
394
|
-
},
|
|
395
322
|
mediaHelpText: {
|
|
396
323
|
fontSize: 12,
|
|
397
324
|
lineHeight: 18,
|