@scrumble-nl/gatherer-frontend 0.2.3 → 1.0.1
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/README.md +10 -10
- package/lib/commonjs/context/gatherer-context.js +10 -6
- package/lib/commonjs/context/gatherer-context.js.map +1 -1
- package/lib/commonjs/context/scan-context.js.map +1 -1
- package/lib/commonjs/hooks/use-gatherer.js.map +1 -1
- package/lib/commonjs/hooks/use-scanner.js.map +1 -1
- package/lib/commonjs/picker/partials/modal/pick-modal.js +3 -2
- package/lib/commonjs/picker/partials/modal/pick-modal.js.map +1 -1
- package/lib/commonjs/picker/partials/modal/pick-quantity-select.js +1 -1
- package/lib/commonjs/picker/partials/modal/pick-quantity-select.js.map +1 -1
- package/lib/commonjs/picker/partials/pick-amount.js +9 -2
- package/lib/commonjs/picker/partials/pick-amount.js.map +1 -1
- package/lib/commonjs/picker/partials/product-info.js +11 -5
- package/lib/commonjs/picker/partials/product-info.js.map +1 -1
- package/lib/commonjs/picker/picker.js +9 -0
- package/lib/commonjs/picker/picker.js.map +1 -1
- package/lib/commonjs/picker/styles/pick-amount-styles.js +0 -1
- package/lib/commonjs/picker/styles/pick-amount-styles.js.map +1 -1
- package/lib/commonjs/shared/default-pick-group-item.js.map +1 -1
- package/lib/commonjs/types/config/config.d.js.map +1 -1
- package/lib/commonjs/types/pick-group/pick-group.d.js.map +1 -1
- package/lib/commonjs/types/pick-item/pick-item.d.js.map +1 -1
- package/lib/module/context/gatherer-context.js +10 -6
- package/lib/module/context/gatherer-context.js.map +1 -1
- package/lib/module/context/scan-context.js.map +1 -1
- package/lib/module/hooks/use-gatherer.js.map +1 -1
- package/lib/module/hooks/use-scanner.js.map +1 -1
- package/lib/module/picker/partials/modal/pick-modal.js +3 -2
- package/lib/module/picker/partials/modal/pick-modal.js.map +1 -1
- package/lib/module/picker/partials/modal/pick-quantity-select.js +1 -1
- package/lib/module/picker/partials/modal/pick-quantity-select.js.map +1 -1
- package/lib/module/picker/partials/pick-amount.js +9 -2
- package/lib/module/picker/partials/pick-amount.js.map +1 -1
- package/lib/module/picker/partials/product-info.js +11 -5
- package/lib/module/picker/partials/product-info.js.map +1 -1
- package/lib/module/picker/picker.js +9 -0
- package/lib/module/picker/picker.js.map +1 -1
- package/lib/module/picker/styles/pick-amount-styles.js +1 -2
- package/lib/module/picker/styles/pick-amount-styles.js.map +1 -1
- package/lib/module/shared/default-pick-group-item.js.map +1 -1
- package/lib/module/types/config/config.d.js.map +1 -1
- package/lib/module/types/pick-group/pick-group.d.js.map +1 -1
- package/lib/module/types/pick-item/pick-item.d.js.map +1 -1
- package/lib/typescript/context/gatherer-context.d.ts +6 -7
- package/lib/typescript/context/scan-context.d.ts +4 -4
- package/lib/typescript/hooks/use-gatherer.d.ts +1 -1
- package/lib/typescript/picker/partials/modal/pick-modal.d.ts +1 -0
- package/lib/typescript/picker/partials/modal/pick-quantity-select.d.ts +1 -1
- package/lib/typescript/picker/partials/pick-amount.d.ts +4 -1
- package/lib/typescript/picker/partials/product-info.d.ts +8 -1
- package/lib/typescript/picker/picker.d.ts +4 -3
- package/lib/typescript/picker/styles/pick-amount-styles.d.ts +0 -1
- package/lib/typescript/shared/default-pick-group-item.d.ts +1 -1
- package/package.json +2 -3
- package/src/context/gatherer-context.tsx +23 -25
- package/src/context/scan-context.tsx +4 -4
- package/src/hooks/use-gatherer.tsx +2 -2
- package/src/hooks/use-scanner.tsx +1 -1
- package/src/picker/partials/modal/pick-modal.tsx +3 -2
- package/src/picker/partials/modal/pick-quantity-select.tsx +2 -2
- package/src/picker/partials/pick-amount.tsx +9 -2
- package/src/picker/partials/product-info.tsx +14 -5
- package/src/picker/picker.tsx +14 -2
- package/src/picker/styles/pick-amount-styles.ts +1 -2
- package/src/shared/default-pick-group-item.ts +1 -1
- package/src/types/config/config.d.ts +4 -2
- package/src/types/pick-group/pick-group.d.ts +0 -5
- package/src/types/pick-item/pick-item.d.ts +2 -0
|
@@ -3,11 +3,18 @@ import {View, Text} from 'react-native';
|
|
|
3
3
|
|
|
4
4
|
import {styles} from '../styles/pick-amount-styles';
|
|
5
5
|
import {useGatherer} from '../../hooks/use-gatherer';
|
|
6
|
+
import {PRIMARY_COLOR} from '../../shared/constants';
|
|
6
7
|
|
|
7
8
|
const {container, pickBoxContainer, pickText} = styles;
|
|
8
9
|
|
|
9
|
-
export
|
|
10
|
+
export interface pickAmountProps {
|
|
11
|
+
backgroundColor?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const PickAmount = (props: pickAmountProps): JSX.Element => {
|
|
10
15
|
const {pickItem} = useGatherer();
|
|
16
|
+
const {backgroundColor} = props;
|
|
17
|
+
const backgroundStyle = {backgroundColor: backgroundColor ?? PRIMARY_COLOR};
|
|
11
18
|
|
|
12
19
|
if (!pickItem.quantity) {
|
|
13
20
|
return <></>;
|
|
@@ -15,7 +22,7 @@ export const PickAmount = (): JSX.Element => {
|
|
|
15
22
|
|
|
16
23
|
return (
|
|
17
24
|
<View style={container}>
|
|
18
|
-
<View style={pickBoxContainer}>
|
|
25
|
+
<View style={[pickBoxContainer, backgroundStyle]}>
|
|
19
26
|
<Text style={pickText}>{pickItem.quantity ?? 1}</Text>
|
|
20
27
|
</View>
|
|
21
28
|
</View>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, {ReactNode} from 'react';
|
|
2
2
|
import {View, Text} from 'react-native';
|
|
3
3
|
|
|
4
4
|
import {useTranslation} from 'react-i18next';
|
|
@@ -9,20 +9,29 @@ import {DataRow} from '../../shared/layout/data-row';
|
|
|
9
9
|
|
|
10
10
|
const {container, productName, productInfo} = styles;
|
|
11
11
|
|
|
12
|
-
export
|
|
12
|
+
export interface productInfoProps {
|
|
13
|
+
name?: string;
|
|
14
|
+
quantity?: number;
|
|
15
|
+
barcode?: string;
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const ProductInfo = (props: productInfoProps): JSX.Element => {
|
|
13
20
|
const {pickItem} = useGatherer();
|
|
14
21
|
const {t} = useTranslation();
|
|
22
|
+
const {name, quantity, barcode, children} = props;
|
|
15
23
|
|
|
16
24
|
return (
|
|
17
25
|
<View style={container}>
|
|
18
|
-
<Text style={productName}>{pickItem?.pickItem.name}</Text>
|
|
26
|
+
<Text style={productName}>{name ?? pickItem?.pickItem.name}</Text>
|
|
19
27
|
<View style={productInfo}>
|
|
20
28
|
<DataRow
|
|
21
29
|
leftTitle={t('picker.product-info.barcode')}
|
|
22
|
-
leftContent={pickItem.barcode}
|
|
30
|
+
leftContent={barcode ?? pickItem.barcode}
|
|
23
31
|
rightTitle={t('picker.product-info.pick-quantity')}
|
|
24
|
-
rightContent={pickItem.quantity}
|
|
32
|
+
rightContent={quantity ?? pickItem.quantity}
|
|
25
33
|
/>
|
|
34
|
+
{children ?? <></>}
|
|
26
35
|
</View>
|
|
27
36
|
</View>
|
|
28
37
|
);
|
package/src/picker/picker.tsx
CHANGED
|
@@ -16,7 +16,8 @@ interface props {
|
|
|
16
16
|
children: ReactNode;
|
|
17
17
|
style?: ViewStyle;
|
|
18
18
|
pickModal?: JSX.Element;
|
|
19
|
-
|
|
19
|
+
onMultiQuantityPick?: () => void;
|
|
20
|
+
shouldLesserPick?: boolean;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
const {container} = styles;
|
|
@@ -31,7 +32,13 @@ const Picker = (props: props): JSX.Element => {
|
|
|
31
32
|
setPickModalVisible(false);
|
|
32
33
|
};
|
|
33
34
|
|
|
34
|
-
const
|
|
35
|
+
const handleMultiQuantityPick = (quantityPicked: number): void => {
|
|
36
|
+
nextPickItem(false, quantityPicked);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const pickModal = props.pickModal ?? (
|
|
40
|
+
<PickModal onPickItems={handleMultiQuantityPick} visible={pickModalVisible} closeModal={closeModal} />
|
|
41
|
+
);
|
|
35
42
|
|
|
36
43
|
const handleScan = useCallback(
|
|
37
44
|
(scan: string): void => {
|
|
@@ -39,6 +46,11 @@ const Picker = (props: props): JSX.Element => {
|
|
|
39
46
|
if (pickItem.quantity === 1) {
|
|
40
47
|
nextPickItem(false, 1);
|
|
41
48
|
} else {
|
|
49
|
+
if (props.pickModal) {
|
|
50
|
+
props.onMultiQuantityPick?.();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
42
54
|
stopScanner();
|
|
43
55
|
setPickModalVisible(true);
|
|
44
56
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {StyleSheet} from 'react-native';
|
|
2
2
|
|
|
3
|
-
import {BIGGEST_FONT,
|
|
3
|
+
import {BIGGEST_FONT, WHITE} from '../../shared/constants';
|
|
4
4
|
|
|
5
5
|
export const styles = StyleSheet.create({
|
|
6
6
|
container: {
|
|
@@ -12,7 +12,6 @@ export const styles = StyleSheet.create({
|
|
|
12
12
|
pickBoxContainer: {
|
|
13
13
|
width: 75,
|
|
14
14
|
height: 75,
|
|
15
|
-
backgroundColor: PRIMARY_COLOR,
|
|
16
15
|
justifyContent: 'center',
|
|
17
16
|
alignItems: 'center',
|
|
18
17
|
borderRadius: 5,
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
type GathererConfig = {
|
|
2
2
|
instance: import('../../../node_modules/axios').AxiosInstance;
|
|
3
3
|
scanImplementation: {
|
|
4
|
-
registerListener: (event:
|
|
4
|
+
registerListener: (event: ScanEvent) => void;
|
|
5
5
|
clearEventListeners: () => void;
|
|
6
6
|
registerEventListener?: () => void;
|
|
7
|
-
onBarcodeReadFail?: (event:
|
|
7
|
+
onBarcodeReadFail?: (event: ScanEvent) => void;
|
|
8
8
|
};
|
|
9
9
|
onLastPick: () => void;
|
|
10
10
|
language?: LanguageConfig;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
type LanguageConfig = 'nl' | 'en';
|
|
14
|
+
|
|
15
|
+
type ScanEvent = (event: {data: string}) => void;
|