ordering-ui-react-native 0.12.33 → 0.12.37

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.
Files changed (30) hide show
  1. package/package.json +1 -1
  2. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +6 -5
  3. package/themes/business/src/components/OrderDetails/Business.tsx +2 -4
  4. package/themes/business/src/components/OrderDetails/Delivery.tsx +231 -202
  5. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +344 -334
  6. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +83 -69
  7. package/themes/business/src/components/OrdersOption/index.tsx +122 -77
  8. package/themes/business/src/components/PreviousOrders/index.tsx +124 -73
  9. package/themes/business/src/components/PreviousOrders/styles.tsx +7 -0
  10. package/themes/business/src/components/ProductItemAccordion/index.tsx +26 -25
  11. package/themes/business/src/components/shared/OIcon.tsx +2 -0
  12. package/themes/business/src/types/index.tsx +5 -0
  13. package/themes/single-business/src/components/BusinessBasicInformation/index.tsx +1 -1
  14. package/themes/single-business/src/components/BusinessProductsListing/index.tsx +9 -8
  15. package/themes/single-business/src/components/BusinessesListing/index.tsx +307 -296
  16. package/themes/single-business/src/components/BusinessesListing/styles.tsx +41 -14
  17. package/themes/single-business/src/components/HelpAccountAndPayment/index.tsx +7 -6
  18. package/themes/single-business/src/components/HelpGuide/index.tsx +7 -6
  19. package/themes/single-business/src/components/HelpOrder/index.tsx +7 -6
  20. package/themes/single-business/src/components/LanguageSelector/index.tsx +87 -70
  21. package/themes/single-business/src/components/LoginForm/index.tsx +2 -2
  22. package/themes/single-business/src/components/OrderDetails/index.tsx +21 -21
  23. package/themes/single-business/src/components/ProductForm/index.tsx +682 -656
  24. package/themes/single-business/src/components/ProductForm/styles.tsx +1 -1
  25. package/themes/single-business/src/components/UserProfile/index.tsx +2 -2
  26. package/themes/single-business/src/components/shared/OIconButton.tsx +2 -2
  27. package/themes/single-business/src/components/shared/OInput.tsx +1 -0
  28. package/themes/single-business/src/components/shared/OLink.tsx +80 -0
  29. package/themes/single-business/src/components/shared/index.tsx +2 -0
  30. package/themes/single-business/src/types/index.tsx +3 -0
@@ -26,11 +26,19 @@ interface OrderHeader {
26
26
  handleArrowBack?: any,
27
27
  handleOpenMapView?: any,
28
28
  handleOpenMessagesForBusiness?: any,
29
- getOrderStatus?: any
29
+ getOrderStatus?: any,
30
+ logisticOrderStatus?: Array<number>
30
31
  }
31
32
 
32
33
  export const OrderHeaderComponent = (props: OrderHeader) => {
33
- const { order, handleArrowBack, handleOpenMapView, handleOpenMessagesForBusiness, getOrderStatus } = props
34
+ const {
35
+ order,
36
+ handleArrowBack,
37
+ handleOpenMapView,
38
+ handleOpenMessagesForBusiness,
39
+ getOrderStatus,
40
+ logisticOrderStatus
41
+ } = props
34
42
  const theme = useTheme();
35
43
  const [, t] = useLanguage();
36
44
  const [{ parseDate }] = useUtils();
@@ -73,76 +81,82 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
73
81
 
74
82
  return (
75
83
  <>
76
- <Header>
77
- <OIconButton
78
- icon={theme.images.general.arrow_left}
79
- iconStyle={{ width: 20, height: 20 }}
80
- borderColor={theme.colors.clear}
81
- style={{ ...styles.icons, justifyContent: 'flex-end' }}
82
- onClick={() => handleArrowBack()}
83
- />
84
+ <Header>
85
+ <OIconButton
86
+ icon={theme.images.general.arrow_left}
87
+ iconStyle={{ width: 20, height: 20 }}
88
+ borderColor={theme.colors.clear}
89
+ style={{ ...styles.icons, justifyContent: 'flex-end' }}
90
+ onClick={() => handleArrowBack()}
91
+ />
84
92
 
85
- <Actions>
86
- <OIconButton
87
- icon={theme.images.general.map}
88
- iconStyle={{
89
- width: 20,
90
- height: 20,
91
- tintColor: theme.colors.backArrow,
92
- }}
93
- borderColor={theme.colors.clear}
94
- style={styles.icons}
95
- onClick={() => handleOpenMapView()}
96
- />
93
+ {
94
+ (!order?.isLogistic || !logisticOrderStatus?.includes(order?.status)) && (
95
+ <Actions>
96
+ <OIconButton
97
+ icon={theme.images.general.map}
98
+ iconStyle={{
99
+ width: 20,
100
+ height: 20,
101
+ tintColor: theme.colors.backArrow,
102
+ }}
103
+ borderColor={theme.colors.clear}
104
+ style={styles.icons}
105
+ onClick={() => handleOpenMapView()}
106
+ />
97
107
 
98
- <OIconButton
99
- icon={theme.images.general.messages}
100
- iconStyle={{
101
- width: 20,
102
- height: 20,
103
- tintColor: theme.colors.backArrow,
104
- }}
105
- borderColor={theme.colors.clear}
106
- style={styles.icons}
107
- onClick={() => handleOpenMessagesForBusiness()}
108
- />
109
- </Actions>
110
- </Header>
111
- <OrderHeader>
112
- <OText size={13} style={{ marginBottom: 5 }}>
113
- {order?.delivery_datetime_utc
114
- ? parseDate(order?.delivery_datetime_utc)
115
- : parseDate(order?.delivery_datetime, { utc: false })}
116
- </OText>
108
+ <OIconButton
109
+ icon={theme.images.general.messages}
110
+ iconStyle={{
111
+ width: 20,
112
+ height: 20,
113
+ tintColor: theme.colors.backArrow,
114
+ }}
115
+ borderColor={theme.colors.clear}
116
+ style={styles.icons}
117
+ onClick={() => handleOpenMessagesForBusiness()}
118
+ />
119
+ </Actions>
120
+ )}
121
+ </Header>
122
+ <OrderHeader>
123
+ <OText size={13} style={{ marginBottom: 5 }}>
124
+ {order?.delivery_datetime_utc
125
+ ? parseDate(order?.delivery_datetime_utc)
126
+ : parseDate(order?.delivery_datetime, { utc: false })}
127
+ </OText>
117
128
 
118
- <OText numberOfLines={2} size={20} weight="600">
119
- <>
120
- {`${t('INVOICE_ORDER_NO', 'Order No.')} ${order.id} ${t(
121
- 'IS',
122
- 'is',
123
- )} `}
124
- <OText
125
- size={20}
126
- weight="600"
127
- color={colors[order?.status] || theme.colors.primary}>
128
- {getOrderStatus(order?.status, t)?.value}
129
+ <OText numberOfLines={2} size={20} weight="600">
130
+ <>
131
+ {`${t('INVOICE_ORDER_NO', 'Order No.')} ${order.id} `}
132
+ {(!order?.isLogistic || !logisticOrderStatus?.includes(order?.status)) && (
133
+ <>
134
+ {t('IS', 'is')}{' '}
135
+ <OText
136
+ size={20}
137
+ weight="600"
138
+ color={colors[order?.status] || theme.colors.primary}>
139
+ {getOrderStatus(order?.status, t)?.value}
140
+ </OText>
141
+ </>
142
+ )}
143
+ </>
129
144
  </OText>
130
- </>
131
- </OText>
132
- <OText size={13}>
133
- {`${order?.paymethod?.name} - ${
134
- order.delivery_type === 1
135
- ? t('DELIVERY', 'Delivery')
136
- : order.delivery_type === 2
137
- ? t('PICKUP', 'Pickup')
138
- : order.delivery_type === 3
139
- ? t('EAT_IN', 'Eat in')
140
- : order.delivery_type === 4
141
- ? t('CURBSIDE', 'Curbside')
142
- : t('DRIVER_THRU', 'Driver thru')
143
- }`}
144
- </OText>
145
- </OrderHeader>
146
- </>
145
+ {(!order?.isLogistic || !logisticOrderStatus?.includes(order?.status)) && (
146
+ <OText size={13}>
147
+ {`${order?.paymethod?.name} - ${order.delivery_type === 1
148
+ ? t('DELIVERY', 'Delivery')
149
+ : order.delivery_type === 2
150
+ ? t('PICKUP', 'Pickup')
151
+ : order.delivery_type === 3
152
+ ? t('EAT_IN', 'Eat in')
153
+ : order.delivery_type === 4
154
+ ? t('CURBSIDE', 'Curbside')
155
+ : t('DRIVER_THRU', 'Driver thru')
156
+ }`}
157
+ </OText>
158
+ )}
159
+ </OrderHeader>
160
+ </>
147
161
  )
148
162
  }
@@ -69,7 +69,11 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
69
69
  filtered,
70
70
  onFiltered,
71
71
  handleClickOrder,
72
- isBusinessApp
72
+ isBusinessApp,
73
+ handleClickLogisticOrder,
74
+ logisticOrders,
75
+ loadLogisticOrders,
76
+ isLogisticActivated
73
77
  } = props;
74
78
 
75
79
  const defaultSearchList = {
@@ -93,7 +97,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
93
97
  const [orientationState] = useDeviceOrientation();
94
98
  const [openModal, setOpenModal] = useState(false)
95
99
  const [search, setSearch] = useState(defaultSearchList)
96
-
97
100
  const WIDTH_SCREEN = orientationState?.dimensions?.width
98
101
  const HEIGHT_SCREEN = orientationState?.dimensions?.height
99
102
  const IS_PORTRAIT = orientationState.orientation === PORTRAIT
@@ -124,6 +127,11 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
124
127
  zIndex: 100,
125
128
  borderColor: theme.colors.textGray,
126
129
  },
130
+ icon: {
131
+ paddingBottom: 10,
132
+ zIndex: 100,
133
+ marginBottom: 5,
134
+ },
127
135
  tagsContainer: {
128
136
  marginBottom: 20,
129
137
  },
@@ -171,7 +179,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
171
179
  const currentOrdersGroup = ordersGroup[currentTabSelected]
172
180
 
173
181
  const isEqual = (array1: any, array2: any) => {
174
- return array1.every((item: any) => array2.includes(item)) && array2.every((item: any) => array1.includes(item))
182
+ return array1?.every((item: any) => array2.includes(item)) && array2?.every((item: any) => array1.includes(item))
175
183
  }
176
184
 
177
185
  const handleLoadMore = () => {
@@ -298,7 +306,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
298
306
  name='refresh-cw'
299
307
  color={theme.colors.backgroundDark}
300
308
  size={24}
301
- onPress={() => loadOrders && loadOrders({ newFetch: true })}
309
+ onPress={() => { currentTabSelected === 'logisticOrders' ? loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true }) }}
302
310
  style={{ marginRight: 20 }}
303
311
  />
304
312
  <FontistoIcon
@@ -318,6 +326,24 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
318
326
  nestedScrollEnabled={true}
319
327
  >
320
328
  <TabsContainer width={WIDTH_SCREEN}>
329
+ {isLogisticActivated && (
330
+ <Pressable
331
+ style={styles.pressable}
332
+ onPress={() => setCurrentTabSelected('logisticOrders')}>
333
+ <OIcon
334
+ src={theme.images?.general?.chronometer}
335
+ borderBottomWidth={currentTabSelected === 'logisticOrders' ? 1 : 0}
336
+ width={currentTabSelected === 'logisticOrders' ? 26 : 24}
337
+ height={currentTabSelected === 'logisticOrders' ? 26 : 24}
338
+ color={
339
+ currentTabSelected === 'logisticOrders'
340
+ ? theme.colors.textGray
341
+ : theme.colors.unselectText
342
+ }
343
+ style={styles.icon}
344
+ />
345
+ </Pressable>
346
+ )}
321
347
  {tabs.map((tab: any) => (
322
348
  <Pressable
323
349
  key={tab.key}
@@ -344,72 +370,73 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
344
370
  </ScrollView>
345
371
  </FiltersTab>
346
372
  <View style={{ flex: 1, minHeight: HEIGHT_SCREEN - 250 }}>
347
- <View
348
- style={{
349
- display: 'flex',
350
- flexDirection: 'row',
351
- alignContent: 'center',
352
- alignItems: 'center',
353
- }}
354
- >
355
- {tagsList && tagsList?.length > 1 && (
356
- <View style={{ marginBottom: 20 }}>
357
- <Tag
358
- onPress={() => handleAllSelect()}
359
- isSelected={
360
- isEqual(currentOrdersGroup.currentFilter, tagsList)
361
- ? theme.colors.primary
362
- : theme.colors.tabBar
363
- }>
364
- <OText
365
- style={styles.tag}
366
- color={
373
+ {currentTabSelected !== 'logisticOrders' && (
374
+ <View
375
+ style={{
376
+ display: 'flex',
377
+ flexDirection: 'row',
378
+ alignContent: 'center',
379
+ alignItems: 'center',
380
+ }}
381
+ >
382
+ {tagsList && tagsList?.length > 1 && (
383
+ <View style={{ marginBottom: 20 }}>
384
+ <Tag
385
+ onPress={() => handleAllSelect()}
386
+ isSelected={
367
387
  isEqual(currentOrdersGroup.currentFilter, tagsList)
368
- ? theme.colors.white
369
- : theme.colors.black
388
+ ? theme.colors.primary
389
+ : theme.colors.tabBar
370
390
  }>
371
- {t('All', 'All')}
372
- </OText>
373
- </Tag>
374
- </View>
375
- )}
376
- <ScrollView
377
- ref={scrollRef}
378
- showsVerticalScrollIndicator={false}
379
- showsHorizontalScrollIndicator={false}
380
- contentContainerStyle={styles.tagsContainer}
381
- horizontal
382
- >
383
- {tagsList && tagsList.map((key: number) => (
384
- <Tag
385
- key={key}
386
- onPress={() => !currentOrdersGroup.loading && handleTagSelected(key)}
387
- isSelected={
388
- currentOrdersGroup.currentFilter.includes(key) &&
389
- !isEqual(currentOrdersGroup.currentFilter, tagsList)
390
- ? theme.colors.primary
391
- : theme.colors.tabBar
392
- }>
393
- <OText
394
- style={styles.tag}
395
- color={
391
+ <OText
392
+ style={styles.tag}
393
+ color={
394
+ isEqual(currentOrdersGroup.currentFilter, tagsList)
395
+ ? theme.colors.white
396
+ : theme.colors.black
397
+ }>
398
+ {t('All', 'All')}
399
+ </OText>
400
+ </Tag>
401
+ </View>
402
+ )}
403
+ <ScrollView
404
+ ref={scrollRef}
405
+ showsVerticalScrollIndicator={false}
406
+ showsHorizontalScrollIndicator={false}
407
+ contentContainerStyle={styles.tagsContainer}
408
+ horizontal
409
+ >
410
+ {tagsList && tagsList.map((key: number) => (
411
+ <Tag
412
+ key={key}
413
+ onPress={() => !currentOrdersGroup.loading && handleTagSelected(key)}
414
+ isSelected={
396
415
  currentOrdersGroup.currentFilter.includes(key) &&
397
416
  !isEqual(currentOrdersGroup.currentFilter, tagsList)
398
- ? theme.colors.white
399
- : theme.colors.black
417
+ ? theme.colors.primary
418
+ : theme.colors.tabBar
400
419
  }>
401
- {getOrderStatus(key)}
402
- {
403
- currentOrdersGroup.currentFilter.includes(key) &&
404
- !isEqual(currentOrdersGroup.currentFilter, tagsList) &&
405
- ' X'
406
- }
407
- </OText>
408
- </Tag>
409
- ))}
410
- </ScrollView>
411
- </View>
412
-
420
+ <OText
421
+ style={styles.tag}
422
+ color={
423
+ currentOrdersGroup.currentFilter.includes(key) &&
424
+ !isEqual(currentOrdersGroup.currentFilter, tagsList)
425
+ ? theme.colors.white
426
+ : theme.colors.black
427
+ }>
428
+ {getOrderStatus(key)}
429
+ {
430
+ currentOrdersGroup.currentFilter.includes(key) &&
431
+ !isEqual(currentOrdersGroup.currentFilter, tagsList) &&
432
+ ' X'
433
+ }
434
+ </OText>
435
+ </Tag>
436
+ ))}
437
+ </ScrollView>
438
+ </View>
439
+ )}
413
440
  <ScrollView
414
441
  ref={scrollListRef}
415
442
  showsVerticalScrollIndicator={false}
@@ -418,12 +445,13 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
418
445
  refreshControl={
419
446
  <RefreshControl
420
447
  refreshing={refreshing}
421
- onRefresh={() => loadOrders && loadOrders({ newFetch: true })}
448
+ onRefresh={() => { currentTabSelected === 'logisticOrders' ? loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true }) }}
422
449
  />
423
450
  }
424
451
  >
425
- {!currentOrdersGroup.error?.length &&
426
- currentOrdersGroup.orders?.length > 0 &&
452
+ {!currentOrdersGroup?.error?.length &&
453
+ currentOrdersGroup?.orders?.length > 0 &&
454
+ currentTabSelected !== 'logisticOrders' &&
427
455
  (
428
456
  <PreviousOrders
429
457
  orders={currentOrdersGroup.orders}
@@ -432,9 +460,21 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
432
460
  handleClickOrder={handleClickOrder}
433
461
  />
434
462
  )}
435
-
436
- {(currentOrdersGroup?.loading ||
437
- currentOrdersGroup?.pagination?.total === null) &&
463
+ {!logisticOrders?.error?.length &&
464
+ logisticOrders?.orders?.length > 0 &&
465
+ currentTabSelected === 'logisticOrders' && (
466
+ <PreviousOrders
467
+ orders={logisticOrders.orders.filter((order: any) => !order?.expired).map((order: any) => ({ ...order, isLogistic: true }))}
468
+ onNavigationRedirect={onNavigationRedirect}
469
+ getOrderStatus={getOrderStatus}
470
+ handleClickLogisticOrder={handleClickLogisticOrder}
471
+ isLogisticOrder
472
+ />
473
+ )
474
+ }
475
+ {((currentOrdersGroup?.loading ||
476
+ currentOrdersGroup?.pagination?.total === null) ||
477
+ (logisticOrders?.loading)) &&
438
478
  (
439
479
  <>
440
480
  <View>
@@ -484,16 +524,21 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
484
524
  />
485
525
  )}
486
526
 
487
- {!currentOrdersGroup?.loading &&
527
+ {((!currentOrdersGroup?.loading &&
488
528
  (currentOrdersGroup?.error?.length ||
489
- currentOrdersGroup?.orders?.length === 0) &&
529
+ currentOrdersGroup?.orders?.length === 0)) ||
530
+ (currentTabSelected === 'logisticOrders' &&
531
+ (logisticOrders?.error?.length > 0 || logisticOrders?.orders?.length === 0))
532
+ ) &&
490
533
  (
491
534
  <NotFoundSource
492
535
  content={
493
- !currentOrdersGroup?.error?.length
536
+ ((currentTabSelected !== 'logisticOrders' && !currentOrdersGroup?.error?.length) ||
537
+ (currentTabSelected === 'logisticOrders' && !logisticOrders?.error?.length))
494
538
  ? t('NO_RESULTS_FOUND', 'Sorry, no results found')
495
- : currentOrdersGroup?.error[0]?.message ||
496
- currentOrdersGroup?.error[0] ||
539
+ : currentOrdersGroup?.error?.[0]?.message ||
540
+ currentOrdersGroup?.error?.[0] ||
541
+ (currentTabSelected === 'logisticOrders' && logisticOrders?.error) ||
497
542
  t('NETWORK_ERROR', 'Network Error')
498
543
  }
499
544
  image={theme.images.general.notFound}
@@ -587,7 +632,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
587
632
 
588
633
  export const OrdersOption = (props: OrdersOptionParams) => {
589
634
  const [, t] = useLanguage();
590
-
635
+ const theme = useTheme()
591
636
  const ordersProps = {
592
637
  ...props,
593
638
  UIComponent: OrdersOptionUI,