@controleonline/ui-common 1.2.81 → 1.2.82
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/package.json +1 -1
- package/src/react/pages/Devices/detail/DeviceDetailPaymentSection.js +25 -21
- package/src/react/pages/Devices/detail/DeviceDetailScreen.js +3 -1
- package/src/react/pages/Devices/detail/useDeviceDetailStateA.js +5 -0
- package/src/react/pages/Devices/detail/useDeviceDetailStateB.js +30 -3
package/package.json
CHANGED
|
@@ -10,31 +10,35 @@ import styles from '../../DeviceDetailPage.styles';
|
|
|
10
10
|
*/
|
|
11
11
|
export default function DeviceDetailPaymentSection(ctx) {
|
|
12
12
|
const {
|
|
13
|
-
showPdvPaymentTypesTab,
|
|
13
|
+
showPdvPaymentTypesTab,
|
|
14
|
+
renderHelpButton,
|
|
15
|
+
deviceId,
|
|
16
|
+
savePaymentTypeConfigs,
|
|
17
|
+
savingPaymentTypes,
|
|
18
|
+
currentCompany,
|
|
19
|
+
configs,
|
|
14
20
|
} = ctx;
|
|
15
21
|
|
|
16
22
|
if (!showPdvPaymentTypesTab) return null;
|
|
17
23
|
|
|
18
24
|
return (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
)}
|
|
38
|
-
|
|
25
|
+
<View style={styles.section}>
|
|
26
|
+
<View style={styles.sectionHeaderRow}>
|
|
27
|
+
<Text style={styles.sectionTitle}>
|
|
28
|
+
<Icon name="credit-card" size={13} /> {' '}Pagamentos do device
|
|
29
|
+
</Text>
|
|
30
|
+
{renderHelpButton(
|
|
31
|
+
'Pagamentos do device',
|
|
32
|
+
'Selecione os meios de pagamento que este device pode exibir e usar nas opções de pagamento. Os wallets entram só para organizar a lista.',
|
|
33
|
+
)}
|
|
34
|
+
</View>
|
|
35
|
+
<PaymentTypesByWalletTab
|
|
36
|
+
currentCompanyId={currentCompany?.id}
|
|
37
|
+
configs={configs}
|
|
38
|
+
disableSelection={savingPaymentTypes}
|
|
39
|
+
isSaving={savingPaymentTypes}
|
|
40
|
+
onPersistSelectedPaymentTypeIds={savePaymentTypeConfigs}
|
|
41
|
+
/>
|
|
42
|
+
</View>
|
|
39
43
|
);
|
|
40
44
|
}
|
|
@@ -326,7 +326,8 @@ const DeviceDetailScreen = () => {
|
|
|
326
326
|
shouldShowOrderVisibility,
|
|
327
327
|
shouldShowRemotePayment,
|
|
328
328
|
shouldShowDeviceBehavior,
|
|
329
|
-
shouldShowRemoteCommands
|
|
329
|
+
shouldShowRemoteCommands,
|
|
330
|
+
currentCompany,
|
|
330
331
|
} = { ...state, ...loaders, ...actions, ...saves };
|
|
331
332
|
|
|
332
333
|
const detailCtx = {
|
|
@@ -357,6 +358,7 @@ const DeviceDetailScreen = () => {
|
|
|
357
358
|
showPdvMovementTab, showPdvPaymentTypesTab, showPdvOperationTab,
|
|
358
359
|
inflowData, productTotal, wallets, filteredProducts, search, setSearch,
|
|
359
360
|
loadingMovementData, deviceId, savePaymentTypeConfigs, savingPaymentTypes,
|
|
361
|
+
configs, currentCompany,
|
|
360
362
|
};
|
|
361
363
|
|
|
362
364
|
const {
|
|
@@ -337,6 +337,10 @@ export default function useDeviceDetailStateA() {
|
|
|
337
337
|
() =>
|
|
338
338
|
String(runtimeDevice?.type || runtimeDevice?.deviceType || '')
|
|
339
339
|
.trim()
|
|
340
|
+
.toUpperCase(),
|
|
341
|
+
[runtimeDevice?.deviceType, runtimeDevice?.type],
|
|
342
|
+
);
|
|
343
|
+
|
|
340
344
|
return {
|
|
341
345
|
navigation,
|
|
342
346
|
deviceId,
|
|
@@ -480,5 +484,6 @@ export default function useDeviceDetailStateA() {
|
|
|
480
484
|
appVersion,
|
|
481
485
|
runtimeDeviceId,
|
|
482
486
|
runtimeDeviceType,
|
|
487
|
+
currentCompany,
|
|
483
488
|
};
|
|
484
489
|
}
|
|
@@ -51,9 +51,7 @@ export default function useDeviceDetailStateB(deps) {
|
|
|
51
51
|
setAlias, editingAlias, setEditingAlias, aliasInput, setAliasInput, savingAlias, setSavingAlias, removingDevice, setRemovingDevice, aliasInputRef, skipAliasSyncFromStoreRef, isOpen,
|
|
52
52
|
hasLocalPaymentGateway, paymentDeviceOptions, displayOptions, printerOptions, selectedPosOperationModeOption, pickerMode, packageVersion, appVersion, runtimeDeviceId, runtimeDeviceType,
|
|
53
53
|
} = deps;
|
|
54
|
-
|
|
55
|
-
[runtimeDevice?.deviceType, runtimeDevice?.type],
|
|
56
|
-
);
|
|
54
|
+
|
|
57
55
|
const isEditingRuntimeDevice = useMemo(
|
|
58
56
|
() =>
|
|
59
57
|
!!runtimeDeviceId &&
|
|
@@ -64,8 +62,37 @@ export default function useDeviceDetailStateB(deps) {
|
|
|
64
62
|
|
|
65
63
|
const resolveDeviceContext = useCallback(async () => {
|
|
66
64
|
if (deviceString && deviceType) {
|
|
65
|
+
return {
|
|
66
|
+
deviceData: null,
|
|
67
|
+
deviceString,
|
|
68
|
+
deviceType,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (!deviceId) {
|
|
73
|
+
return {
|
|
74
|
+
deviceData: null,
|
|
75
|
+
deviceString: '',
|
|
76
|
+
deviceType: '',
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const fetchedDevice = await actionsRef.current.deviceActions
|
|
81
|
+
.get(deviceId)
|
|
82
|
+
.catch(() => null);
|
|
83
|
+
|
|
84
|
+
return {
|
|
85
|
+
deviceData: fetchedDevice,
|
|
86
|
+
deviceString: String(fetchedDevice?.device || '').trim(),
|
|
87
|
+
deviceType: String(fetchedDevice?.type || fetchedDevice?.deviceType || '')
|
|
88
|
+
.trim()
|
|
89
|
+
.toUpperCase(),
|
|
90
|
+
};
|
|
91
|
+
}, [deviceId, deviceString, deviceType]);
|
|
92
|
+
|
|
67
93
|
return {
|
|
68
94
|
isEditingRuntimeDevice,
|
|
69
95
|
resolveDeviceContext,
|
|
70
96
|
};
|
|
71
97
|
}
|
|
98
|
+
|