ordering-ui-react-native 0.15.14 → 0.15.15
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/OrdersOption/index.tsx +16 -67
- package/themes/business/src/components/OrdersOption/styles.tsx +2 -5
- package/themes/original/src/components/Messages/index.tsx +1 -1
- package/themes/original/src/components/OrderDetails/index.tsx +24 -20
- package/themes/original/src/components/ProductForm/index.tsx +12 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState, useRef } from 'react';
|
|
2
2
|
import { View, Pressable, StyleSheet, ScrollView, RefreshControl, Linking, Platform, TextInput } from 'react-native';
|
|
3
|
-
import { useLanguage, useUtils, useToast, ToastType, OrderListGroups } from 'ordering-components/native';
|
|
3
|
+
import { useLanguage, useUtils, useToast, ToastType, OrderListGroups, useConfig } from 'ordering-components/native';
|
|
4
4
|
import SelectDropdown from 'react-native-select-dropdown'
|
|
5
5
|
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
|
|
6
6
|
import FeatherIcon from 'react-native-vector-icons/Feather';
|
|
@@ -400,20 +400,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
400
400
|
setOpenSLASettingModal(false)
|
|
401
401
|
}
|
|
402
402
|
|
|
403
|
-
const [settingTimeErrorMessage, setSettingTimeErrorMessage] = useState('')
|
|
404
|
-
|
|
405
|
-
const handlSLASettingTime = () => {
|
|
406
|
-
if (!hour || !minute) {
|
|
407
|
-
setSettingTimeErrorMessage(t('SLA_SETTING_ERROR', 'Time value is invalid'))
|
|
408
|
-
return
|
|
409
|
-
}
|
|
410
|
-
const _settingTimeSecond = hour * 3600 + minute * 60
|
|
411
|
-
setSlaSettingTime(_settingTimeSecond)
|
|
412
|
-
handleClose()
|
|
413
|
-
showToast(ToastType.Success, t('SLA_SETTING_UPDATED', 'SLAs setting updated'))
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
|
|
417
403
|
useEffect(() => {
|
|
418
404
|
setCurrentFilters(null)
|
|
419
405
|
onFiltered && onFiltered(null)
|
|
@@ -859,24 +845,10 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
859
845
|
key={i}
|
|
860
846
|
item={item}
|
|
861
847
|
last={i + 1 === selectedTabStatus.length}
|
|
862
|
-
setHour={setHour}
|
|
863
|
-
setMinute={setMinute}
|
|
864
|
-
setSettingTimeErrorMessage={setSettingTimeErrorMessage}
|
|
865
848
|
/>
|
|
866
849
|
))}
|
|
867
850
|
<VerticalLine />
|
|
868
851
|
</DeliveryStatusWrapper>
|
|
869
|
-
{settingTimeErrorMessage !== '' && (
|
|
870
|
-
<OText style={styles.errorMessage}>{settingTimeErrorMessage}</OText>
|
|
871
|
-
)}
|
|
872
|
-
<Actions>
|
|
873
|
-
<OButton
|
|
874
|
-
text={t('ACCEPT', 'Accept')}
|
|
875
|
-
textStyle={{ color: 'white', fontSize: 14 }}
|
|
876
|
-
onClick={handlSLASettingTime}
|
|
877
|
-
style={styles.acceptButtonStyle}
|
|
878
|
-
/>
|
|
879
|
-
</Actions>
|
|
880
852
|
</SlaSettingModalContent>
|
|
881
853
|
)}
|
|
882
854
|
</ModalContainer>
|
|
@@ -887,7 +859,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
887
859
|
};
|
|
888
860
|
|
|
889
861
|
export const StatusBlock = (props: any) => {
|
|
890
|
-
const { item, last
|
|
862
|
+
const { item, last } = props
|
|
891
863
|
const [showTime, setShowTime] = useState(false)
|
|
892
864
|
|
|
893
865
|
useEffect(() => {
|
|
@@ -898,7 +870,7 @@ export const StatusBlock = (props: any) => {
|
|
|
898
870
|
|
|
899
871
|
return (
|
|
900
872
|
<StatusItems>
|
|
901
|
-
<Pressable
|
|
873
|
+
<Pressable style={{ marginBottom: 10 }}>
|
|
902
874
|
<ItemHeader>
|
|
903
875
|
<IconWrapper>
|
|
904
876
|
<OIcon
|
|
@@ -916,11 +888,7 @@ export const StatusBlock = (props: any) => {
|
|
|
916
888
|
<OText>{item?.des}</OText>
|
|
917
889
|
</ItemContent>
|
|
918
890
|
{showTime && (
|
|
919
|
-
<Timer
|
|
920
|
-
setHour={setHour}
|
|
921
|
-
setMinute={setMinute}
|
|
922
|
-
setSettingTimeErrorMessage={setSettingTimeErrorMessage}
|
|
923
|
-
/>
|
|
891
|
+
<Timer />
|
|
924
892
|
)}
|
|
925
893
|
{last && (
|
|
926
894
|
<OverLine />
|
|
@@ -929,47 +897,28 @@ export const StatusBlock = (props: any) => {
|
|
|
929
897
|
)
|
|
930
898
|
}
|
|
931
899
|
|
|
932
|
-
export const Timer = (
|
|
933
|
-
const { setHour, setMinute, setSettingTimeErrorMessage } = props
|
|
900
|
+
export const Timer = () => {
|
|
934
901
|
const [, t] = useLanguage()
|
|
935
902
|
const theme = useTheme()
|
|
903
|
+
const [{ configs }] = useConfig();
|
|
936
904
|
|
|
937
905
|
const styles = StyleSheet.create({
|
|
938
|
-
|
|
939
|
-
paddingHorizontal: 7,
|
|
940
|
-
paddingVertical: 2,
|
|
941
|
-
borderRadius: 0,
|
|
906
|
+
settingTime: {
|
|
942
907
|
fontSize: 14,
|
|
908
|
+
borderWidth: 1,
|
|
909
|
+
borderRadius: 7.6,
|
|
910
|
+
margin: 0,
|
|
911
|
+
marginRight: 10,
|
|
912
|
+
paddingHorizontal: 10,
|
|
913
|
+
paddingTop: 5,
|
|
914
|
+
borderColor: theme.colors.disabled
|
|
943
915
|
}
|
|
944
916
|
})
|
|
945
917
|
|
|
946
|
-
const handleChangeInput = (val: any, type: string) => {
|
|
947
|
-
setSettingTimeErrorMessage('')
|
|
948
|
-
if (type === 'hour') {
|
|
949
|
-
setHour(val)
|
|
950
|
-
}
|
|
951
|
-
if (type === 'minute') {
|
|
952
|
-
setMinute(val)
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
|
-
|
|
956
918
|
return (
|
|
957
919
|
<TimerInputWrapper>
|
|
958
|
-
<
|
|
959
|
-
|
|
960
|
-
keyboardType='number-pad'
|
|
961
|
-
maxLength={2}
|
|
962
|
-
style={{ ...styles.inputStyle, width: 36 }}
|
|
963
|
-
onChangeText={hour => handleChangeInput(hour, 'hour')}
|
|
964
|
-
/>
|
|
965
|
-
<OText color={theme.colors.disabled}>:</OText>
|
|
966
|
-
<TextInput
|
|
967
|
-
placeholder='MM'
|
|
968
|
-
keyboardType='number-pad'
|
|
969
|
-
maxLength={2}
|
|
970
|
-
style={{ ...styles.inputStyle, width: 40 }}
|
|
971
|
-
onChangeText={minute => handleChangeInput(minute, 'minute')}
|
|
972
|
-
/>
|
|
920
|
+
<OText style={styles.settingTime} color={theme.colors.disabled}>{configs?.order_deadlines_delayed_time?.value}</OText>
|
|
921
|
+
<OText>{t('MIN', 'min')}</OText>
|
|
973
922
|
</TimerInputWrapper>
|
|
974
923
|
)
|
|
975
924
|
}
|
|
@@ -130,15 +130,12 @@ export const ItemContent = styled.View`
|
|
|
130
130
|
`
|
|
131
131
|
|
|
132
132
|
export const TimerInputWrapper = styled.View`
|
|
133
|
-
border-width: 1px;
|
|
134
|
-
border-radius: 7.6px;
|
|
135
133
|
color: ${(props: any) => props.theme.colors.disabled};
|
|
136
|
-
|
|
134
|
+
margin-top: 15px;
|
|
137
135
|
margin-left: 30px;
|
|
138
136
|
margin-right: 30px;
|
|
139
137
|
flex-direction: row;
|
|
140
|
-
align-items:
|
|
141
|
-
width: 80px;
|
|
138
|
+
align-items: flex-end;
|
|
142
139
|
`
|
|
143
140
|
export const OverLine = styled.View`
|
|
144
141
|
position: absolute;
|
|
@@ -97,7 +97,7 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
const handleImagePicker = () => {
|
|
100
|
-
launchImageLibrary({ mediaType: 'photo', maxHeight:
|
|
100
|
+
launchImageLibrary({ mediaType: 'photo', maxHeight: 2048, maxWidth: 2048, includeBase64: true }, (response: any) => {
|
|
101
101
|
if (response.didCancel) {
|
|
102
102
|
console.log('User cancelled image picker');
|
|
103
103
|
} else if (response.errorMessage) {
|
|
@@ -594,18 +594,20 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
594
594
|
{order?.business?.name}
|
|
595
595
|
</OText>
|
|
596
596
|
<Icons>
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
597
|
+
{!!order?.business?.cellphone && (
|
|
598
|
+
<TouchableOpacity
|
|
599
|
+
onPress={() => order?.business?.cellphone &&
|
|
600
|
+
Linking.openURL(`tel:${order?.business?.cellphone}`)
|
|
601
|
+
}
|
|
602
|
+
style={{ paddingEnd: 5 }}
|
|
603
|
+
>
|
|
604
|
+
<OIcon
|
|
605
|
+
src={theme.images.general.phone}
|
|
606
|
+
width={16}
|
|
607
|
+
color={theme.colors.disabled}
|
|
608
|
+
/>
|
|
609
|
+
</TouchableOpacity>
|
|
610
|
+
)}
|
|
609
611
|
<TouchableOpacity
|
|
610
612
|
style={{ paddingStart: 5 }}
|
|
611
613
|
onPress={() => handleOpenMessagesForBusiness()}>
|
|
@@ -624,13 +626,15 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
624
626
|
mBottom={2}>
|
|
625
627
|
{order?.business?.email}
|
|
626
628
|
</OText>
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
629
|
+
{!!order?.business?.cellphone && (
|
|
630
|
+
<OText
|
|
631
|
+
size={12}
|
|
632
|
+
lineHeight={18}
|
|
633
|
+
color={theme.colors.textNormal}
|
|
634
|
+
mBottom={2}>
|
|
635
|
+
{order?.business?.cellphone}
|
|
636
|
+
</OText>
|
|
637
|
+
)}
|
|
634
638
|
<OText size={12} lineHeight={18} color={theme.colors.textNormal}>
|
|
635
639
|
{order?.business?.address}
|
|
636
640
|
</OText>
|
|
@@ -978,7 +982,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
978
982
|
marginTop: 10
|
|
979
983
|
}}
|
|
980
984
|
>
|
|
981
|
-
{order?.payment_events?.map((event: any) => (
|
|
985
|
+
{order?.payment_events?.map((event: any) => event.amount > 0 && (
|
|
982
986
|
<View
|
|
983
987
|
key={event.id}
|
|
984
988
|
style={{
|
|
@@ -872,9 +872,13 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
872
872
|
</ScrollView>
|
|
873
873
|
{!loading && !error && product && (
|
|
874
874
|
<ProductActions ios={Platform?.OS === 'ios'}>
|
|
875
|
-
<
|
|
876
|
-
{
|
|
877
|
-
|
|
875
|
+
<View>
|
|
876
|
+
<OText size={16} lineHeight={24} weight={'600'}>
|
|
877
|
+
{productCart.total ? parsePrice(productCart?.total) : ''}
|
|
878
|
+
</OText>
|
|
879
|
+
{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>}
|
|
880
|
+
{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>}
|
|
881
|
+
</View>
|
|
878
882
|
{productCart && !isSoldOut && maxProductQuantity > 0 && (
|
|
879
883
|
<View style={styles.quantityControl}>
|
|
880
884
|
<TouchableOpacity
|
|
@@ -883,6 +887,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
883
887
|
<OIcon
|
|
884
888
|
src={theme.images.general.minus}
|
|
885
889
|
width={16}
|
|
890
|
+
style={{ borderWidth: 1, borderColor: 'red' }}
|
|
886
891
|
color={
|
|
887
892
|
productCart.quantity === 1 || isSoldOut
|
|
888
893
|
? theme.colors.backgroundGray
|
|
@@ -926,6 +931,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
926
931
|
<OIcon
|
|
927
932
|
src={theme.images.general.plus}
|
|
928
933
|
width={16}
|
|
934
|
+
style={{ borderWidth: 1, borderColor: 'red' }}
|
|
929
935
|
color={
|
|
930
936
|
maxProductQuantity <= 0 ||
|
|
931
937
|
productCart.quantity >= maxProductQuantity ||
|
|
@@ -987,14 +993,14 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
987
993
|
? t('UPDATE', 'Update')
|
|
988
994
|
: t('ADD', 'Add')
|
|
989
995
|
}`}
|
|
990
|
-
isDisabled={isSoldOut || maxProductQuantity <= 0}
|
|
996
|
+
isDisabled={isSoldOut || maxProductQuantity <= 0 || productCart?.quantity < product?.minimum_per_order || productCart?.quantity > product?.maximum_per_order}
|
|
991
997
|
textStyle={{
|
|
992
998
|
color: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.primary : theme.colors.white,
|
|
993
999
|
fontSize: orderState.loading || editMode ? 10 : 14
|
|
994
1000
|
}}
|
|
995
1001
|
style={{
|
|
996
|
-
backgroundColor: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.lightGray : theme.colors.primary,
|
|
997
|
-
borderColor: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.white : theme.colors.primary,
|
|
1002
|
+
backgroundColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || productCart?.quantity < product?.minimum_per_order || productCart?.quantity > product?.maximum_per_order ? theme.colors.lightGray : theme.colors.primary,
|
|
1003
|
+
borderColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || productCart?.quantity < product?.minimum_per_order || productCart?.quantity > product?.maximum_per_order ? theme.colors.white : theme.colors.primary,
|
|
998
1004
|
opacity: saveErrors || isSoldOut || maxProductQuantity <= 0 ? 0.3 : 1,
|
|
999
1005
|
borderRadius: 7.6,
|
|
1000
1006
|
height: 44,
|