ordering-ui-react-native 0.17.47-release → 0.17.48-release
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/OrderDetails/Delivery.tsx +23 -0
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +1 -1
- package/themes/original/src/components/OrderDetails/index.tsx +1 -1
- package/themes/original/src/components/OrderSummary/index.tsx +1 -1
- package/themes/original/src/components/ProductItemAccordion/index.tsx +3 -1
- package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
- package/themes/original/src/components/UserProfile/index.tsx +6 -7
package/package.json
CHANGED
|
@@ -12,6 +12,8 @@ import {
|
|
|
12
12
|
useToast,
|
|
13
13
|
useSession,
|
|
14
14
|
ToastType,
|
|
15
|
+
useUtils,
|
|
16
|
+
useConfig
|
|
15
17
|
} from 'ordering-components/native';
|
|
16
18
|
|
|
17
19
|
//Components
|
|
@@ -56,7 +58,11 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
56
58
|
isGrantedPermissions,
|
|
57
59
|
} = props;
|
|
58
60
|
const [, { showToast }] = useToast();
|
|
61
|
+
const [{ parsePrice, parseNumber }] = useUtils();
|
|
62
|
+
const [{ configs }] = useConfig();
|
|
59
63
|
const { order } = props.order
|
|
64
|
+
|
|
65
|
+
const isAllowedDriverRejectOrder = configs?.allow_driver_reject_order?.value === '1'
|
|
60
66
|
const theme = useTheme();
|
|
61
67
|
const [, t] = useLanguage();
|
|
62
68
|
const [session] = useSession();
|
|
@@ -135,6 +141,16 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
135
141
|
};
|
|
136
142
|
|
|
137
143
|
const handleViewActionOrder = (action: string) => {
|
|
144
|
+
if (action === 'reject' && !isAllowedDriverRejectOrder) {
|
|
145
|
+
setAlertState({
|
|
146
|
+
open: true,
|
|
147
|
+
content: [
|
|
148
|
+
t('DRIVER_NOT_ALLOWED_TO_REJECT_ORDER', 'The driver is not allowed to reject an order.'),
|
|
149
|
+
],
|
|
150
|
+
key: null,
|
|
151
|
+
})
|
|
152
|
+
return
|
|
153
|
+
}
|
|
138
154
|
if (!isGrantedPermissions) {
|
|
139
155
|
navigation.navigate('RequestPermissions')
|
|
140
156
|
return
|
|
@@ -151,6 +167,13 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
151
167
|
};
|
|
152
168
|
|
|
153
169
|
const handleArrowBack: any = () => {
|
|
170
|
+
if (alertState?.open && !isAllowedDriverRejectOrder) {
|
|
171
|
+
setAlertState({
|
|
172
|
+
...alertState,
|
|
173
|
+
open: false
|
|
174
|
+
})
|
|
175
|
+
return
|
|
176
|
+
}
|
|
154
177
|
navigation?.canGoBack() && navigation.goBack();
|
|
155
178
|
};
|
|
156
179
|
|
|
@@ -523,7 +523,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
523
523
|
))
|
|
524
524
|
}
|
|
525
525
|
{
|
|
526
|
-
order?.summary?.delivery_price
|
|
526
|
+
typeof order?.summary?.delivery_price === 'number' && (
|
|
527
527
|
<Table>
|
|
528
528
|
<OText mBottom={4}>
|
|
529
529
|
{t('DELIVERY_FEE', 'Delivery Fee')}
|
|
@@ -909,7 +909,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
909
909
|
</Table>
|
|
910
910
|
))
|
|
911
911
|
}
|
|
912
|
-
{order?.summary?.delivery_price
|
|
912
|
+
{typeof order?.summary?.delivery_price === 'number' && (
|
|
913
913
|
<Table>
|
|
914
914
|
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
915
915
|
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.delivery_price)}</OText>
|
|
@@ -244,7 +244,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
244
244
|
</OSTable>
|
|
245
245
|
))
|
|
246
246
|
}
|
|
247
|
-
{orderState?.options?.type === 1 &&
|
|
247
|
+
{orderState?.options?.type === 1 && !hideDeliveryFee && (
|
|
248
248
|
<OSTable>
|
|
249
249
|
<OText size={12}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
250
250
|
<OText size={12}>{parsePrice(cart?.delivery_price_with_discount)}</OText>
|
|
@@ -77,6 +77,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
77
77
|
const [isServiceOpen, setIsServiceOpen] = useState(false)
|
|
78
78
|
// const [setHeight, setHeightState] = useState({ height: new Animated.Value(0) })
|
|
79
79
|
// const [setRotate, setRotateState] = useState({ angle: new Animated.Value(0) })
|
|
80
|
+
const [productQuantity, setProductQuantity] = useState(product.quantity.toString())
|
|
80
81
|
|
|
81
82
|
const productInfo = () => {
|
|
82
83
|
if (isCartProduct) {
|
|
@@ -120,6 +121,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
120
121
|
|
|
121
122
|
const handleChangeQuantity = (value: string) => {
|
|
122
123
|
if (!orderState.loading) {
|
|
124
|
+
setProductQuantity(value)
|
|
123
125
|
if (parseInt(value) === 0) {
|
|
124
126
|
onDeleteProduct && onDeleteProduct(product)
|
|
125
127
|
} else {
|
|
@@ -209,7 +211,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
209
211
|
<RNPickerSelect
|
|
210
212
|
items={productOptions}
|
|
211
213
|
onValueChange={handleChangeQuantity}
|
|
212
|
-
value={
|
|
214
|
+
value={productQuantity}
|
|
213
215
|
style={pickerStyle}
|
|
214
216
|
useNativeAndroidPickerStyle={false}
|
|
215
217
|
placeholder={{}}
|
|
@@ -50,6 +50,7 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
50
50
|
const theme = useTheme();
|
|
51
51
|
|
|
52
52
|
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
53
|
+
const showLanguages = theme?.profile?.components?.languages?.hidden
|
|
53
54
|
|
|
54
55
|
const langPickerStyle = StyleSheet.create({
|
|
55
56
|
inputAndroid: {
|
|
@@ -164,7 +165,7 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
164
165
|
}, [removeAccountState])
|
|
165
166
|
|
|
166
167
|
return (
|
|
167
|
-
<View style={{ flex: 1, height:
|
|
168
|
+
<View style={{ flex: 1, height: '100%', paddingTop: 20 }}>
|
|
168
169
|
<CenterView style={styles.pagePadding}>
|
|
169
170
|
{user?.photo && (
|
|
170
171
|
<View style={styles.photo}>
|
|
@@ -248,15 +249,13 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
248
249
|
</ListItem>
|
|
249
250
|
</Actions>
|
|
250
251
|
|
|
251
|
-
|
|
252
|
-
|
|
252
|
+
<Actions style={{ paddingTop: height * .02 }}>
|
|
253
|
+
{!showLanguages && (
|
|
254
|
+
<LanguageSelector iconColor={theme.colors.textNormal} pickerStyle={langPickerStyle} />
|
|
255
|
+
)}
|
|
253
256
|
<View style={{ height: 17 }} />
|
|
254
257
|
<LogoutButton color={theme.colors.textNormal} text={t('LOGOUT', 'Logout')} />
|
|
255
258
|
<View style={{ height: 17 }} />
|
|
256
|
-
<ListItem disabled={isAdmin} onPress={() => onRemoveAccount()} activeOpacity={0.7}>
|
|
257
|
-
<OIcon src={theme.images.general.user} width={16} color={theme.colors.textNormal} style={{ marginEnd: 14 }} />
|
|
258
|
-
<OText size={14} lineHeight={24} weight={'400'} style={{ opacity: isAdmin ? 0.5 : 1 }} color={theme.colors.danger5}>{t('REMOVE_ACCOUNT', 'Remove account')}</OText>
|
|
259
|
-
</ListItem>
|
|
260
259
|
</Actions>
|
|
261
260
|
</ListWrap>
|
|
262
261
|
<OAlert
|