@controleonline/ui-common 1.2.133 → 1.2.135
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/.release/rc-manifest.json +12 -6
- package/package.json +1 -1
- package/src/react/components/CategoryForm.js +539 -539
- package/src/react/components/DefaultProvider.native.js +2 -2
- package/src/react/components/DefaultProvider.web.js +2 -2
- package/src/react/components/integrations/IntegrationHero/index.js +1 -1
- package/src/react/components/integrations/IntegrationHero/styles.js +2 -2
- package/src/react/components/integrations/IntegrationTabs/index.js +1 -1
- package/src/react/components/integrations/IntegrationTabs/styles.js +1 -1
- package/src/react/pages/Connections.styles.js +72 -72
- package/src/react/pages/Devices/detail/DeviceDetailHeader.js +1 -1
- package/src/react/pages/Devices/detail/DeviceDetailMovementSections.js +1 -1
- package/src/react/pages/Devices/detail/useDeviceDetailStateA.js +2 -2
- package/src/react/pages/Devices/detail/useDeviceDetailStateB.js +2 -2
- package/src/react/pages/Devices/deviceTypes/DeviceGroupCard.js +1 -1
- package/src/react/pages/Devices/deviceTypes/shared.js +2 -2
- package/src/react/pages/Devices.js +2 -2
- package/src/react/pages/Devices.styles.js +353 -353
- package/src/react/pages/Food99IntegrationPage/components/Food99CatalogTab.js +219 -219
- package/src/react/pages/Food99IntegrationPage/components/Food99OverviewTab.js +134 -134
- package/src/react/pages/Food99IntegrationPage/components/Food99PreviewModal.js +173 -173
- package/src/react/pages/Food99IntegrationPage/components/Food99QuickWalletModal.js +1 -1
- package/src/react/pages/Food99IntegrationPage/components/Food99SettingsTab.js +306 -306
- package/src/react/pages/Food99IntegrationPage/components/Food99StoreTab.js +417 -417
- package/src/react/pages/Food99IntegrationPage/index.js +1530 -1530
- package/src/react/pages/Food99IntegrationPage/styles.js +792 -792
- package/src/react/pages/IFoodIntegrationPage/components/IFoodOperationsTab.js +267 -267
- package/src/react/pages/IFoodIntegrationPage/components/IFoodOverviewTab.js +118 -118
- package/src/react/pages/IFoodIntegrationPage/components/IFoodPreviewModal.js +101 -101
- package/src/react/pages/IFoodIntegrationPage/components/IFoodStoreTab.js +150 -150
- package/src/react/pages/IFoodIntegrationPage/index.js +1298 -1298
- package/src/react/pages/Imports.js +1 -1
- package/src/react/pages/Imports.styles.js +223 -223
- package/src/react/pages/IntegrationConfigPage.js +2 -2
- package/src/react/pages/Integrations.js +2 -15
- package/src/react/pages/Integrations.styles.js +130 -130
- package/src/react/pages/LinkedInIntegrationPage.js +2 -2
- package/src/react/pages/ManagerOrderNotificationsPage.js +642 -642
- package/src/react/pages/MarketplaceIntegrationPage/components/MarketplaceProductCard.js +205 -205
- package/src/react/pages/MercadoLivreIntegrationPage.js +2 -2
- package/src/react/pages/PrinterDeviceDetailPage.js +1915 -1915
- package/src/react/pages/PrinterDeviceFormPage.js +2 -2
- package/src/react/pages/WhatsAppConnectionPage.js +51 -0
- package/src/react/pages/WhatsAppConnectionPage.styles.js +315 -279
- package/src/react/pages/WhatsAppProviderForm.js +39 -1
- package/src/react/pages/whatsAppConnectionHelpers.js +38 -10
- package/src/react/pages/whatsAppEmbeddedSignup.js +133 -0
- package/src/react/router/__tests__/publicRoutes.test.js +12 -0
- package/src/react/router/publicRoutes.js +3 -0
- package/src/react/utils/fileUrl.js +1 -1
- package/src/store/connections/customActions.js +51 -14
- package/src/store/connections/index.js +109 -105
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Text, View } from 'react-native';
|
|
3
|
-
|
|
4
|
-
import { withOpacity } from '@controleonline
|
|
5
|
-
|
|
6
|
-
import styles from '../styles';
|
|
7
|
-
|
|
8
|
-
// Aba de resumo da integração iFood.
|
|
9
|
-
export default function IFoodOverviewTab({
|
|
10
|
-
shadowStyle,
|
|
11
|
-
integration,
|
|
12
|
-
connected,
|
|
13
|
-
remoteConnected,
|
|
14
|
-
authAvailable,
|
|
15
|
-
statusTone,
|
|
16
|
-
statusText,
|
|
17
|
-
eligibleCount,
|
|
18
|
-
selectedStoreDetail,
|
|
19
|
-
}) {
|
|
20
|
-
return (
|
|
21
|
-
<View style={[styles.sectionCard, shadowStyle]}>
|
|
22
|
-
<View style={styles.statusRow}>
|
|
23
|
-
<Text style={styles.sectionTitle}>Status da integracao</Text>
|
|
24
|
-
<View style={[styles.statusBadge, { backgroundColor: withOpacity(statusTone, 0.12) }]}>
|
|
25
|
-
<Text style={[styles.statusBadgeText, { color: statusTone }]}>{statusText}</Text>
|
|
26
|
-
</View>
|
|
27
|
-
</View>
|
|
28
|
-
|
|
29
|
-
<View style={styles.metaGrid}>
|
|
30
|
-
<View style={styles.metaBox}>
|
|
31
|
-
<Text style={styles.metaLabel}>Loja vinculada</Text>
|
|
32
|
-
<Text style={styles.metaValue}>{integration?.merchant_name || integration?.merchant_id || 'Nao vinculada'}</Text>
|
|
33
|
-
</View>
|
|
34
|
-
<View style={styles.metaBox}>
|
|
35
|
-
<Text style={styles.metaLabel}>Status remoto</Text>
|
|
36
|
-
<Text style={styles.metaValue}>{integration?.merchant_status_label || 'Indefinido'}</Text>
|
|
37
|
-
</View>
|
|
38
|
-
</View>
|
|
39
|
-
|
|
40
|
-
<View style={styles.metaGrid}>
|
|
41
|
-
<View style={styles.metaBox}>
|
|
42
|
-
<Text style={styles.metaLabel}>Token OAuth</Text>
|
|
43
|
-
<Text style={styles.metaValue}>{authAvailable ? 'Disponível' : 'Indisponível'}</Text>
|
|
44
|
-
</View>
|
|
45
|
-
<View style={styles.metaBox}>
|
|
46
|
-
<Text style={styles.metaLabel}>Produtos aptos</Text>
|
|
47
|
-
<Text style={styles.metaValue}>{eligibleCount}</Text>
|
|
48
|
-
</View>
|
|
49
|
-
</View>
|
|
50
|
-
|
|
51
|
-
<View style={styles.helperRow}>
|
|
52
|
-
<Text style={styles.helperText}>
|
|
53
|
-
{remoteConnected
|
|
54
|
-
? 'A vinculação local está confirmada na conta iFood.'
|
|
55
|
-
: connected
|
|
56
|
-
? 'Loja vinculada localmente. Execute sincronização para validar no iFood.'
|
|
57
|
-
: 'Selecione uma loja ou informe o código iFood para conectar.'}
|
|
58
|
-
</Text>
|
|
59
|
-
</View>
|
|
60
|
-
|
|
61
|
-
{!!integration?.last_error_message && (
|
|
62
|
-
<View style={styles.errorBox}>
|
|
63
|
-
<Text style={styles.errorTitle}>Último erro</Text>
|
|
64
|
-
<Text style={styles.errorText}>{integration.last_error_message}</Text>
|
|
65
|
-
</View>
|
|
66
|
-
)}
|
|
67
|
-
|
|
68
|
-
{!!selectedStoreDetail && (
|
|
69
|
-
<View style={styles.selectedStoreBox}>
|
|
70
|
-
<Text style={styles.selectedStoreTitle}>Detalhes da loja</Text>
|
|
71
|
-
|
|
72
|
-
<View style={styles.metaGrid}>
|
|
73
|
-
<View style={styles.metaBox}>
|
|
74
|
-
<Text style={styles.metaLabel}>Nome fantasia</Text>
|
|
75
|
-
<Text style={styles.metaValue}>{selectedStoreDetail?.name || '--'}</Text>
|
|
76
|
-
</View>
|
|
77
|
-
<View style={styles.metaBox}>
|
|
78
|
-
<Text style={styles.metaLabel}>Status</Text>
|
|
79
|
-
<Text style={styles.metaValue}>{selectedStoreDetail?.status_label || '--'}</Text>
|
|
80
|
-
</View>
|
|
81
|
-
</View>
|
|
82
|
-
|
|
83
|
-
<View style={styles.metaGrid}>
|
|
84
|
-
<View style={styles.metaBox}>
|
|
85
|
-
<Text style={styles.metaLabel}>Razão social</Text>
|
|
86
|
-
<Text style={styles.metaValue}>{selectedStoreDetail?.corporate_name || '--'}</Text>
|
|
87
|
-
</View>
|
|
88
|
-
<View style={styles.metaBox}>
|
|
89
|
-
<Text style={styles.metaLabel}>Tipo</Text>
|
|
90
|
-
<Text style={styles.metaValue}>{selectedStoreDetail?.type || '--'}</Text>
|
|
91
|
-
</View>
|
|
92
|
-
</View>
|
|
93
|
-
|
|
94
|
-
<View style={styles.metaBox}>
|
|
95
|
-
<Text style={styles.metaLabel}>Endereço</Text>
|
|
96
|
-
<Text style={styles.metaValue}>
|
|
97
|
-
{selectedStoreDetail?.address?.formatted || 'Endereço não informado'}
|
|
98
|
-
</Text>
|
|
99
|
-
</View>
|
|
100
|
-
|
|
101
|
-
{Array.isArray(selectedStoreDetail?.operations) && selectedStoreDetail.operations.length > 0 && (
|
|
102
|
-
<View style={styles.storeOperationsBox}>
|
|
103
|
-
<Text style={styles.metaLabel}>Operações configuradas</Text>
|
|
104
|
-
{selectedStoreDetail.operations.map((operation, index) => (
|
|
105
|
-
<Text key={`${operation?.name || 'operation'}-${index}`} style={styles.operationText}>
|
|
106
|
-
{operation?.name || 'Operação'}
|
|
107
|
-
{Array.isArray(operation?.sales_channels) && operation.sales_channels.length > 0
|
|
108
|
-
? ` - ${operation.sales_channels.join(', ')}`
|
|
109
|
-
: ''}
|
|
110
|
-
</Text>
|
|
111
|
-
))}
|
|
112
|
-
</View>
|
|
113
|
-
)}
|
|
114
|
-
</View>
|
|
115
|
-
)}
|
|
116
|
-
</View>
|
|
117
|
-
);
|
|
118
|
-
}
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { withOpacity } from '@controleonline/ui-layout/src/styles/branding';
|
|
5
|
+
|
|
6
|
+
import styles from '../styles';
|
|
7
|
+
|
|
8
|
+
// Aba de resumo da integração iFood.
|
|
9
|
+
export default function IFoodOverviewTab({
|
|
10
|
+
shadowStyle,
|
|
11
|
+
integration,
|
|
12
|
+
connected,
|
|
13
|
+
remoteConnected,
|
|
14
|
+
authAvailable,
|
|
15
|
+
statusTone,
|
|
16
|
+
statusText,
|
|
17
|
+
eligibleCount,
|
|
18
|
+
selectedStoreDetail,
|
|
19
|
+
}) {
|
|
20
|
+
return (
|
|
21
|
+
<View style={[styles.sectionCard, shadowStyle]}>
|
|
22
|
+
<View style={styles.statusRow}>
|
|
23
|
+
<Text style={styles.sectionTitle}>Status da integracao</Text>
|
|
24
|
+
<View style={[styles.statusBadge, { backgroundColor: withOpacity(statusTone, 0.12) }]}>
|
|
25
|
+
<Text style={[styles.statusBadgeText, { color: statusTone }]}>{statusText}</Text>
|
|
26
|
+
</View>
|
|
27
|
+
</View>
|
|
28
|
+
|
|
29
|
+
<View style={styles.metaGrid}>
|
|
30
|
+
<View style={styles.metaBox}>
|
|
31
|
+
<Text style={styles.metaLabel}>Loja vinculada</Text>
|
|
32
|
+
<Text style={styles.metaValue}>{integration?.merchant_name || integration?.merchant_id || 'Nao vinculada'}</Text>
|
|
33
|
+
</View>
|
|
34
|
+
<View style={styles.metaBox}>
|
|
35
|
+
<Text style={styles.metaLabel}>Status remoto</Text>
|
|
36
|
+
<Text style={styles.metaValue}>{integration?.merchant_status_label || 'Indefinido'}</Text>
|
|
37
|
+
</View>
|
|
38
|
+
</View>
|
|
39
|
+
|
|
40
|
+
<View style={styles.metaGrid}>
|
|
41
|
+
<View style={styles.metaBox}>
|
|
42
|
+
<Text style={styles.metaLabel}>Token OAuth</Text>
|
|
43
|
+
<Text style={styles.metaValue}>{authAvailable ? 'Disponível' : 'Indisponível'}</Text>
|
|
44
|
+
</View>
|
|
45
|
+
<View style={styles.metaBox}>
|
|
46
|
+
<Text style={styles.metaLabel}>Produtos aptos</Text>
|
|
47
|
+
<Text style={styles.metaValue}>{eligibleCount}</Text>
|
|
48
|
+
</View>
|
|
49
|
+
</View>
|
|
50
|
+
|
|
51
|
+
<View style={styles.helperRow}>
|
|
52
|
+
<Text style={styles.helperText}>
|
|
53
|
+
{remoteConnected
|
|
54
|
+
? 'A vinculação local está confirmada na conta iFood.'
|
|
55
|
+
: connected
|
|
56
|
+
? 'Loja vinculada localmente. Execute sincronização para validar no iFood.'
|
|
57
|
+
: 'Selecione uma loja ou informe o código iFood para conectar.'}
|
|
58
|
+
</Text>
|
|
59
|
+
</View>
|
|
60
|
+
|
|
61
|
+
{!!integration?.last_error_message && (
|
|
62
|
+
<View style={styles.errorBox}>
|
|
63
|
+
<Text style={styles.errorTitle}>Último erro</Text>
|
|
64
|
+
<Text style={styles.errorText}>{integration.last_error_message}</Text>
|
|
65
|
+
</View>
|
|
66
|
+
)}
|
|
67
|
+
|
|
68
|
+
{!!selectedStoreDetail && (
|
|
69
|
+
<View style={styles.selectedStoreBox}>
|
|
70
|
+
<Text style={styles.selectedStoreTitle}>Detalhes da loja</Text>
|
|
71
|
+
|
|
72
|
+
<View style={styles.metaGrid}>
|
|
73
|
+
<View style={styles.metaBox}>
|
|
74
|
+
<Text style={styles.metaLabel}>Nome fantasia</Text>
|
|
75
|
+
<Text style={styles.metaValue}>{selectedStoreDetail?.name || '--'}</Text>
|
|
76
|
+
</View>
|
|
77
|
+
<View style={styles.metaBox}>
|
|
78
|
+
<Text style={styles.metaLabel}>Status</Text>
|
|
79
|
+
<Text style={styles.metaValue}>{selectedStoreDetail?.status_label || '--'}</Text>
|
|
80
|
+
</View>
|
|
81
|
+
</View>
|
|
82
|
+
|
|
83
|
+
<View style={styles.metaGrid}>
|
|
84
|
+
<View style={styles.metaBox}>
|
|
85
|
+
<Text style={styles.metaLabel}>Razão social</Text>
|
|
86
|
+
<Text style={styles.metaValue}>{selectedStoreDetail?.corporate_name || '--'}</Text>
|
|
87
|
+
</View>
|
|
88
|
+
<View style={styles.metaBox}>
|
|
89
|
+
<Text style={styles.metaLabel}>Tipo</Text>
|
|
90
|
+
<Text style={styles.metaValue}>{selectedStoreDetail?.type || '--'}</Text>
|
|
91
|
+
</View>
|
|
92
|
+
</View>
|
|
93
|
+
|
|
94
|
+
<View style={styles.metaBox}>
|
|
95
|
+
<Text style={styles.metaLabel}>Endereço</Text>
|
|
96
|
+
<Text style={styles.metaValue}>
|
|
97
|
+
{selectedStoreDetail?.address?.formatted || 'Endereço não informado'}
|
|
98
|
+
</Text>
|
|
99
|
+
</View>
|
|
100
|
+
|
|
101
|
+
{Array.isArray(selectedStoreDetail?.operations) && selectedStoreDetail.operations.length > 0 && (
|
|
102
|
+
<View style={styles.storeOperationsBox}>
|
|
103
|
+
<Text style={styles.metaLabel}>Operações configuradas</Text>
|
|
104
|
+
{selectedStoreDetail.operations.map((operation, index) => (
|
|
105
|
+
<Text key={`${operation?.name || 'operation'}-${index}`} style={styles.operationText}>
|
|
106
|
+
{operation?.name || 'Operação'}
|
|
107
|
+
{Array.isArray(operation?.sales_channels) && operation.sales_channels.length > 0
|
|
108
|
+
? ` - ${operation.sales_channels.join(', ')}`
|
|
109
|
+
: ''}
|
|
110
|
+
</Text>
|
|
111
|
+
))}
|
|
112
|
+
</View>
|
|
113
|
+
)}
|
|
114
|
+
</View>
|
|
115
|
+
)}
|
|
116
|
+
</View>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
@@ -1,103 +1,103 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ActivityIndicator, ScrollView, Text, TouchableOpacity, View } from 'react-native';
|
|
3
|
-
import Icon from 'react-native-vector-icons/Feather';
|
|
4
|
-
import { colors } from '@controleonline
|
|
5
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ActivityIndicator, ScrollView, Text, TouchableOpacity, View } from 'react-native';
|
|
3
|
+
import Icon from 'react-native-vector-icons/Feather';
|
|
4
|
+
import { colors } from '@controleonline/ui-layout/src/styles/colors';
|
|
5
|
+
|
|
6
6
|
import AnimatedModal from '@controleonline/ui-common/src/react/components/AnimatedModal';
|
|
7
|
-
|
|
8
|
-
import styles from '../styles';
|
|
7
|
+
|
|
8
|
+
import styles from '../styles';
|
|
9
9
|
import { countCollection } from '@controleonline/ui-common/src/react/utils/integrationPage';
|
|
10
|
-
|
|
11
|
-
// Modal de pré-visualização do menu antes do envio ao iFood.
|
|
12
|
-
export default function IFoodPreviewModal({
|
|
13
|
-
visible,
|
|
14
|
-
previewData,
|
|
15
|
-
selectedEligible,
|
|
16
|
-
accentColor,
|
|
17
|
-
uploading,
|
|
18
|
-
palette = colors,
|
|
19
|
-
onClose,
|
|
20
|
-
onUpload,
|
|
21
|
-
}) {
|
|
22
|
-
return (
|
|
23
|
-
<AnimatedModal visible={visible} onRequestClose={onClose}>
|
|
24
|
-
<View style={styles.modalShell}>
|
|
25
|
-
<View style={styles.modalCard}>
|
|
26
|
-
<View style={styles.modalHeader}>
|
|
27
|
-
<View>
|
|
28
|
-
<Text style={styles.modalTitle}>Pre-visualizacao do menu</Text>
|
|
29
|
-
<Text style={styles.modalSubtitle}>
|
|
30
|
-
{previewData?.eligible_product_count || selectedEligible.length} produtos prontos para upload
|
|
31
|
-
</Text>
|
|
32
|
-
</View>
|
|
33
|
-
|
|
34
|
-
<TouchableOpacity onPress={onClose} style={styles.modalCloseButton}>
|
|
35
|
-
<Icon name="x" size={18} color={palette.textSecondary} />
|
|
36
|
-
</TouchableOpacity>
|
|
37
|
-
</View>
|
|
38
|
-
|
|
39
|
-
<ScrollView showsVerticalScrollIndicator={false} contentContainerStyle={styles.modalContent}>
|
|
40
|
-
<View style={styles.modalSummaryGrid}>
|
|
41
|
-
<View style={styles.modalSummaryCard}>
|
|
42
|
-
<Text style={styles.modalSummaryValue}>{countCollection(previewData?.payload?.menus)}</Text>
|
|
43
|
-
<Text style={styles.modalSummaryLabel}>Menus</Text>
|
|
44
|
-
</View>
|
|
45
|
-
<View style={styles.modalSummaryCard}>
|
|
46
|
-
<Text style={styles.modalSummaryValue}>{countCollection(previewData?.payload?.categories)}</Text>
|
|
47
|
-
<Text style={styles.modalSummaryLabel}>Categorias</Text>
|
|
48
|
-
</View>
|
|
49
|
-
<View style={styles.modalSummaryCard}>
|
|
50
|
-
<Text style={styles.modalSummaryValue}>{countCollection(previewData?.payload?.items)}</Text>
|
|
51
|
-
<Text style={styles.modalSummaryLabel}>Itens</Text>
|
|
52
|
-
</View>
|
|
53
|
-
</View>
|
|
54
|
-
|
|
55
|
-
<View style={styles.previewSection}>
|
|
56
|
-
<Text style={styles.previewSectionTitle}>Categorias</Text>
|
|
57
|
-
{(previewData?.payload?.categories || []).map(category => (
|
|
58
|
-
<View key={category.app_category_id} style={styles.previewLine}>
|
|
59
|
-
<Text style={styles.previewLineTitle}>{category.category_name}</Text>
|
|
60
|
-
<Text style={styles.previewLineMeta}>
|
|
61
|
-
{countCollection(category.app_item_ids)} item(ns)
|
|
62
|
-
</Text>
|
|
63
|
-
</View>
|
|
64
|
-
))}
|
|
65
|
-
</View>
|
|
66
|
-
|
|
67
|
-
<View style={styles.previewSection}>
|
|
68
|
-
<Text style={styles.previewSectionTitle}>Itens selecionados</Text>
|
|
69
|
-
{selectedEligible.map(product => (
|
|
70
|
-
<View key={product.id} style={styles.previewLine}>
|
|
71
|
-
<Text style={styles.previewLineTitle}>{product.name}</Text>
|
|
72
|
-
<Text style={styles.previewLineMeta}>
|
|
73
|
-
{product.category?.name || 'Sem categoria'} • R$ {Number(product.price || 0).toFixed(2)}
|
|
74
|
-
</Text>
|
|
75
|
-
</View>
|
|
76
|
-
))}
|
|
77
|
-
</View>
|
|
78
|
-
</ScrollView>
|
|
79
|
-
|
|
80
|
-
<View style={styles.modalActions}>
|
|
81
|
-
<TouchableOpacity style={styles.secondaryButton} onPress={onClose}>
|
|
82
|
-
<Text style={styles.secondaryButtonText}>Fechar</Text>
|
|
83
|
-
</TouchableOpacity>
|
|
84
|
-
|
|
85
|
-
<TouchableOpacity
|
|
86
|
-
style={[styles.primaryButton, styles.modalPrimaryButton, { backgroundColor: accentColor }]}
|
|
87
|
-
onPress={onUpload}
|
|
88
|
-
disabled={uploading}>
|
|
89
|
-
{uploading ? (
|
|
90
|
-
<ActivityIndicator size="small" color={palette.white} />
|
|
91
|
-
) : (
|
|
92
|
-
<>
|
|
93
|
-
<Icon name="upload-cloud" size={16} color={palette.white} />
|
|
94
|
-
<Text style={styles.primaryButtonText}>Publicar menu</Text>
|
|
95
|
-
</>
|
|
96
|
-
)}
|
|
97
|
-
</TouchableOpacity>
|
|
98
|
-
</View>
|
|
99
|
-
</View>
|
|
100
|
-
</View>
|
|
101
|
-
</AnimatedModal>
|
|
102
|
-
);
|
|
103
|
-
}
|
|
10
|
+
|
|
11
|
+
// Modal de pré-visualização do menu antes do envio ao iFood.
|
|
12
|
+
export default function IFoodPreviewModal({
|
|
13
|
+
visible,
|
|
14
|
+
previewData,
|
|
15
|
+
selectedEligible,
|
|
16
|
+
accentColor,
|
|
17
|
+
uploading,
|
|
18
|
+
palette = colors,
|
|
19
|
+
onClose,
|
|
20
|
+
onUpload,
|
|
21
|
+
}) {
|
|
22
|
+
return (
|
|
23
|
+
<AnimatedModal visible={visible} onRequestClose={onClose}>
|
|
24
|
+
<View style={styles.modalShell}>
|
|
25
|
+
<View style={styles.modalCard}>
|
|
26
|
+
<View style={styles.modalHeader}>
|
|
27
|
+
<View>
|
|
28
|
+
<Text style={styles.modalTitle}>Pre-visualizacao do menu</Text>
|
|
29
|
+
<Text style={styles.modalSubtitle}>
|
|
30
|
+
{previewData?.eligible_product_count || selectedEligible.length} produtos prontos para upload
|
|
31
|
+
</Text>
|
|
32
|
+
</View>
|
|
33
|
+
|
|
34
|
+
<TouchableOpacity onPress={onClose} style={styles.modalCloseButton}>
|
|
35
|
+
<Icon name="x" size={18} color={palette.textSecondary} />
|
|
36
|
+
</TouchableOpacity>
|
|
37
|
+
</View>
|
|
38
|
+
|
|
39
|
+
<ScrollView showsVerticalScrollIndicator={false} contentContainerStyle={styles.modalContent}>
|
|
40
|
+
<View style={styles.modalSummaryGrid}>
|
|
41
|
+
<View style={styles.modalSummaryCard}>
|
|
42
|
+
<Text style={styles.modalSummaryValue}>{countCollection(previewData?.payload?.menus)}</Text>
|
|
43
|
+
<Text style={styles.modalSummaryLabel}>Menus</Text>
|
|
44
|
+
</View>
|
|
45
|
+
<View style={styles.modalSummaryCard}>
|
|
46
|
+
<Text style={styles.modalSummaryValue}>{countCollection(previewData?.payload?.categories)}</Text>
|
|
47
|
+
<Text style={styles.modalSummaryLabel}>Categorias</Text>
|
|
48
|
+
</View>
|
|
49
|
+
<View style={styles.modalSummaryCard}>
|
|
50
|
+
<Text style={styles.modalSummaryValue}>{countCollection(previewData?.payload?.items)}</Text>
|
|
51
|
+
<Text style={styles.modalSummaryLabel}>Itens</Text>
|
|
52
|
+
</View>
|
|
53
|
+
</View>
|
|
54
|
+
|
|
55
|
+
<View style={styles.previewSection}>
|
|
56
|
+
<Text style={styles.previewSectionTitle}>Categorias</Text>
|
|
57
|
+
{(previewData?.payload?.categories || []).map(category => (
|
|
58
|
+
<View key={category.app_category_id} style={styles.previewLine}>
|
|
59
|
+
<Text style={styles.previewLineTitle}>{category.category_name}</Text>
|
|
60
|
+
<Text style={styles.previewLineMeta}>
|
|
61
|
+
{countCollection(category.app_item_ids)} item(ns)
|
|
62
|
+
</Text>
|
|
63
|
+
</View>
|
|
64
|
+
))}
|
|
65
|
+
</View>
|
|
66
|
+
|
|
67
|
+
<View style={styles.previewSection}>
|
|
68
|
+
<Text style={styles.previewSectionTitle}>Itens selecionados</Text>
|
|
69
|
+
{selectedEligible.map(product => (
|
|
70
|
+
<View key={product.id} style={styles.previewLine}>
|
|
71
|
+
<Text style={styles.previewLineTitle}>{product.name}</Text>
|
|
72
|
+
<Text style={styles.previewLineMeta}>
|
|
73
|
+
{product.category?.name || 'Sem categoria'} • R$ {Number(product.price || 0).toFixed(2)}
|
|
74
|
+
</Text>
|
|
75
|
+
</View>
|
|
76
|
+
))}
|
|
77
|
+
</View>
|
|
78
|
+
</ScrollView>
|
|
79
|
+
|
|
80
|
+
<View style={styles.modalActions}>
|
|
81
|
+
<TouchableOpacity style={styles.secondaryButton} onPress={onClose}>
|
|
82
|
+
<Text style={styles.secondaryButtonText}>Fechar</Text>
|
|
83
|
+
</TouchableOpacity>
|
|
84
|
+
|
|
85
|
+
<TouchableOpacity
|
|
86
|
+
style={[styles.primaryButton, styles.modalPrimaryButton, { backgroundColor: accentColor }]}
|
|
87
|
+
onPress={onUpload}
|
|
88
|
+
disabled={uploading}>
|
|
89
|
+
{uploading ? (
|
|
90
|
+
<ActivityIndicator size="small" color={palette.white} />
|
|
91
|
+
) : (
|
|
92
|
+
<>
|
|
93
|
+
<Icon name="upload-cloud" size={16} color={palette.white} />
|
|
94
|
+
<Text style={styles.primaryButtonText}>Publicar menu</Text>
|
|
95
|
+
</>
|
|
96
|
+
)}
|
|
97
|
+
</TouchableOpacity>
|
|
98
|
+
</View>
|
|
99
|
+
</View>
|
|
100
|
+
</View>
|
|
101
|
+
</AnimatedModal>
|
|
102
|
+
);
|
|
103
|
+
}
|