ordering-ui-react-native 0.15.10-release → 0.15.12-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.
Files changed (34) hide show
  1. package/package.json +1 -1
  2. package/src/components/OrderDetails/index.tsx +2 -2
  3. package/src/pages/BusinessProductsList.tsx +1 -0
  4. package/src/pages/BusinessesListing.tsx +1 -1
  5. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  6. package/themes/business/src/components/OrderDetails/Delivery.tsx +9 -9
  7. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +123 -89
  8. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  9. package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
  10. package/themes/kiosk/src/components/Cart/index.tsx +99 -25
  11. package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
  12. package/themes/kiosk/src/components/OrderDetails/index.tsx +134 -39
  13. package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
  14. package/themes/kiosk/src/types/index.d.ts +2 -0
  15. package/themes/original/index.tsx +10 -8
  16. package/themes/original/src/components/BusinessBasicInformation/index.tsx +1 -1
  17. package/themes/original/src/components/BusinessController/index.tsx +20 -1
  18. package/themes/original/src/components/BusinessController/styles.tsx +22 -0
  19. package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
  20. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
  21. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  22. package/themes/original/src/components/Cart/index.tsx +1 -1
  23. package/themes/original/src/components/OrderDetails/index.tsx +1 -1
  24. package/themes/original/src/components/OrderSummary/index.tsx +2 -2
  25. package/themes/original/src/components/OrderTypeSelector/index.tsx +1 -1
  26. package/themes/original/src/components/ProductForm/index.tsx +26 -26
  27. package/themes/original/src/components/Promotions/index.tsx +233 -0
  28. package/themes/original/src/components/Promotions/styles.tsx +58 -0
  29. package/themes/original/src/components/SingleProductCard/index.tsx +39 -18
  30. package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
  31. package/themes/original/src/components/UserProfile/index.tsx +8 -1
  32. package/themes/original/src/components/Wallets/index.tsx +58 -4
  33. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  34. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.15.10-release",
3
+ "version": "0.15.12-release",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -514,7 +514,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
514
514
  </Table>
515
515
  )}
516
516
  {
517
- order?.taxes?.length === 0 && order?.tax_type === 2 && (
517
+ order?.taxes?.length === 0 && order?.tax_type === 2 && order?.summary?.tax > 0 && (
518
518
  <Table>
519
519
  <OText>
520
520
  {t('TAX', 'Tax')} {`(${verifyDecimals(order?.tax, parseNumber)}%)`}
@@ -524,7 +524,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
524
524
  )
525
525
  }
526
526
  {
527
- order?.fees?.length === 0 && (
527
+ order?.fees?.length === 0 && order?.summary?.service_fee > 0 && (
528
528
  <Table>
529
529
  <OText>
530
530
  {t('SERVICE_FEE', 'Service fee')}
@@ -31,6 +31,7 @@ const BusinessProductsList = (props: any) => {
31
31
  'open',
32
32
  'about',
33
33
  'description',
34
+ 'ribbon',
34
35
  'address',
35
36
  'location',
36
37
  'schedule',
@@ -21,7 +21,7 @@ const BusinessesListing = (props: any) => {
21
21
  ...props,
22
22
  isSearchByName: true,
23
23
  isSearchByDescription: true,
24
- propsToFetch: ['id', 'name', 'header', 'logo', 'location', 'schedule', 'open', 'delivery_price', 'distance', 'delivery_time', 'pickup_time', 'reviews', 'featured', 'offers', 'food', 'laundry', 'alcohol', 'groceries', 'slug'],
24
+ propsToFetch: ['id', 'name', 'header', 'logo', 'ribbon', 'location', 'schedule', 'open', 'delivery_price', 'distance', 'delivery_time', 'pickup_time', 'reviews', 'featured', 'offers', 'food', 'laundry', 'alcohol', 'groceries', 'slug'],
25
25
  onBusinessClick: (business: any) => {
26
26
  props.navigation.navigate('Business', { store: store || business.slug, header: business.header, logo: business.logo })
27
27
  }
@@ -335,7 +335,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
335
335
  addressName: order?.business?.address,
336
336
  zipcode: order?.business?.zipcode
337
337
  },
338
- icon: order?.business?.logo || theme.images.dummies.businessLogo,
338
+ icon: order?.business?.logo || 'https://res.cloudinary.com/demo/image/fetch/c_thumb,g_face,r_max/https://res.cloudinary.com/ordering2/image/upload/v1654619525/hzegwosnplvrbtjkpfi6.png',
339
339
  level: 2,
340
340
  },
341
341
  {
@@ -101,9 +101,9 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
101
101
  };
102
102
 
103
103
  const handleOpenMapView = async () => {
104
- if (permissions.locationStatus === 'granted') {
104
+ if (permissions?.locationStatus === 'granted') {
105
105
  setOpenModalForMapView(!openModalForMapView);
106
- } else if (permissions.locationStatus === 'blocked') {
106
+ } else if (permissions?.locationStatus === 'blocked') {
107
107
  // redirectToSettings();
108
108
  showToast(
109
109
  ToastType.Error,
@@ -141,9 +141,9 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
141
141
  handleArrowBack()
142
142
  }
143
143
 
144
- const handleAcceptLogisticOrder = (order : any) => {
144
+ const handleAcceptLogisticOrder = (order: any) => {
145
145
  handleClickLogisticOrder?.(1, order?.logistic_order_id)
146
- if(order?.order_group){
146
+ if (order?.order_group) {
147
147
  handleArrowBack()
148
148
  }
149
149
  }
@@ -166,10 +166,10 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
166
166
  ];
167
167
 
168
168
  useEffect(() => {
169
- if (permissions.locationStatus !== 'granted' && openModalForMapView) {
169
+ if (permissions?.locationStatus !== 'granted' && openModalForMapView) {
170
170
  setOpenModalForMapView(false);
171
171
  }
172
- }, [permissions.locationStatus]);
172
+ }, [permissions?.locationStatus]);
173
173
 
174
174
  useEffect(() => {
175
175
  if (openModalForAccept) {
@@ -215,8 +215,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
215
215
  }, [messagesReadList]);
216
216
 
217
217
  useEffect(() => {
218
- forceUpdate && handleViewActionOrder && handleViewActionOrder(forceUpdate === 9 ? 'forcePickUp': 'forceDelivery')
219
- },[forceUpdate])
218
+ forceUpdate && handleViewActionOrder && handleViewActionOrder(forceUpdate === 9 ? 'forcePickUp' : 'forceDelivery')
219
+ }, [forceUpdate])
220
220
 
221
221
  const styles = StyleSheet.create({
222
222
  btnPickUp: {
@@ -254,7 +254,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
254
254
  );
255
255
  }
256
256
 
257
- const OrderDetailsInformation = (props : {order: any, isOrderGroup?: boolean, lastOrder?: boolean}) => {
257
+ const OrderDetailsInformation = (props: { order: any, isOrderGroup?: boolean, lastOrder?: boolean }) => {
258
258
  const {
259
259
  order,
260
260
  isOrderGroup,
@@ -11,6 +11,7 @@ import {
11
11
  Table,
12
12
  OrderBill,
13
13
  Total,
14
+ OSRow,
14
15
  } from './styles';
15
16
 
16
17
  import { ProductItemAccordion } from '../ProductItemAccordion';
@@ -75,6 +76,20 @@ export const OrderContentComponent = (props: OrderContent) => {
75
76
  }
76
77
  })
77
78
 
79
+ const getIncludedTaxes = () => {
80
+ if (order?.taxes?.length === 0) {
81
+ return order.tax_type === 1 ? order?.summary?.tax ?? 0 : 0
82
+ } else {
83
+ return order?.taxes.reduce((taxIncluded: number, tax: any) => {
84
+ return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
85
+ }, 0)
86
+ }
87
+ }
88
+
89
+ const getIncludedTaxesDiscounts = () => {
90
+ return order?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
91
+ }
92
+
78
93
  return (
79
94
  <OrderContent isOrderGroup={isOrderGroup} lastOrder={lastOrder}>
80
95
  {isOrderGroup && (
@@ -308,14 +323,14 @@ export const OrderContentComponent = (props: OrderContent) => {
308
323
  </OText>
309
324
  )}
310
325
  {((order?.delivery_option !== undefined && order?.delivery_type === 1) || !!order?.comment) && (
311
- <View style={{marginTop: 10}}>
326
+ <View style={{ marginTop: 10 }}>
312
327
  {order?.delivery_option !== undefined && order?.delivery_type === 1 && (
313
328
  <OText>
314
329
  {order?.delivery_option?.name}
315
330
  </OText>
316
331
  )}
317
332
  {!!order?.comment && (
318
- <OText style={{fontStyle: 'italic', opacity: 0.6, marginBottom: 5}}>
333
+ <OText style={{ fontStyle: 'italic', opacity: 0.6, marginBottom: 5 }}>
319
334
  {order?.comment}
320
335
  </OText>
321
336
  )}
@@ -350,84 +365,109 @@ export const OrderContentComponent = (props: OrderContent) => {
350
365
  <Table>
351
366
  <OText mBottom={4}>{t('SUBTOTAL', 'Subtotal')}</OText>
352
367
  <OText mBottom={4}>
353
- {parsePrice(
354
- order.tax_type === 1
355
- ? order?.summary?.subtotal + order?.summary?.tax ?? 0
356
- : order?.summary?.subtotal ?? 0,
357
- )}
368
+ {parsePrice(((order?.summary?.subtotal ?? order?.subtotal) + getIncludedTaxes()))}
358
369
  </OText>
359
370
  </Table>
360
-
361
- {order?.tax_type !== 1 && (
371
+ {(order?.summary?.discount > 0 ?? order?.discount > 0) && order?.offers?.length === 0 && (
372
+ <Table>
373
+ {order?.offer_type === 1 ? (
374
+ <OText mBottom={4}>
375
+ {t('DISCOUNT', theme?.defaultLanguages?.DISCOUNT || 'Discount')}{' '}
376
+ <OText>{`(${verifyDecimals(order?.offer_rate, parsePrice)}%)`}</OText>
377
+ </OText>
378
+ ) : (
379
+ <OText mBottom={4}>{t('DISCOUNT', theme?.defaultLanguages?.DISCOUNT || 'Discount')}</OText>
380
+ )}
381
+ <OText>- {parsePrice(order?.summary?.discount ?? order?.discount)}</OText>
382
+ </Table>
383
+ )}
384
+ {
385
+ order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any) => (
386
+ <Table key={offer.id}>
387
+ <OSRow>
388
+ <OText mBottom={4}>
389
+ {offer.name}
390
+ {offer.rate_type === 1 && (
391
+ <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
392
+ )}
393
+ </OText>
394
+ </OSRow>
395
+ <OText mBottom={4}>- {parsePrice(offer?.summary?.discount)}</OText>
396
+ </Table>
397
+ ))
398
+ }
399
+ {order?.summary?.subtotal_with_discount > 0 && order?.summary?.discount > 0 && order?.summary?.total >= 0 && (
400
+ <Table>
401
+ <OText mBottom={4}>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
402
+ {order?.tax_type === 1 ? (
403
+ <OText mBottom={4}>{parsePrice((order?.summary?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0))}</OText>
404
+ ) : (
405
+ <OText mBottom={4}>{parsePrice(order?.summary?.subtotal_with_discount ?? 0)}</OText>
406
+ )}
407
+ </Table>
408
+ )}
409
+ {order?.taxes?.length === 0 && order?.tax_type === 2 && order?.summary?.tax > 0 && (
362
410
  <Table>
363
411
  <OText mBottom={4}>
364
- {t('TAX', 'Tax')}
365
- {`(${verifyDecimals(
366
- order?.summary?.tax_rate,
367
- parseNumber,
368
- )}%)`}
412
+ {t('TAX', 'Tax')} {`(${verifyDecimals(order?.tax, parseNumber)}%)`}
369
413
  </OText>
370
-
371
414
  <OText mBottom={4}>
372
415
  {parsePrice(order?.summary?.tax ?? 0)}
373
416
  </OText>
374
- </Table >
417
+ </Table>
375
418
  )}
376
-
377
419
  {
378
- order?.summary?.discount > 0 && (
420
+ order?.fees?.length === 0 && order?.summary?.service_fee > 0 && (
379
421
  <Table>
380
- {order?.offer_type === 1 ? (
381
- <OText mBottom={4}>
382
- <OText>{t('DISCOUNT', 'Discount')}</OText>
383
-
384
- <OText>
385
- {`(${verifyDecimals(
386
- order?.offer_rate,
387
- parsePrice,
388
- )}%)`}
389
- </OText>
390
- </OText>
391
- ) : (
392
- <OText mBottom={4}>{t('DISCOUNT', 'Discount')}</OText>
393
- )}
394
-
395
422
  <OText mBottom={4}>
396
- - {parsePrice(order?.summary?.discount)}
423
+ {t('SERVICE_FEE', 'Service fee')}
424
+ {`(${verifyDecimals(order?.service_fee, parseNumber)}%)`}
397
425
  </OText>
426
+ <OText mBottom={4}>{parsePrice(order?.summary?.service_fee ?? 0)}</OText>
398
427
  </Table>
399
428
  )
400
429
  }
401
-
402
430
  {
403
- order?.summary?.subtotal_with_discount > 0 &&
404
- order?.summary?.discount > 0 &&
405
- order?.summary?.total >= 0 && (
406
- <Table>
407
- <OText mBottom={4}>
408
- {t(
409
- 'SUBTOTAL_WITH_DISCOUNT',
410
- 'Subtotal with discount',
411
- )}
412
- </OText>
413
- {order?.tax_type === 1 ? (
431
+ order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0).map((tax: any) => (
432
+ <Table key={tax.id}>
433
+ <OSRow>
414
434
  <OText mBottom={4}>
415
- {parsePrice(
416
- order?.summary?.subtotal_with_discount +
417
- order?.summary?.tax ?? 0,
418
- )}
435
+ {tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
436
+ {`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
419
437
  </OText>
420
- ) : (
438
+ </OSRow>
439
+ <OText mBottom={4}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
440
+ </Table>
441
+ ))
442
+ }
443
+ {
444
+ order?.fees?.length > 0 && order?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0))?.map((fee: any) => (
445
+ <Table key={fee.id}>
446
+ <OSRow>
447
+ <OText mBottom={4}>
448
+ {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
449
+ ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)} + `}{fee.percentage}%){' '}
450
+ </OText>
451
+ </OSRow>
452
+ <OText mBottom={4}>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0)}</OText>
453
+ </Table>
454
+ ))
455
+ }
456
+ {
457
+ order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 3)?.map((offer: any) => (
458
+ <Table key={offer.id}>
459
+ <OSRow>
421
460
  <OText mBottom={4}>
422
- {parsePrice(
423
- order?.summary?.subtotal_with_discount ?? 0,
461
+ {offer.name}
462
+ {offer.rate_type === 1 && (
463
+ <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
424
464
  )}
425
465
  </OText>
426
- )}
466
+ </OSRow>
467
+ <OText mBottom={4}>- {parsePrice(offer?.summary?.discount)}</OText>
427
468
  </Table>
428
- )
469
+ ))
429
470
  }
430
-
431
471
  {
432
472
  order?.summary?.delivery_price > 0 && (
433
473
  <Table>
@@ -441,41 +481,35 @@ export const OrderContentComponent = (props: OrderContent) => {
441
481
  </Table>
442
482
  )
443
483
  }
444
-
445
- <Table>
446
- <OText mBottom={4}>
447
- {t('DRIVER_TIP', 'Driver tip')}{' '}
448
- {order?.summary?.driver_tip > 0 &&
449
- parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
450
- !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
451
- `(${verifyDecimals(
452
- order?.summary?.driver_tip,
453
- parseNumber,
454
- )}%)`}
455
- </OText>
456
-
457
- <OText mBottom={4}>
458
- {parsePrice(order?.summary?.driver_tip ?? 0)}
459
- </OText>
460
- </Table>
461
-
462
484
  {
463
- order?.summary?.service_fee > 0 && (
464
- <Table>
465
- <OText mBottom={4}>
466
- {t('SERVICE_FEE', 'Service Fee')}{' '}
467
- {`(${verifyDecimals(
468
- order?.summary?.service_fee,
469
- parseNumber,
470
- )}%)`}
471
- </OText>
472
-
473
- <OText mBottom={4}>
474
- {parsePrice(order?.summary?.service_fee)}
475
- </OText>
485
+ order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any) => (
486
+ <Table key={offer.id}>
487
+ <OSRow>
488
+ <OText mBottom={4}>
489
+ {offer.name}
490
+ {offer.rate_type === 1 && (
491
+ <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
492
+ )}
493
+ </OText>
494
+ </OSRow>
495
+ <OText mBottom={4}>- {parsePrice(offer?.summary?.discount)}</OText>
476
496
  </Table>
477
- )
497
+ ))
478
498
  }
499
+ {order?.summary?.driver_tip > 0 && (
500
+ <Table>
501
+ <OText mBottom={4}>
502
+ {t('DRIVER_TIP', 'Driver tip')}
503
+ {order?.summary?.driver_tip > 0 &&
504
+ parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
505
+ !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
506
+ (
507
+ `(${verifyDecimals(order?.summary?.driver_tip, parseNumber)}%)`
508
+ )}
509
+ </OText>
510
+ <OText mBottom={4}>{parsePrice(order?.summary?.driver_tip ?? order?.totalDriverTip)}</OText>
511
+ </Table>
512
+ )}
479
513
 
480
514
  <Total style={{ paddingBottom: 10 }}>
481
515
  <Table>
@@ -487,7 +521,7 @@ export const OrderContentComponent = (props: OrderContent) => {
487
521
  mBottom={4}
488
522
  style={styles.textBold}
489
523
  color={theme.colors.primary}>
490
- {parsePrice(order?.summary?.total ?? 0)}
524
+ {parsePrice(order?.summary?.total ?? order?.total)}
491
525
  </OText>
492
526
  </Table>
493
527
  </Total>
@@ -268,6 +268,12 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
268
268
  <OText size={13} weight='bold'>{`${t('ORDER_TYPE', 'Order Type')}: `}</OText>
269
269
  {orderTypes(order.delivery_type)}
270
270
  </OText>
271
+ {order?.delivery_option && (
272
+ <OText size={13}>
273
+ <OText size={13} weight='bold'>{`${t('DELIVERY_PREFERENCE', 'Delivery Preference')}: `}</OText>
274
+ {order?.delivery_option?.name}
275
+ </OText>
276
+ )}
271
277
  {order?.payment_events?.length > 0 && (
272
278
  <View>
273
279
  <OText size={13}>
@@ -91,3 +91,10 @@ export const AssignDriver = styled.View`
91
91
  padding-vertical: 10px;
92
92
  margin-bottom: 10px;
93
93
  `;
94
+
95
+ export const OSRow = styled.View`
96
+ flex-direction: row;
97
+ overflow: hidden;
98
+ width: 70%;
99
+ flex-wrap: wrap;
100
+ `
@@ -10,7 +10,7 @@ import {
10
10
  useValidationFields,
11
11
  } from 'ordering-components/native';
12
12
 
13
- import { CheckoutAction, OrderTypeWrapper, FloatingLayout } from './styles';
13
+ import { CheckoutAction, OrderTypeWrapper, FloatingLayout, OSRow } from './styles';
14
14
 
15
15
  import { OSBill, OSCoupon, OSTable } from '../OrderSummary/styles';
16
16
 
@@ -90,6 +90,20 @@ const CartUI = (props: any) => {
90
90
 
91
91
  const goToBack = () => navigation.goBack();
92
92
 
93
+ const getIncludedTaxes = () => {
94
+ if (cart?.taxes === null) {
95
+ return cart.business.tax_type === 1 ? cart?.tax : 0
96
+ } else {
97
+ return cart?.taxes.reduce((taxIncluded: number, tax: any) => {
98
+ return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
99
+ }, 0)
100
+ }
101
+ }
102
+
103
+ const getIncludedTaxesDiscounts = () => {
104
+ return cart?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
105
+ }
106
+
93
107
  return (
94
108
  <>
95
109
  <Container>
@@ -177,13 +191,10 @@ const CartUI = (props: any) => {
177
191
  <OSTable>
178
192
  <OText>{t('SUBTOTAL', 'Subtotal')}</OText>
179
193
  <OText>
180
- {cart.business.tax_type === 1
181
- ? parsePrice((cart?.subtotal + cart?.tax) || 0)
182
- : parsePrice(cart?.subtotal || 0)}
194
+ {parsePrice(cart?.subtotal + getIncludedTaxes())}
183
195
  </OText>
184
196
  </OSTable>
185
- {cart?.discount > 0 && cart?.total >= 0 && orientationState?.orientation == PORTRAIT && (
186
-
197
+ {cart?.discount > 0 && cart?.total >= 0 && cart?.offers?.length === 0 && orientationState?.orientation == PORTRAIT && (
187
198
  <OSTable
188
199
  style={{
189
200
  backgroundColor: theme.colors.success,
@@ -226,44 +237,107 @@ const CartUI = (props: any) => {
226
237
  </OText>
227
238
  </OSTable>
228
239
  )}
229
- {cart.business.tax_type !== 1 && (
240
+ {
241
+ cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any) => (
242
+ <OSTable key={offer.id}>
243
+ <OSRow>
244
+ <OText>{offer.name}</OText>
245
+ {offer.rate_type === 1 && (
246
+ <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
247
+ )}
248
+ </OSRow>
249
+ <OText>
250
+ - {parsePrice(offer?.summary?.discount)}
251
+ </OText>
252
+ </OSTable>
253
+ ))
254
+ }
255
+ {cart?.subtotal_with_discount > 0 && cart?.discount > 0 && cart?.total >= 0 && (
230
256
  <OSTable>
231
- <OText>
232
- {t('TAX', 'Tax')}
233
- {`(${verifyDecimals(cart?.business?.tax, parseNumber)}%)`}
234
- </OText>
235
- <OText>{parsePrice(cart?.tax || 0)}</OText>
257
+ <OText numberOfLines={1}>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
258
+ {cart?.business?.tax_type === 1 ? (
259
+ <OText>{parsePrice(cart?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0)}</OText>
260
+ ) : (
261
+ <OText>{parsePrice(cart?.subtotal_with_discount ?? 0)}</OText>
262
+ )}
236
263
  </OSTable>
237
264
  )}
265
+ {
266
+ cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0).map((tax: any) => (
267
+ <OSTable key={tax.id}>
268
+ <OSRow>
269
+ <OText>
270
+ {tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
271
+ {`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
272
+ </OText>
273
+ </OSRow>
274
+ <OText>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
275
+ </OSTable>
276
+ ))
277
+ }
278
+ {
279
+ cart?.fees?.length > 0 && cart?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0)).map((fee: any) => (
280
+ <OSTable key={fee?.id}>
281
+ <OSRow>
282
+ <OText>
283
+ {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
284
+ ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
285
+ </OText>
286
+ </OSRow>
287
+ <OText>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0)}</OText>
288
+ </OSTable>
289
+ ))
290
+ }
291
+ {
292
+ cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 3)?.map((offer: any) => (
293
+ <OSTable key={offer.id}>
294
+ <OSRow>
295
+ <OText>{offer.name}</OText>
296
+ {offer.rate_type === 1 && (
297
+ <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
298
+ )}
299
+ </OSRow>
300
+ <OText>
301
+ - {parsePrice(offer?.summary?.discount)}
302
+ </OText>
303
+ </OSTable>
304
+ ))
305
+ }
238
306
  {selectedOrderType === 1 && cart?.delivery_price > 0 && (
239
307
  <OSTable>
240
308
  <OText>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
241
309
  <OText>{parsePrice(cart?.delivery_price)}</OText>
242
310
  </OSTable>
243
311
  )}
312
+ {
313
+ cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any) => (
314
+ <OSTable key={offer.id}>
315
+ <OSRow>
316
+ <OText>{offer.name}</OText>
317
+ {offer.rate_type === 1 && (
318
+ <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
319
+ )}
320
+ </OSRow>
321
+ <OText>
322
+ - {parsePrice(offer?.summary?.discount)}
323
+ </OText>
324
+ </OSTable>
325
+ ))
326
+ }
244
327
  {cart?.driver_tip > 0 && (
245
328
  <OSTable>
246
329
  <OText>
247
330
  {t('DRIVER_TIP', 'Driver tip')}
248
331
  {cart?.driver_tip_rate > 0 &&
249
332
  parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
250
- !!!parseInt(configs?.driver_tip_use_custom?.value, 10) &&
333
+ !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
251
334
  (
252
- `(${parseNumber(cart?.driver_tip_rate)}%)`
335
+ `(${verifyDecimals(cart?.driver_tip_rate, parseNumber)}%)`
253
336
  )}
254
337
  </OText>
255
338
  <OText>{parsePrice(cart?.driver_tip)}</OText>
256
339
  </OSTable>
257
340
  )}
258
- {cart?.service_fee > 0 && (
259
- <OSTable>
260
- <OText>
261
- {t('SERVICE_FEE', 'Service Fee')}
262
- {`(${verifyDecimals(cart?.business?.service_fee, parseNumber)}%)`}
263
- </OText>
264
- <OText>{parsePrice(cart?.service_fee)}</OText>
265
- </OSTable>
266
- )}
267
341
  {!cart?.discount_type && isCouponEnabled && !isCartPending && orientationState?.orientation == PORTRAIT && (
268
342
  <OSTable>
269
343
  <OSCoupon>
@@ -279,7 +353,7 @@ const CartUI = (props: any) => {
279
353
  {t('TOTAL', 'Total')}
280
354
  </OText>
281
355
  <OText weight='bold' color={theme.colors.primary}>
282
- {cart?.total >= 1 && parsePrice(cart?.total)}
356
+ {parsePrice(cart?.total >= 0 ? cart?.total : 0)}
283
357
  </OText>
284
358
  </OSTable>
285
359
  </OSBill>
@@ -379,7 +453,7 @@ const CartUI = (props: any) => {
379
453
  <ProductForm
380
454
  productCart={curProduct}
381
455
  businessSlug={cart?.business?.slug}
382
- businessId={cart?.business_id}
456
+ businessId={curProduct?.business_id}
383
457
  categoryId={curProduct?.category_id}
384
458
  productId={curProduct?.id}
385
459
  onSave={handlerProductAction}
@@ -68,3 +68,9 @@ export const FloatingLayout = styled.View`
68
68
  padding-bottom: 20px;
69
69
  `)}
70
70
  `
71
+
72
+ export const OSRow = styled.View`
73
+ flex-direction: row;
74
+ overflow: hidden;
75
+ width: 80%;
76
+ `