@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.
Files changed (66) hide show
  1. package/.release/rc-manifest.json +12 -5
  2. package/package.json +6 -2
  3. package/src/react/components/CategoryForm.js +539 -539
  4. package/src/react/components/DefaultProvider.native.js +2 -2
  5. package/src/react/components/DefaultProvider.web.js +2 -2
  6. package/src/react/components/LinkedOrderProductsTab.js +17 -8
  7. package/src/react/components/LinkedOrderProductsTab.styles.js +15 -0
  8. package/src/react/components/documentDetails/DocumentDetailsShell.js +147 -0
  9. package/src/react/components/documentDetails/DocumentDetailsShell.styles.js +163 -0
  10. package/src/react/components/documentDetails/DocumentSheet.js +87 -0
  11. package/src/react/components/integrations/IntegrationHero/index.js +1 -1
  12. package/src/react/components/integrations/IntegrationHero/styles.js +2 -2
  13. package/src/react/components/integrations/IntegrationTabs/index.js +1 -1
  14. package/src/react/components/integrations/IntegrationTabs/styles.js +1 -1
  15. package/src/react/hooks/useLinkedOrderSummary.js +41 -0
  16. package/src/react/pages/Connections.styles.js +72 -72
  17. package/src/react/pages/Devices/detail/DeviceDetailHeader.js +1 -1
  18. package/src/react/pages/Devices/detail/DeviceDetailMovementSections.js +1 -1
  19. package/src/react/pages/Devices/detail/useDeviceDetailStateA.js +2 -2
  20. package/src/react/pages/Devices/detail/useDeviceDetailStateB.js +2 -2
  21. package/src/react/pages/Devices/deviceTypes/DeviceGroupCard.js +1 -1
  22. package/src/react/pages/Devices/deviceTypes/shared.js +2 -2
  23. package/src/react/pages/Devices.js +2 -2
  24. package/src/react/pages/Devices.styles.js +353 -353
  25. package/src/react/pages/Food99IntegrationPage/components/Food99CatalogTab.js +219 -219
  26. package/src/react/pages/Food99IntegrationPage/components/Food99OverviewTab.js +134 -134
  27. package/src/react/pages/Food99IntegrationPage/components/Food99PreviewModal.js +173 -173
  28. package/src/react/pages/Food99IntegrationPage/components/Food99QuickWalletModal.js +1 -1
  29. package/src/react/pages/Food99IntegrationPage/components/Food99SettingsTab.js +306 -306
  30. package/src/react/pages/Food99IntegrationPage/components/Food99StoreTab.js +417 -417
  31. package/src/react/pages/Food99IntegrationPage/index.js +1530 -1530
  32. package/src/react/pages/Food99IntegrationPage/styles.js +792 -792
  33. package/src/react/pages/IFoodIntegrationPage/components/IFoodOperationsTab.js +267 -267
  34. package/src/react/pages/IFoodIntegrationPage/components/IFoodOverviewTab.js +118 -118
  35. package/src/react/pages/IFoodIntegrationPage/components/IFoodPreviewModal.js +101 -101
  36. package/src/react/pages/IFoodIntegrationPage/components/IFoodStoreTab.js +150 -150
  37. package/src/react/pages/IFoodIntegrationPage/index.js +1298 -1298
  38. package/src/react/pages/Imports.js +1 -1
  39. package/src/react/pages/Imports.styles.js +223 -223
  40. package/src/react/pages/IntegrationConfigPage.js +2 -2
  41. package/src/react/pages/Integrations.js +2 -15
  42. package/src/react/pages/Integrations.styles.js +130 -130
  43. package/src/react/pages/LinkedInIntegrationPage.js +2 -2
  44. package/src/react/pages/ManagerOrderNotificationsPage.js +642 -642
  45. package/src/react/pages/MarketplaceIntegrationPage/components/MarketplaceProductCard.js +205 -205
  46. package/src/react/pages/MercadoLivreIntegrationPage.js +2 -2
  47. package/src/react/pages/PrinterDeviceDetailPage.js +1915 -1915
  48. package/src/react/pages/PrinterDeviceFormPage.js +2 -2
  49. package/src/react/pages/WhatsAppConnectionPage.styles.js +315 -279
  50. package/src/react/pages/WhatsAppProviderForm.js +1 -1
  51. package/src/react/pages/whatsAppConnectionHelpers.js +38 -10
  52. package/src/react/router/__tests__/publicRoutes.test.js +12 -0
  53. package/src/react/router/publicRoutes.js +3 -0
  54. package/src/react/utils/clientPortfolioParams.js +42 -0
  55. package/src/react/utils/commercialDocumentOrders.js +13 -20
  56. package/src/react/utils/documentFileContent.js +61 -0
  57. package/src/react/utils/fileUrl.js +1 -1
  58. package/src/react/utils/linkedOrderPayload.js +43 -0
  59. package/src/react/utils/orderProductsSummary.js +28 -0
  60. package/src/react/utils/peopleDisplay.js +8 -13
  61. package/src/store/connections/customActions.js +16 -14
  62. package/src/store/connections/index.js +109 -105
  63. package/src/tests/react/utils/clientPortfolioParams.test.js +30 -0
  64. package/src/tests/react/utils/documentFileContent.test.js +29 -0
  65. package/src/tests/react/utils/linkedOrderPayload.test.js +46 -0
  66. package/src/tests/react/utils/orderProductsSummary.test.js +24 -0
@@ -1,450 +1,450 @@
1
- import React, { useState, useEffect, useImperativeHandle, forwardRef, useMemo } from 'react';
2
-
3
- import {
4
- View,
5
- Text,
6
- TextInput,
7
- TouchableOpacity,
8
- ScrollView,
9
- FlatList,
10
- Modal,
11
- } from 'react-native';
12
-
1
+ import React, { useState, useEffect, useImperativeHandle, forwardRef, useMemo } from 'react';
2
+
3
+ import {
4
+ View,
5
+ Text,
6
+ TextInput,
7
+ TouchableOpacity,
8
+ ScrollView,
9
+ FlatList,
10
+ Modal,
11
+ } from 'react-native';
12
+
13
13
  import { MaterialCommunityIcons } from '@expo/vector-icons';
14
14
  import { useStore } from '@store';
15
- import { colors } from '@controleonline/../../src/styles/colors';
16
- import { resolveThemePalette } from '@controleonline/../../src/styles/branding';
15
+ import { colors } from '@controleonline/ui-layout/src/styles/colors';
16
+ import { resolveThemePalette } from '@controleonline/ui-layout/src/styles/branding';
17
17
  import styles from './CategoryForm.styles';
18
18
  import { inlineStyle_240_75 } from './CategoryForm.styles';
19
-
20
- /* ─── Paleta de cores predefinidas ─── */
21
- const PRESET_COLORS = [
22
- '#c10015', '#F97316', '#e67e22', '#84CC16', '#10b981',
23
- '#14B8A6', '#06B6D4', '#3B82F6', '#6366F1', '#8B5CF6',
24
- '#EC4899', '#F43F5E', '#64748B', '#0F172A', '#FFFFFF',
25
- '#FCA5A5', '#FED7AA', '#FEF08A', '#BBF7D0', '#A7F3D0',
26
- '#99F6E4', '#BAE6FD', '#BFDBFE', '#C7D2FE', '#DDD6FE',
27
- '#FBCFE8', '#FDA4AF', '#CBD5E1', '#475569', '#1E293B',
28
- ];
29
-
30
- /* ─── Ícones curados para categorias ─── */
31
- const CATEGORY_ICONS = [
32
- { name: 'food', label: 'Comida' },
33
- { name: 'food-variant', label: 'Prato' },
34
- { name: 'silverware-fork-knife', label: 'Talheres' },
35
- { name: 'pizza', label: 'Pizza' },
36
- { name: 'hamburger', label: 'Hambúrguer' },
37
- { name: 'noodles', label: 'Massa' },
38
- { name: 'rice', label: 'Arroz' },
39
- { name: 'bread-slice', label: 'Pão' },
40
- { name: 'fish', label: 'Peixe' },
41
- { name: 'egg-fried', label: 'Ovo' },
42
- { name: 'cheese', label: 'Queijo' },
43
- { name: 'sausage', label: 'Linguiça' },
44
- { name: 'corn', label: 'Milho' },
45
- { name: 'carrot', label: 'Cenoura' },
46
- { name: 'chili-mild', label: 'Tempero' },
47
- { name: 'shaker', label: 'Molho' },
48
- { name: 'leaf', label: 'Vegetal' },
49
- { name: 'sprout', label: 'Salada' },
50
- { name: 'mushroom', label: 'Cogumelo' },
51
- { name: 'fruit-watermelon', label: 'Fruta' },
52
- { name: 'fruit-cherries', label: 'Frutas' },
53
- { name: 'pot-steam', label: 'Panela' },
54
- { name: 'fire', label: 'Churrasco' },
55
- { name: 'grill', label: 'Grill' },
56
- { name: 'coffee', label: 'Café' },
57
- { name: 'tea', label: 'Chá' },
58
- { name: 'cup', label: 'Xícara' },
59
- { name: 'bottle-soda', label: 'Refrigerante' },
60
- { name: 'beer', label: 'Cerveja' },
61
- { name: 'glass-wine', label: 'Vinho' },
62
- { name: 'glass-cocktail', label: 'Drinque' },
63
- { name: 'water', label: 'Água' },
64
- { name: 'blender', label: 'Vitamina' },
65
- { name: 'ice-cream', label: 'Sorvete' },
66
- { name: 'candy', label: 'Doce' },
67
- { name: 'cake-variant', label: 'Bolo' },
68
- { name: 'cookie', label: 'Biscoito' },
69
- { name: 'cupcake', label: 'Cupcake' },
70
- { name: 'silverware-spoon', label: 'Sobremesa' },
71
- { name: 'nutrition', label: 'Nutrição' },
72
- { name: 'bottle-tonic', label: 'Suplemento' },
73
- { name: 'weight', label: 'Fitness' },
74
- { name: 'dumbbell', label: 'Academia' },
75
- { name: 'storefront-outline', label: 'Loja' },
76
- { name: 'shopping-outline', label: 'Compras' },
77
- { name: 'tag-outline', label: 'Promoção' },
78
- { name: 'star-outline', label: 'Destaque' },
79
- { name: 'heart-outline', label: 'Favorito' },
80
- { name: 'package-variant-closed', label: 'Pacote' },
81
- { name: 'bicycle', label: 'Delivery' },
82
- { name: 'motorbike', label: 'Moto' },
83
- { name: 'percent', label: 'Desconto' },
84
- { name: 'new-box', label: 'Novidade' },
85
- { name: 'flask-outline', label: 'Especial' },
86
- { name: 'spa-outline', label: 'Bem-estar' },
87
- { name: 'baby-bottle-outline', label: 'Bebê' },
88
- { name: 'bowl-mix', label: 'Tigela' },
89
- { name: 'french-fries', label: 'Batata' },
90
- { name: 'taco', label: 'Taco' },
91
- { name: 'food-apple', label: 'Maçã' },
92
- { name: 'weather-sunny', label: 'Dia' },
93
- { name: 'moon-waning-crescent', label: 'Noite' },
94
- ];
95
-
96
- /* ─── Canais disponíveis ─── */
97
- const CHANNELS = [
98
- { key: 'default', label: 'Balcão', icon: 'storefront-outline' },
99
- { key: 'totem', label: 'Totem', icon: 'monitor' },
100
- { key: 'delivery', label: 'Delivery', icon: 'bicycle' },
101
- { key: 'ifood', label: 'iFood', icon: 'food-fork-drink' },
102
- { key: '99food', label: '99Food', icon: 'food-variant' },
103
- { key: 'whatsapp', label: 'WhatsApp', icon: 'whatsapp' },
104
- { key: 'instagram', label: 'Instagram', icon: 'instagram' },
105
- { key: 'keeta', label: 'Keeta', icon: 'motorbike' },
106
- { key: 'messenger', label: 'Messenger', icon: 'facebook-messenger' },
107
- ];
108
-
109
- /* ─── Modal genérico bottom-sheet ─── */
110
- const BottomModal = ({ visible, onClose, title, children }) => (
111
- <Modal
112
- visible={visible}
113
- transparent
114
- animationType="slide"
115
- onRequestClose={onClose}
116
- >
117
- <TouchableOpacity
118
- style={styles.modalOverlay}
119
- activeOpacity={1}
120
- onPress={onClose}
121
- />
122
- <View style={styles.modalSheet}>
123
- <View style={styles.modalHandle} />
124
- <View style={styles.modalHeader}>
125
- <Text style={styles.modalTitle}>{title}</Text>
126
- <TouchableOpacity onPress={onClose} style={styles.modalClose}>
127
- <MaterialCommunityIcons name="close" size={20} color="#64748B" />
128
- </TouchableOpacity>
129
- </View>
130
- {children}
131
- </View>
132
- </Modal>
133
- );
134
-
135
- /* ─── Seletor de cor ─── */
19
+
20
+ /* ─── Paleta de cores predefinidas ─── */
21
+ const PRESET_COLORS = [
22
+ '#c10015', '#F97316', '#e67e22', '#84CC16', '#10b981',
23
+ '#14B8A6', '#06B6D4', '#3B82F6', '#6366F1', '#8B5CF6',
24
+ '#EC4899', '#F43F5E', '#64748B', '#0F172A', '#FFFFFF',
25
+ '#FCA5A5', '#FED7AA', '#FEF08A', '#BBF7D0', '#A7F3D0',
26
+ '#99F6E4', '#BAE6FD', '#BFDBFE', '#C7D2FE', '#DDD6FE',
27
+ '#FBCFE8', '#FDA4AF', '#CBD5E1', '#475569', '#1E293B',
28
+ ];
29
+
30
+ /* ─── Ícones curados para categorias ─── */
31
+ const CATEGORY_ICONS = [
32
+ { name: 'food', label: 'Comida' },
33
+ { name: 'food-variant', label: 'Prato' },
34
+ { name: 'silverware-fork-knife', label: 'Talheres' },
35
+ { name: 'pizza', label: 'Pizza' },
36
+ { name: 'hamburger', label: 'Hambúrguer' },
37
+ { name: 'noodles', label: 'Massa' },
38
+ { name: 'rice', label: 'Arroz' },
39
+ { name: 'bread-slice', label: 'Pão' },
40
+ { name: 'fish', label: 'Peixe' },
41
+ { name: 'egg-fried', label: 'Ovo' },
42
+ { name: 'cheese', label: 'Queijo' },
43
+ { name: 'sausage', label: 'Linguiça' },
44
+ { name: 'corn', label: 'Milho' },
45
+ { name: 'carrot', label: 'Cenoura' },
46
+ { name: 'chili-mild', label: 'Tempero' },
47
+ { name: 'shaker', label: 'Molho' },
48
+ { name: 'leaf', label: 'Vegetal' },
49
+ { name: 'sprout', label: 'Salada' },
50
+ { name: 'mushroom', label: 'Cogumelo' },
51
+ { name: 'fruit-watermelon', label: 'Fruta' },
52
+ { name: 'fruit-cherries', label: 'Frutas' },
53
+ { name: 'pot-steam', label: 'Panela' },
54
+ { name: 'fire', label: 'Churrasco' },
55
+ { name: 'grill', label: 'Grill' },
56
+ { name: 'coffee', label: 'Café' },
57
+ { name: 'tea', label: 'Chá' },
58
+ { name: 'cup', label: 'Xícara' },
59
+ { name: 'bottle-soda', label: 'Refrigerante' },
60
+ { name: 'beer', label: 'Cerveja' },
61
+ { name: 'glass-wine', label: 'Vinho' },
62
+ { name: 'glass-cocktail', label: 'Drinque' },
63
+ { name: 'water', label: 'Água' },
64
+ { name: 'blender', label: 'Vitamina' },
65
+ { name: 'ice-cream', label: 'Sorvete' },
66
+ { name: 'candy', label: 'Doce' },
67
+ { name: 'cake-variant', label: 'Bolo' },
68
+ { name: 'cookie', label: 'Biscoito' },
69
+ { name: 'cupcake', label: 'Cupcake' },
70
+ { name: 'silverware-spoon', label: 'Sobremesa' },
71
+ { name: 'nutrition', label: 'Nutrição' },
72
+ { name: 'bottle-tonic', label: 'Suplemento' },
73
+ { name: 'weight', label: 'Fitness' },
74
+ { name: 'dumbbell', label: 'Academia' },
75
+ { name: 'storefront-outline', label: 'Loja' },
76
+ { name: 'shopping-outline', label: 'Compras' },
77
+ { name: 'tag-outline', label: 'Promoção' },
78
+ { name: 'star-outline', label: 'Destaque' },
79
+ { name: 'heart-outline', label: 'Favorito' },
80
+ { name: 'package-variant-closed', label: 'Pacote' },
81
+ { name: 'bicycle', label: 'Delivery' },
82
+ { name: 'motorbike', label: 'Moto' },
83
+ { name: 'percent', label: 'Desconto' },
84
+ { name: 'new-box', label: 'Novidade' },
85
+ { name: 'flask-outline', label: 'Especial' },
86
+ { name: 'spa-outline', label: 'Bem-estar' },
87
+ { name: 'baby-bottle-outline', label: 'Bebê' },
88
+ { name: 'bowl-mix', label: 'Tigela' },
89
+ { name: 'french-fries', label: 'Batata' },
90
+ { name: 'taco', label: 'Taco' },
91
+ { name: 'food-apple', label: 'Maçã' },
92
+ { name: 'weather-sunny', label: 'Dia' },
93
+ { name: 'moon-waning-crescent', label: 'Noite' },
94
+ ];
95
+
96
+ /* ─── Canais disponíveis ─── */
97
+ const CHANNELS = [
98
+ { key: 'default', label: 'Balcão', icon: 'storefront-outline' },
99
+ { key: 'totem', label: 'Totem', icon: 'monitor' },
100
+ { key: 'delivery', label: 'Delivery', icon: 'bicycle' },
101
+ { key: 'ifood', label: 'iFood', icon: 'food-fork-drink' },
102
+ { key: '99food', label: '99Food', icon: 'food-variant' },
103
+ { key: 'whatsapp', label: 'WhatsApp', icon: 'whatsapp' },
104
+ { key: 'instagram', label: 'Instagram', icon: 'instagram' },
105
+ { key: 'keeta', label: 'Keeta', icon: 'motorbike' },
106
+ { key: 'messenger', label: 'Messenger', icon: 'facebook-messenger' },
107
+ ];
108
+
109
+ /* ─── Modal genérico bottom-sheet ─── */
110
+ const BottomModal = ({ visible, onClose, title, children }) => (
111
+ <Modal
112
+ visible={visible}
113
+ transparent
114
+ animationType="slide"
115
+ onRequestClose={onClose}
116
+ >
117
+ <TouchableOpacity
118
+ style={styles.modalOverlay}
119
+ activeOpacity={1}
120
+ onPress={onClose}
121
+ />
122
+ <View style={styles.modalSheet}>
123
+ <View style={styles.modalHandle} />
124
+ <View style={styles.modalHeader}>
125
+ <Text style={styles.modalTitle}>{title}</Text>
126
+ <TouchableOpacity onPress={onClose} style={styles.modalClose}>
127
+ <MaterialCommunityIcons name="close" size={20} color="#64748B" />
128
+ </TouchableOpacity>
129
+ </View>
130
+ {children}
131
+ </View>
132
+ </Modal>
133
+ );
134
+
135
+ /* ─── Seletor de cor ─── */
136
136
  const ColorPicker = ({ defaultColor = '#CBD5E1', value, onChange }) => {
137
137
  const [open, setOpen] = useState(false);
138
138
  const [hexInput, setHexInput] = useState(value || defaultColor);
139
139
 
140
140
  useEffect(() => { setHexInput(value || defaultColor); }, [defaultColor, value]);
141
-
142
- const applyHex = () => {
143
- const v = hexInput.startsWith('#') ? hexInput : `#${hexInput}`;
144
- if (/^#[0-9A-Fa-f]{6}$/.test(v)) {
145
- onChange(v);
146
- setOpen(false);
147
- }
148
- };
149
-
150
- return (
151
- <>
152
- <TouchableOpacity
153
- style={styles.colorButton}
154
- onPress={() => setOpen(true)}
155
- activeOpacity={0.7}
156
- >
141
+
142
+ const applyHex = () => {
143
+ const v = hexInput.startsWith('#') ? hexInput : `#${hexInput}`;
144
+ if (/^#[0-9A-Fa-f]{6}$/.test(v)) {
145
+ onChange(v);
146
+ setOpen(false);
147
+ }
148
+ };
149
+
150
+ return (
151
+ <>
152
+ <TouchableOpacity
153
+ style={styles.colorButton}
154
+ onPress={() => setOpen(true)}
155
+ activeOpacity={0.7}
156
+ >
157
157
  <View style={[styles.colorSwatch, { backgroundColor: value || defaultColor }]} />
158
158
  <Text style={styles.colorButtonText}>{value || defaultColor}</Text>
159
- <MaterialCommunityIcons name="palette-outline" size={18} color="#94A3B8" />
160
- </TouchableOpacity>
161
-
162
- <BottomModal visible={open} onClose={() => setOpen(false)} title="Escolher cor">
163
- <ScrollView contentContainerStyle={styles.colorGrid} showsVerticalScrollIndicator={false}>
164
- {PRESET_COLORS.map(c => {
165
- const selected = (value || '').toLowerCase() === c.toLowerCase();
166
- return (
167
- <TouchableOpacity
168
- key={c}
169
- onPress={() => { onChange(c); setOpen(false); }}
170
- activeOpacity={0.75}
171
- style={styles.colorCell}
172
- >
173
- <View style={[
174
- styles.colorCircle,
175
- { backgroundColor: c },
176
- c === '#FFFFFF' && styles.colorCircleWhite,
177
- selected && styles.colorCircleSelected,
178
- ]}>
179
- {selected && (
180
- <MaterialCommunityIcons
181
- name="check"
182
- size={16}
183
- color={c === '#FFFFFF' || c === '#FEF08A' || c === '#BBF7D0' || c === '#FED7AA' ? '#0F172A' : '#fff'}
184
- />
185
- )}
186
- </View>
187
- </TouchableOpacity>
188
- );
189
- })}
190
- </ScrollView>
191
-
192
- <View style={styles.hexInputRow}>
193
- <View style={[styles.colorSwatch, { backgroundColor: hexInput.startsWith('#') && hexInput.length >= 7 ? hexInput : '#ccc' }]} />
194
- <TextInput
195
- value={hexInput}
196
- onChangeText={setHexInput}
197
- style={styles.hexInput}
198
- placeholder="#000000"
199
- placeholderTextColor="#CBD5E1"
200
- maxLength={7}
201
- autoCapitalize="characters"
202
- />
203
- <TouchableOpacity style={styles.hexApplyBtn} onPress={applyHex} activeOpacity={0.8}>
204
- <Text style={styles.hexApplyText}>OK</Text>
205
- </TouchableOpacity>
206
- </View>
207
- </BottomModal>
208
- </>
209
- );
210
- };
211
-
212
- /* ─── Seletor de ícone ─── */
213
- const IconPicker = ({ value, onChange }) => {
214
- const [open, setOpen] = useState(false);
215
- const [search, setSearch] = useState('');
216
-
217
- const filtered = useMemo(() => {
218
- const q = search.toLowerCase().trim();
219
- if (!q) return CATEGORY_ICONS;
220
- return CATEGORY_ICONS.filter(
221
- ic => ic.name.includes(q) || ic.label.toLowerCase().includes(q),
222
- );
223
- }, [search]);
224
-
225
- return (
226
- <>
227
- <TouchableOpacity
228
- style={styles.iconButton}
229
- onPress={() => setOpen(true)}
230
- activeOpacity={0.7}
231
- >
232
- {value ? (
233
- <MaterialCommunityIcons name={value} size={22} color="#0F172A" />
234
- ) : (
235
- <MaterialCommunityIcons name="image-outline" size={22} color="#CBD5E1" />
236
- )}
237
- <Text style={[styles.iconButtonText, !value && { color: '#CBD5E1' }]}>
238
- {value || 'Selecionar ícone'}
239
- </Text>
240
- <MaterialCommunityIcons name="chevron-down" size={18} color="#94A3B8" />
241
- </TouchableOpacity>
242
- <BottomModal visible={open} onClose={() => { setOpen(false); setSearch(''); }} title="Selecionar ícone">
243
- <View style={styles.iconSearchWrap}>
244
- <MaterialCommunityIcons name="magnify" size={18} color="#94A3B8" style={inlineStyle_240_75} />
245
- <TextInput
246
- value={search}
247
- onChangeText={setSearch}
248
- placeholder="Pesquisar..."
249
- placeholderTextColor="#CBD5E1"
250
- style={styles.iconSearchInput}
251
- />
252
- {!!search && (
253
- <TouchableOpacity onPress={() => setSearch('')}>
254
- <MaterialCommunityIcons name="close-circle" size={16} color="#94A3B8" />
255
- </TouchableOpacity>
256
- )}
257
- </View>
258
-
259
- {/* Opção "Nenhum" */}
260
- <TouchableOpacity
261
- style={styles.iconNoneRow}
262
- onPress={() => { onChange(''); setOpen(false); setSearch(''); }}
263
- activeOpacity={0.7}
264
- >
265
- <View style={styles.iconNoneCircle}>
266
- <MaterialCommunityIcons name="close" size={16} color="#94A3B8" />
267
- </View>
268
- <Text style={styles.iconNoneText}>Nenhum ícone</Text>
269
- {!value && <MaterialCommunityIcons name="check-circle" size={18} color="#10b981" />}
270
- </TouchableOpacity>
271
-
272
- <FlatList
273
- data={filtered}
274
- keyExtractor={item => item.name}
275
- numColumns={5}
276
- style={styles.iconList}
277
- contentContainerStyle={styles.iconGrid}
278
- showsVerticalScrollIndicator={false}
279
- keyboardShouldPersistTaps="handled"
280
- renderItem={({ item }) => {
281
- const selected = value === item.name;
282
- return (
283
- <TouchableOpacity
284
- style={[styles.iconCell, selected && styles.iconCellSelected]}
285
- onPress={() => { onChange(item.name); setOpen(false); setSearch(''); }}
286
- activeOpacity={0.7}
287
- >
288
- <MaterialCommunityIcons
289
- name={item.name}
290
- size={24}
291
- color={selected ? '#3B82F6' : '#334155'}
292
- />
293
- <Text style={[styles.iconCellLabel, selected && styles.iconCellLabelSelected]} numberOfLines={1}>
294
- {item.label}
295
- </Text>
296
- </TouchableOpacity>
297
- );
298
- }}
299
- />
300
- </BottomModal>
301
- </>
302
- );
303
- };
304
-
305
- /* ─── Seletor de categoria pai ─── */
306
- const ParentCategoryPicker = ({ value, onChange, categories, currentId }) => {
307
- const [open, setOpen] = useState(false);
308
- const [search, setSearch] = useState('');
309
-
310
- const available = useMemo(() => {
311
- const q = search.toLowerCase().trim();
312
- return (categories || []).filter(c => {
313
- if (String(c.id) === String(currentId)) return false;
314
- if (!q) return true;
315
- return String(c.name || '').toLowerCase().includes(q);
316
- });
317
- }, [categories, currentId, search]);
318
-
319
- const selected = (categories || []).find(c => String(c.id) === String(value));
320
-
321
- return (
322
- <>
323
- <TouchableOpacity
324
- style={styles.iconButton}
325
- onPress={() => setOpen(true)}
326
- activeOpacity={0.7}
327
- >
328
- {selected?.color && (
329
- <View style={[styles.parentColorDot, { backgroundColor: selected.color }]} />
330
- )}
331
- <Text style={[styles.iconButtonText, !selected && styles.emptyPickerText]}>
332
- {selected ? selected.name : 'Nenhuma'}
333
- </Text>
334
- <MaterialCommunityIcons name="chevron-down" size={18} color="#94A3B8" />
335
- </TouchableOpacity>
336
-
337
- <BottomModal visible={open} onClose={() => { setOpen(false); setSearch(''); }} title="Categoria pai">
338
- <View style={styles.iconSearchWrap}>
339
- <MaterialCommunityIcons name="magnify" size={18} color="#94A3B8" style={styles.searchIcon} />
340
- <TextInput
341
- value={search}
342
- onChangeText={setSearch}
343
- placeholder="Pesquisar categoria..."
344
- placeholderTextColor="#CBD5E1"
345
- style={styles.iconSearchInput}
346
- />
347
- {!!search && (
348
- <TouchableOpacity onPress={() => setSearch('')}>
349
- <MaterialCommunityIcons name="close-circle" size={16} color="#94A3B8" />
350
- </TouchableOpacity>
351
- )}
352
- </View>
353
-
354
- <ScrollView style={styles.parentSearchList} showsVerticalScrollIndicator={false} keyboardShouldPersistTaps="handled">
355
- {/* Opção nenhuma */}
356
- <TouchableOpacity
357
- style={styles.parentRow}
358
- onPress={() => { onChange(null); setOpen(false); setSearch(''); }}
359
- activeOpacity={0.7}
360
- >
361
- <MaterialCommunityIcons name="close-circle-outline" size={18} color="#94A3B8" style={styles.parentLeadingIcon} />
362
- <Text style={[styles.parentRowText, styles.parentRowTextMuted]}>Nenhuma</Text>
363
- {!value && <MaterialCommunityIcons name="check-circle" size={18} color="#10b981" />}
364
- </TouchableOpacity>
365
-
366
- {available.map(cat => {
367
- const isSelected = String(cat.id) === String(value);
368
- return (
369
- <TouchableOpacity
370
- key={cat.id}
371
- style={styles.parentRow}
372
- onPress={() => { onChange(cat.id); setOpen(false); setSearch(''); }}
373
- activeOpacity={0.7}
374
- >
375
- <View style={[styles.parentColorDot, styles.parentColorDotSpacing, { backgroundColor: cat.color || '#CBD5E1' }]} />
376
- {!!cat.icon && (
377
- <MaterialCommunityIcons name={cat.icon} size={16} color="#475569" style={styles.parentIconSpacing} />
378
- )}
379
- <Text style={[styles.parentRowText, isSelected && styles.parentRowTextSelected]} numberOfLines={1}>
380
- {cat.name}
381
- </Text>
382
- {isSelected && <MaterialCommunityIcons name="check-circle" size={18} color="#3B82F6" style={styles.parentSelectedIcon} />}
383
- </TouchableOpacity>
384
- );
385
- })}
386
-
387
- {available.length === 0 && (
388
- <View style={styles.parentEmpty}>
389
- <Text style={styles.parentEmptyText}>Nenhuma categoria encontrada</Text>
390
- </View>
391
- )}
392
- </ScrollView>
393
- </BottomModal>
394
- </>
395
- );
396
- };
397
-
398
- /* ─── Seletor de canais (multi-toggle) ─── */
399
- const ChannelPicker = ({ value, onChange }) => {
400
- const selected = useMemo(() => {
401
- if (!value) return ['default'];
402
- return String(value).split(',').map(s => s.trim()).filter(Boolean);
403
- }, [value]);
404
-
405
- const toggle = key => {
406
- let next = selected.includes(key)
407
- ? selected.filter(k => k !== key)
408
- : [...selected, key];
409
- if (next.length === 0) next = ['default'];
410
- onChange(next.join(','));
411
- };
412
-
413
- return (
414
- <View style={styles.channelWrap}>
415
- {CHANNELS.map(ch => {
416
- const active = selected.includes(ch.key);
417
- return (
418
- <TouchableOpacity
419
- key={ch.key}
420
- style={[styles.channelChip, active && styles.channelChipActive]}
421
- onPress={() => toggle(ch.key)}
422
- activeOpacity={0.75}
423
- >
424
- <MaterialCommunityIcons
425
- name={ch.icon}
426
- size={14}
427
- color={active ? '#fff' : '#64748B'}
428
- style={styles.channelIcon}
429
- />
430
- <Text style={[styles.channelChipText, active && styles.channelChipTextActive]}>
431
- {ch.label}
432
- </Text>
433
- </TouchableOpacity>
434
- );
435
- })}
436
- </View>
437
- );
438
- };
439
-
440
- const normalizeCategoryContext = context =>
441
- String(context || 'products').trim().toLowerCase() || 'products';
442
-
443
- /* ─── Formulário principal ─── */
444
- const CategoryForm = forwardRef(({ category, context = 'products', onClose, onSaved }, ref) => {
445
- const categoriesStore = useStore('categories');
446
- const categoryActions = categoriesStore.actions;
447
- const categories = categoriesStore.getters.items;
159
+ <MaterialCommunityIcons name="palette-outline" size={18} color="#94A3B8" />
160
+ </TouchableOpacity>
161
+
162
+ <BottomModal visible={open} onClose={() => setOpen(false)} title="Escolher cor">
163
+ <ScrollView contentContainerStyle={styles.colorGrid} showsVerticalScrollIndicator={false}>
164
+ {PRESET_COLORS.map(c => {
165
+ const selected = (value || '').toLowerCase() === c.toLowerCase();
166
+ return (
167
+ <TouchableOpacity
168
+ key={c}
169
+ onPress={() => { onChange(c); setOpen(false); }}
170
+ activeOpacity={0.75}
171
+ style={styles.colorCell}
172
+ >
173
+ <View style={[
174
+ styles.colorCircle,
175
+ { backgroundColor: c },
176
+ c === '#FFFFFF' && styles.colorCircleWhite,
177
+ selected && styles.colorCircleSelected,
178
+ ]}>
179
+ {selected && (
180
+ <MaterialCommunityIcons
181
+ name="check"
182
+ size={16}
183
+ color={c === '#FFFFFF' || c === '#FEF08A' || c === '#BBF7D0' || c === '#FED7AA' ? '#0F172A' : '#fff'}
184
+ />
185
+ )}
186
+ </View>
187
+ </TouchableOpacity>
188
+ );
189
+ })}
190
+ </ScrollView>
191
+
192
+ <View style={styles.hexInputRow}>
193
+ <View style={[styles.colorSwatch, { backgroundColor: hexInput.startsWith('#') && hexInput.length >= 7 ? hexInput : '#ccc' }]} />
194
+ <TextInput
195
+ value={hexInput}
196
+ onChangeText={setHexInput}
197
+ style={styles.hexInput}
198
+ placeholder="#000000"
199
+ placeholderTextColor="#CBD5E1"
200
+ maxLength={7}
201
+ autoCapitalize="characters"
202
+ />
203
+ <TouchableOpacity style={styles.hexApplyBtn} onPress={applyHex} activeOpacity={0.8}>
204
+ <Text style={styles.hexApplyText}>OK</Text>
205
+ </TouchableOpacity>
206
+ </View>
207
+ </BottomModal>
208
+ </>
209
+ );
210
+ };
211
+
212
+ /* ─── Seletor de ícone ─── */
213
+ const IconPicker = ({ value, onChange }) => {
214
+ const [open, setOpen] = useState(false);
215
+ const [search, setSearch] = useState('');
216
+
217
+ const filtered = useMemo(() => {
218
+ const q = search.toLowerCase().trim();
219
+ if (!q) return CATEGORY_ICONS;
220
+ return CATEGORY_ICONS.filter(
221
+ ic => ic.name.includes(q) || ic.label.toLowerCase().includes(q),
222
+ );
223
+ }, [search]);
224
+
225
+ return (
226
+ <>
227
+ <TouchableOpacity
228
+ style={styles.iconButton}
229
+ onPress={() => setOpen(true)}
230
+ activeOpacity={0.7}
231
+ >
232
+ {value ? (
233
+ <MaterialCommunityIcons name={value} size={22} color="#0F172A" />
234
+ ) : (
235
+ <MaterialCommunityIcons name="image-outline" size={22} color="#CBD5E1" />
236
+ )}
237
+ <Text style={[styles.iconButtonText, !value && { color: '#CBD5E1' }]}>
238
+ {value || 'Selecionar ícone'}
239
+ </Text>
240
+ <MaterialCommunityIcons name="chevron-down" size={18} color="#94A3B8" />
241
+ </TouchableOpacity>
242
+ <BottomModal visible={open} onClose={() => { setOpen(false); setSearch(''); }} title="Selecionar ícone">
243
+ <View style={styles.iconSearchWrap}>
244
+ <MaterialCommunityIcons name="magnify" size={18} color="#94A3B8" style={inlineStyle_240_75} />
245
+ <TextInput
246
+ value={search}
247
+ onChangeText={setSearch}
248
+ placeholder="Pesquisar..."
249
+ placeholderTextColor="#CBD5E1"
250
+ style={styles.iconSearchInput}
251
+ />
252
+ {!!search && (
253
+ <TouchableOpacity onPress={() => setSearch('')}>
254
+ <MaterialCommunityIcons name="close-circle" size={16} color="#94A3B8" />
255
+ </TouchableOpacity>
256
+ )}
257
+ </View>
258
+
259
+ {/* Opção "Nenhum" */}
260
+ <TouchableOpacity
261
+ style={styles.iconNoneRow}
262
+ onPress={() => { onChange(''); setOpen(false); setSearch(''); }}
263
+ activeOpacity={0.7}
264
+ >
265
+ <View style={styles.iconNoneCircle}>
266
+ <MaterialCommunityIcons name="close" size={16} color="#94A3B8" />
267
+ </View>
268
+ <Text style={styles.iconNoneText}>Nenhum ícone</Text>
269
+ {!value && <MaterialCommunityIcons name="check-circle" size={18} color="#10b981" />}
270
+ </TouchableOpacity>
271
+
272
+ <FlatList
273
+ data={filtered}
274
+ keyExtractor={item => item.name}
275
+ numColumns={5}
276
+ style={styles.iconList}
277
+ contentContainerStyle={styles.iconGrid}
278
+ showsVerticalScrollIndicator={false}
279
+ keyboardShouldPersistTaps="handled"
280
+ renderItem={({ item }) => {
281
+ const selected = value === item.name;
282
+ return (
283
+ <TouchableOpacity
284
+ style={[styles.iconCell, selected && styles.iconCellSelected]}
285
+ onPress={() => { onChange(item.name); setOpen(false); setSearch(''); }}
286
+ activeOpacity={0.7}
287
+ >
288
+ <MaterialCommunityIcons
289
+ name={item.name}
290
+ size={24}
291
+ color={selected ? '#3B82F6' : '#334155'}
292
+ />
293
+ <Text style={[styles.iconCellLabel, selected && styles.iconCellLabelSelected]} numberOfLines={1}>
294
+ {item.label}
295
+ </Text>
296
+ </TouchableOpacity>
297
+ );
298
+ }}
299
+ />
300
+ </BottomModal>
301
+ </>
302
+ );
303
+ };
304
+
305
+ /* ─── Seletor de categoria pai ─── */
306
+ const ParentCategoryPicker = ({ value, onChange, categories, currentId }) => {
307
+ const [open, setOpen] = useState(false);
308
+ const [search, setSearch] = useState('');
309
+
310
+ const available = useMemo(() => {
311
+ const q = search.toLowerCase().trim();
312
+ return (categories || []).filter(c => {
313
+ if (String(c.id) === String(currentId)) return false;
314
+ if (!q) return true;
315
+ return String(c.name || '').toLowerCase().includes(q);
316
+ });
317
+ }, [categories, currentId, search]);
318
+
319
+ const selected = (categories || []).find(c => String(c.id) === String(value));
320
+
321
+ return (
322
+ <>
323
+ <TouchableOpacity
324
+ style={styles.iconButton}
325
+ onPress={() => setOpen(true)}
326
+ activeOpacity={0.7}
327
+ >
328
+ {selected?.color && (
329
+ <View style={[styles.parentColorDot, { backgroundColor: selected.color }]} />
330
+ )}
331
+ <Text style={[styles.iconButtonText, !selected && styles.emptyPickerText]}>
332
+ {selected ? selected.name : 'Nenhuma'}
333
+ </Text>
334
+ <MaterialCommunityIcons name="chevron-down" size={18} color="#94A3B8" />
335
+ </TouchableOpacity>
336
+
337
+ <BottomModal visible={open} onClose={() => { setOpen(false); setSearch(''); }} title="Categoria pai">
338
+ <View style={styles.iconSearchWrap}>
339
+ <MaterialCommunityIcons name="magnify" size={18} color="#94A3B8" style={styles.searchIcon} />
340
+ <TextInput
341
+ value={search}
342
+ onChangeText={setSearch}
343
+ placeholder="Pesquisar categoria..."
344
+ placeholderTextColor="#CBD5E1"
345
+ style={styles.iconSearchInput}
346
+ />
347
+ {!!search && (
348
+ <TouchableOpacity onPress={() => setSearch('')}>
349
+ <MaterialCommunityIcons name="close-circle" size={16} color="#94A3B8" />
350
+ </TouchableOpacity>
351
+ )}
352
+ </View>
353
+
354
+ <ScrollView style={styles.parentSearchList} showsVerticalScrollIndicator={false} keyboardShouldPersistTaps="handled">
355
+ {/* Opção nenhuma */}
356
+ <TouchableOpacity
357
+ style={styles.parentRow}
358
+ onPress={() => { onChange(null); setOpen(false); setSearch(''); }}
359
+ activeOpacity={0.7}
360
+ >
361
+ <MaterialCommunityIcons name="close-circle-outline" size={18} color="#94A3B8" style={styles.parentLeadingIcon} />
362
+ <Text style={[styles.parentRowText, styles.parentRowTextMuted]}>Nenhuma</Text>
363
+ {!value && <MaterialCommunityIcons name="check-circle" size={18} color="#10b981" />}
364
+ </TouchableOpacity>
365
+
366
+ {available.map(cat => {
367
+ const isSelected = String(cat.id) === String(value);
368
+ return (
369
+ <TouchableOpacity
370
+ key={cat.id}
371
+ style={styles.parentRow}
372
+ onPress={() => { onChange(cat.id); setOpen(false); setSearch(''); }}
373
+ activeOpacity={0.7}
374
+ >
375
+ <View style={[styles.parentColorDot, styles.parentColorDotSpacing, { backgroundColor: cat.color || '#CBD5E1' }]} />
376
+ {!!cat.icon && (
377
+ <MaterialCommunityIcons name={cat.icon} size={16} color="#475569" style={styles.parentIconSpacing} />
378
+ )}
379
+ <Text style={[styles.parentRowText, isSelected && styles.parentRowTextSelected]} numberOfLines={1}>
380
+ {cat.name}
381
+ </Text>
382
+ {isSelected && <MaterialCommunityIcons name="check-circle" size={18} color="#3B82F6" style={styles.parentSelectedIcon} />}
383
+ </TouchableOpacity>
384
+ );
385
+ })}
386
+
387
+ {available.length === 0 && (
388
+ <View style={styles.parentEmpty}>
389
+ <Text style={styles.parentEmptyText}>Nenhuma categoria encontrada</Text>
390
+ </View>
391
+ )}
392
+ </ScrollView>
393
+ </BottomModal>
394
+ </>
395
+ );
396
+ };
397
+
398
+ /* ─── Seletor de canais (multi-toggle) ─── */
399
+ const ChannelPicker = ({ value, onChange }) => {
400
+ const selected = useMemo(() => {
401
+ if (!value) return ['default'];
402
+ return String(value).split(',').map(s => s.trim()).filter(Boolean);
403
+ }, [value]);
404
+
405
+ const toggle = key => {
406
+ let next = selected.includes(key)
407
+ ? selected.filter(k => k !== key)
408
+ : [...selected, key];
409
+ if (next.length === 0) next = ['default'];
410
+ onChange(next.join(','));
411
+ };
412
+
413
+ return (
414
+ <View style={styles.channelWrap}>
415
+ {CHANNELS.map(ch => {
416
+ const active = selected.includes(ch.key);
417
+ return (
418
+ <TouchableOpacity
419
+ key={ch.key}
420
+ style={[styles.channelChip, active && styles.channelChipActive]}
421
+ onPress={() => toggle(ch.key)}
422
+ activeOpacity={0.75}
423
+ >
424
+ <MaterialCommunityIcons
425
+ name={ch.icon}
426
+ size={14}
427
+ color={active ? '#fff' : '#64748B'}
428
+ style={styles.channelIcon}
429
+ />
430
+ <Text style={[styles.channelChipText, active && styles.channelChipTextActive]}>
431
+ {ch.label}
432
+ </Text>
433
+ </TouchableOpacity>
434
+ );
435
+ })}
436
+ </View>
437
+ );
438
+ };
439
+
440
+ const normalizeCategoryContext = context =>
441
+ String(context || 'products').trim().toLowerCase() || 'products';
442
+
443
+ /* ─── Formulário principal ─── */
444
+ const CategoryForm = forwardRef(({ category, context = 'products', onClose, onSaved }, ref) => {
445
+ const categoriesStore = useStore('categories');
446
+ const categoryActions = categoriesStore.actions;
447
+ const categories = categoriesStore.getters.items;
448
448
  const peopleStore = useStore('people');
449
449
  const { currentCompany } = peopleStore.getters;
450
450
  const { colors: themeColors } = useStore('theme').getters;
@@ -456,124 +456,124 @@ const CategoryForm = forwardRef(({ category, context = 'products', onClose, onSa
456
456
  ).primary,
457
457
  [currentCompany?.theme?.colors, themeColors],
458
458
  );
459
-
460
- const [name, setName] = useState('');
461
- const [color, setColor] = useState('#CBD5E1');
462
- const [icon, setIcon] = useState('');
463
- const [parent, setParent] = useState(null);
464
- const [sortOrder, setSortOrder] = useState('');
465
- const [channel, setChannel] = useState('default');
466
-
467
- const companyIri = currentCompany?.['@id']
468
- ? String(currentCompany['@id'])
469
- : currentCompany?.id
470
- ? `/people/${String(currentCompany.id).replace(/\D/g, '')}`
471
- : null;
472
-
473
- useEffect(() => {
474
- if (category) {
475
- setName(category.name || '');
459
+
460
+ const [name, setName] = useState('');
461
+ const [color, setColor] = useState('#CBD5E1');
462
+ const [icon, setIcon] = useState('');
463
+ const [parent, setParent] = useState(null);
464
+ const [sortOrder, setSortOrder] = useState('');
465
+ const [channel, setChannel] = useState('default');
466
+
467
+ const companyIri = currentCompany?.['@id']
468
+ ? String(currentCompany['@id'])
469
+ : currentCompany?.id
470
+ ? `/people/${String(currentCompany.id).replace(/\D/g, '')}`
471
+ : null;
472
+
473
+ useEffect(() => {
474
+ if (category) {
475
+ setName(category.name || '');
476
476
  setColor(category.color || defaultColor);
477
- setIcon(category.icon || '');
478
- setParent(category.parent?.id || null);
477
+ setIcon(category.icon || '');
478
+ setParent(category.parent?.id || null);
479
479
  setSortOrder(category?.sortOrder === null || category?.sortOrder === undefined
480
480
  ? ''
481
481
  : String(category.sortOrder));
482
- setChannel(String(category?.extraData?.channel || 'default'));
483
- } else {
484
- setName('');
482
+ setChannel(String(category?.extraData?.channel || 'default'));
483
+ } else {
484
+ setName('');
485
485
  setColor(defaultColor);
486
- setIcon('');
487
- setParent(null);
488
- setSortOrder('');
489
- setChannel('default');
490
- }
486
+ setIcon('');
487
+ setParent(null);
488
+ setSortOrder('');
489
+ setChannel('default');
490
+ }
491
491
  }, [category, defaultColor]);
492
-
492
+
493
493
  const handleSubmit = async () => {
494
494
  const categoryExtraData = { ...(category?.extraData || {}) };
495
495
  delete categoryExtraData.sortOrder;
496
496
  const payload = {
497
- ...(category?.id ? { id: category.id } : {}),
498
- name,
499
- color,
500
- icon: icon || '',
501
- context: categoryContext,
502
- company: companyIri,
497
+ ...(category?.id ? { id: category.id } : {}),
498
+ name,
499
+ color,
500
+ icon: icon || '',
501
+ context: categoryContext,
502
+ company: companyIri,
503
503
  parent: parent ? `/categories/${parent}` : null,
504
504
  sortOrder: sortOrder === '' ? null : Number.parseInt(sortOrder, 10),
505
505
  extraData: {
506
506
  ...categoryExtraData,
507
507
  channel: channel || 'default',
508
508
  },
509
- };
510
-
511
- const saved = await categoryActions.save(payload);
512
-
513
- await categoryActions.getItems({
509
+ };
510
+
511
+ const saved = await categoryActions.save(payload);
512
+
513
+ await categoryActions.getItems({
514
514
  context: categoryContext,
515
515
  'order[sortOrder]': 'ASC',
516
516
  'order[name]': 'ASC',
517
517
  company: currentCompany.id,
518
- });
519
-
520
- if (onSaved) onSaved(saved);
521
- onClose();
522
- };
523
-
524
- useImperativeHandle(ref, () => ({ submit: handleSubmit }));
525
-
526
- return (
527
- <View style={styles.form}>
528
-
529
- {/* Nome */}
530
- <View style={styles.field}>
531
- <Text style={styles.label}>Nome</Text>
532
- <TextInput
533
- value={name}
534
- onChangeText={setName}
535
- style={styles.input}
536
- placeholder="Ex: Entradas, Bebidas, Sobremesas..."
537
- placeholderTextColor="#CBD5E1"
538
- />
539
- </View>
540
-
541
- {/* Cor */}
542
- <View style={styles.field}>
543
- <Text style={styles.label}>Cor</Text>
518
+ });
519
+
520
+ if (onSaved) onSaved(saved);
521
+ onClose();
522
+ };
523
+
524
+ useImperativeHandle(ref, () => ({ submit: handleSubmit }));
525
+
526
+ return (
527
+ <View style={styles.form}>
528
+
529
+ {/* Nome */}
530
+ <View style={styles.field}>
531
+ <Text style={styles.label}>Nome</Text>
532
+ <TextInput
533
+ value={name}
534
+ onChangeText={setName}
535
+ style={styles.input}
536
+ placeholder="Ex: Entradas, Bebidas, Sobremesas..."
537
+ placeholderTextColor="#CBD5E1"
538
+ />
539
+ </View>
540
+
541
+ {/* Cor */}
542
+ <View style={styles.field}>
543
+ <Text style={styles.label}>Cor</Text>
544
544
  <ColorPicker defaultColor={defaultColor} value={color} onChange={setColor} />
545
- </View>
546
-
547
- {/* Ícone */}
548
- <View style={styles.field}>
549
- <Text style={styles.label}>Ícone</Text>
550
- <IconPicker value={icon} onChange={setIcon} />
551
- </View>
552
-
553
- {/* Categoria pai */}
554
- <View style={styles.field}>
555
- <Text style={styles.label}>Categoria pai</Text>
556
- <ParentCategoryPicker
557
- value={parent}
558
- onChange={setParent}
559
- categories={categories}
560
- currentId={category?.id}
561
- />
562
- </View>
563
-
564
- {/* Ordem */}
565
- <View style={styles.field}>
566
- <Text style={styles.label}>Ordem no cardápio</Text>
567
- <TextInput
568
- value={sortOrder}
569
- onChangeText={setSortOrder}
570
- keyboardType="numeric"
571
- style={styles.input}
572
- placeholder="0"
573
- placeholderTextColor="#CBD5E1"
574
- />
575
- </View>
576
-
545
+ </View>
546
+
547
+ {/* Ícone */}
548
+ <View style={styles.field}>
549
+ <Text style={styles.label}>Ícone</Text>
550
+ <IconPicker value={icon} onChange={setIcon} />
551
+ </View>
552
+
553
+ {/* Categoria pai */}
554
+ <View style={styles.field}>
555
+ <Text style={styles.label}>Categoria pai</Text>
556
+ <ParentCategoryPicker
557
+ value={parent}
558
+ onChange={setParent}
559
+ categories={categories}
560
+ currentId={category?.id}
561
+ />
562
+ </View>
563
+
564
+ {/* Ordem */}
565
+ <View style={styles.field}>
566
+ <Text style={styles.label}>Ordem no cardápio</Text>
567
+ <TextInput
568
+ value={sortOrder}
569
+ onChangeText={setSortOrder}
570
+ keyboardType="numeric"
571
+ style={styles.input}
572
+ placeholder="0"
573
+ placeholderTextColor="#CBD5E1"
574
+ />
575
+ </View>
576
+
577
577
  {/* Vitrines */}
578
578
  <View style={styles.field}>
579
579
  <Text style={styles.label}>
@@ -581,9 +581,9 @@ const CategoryForm = forwardRef(({ category, context = 'products', onClose, onSa
581
581
  </Text>
582
582
  <ChannelPicker value={channel} onChange={setChannel} />
583
583
  </View>
584
-
585
- </View>
586
- );
587
- });
588
-
589
- export default CategoryForm;
584
+
585
+ </View>
586
+ );
587
+ });
588
+
589
+ export default CategoryForm;