@controleonline/ui-common 1.2.134 → 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 -5
- package/package.json +6 -2
- 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/LinkedOrderProductsTab.js +17 -8
- package/src/react/components/LinkedOrderProductsTab.styles.js +15 -0
- package/src/react/components/documentDetails/DocumentDetailsShell.js +147 -0
- package/src/react/components/documentDetails/DocumentDetailsShell.styles.js +163 -0
- package/src/react/components/documentDetails/DocumentSheet.js +87 -0
- 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/hooks/useLinkedOrderSummary.js +41 -0
- 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.styles.js +315 -279
- package/src/react/pages/WhatsAppProviderForm.js +1 -1
- package/src/react/pages/whatsAppConnectionHelpers.js +38 -10
- package/src/react/router/__tests__/publicRoutes.test.js +12 -0
- package/src/react/router/publicRoutes.js +3 -0
- package/src/react/utils/clientPortfolioParams.js +42 -0
- package/src/react/utils/commercialDocumentOrders.js +13 -20
- package/src/react/utils/documentFileContent.js +61 -0
- package/src/react/utils/fileUrl.js +1 -1
- package/src/react/utils/linkedOrderPayload.js +43 -0
- package/src/react/utils/orderProductsSummary.js +28 -0
- package/src/react/utils/peopleDisplay.js +8 -13
- package/src/store/connections/customActions.js +16 -14
- package/src/store/connections/index.js +109 -105
- package/src/tests/react/utils/clientPortfolioParams.test.js +30 -0
- package/src/tests/react/utils/documentFileContent.test.js +29 -0
- package/src/tests/react/utils/linkedOrderPayload.test.js +46 -0
- package/src/tests/react/utils/orderProductsSummary.test.js +24 -0
|
@@ -1,306 +1,306 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ActivityIndicator, Platform, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
|
3
|
-
import { Picker } from '@react-native-picker/picker';
|
|
4
|
-
import Icon from 'react-native-vector-icons/Feather';
|
|
5
|
-
import { colors } from '@controleonline
|
|
6
|
-
|
|
7
|
-
import { withOpacity } from '@controleonline
|
|
8
|
-
|
|
9
|
-
import styles from '../styles';
|
|
10
|
-
import {
|
|
11
|
-
deliveryMethodOptions,
|
|
12
|
-
sanitizeConfirmMethodInput,
|
|
13
|
-
sanitizeRadiusInput,
|
|
14
|
-
sanitizeTimeInput,
|
|
15
|
-
} from '../utils';
|
|
16
|
-
|
|
17
|
-
const resolveButtonPalette = (palette, accentColor) => {
|
|
18
|
-
const primaryBackground =
|
|
19
|
-
palette.buttonBackground || accentColor || palette.primary;
|
|
20
|
-
const primaryBorder = palette.buttonBorder || primaryBackground;
|
|
21
|
-
const primaryText = palette.buttonText || palette.white;
|
|
22
|
-
const primaryIcon = palette.buttonIcon || primaryText;
|
|
23
|
-
const secondaryBackground =
|
|
24
|
-
palette.buttonBackgroundSecondary || palette.white;
|
|
25
|
-
const secondaryBorder = palette.buttonBorderSecondary || palette.border;
|
|
26
|
-
const secondaryText = palette.buttonTextSecondary || palette.textSecondary;
|
|
27
|
-
const secondaryIcon = palette.buttonIconSecondary || secondaryText;
|
|
28
|
-
const disabledBackground =
|
|
29
|
-
palette.buttonDisabledBackground || secondaryBorder;
|
|
30
|
-
const disabledText = palette.buttonDisabledText || secondaryText;
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
primaryBackground,
|
|
34
|
-
primaryBorder,
|
|
35
|
-
primaryText,
|
|
36
|
-
primaryIcon,
|
|
37
|
-
secondaryBackground,
|
|
38
|
-
secondaryBorder,
|
|
39
|
-
secondaryText,
|
|
40
|
-
secondaryIcon,
|
|
41
|
-
disabledBackground,
|
|
42
|
-
disabledText,
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
// Aba isolada para configurações operacionais da loja.
|
|
47
|
-
export default function Food99SettingsTab({
|
|
48
|
-
shadowStyle,
|
|
49
|
-
accentColor,
|
|
50
|
-
settingsSummaryRows,
|
|
51
|
-
storeSettingsDraft,
|
|
52
|
-
setStoreSettingsDraft,
|
|
53
|
-
wallets,
|
|
54
|
-
walletLoading,
|
|
55
|
-
actionLoading,
|
|
56
|
-
onQuickCreateWallet,
|
|
57
|
-
onSave,
|
|
58
|
-
palette = colors,
|
|
59
|
-
}) {
|
|
60
|
-
const buttonPalette = resolveButtonPalette(palette, accentColor);
|
|
61
|
-
|
|
62
|
-
return (
|
|
63
|
-
<View style={[styles.panel, shadowStyle]}>
|
|
64
|
-
<View style={styles.panelHeader}>
|
|
65
|
-
<View>
|
|
66
|
-
<Text style={styles.panelTitle}>Configuracoes operacionais</Text>
|
|
67
|
-
<Text style={styles.panelSubtitle}>
|
|
68
|
-
Ajuste raio, horario, metodo de entrega, confirmacao e carteira de repasse sem misturar isso com a conexão da loja.
|
|
69
|
-
</Text>
|
|
70
|
-
</View>
|
|
71
|
-
</View>
|
|
72
|
-
|
|
73
|
-
<View style={styles.statusRows}>
|
|
74
|
-
{settingsSummaryRows.map(row => (
|
|
75
|
-
<View
|
|
76
|
-
key={row.label}
|
|
77
|
-
style={[
|
|
78
|
-
styles.statusRowItem,
|
|
79
|
-
row.wide && styles.statusRowItemWide,
|
|
80
|
-
]}>
|
|
81
|
-
<Text style={styles.statusRowLabel}>{row.label}</Text>
|
|
82
|
-
<Text style={row.small ? styles.statusRowValueSmall : styles.statusRowValue}>{row.value}</Text>
|
|
83
|
-
</View>
|
|
84
|
-
))}
|
|
85
|
-
</View>
|
|
86
|
-
|
|
87
|
-
<View style={styles.settingsForm}>
|
|
88
|
-
<View style={styles.formField}>
|
|
89
|
-
<Text style={styles.formLabel}>Raio de atendimento (km)</Text>
|
|
90
|
-
<TextInput
|
|
91
|
-
value={storeSettingsDraft.deliveryRadiusKm}
|
|
92
|
-
onChangeText={value =>
|
|
93
|
-
setStoreSettingsDraft(current => ({ ...current, deliveryRadiusKm: sanitizeRadiusInput(value) }))
|
|
94
|
-
}
|
|
95
|
-
placeholder="Ex.: 5"
|
|
96
|
-
keyboardType="decimal-pad"
|
|
97
|
-
style={styles.formInput}
|
|
98
|
-
placeholderTextColor={palette.textSecondary}
|
|
99
|
-
/>
|
|
100
|
-
</View>
|
|
101
|
-
|
|
102
|
-
<View style={styles.formRow}>
|
|
103
|
-
<View style={[styles.formField, styles.formFieldHalf]}>
|
|
104
|
-
<Text style={styles.formLabel}>Abertura (HH:mm)</Text>
|
|
105
|
-
<TextInput
|
|
106
|
-
value={storeSettingsDraft.openTime}
|
|
107
|
-
onChangeText={value =>
|
|
108
|
-
setStoreSettingsDraft(current => ({ ...current, openTime: sanitizeTimeInput(value) }))
|
|
109
|
-
}
|
|
110
|
-
placeholder="08:00"
|
|
111
|
-
keyboardType="number-pad"
|
|
112
|
-
maxLength={5}
|
|
113
|
-
style={styles.formInput}
|
|
114
|
-
placeholderTextColor={palette.textSecondary}
|
|
115
|
-
/>
|
|
116
|
-
</View>
|
|
117
|
-
|
|
118
|
-
<View style={[styles.formField, styles.formFieldHalf]}>
|
|
119
|
-
<Text style={styles.formLabel}>Fechamento (HH:mm)</Text>
|
|
120
|
-
<TextInput
|
|
121
|
-
value={storeSettingsDraft.closeTime}
|
|
122
|
-
onChangeText={value =>
|
|
123
|
-
setStoreSettingsDraft(current => ({ ...current, closeTime: sanitizeTimeInput(value) }))
|
|
124
|
-
}
|
|
125
|
-
placeholder="22:00"
|
|
126
|
-
keyboardType="number-pad"
|
|
127
|
-
maxLength={5}
|
|
128
|
-
style={styles.formInput}
|
|
129
|
-
placeholderTextColor={palette.textSecondary}
|
|
130
|
-
/>
|
|
131
|
-
</View>
|
|
132
|
-
</View>
|
|
133
|
-
|
|
134
|
-
<View style={styles.formRow}>
|
|
135
|
-
<View style={[styles.formField, styles.formFieldHalf]}>
|
|
136
|
-
<Text style={styles.formLabel}>Metodo de entrega</Text>
|
|
137
|
-
<View style={styles.optionGroup}>
|
|
138
|
-
{deliveryMethodOptions.map(option => {
|
|
139
|
-
const selected = String(storeSettingsDraft.deliveryMethod) === String(option.value);
|
|
140
|
-
|
|
141
|
-
return (
|
|
142
|
-
<TouchableOpacity
|
|
143
|
-
key={option.value}
|
|
144
|
-
onPress={() =>
|
|
145
|
-
setStoreSettingsDraft(current => ({ ...current, deliveryMethod: option.value }))
|
|
146
|
-
}
|
|
147
|
-
style={[
|
|
148
|
-
styles.optionChip,
|
|
149
|
-
{
|
|
150
|
-
borderColor: selected
|
|
151
|
-
? buttonPalette.primaryBorder
|
|
152
|
-
: buttonPalette.secondaryBorder,
|
|
153
|
-
backgroundColor: selected
|
|
154
|
-
? buttonPalette.primaryBackground
|
|
155
|
-
: buttonPalette.secondaryBackground,
|
|
156
|
-
},
|
|
157
|
-
]}>
|
|
158
|
-
<Text
|
|
159
|
-
style={[
|
|
160
|
-
styles.optionChipText,
|
|
161
|
-
{
|
|
162
|
-
color: selected
|
|
163
|
-
? buttonPalette.primaryText
|
|
164
|
-
: buttonPalette.secondaryText,
|
|
165
|
-
},
|
|
166
|
-
]}>
|
|
167
|
-
{option.label}
|
|
168
|
-
</Text>
|
|
169
|
-
</TouchableOpacity>
|
|
170
|
-
);
|
|
171
|
-
})}
|
|
172
|
-
</View>
|
|
173
|
-
</View>
|
|
174
|
-
|
|
175
|
-
<View style={[styles.formField, styles.formFieldHalf]}>
|
|
176
|
-
<Text style={styles.formLabel}>Metodo de confirmacao</Text>
|
|
177
|
-
<TextInput
|
|
178
|
-
value={storeSettingsDraft.confirmMethod}
|
|
179
|
-
onChangeText={value =>
|
|
180
|
-
setStoreSettingsDraft(current => ({ ...current, confirmMethod: sanitizeConfirmMethodInput(value) }))
|
|
181
|
-
}
|
|
182
|
-
placeholder="Ex.: 1"
|
|
183
|
-
keyboardType="number-pad"
|
|
184
|
-
maxLength={3}
|
|
185
|
-
style={styles.formInput}
|
|
186
|
-
placeholderTextColor={palette.textSecondary}
|
|
187
|
-
/>
|
|
188
|
-
</View>
|
|
189
|
-
</View>
|
|
190
|
-
|
|
191
|
-
<View style={styles.formField}>
|
|
192
|
-
<Text style={styles.formLabel}>ID da area de entrega (opcional)</Text>
|
|
193
|
-
<TextInput
|
|
194
|
-
value={storeSettingsDraft.deliveryAreaId}
|
|
195
|
-
onChangeText={value =>
|
|
196
|
-
setStoreSettingsDraft(current => ({ ...current, deliveryAreaId: value }))
|
|
197
|
-
}
|
|
198
|
-
placeholder="Usa automaticamente a primeira area quando vazio"
|
|
199
|
-
style={styles.formInput}
|
|
200
|
-
placeholderTextColor={palette.textSecondary}
|
|
201
|
-
/>
|
|
202
|
-
</View>
|
|
203
|
-
|
|
204
|
-
<View style={styles.formField}>
|
|
205
|
-
<View style={styles.formFieldHeaderRow}>
|
|
206
|
-
<Text style={styles.formLabel}>Carteira de repasse</Text>
|
|
207
|
-
<TouchableOpacity
|
|
208
|
-
onPress={onQuickCreateWallet}
|
|
209
|
-
style={[
|
|
210
|
-
styles.inlineAction,
|
|
211
|
-
{
|
|
212
|
-
borderWidth: 1,
|
|
213
|
-
borderColor: buttonPalette.secondaryBorder,
|
|
214
|
-
backgroundColor: buttonPalette.secondaryBackground,
|
|
215
|
-
},
|
|
216
|
-
]}>
|
|
217
|
-
<Icon
|
|
218
|
-
name="plus"
|
|
219
|
-
size={14}
|
|
220
|
-
color={buttonPalette.secondaryIcon}
|
|
221
|
-
/>
|
|
222
|
-
<Text
|
|
223
|
-
style={[
|
|
224
|
-
styles.inlineActionText,
|
|
225
|
-
{ color: buttonPalette.secondaryText },
|
|
226
|
-
]}>
|
|
227
|
-
Cadastro rapido
|
|
228
|
-
</Text>
|
|
229
|
-
</TouchableOpacity>
|
|
230
|
-
</View>
|
|
231
|
-
<View style={styles.pickerWrap}>
|
|
232
|
-
<Picker
|
|
233
|
-
selectedValue={storeSettingsDraft.settlementWalletId}
|
|
234
|
-
mode={Platform.OS === 'android' ? 'dropdown' : undefined}
|
|
235
|
-
onValueChange={value =>
|
|
236
|
-
setStoreSettingsDraft(current => ({ ...current, settlementWalletId: String(value || '') }))
|
|
237
|
-
}
|
|
238
|
-
enabled={!walletLoading && Array.isArray(wallets) && wallets.length > 0}
|
|
239
|
-
style={styles.picker}>
|
|
240
|
-
<Picker.Item
|
|
241
|
-
label={
|
|
242
|
-
walletLoading
|
|
243
|
-
? 'Carregando carteiras...'
|
|
244
|
-
: Array.isArray(wallets) && wallets.length === 0
|
|
245
|
-
? 'Nenhuma carteira cadastrada'
|
|
246
|
-
: 'Selecione uma carteira'
|
|
247
|
-
}
|
|
248
|
-
value=""
|
|
249
|
-
/>
|
|
250
|
-
{(Array.isArray(wallets) ? wallets : []).map(wallet => (
|
|
251
|
-
<Picker.Item
|
|
252
|
-
key={wallet.id}
|
|
253
|
-
label={`${wallet.wallet || 'Carteira'} (#${wallet.id})`}
|
|
254
|
-
value={String(wallet.id)}
|
|
255
|
-
/>
|
|
256
|
-
))}
|
|
257
|
-
</Picker>
|
|
258
|
-
</View>
|
|
259
|
-
<Text style={styles.formHint}>
|
|
260
|
-
A carteira selecionada recebe o repasse semanal do 99Food e precisa pertencer a empresa ativa.
|
|
261
|
-
</Text>
|
|
262
|
-
</View>
|
|
263
|
-
</View>
|
|
264
|
-
|
|
265
|
-
<View style={styles.actionRow}>
|
|
266
|
-
<TouchableOpacity
|
|
267
|
-
style={[
|
|
268
|
-
styles.primaryButton,
|
|
269
|
-
{
|
|
270
|
-
borderWidth: 1,
|
|
271
|
-
borderColor: buttonPalette.primaryBorder,
|
|
272
|
-
backgroundColor: buttonPalette.primaryBackground,
|
|
273
|
-
},
|
|
274
|
-
actionLoading === 'save-settings' && {
|
|
275
|
-
borderColor: buttonPalette.secondaryBorder,
|
|
276
|
-
backgroundColor: buttonPalette.disabledBackground,
|
|
277
|
-
},
|
|
278
|
-
]}
|
|
279
|
-
onPress={onSave}
|
|
280
|
-
disabled={actionLoading === 'save-settings'}>
|
|
281
|
-
{actionLoading === 'save-settings' ? (
|
|
282
|
-
<ActivityIndicator
|
|
283
|
-
size="small"
|
|
284
|
-
color={buttonPalette.disabledText}
|
|
285
|
-
/>
|
|
286
|
-
) : (
|
|
287
|
-
<>
|
|
288
|
-
<Icon
|
|
289
|
-
name="save"
|
|
290
|
-
size={16}
|
|
291
|
-
color={buttonPalette.primaryIcon}
|
|
292
|
-
/>
|
|
293
|
-
<Text
|
|
294
|
-
style={[
|
|
295
|
-
styles.primaryButtonText,
|
|
296
|
-
{ color: buttonPalette.primaryText },
|
|
297
|
-
]}>
|
|
298
|
-
Salvar configuracoes
|
|
299
|
-
</Text>
|
|
300
|
-
</>
|
|
301
|
-
)}
|
|
302
|
-
</TouchableOpacity>
|
|
303
|
-
</View>
|
|
304
|
-
</View>
|
|
305
|
-
);
|
|
306
|
-
}
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ActivityIndicator, Platform, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
|
3
|
+
import { Picker } from '@react-native-picker/picker';
|
|
4
|
+
import Icon from 'react-native-vector-icons/Feather';
|
|
5
|
+
import { colors } from '@controleonline/ui-layout/src/styles/colors';
|
|
6
|
+
|
|
7
|
+
import { withOpacity } from '@controleonline/ui-layout/src/styles/branding';
|
|
8
|
+
|
|
9
|
+
import styles from '../styles';
|
|
10
|
+
import {
|
|
11
|
+
deliveryMethodOptions,
|
|
12
|
+
sanitizeConfirmMethodInput,
|
|
13
|
+
sanitizeRadiusInput,
|
|
14
|
+
sanitizeTimeInput,
|
|
15
|
+
} from '../utils';
|
|
16
|
+
|
|
17
|
+
const resolveButtonPalette = (palette, accentColor) => {
|
|
18
|
+
const primaryBackground =
|
|
19
|
+
palette.buttonBackground || accentColor || palette.primary;
|
|
20
|
+
const primaryBorder = palette.buttonBorder || primaryBackground;
|
|
21
|
+
const primaryText = palette.buttonText || palette.white;
|
|
22
|
+
const primaryIcon = palette.buttonIcon || primaryText;
|
|
23
|
+
const secondaryBackground =
|
|
24
|
+
palette.buttonBackgroundSecondary || palette.white;
|
|
25
|
+
const secondaryBorder = palette.buttonBorderSecondary || palette.border;
|
|
26
|
+
const secondaryText = palette.buttonTextSecondary || palette.textSecondary;
|
|
27
|
+
const secondaryIcon = palette.buttonIconSecondary || secondaryText;
|
|
28
|
+
const disabledBackground =
|
|
29
|
+
palette.buttonDisabledBackground || secondaryBorder;
|
|
30
|
+
const disabledText = palette.buttonDisabledText || secondaryText;
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
primaryBackground,
|
|
34
|
+
primaryBorder,
|
|
35
|
+
primaryText,
|
|
36
|
+
primaryIcon,
|
|
37
|
+
secondaryBackground,
|
|
38
|
+
secondaryBorder,
|
|
39
|
+
secondaryText,
|
|
40
|
+
secondaryIcon,
|
|
41
|
+
disabledBackground,
|
|
42
|
+
disabledText,
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// Aba isolada para configurações operacionais da loja.
|
|
47
|
+
export default function Food99SettingsTab({
|
|
48
|
+
shadowStyle,
|
|
49
|
+
accentColor,
|
|
50
|
+
settingsSummaryRows,
|
|
51
|
+
storeSettingsDraft,
|
|
52
|
+
setStoreSettingsDraft,
|
|
53
|
+
wallets,
|
|
54
|
+
walletLoading,
|
|
55
|
+
actionLoading,
|
|
56
|
+
onQuickCreateWallet,
|
|
57
|
+
onSave,
|
|
58
|
+
palette = colors,
|
|
59
|
+
}) {
|
|
60
|
+
const buttonPalette = resolveButtonPalette(palette, accentColor);
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<View style={[styles.panel, shadowStyle]}>
|
|
64
|
+
<View style={styles.panelHeader}>
|
|
65
|
+
<View>
|
|
66
|
+
<Text style={styles.panelTitle}>Configuracoes operacionais</Text>
|
|
67
|
+
<Text style={styles.panelSubtitle}>
|
|
68
|
+
Ajuste raio, horario, metodo de entrega, confirmacao e carteira de repasse sem misturar isso com a conexão da loja.
|
|
69
|
+
</Text>
|
|
70
|
+
</View>
|
|
71
|
+
</View>
|
|
72
|
+
|
|
73
|
+
<View style={styles.statusRows}>
|
|
74
|
+
{settingsSummaryRows.map(row => (
|
|
75
|
+
<View
|
|
76
|
+
key={row.label}
|
|
77
|
+
style={[
|
|
78
|
+
styles.statusRowItem,
|
|
79
|
+
row.wide && styles.statusRowItemWide,
|
|
80
|
+
]}>
|
|
81
|
+
<Text style={styles.statusRowLabel}>{row.label}</Text>
|
|
82
|
+
<Text style={row.small ? styles.statusRowValueSmall : styles.statusRowValue}>{row.value}</Text>
|
|
83
|
+
</View>
|
|
84
|
+
))}
|
|
85
|
+
</View>
|
|
86
|
+
|
|
87
|
+
<View style={styles.settingsForm}>
|
|
88
|
+
<View style={styles.formField}>
|
|
89
|
+
<Text style={styles.formLabel}>Raio de atendimento (km)</Text>
|
|
90
|
+
<TextInput
|
|
91
|
+
value={storeSettingsDraft.deliveryRadiusKm}
|
|
92
|
+
onChangeText={value =>
|
|
93
|
+
setStoreSettingsDraft(current => ({ ...current, deliveryRadiusKm: sanitizeRadiusInput(value) }))
|
|
94
|
+
}
|
|
95
|
+
placeholder="Ex.: 5"
|
|
96
|
+
keyboardType="decimal-pad"
|
|
97
|
+
style={styles.formInput}
|
|
98
|
+
placeholderTextColor={palette.textSecondary}
|
|
99
|
+
/>
|
|
100
|
+
</View>
|
|
101
|
+
|
|
102
|
+
<View style={styles.formRow}>
|
|
103
|
+
<View style={[styles.formField, styles.formFieldHalf]}>
|
|
104
|
+
<Text style={styles.formLabel}>Abertura (HH:mm)</Text>
|
|
105
|
+
<TextInput
|
|
106
|
+
value={storeSettingsDraft.openTime}
|
|
107
|
+
onChangeText={value =>
|
|
108
|
+
setStoreSettingsDraft(current => ({ ...current, openTime: sanitizeTimeInput(value) }))
|
|
109
|
+
}
|
|
110
|
+
placeholder="08:00"
|
|
111
|
+
keyboardType="number-pad"
|
|
112
|
+
maxLength={5}
|
|
113
|
+
style={styles.formInput}
|
|
114
|
+
placeholderTextColor={palette.textSecondary}
|
|
115
|
+
/>
|
|
116
|
+
</View>
|
|
117
|
+
|
|
118
|
+
<View style={[styles.formField, styles.formFieldHalf]}>
|
|
119
|
+
<Text style={styles.formLabel}>Fechamento (HH:mm)</Text>
|
|
120
|
+
<TextInput
|
|
121
|
+
value={storeSettingsDraft.closeTime}
|
|
122
|
+
onChangeText={value =>
|
|
123
|
+
setStoreSettingsDraft(current => ({ ...current, closeTime: sanitizeTimeInput(value) }))
|
|
124
|
+
}
|
|
125
|
+
placeholder="22:00"
|
|
126
|
+
keyboardType="number-pad"
|
|
127
|
+
maxLength={5}
|
|
128
|
+
style={styles.formInput}
|
|
129
|
+
placeholderTextColor={palette.textSecondary}
|
|
130
|
+
/>
|
|
131
|
+
</View>
|
|
132
|
+
</View>
|
|
133
|
+
|
|
134
|
+
<View style={styles.formRow}>
|
|
135
|
+
<View style={[styles.formField, styles.formFieldHalf]}>
|
|
136
|
+
<Text style={styles.formLabel}>Metodo de entrega</Text>
|
|
137
|
+
<View style={styles.optionGroup}>
|
|
138
|
+
{deliveryMethodOptions.map(option => {
|
|
139
|
+
const selected = String(storeSettingsDraft.deliveryMethod) === String(option.value);
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<TouchableOpacity
|
|
143
|
+
key={option.value}
|
|
144
|
+
onPress={() =>
|
|
145
|
+
setStoreSettingsDraft(current => ({ ...current, deliveryMethod: option.value }))
|
|
146
|
+
}
|
|
147
|
+
style={[
|
|
148
|
+
styles.optionChip,
|
|
149
|
+
{
|
|
150
|
+
borderColor: selected
|
|
151
|
+
? buttonPalette.primaryBorder
|
|
152
|
+
: buttonPalette.secondaryBorder,
|
|
153
|
+
backgroundColor: selected
|
|
154
|
+
? buttonPalette.primaryBackground
|
|
155
|
+
: buttonPalette.secondaryBackground,
|
|
156
|
+
},
|
|
157
|
+
]}>
|
|
158
|
+
<Text
|
|
159
|
+
style={[
|
|
160
|
+
styles.optionChipText,
|
|
161
|
+
{
|
|
162
|
+
color: selected
|
|
163
|
+
? buttonPalette.primaryText
|
|
164
|
+
: buttonPalette.secondaryText,
|
|
165
|
+
},
|
|
166
|
+
]}>
|
|
167
|
+
{option.label}
|
|
168
|
+
</Text>
|
|
169
|
+
</TouchableOpacity>
|
|
170
|
+
);
|
|
171
|
+
})}
|
|
172
|
+
</View>
|
|
173
|
+
</View>
|
|
174
|
+
|
|
175
|
+
<View style={[styles.formField, styles.formFieldHalf]}>
|
|
176
|
+
<Text style={styles.formLabel}>Metodo de confirmacao</Text>
|
|
177
|
+
<TextInput
|
|
178
|
+
value={storeSettingsDraft.confirmMethod}
|
|
179
|
+
onChangeText={value =>
|
|
180
|
+
setStoreSettingsDraft(current => ({ ...current, confirmMethod: sanitizeConfirmMethodInput(value) }))
|
|
181
|
+
}
|
|
182
|
+
placeholder="Ex.: 1"
|
|
183
|
+
keyboardType="number-pad"
|
|
184
|
+
maxLength={3}
|
|
185
|
+
style={styles.formInput}
|
|
186
|
+
placeholderTextColor={palette.textSecondary}
|
|
187
|
+
/>
|
|
188
|
+
</View>
|
|
189
|
+
</View>
|
|
190
|
+
|
|
191
|
+
<View style={styles.formField}>
|
|
192
|
+
<Text style={styles.formLabel}>ID da area de entrega (opcional)</Text>
|
|
193
|
+
<TextInput
|
|
194
|
+
value={storeSettingsDraft.deliveryAreaId}
|
|
195
|
+
onChangeText={value =>
|
|
196
|
+
setStoreSettingsDraft(current => ({ ...current, deliveryAreaId: value }))
|
|
197
|
+
}
|
|
198
|
+
placeholder="Usa automaticamente a primeira area quando vazio"
|
|
199
|
+
style={styles.formInput}
|
|
200
|
+
placeholderTextColor={palette.textSecondary}
|
|
201
|
+
/>
|
|
202
|
+
</View>
|
|
203
|
+
|
|
204
|
+
<View style={styles.formField}>
|
|
205
|
+
<View style={styles.formFieldHeaderRow}>
|
|
206
|
+
<Text style={styles.formLabel}>Carteira de repasse</Text>
|
|
207
|
+
<TouchableOpacity
|
|
208
|
+
onPress={onQuickCreateWallet}
|
|
209
|
+
style={[
|
|
210
|
+
styles.inlineAction,
|
|
211
|
+
{
|
|
212
|
+
borderWidth: 1,
|
|
213
|
+
borderColor: buttonPalette.secondaryBorder,
|
|
214
|
+
backgroundColor: buttonPalette.secondaryBackground,
|
|
215
|
+
},
|
|
216
|
+
]}>
|
|
217
|
+
<Icon
|
|
218
|
+
name="plus"
|
|
219
|
+
size={14}
|
|
220
|
+
color={buttonPalette.secondaryIcon}
|
|
221
|
+
/>
|
|
222
|
+
<Text
|
|
223
|
+
style={[
|
|
224
|
+
styles.inlineActionText,
|
|
225
|
+
{ color: buttonPalette.secondaryText },
|
|
226
|
+
]}>
|
|
227
|
+
Cadastro rapido
|
|
228
|
+
</Text>
|
|
229
|
+
</TouchableOpacity>
|
|
230
|
+
</View>
|
|
231
|
+
<View style={styles.pickerWrap}>
|
|
232
|
+
<Picker
|
|
233
|
+
selectedValue={storeSettingsDraft.settlementWalletId}
|
|
234
|
+
mode={Platform.OS === 'android' ? 'dropdown' : undefined}
|
|
235
|
+
onValueChange={value =>
|
|
236
|
+
setStoreSettingsDraft(current => ({ ...current, settlementWalletId: String(value || '') }))
|
|
237
|
+
}
|
|
238
|
+
enabled={!walletLoading && Array.isArray(wallets) && wallets.length > 0}
|
|
239
|
+
style={styles.picker}>
|
|
240
|
+
<Picker.Item
|
|
241
|
+
label={
|
|
242
|
+
walletLoading
|
|
243
|
+
? 'Carregando carteiras...'
|
|
244
|
+
: Array.isArray(wallets) && wallets.length === 0
|
|
245
|
+
? 'Nenhuma carteira cadastrada'
|
|
246
|
+
: 'Selecione uma carteira'
|
|
247
|
+
}
|
|
248
|
+
value=""
|
|
249
|
+
/>
|
|
250
|
+
{(Array.isArray(wallets) ? wallets : []).map(wallet => (
|
|
251
|
+
<Picker.Item
|
|
252
|
+
key={wallet.id}
|
|
253
|
+
label={`${wallet.wallet || 'Carteira'} (#${wallet.id})`}
|
|
254
|
+
value={String(wallet.id)}
|
|
255
|
+
/>
|
|
256
|
+
))}
|
|
257
|
+
</Picker>
|
|
258
|
+
</View>
|
|
259
|
+
<Text style={styles.formHint}>
|
|
260
|
+
A carteira selecionada recebe o repasse semanal do 99Food e precisa pertencer a empresa ativa.
|
|
261
|
+
</Text>
|
|
262
|
+
</View>
|
|
263
|
+
</View>
|
|
264
|
+
|
|
265
|
+
<View style={styles.actionRow}>
|
|
266
|
+
<TouchableOpacity
|
|
267
|
+
style={[
|
|
268
|
+
styles.primaryButton,
|
|
269
|
+
{
|
|
270
|
+
borderWidth: 1,
|
|
271
|
+
borderColor: buttonPalette.primaryBorder,
|
|
272
|
+
backgroundColor: buttonPalette.primaryBackground,
|
|
273
|
+
},
|
|
274
|
+
actionLoading === 'save-settings' && {
|
|
275
|
+
borderColor: buttonPalette.secondaryBorder,
|
|
276
|
+
backgroundColor: buttonPalette.disabledBackground,
|
|
277
|
+
},
|
|
278
|
+
]}
|
|
279
|
+
onPress={onSave}
|
|
280
|
+
disabled={actionLoading === 'save-settings'}>
|
|
281
|
+
{actionLoading === 'save-settings' ? (
|
|
282
|
+
<ActivityIndicator
|
|
283
|
+
size="small"
|
|
284
|
+
color={buttonPalette.disabledText}
|
|
285
|
+
/>
|
|
286
|
+
) : (
|
|
287
|
+
<>
|
|
288
|
+
<Icon
|
|
289
|
+
name="save"
|
|
290
|
+
size={16}
|
|
291
|
+
color={buttonPalette.primaryIcon}
|
|
292
|
+
/>
|
|
293
|
+
<Text
|
|
294
|
+
style={[
|
|
295
|
+
styles.primaryButtonText,
|
|
296
|
+
{ color: buttonPalette.primaryText },
|
|
297
|
+
]}>
|
|
298
|
+
Salvar configuracoes
|
|
299
|
+
</Text>
|
|
300
|
+
</>
|
|
301
|
+
)}
|
|
302
|
+
</TouchableOpacity>
|
|
303
|
+
</View>
|
|
304
|
+
</View>
|
|
305
|
+
);
|
|
306
|
+
}
|