ordering-ui-react-native 0.21.20 → 0.21.21

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.20",
3
+ "version": "0.21.21",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -99,6 +99,17 @@ const ChatUI = (props: MessagesParams) => {
99
99
  23: t('ORDER_DRIVER_ON_WAY', 'Driver on way')
100
100
  }
101
101
 
102
+ const getLogisticTag = (status: any) => {
103
+ const keyList: any = {
104
+ 0: t('PENDING', 'Pending'),
105
+ 1: t('IN_PROGRESS', 'In progress'),
106
+ 2: t('IN_QUEUE', 'In queue'),
107
+ 3: t('EXPIRED', 'Expired'),
108
+ 4: t('RESOLVED', 'Resolved'),
109
+ }
110
+ return keyList[status] ? keyList[status] : t('UNKNOWN', 'Unknown')
111
+ }
112
+
102
113
  const storeMessageList: any = [
103
114
  { key: 'store_message_1', text: t('STORE_MESSAGE_1', 'store_message_1') },
104
115
  { key: 'store_message_2', text: t('STORE_MESSAGE_2', 'store_message_2') },
@@ -372,18 +383,25 @@ const ChatUI = (props: MessagesParams) => {
372
383
  }}>
373
384
  <OText
374
385
  numberOfLines={3}
375
- style={{ ...styles.firstMessageText, textAlign: 'center' }}>
376
- {message.change?.attribute !== 'driver_id'
386
+ style={{ ...styles.firstMessageText, textAlign: 'center' }}
387
+ >
388
+ {
389
+ message.change?.attribute !== 'driver_id'
377
390
  ?
378
- `${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${filterSpecialStatus.includes(message.change.attribute) ?
379
- `${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new} ${t('MINUTES', 'Minutes')}` :
380
- `${message.change.old !== null && ORDER_STATUS[parseInt(message.change.old, 10)]} ${t('TO', 'to')} ${ORDER_STATUS[parseInt(message.change.new, 10)]}`
391
+ `${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${filterSpecialStatus.includes(message.change.attribute)
392
+ ? `${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new} ${t('MINUTES', 'Minutes')}`
393
+ : `${message.change?.attribute !== 'logistic_status'
394
+ ? message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])
395
+ : message.change.old !== null && getLogisticTag(message.change.old)} ${t('TO', 'to')} ${message.change?.attribute !== 'logistic_status'
396
+ ? t(ORDER_STATUS[parseInt(message.change.new, 10)])
397
+ : getLogisticTag(message.change.new)}`
381
398
  }`
382
399
  : message.change.new
383
400
  ?
384
401
  `${message.driver?.name} ${message.driver?.lastname !== null ? message.driver.lastname : ''} ${t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')} ${message.comment ? message.comment.length : ''}`
385
402
  :
386
- `${t('DRIVER_UNASSIGNED', 'Driver unassigned')}`}
403
+ `${t('DRIVER_UNASSIGNED', 'Driver unassigned')}`
404
+ }
387
405
  </OText>
388
406
  <OText size={10} color={'#aaa'} style={{ alignSelf: 'flex-start' }}>
389
407
  {parseTime(message?.created_at, { outputFormat: 'hh:mma' })}
@@ -1063,7 +1081,7 @@ const ChatUI = (props: MessagesParams) => {
1063
1081
  .m-signature-pad {
1064
1082
  box-shadow: none;
1065
1083
  border: none;
1066
- }
1084
+ }
1067
1085
  .m-signature-pad--body {
1068
1086
  border: none;
1069
1087
  }
@@ -49,7 +49,8 @@ const ProfileUI = (props: ProfileParams) => {
49
49
  handleToggleAvalaibleStatusDriver,
50
50
  userState,
51
51
  isAvailableLoading,
52
- isAlsea
52
+ isAlsea,
53
+ isHideDriverStatus
53
54
  } = props;
54
55
 
55
56
  const [{ user }] = useSession();
@@ -345,7 +346,7 @@ const ProfileUI = (props: ProfileParams) => {
345
346
  />
346
347
  </CenterView>
347
348
 
348
- {user?.level === 4 && (
349
+ {user?.level === 4 && !isHideDriverStatus && (
349
350
  <EnabledStatusDriver>
350
351
  <View style={{ flex: 1 }}>
351
352
  <OText
@@ -57,6 +57,7 @@ export interface ProfileParams {
57
57
  showField?: any;
58
58
  isRequiredField?: any;
59
59
  isAlsea?: boolean;
60
+ isHideDriverStatus?: boolean;
60
61
  }
61
62
 
62
63
  export interface AddressListParams {
@@ -294,7 +294,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
294
294
  <ButtonWrapper>
295
295
  {!hideReviewOrderButton &&
296
296
  allowedOrderStatus.includes(parseInt(order?.status)) &&
297
- !order.review && (
297
+ !order.review && order?.cart && (
298
298
  <TouchableOpacity
299
299
  onPress={() => handleClickOrderReview(order)}
300
300
  style={styles.reviewButton}>
@@ -303,7 +303,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
303
303
  </OText>
304
304
  </TouchableOpacity>
305
305
  )}
306
- {!hideReorderButton && typeof order?.id === 'number' && (
306
+ {!hideReorderButton && typeof order?.id === 'number' && order?.cart && (
307
307
  <OButton
308
308
  text={t('REORDER', 'Reorder')}
309
309
  imgRightSrc={''}