ordering-ui-react-native 0.18.91 → 0.18.93

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,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.18.91",
3
+ "version": "0.18.93",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -83,6 +83,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
83
83
 
84
84
  const validStatusComplete = [9, 19, 23]
85
85
 
86
+ const pendingOrderStatus = [1, 4, 7, 13]
87
+
86
88
  const logisticOrderStatus = [4, 6, 7]
87
89
 
88
90
  const showFloatButtonsPickUp: any = {
@@ -325,7 +327,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
325
327
  };
326
328
 
327
329
  const handleArrowBack: any = () => {
328
- if (alertState?.open && !isAllowedDriverRejectOrder) {
330
+ if (alertState?.open && !isAllowedDriverRejectOrder && !pendingOrderStatus.includes(order?.status)) {
329
331
  setAlertState({
330
332
  ...alertState,
331
333
  open: false
@@ -525,7 +527,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
525
527
  </View>
526
528
  )}
527
529
 
528
- {(!!props.order?.error || props.order?.error) && (
530
+ {(!!props.order?.error || props.order?.error?.length > 0) && (
529
531
  <NotFoundSource
530
532
  btnTitle={t('GO_TO_MY_ORDERS', 'Go to my orders')}
531
533
  content={
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import {
3
3
  BusinessInformation as BusinessInformationController,
4
- useLanguage, useUtils
4
+ useLanguage, useUtils, useConfig,
5
5
  } from 'ordering-components/native';
6
6
  import { useTheme } from 'styled-components/native';
7
7
  import { OIcon, OText } from '../shared';
@@ -22,31 +22,27 @@ import { GoogleMap } from '../GoogleMap';
22
22
  import { WebView } from 'react-native-webview';
23
23
  import { formatUrlVideo } from '../../utils'
24
24
  import { ScheduleAccordion } from '../ScheduleAccordion';
25
+ import moment from 'moment';
25
26
  const BusinessInformationUI = (props: BusinessInformationParams) => {
26
27
  const { businessState, businessSchedule, businessLocation } = props;
27
28
 
28
29
  const theme = useTheme();
29
30
  const [, t] = useLanguage();
30
31
  const [{ optimizeImage }] = useUtils();
32
+ const [{ configs }] = useConfig()
31
33
 
32
34
  const hideLocation = theme?.business_view?.components?.information?.components?.location?.hidden
33
35
  const hideSchedule = theme?.business_view?.components?.information?.components?.schedule?.hidden
34
36
  const hideVideos = theme?.business_view?.components?.information?.components?.videos?.hidden
35
37
  const hideImages = theme?.business_view?.components?.information?.components?.images?.hidden
36
38
  const hideAddress = theme?.business_view?.components?.information?.components?.address?.hidden
39
+ const formatTime = configs?.general_hour_format?.value
40
+
41
+ const checkTime = (val: number) => (val < 10 ? `0${val}` : val);
42
+ const timeFormated = (time: any) => {
43
+ return moment(`1900-01-01 ${checkTime(time.hour)}:${checkTime(time.minute)}`).format(formatTime)
44
+ }
37
45
 
38
- const scheduleFormatted = ({
39
- hour,
40
- minute,
41
- }: {
42
- hour: number | string;
43
- minute: number | string;
44
- }) => {
45
- const checkTime = (val: number | string) => (val < 10 ? `0${val}` : val);
46
- const zz = hour > 12 ? 'PM' : 'AM';
47
- const h = parseInt(`${hour}`);
48
- return `${h > 12 ? h - 12 : h}:${checkTime(minute)} ${zz}`;
49
- };
50
46
  const businessCoordinate = {
51
47
  lat: businessState?.business?.location?.lat,
52
48
  lng: businessState?.business?.location?.lng,
@@ -121,7 +117,7 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
121
117
  <ScheduleBlock key={i}>
122
118
  <ScheduleAccordion
123
119
  weekIndex={i}
124
- scheduleFormatted={scheduleFormatted}
120
+ timeFormated={timeFormated}
125
121
  schedule={schedule}
126
122
  />
127
123
  </ScheduleBlock>
@@ -107,8 +107,7 @@ const BusinessProductsCategoriesUI = (props: any) => {
107
107
  </Placeholder>
108
108
  )}
109
109
  {!loading &&
110
- categories &&
111
- categories.length &&
110
+ categories?.length > 0 &&
112
111
  categories.map((category: any) => (
113
112
  <Tab
114
113
  key={category.id}
@@ -572,7 +572,7 @@ const CheckoutUI = (props: any) => {
572
572
  data: deliveryOptions || [],
573
573
  renderItem: ({ item }: any) => (
574
574
  <TouchableOpacity
575
- onPress={() => changeDeliveryOption(item.value)}
575
+ onPress={() => !!cart?.uuid && changeDeliveryOption(item.value)}
576
576
  disabled={
577
577
  deliveryOptionSelected === item.value
578
578
  }
@@ -13,7 +13,7 @@ import { OIcon, OText } from '../shared';
13
13
  export const ScheduleAccordion = (props: any) => {
14
14
 
15
15
  const {
16
- scheduleFormatted,
16
+ timeFormated,
17
17
  schedule,
18
18
  weekIndex
19
19
  } = props
@@ -52,9 +52,9 @@ export const ScheduleAccordion = (props: any) => {
52
52
  {schedule?.lapses?.map((lapse: any) => (
53
53
  schedule?.enabled ?
54
54
  <OText mBottom={16}>
55
- {scheduleFormatted(lapse.open) +
55
+ {timeFormated(lapse.open) +
56
56
  ' - ' +
57
- scheduleFormatted(lapse.close)}
57
+ timeFormated(lapse.close)}
58
58
  </OText>
59
59
  :
60
60
  <OText color={theme.colors.red} mBottom={16}>