ordering-ui-react-native 0.14.41 → 0.14.42-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 (55) hide show
  1. package/package.json +2 -2
  2. package/src/components/BusinessItemAccordion/index.tsx +2 -2
  3. package/src/components/Cart/index.tsx +135 -42
  4. package/src/components/Cart/styles.tsx +7 -0
  5. package/src/components/Checkout/index.tsx +28 -166
  6. package/src/components/OrderDetails/index.tsx +102 -34
  7. package/src/components/OrderDetails/styles.tsx +7 -0
  8. package/src/components/OrderSummary/index.tsx +140 -37
  9. package/src/components/OrderSummary/styles.tsx +10 -2
  10. package/src/components/PaymentOptions/index.tsx +3 -1
  11. package/src/components/PaymentOptionsWebView/index.tsx +150 -0
  12. package/src/components/ProductForm/index.tsx +6 -6
  13. package/src/components/SingleProductCard/index.tsx +1 -1
  14. package/src/components/StripeElementsForm/index.tsx +28 -13
  15. package/src/components/TaxInformation/index.tsx +58 -26
  16. package/src/components/VerifyPhone/styles.tsx +1 -2
  17. package/src/components/shared/OIcon.tsx +4 -1
  18. package/src/index.tsx +2 -0
  19. package/src/navigators/HomeNavigator.tsx +6 -0
  20. package/src/pages/ProductDetails.tsx +55 -0
  21. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  22. package/themes/kiosk/src/components/Cart/index.tsx +14 -21
  23. package/themes/kiosk/src/components/CartItem/index.tsx +9 -7
  24. package/themes/kiosk/src/components/CustomerName/index.tsx +2 -1
  25. package/themes/kiosk/src/components/Intro/index.tsx +4 -4
  26. package/themes/kiosk/src/components/OptionCard/index.tsx +11 -6
  27. package/themes/kiosk/src/components/PaymentOptions/index.tsx +46 -44
  28. package/themes/original/src/components/BusinessController/index.tsx +3 -3
  29. package/themes/original/src/components/BusinessFeaturedController/index.tsx +2 -2
  30. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -9
  31. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -2
  32. package/themes/original/src/components/BusinessProductsListing/index.tsx +8 -4
  33. package/themes/original/src/components/BusinessesListing/index.tsx +129 -94
  34. package/themes/original/src/components/Cart/index.tsx +122 -24
  35. package/themes/original/src/components/Cart/styles.tsx +8 -1
  36. package/themes/original/src/components/Checkout/index.tsx +37 -3
  37. package/themes/original/src/components/Help/index.tsx +1 -1
  38. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -0
  39. package/themes/original/src/components/MessageListing/index.tsx +4 -2
  40. package/themes/original/src/components/MomentOption/index.tsx +150 -158
  41. package/themes/original/src/components/OrderDetails/index.tsx +114 -42
  42. package/themes/original/src/components/OrderDetails/styles.tsx +8 -1
  43. package/themes/original/src/components/OrderProgress/index.tsx +2 -1
  44. package/themes/original/src/components/OrderSummary/index.tsx +132 -23
  45. package/themes/original/src/components/OrderSummary/styles.tsx +7 -0
  46. package/themes/original/src/components/PaymentOptions/index.tsx +8 -2
  47. package/themes/original/src/components/ProductForm/index.tsx +63 -56
  48. package/themes/original/src/components/ProductOptionSubOption/index.tsx +54 -51
  49. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +8 -1
  50. package/themes/original/src/components/SingleProductCard/index.tsx +36 -19
  51. package/themes/original/src/components/SingleProductCard/styles.tsx +4 -0
  52. package/themes/original/src/components/StripeElementsForm/index.tsx +28 -13
  53. package/themes/original/src/components/TaxInformation/index.tsx +59 -27
  54. package/themes/original/src/components/UpsellingProducts/index.tsx +26 -18
  55. package/themes/original/src/types/index.tsx +2 -0
@@ -48,7 +48,7 @@ export const Help = (props: HelpParams) => {
48
48
 
49
49
  <LastOrdersContainer>
50
50
  <OText size={18} weight={600}>{t('LAST_ORDERS', 'Last Orders')}</OText>
51
- <LastOrders businessId={props.businessId} onRedirect={onRedirect} />
51
+ <LastOrders {...props} onRedirect={onRedirect} />
52
52
  </LastOrdersContainer>
53
53
  </>
54
54
  )
@@ -103,6 +103,7 @@ const HighestRatedBusinessesUI = (props: HighestRatedBusinessesParams) => {
103
103
  >
104
104
  <BusinessController
105
105
  business={business}
106
+ isBusinessOpen={business?.open}
106
107
  handleCustomClick={onBusinessClick}
107
108
  orderType={orderState?.options?.type}
108
109
  navigation={navigation}
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
- import { useLanguage, useOrder, ToastType, useToast, OrderList, OrderDetails as OrderDetailsConTableoller } from 'ordering-components/native'
2
+ import { useLanguage, useOrder, ToastType, useToast, OrderList, OrderDetails as OrderDetailsConTableoller, useBusiness } from 'ordering-components/native'
3
3
  import { useTheme } from 'styled-components/native';
4
4
  import { useFocusEffect } from '@react-navigation/native'
5
5
  import { OText, OModal } from '../shared'
@@ -214,6 +214,7 @@ const OrderMessageUI = (props: any) => {
214
214
  }
215
215
 
216
216
  export const OrderListing = (props: OrdersOptionParams) => {
217
+ const [businessState] = useBusiness();
217
218
  const OrderListingProps = {
218
219
  ...props,
219
220
  UIComponent: OrdersOptionUI,
@@ -224,6 +225,7 @@ export const OrderListing = (props: OrdersOptionParams) => {
224
225
  pageSize: 10,
225
226
  controlType: 'infinity'
226
227
  },
228
+ businessId: businessState?.business?.id,
227
229
  profileMessages: true,
228
230
  orderBy: 'last_direct_message_at',
229
231
  orderDirection: 'asc'
@@ -287,6 +289,7 @@ export const MessageListing = (props: MessageListingParams) => {
287
289
  setSelectedOrderId={setSelectedOrderId}
288
290
  setOrderList={setOrderListStatus}
289
291
  setOpenMessges={setOpenMessges}
292
+ franchiseId={props.franchiseId}
290
293
  />
291
294
  {openMessages && seletedOrder && (
292
295
  <OModal
@@ -304,4 +307,3 @@ export const MessageListing = (props: MessageListingParams) => {
304
307
  </MessageListingWrapper>
305
308
  )
306
309
  }
307
-
@@ -20,19 +20,11 @@ import NavBar from '../NavBar';
20
20
  import { OButton, OIcon, OText } from '../shared';
21
21
  import { Container } from '../../layouts/Container';
22
22
  import {
23
- HeaderTitle,
24
23
  WrapSelectOption,
25
- Days,
26
- Day,
27
- WrapHours,
28
- Hours,
29
- Hour,
30
24
  WrapDelveryTime,
31
25
  } from './styles';
32
26
  import CalendarPicker from 'react-native-calendar-picker';
33
- import { TouchableRipple } from 'react-native-paper';
34
27
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
35
- import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
36
28
  import SelectDropdown from 'react-native-select-dropdown';
37
29
 
38
30
  const MomentOptionUI = (props: MomentOptionParams) => {
@@ -179,165 +171,165 @@ const MomentOptionUI = (props: MomentOptionParams) => {
179
171
 
180
172
  useEffect(() => {
181
173
  if (datesList?.length > 0) {
182
- const _datesList = datesList.slice(0, Number(configs?.max_days_preorder?.value || 6))
183
- const minDateParts = _datesList[0].split('-')
184
- const maxDateParts = _datesList[_datesList.length - 1].split('-')
185
- const _minDate = new Date(minDateParts[0], minDateParts[1] - 1, minDateParts[2])
186
- const _maxDate = new Date(maxDateParts[0], maxDateParts[1] - 1, maxDateParts[2])
187
- setMinDate(_minDate)
188
- setMaxDate(_maxDate)
174
+ const _datesList = datesList.slice(0, Number(configs?.max_days_preorder?.value || 6))
175
+ const minDateParts = _datesList[0].split('-')
176
+ const maxDateParts = _datesList[_datesList.length - 1].split('-')
177
+ const _minDate = new Date(minDateParts[0], minDateParts[1] - 1, minDateParts[2])
178
+ const _maxDate = new Date(maxDateParts[0], maxDateParts[1] - 1, maxDateParts[2])
179
+ setMinDate(_minDate)
180
+ setMaxDate(_maxDate)
189
181
  }
190
182
  }, [datesList])
191
183
 
192
184
  return (
193
185
  <>
194
- <Container style={{ paddingLeft: 40, paddingRight: 40 }}>
195
- <View style={{ paddingBottom: 90 }}>
196
- <NavBar
197
- onActionLeft={() => goToBack()}
198
- btnStyle={{ paddingLeft: 0 }}
199
- paddingTop={0}
200
- style={{ paddingBottom: 0, flexDirection: 'column', alignItems: 'flex-start' }}
201
- title={t('QUESTION_WHEN_ORDER', 'When do you want your order?')}
202
- titleAlign={'center'}
203
- titleStyle={{ fontSize: 14, marginRight: 0, marginLeft: 0 }}
204
- titleWrapStyle={{ paddingHorizontal: 0 }}
205
- />
186
+ <Container style={{ paddingLeft: 40, paddingRight: 40 }}>
187
+ <View style={{ paddingBottom: 90 }}>
188
+ <NavBar
189
+ onActionLeft={() => goToBack()}
190
+ btnStyle={{ paddingLeft: 0 }}
191
+ paddingTop={0}
192
+ style={{ paddingBottom: 0, flexDirection: 'column', alignItems: 'flex-start' }}
193
+ title={t('QUESTION_WHEN_ORDER', 'When do you want your order?')}
194
+ titleAlign={'center'}
195
+ titleStyle={{ fontSize: 14, marginRight: 0, marginLeft: 0 }}
196
+ titleWrapStyle={{ paddingHorizontal: 0 }}
197
+ />
206
198
 
207
- <WrapSelectOption
208
- onPress={() => _handleAsap()}
209
- disabled={orderState.loading} style={{ alignItems: 'flex-start' }}>
210
- {optionSelected.isAsap ? (
211
- <OIcon
212
- src={theme.images.general.option_checked}
213
- width={16}
214
- style={{ marginEnd: 24 }}
215
- />
216
- ) : (
217
- <OIcon
218
- src={theme.images.general.option_normal}
219
- width={16}
220
- style={{ marginEnd: 24 }}
221
- />
222
- )}
223
- <OText color={optionSelected.isAsap ? theme.colors.textNormal : theme.colors.disabled}>{t('ASAP_ABBREVIATION', 'ASAP') + ` (${moment().format('dddd, MMM d, yyyy h:mm A')} + delivery time)`}</OText>
224
- </WrapSelectOption>
225
- <WrapSelectOption
226
- onPress={() => setOptionSelected({ isAsap: false, isSchedule: true })}
227
- disabled={orderState.loading}>
228
- {optionSelected.isSchedule ? (
229
- <OIcon
230
- src={theme.images.general.option_checked}
231
- width={16}
232
- style={{ marginEnd: 24 }}
233
- />
234
- ) : (
235
- <OIcon
236
- src={theme.images.general.option_normal}
237
- width={16}
238
- style={{ marginEnd: 24 }}
239
- />
240
- )}
241
- <OText color={optionSelected.isSchedule ? theme.colors.textNormal : theme.colors.disabled}>{t('SCHEDULE_FOR_LATER', 'Schedule for later')}</OText>
242
- </WrapSelectOption>
199
+ <WrapSelectOption
200
+ onPress={() => _handleAsap()}
201
+ disabled={orderState.loading} style={{ alignItems: 'flex-start' }}>
202
+ {optionSelected.isAsap ? (
203
+ <OIcon
204
+ src={theme.images.general.option_checked}
205
+ width={16}
206
+ style={{ marginEnd: 24 }}
207
+ />
208
+ ) : (
209
+ <OIcon
210
+ src={theme.images.general.option_normal}
211
+ width={16}
212
+ style={{ marginEnd: 24 }}
213
+ />
214
+ )}
215
+ <OText color={optionSelected.isAsap ? theme.colors.textNormal : theme.colors.disabled}>{t('ASAP_ABBREVIATION', 'ASAP') + ` (${moment().format('dddd, MMM D, yyyy h:mm A')} + delivery time)`}</OText>
216
+ </WrapSelectOption>
217
+ <WrapSelectOption
218
+ onPress={() => setOptionSelected({ isAsap: false, isSchedule: true })}
219
+ disabled={orderState.loading}>
220
+ {optionSelected.isSchedule ? (
221
+ <OIcon
222
+ src={theme.images.general.option_checked}
223
+ width={16}
224
+ style={{ marginEnd: 24 }}
225
+ />
226
+ ) : (
227
+ <OIcon
228
+ src={theme.images.general.option_normal}
229
+ width={16}
230
+ style={{ marginEnd: 24 }}
231
+ />
232
+ )}
233
+ <OText color={optionSelected.isSchedule ? theme.colors.textNormal : theme.colors.disabled}>{t('SCHEDULE_FOR_LATER', 'Schedule for later')}</OText>
234
+ </WrapSelectOption>
243
235
 
244
- {optionSelected.isSchedule && (
245
- <WrapDelveryTime>
246
- {datesList.length > 0 && (
247
- <View style={styles.dateWrap}>
248
- <View style={styles.dateLabel}>
249
- <OText size={12} color={theme.colors.textNormal}>{dateSelected}</OText>
236
+ {optionSelected.isSchedule && (
237
+ <WrapDelveryTime>
238
+ {datesList.length > 0 && (
239
+ <View style={styles.dateWrap}>
240
+ <View style={styles.dateLabel}>
241
+ <OText size={12} color={theme.colors.textNormal}>{dateSelected}</OText>
242
+ </View>
243
+ <SelectDropdown
244
+ defaultButtonText={timeSelected ? timeSelected : t('DELIVERY_TIME', 'Delivery Time')}
245
+ defaultValue={74}
246
+ data={hoursList}
247
+ disabled={orderState.loading}
248
+ onSelect={(selectedItem, index) => {
249
+ setSelectedTime(selectedItem.startTime)
250
+ }}
251
+ buttonTextAfterSelection={(selectedItem, index) => {
252
+ return `${selectedItem.startTime} - ${selectedItem.endTime}`
253
+ }}
254
+ rowTextForSelection={(item, index) => {
255
+ return `${item.startTime} - ${item.endTime}`
256
+ }}
257
+ buttonStyle={{
258
+ backgroundColor: theme.colors.white,
259
+ borderColor: theme.colors.border,
260
+ borderWidth: 1,
261
+ borderRadius: 8,
262
+ height: 40,
263
+ width: '100%',
264
+ flexDirection: 'column',
265
+ alignItems: 'flex-start',
266
+ marginBottom: 20
267
+ }}
268
+ buttonTextStyle={{
269
+ color: theme.colors.textNormal,
270
+ fontSize: 12,
271
+ paddingTop: 10
272
+ }}
273
+ dropdownStyle={{
274
+ borderRadius: 8,
275
+ borderColor: theme.colors.lightGray,
276
+ }}
277
+ rowStyle={{
278
+ borderBottomColor: theme.colors.white,
279
+ backgroundColor: theme.colors.white,
280
+ height: 40,
281
+ flexDirection: 'column',
282
+ alignItems: 'flex-start',
283
+ paddingTop: 8,
284
+ paddingLeft: 22
285
+ }}
286
+ rowTextStyle={{
287
+ color: theme.colors.textNormal,
288
+ fontSize: 14,
289
+ }}
290
+ />
291
+ <CalendarPicker
292
+ nextTitle=">"
293
+ width={width - 80}
294
+ previousTitle="<"
295
+ nextComponent={
296
+ <OIcon
297
+ src={theme.images.general.chevron_right}
298
+ color={theme.colors.disabled}
299
+ width={12}
300
+ style={{ marginHorizontal: 4 }}
301
+ />
302
+ }
303
+ previousComponent={
304
+ <OIcon
305
+ src={theme.images.general.chevron_left}
306
+ color={theme.colors.disabled}
307
+ width={12}
308
+ style={{ marginHorizontal: 4 }}
309
+ />
310
+ }
311
+ onDateChange={(date: moment.Moment) =>
312
+ handleChangeDate(date.format('YYYY-MM-DD'))
313
+ }
314
+ selectedDayColor={theme.colors.primaryContrast}
315
+ todayBackgroundColor={theme.colors.border}
316
+ dayLabelsWrapper={{ borderColor: theme.colors.clear }}
317
+ customDayHeaderStyles={customDayHeaderStylesCallback}
318
+ weekdays={weekDays}
319
+ selectedStartDate={momento}
320
+ minDate={minDate}
321
+ maxDate={maxDate}
322
+ />
250
323
  </View>
251
- <SelectDropdown
252
- defaultButtonText={timeSelected ? timeSelected : t('DELIVERY_TIME', 'Delivery Time')}
253
- defaultValue={74}
254
- data={hoursList}
255
- disabled={orderState.loading}
256
- onSelect={(selectedItem, index) => {
257
- setSelectedTime(selectedItem.startTime)
258
- }}
259
- buttonTextAfterSelection={(selectedItem, index) => {
260
- return `${selectedItem.startTime} - ${selectedItem.endTime}`
261
- }}
262
- rowTextForSelection={(item, index) => {
263
- return `${item.startTime} - ${item.endTime}`
264
- }}
265
- buttonStyle={{
266
- backgroundColor: theme.colors.white,
267
- borderColor: theme.colors.border,
268
- borderWidth: 1,
269
- borderRadius: 8,
270
- height: 40,
271
- width: '100%',
272
- flexDirection: 'column',
273
- alignItems: 'flex-start',
274
- marginBottom: 20
275
- }}
276
- buttonTextStyle={{
277
- color: theme.colors.textNormal,
278
- fontSize: 12,
279
- paddingTop: 10
280
- }}
281
- dropdownStyle={{
282
- borderRadius: 8,
283
- borderColor: theme.colors.lightGray,
284
- }}
285
- rowStyle={{
286
- borderBottomColor: theme.colors.white,
287
- backgroundColor: theme.colors.white,
288
- height: 40,
289
- flexDirection: 'column',
290
- alignItems: 'flex-start',
291
- paddingTop: 8,
292
- paddingLeft: 22
293
- }}
294
- rowTextStyle={{
295
- color: theme.colors.textNormal,
296
- fontSize: 14,
297
- }}
298
- />
299
- <CalendarPicker
300
- nextTitle=">"
301
- width={width - 80}
302
- previousTitle="<"
303
- nextComponent={
304
- <OIcon
305
- src={theme.images.general.chevron_right}
306
- color={theme.colors.disabled}
307
- width={12}
308
- style={{ marginHorizontal: 4 }}
309
- />
310
- }
311
- previousComponent={
312
- <OIcon
313
- src={theme.images.general.chevron_left}
314
- color={theme.colors.disabled}
315
- width={12}
316
- style={{ marginHorizontal: 4 }}
317
- />
318
- }
319
- onDateChange={(date: moment.Moment) =>
320
- handleChangeDate(date.format('YYYY-MM-DD'))
321
- }
322
- selectedDayColor={theme.colors.primaryContrast}
323
- todayBackgroundColor={theme.colors.border}
324
- dayLabelsWrapper={{ borderColor: theme.colors.clear }}
325
- customDayHeaderStyles={customDayHeaderStylesCallback}
326
- weekdays={weekDays}
327
- selectedStartDate={momento}
328
- minDate={minDate}
329
- maxDate={maxDate}
330
- />
331
- </View>
332
- )}
333
- </WrapDelveryTime>
334
- )}
324
+ )}
325
+ </WrapDelveryTime>
326
+ )}
327
+ </View>
328
+ <Spinner visible={momentState.isLoading === 1} />
329
+ </Container>
330
+ <View style={{ position: 'absolute', bottom: bottom, paddingBottom: 20, paddingHorizontal: 40, backgroundColor: 'white', width: '100%' }}>
331
+ <OButton onClick={handleChangeMoment} isDisabled={!selectedTime} text={t('CONTINUE', 'Continue')} style={{ borderRadius: 7.6, height: 44, shadowOpacity: 0 }} textStyle={{ color: 'white', fontSize: 14 }} showNextIcon />
335
332
  </View>
336
- <Spinner visible={momentState.isLoading === 1} />
337
- </Container>
338
- <View style={{position: 'absolute', bottom: bottom, paddingBottom: 20, paddingHorizontal: 40, backgroundColor: 'white', width: '100%'}}>
339
- <OButton onClick={handleChangeMoment} isDisabled={!selectedTime} text={t('CONTINUE', 'Continue')} style={{borderRadius: 7.6, height: 44, shadowOpacity: 0}} textStyle={{color: 'white', fontSize: 14}} showNextIcon />
340
- </View>
341
333
  </>
342
334
  );
343
335
  };
@@ -35,6 +35,7 @@ import {
35
35
  Icons,
36
36
  OrderDriver,
37
37
  Map,
38
+ Divider,
38
39
  } from './styles';
39
40
  import { OButton, OIcon, OModal, OText } from '../shared';
40
41
  import { ProductItemAccordion } from '../ProductItemAccordion';
@@ -100,7 +101,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
100
101
  business: false,
101
102
  driver: false,
102
103
  });
103
- const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null })
104
+ const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, tax: null, type: '' })
104
105
 
105
106
  const { order, businessData } = props.order;
106
107
 
@@ -349,6 +350,10 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
349
350
  }
350
351
  }
351
352
 
353
+ const getIncludedTaxesDiscounts = () => {
354
+ return order?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
355
+ }
356
+
352
357
  const handleClickOrderReview = (order: any) => {
353
358
  navigation.navigate(
354
359
  'ReviewOrder',
@@ -527,7 +532,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
527
532
  onPress={() => order?.business?.cellphone &&
528
533
  Linking.openURL(`tel:${order?.business?.cellphone}`)
529
534
  }
530
- style={{ paddingEnd: 5 }}>
535
+ style={{ paddingEnd: 5 }}
536
+ >
531
537
  <OIcon
532
538
  src={theme.images.general.phone}
533
539
  width={16}
@@ -730,10 +736,10 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
730
736
  <Table>
731
737
  <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('SUBTOTAL', 'Subtotal')}</OText>
732
738
  <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
733
- {parsePrice(((order?.summary?.subtotal || order?.subtotal) + getIncludedTaxes()))}
739
+ {parsePrice(((order?.summary?.subtotal ?? order?.subtotal) + getIncludedTaxes()))}
734
740
  </OText>
735
741
  </Table>
736
- {(order?.summary?.discount > 0 || order?.discount > 0) && (
742
+ {(order?.summary?.discount > 0 ?? order?.discount > 0) && order?.offers?.length === 0 && (
737
743
  <Table>
738
744
  {order?.offer_type === 1 ? (
739
745
  <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
@@ -751,24 +757,53 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
751
757
  </OText>
752
758
  </Table>
753
759
  )}
760
+ {
761
+ order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any) => (
762
+ <Table key={offer.id}>
763
+ <OSRow>
764
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
765
+ {offer.name}
766
+ {offer.rate_type === 1 && (
767
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
768
+ )}
769
+ </OText>
770
+ <TouchableOpacity style={{ marginLeft: 5 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_1' })}>
771
+ <AntIcon name='exclamationcircleo' size={18} color={theme.colors.primary} />
772
+ </TouchableOpacity>
773
+ </OSRow>
774
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>- {parsePrice(offer?.summary?.discount)}</OText>
775
+ </Table>
776
+ ))
777
+ }
778
+ <Divider />
779
+ {order?.summary?.subtotal_with_discount > 0 && order?.summary?.discount > 0 && order?.summary?.total >= 0 && (
780
+ <Table>
781
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
782
+ {order?.tax_type === 1 ? (
783
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice((order?.summary?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0))}</OText>
784
+ ) : (
785
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.subtotal_with_discount ?? 0)}</OText>
786
+ )}
787
+ </Table>
788
+ )}
754
789
  {
755
790
  order?.taxes?.length === 0 && order?.tax_type === 2 && (
756
791
  <Table>
757
- <OText size={12}>
792
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
758
793
  {t('TAX', 'Tax')} {`(${verifyDecimals(order?.tax, parseNumber)}%)`}
759
794
  </OText>
760
- <OText size={12}>{parsePrice(order?.summary?.tax || 0)}</OText>
795
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.tax || 0)}</OText>
761
796
  </Table>
762
797
  )
763
798
  }
764
799
  {
765
800
  order?.fees?.length === 0 && (
766
801
  <Table>
767
- <OText size={12}>
802
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
768
803
  {t('SERVICE_FEE', 'Service fee')}
769
804
  {`(${verifyDecimals(order?.service_fee, parseNumber)}%)`}
770
805
  </OText>
771
- <OText size={12}>{parsePrice(order?.summary?.service_fee || 0)}</OText>
806
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.service_fee || 0)}</OText>
772
807
  </Table>
773
808
  )
774
809
  }
@@ -776,15 +811,15 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
776
811
  order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0).map((tax: any) => (
777
812
  <Table key={tax.id}>
778
813
  <OSRow>
779
- <OText size={12} numberOfLines={1}>
814
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
780
815
  {tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
781
816
  {`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
782
817
  </OText>
783
- <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: tax })}>
818
+ <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: tax, type: 'tax' })}>
784
819
  <AntIcon name='exclamationcircleo' size={18} color={theme.colors.primary} />
785
820
  </TouchableOpacity>
786
821
  </OSRow>
787
- <OText size={12}>{parsePrice(tax?.summary?.tax || 0)}</OText>
822
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
788
823
  </Table>
789
824
  ))
790
825
  }
@@ -792,53 +827,84 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
792
827
  order?.fees?.length > 0 && order?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0))?.map((fee: any) => (
793
828
  <Table key={fee.id}>
794
829
  <OSRow>
795
- <OText size={12} numberOfLines={1}>
830
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
796
831
  {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
797
832
  ({parsePrice(fee?.fixed)} + {fee.percentage}%){' '}
798
833
  </OText>
799
- <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee })}>
834
+ <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })}>
800
835
  <AntIcon name='exclamationcircleo' size={18} color={theme.colors.primary} />
801
836
  </TouchableOpacity>
802
837
  </OSRow>
803
- <OText size={12}>{parsePrice(fee?.fixed + fee?.summary?.percentage || 0)}</OText>
838
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0)}</OText>
804
839
  </Table>
805
840
  ))
806
841
  }
807
- {(order?.summary?.delivery_price > 0 ||
808
- order?.deliveryFee > 0) && (
809
- <Table>
810
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
811
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
812
- {parsePrice(
813
- order?.summary?.delivery_price || order?.deliveryFee,
814
- )}
815
- </OText>
842
+ {
843
+ order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 3)?.map((offer: any) => (
844
+ <Table key={offer.id}>
845
+ <OSRow>
846
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
847
+ {offer.name}
848
+ {offer.rate_type === 1 && (
849
+ <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
850
+ )}
851
+ </OText>
852
+ <TouchableOpacity style={{ marginLeft: 5 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_3' })}>
853
+ <AntIcon name='exclamationcircleo' size={18} color={theme.colors.primary} />
854
+ </TouchableOpacity>
855
+ </OSRow>
856
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>- {parsePrice(offer?.summary?.discount)}</OText>
816
857
  </Table>
817
- )}
818
- <Table>
819
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
820
- {t('DRIVER_TIP', 'Driver tip')}
821
- {(order?.summary?.driver_tip > 0 || order?.driver_tip > 0) &&
822
- parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
823
- !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
824
- `(${verifyDecimals(order?.driver_tip, parseNumber)}%)`}
825
- </OText>
826
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
827
- {parsePrice(
828
- order?.summary?.driver_tip || order?.totalDriverTip,
829
- )}
830
- </OText>
831
- </Table>
858
+ ))
859
+ }
860
+ {order?.summary?.delivery_price > 0 && (
861
+ <Table>
862
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
863
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.delivery_price)}</OText>
864
+ </Table>
865
+ )}
866
+ {
867
+ order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any) => (
868
+ <Table key={offer.id}>
869
+ <OSRow>
870
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
871
+ {offer.name}
872
+ {offer.rate_type === 1 && (
873
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
874
+ )}
875
+ </OText>
876
+ <TouchableOpacity style={{ marginLeft: 5 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_2' })}>
877
+ <AntIcon name='exclamationcircleo' size={18} color={theme.colors.primary} />
878
+ </TouchableOpacity>
879
+ </OSRow>
880
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>- {parsePrice(offer?.summary?.discount)}</OText>
881
+ </Table>
882
+ ))
883
+ }
884
+ {order?.summary?.driver_tip > 0 && (
885
+ <Table>
886
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
887
+ {t('DRIVER_TIP', 'Driver tip')}
888
+ {order?.summary?.driver_tip > 0 &&
889
+ parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
890
+ !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
891
+ (
892
+ `(${verifyDecimals(order?.summary?.driver_tip, parseNumber)}%)`
893
+ )}
894
+ </OText>
895
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.driver_tip ?? order?.totalDriverTip)}</OText>
896
+ </Table>
897
+ )}
832
898
  <Total>
833
899
  <Table>
834
900
  <OText size={20} lineHeight={30} weight={'600'} color={theme.colors.textNormal}>{t('TOTAL', 'Total')}</OText>
835
901
  <OText size={20} lineHeight={30} weight={'600'} color={theme.colors.textNormal}>
836
- {parsePrice(order?.summary?.total || order?.total)}
902
+ {parsePrice(order?.summary?.total ?? order?.total)}
837
903
  </OText>
838
904
  </Table>
839
905
  </Total>
840
906
  {order?.payment_events?.length > 0 && (
841
- <View style={{marginTop: 10}}>
907
+ <View style={{ marginTop: 10 }}>
842
908
  <OText size={20} weight='bold' color={theme.colors.textNormal}>{t('PAYMENTS', 'Payments')}</OText>
843
909
  <View
844
910
  style={{
@@ -904,10 +970,16 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
904
970
  </OModal>
905
971
  <OModal
906
972
  open={openTaxModal.open}
907
- onClose={() => setOpenTaxModal({ open: false, data: null })}
973
+ onClose={() => setOpenTaxModal({ open: false, data: null, type: '' })}
908
974
  entireModal
975
+ title={`${openTaxModal.data?.name ||
976
+ t('INHERIT_FROM_BUSINESS', 'Inherit from business')} ${openTaxModal.data?.rate_type !== 2 ? `(${typeof openTaxModal.data?.rate === 'number' ? `${openTaxModal.data?.rate}%` : `${parsePrice(openTaxModal.data?.fixed ?? 0)} + ${openTaxModal.data?.percentage}%`})` : ''} `}
909
977
  >
910
- <TaxInformation data={openTaxModal.data} products={order?.products} />
978
+ <TaxInformation
979
+ type={openTaxModal.type}
980
+ data={openTaxModal.data}
981
+ products={order?.products}
982
+ />
911
983
  </OModal>
912
984
  </OrderDetailsContainer>
913
985
  );