ordering-ui-react-native 0.21.24-release → 0.21.25-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.24-release",
3
+ "version": "0.21.25-release",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -417,7 +417,7 @@ export const OrderContentComponent = (props: OrderContent) => {
417
417
  )}
418
418
  </View>
419
419
  )}
420
- {!order?.user_review && pastOrderStatuses.includes(order?.status) && (
420
+ {!order?.user_review && pastOrderStatuses.includes(order?.status) && order?.customer_id && (
421
421
  <OButton
422
422
  style={styles.btnReview}
423
423
  textStyle={{ color: theme.colors.white }}
@@ -22,6 +22,7 @@ import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityI
22
22
  import {
23
23
  useLanguage,
24
24
  useUtils,
25
+ useConfig
25
26
  } from 'ordering-components/native';
26
27
 
27
28
  interface OrderHeader {
@@ -49,8 +50,10 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
49
50
  } = props
50
51
  const theme = useTheme();
51
52
  const [, t] = useLanguage();
53
+ const [configState] = useConfig()
52
54
  const [{ parseDate, parsePrice }] = useUtils();
53
55
  const paymethodsLength = order?.payment_events?.filter((item: any) => item.event === 'payment')?.length
56
+ const showExternalId = configState?.configs?.change_order_id?.value === '1'
54
57
 
55
58
  const styles = StyleSheet.create({
56
59
  icons: {
@@ -270,7 +273,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
270
273
 
271
274
  <OText numberOfLines={2} size={20} weight="600">
272
275
  <>
273
- {`${t('INVOICE_ORDER_NO', 'Order No.')} ${order?.id} `}
276
+ {`${t('INVOICE_ORDER_NO', 'Order No.')} ${showExternalId ? order?.external_id || order?.id : order?.id} `}
274
277
  {!order?.isLogistic && (!order?.order_group_id || !logisticOrderStatus?.includes(order?.status)) && (
275
278
  <>
276
279
  {t('IS', 'is')}{' '}
@@ -284,7 +287,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
284
287
  )}
285
288
  </>
286
289
  </OText>
287
- {order?.external_id && (
290
+ {order?.external_id && !showExternalId && (
288
291
  <OText size={13}>
289
292
  <OText size={13} weight='bold'>{`${t('EXTERNAL_ID', 'External ID :')} `}</OText>
290
293
  {order?.external_id}
@@ -191,23 +191,24 @@ export const OrderItem = React.memo((props: any) => {
191
191
  {order?.external_id ?? t('NO_EXTERNAL_ID', 'No external Id ') + t('NO', 'Order No.') + order?.id}
192
192
  </OText>
193
193
  )}
194
- <OText
194
+ {!showExternalId && <OText
195
195
  style={styles.date}
196
196
  color={theme.colors.unselectText}
197
197
  numberOfLines={1}
198
198
  adjustsFontSizeToFit
199
199
  >
200
- {(!showExternalId && ((!!order?.order_group_id && order?.order_group && isLogisticOrder
200
+ {((!!order?.order_group_id && order?.order_group && isLogisticOrder
201
201
  ? `${order?.order_group?.orders?.length} ${t('ORDERS', 'Orders')}`
202
202
  : (t('NO', 'Order No.') + order?.id)
203
- ) + ' · '))}
203
+ ) + ' · ')}
204
204
  {order?.delivery_datetime_utc
205
205
  ? parseDate(order?.delivery_datetime_utc)
206
206
  : parseDate(order?.delivery_datetime, { utc: false })}
207
207
  </OText>
208
+ }
208
209
  {((currentTabSelected === 'pending' || currentTabSelected === 'inProgress') && allowColumns?.timer) && (
209
210
  <>
210
- <OText> · </OText>
211
+ {!showExternalId && <OText> · </OText>}
211
212
  <OText
212
213
  style={styles.date}
213
214
  color={
@@ -11,7 +11,8 @@ import {
11
11
  useToast,
12
12
  useLanguage,
13
13
  useUtils,
14
- useConfig
14
+ useConfig,
15
+ useValidationFields
15
16
  } from 'ordering-components/native';
16
17
  import {
17
18
  CenterView,
@@ -57,7 +58,8 @@ const ProfileUI = (props: ProfileParams) => {
57
58
  const [, t] = useLanguage();
58
59
  const [, { showToast }] = useToast();
59
60
  const [{ optimizeImage }] = useUtils();
60
- const [{ configs }] = useConfig()
61
+ const [{ configs }] = useConfig();
62
+ const [{ loading }, { loadOriginalValidationFields }] = useValidationFields()
61
63
  const { errors } = useForm();
62
64
  const theme = useTheme();
63
65
 
@@ -262,15 +264,17 @@ const ProfileUI = (props: ProfileParams) => {
262
264
 
263
265
  return (
264
266
  <>
265
- {validationFields?.error && (
267
+ {validationFields?.error && !loading && (
266
268
  <NotFoundSource
267
269
  content={
268
- validationFields?.error[0] ||
269
- validationFields?.error[0]?.message ||
270
+ validationFields?.error?.[0] ||
271
+ validationFields?.error?.[0]?.message ||
270
272
  t('NETWORK_ERROR', 'Network Error')
271
273
  }
272
274
  image={theme.images.general.notFound}
273
275
  conditioned={false}
276
+ onClickButton={() => loadOriginalValidationFields({ forceLoading: true })}
277
+ btnTitle={t('REFRESH_PROFILE', 'Refresh profile')}
274
278
  />
275
279
  )}
276
280