@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,134 +1,134 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Text, View } from 'react-native';
|
|
3
|
-
import Icon from 'react-native-vector-icons/Feather';
|
|
4
|
-
import { colors } from '@controleonline
|
|
5
|
-
|
|
6
|
-
import { withOpacity } from '@controleonline
|
|
7
|
-
|
|
8
|
-
import styles from '../styles';
|
|
9
|
-
|
|
10
|
-
// Aba inicial com leitura rápida da integração 99Food.
|
|
11
|
-
export default function Food99OverviewTab({
|
|
12
|
-
shadowStyle,
|
|
13
|
-
connected,
|
|
14
|
-
needsReconnect,
|
|
15
|
-
summaryCards,
|
|
16
|
-
lastMenuPublishState,
|
|
17
|
-
publicationTone,
|
|
18
|
-
publishStateLabel,
|
|
19
|
-
lastMenuTaskMessage,
|
|
20
|
-
lastErrorMessage,
|
|
21
|
-
palette = colors,
|
|
22
|
-
}) {
|
|
23
|
-
const reconnectRequired = Boolean(needsReconnect);
|
|
24
|
-
const pillBackgroundColor = reconnectRequired
|
|
25
|
-
? withOpacity(palette.warning, 0.24)
|
|
26
|
-
: connected
|
|
27
|
-
? withOpacity(palette.success, 0.18)
|
|
28
|
-
: withOpacity(palette.warning, 0.24);
|
|
29
|
-
const pillTextColor = reconnectRequired
|
|
30
|
-
? palette.warning
|
|
31
|
-
: connected
|
|
32
|
-
? palette.success
|
|
33
|
-
: palette.warning;
|
|
34
|
-
const pillLabel = reconnectRequired
|
|
35
|
-
? 'Reconexão necessária'
|
|
36
|
-
: connected
|
|
37
|
-
? '99Food conectado'
|
|
38
|
-
: 'Integração pendente';
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<>
|
|
42
|
-
<View style={styles.companyRow}>
|
|
43
|
-
<View
|
|
44
|
-
style={[
|
|
45
|
-
styles.statusPill,
|
|
46
|
-
{ backgroundColor: pillBackgroundColor },
|
|
47
|
-
]}>
|
|
48
|
-
<Text
|
|
49
|
-
style={[
|
|
50
|
-
styles.statusPillText,
|
|
51
|
-
{ color: pillTextColor },
|
|
52
|
-
]}>
|
|
53
|
-
{pillLabel}
|
|
54
|
-
</Text>
|
|
55
|
-
</View>
|
|
56
|
-
</View>
|
|
57
|
-
|
|
58
|
-
<View style={styles.summaryGrid}>
|
|
59
|
-
{summaryCards.map(card => (
|
|
60
|
-
<View key={card.key} style={[styles.summaryCard, shadowStyle]}>
|
|
61
|
-
<View
|
|
62
|
-
style={[
|
|
63
|
-
styles.summaryIcon,
|
|
64
|
-
{ backgroundColor: palette.cardIconBackground || palette.iconBackground },
|
|
65
|
-
]}
|
|
66
|
-
>
|
|
67
|
-
<Icon
|
|
68
|
-
name={card.icon}
|
|
69
|
-
size={18}
|
|
70
|
-
color={palette.cardIconColor || palette.iconColor || palette.text}
|
|
71
|
-
/>
|
|
72
|
-
</View>
|
|
73
|
-
<Text style={styles.summaryValue}>{card.value}</Text>
|
|
74
|
-
<Text style={styles.summaryLabel}>{card.label}</Text>
|
|
75
|
-
</View>
|
|
76
|
-
))}
|
|
77
|
-
</View>
|
|
78
|
-
|
|
79
|
-
<View style={[styles.panel, shadowStyle]}>
|
|
80
|
-
<View style={styles.panelHeader}>
|
|
81
|
-
<View>
|
|
82
|
-
<Text style={styles.panelTitle}>Leitura rapida</Text>
|
|
83
|
-
<Text style={styles.panelSubtitle}>
|
|
84
|
-
Use as abas seguintes para trabalhar conexao, configuracoes e catalogo separadamente.
|
|
85
|
-
</Text>
|
|
86
|
-
</View>
|
|
87
|
-
</View>
|
|
88
|
-
|
|
89
|
-
{!!lastMenuPublishState && (
|
|
90
|
-
<View style={[styles.infoBanner, { backgroundColor: withOpacity(publicationTone, 0.12) }]}>
|
|
91
|
-
<Icon
|
|
92
|
-
name={
|
|
93
|
-
lastMenuPublishState === 'failed'
|
|
94
|
-
? 'alert-triangle'
|
|
95
|
-
: lastMenuPublishState === 'published'
|
|
96
|
-
? 'check-circle'
|
|
97
|
-
: 'clock'
|
|
98
|
-
}
|
|
99
|
-
size={14}
|
|
100
|
-
color={publicationTone}
|
|
101
|
-
/>
|
|
102
|
-
<Text style={[styles.infoBannerText, { color: publicationTone }]}>
|
|
103
|
-
{publishStateLabel}
|
|
104
|
-
{lastMenuTaskMessage ? ` • ${lastMenuTaskMessage}` : ''}
|
|
105
|
-
</Text>
|
|
106
|
-
</View>
|
|
107
|
-
)}
|
|
108
|
-
|
|
109
|
-
{!!lastErrorMessage && lastMenuPublishState !== 'failed' && (
|
|
110
|
-
<View style={styles.errorBanner}>
|
|
111
|
-
<Icon name="alert-circle" size={14} color={palette.error} />
|
|
112
|
-
<Text style={styles.errorBannerText}>{lastErrorMessage}</Text>
|
|
113
|
-
</View>
|
|
114
|
-
)}
|
|
115
|
-
|
|
116
|
-
{reconnectRequired && !lastMenuPublishState && !lastErrorMessage ? (
|
|
117
|
-
<View style={[styles.infoBanner, { backgroundColor: withOpacity(palette.warning, 0.24) }]}>
|
|
118
|
-
<Icon name="alert-triangle" size={14} color={palette.warning} />
|
|
119
|
-
<Text style={[styles.infoBannerText, { color: palette.warning }]}>
|
|
120
|
-
A loja está vinculada localmente, mas a conexão remota caiu. Use a aba Loja para reconectar e retomar os webhooks.
|
|
121
|
-
</Text>
|
|
122
|
-
</View>
|
|
123
|
-
) : !lastMenuPublishState && !lastErrorMessage ? (
|
|
124
|
-
<View style={[styles.infoBanner, { backgroundColor: withOpacity(palette.info, 0.12) }]}>
|
|
125
|
-
<Icon name="info" size={14} color={palette.info} />
|
|
126
|
-
<Text style={[styles.infoBannerText, { color: palette.info }]}>
|
|
127
|
-
A aba de loja concentra status remoto e ações de conexão. A aba de cardápio cuida somente dos produtos.
|
|
128
|
-
</Text>
|
|
129
|
-
</View>
|
|
130
|
-
) : null}
|
|
131
|
-
</View>
|
|
132
|
-
</>
|
|
133
|
-
);
|
|
134
|
-
}
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text, 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
|
+
import { withOpacity } from '@controleonline/ui-layout/src/styles/branding';
|
|
7
|
+
|
|
8
|
+
import styles from '../styles';
|
|
9
|
+
|
|
10
|
+
// Aba inicial com leitura rápida da integração 99Food.
|
|
11
|
+
export default function Food99OverviewTab({
|
|
12
|
+
shadowStyle,
|
|
13
|
+
connected,
|
|
14
|
+
needsReconnect,
|
|
15
|
+
summaryCards,
|
|
16
|
+
lastMenuPublishState,
|
|
17
|
+
publicationTone,
|
|
18
|
+
publishStateLabel,
|
|
19
|
+
lastMenuTaskMessage,
|
|
20
|
+
lastErrorMessage,
|
|
21
|
+
palette = colors,
|
|
22
|
+
}) {
|
|
23
|
+
const reconnectRequired = Boolean(needsReconnect);
|
|
24
|
+
const pillBackgroundColor = reconnectRequired
|
|
25
|
+
? withOpacity(palette.warning, 0.24)
|
|
26
|
+
: connected
|
|
27
|
+
? withOpacity(palette.success, 0.18)
|
|
28
|
+
: withOpacity(palette.warning, 0.24);
|
|
29
|
+
const pillTextColor = reconnectRequired
|
|
30
|
+
? palette.warning
|
|
31
|
+
: connected
|
|
32
|
+
? palette.success
|
|
33
|
+
: palette.warning;
|
|
34
|
+
const pillLabel = reconnectRequired
|
|
35
|
+
? 'Reconexão necessária'
|
|
36
|
+
: connected
|
|
37
|
+
? '99Food conectado'
|
|
38
|
+
: 'Integração pendente';
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<>
|
|
42
|
+
<View style={styles.companyRow}>
|
|
43
|
+
<View
|
|
44
|
+
style={[
|
|
45
|
+
styles.statusPill,
|
|
46
|
+
{ backgroundColor: pillBackgroundColor },
|
|
47
|
+
]}>
|
|
48
|
+
<Text
|
|
49
|
+
style={[
|
|
50
|
+
styles.statusPillText,
|
|
51
|
+
{ color: pillTextColor },
|
|
52
|
+
]}>
|
|
53
|
+
{pillLabel}
|
|
54
|
+
</Text>
|
|
55
|
+
</View>
|
|
56
|
+
</View>
|
|
57
|
+
|
|
58
|
+
<View style={styles.summaryGrid}>
|
|
59
|
+
{summaryCards.map(card => (
|
|
60
|
+
<View key={card.key} style={[styles.summaryCard, shadowStyle]}>
|
|
61
|
+
<View
|
|
62
|
+
style={[
|
|
63
|
+
styles.summaryIcon,
|
|
64
|
+
{ backgroundColor: palette.cardIconBackground || palette.iconBackground },
|
|
65
|
+
]}
|
|
66
|
+
>
|
|
67
|
+
<Icon
|
|
68
|
+
name={card.icon}
|
|
69
|
+
size={18}
|
|
70
|
+
color={palette.cardIconColor || palette.iconColor || palette.text}
|
|
71
|
+
/>
|
|
72
|
+
</View>
|
|
73
|
+
<Text style={styles.summaryValue}>{card.value}</Text>
|
|
74
|
+
<Text style={styles.summaryLabel}>{card.label}</Text>
|
|
75
|
+
</View>
|
|
76
|
+
))}
|
|
77
|
+
</View>
|
|
78
|
+
|
|
79
|
+
<View style={[styles.panel, shadowStyle]}>
|
|
80
|
+
<View style={styles.panelHeader}>
|
|
81
|
+
<View>
|
|
82
|
+
<Text style={styles.panelTitle}>Leitura rapida</Text>
|
|
83
|
+
<Text style={styles.panelSubtitle}>
|
|
84
|
+
Use as abas seguintes para trabalhar conexao, configuracoes e catalogo separadamente.
|
|
85
|
+
</Text>
|
|
86
|
+
</View>
|
|
87
|
+
</View>
|
|
88
|
+
|
|
89
|
+
{!!lastMenuPublishState && (
|
|
90
|
+
<View style={[styles.infoBanner, { backgroundColor: withOpacity(publicationTone, 0.12) }]}>
|
|
91
|
+
<Icon
|
|
92
|
+
name={
|
|
93
|
+
lastMenuPublishState === 'failed'
|
|
94
|
+
? 'alert-triangle'
|
|
95
|
+
: lastMenuPublishState === 'published'
|
|
96
|
+
? 'check-circle'
|
|
97
|
+
: 'clock'
|
|
98
|
+
}
|
|
99
|
+
size={14}
|
|
100
|
+
color={publicationTone}
|
|
101
|
+
/>
|
|
102
|
+
<Text style={[styles.infoBannerText, { color: publicationTone }]}>
|
|
103
|
+
{publishStateLabel}
|
|
104
|
+
{lastMenuTaskMessage ? ` • ${lastMenuTaskMessage}` : ''}
|
|
105
|
+
</Text>
|
|
106
|
+
</View>
|
|
107
|
+
)}
|
|
108
|
+
|
|
109
|
+
{!!lastErrorMessage && lastMenuPublishState !== 'failed' && (
|
|
110
|
+
<View style={styles.errorBanner}>
|
|
111
|
+
<Icon name="alert-circle" size={14} color={palette.error} />
|
|
112
|
+
<Text style={styles.errorBannerText}>{lastErrorMessage}</Text>
|
|
113
|
+
</View>
|
|
114
|
+
)}
|
|
115
|
+
|
|
116
|
+
{reconnectRequired && !lastMenuPublishState && !lastErrorMessage ? (
|
|
117
|
+
<View style={[styles.infoBanner, { backgroundColor: withOpacity(palette.warning, 0.24) }]}>
|
|
118
|
+
<Icon name="alert-triangle" size={14} color={palette.warning} />
|
|
119
|
+
<Text style={[styles.infoBannerText, { color: palette.warning }]}>
|
|
120
|
+
A loja está vinculada localmente, mas a conexão remota caiu. Use a aba Loja para reconectar e retomar os webhooks.
|
|
121
|
+
</Text>
|
|
122
|
+
</View>
|
|
123
|
+
) : !lastMenuPublishState && !lastErrorMessage ? (
|
|
124
|
+
<View style={[styles.infoBanner, { backgroundColor: withOpacity(palette.info, 0.12) }]}>
|
|
125
|
+
<Icon name="info" size={14} color={palette.info} />
|
|
126
|
+
<Text style={[styles.infoBannerText, { color: palette.info }]}>
|
|
127
|
+
A aba de loja concentra status remoto e ações de conexão. A aba de cardápio cuida somente dos produtos.
|
|
128
|
+
</Text>
|
|
129
|
+
</View>
|
|
130
|
+
) : null}
|
|
131
|
+
</View>
|
|
132
|
+
</>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
@@ -1,173 +1,173 @@
|
|
|
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
|
-
|
|
6
|
-
import AnimatedModal from '@controleonline/ui-common/src/react/components/AnimatedModal';
|
|
7
|
-
|
|
8
|
-
import styles from '../styles';
|
|
9
|
-
import { countCollection } from '@controleonline/ui-common/src/react/utils/integrationPage';
|
|
10
|
-
|
|
11
|
-
const resolveButtonPalette = (palette, accentColor) => {
|
|
12
|
-
const primaryBackground =
|
|
13
|
-
palette.buttonBackground || accentColor || palette.primary;
|
|
14
|
-
const primaryBorder = palette.buttonBorder || primaryBackground;
|
|
15
|
-
const primaryText = palette.buttonText || palette.white;
|
|
16
|
-
const primaryIcon = palette.buttonIcon || primaryText;
|
|
17
|
-
const secondaryBackground =
|
|
18
|
-
palette.buttonBackgroundSecondary || palette.white;
|
|
19
|
-
const secondaryBorder = palette.buttonBorderSecondary || palette.border;
|
|
20
|
-
const secondaryText = palette.buttonTextSecondary || palette.textSecondary;
|
|
21
|
-
const secondaryIcon = palette.buttonIconSecondary || secondaryText;
|
|
22
|
-
const disabledBackground =
|
|
23
|
-
palette.buttonDisabledBackground || secondaryBorder;
|
|
24
|
-
const disabledBorder = palette.buttonBorderSecondary || secondaryBorder;
|
|
25
|
-
const disabledText = palette.buttonDisabledText || secondaryText;
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
primaryBackground,
|
|
29
|
-
primaryBorder,
|
|
30
|
-
primaryText,
|
|
31
|
-
primaryIcon,
|
|
32
|
-
secondaryBackground,
|
|
33
|
-
secondaryBorder,
|
|
34
|
-
secondaryText,
|
|
35
|
-
secondaryIcon,
|
|
36
|
-
disabledBackground,
|
|
37
|
-
disabledBorder,
|
|
38
|
-
disabledText,
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
// Modal de pré-visualização do menu antes do envio à 99Food.
|
|
43
|
-
export default function Food99PreviewModal({
|
|
44
|
-
visible,
|
|
45
|
-
previewData,
|
|
46
|
-
selectedEligibleProducts,
|
|
47
|
-
uploading,
|
|
48
|
-
accentColor,
|
|
49
|
-
palette = colors,
|
|
50
|
-
onClose,
|
|
51
|
-
onUpload,
|
|
52
|
-
}) {
|
|
53
|
-
const buttonPalette = resolveButtonPalette(palette, accentColor);
|
|
54
|
-
|
|
55
|
-
return (
|
|
56
|
-
<AnimatedModal visible={visible} onRequestClose={onClose}>
|
|
57
|
-
<View style={styles.modalShell}>
|
|
58
|
-
<View style={styles.modalCard}>
|
|
59
|
-
<View style={styles.modalHeader}>
|
|
60
|
-
<View>
|
|
61
|
-
<Text style={styles.modalTitle}>Pre-visualizacao do menu</Text>
|
|
62
|
-
<Text style={styles.modalSubtitle}>
|
|
63
|
-
{previewData?.eligible_product_count || selectedEligibleProducts.length} produtos prontos para upload
|
|
64
|
-
</Text>
|
|
65
|
-
</View>
|
|
66
|
-
<TouchableOpacity onPress={onClose} style={styles.modalCloseButton}>
|
|
67
|
-
<Icon name="x" size={18} color={palette.textSecondary} />
|
|
68
|
-
</TouchableOpacity>
|
|
69
|
-
</View>
|
|
70
|
-
|
|
71
|
-
<ScrollView showsVerticalScrollIndicator={false} contentContainerStyle={styles.modalContent}>
|
|
72
|
-
<View style={styles.modalSummaryGrid}>
|
|
73
|
-
<View style={styles.modalSummaryCard}>
|
|
74
|
-
<Text style={styles.modalSummaryValue}>{countCollection(previewData?.payload?.menus)}</Text>
|
|
75
|
-
<Text style={styles.modalSummaryLabel}>Menus</Text>
|
|
76
|
-
</View>
|
|
77
|
-
<View style={styles.modalSummaryCard}>
|
|
78
|
-
<Text style={styles.modalSummaryValue}>{countCollection(previewData?.payload?.categories)}</Text>
|
|
79
|
-
<Text style={styles.modalSummaryLabel}>Categorias</Text>
|
|
80
|
-
</View>
|
|
81
|
-
<View style={styles.modalSummaryCard}>
|
|
82
|
-
<Text style={styles.modalSummaryValue}>{countCollection(previewData?.payload?.items)}</Text>
|
|
83
|
-
<Text style={styles.modalSummaryLabel}>Itens</Text>
|
|
84
|
-
</View>
|
|
85
|
-
</View>
|
|
86
|
-
|
|
87
|
-
<View style={styles.previewSection}>
|
|
88
|
-
<Text style={styles.previewSectionTitle}>Categorias</Text>
|
|
89
|
-
{(previewData?.payload?.categories || []).map(category => (
|
|
90
|
-
<View key={category.app_category_id} style={styles.previewLine}>
|
|
91
|
-
<Text style={styles.previewLineTitle}>{category.category_name}</Text>
|
|
92
|
-
<Text style={styles.previewLineMeta}>
|
|
93
|
-
{countCollection(category.app_item_ids)} item(ns)
|
|
94
|
-
</Text>
|
|
95
|
-
</View>
|
|
96
|
-
))}
|
|
97
|
-
</View>
|
|
98
|
-
|
|
99
|
-
<View style={styles.previewSection}>
|
|
100
|
-
<Text style={styles.previewSectionTitle}>Itens selecionados</Text>
|
|
101
|
-
{selectedEligibleProducts.map(product => (
|
|
102
|
-
<View key={product.id} style={styles.previewLine}>
|
|
103
|
-
<Text style={styles.previewLineTitle}>{product.name}</Text>
|
|
104
|
-
<Text style={styles.previewLineMeta}>
|
|
105
|
-
{product.category?.name || 'Sem categoria'} • R$ {Number(product.price || 0).toFixed(2)}
|
|
106
|
-
</Text>
|
|
107
|
-
</View>
|
|
108
|
-
))}
|
|
109
|
-
</View>
|
|
110
|
-
</ScrollView>
|
|
111
|
-
|
|
112
|
-
<View style={styles.modalActions}>
|
|
113
|
-
<TouchableOpacity
|
|
114
|
-
style={[
|
|
115
|
-
styles.secondaryButton,
|
|
116
|
-
{
|
|
117
|
-
borderColor: buttonPalette.secondaryBorder,
|
|
118
|
-
backgroundColor: buttonPalette.secondaryBackground,
|
|
119
|
-
},
|
|
120
|
-
]}
|
|
121
|
-
onPress={onClose}>
|
|
122
|
-
<Text
|
|
123
|
-
style={[
|
|
124
|
-
styles.secondaryButtonText,
|
|
125
|
-
{ color: buttonPalette.secondaryText },
|
|
126
|
-
]}>
|
|
127
|
-
Fechar
|
|
128
|
-
</Text>
|
|
129
|
-
</TouchableOpacity>
|
|
130
|
-
<TouchableOpacity
|
|
131
|
-
style={[
|
|
132
|
-
styles.primaryButton,
|
|
133
|
-
styles.modalPrimaryButton,
|
|
134
|
-
{
|
|
135
|
-
borderWidth: 1,
|
|
136
|
-
borderColor: uploading
|
|
137
|
-
? buttonPalette.disabledBorder
|
|
138
|
-
: buttonPalette.primaryBorder,
|
|
139
|
-
backgroundColor: uploading
|
|
140
|
-
? buttonPalette.disabledBackground
|
|
141
|
-
: buttonPalette.primaryBackground,
|
|
142
|
-
},
|
|
143
|
-
]}
|
|
144
|
-
onPress={onUpload}
|
|
145
|
-
disabled={uploading}>
|
|
146
|
-
{uploading ? (
|
|
147
|
-
<ActivityIndicator
|
|
148
|
-
size="small"
|
|
149
|
-
color={buttonPalette.disabledText}
|
|
150
|
-
/>
|
|
151
|
-
) : (
|
|
152
|
-
<>
|
|
153
|
-
<Icon
|
|
154
|
-
name="upload-cloud"
|
|
155
|
-
size={16}
|
|
156
|
-
color={buttonPalette.primaryIcon}
|
|
157
|
-
/>
|
|
158
|
-
<Text
|
|
159
|
-
style={[
|
|
160
|
-
styles.primaryButtonText,
|
|
161
|
-
{ color: buttonPalette.primaryText },
|
|
162
|
-
]}>
|
|
163
|
-
Publicar menu
|
|
164
|
-
</Text>
|
|
165
|
-
</>
|
|
166
|
-
)}
|
|
167
|
-
</TouchableOpacity>
|
|
168
|
-
</View>
|
|
169
|
-
</View>
|
|
170
|
-
</View>
|
|
171
|
-
</AnimatedModal>
|
|
172
|
-
);
|
|
173
|
-
}
|
|
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
|
+
import AnimatedModal from '@controleonline/ui-common/src/react/components/AnimatedModal';
|
|
7
|
+
|
|
8
|
+
import styles from '../styles';
|
|
9
|
+
import { countCollection } from '@controleonline/ui-common/src/react/utils/integrationPage';
|
|
10
|
+
|
|
11
|
+
const resolveButtonPalette = (palette, accentColor) => {
|
|
12
|
+
const primaryBackground =
|
|
13
|
+
palette.buttonBackground || accentColor || palette.primary;
|
|
14
|
+
const primaryBorder = palette.buttonBorder || primaryBackground;
|
|
15
|
+
const primaryText = palette.buttonText || palette.white;
|
|
16
|
+
const primaryIcon = palette.buttonIcon || primaryText;
|
|
17
|
+
const secondaryBackground =
|
|
18
|
+
palette.buttonBackgroundSecondary || palette.white;
|
|
19
|
+
const secondaryBorder = palette.buttonBorderSecondary || palette.border;
|
|
20
|
+
const secondaryText = palette.buttonTextSecondary || palette.textSecondary;
|
|
21
|
+
const secondaryIcon = palette.buttonIconSecondary || secondaryText;
|
|
22
|
+
const disabledBackground =
|
|
23
|
+
palette.buttonDisabledBackground || secondaryBorder;
|
|
24
|
+
const disabledBorder = palette.buttonBorderSecondary || secondaryBorder;
|
|
25
|
+
const disabledText = palette.buttonDisabledText || secondaryText;
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
primaryBackground,
|
|
29
|
+
primaryBorder,
|
|
30
|
+
primaryText,
|
|
31
|
+
primaryIcon,
|
|
32
|
+
secondaryBackground,
|
|
33
|
+
secondaryBorder,
|
|
34
|
+
secondaryText,
|
|
35
|
+
secondaryIcon,
|
|
36
|
+
disabledBackground,
|
|
37
|
+
disabledBorder,
|
|
38
|
+
disabledText,
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// Modal de pré-visualização do menu antes do envio à 99Food.
|
|
43
|
+
export default function Food99PreviewModal({
|
|
44
|
+
visible,
|
|
45
|
+
previewData,
|
|
46
|
+
selectedEligibleProducts,
|
|
47
|
+
uploading,
|
|
48
|
+
accentColor,
|
|
49
|
+
palette = colors,
|
|
50
|
+
onClose,
|
|
51
|
+
onUpload,
|
|
52
|
+
}) {
|
|
53
|
+
const buttonPalette = resolveButtonPalette(palette, accentColor);
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<AnimatedModal visible={visible} onRequestClose={onClose}>
|
|
57
|
+
<View style={styles.modalShell}>
|
|
58
|
+
<View style={styles.modalCard}>
|
|
59
|
+
<View style={styles.modalHeader}>
|
|
60
|
+
<View>
|
|
61
|
+
<Text style={styles.modalTitle}>Pre-visualizacao do menu</Text>
|
|
62
|
+
<Text style={styles.modalSubtitle}>
|
|
63
|
+
{previewData?.eligible_product_count || selectedEligibleProducts.length} produtos prontos para upload
|
|
64
|
+
</Text>
|
|
65
|
+
</View>
|
|
66
|
+
<TouchableOpacity onPress={onClose} style={styles.modalCloseButton}>
|
|
67
|
+
<Icon name="x" size={18} color={palette.textSecondary} />
|
|
68
|
+
</TouchableOpacity>
|
|
69
|
+
</View>
|
|
70
|
+
|
|
71
|
+
<ScrollView showsVerticalScrollIndicator={false} contentContainerStyle={styles.modalContent}>
|
|
72
|
+
<View style={styles.modalSummaryGrid}>
|
|
73
|
+
<View style={styles.modalSummaryCard}>
|
|
74
|
+
<Text style={styles.modalSummaryValue}>{countCollection(previewData?.payload?.menus)}</Text>
|
|
75
|
+
<Text style={styles.modalSummaryLabel}>Menus</Text>
|
|
76
|
+
</View>
|
|
77
|
+
<View style={styles.modalSummaryCard}>
|
|
78
|
+
<Text style={styles.modalSummaryValue}>{countCollection(previewData?.payload?.categories)}</Text>
|
|
79
|
+
<Text style={styles.modalSummaryLabel}>Categorias</Text>
|
|
80
|
+
</View>
|
|
81
|
+
<View style={styles.modalSummaryCard}>
|
|
82
|
+
<Text style={styles.modalSummaryValue}>{countCollection(previewData?.payload?.items)}</Text>
|
|
83
|
+
<Text style={styles.modalSummaryLabel}>Itens</Text>
|
|
84
|
+
</View>
|
|
85
|
+
</View>
|
|
86
|
+
|
|
87
|
+
<View style={styles.previewSection}>
|
|
88
|
+
<Text style={styles.previewSectionTitle}>Categorias</Text>
|
|
89
|
+
{(previewData?.payload?.categories || []).map(category => (
|
|
90
|
+
<View key={category.app_category_id} style={styles.previewLine}>
|
|
91
|
+
<Text style={styles.previewLineTitle}>{category.category_name}</Text>
|
|
92
|
+
<Text style={styles.previewLineMeta}>
|
|
93
|
+
{countCollection(category.app_item_ids)} item(ns)
|
|
94
|
+
</Text>
|
|
95
|
+
</View>
|
|
96
|
+
))}
|
|
97
|
+
</View>
|
|
98
|
+
|
|
99
|
+
<View style={styles.previewSection}>
|
|
100
|
+
<Text style={styles.previewSectionTitle}>Itens selecionados</Text>
|
|
101
|
+
{selectedEligibleProducts.map(product => (
|
|
102
|
+
<View key={product.id} style={styles.previewLine}>
|
|
103
|
+
<Text style={styles.previewLineTitle}>{product.name}</Text>
|
|
104
|
+
<Text style={styles.previewLineMeta}>
|
|
105
|
+
{product.category?.name || 'Sem categoria'} • R$ {Number(product.price || 0).toFixed(2)}
|
|
106
|
+
</Text>
|
|
107
|
+
</View>
|
|
108
|
+
))}
|
|
109
|
+
</View>
|
|
110
|
+
</ScrollView>
|
|
111
|
+
|
|
112
|
+
<View style={styles.modalActions}>
|
|
113
|
+
<TouchableOpacity
|
|
114
|
+
style={[
|
|
115
|
+
styles.secondaryButton,
|
|
116
|
+
{
|
|
117
|
+
borderColor: buttonPalette.secondaryBorder,
|
|
118
|
+
backgroundColor: buttonPalette.secondaryBackground,
|
|
119
|
+
},
|
|
120
|
+
]}
|
|
121
|
+
onPress={onClose}>
|
|
122
|
+
<Text
|
|
123
|
+
style={[
|
|
124
|
+
styles.secondaryButtonText,
|
|
125
|
+
{ color: buttonPalette.secondaryText },
|
|
126
|
+
]}>
|
|
127
|
+
Fechar
|
|
128
|
+
</Text>
|
|
129
|
+
</TouchableOpacity>
|
|
130
|
+
<TouchableOpacity
|
|
131
|
+
style={[
|
|
132
|
+
styles.primaryButton,
|
|
133
|
+
styles.modalPrimaryButton,
|
|
134
|
+
{
|
|
135
|
+
borderWidth: 1,
|
|
136
|
+
borderColor: uploading
|
|
137
|
+
? buttonPalette.disabledBorder
|
|
138
|
+
: buttonPalette.primaryBorder,
|
|
139
|
+
backgroundColor: uploading
|
|
140
|
+
? buttonPalette.disabledBackground
|
|
141
|
+
: buttonPalette.primaryBackground,
|
|
142
|
+
},
|
|
143
|
+
]}
|
|
144
|
+
onPress={onUpload}
|
|
145
|
+
disabled={uploading}>
|
|
146
|
+
{uploading ? (
|
|
147
|
+
<ActivityIndicator
|
|
148
|
+
size="small"
|
|
149
|
+
color={buttonPalette.disabledText}
|
|
150
|
+
/>
|
|
151
|
+
) : (
|
|
152
|
+
<>
|
|
153
|
+
<Icon
|
|
154
|
+
name="upload-cloud"
|
|
155
|
+
size={16}
|
|
156
|
+
color={buttonPalette.primaryIcon}
|
|
157
|
+
/>
|
|
158
|
+
<Text
|
|
159
|
+
style={[
|
|
160
|
+
styles.primaryButtonText,
|
|
161
|
+
{ color: buttonPalette.primaryText },
|
|
162
|
+
]}>
|
|
163
|
+
Publicar menu
|
|
164
|
+
</Text>
|
|
165
|
+
</>
|
|
166
|
+
)}
|
|
167
|
+
</TouchableOpacity>
|
|
168
|
+
</View>
|
|
169
|
+
</View>
|
|
170
|
+
</View>
|
|
171
|
+
</AnimatedModal>
|
|
172
|
+
);
|
|
173
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ActivityIndicator, StyleSheet, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
|
3
3
|
import Icon from 'react-native-vector-icons/Feather';
|
|
4
|
-
import { colors } from '@controleonline
|
|
4
|
+
import { colors } from '@controleonline/ui-layout/src/styles/colors';
|
|
5
5
|
|
|
6
6
|
import AnimatedModal from '@controleonline/ui-common/src/react/components/AnimatedModal';
|
|
7
7
|
|