ordering-ui-react-native 0.21.63-release → 0.21.64-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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.21.63-release",
3
+ "version": "0.21.64-release",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -428,13 +428,15 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
428
428
  {action === 'accept' && (
429
429
  <View style={{ height: 300, justifyContent: 'center' }}>
430
430
  <Timer onPress={() => openTimerIOnput()}>
431
- <OText weight="600" style={{ textAlign: 'center' }} size={55}>
431
+ <OText weight="600" size={55}>
432
432
  {hour}
433
433
  </OText>
434
- {hour.length > 0 && <OText size={55}>:</OText>}
435
- <OText weight="600" style={{ textAlign: 'center' }} size={55}>
434
+ {hour.length > 0 && <OText size={55} style={{ marginBottom: 10 }}>:</OText>}
435
+ <OText weight="600" size={55}>
436
436
  {min}
437
437
  </OText>
438
+ {time?.length > 2 && <OText style={{ position: 'absolute', bottom: 60, left: 55 }}>{t('HOURS', 'Hours')}</OText>}
439
+ <OText style={{ position: 'absolute', bottom: 60, right: time?.length > 2 ? 55 : 95 }}>{t('MINUTES', 'Minutes')}</OText>
438
440
  </Timer>
439
441
  </View>
440
442
  )}
@@ -10,6 +10,7 @@ export const TopActions = styled.View`
10
10
  `
11
11
 
12
12
  export const Timer = styled.TouchableOpacity`
13
+ position: relative;
13
14
  padding: 40px;
14
15
  justify-content: center;
15
16
  flex-direction: row;
@@ -53,6 +53,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
53
53
  actions,
54
54
  orderTitle,
55
55
  appTitle,
56
+ loadMessages
56
57
  } = props;
57
58
 
58
59
  const theme = useTheme();
@@ -77,7 +78,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
77
78
  const [printerSettings, setPrinterSettings] = useState<any>('')
78
79
  const [autoPrintEnabled, setAutoPrintEnabled] = useState<boolean>(false)
79
80
 
80
- const orderToComplete = [4,20,21]
81
+ const orderToComplete = [4, 20, 21]
82
+ const orderToReady = [7, 14]
81
83
 
82
84
  if (order?.status === 7 || order?.status === 4) {
83
85
  if (drivers?.length > 0 && drivers) {
@@ -297,7 +299,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
297
299
 
298
300
  const handleOpenMessagesForBusiness = () => {
299
301
  setOpenModalForBusiness(true);
300
- readMessages && readMessages();
302
+ readMessages && readMessages()
303
+ loadMessages && loadMessages()
301
304
  setUnreadAlert({ ...unreadAlert, business: false });
302
305
  };
303
306
 
@@ -339,6 +342,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
339
342
  };
340
343
 
341
344
  const handleCloseModal = () => {
345
+ readMessages && readMessages()
346
+ loadMessages && loadMessages()
342
347
  setOpenModalForBusiness(false);
343
348
  };
344
349
 
@@ -379,7 +384,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
379
384
  },
380
385
  {
381
386
  ...order?.customer?.location,
382
- title: order?.customer?.name ?? t('CUSTOMER', 'Customer'),
387
+ title: order?.customer?.name ?? t('CUSTOMER', 'Customer'),
383
388
  address: {
384
389
  addressName: order?.customer?.address,
385
390
  zipcode: order?.customer?.zipcode
@@ -413,7 +418,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
413
418
 
414
419
  useEffect(() => {
415
420
  const getStorageData = async () => {
416
- const printers = await _retrieveStoreData('printers')
421
+ const printers = await _retrieveStoreData('printers')
417
422
  const autoPrint = await _retrieveStoreData('auto_print_after_accept_order')
418
423
  setPrinterSettings(printers?.length && printers)
419
424
  setAutoPrintEnabled(!!autoPrint)
@@ -482,6 +487,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
482
487
  handleCopyClipboard={handleCopyClipboard}
483
488
  handleArrowBack={handleArrowBack}
484
489
  isCustomView={props.isCustomView}
490
+ messages={messages}
491
+ messagesReadList={messagesReadList}
485
492
  />
486
493
  <OrderDetailsContainer
487
494
  keyboardShouldPersistTaps="handled"
@@ -630,7 +637,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
630
637
  </>
631
638
  <View style={{ height: 30 }} />
632
639
  </OrderDetailsContainer>
633
-
634
640
  {order &&
635
641
  Object.keys(order).length > 0 &&
636
642
  getOrderStatus(order?.status, t)?.value ===
@@ -647,7 +653,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
647
653
  widthButton={'45%'}
648
654
  />
649
655
  )}
650
- {order?.status === 7 && (
656
+ {orderToReady.includes(order?.status) && (
651
657
  <FloatingButton
652
658
  btnText={t('READY_FOR_PICKUP', 'Ready for pickup')}
653
659
  colorTxt1={theme.colors.primary}
@@ -668,7 +674,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
668
674
  secondButtonClick={() => handleChangeOrderStatus?.(15)}
669
675
  firstButtonClick={() => handleChangeOrderStatus?.(17)}
670
676
  secondBtnText={t(
671
- 'PICKUP_COMPLETED_BY_CUSTOMER',
677
+ 'ORDER_PICKUP_COMPLETED_BY_CUSTOMER',
672
678
  'Pickup completed by customer',
673
679
  )}
674
680
  secondButton={true}
@@ -13,6 +13,7 @@ import {
13
13
  OrderBill,
14
14
  Total,
15
15
  OSRow,
16
+ OrderVehicle,
16
17
  } from './styles';
17
18
 
18
19
  import { ProductItemAccordion } from '../ProductItemAccordion';
@@ -449,7 +450,7 @@ export const OrderContentComponent = (props: OrderContent) => {
449
450
  ))}
450
451
  </OrderProducts>
451
452
 
452
- <OrderBill>
453
+ <OrderBill vehicleExists={!!order?.vehicle}>
453
454
  <Table>
454
455
  <OText mBottom={4}>{t('SUBTOTAL', 'Subtotal')}</OText>
455
456
  <OText mBottom={4}>
@@ -659,7 +660,51 @@ export const OrderContentComponent = (props: OrderContent) => {
659
660
  </View>
660
661
  </View>
661
662
  )}
663
+
662
664
  </OrderBill >
665
+ {!!order?.vehicle && (
666
+ <OrderVehicle>
667
+ <OText
668
+ style={{ marginBottom: 5 }}
669
+ size={16}
670
+ weight="600"
671
+ color={theme.colors.textGray}>
672
+ {t('VEHICLE', 'Vehicle')}
673
+ </OText>
674
+ <Table>
675
+ <OText style={{ marginBottom: 5 }}>
676
+ {t('CAR_REGISTRATION', 'Car registration')}
677
+ </OText>
678
+ <OText style={{ marginBottom: 5 }}>
679
+ {order?.vehicle?.car_registration}
680
+ </OText>
681
+ </Table>
682
+ <Table>
683
+ <OText style={{ marginBottom: 5 }}>
684
+ {t('COLOR', 'Color')}
685
+ </OText>
686
+ <OText style={{ marginBottom: 5 }}>
687
+ {order?.vehicle?.color}
688
+ </OText>
689
+ </Table>
690
+ <Table>
691
+ <OText style={{ marginBottom: 5 }}>
692
+ {t('MODEL', 'Model')}
693
+ </OText>
694
+ <OText style={{ marginBottom: 5 }}>
695
+ {order?.vehicle?.model}
696
+ </OText>
697
+ </Table>
698
+ <Table>
699
+ <OText style={{ marginBottom: 5 }}>
700
+ {t('TYPE', 'Type')}
701
+ </OText>
702
+ <OText style={{ marginBottom: 5 }}>
703
+ {order?.vehicle?.type}
704
+ </OText>
705
+ </Table>
706
+ </OrderVehicle>
707
+ )}
663
708
  <OModal
664
709
  open={openReviewModal}
665
710
  onClose={() => setOpenReviewModal(false)}
@@ -3,7 +3,9 @@ import React from 'react';
3
3
  //Styles
4
4
  import {
5
5
  Actions,
6
+ Dot,
6
7
  Header,
8
+ Messages,
7
9
  OrderHeader,
8
10
  } from './styles';
9
11
 
@@ -22,7 +24,8 @@ import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityI
22
24
  import {
23
25
  useLanguage,
24
26
  useUtils,
25
- useConfig
27
+ useConfig,
28
+ useSession
26
29
  } from 'ordering-components/native';
27
30
 
28
31
  interface OrderHeader {
@@ -35,6 +38,8 @@ interface OrderHeader {
35
38
  handleViewSummaryOrder?: any;
36
39
  handleCopyClipboard?: any
37
40
  isCustomView?: any
41
+ messages?: any
42
+ messagesReadList?: any
38
43
  }
39
44
 
40
45
  export const OrderHeaderComponent = (props: OrderHeader) => {
@@ -46,14 +51,20 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
46
51
  getOrderStatus,
47
52
  logisticOrderStatus,
48
53
  handleViewSummaryOrder,
49
- handleCopyClipboard
54
+ handleCopyClipboard,
55
+ messages,
56
+ messagesReadList
50
57
  } = props
51
58
  const theme = useTheme();
52
59
  const [, t] = useLanguage();
53
60
  const [configState] = useConfig()
61
+ const [{ user }] = useSession()
54
62
  const [{ parseDate, parsePrice }] = useUtils();
55
63
  const paymethodsLength = order?.payment_events?.filter((item: any) => item.event === 'payment')?.length
56
64
  const showExternalId = configState?.configs?.change_order_id?.value === '1'
65
+ const messagesReadIds = messagesReadList?.map((message: any) => message?.order_message_id)
66
+
67
+ const filteredMessages = messagesReadList?.length > 0 ? messages?.messages?.filter((message: any) => !messagesReadIds?.includes(message?.id)) : messages?.messages
57
68
 
58
69
  const styles = StyleSheet.create({
59
70
  icons: {
@@ -191,18 +202,20 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
191
202
  style={styles.icons}
192
203
  onClick={() => handleOpenMapView()}
193
204
  />
194
-
195
- <OIconButton
196
- icon={theme.images.general.messages}
197
- iconStyle={{
198
- width: 20,
199
- height: 20,
200
- tintColor: theme.colors.textGray,
201
- }}
202
- borderColor={theme.colors.clear}
203
- style={styles.icons}
204
- onClick={() => handleOpenMessagesForBusiness()}
205
- />
205
+ <Messages>
206
+ {filteredMessages?.filter((message: any) => message?.author_id !== user?.id && !message?.read)?.length > 0 && <Dot />}
207
+ <OIconButton
208
+ icon={theme.images.general.messages}
209
+ iconStyle={{
210
+ width: 20,
211
+ height: 20,
212
+ tintColor: theme.colors.textGray,
213
+ }}
214
+ borderColor={theme.colors.clear}
215
+ style={styles.icons}
216
+ onClick={() => handleOpenMessagesForBusiness()}
217
+ />
218
+ </Messages>
206
219
  </Actions>
207
220
  )}
208
221
  </Header>
@@ -254,7 +267,6 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
254
267
  style={styles.icons}
255
268
  onClick={() => handleOpenMapView()}
256
269
  />
257
-
258
270
  <OIconButton
259
271
  icon={theme.images.general.messages}
260
272
  iconStyle={{
@@ -25,13 +25,13 @@ export const Logo = styled.View`
25
25
 
26
26
  export const OrderContent = styled.View`
27
27
  flex: 1;
28
- ${(props : any) => props.isOrderGroup && css`
28
+ ${(props: any) => props.isOrderGroup && css`
29
29
  border-color: rgba(0, 0, 0, 0.2);
30
30
  border-width: 1px;
31
31
  padding: 10px;
32
32
  `
33
33
  }
34
- ${(props : any) => props.lastOrder && css`
34
+ ${(props: any) => props.lastOrder && css`
35
35
  margin-bottom: 50px;
36
36
  `}
37
37
  `;
@@ -68,7 +68,18 @@ export const Table = styled.View`
68
68
 
69
69
  export const OrderBill = styled.View`
70
70
  padding-vertical: 20px;
71
- padding-bottom: 30px;
71
+ ${(props: any) => !props.vehicleExists && css`
72
+ padding-bottom: 50px;
73
+ `
74
+ }
75
+ flex: 1;
76
+ `;
77
+
78
+ export const OrderVehicle = styled.View`
79
+ border-top-width: 1px;
80
+ border-top-color: ${(props: any) => props.theme.colors.borderTops};
81
+ padding-vertical: 20px;
82
+ padding-bottom: 50px;
72
83
  flex: 1;
73
84
  `;
74
85
 
@@ -98,3 +109,18 @@ export const OSRow = styled.View`
98
109
  width: 70%;
99
110
  flex-wrap: wrap;
100
111
  `
112
+
113
+ export const Messages = styled.View`
114
+ position: relative;
115
+ `;
116
+
117
+ export const Dot = styled.View`
118
+ position: absolute;
119
+ width: 8px;
120
+ height: 8px;
121
+ border-radius: 4px;
122
+ background-color: ${(props: any) => props.theme.colors.red};
123
+ top: 10;
124
+ right: 10;
125
+ z-index: 99;
126
+ `;
@@ -415,6 +415,7 @@ export interface OrderDetailsParams {
415
415
  orderTitle?: any;
416
416
  forceUpdate?: number;
417
417
  getPermissions?: any
418
+ loadMessages?: any
418
419
  }
419
420
  export interface ProductItemAccordionParams {
420
421
  isCartPending?: boolean;