ordering-ui-react-native 0.22.83 → 0.22.84

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.22.83",
3
+ "version": "0.22.84",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -428,19 +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
- <View>
432
- <OText weight="600" size={55}>
433
- {hour}
434
- </OText>
435
- <OText style={{ marginLeft: 10 }}>{t('HOURS', 'Hours')}</OText>
436
- </View>
437
- {hour.length > 0 && <OText size={55} style={{ marginBottom: 30 }}>:</OText>}
438
- <View>
439
- <OText weight="600" size={55}>
440
- {min}
441
- </OText>
442
- <OText style={{ marginLeft: 10 }}>{t('MINUTES', 'Minutes')}</OText>
443
- </View>
431
+ <OText weight="600" size={55}>
432
+ {hour}
433
+ </OText>
434
+ {hour.length > 0 && <OText size={55} style={{ marginBottom: 10 }}>:</OText>}
435
+ <OText weight="600" size={55}>
436
+ {min}
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>
444
440
  </Timer>
445
441
  </View>
446
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;
@@ -78,7 +78,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
78
78
  const [printerSettings, setPrinterSettings] = useState<any>('')
79
79
  const [autoPrintEnabled, setAutoPrintEnabled] = useState<boolean>(false)
80
80
 
81
- const orderToComplete = [4, 7, 14, 20, 21]
81
+ const orderToComplete = [4, 20, 21]
82
+ const orderToReady = [7, 14]
82
83
 
83
84
  if (order?.status === 7 || order?.status === 4) {
84
85
  if (drivers?.length > 0 && drivers) {
@@ -341,6 +342,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
341
342
  };
342
343
 
343
344
  const handleCloseModal = () => {
345
+ readMessages && readMessages()
346
+ loadMessages && loadMessages()
344
347
  setOpenModalForBusiness(false);
345
348
  };
346
349
 
@@ -485,6 +488,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
485
488
  handleArrowBack={handleArrowBack}
486
489
  isCustomView={props.isCustomView}
487
490
  messages={messages}
491
+ messagesReadList={messagesReadList}
488
492
  />
489
493
  <OrderDetailsContainer
490
494
  keyboardShouldPersistTaps="handled"
@@ -633,7 +637,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
633
637
  </>
634
638
  <View style={{ height: 30 }} />
635
639
  </OrderDetailsContainer>
636
-
637
640
  {order &&
638
641
  Object.keys(order).length > 0 &&
639
642
  getOrderStatus(order?.status, t)?.value ===
@@ -650,7 +653,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
650
653
  widthButton={'45%'}
651
654
  />
652
655
  )}
653
- {order?.status === 7 && (
656
+ {orderToReady.includes(order?.status) && (
654
657
  <FloatingButton
655
658
  btnText={t('READY_FOR_PICKUP', 'Ready for pickup')}
656
659
  colorTxt1={theme.colors.primary}
@@ -24,7 +24,8 @@ import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityI
24
24
  import {
25
25
  useLanguage,
26
26
  useUtils,
27
- useConfig
27
+ useConfig,
28
+ useSession
28
29
  } from 'ordering-components/native';
29
30
 
30
31
  interface OrderHeader {
@@ -38,6 +39,7 @@ interface OrderHeader {
38
39
  handleCopyClipboard?: any
39
40
  isCustomView?: any
40
41
  messages?: any
42
+ messagesReadList?: any
41
43
  }
42
44
 
43
45
  export const OrderHeaderComponent = (props: OrderHeader) => {
@@ -51,13 +53,18 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
51
53
  handleViewSummaryOrder,
52
54
  handleCopyClipboard,
53
55
  messages,
56
+ messagesReadList
54
57
  } = props
55
58
  const theme = useTheme();
56
59
  const [, t] = useLanguage();
57
60
  const [configState] = useConfig()
61
+ const [{ user }] = useSession()
58
62
  const [{ parseDate, parsePrice }] = useUtils();
59
63
  const paymethodsLength = order?.payment_events?.filter((item: any) => item.event === 'payment')?.length
60
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
61
68
 
62
69
  const styles = StyleSheet.create({
63
70
  icons: {
@@ -196,7 +203,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
196
203
  onClick={() => handleOpenMapView()}
197
204
  />
198
205
  <Messages>
199
- {messages?.messages?.filter((message: any) => !message?.read)?.length > 0 && <Dot />}
206
+ {filteredMessages?.filter((message: any) => message?.author_id !== user?.id && !message?.read)?.length > 0 && <Dot />}
200
207
  <OIconButton
201
208
  icon={theme.images.general.messages}
202
209
  iconStyle={{