ordering-ui-react-native 0.16.59 → 0.16.62
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/themes/business/src/components/UserFormDetails/index.tsx +5 -2
- package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
- package/themes/business/src/types/index.tsx +1 -0
- package/themes/original/src/components/BusinessController/index.tsx +7 -1
- package/themes/original/src/components/BusinessProductsList/index.tsx +5 -1
- package/themes/original/src/components/BusinessProductsListing/index.tsx +4 -1
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +1 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +14 -4
- package/themes/original/src/components/BusinessesListing/index.tsx +3 -2
- package/themes/original/src/components/Checkout/index.tsx +7 -6
- package/themes/original/src/components/OrderSummary/index.tsx +3 -3
- package/themes/original/src/components/OrderTypeSelector/index.tsx +77 -35
- package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
- package/themes/original/src/components/ProductForm/index.tsx +175 -154
- package/themes/original/src/components/ProductForm/styles.tsx +3 -5
- package/themes/original/src/components/ProductOption/index.tsx +1 -1
- package/themes/original/src/components/SingleOrderCard/index.tsx +156 -121
- package/themes/original/src/components/SingleProductCard/index.tsx +11 -4
- package/themes/original/src/components/shared/OBottomPopup.tsx +5 -3
- package/themes/original/src/types/index.tsx +10 -3
|
@@ -151,6 +151,13 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
151
151
|
productTagNameStyle: {
|
|
152
152
|
paddingHorizontal: 6,
|
|
153
153
|
marginRight: 5
|
|
154
|
+
},
|
|
155
|
+
actionContainer: {
|
|
156
|
+
flexDirection: 'row',
|
|
157
|
+
alignItems: 'center',
|
|
158
|
+
justifyContent: 'space-between',
|
|
159
|
+
width: '100%',
|
|
160
|
+
marginTop: 10
|
|
154
161
|
}
|
|
155
162
|
});
|
|
156
163
|
|
|
@@ -304,7 +311,9 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
304
311
|
selOpt == id ? theme.colors.textNormal : theme.colors.textSecondary
|
|
305
312
|
}
|
|
306
313
|
size={selOpt == id ? 14 : 12}
|
|
307
|
-
weight={selOpt == id ? '600' : 'normal'}
|
|
314
|
+
weight={selOpt == id ? '600' : 'normal'}
|
|
315
|
+
style={{ maxWidth: 150 }}
|
|
316
|
+
numberOfLines={1}>
|
|
308
317
|
{name}
|
|
309
318
|
</OText>
|
|
310
319
|
</TouchableOpacity>
|
|
@@ -366,6 +375,77 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
366
375
|
}
|
|
367
376
|
}, [product])
|
|
368
377
|
|
|
378
|
+
const ActionButton = () => {
|
|
379
|
+
return (
|
|
380
|
+
<View
|
|
381
|
+
style={{
|
|
382
|
+
width: isHaveWeight ? '100%' : ((isSoldOut || maxProductQuantity <= 0) ? '60%' : '40%'),
|
|
383
|
+
}}>
|
|
384
|
+
{((productCart &&
|
|
385
|
+
auth &&
|
|
386
|
+
orderState.options?.address_id) || (isSoldOut || maxProductQuantity <= 0)) && (
|
|
387
|
+
<OButton
|
|
388
|
+
onClick={() => handleSaveProduct()}
|
|
389
|
+
imgRightSrc=""
|
|
390
|
+
text={`${orderState.loading
|
|
391
|
+
? t('LOADING', 'Loading')
|
|
392
|
+
: (isSoldOut || maxProductQuantity <= 0)
|
|
393
|
+
? t('SOLD_OUT', 'Sold out')
|
|
394
|
+
: editMode
|
|
395
|
+
? t('UPDATE', 'Update')
|
|
396
|
+
: t('ADD', 'Add')
|
|
397
|
+
}`}
|
|
398
|
+
isDisabled={isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order))}
|
|
399
|
+
textStyle={{
|
|
400
|
+
color: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.primary : theme.colors.white,
|
|
401
|
+
fontSize: orderState.loading || editMode ? 10 : 14
|
|
402
|
+
}}
|
|
403
|
+
style={{
|
|
404
|
+
backgroundColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order)) ? theme.colors.lightGray : theme.colors.primary,
|
|
405
|
+
borderColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order)) ? theme.colors.white : theme.colors.primary,
|
|
406
|
+
opacity: saveErrors || isSoldOut || maxProductQuantity <= 0 ? 0.3 : 1,
|
|
407
|
+
borderRadius: 7.6,
|
|
408
|
+
height: 44,
|
|
409
|
+
shadowOpacity: 0,
|
|
410
|
+
borderWidth: 1,
|
|
411
|
+
marginTop: isHaveWeight ? 10: 0
|
|
412
|
+
}}
|
|
413
|
+
/>
|
|
414
|
+
)}
|
|
415
|
+
{auth &&
|
|
416
|
+
!orderState.options?.address_id &&
|
|
417
|
+
(orderState.loading ? (
|
|
418
|
+
<OButton
|
|
419
|
+
isDisabled
|
|
420
|
+
text={t('LOADING', 'Loading')}
|
|
421
|
+
imgRightSrc=""
|
|
422
|
+
textStyle={{ fontSize: 10 }}
|
|
423
|
+
/>
|
|
424
|
+
) : (
|
|
425
|
+
<OButton onClick={navigation.navigate('AddressList')} />
|
|
426
|
+
))}
|
|
427
|
+
{!auth && (
|
|
428
|
+
<OButton
|
|
429
|
+
isDisabled={isSoldOut || maxProductQuantity <= 0}
|
|
430
|
+
onClick={() => handleRedirectLogin()}
|
|
431
|
+
text={
|
|
432
|
+
isSoldOut || maxProductQuantity <= 0
|
|
433
|
+
? t('SOLD_OUT', 'Sold out')
|
|
434
|
+
: t('LOGIN_SIGNUP', 'Login / Sign Up')
|
|
435
|
+
}
|
|
436
|
+
imgRightSrc=""
|
|
437
|
+
textStyle={{ color: theme.colors.primary, fontSize: 14 }}
|
|
438
|
+
style={{
|
|
439
|
+
height: 44,
|
|
440
|
+
borderColor: theme.colors.primary,
|
|
441
|
+
backgroundColor: theme.colors.white,
|
|
442
|
+
}}
|
|
443
|
+
/>
|
|
444
|
+
)}
|
|
445
|
+
</View>
|
|
446
|
+
)
|
|
447
|
+
}
|
|
448
|
+
|
|
369
449
|
return (
|
|
370
450
|
<SafeAreaView style={{ flex: 1 }}>
|
|
371
451
|
<TopHeader>
|
|
@@ -886,173 +966,114 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
886
966
|
</ScrollView>
|
|
887
967
|
)}
|
|
888
968
|
{!loading && !error && product && (
|
|
889
|
-
<ProductActions ios={Platform?.OS === 'ios'}>
|
|
890
|
-
<View>
|
|
891
|
-
<
|
|
892
|
-
{
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
}>
|
|
945
|
-
<OIcon
|
|
946
|
-
src={theme.images.general.plus}
|
|
947
|
-
width={16}
|
|
948
|
-
color={
|
|
949
|
-
maxProductQuantity <= 0 ||
|
|
969
|
+
<ProductActions ios={Platform?.OS === 'ios'} isColumn={isHaveWeight}>
|
|
970
|
+
<View style={styles.actionContainer}>
|
|
971
|
+
<View>
|
|
972
|
+
<OText size={16} lineHeight={24} weight={'600'}>
|
|
973
|
+
{productCart.total ? parsePrice(productCart?.total) : ''}
|
|
974
|
+
</OText>
|
|
975
|
+
{product?.minimum_per_order && productCart?.quantity < product?.minimum_per_order && <OText size={12} color={theme.colors?.red}>{t('MOBILE_MINIMUM_TO_ORDER', 'Min. _number_ ').replace('_number_', product?.minimum_per_order)}</OText>}
|
|
976
|
+
{product?.maximum_per_order && productCart?.quantity > product?.maximum_per_order && <OText size={12} color={theme.colors?.red}>{t('MOBILE_MAXIMUM_TO_ORDER', 'Max. _number_'.replace('_number_', product?.maximum_per_order))}</OText>}
|
|
977
|
+
</View>
|
|
978
|
+
{productCart && !isSoldOut && maxProductQuantity > 0 && (
|
|
979
|
+
<>
|
|
980
|
+
<View style={styles.quantityControl}>
|
|
981
|
+
<TouchableOpacity
|
|
982
|
+
onPress={decrement}
|
|
983
|
+
disabled={productCart.quantity === 1 || isSoldOut}>
|
|
984
|
+
<OIcon
|
|
985
|
+
src={theme.images.general.minus}
|
|
986
|
+
width={16}
|
|
987
|
+
color={
|
|
988
|
+
productCart.quantity === 1 || isSoldOut
|
|
989
|
+
? theme.colors.backgroundGray
|
|
990
|
+
: theme.colors.backgroundDark
|
|
991
|
+
}
|
|
992
|
+
/>
|
|
993
|
+
</TouchableOpacity>
|
|
994
|
+
{qtyBy?.pieces && (
|
|
995
|
+
<TextInput
|
|
996
|
+
keyboardType='numeric'
|
|
997
|
+
value={`${productCart?.quantity > 0 ? productCart?.quantity : ''}`}
|
|
998
|
+
onChangeText={(val: any) => onChangeProductCartQuantity(parseInt(val))}
|
|
999
|
+
editable={!orderState.loading}
|
|
1000
|
+
style={{
|
|
1001
|
+
borderWidth: 1,
|
|
1002
|
+
textAlign: 'center',
|
|
1003
|
+
minWidth: 60,
|
|
1004
|
+
borderRadius: 8,
|
|
1005
|
+
borderColor: theme.colors.inputBorderColor,
|
|
1006
|
+
height: 44,
|
|
1007
|
+
marginHorizontal: 10
|
|
1008
|
+
}}
|
|
1009
|
+
/>
|
|
1010
|
+
)}
|
|
1011
|
+
{qtyBy?.weight_unit && (
|
|
1012
|
+
<OText
|
|
1013
|
+
size={12}
|
|
1014
|
+
lineHeight={18}
|
|
1015
|
+
style={{ minWidth: 40, textAlign: 'center' }}
|
|
1016
|
+
>
|
|
1017
|
+
{productCart.quantity * product?.weight}
|
|
1018
|
+
</OText>
|
|
1019
|
+
)}
|
|
1020
|
+
<TouchableOpacity
|
|
1021
|
+
onPress={increment}
|
|
1022
|
+
disabled={
|
|
1023
|
+
maxProductQuantity <= 0 ||
|
|
950
1024
|
productCart.quantity >= maxProductQuantity ||
|
|
951
1025
|
isSoldOut
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
size={12}
|
|
965
|
-
lineHeight={18}
|
|
966
|
-
color={qtyBy?.pieces ? theme.colors.primary : theme.colors.textNormal}
|
|
967
|
-
>
|
|
968
|
-
{t('PIECES', 'pcs')}
|
|
969
|
-
</OText>
|
|
970
|
-
</WeightUnitItem>
|
|
1026
|
+
}>
|
|
1027
|
+
<OIcon
|
|
1028
|
+
src={theme.images.general.plus}
|
|
1029
|
+
width={16}
|
|
1030
|
+
color={
|
|
1031
|
+
maxProductQuantity <= 0 ||
|
|
1032
|
+
productCart.quantity >= maxProductQuantity ||
|
|
1033
|
+
isSoldOut
|
|
1034
|
+
? theme.colors.backgroundGray
|
|
1035
|
+
: theme.colors.backgroundDark
|
|
1036
|
+
}
|
|
1037
|
+
/>
|
|
971
1038
|
</TouchableOpacity>
|
|
972
|
-
|
|
1039
|
+
</View>
|
|
1040
|
+
{isHaveWeight && (
|
|
1041
|
+
<WeightUnitSwitch>
|
|
973
1042
|
<TouchableOpacity
|
|
974
|
-
onPress={() => handleSwitchQtyUnit('
|
|
1043
|
+
onPress={() => handleSwitchQtyUnit('pieces')}
|
|
975
1044
|
>
|
|
976
|
-
<WeightUnitItem active={qtyBy?.
|
|
1045
|
+
<WeightUnitItem active={qtyBy?.pieces}>
|
|
977
1046
|
<OText
|
|
978
1047
|
size={12}
|
|
979
1048
|
lineHeight={18}
|
|
980
|
-
color={qtyBy?.
|
|
1049
|
+
color={qtyBy?.pieces ? theme.colors.primary : theme.colors.textNormal}
|
|
981
1050
|
>
|
|
982
|
-
{
|
|
1051
|
+
{t('PIECES', 'pcs')}
|
|
983
1052
|
</OText>
|
|
984
1053
|
</WeightUnitItem>
|
|
985
1054
|
</TouchableOpacity>
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
? t('SOLD_OUT', 'Sold out')
|
|
1005
|
-
: editMode
|
|
1006
|
-
? t('UPDATE', 'Update')
|
|
1007
|
-
: t('ADD', 'Add')
|
|
1008
|
-
}`}
|
|
1009
|
-
isDisabled={isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order))}
|
|
1010
|
-
textStyle={{
|
|
1011
|
-
color: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.primary : theme.colors.white,
|
|
1012
|
-
fontSize: orderState.loading || editMode ? 10 : 14
|
|
1013
|
-
}}
|
|
1014
|
-
style={{
|
|
1015
|
-
backgroundColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order)) ? theme.colors.lightGray : theme.colors.primary,
|
|
1016
|
-
borderColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order)) ? theme.colors.white : theme.colors.primary,
|
|
1017
|
-
opacity: saveErrors || isSoldOut || maxProductQuantity <= 0 ? 0.3 : 1,
|
|
1018
|
-
borderRadius: 7.6,
|
|
1019
|
-
height: 44,
|
|
1020
|
-
shadowOpacity: 0,
|
|
1021
|
-
borderWidth: 1,
|
|
1022
|
-
}}
|
|
1023
|
-
/>
|
|
1024
|
-
)}
|
|
1025
|
-
{auth &&
|
|
1026
|
-
!orderState.options?.address_id &&
|
|
1027
|
-
(orderState.loading ? (
|
|
1028
|
-
<OButton
|
|
1029
|
-
isDisabled
|
|
1030
|
-
text={t('LOADING', 'Loading')}
|
|
1031
|
-
imgRightSrc=""
|
|
1032
|
-
textStyle={{ fontSize: 10 }}
|
|
1033
|
-
/>
|
|
1034
|
-
) : (
|
|
1035
|
-
<OButton onClick={navigation.navigate('AddressList')} />
|
|
1036
|
-
))}
|
|
1037
|
-
{!auth && (
|
|
1038
|
-
<OButton
|
|
1039
|
-
isDisabled={isSoldOut || maxProductQuantity <= 0}
|
|
1040
|
-
onClick={() => handleRedirectLogin()}
|
|
1041
|
-
text={
|
|
1042
|
-
isSoldOut || maxProductQuantity <= 0
|
|
1043
|
-
? t('SOLD_OUT', 'Sold out')
|
|
1044
|
-
: t('LOGIN_SIGNUP', 'Login / Sign Up')
|
|
1045
|
-
}
|
|
1046
|
-
imgRightSrc=""
|
|
1047
|
-
textStyle={{ color: theme.colors.primary, fontSize: 14 }}
|
|
1048
|
-
style={{
|
|
1049
|
-
height: 44,
|
|
1050
|
-
borderColor: theme.colors.primary,
|
|
1051
|
-
backgroundColor: theme.colors.white,
|
|
1052
|
-
}}
|
|
1053
|
-
/>
|
|
1055
|
+
<View style={{ alignItems: 'flex-start' }}>
|
|
1056
|
+
<TouchableOpacity
|
|
1057
|
+
onPress={() => handleSwitchQtyUnit('weight_unit')}
|
|
1058
|
+
>
|
|
1059
|
+
<WeightUnitItem active={qtyBy?.weight_unit}>
|
|
1060
|
+
<OText
|
|
1061
|
+
size={12}
|
|
1062
|
+
lineHeight={18}
|
|
1063
|
+
color={qtyBy?.weight_unit ? theme.colors.primary : theme.colors.textNormal}
|
|
1064
|
+
>
|
|
1065
|
+
{product?.weight_unit}
|
|
1066
|
+
</OText>
|
|
1067
|
+
</WeightUnitItem>
|
|
1068
|
+
</TouchableOpacity>
|
|
1069
|
+
</View>
|
|
1070
|
+
</WeightUnitSwitch>
|
|
1071
|
+
)}
|
|
1072
|
+
</>
|
|
1054
1073
|
)}
|
|
1074
|
+
{!isHaveWeight && <ActionButton />}
|
|
1055
1075
|
</View>
|
|
1076
|
+
{isHaveWeight && <ActionButton />}
|
|
1056
1077
|
</ProductActions>
|
|
1057
1078
|
)}
|
|
1058
1079
|
</SafeAreaView>
|
|
@@ -65,21 +65,19 @@ export const WrapperSubOption = styled.View`
|
|
|
65
65
|
`
|
|
66
66
|
|
|
67
67
|
export const ProductComment = styled.View`
|
|
68
|
-
padding-bottom:
|
|
68
|
+
padding-bottom: 60px;
|
|
69
69
|
`
|
|
70
70
|
|
|
71
71
|
export const ProductActions = styled.View`
|
|
72
72
|
position: absolute;
|
|
73
73
|
bottom: 0px;
|
|
74
|
-
min-height: 70px;
|
|
75
74
|
padding-top: ${(props: any) => props.ios ? '20px' : '0'};
|
|
76
75
|
padding-horizontal: 40px;
|
|
76
|
+
padding-vertical: 20px;
|
|
77
77
|
width: 100%;
|
|
78
|
-
flex-direction: row;
|
|
78
|
+
flex-direction: ${(props: any) => props.isColumn ? 'column' : 'row'};
|
|
79
79
|
background-color: #FFF;
|
|
80
80
|
z-index: 1000;
|
|
81
|
-
align-items: center;
|
|
82
|
-
justify-content: space-between;
|
|
83
81
|
border-top-width: 1px;
|
|
84
82
|
border-top-color: ${(props: any) => props.theme.colors.border};
|
|
85
83
|
`
|
|
@@ -30,7 +30,7 @@ const ProductOptionUI = (props: any) => {
|
|
|
30
30
|
return (
|
|
31
31
|
<Container style={{ color: error ? 'orange' : theme.colors.white }}>
|
|
32
32
|
<WrapHeader>
|
|
33
|
-
<OText size={16} lineHeight={24} weight={'600'}>{option.name}</OText>
|
|
33
|
+
<OText size={16} lineHeight={24} weight={'600'} style={{ flex: 1 }}>{option.name}</OText>
|
|
34
34
|
<OText color={theme.colors.red}>{maxMin}</OText>
|
|
35
35
|
</WrapHeader>
|
|
36
36
|
{children}
|