@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,368 @@
1
+ /*
2
+ * Seller commissions view — invoices tipo `comission`.
3
+ * O vendedor recebe da empresa (resumo mensal). Não misturar com royalties.
4
+ */
5
+ import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';
6
+ import {
7
+ ActivityIndicator,
8
+ FlatList,
9
+ RefreshControl,
10
+ Text,
11
+ TextInput,
12
+ TouchableOpacity,
13
+ View,
14
+ } from 'react-native';
15
+ import {SafeAreaView} from 'react-native-safe-area-context';
16
+ import {useFocusEffect} from '@react-navigation/native';
17
+ import {useStore} from '@store';
18
+ import {api} from '@controleonline/ui-common/src/api';
19
+ import styles from './SellerCommissionsPage.styles';
20
+ import {
21
+ buildComissionRequestParams,
22
+ buildMonthOptions,
23
+ collectClientsFromInvoices,
24
+ filterInvoicesByClient,
25
+ formatCurrency,
26
+ groupCommissionsByMonth,
27
+ normalizeComissionList,
28
+ extractClientFromInvoice,
29
+ } from './sellerCommissionsHelpers';
30
+
31
+ const COMISSION_ENDPOINT = '/finance/comission';
32
+ const FALLBACK_INVOICES_ENDPOINT = '/invoices';
33
+
34
+ const SellerCommissionsPage = () => {
35
+ const peopleStore = useStore('people');
36
+ const authStore = useStore('auth');
37
+ const invoiceStore = useStore('invoice');
38
+
39
+ const peopleGetters = peopleStore?.getters || {};
40
+ const authGetters = authStore?.getters || {};
41
+ const invoiceGetters = invoiceStore?.getters || {};
42
+
43
+ const {currentCompany} = peopleGetters;
44
+ const {user} = authGetters;
45
+ const isLoadingStore = Boolean(invoiceGetters?.isLoading);
46
+ const storeError = invoiceGetters?.error || null;
47
+
48
+ const sellerPeopleId = user?.people ?? user?.people_id ?? null;
49
+
50
+ const [refreshing, setRefreshing] = useState(false);
51
+ const [loading, setLoading] = useState(false);
52
+ const [error, setError] = useState(null);
53
+ const [rawInvoices, setRawInvoices] = useState([]);
54
+ const [selectedMonth, setSelectedMonth] = useState('0');
55
+ const [selectedYear, setSelectedYear] = useState(
56
+ String(new Date().getFullYear()),
57
+ );
58
+ const [selectedClientId, setSelectedClientId] = useState('');
59
+ const hasLoadedInitially = useRef(false);
60
+
61
+ const translate = useCallback(
62
+ (store, type, key) => global.t?.t(store, type, key),
63
+ [],
64
+ );
65
+
66
+ const monthOptions = useMemo(
67
+ () => buildMonthOptions(translate),
68
+ [translate],
69
+ );
70
+
71
+ const monthLabelById = useMemo(
72
+ () =>
73
+ monthOptions.reduce((acc, option) => {
74
+ acc[option.id] = option.label;
75
+ return acc;
76
+ }, {}),
77
+ [monthOptions],
78
+ );
79
+
80
+ const canLoad = Boolean(sellerPeopleId);
81
+
82
+ const fetchComissions = useCallback(async () => {
83
+ if (!canLoad) return;
84
+
85
+ setLoading(true);
86
+ setError(null);
87
+
88
+ const params = buildComissionRequestParams({
89
+ year: selectedYear,
90
+ month: selectedMonth,
91
+ receiverId: sellerPeopleId,
92
+ clientId: selectedClientId || undefined,
93
+ });
94
+
95
+ try {
96
+ let response;
97
+ try {
98
+ response = await api.fetch(COMISSION_ENDPOINT, {
99
+ method: 'GET',
100
+ params,
101
+ });
102
+ } catch (primaryError) {
103
+ // Fallback: standard invoices filtered by type + receiver
104
+ response = await api.fetch(FALLBACK_INVOICES_ENDPOINT, {
105
+ method: 'GET',
106
+ params: {
107
+ ...params,
108
+ invoiceType: 'comission',
109
+ receiver: sellerPeopleId,
110
+ },
111
+ });
112
+ }
113
+
114
+ const list = normalizeComissionList(response);
115
+ setRawInvoices(list);
116
+ } catch (e) {
117
+ setError(e?.message || String(e));
118
+ setRawInvoices([]);
119
+ } finally {
120
+ setLoading(false);
121
+ }
122
+ }, [canLoad, selectedYear, selectedMonth, selectedClientId, sellerPeopleId]);
123
+
124
+ useFocusEffect(
125
+ useCallback(() => {
126
+ hasLoadedInitially.current = true;
127
+ fetchComissions();
128
+ }, [fetchComissions]),
129
+ );
130
+
131
+ useEffect(() => {
132
+ if (!canLoad || !hasLoadedInitially.current) return;
133
+ fetchComissions();
134
+ }, [canLoad, fetchComissions, selectedMonth, selectedYear, selectedClientId]);
135
+
136
+ const onRefresh = useCallback(async () => {
137
+ setRefreshing(true);
138
+ try {
139
+ await fetchComissions();
140
+ } finally {
141
+ setRefreshing(false);
142
+ }
143
+ }, [fetchComissions]);
144
+
145
+ const filteredInvoices = useMemo(
146
+ () => filterInvoicesByClient(rawInvoices, selectedClientId || null),
147
+ [rawInvoices, selectedClientId],
148
+ );
149
+
150
+ const clientOptions = useMemo(
151
+ () => collectClientsFromInvoices(rawInvoices),
152
+ [rawInvoices],
153
+ );
154
+
155
+ const monthRows = useMemo(
156
+ () =>
157
+ groupCommissionsByMonth(filteredInvoices, {
158
+ selectedMonth,
159
+ year: selectedYear,
160
+ monthLabelById,
161
+ }),
162
+ [filteredInvoices, selectedMonth, selectedYear, monthLabelById],
163
+ );
164
+
165
+ const isBusy = loading || isLoadingStore;
166
+ const displayError = error || storeError;
167
+ const showEmpty = !isBusy && !displayError && monthRows.length === 0;
168
+ const showList = !isBusy && !displayError && monthRows.length > 0;
169
+
170
+ const renderMonthCard = ({item}) => (
171
+ <View style={styles.monthCard} testID={`seller-commission-month-${item.month}`}>
172
+ <View style={styles.monthCardHeader}>
173
+ <Text style={styles.monthCardTitle}>{item.label}</Text>
174
+ <Text style={styles.monthCardCount}>
175
+ {item.count}{' '}
176
+ {item.count === 1
177
+ ? translate('invoice', 'label', 'invoice') || 'fatura'
178
+ : translate('invoice', 'label', 'invoices') || 'faturas'}
179
+ </Text>
180
+ </View>
181
+ <View style={styles.receiveRow}>
182
+ <Text style={styles.receiveLabel}>
183
+ {translate('invoice', 'label', 'toReceive') || 'A receber'}
184
+ </Text>
185
+ <Text style={styles.receiveAmount}>{formatCurrency(item.total)}</Text>
186
+ </View>
187
+ <Text style={styles.senseHint}>
188
+ {translate('crm', 'hint', 'sellerReceivesFromCompany') ||
189
+ 'Vendedor recebe da empresa (tipo comission)'}
190
+ </Text>
191
+ {Array.isArray(item.invoices) && item.invoices.length > 0 ? (
192
+ <View style={styles.detailsCard}>
193
+ {item.invoices.slice(0, 8).map(invoice => {
194
+ const client = extractClientFromInvoice(invoice);
195
+ const key = invoice?.id || `${item.month}-${invoice?.price}`;
196
+ return (
197
+ <View key={String(key)} style={styles.detailRow}>
198
+ <Text style={styles.detailClient} numberOfLines={1}>
199
+ {client?.name ||
200
+ `#${invoice?.id || ''}` ||
201
+ translate('people', 'label', 'noClient') ||
202
+ 'Cliente'}
203
+ </Text>
204
+ <Text style={styles.detailAmount}>
205
+ {formatCurrency(invoice?.price)}
206
+ </Text>
207
+ </View>
208
+ );
209
+ })}
210
+ </View>
211
+ ) : null}
212
+ </View>
213
+ );
214
+
215
+ return (
216
+ <SafeAreaView style={styles.page} edges={['bottom']} testID="seller-commissions-page">
217
+ <View style={styles.filtersContainer}>
218
+ <View style={styles.yearRow}>
219
+ <Text style={styles.filterLabel}>
220
+ {translate('people', 'label', 'year') || 'Ano'}
221
+ </Text>
222
+ <View style={styles.yearControl}>
223
+ <TouchableOpacity
224
+ style={styles.yearStepButton}
225
+ onPress={() => {
226
+ const current = parseInt(selectedYear || '0', 10);
227
+ if (!current) return;
228
+ setSelectedYear(String(current - 1));
229
+ }}
230
+ testID="seller-commissions-year-dec">
231
+ <Text style={styles.yearStepButtonText}>-</Text>
232
+ </TouchableOpacity>
233
+ <TextInput
234
+ value={selectedYear}
235
+ onChangeText={text => {
236
+ const cleaned = text.replace(/\D/g, '').slice(0, 4);
237
+ setSelectedYear(cleaned);
238
+ }}
239
+ onBlur={() => {
240
+ if (selectedYear.length !== 4) {
241
+ setSelectedYear(String(new Date().getFullYear()));
242
+ }
243
+ }}
244
+ keyboardType="numeric"
245
+ style={styles.yearInput}
246
+ testID="seller-commissions-year-input"
247
+ />
248
+ <TouchableOpacity
249
+ style={styles.yearStepButton}
250
+ onPress={() => {
251
+ const current = parseInt(selectedYear || '0', 10);
252
+ if (!current) return;
253
+ setSelectedYear(String(current + 1));
254
+ }}
255
+ testID="seller-commissions-year-inc">
256
+ <Text style={styles.yearStepButtonText}>+</Text>
257
+ </TouchableOpacity>
258
+ </View>
259
+ </View>
260
+
261
+ <FlatList
262
+ data={monthOptions}
263
+ horizontal
264
+ showsHorizontalScrollIndicator={false}
265
+ keyExtractor={item => item.id}
266
+ contentContainerStyle={styles.monthList}
267
+ renderItem={({item}) => (
268
+ <TouchableOpacity
269
+ style={[
270
+ styles.monthChip,
271
+ selectedMonth === item.id && styles.monthChipActive,
272
+ ]}
273
+ onPress={() => setSelectedMonth(item.id)}
274
+ testID={`seller-commissions-month-chip-${item.id}`}>
275
+ <Text
276
+ style={[
277
+ styles.monthChipText,
278
+ selectedMonth === item.id && styles.monthChipTextActive,
279
+ ]}>
280
+ {item.label}
281
+ </Text>
282
+ </TouchableOpacity>
283
+ )}
284
+ />
285
+
286
+ {clientOptions.length > 0 ? (
287
+ <View style={styles.clientFilterRow}>
288
+ <Text style={styles.filterLabel}>
289
+ {translate('people', 'label', 'client') || 'Cliente'}
290
+ </Text>
291
+ <FlatList
292
+ data={[{id: '', name: translate('people', 'month', 'all') || 'Todos'}, ...clientOptions]}
293
+ horizontal
294
+ showsHorizontalScrollIndicator={false}
295
+ keyExtractor={item => String(item.id || 'all')}
296
+ contentContainerStyle={styles.clientChips}
297
+ renderItem={({item}) => {
298
+ const active = String(selectedClientId || '') === String(item.id || '');
299
+ return (
300
+ <TouchableOpacity
301
+ style={[styles.clientChip, active && styles.clientChipActive]}
302
+ onPress={() => setSelectedClientId(item.id ? String(item.id) : '')}
303
+ testID={`seller-commissions-client-chip-${item.id || 'all'}`}>
304
+ <Text
305
+ style={[
306
+ styles.clientChipText,
307
+ active && styles.clientChipTextActive,
308
+ ]}
309
+ numberOfLines={1}>
310
+ {item.name}
311
+ </Text>
312
+ </TouchableOpacity>
313
+ );
314
+ }}
315
+ />
316
+ </View>
317
+ ) : null}
318
+ </View>
319
+
320
+ {isBusy && !refreshing ? (
321
+ <View style={styles.centerState}>
322
+ <ActivityIndicator size="large" color="#0EA5E9" />
323
+ </View>
324
+ ) : null}
325
+
326
+ {displayError ? (
327
+ <View style={styles.centerState}>
328
+ <Text style={styles.errorTitle}>
329
+ {translate('people', 'state', 'errorTitle') || 'Erro'}
330
+ </Text>
331
+ <Text style={styles.errorSubtitle}>{String(displayError)}</Text>
332
+ <TouchableOpacity style={styles.retryButton} onPress={fetchComissions}>
333
+ <Text style={styles.retryButtonText}>
334
+ {translate('people', 'action', 'retry') || 'Tentar de novo'}
335
+ </Text>
336
+ </TouchableOpacity>
337
+ </View>
338
+ ) : null}
339
+
340
+ {showEmpty ? (
341
+ <View style={styles.centerState} testID="seller-commissions-empty">
342
+ <Text style={styles.emptyTitle}>
343
+ {translate('crm', 'state', 'noCommissions') || 'Nenhuma comissão'}
344
+ </Text>
345
+ <Text style={styles.emptySubtitle}>
346
+ {translate('crm', 'state', 'noCommissionsHint') ||
347
+ 'Não há invoices do tipo comission para o período e filtros selecionados.'}
348
+ </Text>
349
+ </View>
350
+ ) : null}
351
+
352
+ {showList ? (
353
+ <FlatList
354
+ data={monthRows}
355
+ keyExtractor={item => String(item.month)}
356
+ renderItem={renderMonthCard}
357
+ contentContainerStyle={styles.listContent}
358
+ refreshControl={
359
+ <RefreshControl refreshing={refreshing} onRefresh={onRefresh} />
360
+ }
361
+ testID="seller-commissions-list"
362
+ />
363
+ ) : null}
364
+ </SafeAreaView>
365
+ );
366
+ };
367
+
368
+ export default SellerCommissionsPage;
@@ -0,0 +1,219 @@
1
+ import {StyleSheet} from 'react-native';
2
+
3
+ const styles = StyleSheet.create({
4
+ page: {
5
+ flex: 1,
6
+ backgroundColor: '#F1F5F9',
7
+ },
8
+ filtersContainer: {
9
+ backgroundColor: '#FFFFFF',
10
+ borderBottomWidth: 1,
11
+ borderBottomColor: '#E2E8F0',
12
+ paddingHorizontal: 12,
13
+ paddingVertical: 10,
14
+ },
15
+ yearRow: {
16
+ flexDirection: 'row',
17
+ justifyContent: 'space-between',
18
+ alignItems: 'center',
19
+ marginBottom: 8,
20
+ },
21
+ filterLabel: {
22
+ color: '#334155',
23
+ fontWeight: '700',
24
+ fontSize: 13,
25
+ },
26
+ yearControl: {
27
+ flexDirection: 'row',
28
+ alignItems: 'center',
29
+ },
30
+ yearStepButton: {
31
+ width: 28,
32
+ height: 28,
33
+ borderRadius: 8,
34
+ backgroundColor: '#E2E8F0',
35
+ alignItems: 'center',
36
+ justifyContent: 'center',
37
+ marginHorizontal: 4,
38
+ },
39
+ yearStepButtonText: {
40
+ color: '#334155',
41
+ fontSize: 18,
42
+ lineHeight: 18,
43
+ fontWeight: '700',
44
+ },
45
+ yearInput: {
46
+ width: 70,
47
+ height: 32,
48
+ borderWidth: 1,
49
+ borderColor: '#CBD5E1',
50
+ borderRadius: 8,
51
+ textAlign: 'center',
52
+ color: '#0F172A',
53
+ fontWeight: '700',
54
+ backgroundColor: '#fff',
55
+ paddingVertical: 0,
56
+ marginHorizontal: 2,
57
+ },
58
+ monthList: {
59
+ paddingVertical: 2,
60
+ },
61
+ monthChip: {
62
+ borderWidth: 1,
63
+ borderColor: '#CBD5E1',
64
+ backgroundColor: '#F8FAFC',
65
+ borderRadius: 999,
66
+ paddingHorizontal: 12,
67
+ paddingVertical: 6,
68
+ marginRight: 8,
69
+ },
70
+ monthChipActive: {
71
+ borderColor: '#0EA5E9',
72
+ backgroundColor: '#E0F2FE',
73
+ },
74
+ monthChipText: {
75
+ color: '#475569',
76
+ fontSize: 12,
77
+ fontWeight: '600',
78
+ },
79
+ monthChipTextActive: {
80
+ color: '#0369A1',
81
+ },
82
+ clientFilterRow: {
83
+ marginTop: 10,
84
+ },
85
+ clientChips: {
86
+ paddingVertical: 4,
87
+ },
88
+ clientChip: {
89
+ borderWidth: 1,
90
+ borderColor: '#CBD5E1',
91
+ backgroundColor: '#F8FAFC',
92
+ borderRadius: 999,
93
+ paddingHorizontal: 12,
94
+ paddingVertical: 6,
95
+ marginRight: 8,
96
+ maxWidth: 180,
97
+ },
98
+ clientChipActive: {
99
+ borderColor: '#16A34A',
100
+ backgroundColor: '#DCFCE7',
101
+ },
102
+ clientChipText: {
103
+ color: '#475569',
104
+ fontSize: 12,
105
+ fontWeight: '600',
106
+ },
107
+ clientChipTextActive: {
108
+ color: '#166534',
109
+ },
110
+ centerState: {
111
+ flex: 1,
112
+ alignItems: 'center',
113
+ justifyContent: 'center',
114
+ padding: 24,
115
+ },
116
+ errorTitle: {
117
+ color: '#B91C1C',
118
+ fontWeight: '700',
119
+ fontSize: 16,
120
+ marginBottom: 6,
121
+ },
122
+ errorSubtitle: {
123
+ color: '#64748B',
124
+ textAlign: 'center',
125
+ marginBottom: 12,
126
+ },
127
+ retryButton: {
128
+ backgroundColor: '#0EA5E9',
129
+ paddingHorizontal: 16,
130
+ paddingVertical: 10,
131
+ borderRadius: 8,
132
+ },
133
+ retryButtonText: {
134
+ color: '#FFFFFF',
135
+ fontWeight: '700',
136
+ },
137
+ emptyTitle: {
138
+ color: '#334155',
139
+ fontWeight: '700',
140
+ fontSize: 16,
141
+ marginBottom: 4,
142
+ },
143
+ emptySubtitle: {
144
+ color: '#64748B',
145
+ textAlign: 'center',
146
+ },
147
+ listContent: {
148
+ padding: 12,
149
+ paddingBottom: 32,
150
+ },
151
+ monthCard: {
152
+ backgroundColor: '#FFFFFF',
153
+ borderRadius: 12,
154
+ padding: 14,
155
+ marginBottom: 10,
156
+ borderWidth: 1,
157
+ borderColor: '#E2E8F0',
158
+ },
159
+ monthCardHeader: {
160
+ flexDirection: 'row',
161
+ justifyContent: 'space-between',
162
+ alignItems: 'center',
163
+ marginBottom: 8,
164
+ },
165
+ monthCardTitle: {
166
+ color: '#0F172A',
167
+ fontWeight: '700',
168
+ fontSize: 15,
169
+ },
170
+ monthCardCount: {
171
+ color: '#64748B',
172
+ fontSize: 12,
173
+ },
174
+ receiveRow: {
175
+ flexDirection: 'row',
176
+ justifyContent: 'space-between',
177
+ alignItems: 'center',
178
+ marginTop: 4,
179
+ },
180
+ receiveLabel: {
181
+ color: '#166534',
182
+ fontWeight: '600',
183
+ fontSize: 13,
184
+ },
185
+ receiveAmount: {
186
+ color: '#15803D',
187
+ fontWeight: '800',
188
+ fontSize: 16,
189
+ },
190
+ senseHint: {
191
+ marginTop: 8,
192
+ color: '#64748B',
193
+ fontSize: 11,
194
+ },
195
+ detailsCard: {
196
+ marginTop: 10,
197
+ borderTopWidth: 1,
198
+ borderTopColor: '#E2E8F0',
199
+ paddingTop: 8,
200
+ },
201
+ detailRow: {
202
+ flexDirection: 'row',
203
+ justifyContent: 'space-between',
204
+ paddingVertical: 4,
205
+ },
206
+ detailClient: {
207
+ color: '#334155',
208
+ fontSize: 12,
209
+ flex: 1,
210
+ marginRight: 8,
211
+ },
212
+ detailAmount: {
213
+ color: '#0F172A',
214
+ fontWeight: '600',
215
+ fontSize: 12,
216
+ },
217
+ });
218
+
219
+ export default styles;