@controleonline/ui-common 1.2.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/agents/developer.agent.md +30 -0
- package/.github/agents/devops.agent.md +30 -0
- package/.github/agents/qa.agent.md +30 -0
- package/.github/agents/security.agent.md +30 -0
- package/.github/workflows/npmjs.yml +35 -0
- package/.github/workflows/pull-request-checks.yml +19 -0
- package/.scrutinizer.yml +24 -0
- package/FUNDING.yml +1 -0
- package/package.json +28 -0
- package/src/api/fetch.js +74 -0
- package/src/api/index.js +155 -0
- package/src/api/localDB.js +131 -0
- package/src/api/queue.js +66 -0
- package/src/react/assets/tap.mp3 +0 -0
- package/src/react/components/AddImportModal.js +157 -0
- package/src/react/components/AddImportModal.styles.js +81 -0
- package/src/react/components/BackgroundRuntimeBridge.js +219 -0
- package/src/react/components/BottomNavigationBar.config.js +238 -0
- package/src/react/components/BottomNavigationBar.js +120 -0
- package/src/react/components/BottomNavigationBar.styles.js +110 -0
- package/src/react/components/CategoryForm.js +572 -0
- package/src/react/components/CategoryForm.styles.js +334 -0
- package/src/react/components/ConfirmModal.js +24 -0
- package/src/react/components/ConfirmModal.styles.js +43 -0
- package/src/react/components/ContextHelpButton.js +69 -0
- package/src/react/components/ContextHelpButton.styles.js +62 -0
- package/src/react/components/DefaultProvider.native.js +848 -0
- package/src/react/components/DefaultProvider.styles.js +21 -0
- package/src/react/components/DefaultProvider.web.js +909 -0
- package/src/react/components/DeliveryPushBridge.native.js +314 -0
- package/src/react/components/DeliveryPushBridge.web.js +5 -0
- package/src/react/components/DeviceAlertSoundService.js +499 -0
- package/src/react/components/EntityLogContent.js +909 -0
- package/src/react/components/EntityLogContent.styles.js +400 -0
- package/src/react/components/EventBus.js +12 -0
- package/src/react/components/KioskModeBridge.js +65 -0
- package/src/react/components/LauncherModeBridge.js +47 -0
- package/src/react/components/LinkedOrderProductsTab.js +388 -0
- package/src/react/components/LinkedOrderProductsTab.styles.js +180 -0
- package/src/react/components/ManagerPushBridge.native.js +345 -0
- package/src/react/components/MessageService.js +314 -0
- package/src/react/components/Paywall/Google.js +89 -0
- package/src/react/components/PrintService.js +778 -0
- package/src/react/components/ProductCatalogCacheService.js +45 -0
- package/src/react/components/RemoteCheckoutService.js +292 -0
- package/src/react/components/RuntimeBottomNavigationBar.js +151 -0
- package/src/react/components/RuntimeInfoFooter.js +214 -0
- package/src/react/components/RuntimeInfoFooter.styles.js +56 -0
- package/src/react/components/SystemErrorToast.js +29 -0
- package/src/react/components/SystemErrorToast.styles.js +38 -0
- package/src/react/components/TouchFeedbackProvider.js +65 -0
- package/src/react/components/UnifiedPaymentBar.js +155 -0
- package/src/react/components/UnifiedPaymentBar.styles.js +174 -0
- package/src/react/components/WebsocketListener.native.js +487 -0
- package/src/react/components/WebsocketListener.web.js +102 -0
- package/src/react/components/inputs/IdInput.js +49 -0
- package/src/react/components/inputs/IdInput.styles.js +26 -0
- package/src/react/components/inputs/InvoiceDueDateFilterInput.js +74 -0
- package/src/react/components/inputs/InvoiceDueDateFilterInput.styles.js +34 -0
- package/src/react/components/inputs/InvoiceDueDateRangeFilterInput.js +115 -0
- package/src/react/components/inputs/InvoiceDueDateRangeFilterInput.styles.js +39 -0
- package/src/react/components/lists/CategoriesList.js +56 -0
- package/src/react/components/lists/PaymentTypeList.js +55 -0
- package/src/react/components/lists/ReceiverList.js +56 -0
- package/src/react/components/lists/SelectList.styles.js +18 -0
- package/src/react/components/lists/StatusList.js +55 -0
- package/src/react/components/lists/WalletList.js +54 -0
- package/src/react/components/radio/Spotify.js +144 -0
- package/src/react/components/radio/Spotify.styles.js +32 -0
- package/src/react/components/radio/YouTube.js +82 -0
- package/src/react/components/radio/YouTube.styles.js +16 -0
- package/src/react/components/toastConfig.js +16 -0
- package/src/react/config/deviceConfigBootstrap.js +571 -0
- package/src/react/index.js +4 -0
- package/src/react/localStorage.js +30 -0
- package/src/react/pages/EntityLogPage.js +124 -0
- package/src/react/pages/EntityLogPage.styles.js +17 -0
- package/src/react/pages/GenericLogPage.js +760 -0
- package/src/react/pages/GenericLogPage.styles.js +401 -0
- package/src/react/pages/Imports.js +361 -0
- package/src/react/pages/Imports.styles.js +223 -0
- package/src/react/pages/SettingsPage/PaymentTypesByWalletTab.js +462 -0
- package/src/react/pages/SettingsPage/index.js +1171 -0
- package/src/react/pages/SettingsPage/index.styles.js +122 -0
- package/src/react/print/jobs.js +147 -0
- package/src/react/print/providers/local.js +53 -0
- package/src/react/print/providers/remote.js +81 -0
- package/src/react/print/selection.js +296 -0
- package/src/react/print/usePrintButtonController.js +474 -0
- package/src/react/router/routes.js +42 -0
- package/src/react/services/NetworkPrinterService.native.js +391 -0
- package/src/react/services/NetworkPrinterService.web.js +15 -0
- package/src/react/stores/index.js +128 -0
- package/src/react/stores/storeErrorBridge.js +36 -0
- package/src/react/utils/backgroundRuntimeRegistration.js +69 -0
- package/src/react/utils/cashPayment.js +87 -0
- package/src/react/utils/commercialDocumentOrders.js +269 -0
- package/src/react/utils/dateRangeFilter.js +264 -0
- package/src/react/utils/deviceRuntime.js +193 -0
- package/src/react/utils/entityDisplay.js +231 -0
- package/src/react/utils/entityLog.js +649 -0
- package/src/react/utils/fileUrl.js +102 -0
- package/src/react/utils/frontendDebugLog.js +45 -0
- package/src/react/utils/googleMapsConfig.js +49 -0
- package/src/react/utils/importStatus.js +100 -0
- package/src/react/utils/invoiceDueDateMessages.js +14 -0
- package/src/react/utils/invoicePresentation.js +46 -0
- package/src/react/utils/logSettings.js +143 -0
- package/src/react/utils/maintenanceSettings.js +53 -0
- package/src/react/utils/managerOrderNotifications.js +523 -0
- package/src/react/utils/mapNavigation.js +76 -0
- package/src/react/utils/menuCatalogConfig.js +8 -0
- package/src/react/utils/menuCatalogDownload.js +157 -0
- package/src/react/utils/networkCameraDevices.js +175 -0
- package/src/react/utils/networkDeviceProfiles.js +135 -0
- package/src/react/utils/normalizedCatalogDownload.js +157 -0
- package/src/react/utils/notificationNavigation.js +94 -0
- package/src/react/utils/notificationSound.js +42 -0
- package/src/react/utils/paymentDevices.js +397 -0
- package/src/react/utils/paymentGatewayExecution.js +91 -0
- package/src/react/utils/paymentOptions.js +88 -0
- package/src/react/utils/peopleDisplay.js +39 -0
- package/src/react/utils/printerDevices.js +465 -0
- package/src/react/utils/remotePayment.js +61 -0
- package/src/react/utils/runtimeFooter.js +475 -0
- package/src/react/utils/runtimeLanguage.js +50 -0
- package/src/react/utils/runtimeMenu.js +224 -0
- package/src/react/utils/screenMetrics.js +30 -0
- package/src/react/utils/shopConfig.js +294 -0
- package/src/react/utils/shopFranchises.js +114 -0
- package/src/react/utils/socketRuntimePipeline.js +454 -0
- package/src/react/utils/spoolAckTracker.js +77 -0
- package/src/react/utils/storeColumns.js +427 -0
- package/src/react/utils/systemErrorChannel.js +109 -0
- package/src/react/utils/systemErrorMessage.js +67 -0
- package/src/react/utils/toastPresentation.js +53 -0
- package/src/react/utils/websocketSharedRuntime.js +826 -0
- package/src/store/acl/getters.js +4 -0
- package/src/store/acl/index.js +19 -0
- package/src/store/acl/mutation_types.js +4 -0
- package/src/store/acl/mutations.js +17 -0
- package/src/store/address/city.js +22 -0
- package/src/store/categories/category_file/index.js +25 -0
- package/src/store/categories/index.js +93 -0
- package/src/store/configs/customActions.js +131 -0
- package/src/store/configs/index.js +25 -0
- package/src/store/connections/customActions.js +26 -0
- package/src/store/connections/index.js +124 -0
- package/src/store/device/index.js +22 -0
- package/src/store/device_config/customActions.js +190 -0
- package/src/store/device_config/index.js +28 -0
- package/src/store/entity_log/customActions.js +63 -0
- package/src/store/entity_log/index.js +25 -0
- package/src/store/extra/data.js +85 -0
- package/src/store/extra/fields.js +88 -0
- package/src/store/file/actions.js +27 -0
- package/src/store/file/index.js +24 -0
- package/src/store/imports/index.js +88 -0
- package/src/store/print/customActions.js +251 -0
- package/src/store/print/index.js +28 -0
- package/src/store/printer/customActions.js +54 -0
- package/src/store/printer/index.js +26 -0
- package/src/store/runtime_debug/customActions.js +71 -0
- package/src/store/runtime_debug/index.js +30 -0
- package/src/store/status/index.js +65 -0
- package/src/store/timezones/index.js +43 -0
- package/src/store/websocket/customActions.js +24 -0
- package/src/store/websocket/index.js +28 -0
- package/src/tests/react/components/LauncherModeBridge.test.js +93 -0
- package/src/tests/react/config/deviceConfigBootstrap.test.js +337 -0
- package/src/tests/react/print/localPrintProvider.test.js +45 -0
- package/src/tests/react/utils/backgroundRuntimeRegistration.test.js +123 -0
- package/src/tests/react/utils/cashPayment.test.js +41 -0
- package/src/tests/react/utils/dateRangeFilter.test.mjs +29 -0
- package/src/tests/react/utils/entityDisplay.test.js +18 -0
- package/src/tests/react/utils/googleMapsConfig.test.js +32 -0
- package/src/tests/react/utils/importStatus.test.js +85 -0
- package/src/tests/react/utils/invoicePresentation.test.mjs +40 -0
- package/src/tests/react/utils/managerOrderNotifications.test.js +127 -0
- package/src/tests/react/utils/mapNavigation.test.js +58 -0
- package/src/tests/react/utils/notificationNavigation.test.js +39 -0
- package/src/tests/react/utils/notificationSound.test.js +27 -0
- package/src/tests/react/utils/paymentDevices.test.js +88 -0
- package/src/tests/react/utils/runtimeFooter.test.js +429 -0
- package/src/tests/react/utils/runtimeLanguage.test.js +80 -0
- package/src/tests/react/utils/runtimeMenu.test.js +174 -0
- package/src/tests/react/utils/shopFranchises.test.js +82 -0
- package/src/tests/react/utils/socketRuntimePipeline.test.js +124 -0
- package/src/tests/react/utils/spoolAckTracker.test.js +40 -0
- package/src/tests/react/utils/storeErrorBridge.test.js +66 -0
- package/src/tests/react/utils/systemErrorChannel.test.js +58 -0
- package/src/tests/react/utils/systemErrorMessage.test.js +59 -0
- package/src/tests/react/utils/toastPresentation.test.js +75 -0
- package/src/tests/react/utils/translate.test.mjs +396 -0
- package/src/tests/react/utils/websocketSharedRuntime.test.js +245 -0
- package/src/utils/apiEntryPoint.js +31 -0
- package/src/utils/appDomain.js +50 -0
- package/src/utils/config.js +14 -0
- package/src/utils/formatter.js +419 -0
- package/src/utils/integrationConfigs.js +79 -0
- package/src/utils/methods.js +23 -0
- package/src/utils/oauth.js +42 -0
- package/src/utils/translate.js +620 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { View, Text, TextInput } from 'react-native'
|
|
3
|
+
import { useStore } from '@store'
|
|
4
|
+
import { normalizeDateInputToYmd } from '@controleonline/ui-common/src/react/utils/dateRangeFilter'
|
|
5
|
+
import {
|
|
6
|
+
resolveInvoiceInvalidDateFormatMessage,
|
|
7
|
+
resolveInvoiceSingleDatePlaceholder,
|
|
8
|
+
} from '@controleonline/ui-common/src/react/utils/invoiceDueDateMessages'
|
|
9
|
+
import styles from './InvoiceDueDateFilterInput.styles'
|
|
10
|
+
|
|
11
|
+
const InvoiceDueDateFilterInput = () => {
|
|
12
|
+
const invoiceStore = useStore('invoice')
|
|
13
|
+
const { actions: invoiceActions } = invoiceStore
|
|
14
|
+
const [inputValue, setInputValue] = useState('')
|
|
15
|
+
const [error, setError] = useState('')
|
|
16
|
+
|
|
17
|
+
const validateDate = (value) => {
|
|
18
|
+
if (value.trim() === '') {
|
|
19
|
+
setError('')
|
|
20
|
+
return true
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const normalizedDate = normalizeDateInputToYmd(value)
|
|
24
|
+
|
|
25
|
+
if (normalizedDate) {
|
|
26
|
+
setError('')
|
|
27
|
+
} else {
|
|
28
|
+
setError(resolveInvoiceInvalidDateFormatMessage())
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return Boolean(normalizedDate)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const handleTextChange = (value) => {
|
|
35
|
+
setInputValue(value)
|
|
36
|
+
|
|
37
|
+
if (value.trim() === '') {
|
|
38
|
+
invoiceActions.setFilterDueDate(null)
|
|
39
|
+
setError('')
|
|
40
|
+
} else if (validateDate(value)) {
|
|
41
|
+
invoiceActions.setFilterDueDate(normalizeDateInputToYmd(value))
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const handleBlur = () => {
|
|
46
|
+
if (inputValue.trim() !== '' && !error) {
|
|
47
|
+
invoiceActions.fetchInvoices()
|
|
48
|
+
} else if (inputValue.trim() === '') {
|
|
49
|
+
invoiceActions.fetchInvoices()
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<View style={styles.container}>
|
|
55
|
+
<Text style={styles.label}>
|
|
56
|
+
{global.t?.t("invoice", "label", "dueDate")}
|
|
57
|
+
</Text>
|
|
58
|
+
|
|
59
|
+
<TextInput
|
|
60
|
+
style={[styles.input, error && styles.inputError]}
|
|
61
|
+
placeholder={resolveInvoiceSingleDatePlaceholder()}
|
|
62
|
+
value={inputValue}
|
|
63
|
+
onChangeText={handleTextChange}
|
|
64
|
+
onBlur={handleBlur}
|
|
65
|
+
placeholderTextColor="#999"
|
|
66
|
+
keyboardType="number-pad"
|
|
67
|
+
/>
|
|
68
|
+
|
|
69
|
+
{error && <Text style={styles.errorText}>{error}</Text>}
|
|
70
|
+
</View>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export default InvoiceDueDateFilterInput
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native'
|
|
2
|
+
|
|
3
|
+
const styles = StyleSheet.create({
|
|
4
|
+
container: {
|
|
5
|
+
marginVertical: 10,
|
|
6
|
+
marginHorizontal: 8,
|
|
7
|
+
flex: 1,
|
|
8
|
+
},
|
|
9
|
+
label: {
|
|
10
|
+
fontSize: 14,
|
|
11
|
+
fontWeight: '600',
|
|
12
|
+
marginBottom: 5,
|
|
13
|
+
color: '#333',
|
|
14
|
+
},
|
|
15
|
+
input: {
|
|
16
|
+
borderWidth: 1,
|
|
17
|
+
borderColor: '#ccc',
|
|
18
|
+
borderRadius: 6,
|
|
19
|
+
paddingHorizontal: 12,
|
|
20
|
+
paddingVertical: 8,
|
|
21
|
+
fontSize: 14,
|
|
22
|
+
backgroundColor: '#fff',
|
|
23
|
+
},
|
|
24
|
+
inputError: {
|
|
25
|
+
borderColor: '#c10015',
|
|
26
|
+
},
|
|
27
|
+
errorText: {
|
|
28
|
+
color: '#c10015',
|
|
29
|
+
fontSize: 12,
|
|
30
|
+
marginTop: 5,
|
|
31
|
+
},
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
export default styles
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import { View, Text, TextInput } from 'react-native'
|
|
3
|
+
import { useStore } from '@store'
|
|
4
|
+
import { normalizeDateInputToYmd } from '@controleonline/ui-common/src/react/utils/dateRangeFilter'
|
|
5
|
+
import {
|
|
6
|
+
resolveInvoiceInvalidDateFormatMessage,
|
|
7
|
+
resolveInvoiceRangeEndPlaceholder,
|
|
8
|
+
resolveInvoiceRangeLabel,
|
|
9
|
+
resolveInvoiceRangeStartPlaceholder,
|
|
10
|
+
} from '@controleonline/ui-common/src/react/utils/invoiceDueDateMessages'
|
|
11
|
+
import styles from './InvoiceDueDateRangeFilterInput.styles'
|
|
12
|
+
|
|
13
|
+
const InvoiceDueDateRangeFilterInput = ({ onSearch }) => {
|
|
14
|
+
const invoiceStore = useStore('invoice')
|
|
15
|
+
const { actions: invoiceActions, getters: invoiceGetters } = invoiceStore
|
|
16
|
+
const [startValue, setStartValue] = useState('')
|
|
17
|
+
const [endValue, setEndValue] = useState('')
|
|
18
|
+
const [startError, setStartError] = useState('')
|
|
19
|
+
const [endError, setEndError] = useState('')
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
const savedRange = invoiceGetters?.filters?.dueDate || {}
|
|
23
|
+
setStartValue(savedRange?.start || '')
|
|
24
|
+
setEndValue(savedRange?.end || '')
|
|
25
|
+
}, [invoiceGetters?.filters?.dueDate?.start, invoiceGetters?.filters?.dueDate?.end])
|
|
26
|
+
|
|
27
|
+
const normalizeDate = (value) => {
|
|
28
|
+
if (!value || value.trim() === '') return null
|
|
29
|
+
return normalizeDateInputToYmd(value)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const validateDate = (value, setError) => {
|
|
33
|
+
if (value.trim() === '') {
|
|
34
|
+
setError('')
|
|
35
|
+
return true
|
|
36
|
+
}
|
|
37
|
+
if (normalizeDate(value)) {
|
|
38
|
+
setError('')
|
|
39
|
+
return true
|
|
40
|
+
} else {
|
|
41
|
+
setError(resolveInvoiceInvalidDateFormatMessage())
|
|
42
|
+
return false
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const syncRangeToStore = (startRaw, endRaw) => {
|
|
47
|
+
const start = normalizeDate(startRaw)
|
|
48
|
+
const end = normalizeDate(endRaw)
|
|
49
|
+
|
|
50
|
+
if (!start && !end) {
|
|
51
|
+
invoiceActions.setFilterDueDate(null)
|
|
52
|
+
return
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
invoiceActions.setFilterDueDate({ start, end })
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const handleStartChange = (value) => {
|
|
59
|
+
setStartValue(value)
|
|
60
|
+
validateDate(value, setStartError)
|
|
61
|
+
syncRangeToStore(value, endValue)
|
|
62
|
+
if (value.trim() === '' || normalizeDate(value)) {
|
|
63
|
+
if (typeof onSearch === 'function') onSearch()
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const handleEndChange = (value) => {
|
|
68
|
+
setEndValue(value)
|
|
69
|
+
validateDate(value, setEndError)
|
|
70
|
+
syncRangeToStore(startValue, value)
|
|
71
|
+
if (value.trim() === '' || normalizeDate(value)) {
|
|
72
|
+
if (typeof onSearch === 'function') onSearch()
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const handleBlur = () => {
|
|
77
|
+
if (!startError && !endError) {
|
|
78
|
+
if (typeof onSearch === 'function') onSearch()
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<View style={styles.container}>
|
|
84
|
+
<Text style={styles.label}>
|
|
85
|
+
{resolveInvoiceRangeLabel()}
|
|
86
|
+
</Text>
|
|
87
|
+
|
|
88
|
+
<View style={styles.row}>
|
|
89
|
+
<TextInput
|
|
90
|
+
style={[styles.input, startError && styles.inputError]}
|
|
91
|
+
placeholder={resolveInvoiceRangeStartPlaceholder()}
|
|
92
|
+
value={startValue}
|
|
93
|
+
onChangeText={handleStartChange}
|
|
94
|
+
onBlur={handleBlur}
|
|
95
|
+
onSubmitEditing={handleBlur}
|
|
96
|
+
placeholderTextColor="#999"
|
|
97
|
+
/>
|
|
98
|
+
<TextInput
|
|
99
|
+
style={[styles.input, endError && styles.inputError]}
|
|
100
|
+
placeholder={resolveInvoiceRangeEndPlaceholder()}
|
|
101
|
+
value={endValue}
|
|
102
|
+
onChangeText={handleEndChange}
|
|
103
|
+
onBlur={handleBlur}
|
|
104
|
+
onSubmitEditing={handleBlur}
|
|
105
|
+
placeholderTextColor="#999"
|
|
106
|
+
/>
|
|
107
|
+
</View>
|
|
108
|
+
|
|
109
|
+
{startError && <Text style={styles.errorText}>{startError}</Text>}
|
|
110
|
+
{endError && <Text style={styles.errorText}>{endError}</Text>}
|
|
111
|
+
</View>
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export default InvoiceDueDateRangeFilterInput
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native'
|
|
2
|
+
|
|
3
|
+
const styles = StyleSheet.create({
|
|
4
|
+
container: {
|
|
5
|
+
marginVertical: 10,
|
|
6
|
+
marginHorizontal: 8,
|
|
7
|
+
flex: 1,
|
|
8
|
+
},
|
|
9
|
+
label: {
|
|
10
|
+
fontSize: 14,
|
|
11
|
+
fontWeight: '600',
|
|
12
|
+
marginBottom: 5,
|
|
13
|
+
color: '#333',
|
|
14
|
+
},
|
|
15
|
+
input: {
|
|
16
|
+
flex: 1,
|
|
17
|
+
borderWidth: 1,
|
|
18
|
+
borderColor: '#ccc',
|
|
19
|
+
borderRadius: 6,
|
|
20
|
+
paddingHorizontal: 12,
|
|
21
|
+
paddingVertical: 8,
|
|
22
|
+
fontSize: 14,
|
|
23
|
+
backgroundColor: '#fff',
|
|
24
|
+
},
|
|
25
|
+
row: {
|
|
26
|
+
flexDirection: 'row',
|
|
27
|
+
gap: 8,
|
|
28
|
+
},
|
|
29
|
+
inputError: {
|
|
30
|
+
borderColor: '#c10015',
|
|
31
|
+
},
|
|
32
|
+
errorText: {
|
|
33
|
+
color: '#c10015',
|
|
34
|
+
fontSize: 12,
|
|
35
|
+
marginTop: 5,
|
|
36
|
+
},
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
export default styles
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
|
+
import { View, Text } from 'react-native'
|
|
3
|
+
import { Picker } from '@react-native-picker/picker'
|
|
4
|
+
import { useStore } from '@store';
|
|
5
|
+
import styles from './SelectList.styles';
|
|
6
|
+
|
|
7
|
+
const CategorySelect = ({ context = null }) => {
|
|
8
|
+
const peopleStore = useStore('people');
|
|
9
|
+
const { getters: peopleGetters } = peopleStore;
|
|
10
|
+
const { currentCompany } = peopleGetters;
|
|
11
|
+
|
|
12
|
+
const { getters: categoryGetters, actions: categoryActions } = useStore('categories')
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
categoryActions.getItems({ context:context, people:currentCompany?.id })
|
|
16
|
+
}, [context, currentCompany])
|
|
17
|
+
|
|
18
|
+
const categories = categoryGetters.items || [];
|
|
19
|
+
|
|
20
|
+
const selectedValue = categoryGetters.item ? categoryGetters.item.id : ''
|
|
21
|
+
|
|
22
|
+
const handleChange = (value) => {
|
|
23
|
+
|
|
24
|
+
const selected = categories.find(s => s.id == value)
|
|
25
|
+
if (selected) {
|
|
26
|
+
categoryActions.setItem(selected)
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
categoryActions.setItem({});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<View style={styles.container}>
|
|
35
|
+
<Text style={styles.label}>{global.t?.t("invoice", "label", "category")}</Text>
|
|
36
|
+
<View style={styles.pickerWrapper}>
|
|
37
|
+
<Picker
|
|
38
|
+
selectedValue={selectedValue}
|
|
39
|
+
onValueChange={handleChange}
|
|
40
|
+
>
|
|
41
|
+
<Picker.Item label={global.t?.t("invoice", "label", "select")} value={''} />
|
|
42
|
+
{categories.map(category => (
|
|
43
|
+
<Picker.Item
|
|
44
|
+
key={category.id}
|
|
45
|
+
label={category.name}
|
|
46
|
+
value={category.id}
|
|
47
|
+
color={category.color}
|
|
48
|
+
/>
|
|
49
|
+
))}
|
|
50
|
+
</Picker>
|
|
51
|
+
</View>
|
|
52
|
+
</View>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export default CategorySelect
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
|
+
import { View, Text } from 'react-native'
|
|
3
|
+
import { Picker } from '@react-native-picker/picker'
|
|
4
|
+
import { useStore } from '@store';
|
|
5
|
+
import styles from './SelectList.styles';
|
|
6
|
+
|
|
7
|
+
const PaymentTypeList = ({ context = null }) => {
|
|
8
|
+
const peopleStore = useStore('people');
|
|
9
|
+
const { getters: peopleGetters } = peopleStore;
|
|
10
|
+
const { currentCompany } = peopleGetters;
|
|
11
|
+
|
|
12
|
+
const { getters: paymentTypeGetters, actions: paymentTypeActions } = useStore('paymentType')
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
paymentTypeActions.getItems({ context: context, people: currentCompany?.id })
|
|
16
|
+
}, [context, currentCompany])
|
|
17
|
+
|
|
18
|
+
const paymentMethods = paymentTypeGetters.items || [];
|
|
19
|
+
|
|
20
|
+
const selectedValue = paymentTypeGetters.item ? paymentTypeGetters.item.id : ''
|
|
21
|
+
|
|
22
|
+
const handleChange = (value) => {
|
|
23
|
+
const selected = paymentMethods.find(s => s.id == value)
|
|
24
|
+
if (selected) {
|
|
25
|
+
paymentTypeActions.setItem(selected)
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
paymentTypeActions.setItem({});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<View style={styles.container}>
|
|
34
|
+
<Text style={styles.label}>{global.t?.t("invoice", "label", "payment method")}</Text>
|
|
35
|
+
|
|
36
|
+
<View style={styles.pickerWrapper}>
|
|
37
|
+
<Picker
|
|
38
|
+
selectedValue={selectedValue}
|
|
39
|
+
onValueChange={handleChange}
|
|
40
|
+
>
|
|
41
|
+
<Picker.Item label={global.t?.t("invoice", "label", "select")} value={''} />
|
|
42
|
+
{paymentMethods.map(method => (
|
|
43
|
+
<Picker.Item
|
|
44
|
+
key={method.id}
|
|
45
|
+
label={method.paymentType} // TO DO // traduzir
|
|
46
|
+
value={method.id}
|
|
47
|
+
/>
|
|
48
|
+
))}
|
|
49
|
+
</Picker>
|
|
50
|
+
</View>
|
|
51
|
+
</View>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export default PaymentTypeList
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
|
+
import { View, Text } from 'react-native'
|
|
3
|
+
import { Picker } from '@react-native-picker/picker'
|
|
4
|
+
import { useStore } from '@store';
|
|
5
|
+
import styles from './SelectList.styles';
|
|
6
|
+
|
|
7
|
+
const ReceiverList = ({ context = null }) => {
|
|
8
|
+
const peopleStore = useStore('people');
|
|
9
|
+
const { getters: peopleGetters } = peopleStore;
|
|
10
|
+
const { currentCompany } = peopleGetters;
|
|
11
|
+
|
|
12
|
+
const { getters: receiverGetters, actions: receiverActions } = useStore('people')
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
receiverActions.getItems({ context:context, people:currentCompany?.id })
|
|
16
|
+
}, [context, currentCompany])
|
|
17
|
+
|
|
18
|
+
const receivers = receiverGetters.items || [];
|
|
19
|
+
|
|
20
|
+
const selectedValue = receiverGetters.item ? receiverGetters.item.id : ''
|
|
21
|
+
|
|
22
|
+
const handleChange = (value) => {
|
|
23
|
+
|
|
24
|
+
const selected = receivers.find(s => s.id == value)
|
|
25
|
+
if (selected) {
|
|
26
|
+
receiverActions.setItem(selected)
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
receiverActions.setItem({});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<View style={styles.container}>
|
|
35
|
+
<Text style={styles.label}>{global.t?.t("invoice", "label", "receiver")}</Text>
|
|
36
|
+
<View style={styles.pickerWrapper}>
|
|
37
|
+
<Picker
|
|
38
|
+
selectedValue={selectedValue}
|
|
39
|
+
onValueChange={handleChange}
|
|
40
|
+
>
|
|
41
|
+
<Picker.Item label={global.t?.t("invoice", "label", "select")} value={''} />
|
|
42
|
+
{receivers.map(receiver => (
|
|
43
|
+
<Picker.Item
|
|
44
|
+
key={receiver.id}
|
|
45
|
+
label={receiver.name}
|
|
46
|
+
value={receiver.id}
|
|
47
|
+
color={receiver.color}
|
|
48
|
+
/>
|
|
49
|
+
))}
|
|
50
|
+
</Picker>
|
|
51
|
+
</View>
|
|
52
|
+
</View>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export default ReceiverList
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native'
|
|
2
|
+
|
|
3
|
+
const styles = StyleSheet.create({
|
|
4
|
+
container: {
|
|
5
|
+
marginVertical: 10,
|
|
6
|
+
},
|
|
7
|
+
label: {
|
|
8
|
+
fontSize: 16,
|
|
9
|
+
marginBottom: 5,
|
|
10
|
+
},
|
|
11
|
+
pickerWrapper: {
|
|
12
|
+
borderWidth: 1,
|
|
13
|
+
borderColor: '#ccc',
|
|
14
|
+
borderRadius: 6,
|
|
15
|
+
},
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
export default styles
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
|
+
import { View, Text } from 'react-native'
|
|
3
|
+
import { Picker } from '@react-native-picker/picker'
|
|
4
|
+
import { useStore } from '@store';
|
|
5
|
+
import styles from './SelectList.styles';
|
|
6
|
+
|
|
7
|
+
const StatusSelect = ({ context = 'null' }) => {
|
|
8
|
+
const { getters: statusGetters, actions: statusActions } = useStore('status')
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
statusActions.getItems({ context })
|
|
12
|
+
}, [context])
|
|
13
|
+
|
|
14
|
+
const statuses = (statusGetters.items || []).filter(
|
|
15
|
+
item => item.context === context
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
const selectedValue = statusGetters.item ? statusGetters.item.id : ''
|
|
19
|
+
|
|
20
|
+
const handleChange = (value) => {
|
|
21
|
+
|
|
22
|
+
const selected = statuses.find(s => s.id == value)
|
|
23
|
+
if (selected) {
|
|
24
|
+
statusActions.setItem(selected)
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
statusActions.setItem({});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<View style={styles.container}>
|
|
33
|
+
<Text style={styles.label}>{global.t?.t("invoice", "label", "status")}</Text>
|
|
34
|
+
|
|
35
|
+
<View style={styles.pickerWrapper}>
|
|
36
|
+
<Picker
|
|
37
|
+
selectedValue={selectedValue}
|
|
38
|
+
onValueChange={handleChange}
|
|
39
|
+
>
|
|
40
|
+
<Picker.Item label={global.t?.t("invoice", "label", "select")} value={''} />
|
|
41
|
+
{statuses.map(status => (
|
|
42
|
+
<Picker.Item
|
|
43
|
+
key={status.id}
|
|
44
|
+
label={global.t?.t("invoice", "label", status.status)}
|
|
45
|
+
value={status.id}
|
|
46
|
+
color={status.color}
|
|
47
|
+
/>
|
|
48
|
+
))}
|
|
49
|
+
</Picker>
|
|
50
|
+
</View>
|
|
51
|
+
</View>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export default StatusSelect
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
|
+
import { View, Text } from 'react-native'
|
|
3
|
+
import { Picker } from '@react-native-picker/picker'
|
|
4
|
+
import { useStore } from '@store';
|
|
5
|
+
import styles from './SelectList.styles';
|
|
6
|
+
|
|
7
|
+
const WalletSelect = ({ people_id }) => {
|
|
8
|
+
const { getters: walletGetters, actions: walletActions } = useStore('wallet')
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (people_id)
|
|
12
|
+
walletActions.getItems({ people: people_id })
|
|
13
|
+
}, [people_id])
|
|
14
|
+
|
|
15
|
+
const wallets = walletGetters.items || [];
|
|
16
|
+
|
|
17
|
+
const selectedValue = walletGetters.item ? walletGetters.item.id : ''
|
|
18
|
+
|
|
19
|
+
const handleChange = (value) => {
|
|
20
|
+
|
|
21
|
+
const selected = wallets.find(s => s.id == value)
|
|
22
|
+
if (selected) {
|
|
23
|
+
walletActions.setItem(selected)
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
walletActions.setItem({});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<View style={styles.container}>
|
|
32
|
+
<Text style={styles.label}>{global.t?.t("invoice", "label", "wallet")}</Text>
|
|
33
|
+
|
|
34
|
+
<View style={styles.pickerWrapper}>
|
|
35
|
+
<Picker
|
|
36
|
+
selectedValue={selectedValue}
|
|
37
|
+
onValueChange={handleChange}
|
|
38
|
+
>
|
|
39
|
+
<Picker.Item label={global.t?.t("invoice", "label", "select")} value={''} />
|
|
40
|
+
{wallets.map(wallet => (
|
|
41
|
+
<Picker.Item
|
|
42
|
+
key={wallet.id}
|
|
43
|
+
label={wallet.wallet}
|
|
44
|
+
value={wallet.id}
|
|
45
|
+
color={wallet.color}
|
|
46
|
+
/>
|
|
47
|
+
))}
|
|
48
|
+
</Picker>
|
|
49
|
+
</View>
|
|
50
|
+
</View>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default WalletSelect
|