@controleonline/ui-crm 1.0.42

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 (141) hide show
  1. package/.github/actions/workers/manager/action.yml +147 -0
  2. package/.github/actions/workers/qa/action.yml +44 -0
  3. package/.github/actions/workers/security/action.yml +44 -0
  4. package/.github/actions/workers/technical-documenter/action.yml +51 -0
  5. package/.github/workflows/manager-worker.yml +167 -0
  6. package/.github/workflows/publish-npm.yml +40 -0
  7. package/.github/workflows/pull-request-checks.yml +29 -0
  8. package/.scrutinizer.yml +24 -0
  9. package/AGENTS.md +56 -0
  10. package/FUNDING.yml +1 -0
  11. package/docs/technical/Cliente-Vendedor-Vinculo-e-Permissoes.md +121 -0
  12. package/docs/technical/Income-Statements-Demonstrativo.md +38 -0
  13. package/docs/technical/Oportunidades-Ordenacao-por-Data-de-Retorno.md +134 -0
  14. package/docs/technical/Propostas-Filtro-de-Status.md +147 -0
  15. package/docs/technical/Royalties-a-pagar-Franqueado.md +51 -0
  16. package/docs/technical/Visao-Vendedor-Comissoes.md +58 -0
  17. package/docs/wiki.md +1 -0
  18. package/package.json +43 -0
  19. package/scripts/validate-wiki-pointer.cjs +13 -0
  20. package/src/react/components/AnimatedModal.js +149 -0
  21. package/src/react/components/AnimatedModal.styles.js +21 -0
  22. package/src/react/components/CreateContractModal.js +151 -0
  23. package/src/react/components/CreateContractModal.styles.js +43 -0
  24. package/src/react/hooks/useToastMessage.js +59 -0
  25. package/src/react/index.js +4 -0
  26. package/src/react/pages/ModelTemplatesPage.js +1461 -0
  27. package/src/react/pages/ModelTemplatesPage.styles.js +441 -0
  28. package/src/react/pages/comissions/IncomeStatementDetailsModal.js +102 -0
  29. package/src/react/pages/comissions/IncomeStatementsFilters.js +120 -0
  30. package/src/react/pages/comissions/SellerCommissionsPage.js +368 -0
  31. package/src/react/pages/comissions/SellerCommissionsPage.styles.js +219 -0
  32. package/src/react/pages/comissions/incomeStatementsHelpers.js +233 -0
  33. package/src/react/pages/comissions/index.js +309 -0
  34. package/src/react/pages/comissions/index.styles.js +381 -0
  35. package/src/react/pages/comissions/sellerCommissionsHelpers.js +222 -0
  36. package/src/react/pages/crm/components/CrmHeader.js +117 -0
  37. package/src/react/pages/crm/components/MarketingEventsSection.js +142 -0
  38. package/src/react/pages/crm/components/MarketingEventsSection.styles.js +105 -0
  39. package/src/react/pages/crm/components/OpportunityCard.js +138 -0
  40. package/src/react/pages/crm/components/OpportunityFormModal.js +279 -0
  41. package/src/react/pages/crm/components/OpportunityList.js +113 -0
  42. package/src/react/pages/crm/components/OpportunitySkeletons.js +53 -0
  43. package/src/react/pages/crm/components/ProviderSelectModal.js +166 -0
  44. package/src/react/pages/crm/components/SelectModal.js +178 -0
  45. package/src/react/pages/crm/conversation.js +342 -0
  46. package/src/react/pages/crm/conversation.styles.js +206 -0
  47. package/src/react/pages/crm/hooks/useCrmData.js +494 -0
  48. package/src/react/pages/crm/hooks/useOpportunityForms.js +306 -0
  49. package/src/react/pages/crm/index.js +262 -0
  50. package/src/react/pages/crm/index.styles.js +13 -0
  51. package/src/react/pages/crm/marketingEventsHelpers.js +41 -0
  52. package/src/react/pages/crm/styles/card.styles.js +178 -0
  53. package/src/react/pages/crm/styles/layout.styles.js +184 -0
  54. package/src/react/pages/crm/styles/modal.styles.js +347 -0
  55. package/src/react/pages/home/index.js +559 -0
  56. package/src/react/pages/home/index.styles.js +268 -0
  57. package/src/react/pages/proposals/CreateProposalsModal.js +466 -0
  58. package/src/react/pages/proposals/CreateProposalsModal.styles.js +344 -0
  59. package/src/react/pages/proposals/CreateProposalsPickers.js +187 -0
  60. package/src/react/pages/proposals/CreateProposalsProductSection.js +117 -0
  61. package/src/react/pages/proposals/ProposalCard.js +112 -0
  62. package/src/react/pages/proposals/ProposalDetails.js +263 -0
  63. package/src/react/pages/proposals/ProposalDetails.styles.js +195 -0
  64. package/src/react/pages/proposals/index.js +488 -0
  65. package/src/react/pages/proposals/index.styles.js +248 -0
  66. package/src/react/pages/proposals/proposalListHelpers.js +216 -0
  67. package/src/react/pages/proposals/proposalNavigation.js +26 -0
  68. package/src/react/pages/royalties/ReceivablePage.js +233 -0
  69. package/src/react/pages/royalties/RoyaltiesPayablePage.js +260 -0
  70. package/src/react/pages/royalties/index.js +2 -0
  71. package/src/react/pages/royalties/royaltiesReceivableHelpers.js +68 -0
  72. package/src/react/pages/settings/GeneralSettings.js +317 -0
  73. package/src/react/pages/settings/GeneralSettings.shared.js +490 -0
  74. package/src/react/pages/settings/GeneralSettings.styles.js +746 -0
  75. package/src/react/pages/settings/GeneralSettingsSection.js +57 -0
  76. package/src/react/pages/settings/generalSettingsActiveTab.js +85 -0
  77. package/src/react/pages/settings/sections/CrmSection.js +281 -0
  78. package/src/react/pages/settings/sections/DeviceRuntimeFooterSection.js +128 -0
  79. package/src/react/pages/settings/sections/DisplayPreparationSection.js +155 -0
  80. package/src/react/pages/settings/sections/IntegrationsSection.js +392 -0
  81. package/src/react/pages/settings/sections/LogSection.js +322 -0
  82. package/src/react/pages/settings/sections/LoginSection.js +137 -0
  83. package/src/react/pages/settings/sections/LoyaltyProductPicker.js +230 -0
  84. package/src/react/pages/settings/sections/LoyaltySection.js +451 -0
  85. package/src/react/pages/settings/sections/MaintenanceSection.js +205 -0
  86. package/src/react/pages/settings/sections/MapsSection.js +629 -0
  87. package/src/react/pages/settings/sections/MenuCatalogSection.js +405 -0
  88. package/src/react/pages/settings/sections/OperationsSection.js +303 -0
  89. package/src/react/pages/settings/sections/OrderPaymentSection.js +379 -0
  90. package/src/react/pages/settings/sections/OrderPrintSection.js +308 -0
  91. package/src/react/pages/settings/sections/ShopSection.js +490 -0
  92. package/src/react/pages/settings/sections/shop/FranchiseMapPreview.js +124 -0
  93. package/src/react/pages/settings/sections/shop/ShopDomainCreateForm.js +57 -0
  94. package/src/react/pages/settings/sections/shop/ShopDomainPanel.js +184 -0
  95. package/src/react/pages/settings/sections/shop/ShopDomainShowcasesSection.js +237 -0
  96. package/src/react/pages/settings/sections/shop/ShopDomainShowcasesSection.styles.js +256 -0
  97. package/src/react/pages/settings/sections/shop/ShopDomainTabs.js +61 -0
  98. package/src/react/pages/settings/sections/shop/ShopFranchiseLocatorSection.js +526 -0
  99. package/src/react/pages/settings/sections/shop/ShopLoyaltySection.js +426 -0
  100. package/src/react/pages/settings/sections/shop/ShopSettingsSection.js +10 -0
  101. package/src/react/pages/settings/sections/shop/mapsFranchiseMapHelpers.js +163 -0
  102. package/src/react/pages/settings/sections/shop/shopDomainShowcasesUtils.js +68 -0
  103. package/src/react/pages/settings/sections/shop/shopFranchiseVisibility.js +158 -0
  104. package/src/react/pages/settings/sections/shop/shopSettingsShared.js +427 -0
  105. package/src/react/router/routes.js +135 -0
  106. package/src/react/utils/opportunityDate.js +82 -0
  107. package/src/react/utils/opportunityEditorReferences.js +76 -0
  108. package/src/react/utils/opportunityEmptyState.js +20 -0
  109. package/src/react/utils/opportunityPeople.js +111 -0
  110. package/src/react/utils/opportunityPhone.js +82 -0
  111. package/src/react/utils/opportunityStage.js +30 -0
  112. package/src/react/utils/opportunityStatusFilter.js +54 -0
  113. package/src/react/utils/proposalCreateHelpers.js +61 -0
  114. package/src/react/utils/proposalProductSelection.js +71 -0
  115. package/src/react/utils/royaltiesPayableParams.js +37 -0
  116. package/src/react/utils/translateWithFallback.js +42 -0
  117. package/src/store/crm/index.js +2 -0
  118. package/src/store/model/index.js +104 -0
  119. package/src/tests/browser/crm/create-proposal-product-category-filter.spec.js +149 -0
  120. package/src/tests/browser/crm/crm-index-status-filter.spec.js +263 -0
  121. package/src/tests/browser/crm/crm-opportunity-category-editor.spec.js +269 -0
  122. package/src/tests/browser/crm/royalties-payable.spec.js +122 -0
  123. package/src/tests/browser/crm/royalties-receivable.spec.js +121 -0
  124. package/src/tests/browser/crm/seller-commissions.spec.js +214 -0
  125. package/src/tests/browser/manager/general-settings-maps.spec.js +400 -0
  126. package/src/tests/react/pages/comissions/incomeStatementsHelpers.test.js +181 -0
  127. package/src/tests/react/pages/comissions/sellerCommissionsHelpers.test.js +132 -0
  128. package/src/tests/react/pages/crm/marketingEventsHelpers.test.cjs +53 -0
  129. package/src/tests/react/pages/crm/opportunitySearchParams.test.cjs +44 -0
  130. package/src/tests/react/pages/proposals/navigation.test.js +71 -0
  131. package/src/tests/react/pages/proposals/proposalListHelpers.test.js +42 -0
  132. package/src/tests/react/pages/royalties/royaltiesReceivableHelpers.test.js +60 -0
  133. package/src/tests/react/pages/settings/generalSettings.shared.test.js +102 -0
  134. package/src/tests/react/pages/settings/sections/shop/shopDomainShowcasesUtils.test.js +60 -0
  135. package/src/tests/react/pages/settings/sections/shop/shopFranchiseVisibility.test.js +80 -0
  136. package/src/tests/react/utils/opportunityEditorReferences.test.js +70 -0
  137. package/src/tests/react/utils/opportunityEmptyState.test.js +39 -0
  138. package/src/tests/react/utils/opportunityStatusFilter.test.cjs +81 -0
  139. package/src/tests/react/utils/proposalCreateHelpers.test.js +25 -0
  140. package/src/tests/react/utils/proposalProductSelection.test.js +76 -0
  141. package/src/tests/react/utils/royaltiesPayableParams.test.js +44 -0
@@ -0,0 +1,344 @@
1
+ import { StyleSheet } from 'react-native';
2
+
3
+ const styles = StyleSheet.create({
4
+ modalContainer: {
5
+ backgroundColor: '#FFFFFF',
6
+ borderTopLeftRadius: 24,
7
+ borderTopRightRadius: 24,
8
+ maxHeight: '92%',
9
+ width: '100%',
10
+ shadowColor: '#000',
11
+ shadowOffset: { width: 0, height: -4 },
12
+ shadowOpacity: 0.1,
13
+ shadowRadius: 12,
14
+ elevation: 10,
15
+ },
16
+ modalHeader: {
17
+ flexDirection: 'row',
18
+ justifyContent: 'space-between',
19
+ alignItems: 'center',
20
+ paddingHorizontal: 24,
21
+ paddingVertical: 20,
22
+ borderBottomWidth: 1,
23
+ borderBottomColor: '#F1F5F9',
24
+ },
25
+ modalTitle: {
26
+ fontSize: 20,
27
+ fontWeight: '700',
28
+ color: '#0F172A',
29
+ },
30
+ headerCloseButton: {
31
+ width: 32,
32
+ height: 32,
33
+ borderRadius: 16,
34
+ backgroundColor: '#F1F5F9',
35
+ alignItems: 'center',
36
+ justifyContent: 'center',
37
+ },
38
+ modalBody: {
39
+ padding: 24,
40
+ },
41
+ inputGroup: {
42
+ marginBottom: 20,
43
+ },
44
+ inputLabel: {
45
+ fontSize: 16,
46
+ fontWeight: '600',
47
+ color: '#212529',
48
+ marginBottom: 8,
49
+ },
50
+ helperText: {
51
+ fontSize: 13,
52
+ lineHeight: 18,
53
+ color: '#64748B',
54
+ },
55
+ required: {
56
+ color: '#c10015',
57
+ },
58
+ selectInput: {
59
+ flexDirection: 'row',
60
+ alignItems: 'center',
61
+ justifyContent: 'space-between',
62
+ borderWidth: 1,
63
+ borderColor: '#E9ECEF',
64
+ borderRadius: 12,
65
+ paddingHorizontal: 16,
66
+ paddingVertical: 12,
67
+ backgroundColor: '#F8F9FA',
68
+ },
69
+ selectInputContent: {
70
+ flexDirection: 'row',
71
+ alignItems: 'center',
72
+ flex: 1,
73
+ },
74
+ selectInputText: {
75
+ fontSize: 16,
76
+ flex: 1,
77
+ color: '#1A1A1A',
78
+ },
79
+ placeholderText: {
80
+ color: '#999999',
81
+ },
82
+ dateContainer: {
83
+ flexDirection: 'row',
84
+ },
85
+ selectInputDate: {
86
+ flex: 1,
87
+ flexDirection: 'row',
88
+ alignItems: 'center',
89
+ justifyContent: 'space-between',
90
+ borderWidth: 1,
91
+ borderColor: '#E9ECEF',
92
+ borderRadius: 12,
93
+ paddingHorizontal: 12,
94
+ paddingVertical: 12,
95
+ backgroundColor: '#F8F9FA',
96
+ marginRight: 8,
97
+ },
98
+ yearInput: {
99
+ flex: 1,
100
+ borderWidth: 1,
101
+ borderColor: '#E9ECEF',
102
+ borderRadius: 12,
103
+ paddingHorizontal: 12,
104
+ paddingVertical: 12,
105
+ fontSize: 16,
106
+ color: '#1A1A1A',
107
+ backgroundColor: '#F8F9FA',
108
+ textAlign: 'center',
109
+ },
110
+ productsHeader: {
111
+ flexDirection: 'row',
112
+ justifyContent: 'space-between',
113
+ alignItems: 'flex-start',
114
+ marginBottom: 10,
115
+ },
116
+ selectedCountBadge: {
117
+ minWidth: 30,
118
+ height: 30,
119
+ borderRadius: 15,
120
+ backgroundColor: '#2529a1',
121
+ alignItems: 'center',
122
+ justifyContent: 'center',
123
+ marginLeft: 12,
124
+ },
125
+ selectedCountText: {
126
+ color: '#FFFFFF',
127
+ fontWeight: '700',
128
+ },
129
+ searchBox: {
130
+ flexDirection: 'row',
131
+ alignItems: 'center',
132
+ borderWidth: 1,
133
+ borderColor: '#E2E8F0',
134
+ borderRadius: 12,
135
+ paddingHorizontal: 12,
136
+ backgroundColor: '#F8FAFC',
137
+ },
138
+ searchInput: {
139
+ flex: 1,
140
+ minHeight: 48,
141
+ fontSize: 15,
142
+ color: '#0F172A',
143
+ paddingHorizontal: 8,
144
+ },
145
+ selectedProductsWrap: {
146
+ marginTop: 12,
147
+ },
148
+ selectedProductChip: {
149
+ flexDirection: 'row',
150
+ alignItems: 'center',
151
+ borderWidth: 1,
152
+ borderColor: '#DCE4FF',
153
+ borderRadius: 12,
154
+ backgroundColor: '#F8F9FF',
155
+ paddingHorizontal: 12,
156
+ paddingVertical: 10,
157
+ marginBottom: 8,
158
+ },
159
+ selectedProductTitle: {
160
+ fontSize: 14,
161
+ fontWeight: '600',
162
+ color: '#0F172A',
163
+ },
164
+ selectedProductMeta: {
165
+ marginTop: 2,
166
+ fontSize: 12,
167
+ color: '#64748B',
168
+ },
169
+ productResultsWrap: {
170
+ marginTop: 12,
171
+ },
172
+ productRow: {
173
+ flexDirection: 'row',
174
+ alignItems: 'center',
175
+ borderWidth: 1,
176
+ borderColor: '#E2E8F0',
177
+ borderRadius: 12,
178
+ paddingHorizontal: 12,
179
+ paddingVertical: 12,
180
+ backgroundColor: '#FFFFFF',
181
+ marginBottom: 8,
182
+ },
183
+ productRowSelected: {
184
+ borderColor: '#10b981',
185
+ backgroundColor: '#F5FFF7',
186
+ },
187
+ productName: {
188
+ fontSize: 14,
189
+ fontWeight: '600',
190
+ color: '#0F172A',
191
+ },
192
+ productMeta: {
193
+ marginTop: 2,
194
+ fontSize: 12,
195
+ color: '#64748B',
196
+ },
197
+ noProductsText: {
198
+ paddingVertical: 8,
199
+ fontSize: 13,
200
+ color: '#94A3B8',
201
+ textAlign: 'center',
202
+ },
203
+ modalFooter: {
204
+ flexDirection: 'row',
205
+ padding: 20,
206
+ borderTopWidth: 1,
207
+ borderTopColor: '#E9ECEF',
208
+ },
209
+ cancelButton: {
210
+ flex: 1,
211
+ paddingVertical: 14,
212
+ borderRadius: 12,
213
+ borderWidth: 1,
214
+ borderColor: '#6C757D',
215
+ alignItems: 'center',
216
+ marginRight: 6,
217
+ },
218
+ cancelButtonText: {
219
+ fontSize: 16,
220
+ fontWeight: '600',
221
+ color: '#6C757D',
222
+ },
223
+ createButton: {
224
+ flex: 1,
225
+ paddingVertical: 14,
226
+ borderRadius: 12,
227
+ backgroundColor: '#007BFF',
228
+ alignItems: 'center',
229
+ justifyContent: 'center',
230
+ marginLeft: 6,
231
+ },
232
+ createButtonDisabled: {
233
+ backgroundColor: '#94A3B8',
234
+ },
235
+ createButtonText: {
236
+ fontSize: 16,
237
+ fontWeight: '600',
238
+ color: '#FFFFFF',
239
+ },
240
+ pickerModalOverlay: {
241
+ flex: 1,
242
+ backgroundColor: 'rgba(0,0,0,0.5)',
243
+ justifyContent: 'flex-end',
244
+ },
245
+ pickerModalContent: {
246
+ backgroundColor: '#FFFFFF',
247
+ borderTopLeftRadius: 20,
248
+ borderTopRightRadius: 20,
249
+ width: '100%',
250
+ maxHeight: '55%',
251
+ elevation: 10,
252
+ },
253
+ pickerModalHeader: {
254
+ flexDirection: 'row',
255
+ justifyContent: 'space-between',
256
+ alignItems: 'center',
257
+ paddingHorizontal: 20,
258
+ paddingVertical: 16,
259
+ borderBottomWidth: 1,
260
+ borderBottomColor: '#E9ECEF',
261
+ },
262
+ pickerModalTitle: {
263
+ fontSize: 18,
264
+ fontWeight: '600',
265
+ color: '#1A1A1A',
266
+ },
267
+ pickerModalBody: {
268
+ maxHeight: '100%',
269
+ },
270
+ selectOption: {
271
+ flexDirection: 'row',
272
+ alignItems: 'center',
273
+ paddingHorizontal: 20,
274
+ paddingVertical: 16,
275
+ borderBottomWidth: 1,
276
+ borderBottomColor: '#F1F3F4',
277
+ },
278
+ selectOptionActive: {
279
+ backgroundColor: '#F8F9FF',
280
+ },
281
+ selectOptionTextActive: {
282
+ color: '#2529a1',
283
+ fontWeight: '600',
284
+ },
285
+ optionInfo: {
286
+ flexDirection: 'row',
287
+ alignItems: 'center',
288
+ flex: 1,
289
+ },
290
+ iconContainer: {
291
+ width: 40,
292
+ height: 40,
293
+ borderRadius: 20,
294
+ backgroundColor: '#F8F9FF',
295
+ alignItems: 'center',
296
+ justifyContent: 'center',
297
+ marginRight: 12,
298
+ },
299
+ optionName: {
300
+ fontSize: 16,
301
+ color: '#1A1A1A',
302
+ },
303
+ emptyState: {
304
+ alignItems: 'center',
305
+ paddingVertical: 40,
306
+ },
307
+ emptyText: {
308
+ fontSize: 16,
309
+ color: '#999999',
310
+ marginTop: 12,
311
+ },
312
+ loadingContainer: {
313
+ alignItems: 'center',
314
+ paddingVertical: 40,
315
+ },
316
+ loadingText: {
317
+ fontSize: 16,
318
+ color: '#666666',
319
+ marginTop: 12,
320
+ },
321
+ });
322
+
323
+ export default styles;
324
+
325
+ export const inlineStyle_482_6 = {
326
+ justifyContent: 'flex-end',
327
+ };
328
+
329
+ export const inlineStyle_502_67 = {
330
+ marginRight: 8,
331
+ };
332
+
333
+ export const inlineStyle_517_71 = {
334
+ marginRight: 8,
335
+ };
336
+
337
+ export const inlineStyle_588_28 = {
338
+ flex: 1,
339
+ };
340
+
341
+ export const inlineStyle_615_26 = {
342
+ flex: 1,
343
+ };
344
+
@@ -0,0 +1,187 @@
1
+ import React from 'react';
2
+ import { Modal, ScrollView, Text, TouchableOpacity, View } from 'react-native';
3
+ import Icon from 'react-native-vector-icons/MaterialIcons';
4
+ import { getPeopleDisplayName } from '@controleonline/ui-common/src/react/utils/peopleDisplay';
5
+ import styles from './CreateProposalsModal.styles';
6
+
7
+ const { MONTHS } = require('../../utils/proposalCreateHelpers');
8
+
9
+ export const ModelSelectModal = ({
10
+ visible,
11
+ onClose,
12
+ loadingModels,
13
+ contractModels,
14
+ selectedModel,
15
+ onSelect,
16
+ }) => (
17
+ <Modal animationType="slide" transparent visible={visible} onRequestClose={onClose}>
18
+ <View style={styles.pickerModalOverlay}>
19
+ <View style={styles.pickerModalContent}>
20
+ <View style={styles.pickerModalHeader}>
21
+ <Text style={styles.pickerModalTitle}>Selecionar modelo da proposta</Text>
22
+ <TouchableOpacity onPress={onClose}>
23
+ <Icon name="close" size={24} color="#666666" />
24
+ </TouchableOpacity>
25
+ </View>
26
+ <ScrollView style={styles.pickerModalBody}>
27
+ {loadingModels ? (
28
+ <View style={styles.loadingContainer}>
29
+ <Text style={styles.loadingText}>Carregando modelos...</Text>
30
+ </View>
31
+ ) : contractModels.length > 0 ? (
32
+ contractModels.map(model => (
33
+ <TouchableOpacity
34
+ key={model['@id']}
35
+ style={[styles.selectOption, selectedModel === model['@id'] && styles.selectOptionActive]}
36
+ onPress={() => onSelect(model['@id'])}>
37
+ <View style={styles.optionInfo}>
38
+ <View style={styles.iconContainer}>
39
+ <Icon name="description" size={20} color="#2529a1" />
40
+ </View>
41
+ <Text
42
+ style={[
43
+ styles.optionName,
44
+ selectedModel === model['@id'] && styles.selectOptionTextActive,
45
+ ]}>
46
+ {model.model || model.name || 'Modelo'}
47
+ </Text>
48
+ </View>
49
+ {selectedModel === model['@id'] && (
50
+ <Icon name="check-circle" size={24} color="#10b981" />
51
+ )}
52
+ </TouchableOpacity>
53
+ ))
54
+ ) : (
55
+ <View style={styles.emptyState}>
56
+ <Icon name="description" size={48} color="#CCCCCC" />
57
+ <Text style={styles.emptyText}>Nenhum modelo encontrado.</Text>
58
+ </View>
59
+ )}
60
+ </ScrollView>
61
+ </View>
62
+ </View>
63
+ </Modal>
64
+ );
65
+
66
+ export const ClientSelectModal = ({
67
+ visible,
68
+ onClose,
69
+ people,
70
+ selectedClient,
71
+ onSelect,
72
+ }) => (
73
+ <Modal animationType="slide" transparent visible={visible} onRequestClose={onClose}>
74
+ <View style={styles.pickerModalOverlay}>
75
+ <View style={styles.pickerModalContent}>
76
+ <View style={styles.pickerModalHeader}>
77
+ <Text style={styles.pickerModalTitle}>Selecionar responsavel do cliente</Text>
78
+ <TouchableOpacity onPress={onClose}>
79
+ <Icon name="close" size={24} color="#666666" />
80
+ </TouchableOpacity>
81
+ </View>
82
+ <ScrollView style={styles.pickerModalBody}>
83
+ {people.length > 0 ? (
84
+ people.map(person => (
85
+ <TouchableOpacity
86
+ key={person['@id']}
87
+ style={[
88
+ styles.selectOption,
89
+ selectedClient === person['@id'] && styles.selectOptionActive,
90
+ ]}
91
+ onPress={() => onSelect(person['@id'])}>
92
+ <View style={styles.optionInfo}>
93
+ <View style={styles.iconContainer}>
94
+ <Icon name="person" size={20} color="#2529a1" />
95
+ </View>
96
+ <Text
97
+ style={[
98
+ styles.optionName,
99
+ selectedClient === person['@id'] && styles.selectOptionTextActive,
100
+ ]}>
101
+ {getPeopleDisplayName(person)}
102
+ </Text>
103
+ </View>
104
+ {selectedClient === person['@id'] && (
105
+ <Icon name="check-circle" size={24} color="#10b981" />
106
+ )}
107
+ </TouchableOpacity>
108
+ ))
109
+ ) : (
110
+ <View style={styles.emptyState}>
111
+ <Icon name="business" size={48} color="#CCCCCC" />
112
+ <Text style={styles.emptyText}>Nenhum cliente encontrado.</Text>
113
+ </View>
114
+ )}
115
+ </ScrollView>
116
+ </View>
117
+ </View>
118
+ </Modal>
119
+ );
120
+
121
+ export const DayPickerModal = ({ visible, onClose, startDay, onSelect }) => (
122
+ <Modal transparent visible={visible} animationType="slide" onRequestClose={onClose}>
123
+ <View style={styles.pickerModalOverlay}>
124
+ <View style={styles.pickerModalContent}>
125
+ <View style={styles.pickerModalHeader}>
126
+ <Text style={styles.pickerModalTitle}>Selecionar dia</Text>
127
+ <TouchableOpacity onPress={onClose}>
128
+ <Icon name="close" size={24} color="#666666" />
129
+ </TouchableOpacity>
130
+ </View>
131
+ <ScrollView style={styles.pickerModalBody}>
132
+ {Array.from({ length: 31 }, (_, index) => index + 1).map(day => (
133
+ <TouchableOpacity
134
+ key={day}
135
+ style={[styles.selectOption, startDay === String(day) && styles.selectOptionActive]}
136
+ onPress={() => onSelect(String(day))}>
137
+ <Text
138
+ style={[
139
+ styles.optionName,
140
+ startDay === String(day) && styles.selectOptionTextActive,
141
+ ]}>
142
+ {day}
143
+ </Text>
144
+ </TouchableOpacity>
145
+ ))}
146
+ </ScrollView>
147
+ </View>
148
+ </View>
149
+ </Modal>
150
+ );
151
+
152
+ export const MonthPickerModal = ({ visible, onClose, startMonth, onSelect }) => (
153
+ <Modal transparent visible={visible} animationType="slide" onRequestClose={onClose}>
154
+ <View style={styles.pickerModalOverlay}>
155
+ <View style={styles.pickerModalContent}>
156
+ <View style={styles.pickerModalHeader}>
157
+ <Text style={styles.pickerModalTitle}>Selecionar mes</Text>
158
+ <TouchableOpacity onPress={onClose}>
159
+ <Icon name="close" size={24} color="#666666" />
160
+ </TouchableOpacity>
161
+ </View>
162
+ <ScrollView style={styles.pickerModalBody}>
163
+ {MONTHS.map((label, index) => {
164
+ const monthValue = String(index + 1);
165
+ return (
166
+ <TouchableOpacity
167
+ key={monthValue}
168
+ style={[
169
+ styles.selectOption,
170
+ startMonth === monthValue && styles.selectOptionActive,
171
+ ]}
172
+ onPress={() => onSelect(monthValue)}>
173
+ <Text
174
+ style={[
175
+ styles.optionName,
176
+ startMonth === monthValue && styles.selectOptionTextActive,
177
+ ]}>
178
+ {label}
179
+ </Text>
180
+ </TouchableOpacity>
181
+ );
182
+ })}
183
+ </ScrollView>
184
+ </View>
185
+ </View>
186
+ </Modal>
187
+ );
@@ -0,0 +1,117 @@
1
+ import React from 'react';
2
+ import { ActivityIndicator, Text, TextInput, TouchableOpacity, View } from 'react-native';
3
+ import Icon from 'react-native-vector-icons/MaterialIcons';
4
+ import Formatter from '@controleonline/ui-common/src/utils/formatter';
5
+ import styles, {
6
+ inlineStyle_588_28,
7
+ inlineStyle_615_26,
8
+ } from './CreateProposalsModal.styles';
9
+
10
+ const CreateProposalsProductSection = ({
11
+ productQuery,
12
+ onChangeQuery,
13
+ productSearchLoading,
14
+ productResults,
15
+ selectedProducts,
16
+ selectedProductIds,
17
+ onToggleProduct,
18
+ categoryName,
19
+ normalizeEntityId,
20
+ }) => {
21
+ const helperText = categoryName
22
+ ? `Somente produtos da categoria "${categoryName}" (modelo selecionado).`
23
+ : 'Escolha os produtos que serao encaminhados agora. Voce podera ajustar depois na proposta.';
24
+
25
+ const emptyResultsLabel = categoryName
26
+ ? `Nenhum produto da categoria "${categoryName}" encontrado.`
27
+ : 'Nenhum produto disponivel para esta busca.';
28
+
29
+ return (
30
+ <View style={styles.inputGroup}>
31
+ <View style={styles.productsHeader}>
32
+ <View>
33
+ <Text style={styles.inputLabel}>Produtos da proposta</Text>
34
+ <Text style={styles.helperText}>{helperText}</Text>
35
+ </View>
36
+ <View style={styles.selectedCountBadge}>
37
+ <Text style={styles.selectedCountText}>{selectedProducts.length}</Text>
38
+ </View>
39
+ </View>
40
+
41
+ <View style={styles.searchBox}>
42
+ <Icon name="search" size={18} color="#64748B" />
43
+ <TextInput
44
+ style={styles.searchInput}
45
+ value={productQuery}
46
+ onChangeText={onChangeQuery}
47
+ placeholder={
48
+ categoryName ? `Buscar em ${categoryName}...` : 'Buscar produto da empresa...'
49
+ }
50
+ placeholderTextColor="#94A3B8"
51
+ />
52
+ {productSearchLoading && <ActivityIndicator size="small" color="#2529a1" />}
53
+ </View>
54
+
55
+ {selectedProducts.length > 0 && (
56
+ <View style={styles.selectedProductsWrap}>
57
+ {selectedProducts.map(product => {
58
+ const productId = normalizeEntityId(product);
59
+ return (
60
+ <View key={product?.['@id'] || productId} style={styles.selectedProductChip}>
61
+ <View style={inlineStyle_588_28}>
62
+ <Text style={styles.selectedProductTitle} numberOfLines={1}>
63
+ {product?.product || 'Produto'}
64
+ </Text>
65
+ <Text style={styles.selectedProductMeta} numberOfLines={1}>
66
+ {product?.sku
67
+ ? `SKU ${product.sku}`
68
+ : Formatter.formatMoney(Number(product?.price || 0))}
69
+ </Text>
70
+ </View>
71
+ <TouchableOpacity onPress={() => onToggleProduct(product)}>
72
+ <Icon name="close" size={18} color="#64748B" />
73
+ </TouchableOpacity>
74
+ </View>
75
+ );
76
+ })}
77
+ </View>
78
+ )}
79
+
80
+ <View style={styles.productResultsWrap}>
81
+ {productResults.map(product => {
82
+ const productId = normalizeEntityId(product);
83
+ const isSelected = selectedProductIds.has(productId);
84
+
85
+ return (
86
+ <TouchableOpacity
87
+ key={product?.['@id'] || productId}
88
+ style={[styles.productRow, isSelected && styles.productRowSelected]}
89
+ onPress={() => onToggleProduct(product)}>
90
+ <View style={inlineStyle_615_26}>
91
+ <Text style={styles.productRowTitle} numberOfLines={1}>
92
+ {product?.product || 'Produto'}
93
+ </Text>
94
+ <Text style={styles.productRowMeta} numberOfLines={1}>
95
+ {product?.sku
96
+ ? `SKU ${product.sku}`
97
+ : Formatter.formatMoney(Number(product?.price || 0))}
98
+ </Text>
99
+ </View>
100
+ <Icon
101
+ name={isSelected ? 'check-circle' : 'add-circle-outline'}
102
+ size={22}
103
+ color={isSelected ? '#2529a1' : '#94A3B8'}
104
+ />
105
+ </TouchableOpacity>
106
+ );
107
+ })}
108
+
109
+ {!productSearchLoading && productResults.length === 0 && (
110
+ <Text style={styles.noProductsText || styles.helperText}>{emptyResultsLabel}</Text>
111
+ )}
112
+ </View>
113
+ </View>
114
+ );
115
+ };
116
+
117
+ export default CreateProposalsProductSection;