@controleonline/ui-customers 1.0.88 → 1.0.89
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 +1 -1
- package/src/react/components/tabs/DocumentAttachments.js +1 -1
- package/src/react/components/tabs/DocumentsTab.js +28 -8
- package/src/react/components/tabs/FranchiseLinksManageModal.js +1 -1
- package/src/react/components/tabs/FranchiseLinksTab.js +1 -1
- package/src/react/components/tabs/MediaTab.js +2 -75
- package/src/react/components/tabs/ProductsTab.js +1 -1
- package/src/react/components/tabs/SalesmanManageModal.js +1 -1
- package/src/react/components/tabs/SalesmanTab.js +1 -1
- package/src/react/pages/details.page.styles.js +15 -1
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import Icon from 'react-native-vector-icons/MaterialIcons';
|
|
15
15
|
import { useMessage } from '@controleonline/ui-common/src/react/components/MessageService';
|
|
16
16
|
import { resolveFileDownloadUrl } from '@controleonline/ui-common/src/react/utils/fileUrl';
|
|
17
|
-
import { colors } from '@controleonline
|
|
17
|
+
import { colors } from '@controleonline/../../src/styles/colors';
|
|
18
18
|
import DefaultUpload from '@controleonline/ui-default/src/react/components/upload/DefaultUpload';
|
|
19
19
|
import {
|
|
20
20
|
extractId,
|
|
@@ -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 && (
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { Picker } from '@react-native-picker/picker';
|
|
11
11
|
import Icon from 'react-native-vector-icons/MaterialIcons';
|
|
12
12
|
import AnimatedModal from '@controleonline/ui-common/src/react/components/AnimatedModal';
|
|
13
|
-
import { colors } from '@controleonline
|
|
13
|
+
import { colors } from '@controleonline/../../src/styles/colors';
|
|
14
14
|
|
|
15
15
|
const styles = {
|
|
16
16
|
modalCard: {
|
|
@@ -13,7 +13,7 @@ import { useStore } from '@store';
|
|
|
13
13
|
import PeopleAvatar from '@controleonline/ui-people/src/react/components/PeopleAvatar';
|
|
14
14
|
import { useMessage } from '@controleonline/ui-common/src/react/components/MessageService';
|
|
15
15
|
import Icon from 'react-native-vector-icons/MaterialIcons';
|
|
16
|
-
import { colors } from '@controleonline
|
|
16
|
+
import { colors } from '@controleonline/../../src/styles/colors';
|
|
17
17
|
|
|
18
18
|
import {
|
|
19
19
|
buildFranchiseLinkReadParams,
|
|
@@ -7,11 +7,10 @@ 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
|
-
import { resolveThemePalette, withOpacity } from '@controleonline
|
|
14
|
-
import { colors } from '@controleonline
|
|
12
|
+
import { resolveThemePalette, withOpacity } from '@controleonline/../../src/styles/branding';
|
|
13
|
+
import { colors } from '@controleonline/../../src/styles/colors';
|
|
15
14
|
|
|
16
15
|
const COMPANY_MEDIA_ACCEPT_ATTRIBUTE = 'image/png,image/jpeg,.png,.jpg,.jpeg';
|
|
17
16
|
|
|
@@ -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,
|
|
@@ -2,7 +2,7 @@ import React, { useMemo, useCallback } from 'react';
|
|
|
2
2
|
import { Text, TouchableOpacity, View } from 'react-native';
|
|
3
3
|
import { useNavigation } from '@react-navigation/native';
|
|
4
4
|
import Icon from 'react-native-vector-icons/MaterialIcons';
|
|
5
|
-
import { colors } from '@controleonline
|
|
5
|
+
import { colors } from '@controleonline/../../src/styles/colors';
|
|
6
6
|
import styles from './ProductsTab.styles';
|
|
7
7
|
import {
|
|
8
8
|
buildCreateProductParams,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { Picker } from '@react-native-picker/picker';
|
|
11
11
|
import Icon from 'react-native-vector-icons/MaterialIcons';
|
|
12
12
|
import AnimatedModal from '@controleonline/ui-common/src/react/components/AnimatedModal';
|
|
13
|
-
import { colors } from '@controleonline
|
|
13
|
+
import { colors } from '@controleonline/../../src/styles/colors';
|
|
14
14
|
|
|
15
15
|
const styles = {
|
|
16
16
|
modalCard: {
|
|
@@ -31,7 +31,7 @@ import { normalizeSalesmanLink } from './salesmanTab.helpers';
|
|
|
31
31
|
import SalesmanManageModal from './SalesmanManageModal';
|
|
32
32
|
import { useSalesmanManage } from './useSalesmanManage';
|
|
33
33
|
import Icon from 'react-native-vector-icons/MaterialIcons';
|
|
34
|
-
import { colors } from '@controleonline
|
|
34
|
+
import { colors } from '@controleonline/../../src/styles/colors';
|
|
35
35
|
import SalesmanCommissionBlock from './SalesmanCommissionBlock';
|
|
36
36
|
|
|
37
37
|
import {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
|
-
import { colors } from '@controleonline
|
|
2
|
+
import { colors } from '@controleonline/../../src/styles/colors';
|
|
3
3
|
|
|
4
4
|
const styles = StyleSheet.create({
|
|
5
5
|
container: {
|
|
@@ -28,6 +28,20 @@ const styles = StyleSheet.create({
|
|
|
28
28
|
color: '#64748B',
|
|
29
29
|
fontWeight: '500',
|
|
30
30
|
},
|
|
31
|
+
removeButton: {
|
|
32
|
+
marginTop: 12,
|
|
33
|
+
paddingHorizontal: 16,
|
|
34
|
+
paddingVertical: 8,
|
|
35
|
+
borderRadius: 8,
|
|
36
|
+
borderWidth: 1,
|
|
37
|
+
borderColor: '#FECACA',
|
|
38
|
+
backgroundColor: '#FEF2F2',
|
|
39
|
+
},
|
|
40
|
+
removeButtonText: {
|
|
41
|
+
fontSize: 14,
|
|
42
|
+
fontWeight: '600',
|
|
43
|
+
color: '#B91C1C',
|
|
44
|
+
},
|
|
31
45
|
tabsHeader: {
|
|
32
46
|
flexDirection: 'row',
|
|
33
47
|
backgroundColor: '#fff',
|