ordering-ui-react-native 0.23.27 → 0.23.29
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
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useState, useCallback } from 'react'
|
|
2
|
-
|
|
3
2
|
import { Platform, StyleSheet, View, TouchableOpacity, ScrollView } from 'react-native';
|
|
4
3
|
import AntDesignIcon from 'react-native-vector-icons/AntDesign'
|
|
5
4
|
|
|
@@ -25,7 +24,8 @@ import {
|
|
|
25
24
|
useLanguage,
|
|
26
25
|
useUtils,
|
|
27
26
|
useConfig,
|
|
28
|
-
useSession
|
|
27
|
+
useSession,
|
|
28
|
+
useApi
|
|
29
29
|
} from 'ordering-components/native';
|
|
30
30
|
import { useTheme } from 'styled-components/native';
|
|
31
31
|
import { ReviewCustomer } from '../ReviewCustomer'
|
|
@@ -46,6 +46,7 @@ interface OrderContent {
|
|
|
46
46
|
export const OrderContentComponent = (props: OrderContent) => {
|
|
47
47
|
const [, t] = useLanguage();
|
|
48
48
|
const theme = useTheme()
|
|
49
|
+
const [ordering] = useApi()
|
|
49
50
|
const [{ user }] = useSession()
|
|
50
51
|
const { order, logisticOrderStatus, isOrderGroup, lastOrder } = props;
|
|
51
52
|
const [{ parsePrice, parseNumber }] = useUtils();
|
|
@@ -439,9 +440,19 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
439
440
|
</OText>
|
|
440
441
|
|
|
441
442
|
{!!order?.comment && (
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
443
|
+
<>
|
|
444
|
+
<OText>
|
|
445
|
+
{`${t('ORDER_COMMENT', 'Order Comment')}: `}
|
|
446
|
+
</OText>
|
|
447
|
+
<OText
|
|
448
|
+
{...(ordering?.project?.includes('delosi') && {
|
|
449
|
+
color: theme.colors.primary,
|
|
450
|
+
weight: 'bold'
|
|
451
|
+
})}
|
|
452
|
+
>
|
|
453
|
+
{order?.comment}
|
|
454
|
+
</OText>
|
|
455
|
+
</>
|
|
445
456
|
)}
|
|
446
457
|
|
|
447
458
|
{order?.products?.length > 0 &&
|
package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx
CHANGED
|
@@ -1,87 +1,90 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { useTheme } from 'styled-components/native'
|
|
3
2
|
import { StyleSheet } from 'react-native'
|
|
4
|
-
import { SubCategoriesContainer, ContainerButton } from './styles'
|
|
5
|
-
import { OButton } from '../../shared'
|
|
6
3
|
import { useLanguage } from 'ordering-components/native'
|
|
4
|
+
import FIcon from 'react-native-vector-icons/Feather'
|
|
5
|
+
import { SubCategoriesContainer, ContainerButton } from './styles'
|
|
6
|
+
import { OButton, OText } from '../../shared'
|
|
7
7
|
|
|
8
8
|
function SubcategoriesComponentPropsAreEqual(prev: any, next: any) {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
return prev.subcategoriesSelected === next.subcategoriesSelected &&
|
|
10
|
+
prev.category === next.category
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
interface SubcategoriesComponentParams {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
subcategoriesSelected?: any,
|
|
15
|
+
category?: any,
|
|
16
|
+
onClickSubcategory: any
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
const SubcategoriesComponent = (props: SubcategoriesComponentParams) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
const {
|
|
21
|
+
subcategoriesSelected,
|
|
22
|
+
category,
|
|
23
|
+
onClickSubcategory
|
|
24
|
+
} = props
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const allsubcategorySelected = !subcategoriesSelected?.some((subcategory: any) => category?.id === subcategory?.parent_category_id)
|
|
26
|
+
const [, t] = useLanguage()
|
|
27
|
+
const allsubcategorySelected = !subcategoriesSelected?.some((subcategory: any) => category?.id === subcategory?.parent_category_id)
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
marginLeft: 5,
|
|
43
|
-
marginRight: 5,
|
|
44
|
-
marginBottom: 10,
|
|
45
|
-
height: 35,
|
|
46
|
-
paddingLeft: 3,
|
|
47
|
-
paddingRight: 3,
|
|
48
|
-
}
|
|
49
|
-
});
|
|
29
|
+
const bpStyles = StyleSheet.create({
|
|
30
|
+
categoryButtonStyle: {
|
|
31
|
+
borderWidth: 0,
|
|
32
|
+
marginRight: 5,
|
|
33
|
+
borderRadius: 8,
|
|
34
|
+
marginBottom: 5,
|
|
35
|
+
height: 35,
|
|
36
|
+
padding: 0,
|
|
37
|
+
paddingLeft: 3,
|
|
38
|
+
paddingRight: 3,
|
|
39
|
+
}
|
|
40
|
+
});
|
|
50
41
|
|
|
51
42
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
43
|
+
return (
|
|
44
|
+
<SubCategoriesContainer>
|
|
45
|
+
<ContainerButton
|
|
46
|
+
isSelected={allsubcategorySelected}
|
|
47
|
+
>
|
|
48
|
+
<OButton
|
|
49
|
+
onClick={() => onClickSubcategory(null, category)}
|
|
50
|
+
text={
|
|
51
|
+
allsubcategorySelected
|
|
52
|
+
? <OText color='#FFF'>
|
|
53
|
+
{t('ALL', 'All')}{' '}
|
|
54
|
+
<FIcon name='x-circle' size={16} />
|
|
55
|
+
</OText>
|
|
56
|
+
: t('ALL', 'All')
|
|
57
|
+
}
|
|
58
|
+
style={bpStyles.categoryButtonStyle}
|
|
59
|
+
textStyle={{ fontSize: 12 }}
|
|
60
|
+
/>
|
|
61
|
+
</ContainerButton>
|
|
62
|
+
{category?.subcategories?.map((subcategory: any) => {
|
|
63
|
+
const isSubcategorySelected = subcategoriesSelected?.find((_subcategory: any) => _subcategory?.id === subcategory?.id)
|
|
64
|
+
return (
|
|
65
|
+
<ContainerButton
|
|
66
|
+
key={subcategory?.id}
|
|
67
|
+
isSelected={isSubcategorySelected}
|
|
68
|
+
>
|
|
69
|
+
<OButton
|
|
70
|
+
onClick={() => onClickSubcategory(subcategory, category)}
|
|
71
|
+
text={
|
|
72
|
+
isSubcategorySelected
|
|
73
|
+
? <OText color='#FFF'>
|
|
74
|
+
{subcategory?.name}{' '}
|
|
75
|
+
<FIcon name='x-circle' size={16} />
|
|
76
|
+
</OText>
|
|
77
|
+
: subcategory?.name
|
|
78
|
+
}
|
|
79
|
+
style={bpStyles.categoryButtonStyle}
|
|
80
|
+
textStyle={{ fontSize: 12 }}
|
|
81
|
+
/>
|
|
82
|
+
</ContainerButton>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
)}
|
|
86
|
+
</SubCategoriesContainer>
|
|
87
|
+
)
|
|
85
88
|
}
|
|
86
89
|
|
|
87
90
|
export const SubcategoriesComponentMemoized = React.memo(SubcategoriesComponent, SubcategoriesComponentPropsAreEqual)
|
|
@@ -65,11 +65,10 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
65
65
|
return
|
|
66
66
|
}
|
|
67
67
|
const categoryFounded = subcategoriesSelected.find((_subcategory: any) => subCategory?.id === _subcategory?.id)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
68
|
+
setSubcategoriesSelected?.(categoryFounded
|
|
69
|
+
? subcategoriesSelected.filter((_subcategory: any) => subCategory?.id !== _subcategory?.id)
|
|
70
|
+
: [...subcategoriesSelected, subCategory]
|
|
71
|
+
)
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
return (
|