ordering-ui-react-native 0.12.55 → 0.12.59

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 (202) hide show
  1. package/package.json +1 -1
  2. package/src/components/Cart/index.tsx +50 -16
  3. package/src/components/OrderDetails/index.tsx +8 -0
  4. package/src/components/OrderSummary/index.tsx +38 -3
  5. package/src/layouts/Container.tsx +1 -1
  6. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +8 -0
  7. package/themes/business/src/components/OrderDetails/styles.tsx +1 -0
  8. package/themes/business/src/layouts/Container.tsx +3 -1
  9. package/themes/doordash/src/components/Cart/index.tsx +37 -2
  10. package/themes/doordash/src/components/OrderDetails/index.tsx +8 -0
  11. package/themes/doordash/src/components/OrderSummary/index.tsx +37 -3
  12. package/themes/doordash/src/layouts/Container.tsx +1 -1
  13. package/themes/instacart/src/components/Cart/index.tsx +37 -3
  14. package/themes/instacart/src/components/OrderDetails/index.tsx +8 -0
  15. package/themes/instacart/src/components/OrderSummary/index.tsx +37 -4
  16. package/themes/instacart/src/layouts/Container.tsx +1 -1
  17. package/themes/kiosk/src/layouts/Container.tsx +2 -1
  18. package/themes/original/src/components/Cart/index.tsx +268 -234
  19. package/themes/original/src/components/OrderDetails/index.tsx +723 -715
  20. package/themes/original/src/components/OrderSummary/index.tsx +37 -3
  21. package/themes/original/src/layouts/Container.tsx +1 -1
  22. package/themes/single-business/src/components/Cart/index.tsx +127 -16
  23. package/themes/single-business/src/components/Cart/styles.tsx +39 -0
  24. package/themes/single-business/src/components/CartContent/index.tsx +56 -52
  25. package/themes/single-business/src/components/CartContent/styles.tsx +2 -16
  26. package/themes/single-business/src/components/OrderDetails/index.tsx +724 -708
  27. package/themes/single-business/src/components/OrderSummary/index.tsx +189 -154
  28. package/themes/single-business/src/layouts/Container.tsx +1 -1
  29. package/themes/uber-eats/src/components/Cart/index.tsx +37 -3
  30. package/themes/uber-eats/src/components/OrderDetails/index.tsx +8 -0
  31. package/themes/uber-eats/src/components/OrderSummary/index.tsx +40 -6
  32. package/themes/uber-eats/src/layouts/Container.tsx +1 -1
  33. package/themes/franchises/index.tsx +0 -111
  34. package/themes/franchises/src/components/ActiveOrders/index.tsx +0 -134
  35. package/themes/franchises/src/components/ActiveOrders/styles.tsx +0 -44
  36. package/themes/franchises/src/components/AddressDetails/index.tsx +0 -77
  37. package/themes/franchises/src/components/AddressDetails/styles.tsx +0 -21
  38. package/themes/franchises/src/components/AddressForm/index.tsx +0 -837
  39. package/themes/franchises/src/components/AddressForm/styles.tsx +0 -27
  40. package/themes/franchises/src/components/AddressList/index.tsx +0 -338
  41. package/themes/franchises/src/components/AddressList/styles.tsx +0 -20
  42. package/themes/franchises/src/components/AppleLogin/index.tsx +0 -149
  43. package/themes/franchises/src/components/AppleLogin/styles.tsx +0 -21
  44. package/themes/franchises/src/components/BottomWrapper/index.tsx +0 -29
  45. package/themes/franchises/src/components/BusinessBasicInformation/index.tsx +0 -310
  46. package/themes/franchises/src/components/BusinessBasicInformation/styles.tsx +0 -66
  47. package/themes/franchises/src/components/BusinessController/index.tsx +0 -184
  48. package/themes/franchises/src/components/BusinessController/styles.tsx +0 -64
  49. package/themes/franchises/src/components/BusinessFeaturedController/index.tsx +0 -189
  50. package/themes/franchises/src/components/BusinessFeaturedController/styles.tsx +0 -50
  51. package/themes/franchises/src/components/BusinessInformation/index.tsx +0 -202
  52. package/themes/franchises/src/components/BusinessInformation/styles.tsx +0 -39
  53. package/themes/franchises/src/components/BusinessItemAccordion/index.tsx +0 -125
  54. package/themes/franchises/src/components/BusinessItemAccordion/styles.tsx +0 -54
  55. package/themes/franchises/src/components/BusinessProductsCategories/index.tsx +0 -87
  56. package/themes/franchises/src/components/BusinessProductsCategories/styles.tsx +0 -8
  57. package/themes/franchises/src/components/BusinessProductsList/index.tsx +0 -199
  58. package/themes/franchises/src/components/BusinessProductsList/styles.tsx +0 -14
  59. package/themes/franchises/src/components/BusinessProductsListing/index.tsx +0 -292
  60. package/themes/franchises/src/components/BusinessProductsListing/styles.tsx +0 -30
  61. package/themes/franchises/src/components/BusinessReviews/index.tsx +0 -249
  62. package/themes/franchises/src/components/BusinessReviews/styles.tsx +0 -59
  63. package/themes/franchises/src/components/BusinessTypeFilter/index.tsx +0 -127
  64. package/themes/franchises/src/components/BusinessTypeFilter/styles.tsx +0 -40
  65. package/themes/franchises/src/components/BusinessesListing/index.tsx +0 -339
  66. package/themes/franchises/src/components/BusinessesListing/styles.tsx +0 -92
  67. package/themes/franchises/src/components/Cart/index.tsx +0 -298
  68. package/themes/franchises/src/components/Cart/styles.tsx +0 -28
  69. package/themes/franchises/src/components/CartContent/index.tsx +0 -60
  70. package/themes/franchises/src/components/CartContent/styles.tsx +0 -19
  71. package/themes/franchises/src/components/Checkout/index.tsx +0 -664
  72. package/themes/franchises/src/components/Checkout/styles.tsx +0 -89
  73. package/themes/franchises/src/components/CouponControl/index.tsx +0 -119
  74. package/themes/franchises/src/components/CouponControl/styles.tsx +0 -22
  75. package/themes/franchises/src/components/DriverTips/index.tsx +0 -167
  76. package/themes/franchises/src/components/DriverTips/styles.tsx +0 -63
  77. package/themes/franchises/src/components/FacebookLogin/index.tsx +0 -107
  78. package/themes/franchises/src/components/FacebookLogin/styles.tsx +0 -21
  79. package/themes/franchises/src/components/FloatingButton/index.tsx +0 -100
  80. package/themes/franchises/src/components/FloatingButton/styles.tsx +0 -26
  81. package/themes/franchises/src/components/ForgotPasswordForm/index.tsx +0 -156
  82. package/themes/franchises/src/components/ForgotPasswordForm/styles.tsx +0 -11
  83. package/themes/franchises/src/components/GPSButton/index.tsx +0 -84
  84. package/themes/franchises/src/components/GPSButton/styles.ts +0 -6
  85. package/themes/franchises/src/components/GoogleLogin/index.tsx +0 -122
  86. package/themes/franchises/src/components/GoogleLogin/styles.tsx +0 -23
  87. package/themes/franchises/src/components/GoogleMap/index.tsx +0 -229
  88. package/themes/franchises/src/components/Help/index.tsx +0 -56
  89. package/themes/franchises/src/components/Help/styles.tsx +0 -11
  90. package/themes/franchises/src/components/HelpAccountAndPayment/index.tsx +0 -68
  91. package/themes/franchises/src/components/HelpAccountAndPayment/styles.tsx +0 -6
  92. package/themes/franchises/src/components/HelpGuide/index.tsx +0 -67
  93. package/themes/franchises/src/components/HelpGuide/styles.tsx +0 -6
  94. package/themes/franchises/src/components/HelpOrder/index.tsx +0 -79
  95. package/themes/franchises/src/components/HelpOrder/styles.tsx +0 -6
  96. package/themes/franchises/src/components/Home/index.tsx +0 -102
  97. package/themes/franchises/src/components/Home/styles.tsx +0 -18
  98. package/themes/franchises/src/components/LanguageSelector/index.tsx +0 -98
  99. package/themes/franchises/src/components/LanguageSelector/styles.tsx +0 -7
  100. package/themes/franchises/src/components/LastOrder/index.tsx +0 -168
  101. package/themes/franchises/src/components/LastOrder/styles.tsx +0 -16
  102. package/themes/franchises/src/components/LastOrders/index.tsx +0 -104
  103. package/themes/franchises/src/components/LastOrders/styles.tsx +0 -17
  104. package/themes/franchises/src/components/LoginForm/index.tsx +0 -512
  105. package/themes/franchises/src/components/LoginForm/styles.tsx +0 -77
  106. package/themes/franchises/src/components/LogoutButton/index.tsx +0 -36
  107. package/themes/franchises/src/components/Messages/index.tsx +0 -359
  108. package/themes/franchises/src/components/Messages/styles.tsx +0 -20
  109. package/themes/franchises/src/components/MomentOption/index.tsx +0 -321
  110. package/themes/franchises/src/components/MomentOption/styles.tsx +0 -66
  111. package/themes/franchises/src/components/NavBar/index.tsx +0 -129
  112. package/themes/franchises/src/components/NotFoundSource/index.tsx +0 -50
  113. package/themes/franchises/src/components/NotFoundSource/styles.tsx +0 -16
  114. package/themes/franchises/src/components/Notifications/index.tsx +0 -120
  115. package/themes/franchises/src/components/Notifications/styles.ts +0 -21
  116. package/themes/franchises/src/components/OrderDetails/index.tsx +0 -820
  117. package/themes/franchises/src/components/OrderDetails/styles.tsx +0 -120
  118. package/themes/franchises/src/components/OrderSummary/index.tsx +0 -232
  119. package/themes/franchises/src/components/OrderSummary/styles.tsx +0 -41
  120. package/themes/franchises/src/components/OrderTypeSelector/index.tsx +0 -92
  121. package/themes/franchises/src/components/OrderTypeSelector/styles.tsx +0 -27
  122. package/themes/franchises/src/components/OrdersOption/index.tsx +0 -243
  123. package/themes/franchises/src/components/OrdersOption/styles.tsx +0 -5
  124. package/themes/franchises/src/components/PaymentOptionCash/index.tsx +0 -102
  125. package/themes/franchises/src/components/PaymentOptionCash/styles.tsx +0 -18
  126. package/themes/franchises/src/components/PaymentOptionStripe/index.tsx +0 -234
  127. package/themes/franchises/src/components/PaymentOptionStripe/styles.tsx +0 -71
  128. package/themes/franchises/src/components/PaymentOptions/index.tsx +0 -430
  129. package/themes/franchises/src/components/PaymentOptions/styles.tsx +0 -77
  130. package/themes/franchises/src/components/PhoneInputNumber/index.tsx +0 -127
  131. package/themes/franchises/src/components/PhoneInputNumber/styles.tsx +0 -3
  132. package/themes/franchises/src/components/PreviousOrders/index.tsx +0 -188
  133. package/themes/franchises/src/components/PreviousOrders/styles.tsx +0 -33
  134. package/themes/franchises/src/components/ProductForm/index.tsx +0 -695
  135. package/themes/franchises/src/components/ProductForm/styles.tsx +0 -78
  136. package/themes/franchises/src/components/ProductIngredient/index.tsx +0 -43
  137. package/themes/franchises/src/components/ProductIngredient/styles.tsx +0 -7
  138. package/themes/franchises/src/components/ProductItemAccordion/index.tsx +0 -276
  139. package/themes/franchises/src/components/ProductItemAccordion/styles.tsx +0 -57
  140. package/themes/franchises/src/components/ProductOption/index.tsx +0 -50
  141. package/themes/franchises/src/components/ProductOption/styles.tsx +0 -11
  142. package/themes/franchises/src/components/ProductOptionSubOption/index.tsx +0 -146
  143. package/themes/franchises/src/components/ProductOptionSubOption/styles.tsx +0 -32
  144. package/themes/franchises/src/components/ReviewDriver/index.tsx +0 -221
  145. package/themes/franchises/src/components/ReviewDriver/styles.tsx +0 -46
  146. package/themes/franchises/src/components/ReviewOrder/index.tsx +0 -325
  147. package/themes/franchises/src/components/ReviewOrder/styles.tsx +0 -46
  148. package/themes/franchises/src/components/ReviewProduct/index.tsx +0 -275
  149. package/themes/franchises/src/components/ReviewProduct/styles.tsx +0 -53
  150. package/themes/franchises/src/components/SearchBar/index.tsx +0 -139
  151. package/themes/franchises/src/components/SignupForm/index.tsx +0 -643
  152. package/themes/franchises/src/components/SignupForm/styles.tsx +0 -27
  153. package/themes/franchises/src/components/SingleProductCard/index.tsx +0 -124
  154. package/themes/franchises/src/components/SingleProductCard/styles.tsx +0 -23
  155. package/themes/franchises/src/components/StripeCardForm/index.tsx +0 -97
  156. package/themes/franchises/src/components/StripeCardForm/naked.tsx +0 -128
  157. package/themes/franchises/src/components/StripeCardForm/styles.tsx +0 -32
  158. package/themes/franchises/src/components/StripeCardsList/index.tsx +0 -182
  159. package/themes/franchises/src/components/StripeElementsForm/index.tsx +0 -204
  160. package/themes/franchises/src/components/StripeElementsForm/naked.tsx +0 -90
  161. package/themes/franchises/src/components/StripeElementsForm/styles.tsx +0 -13
  162. package/themes/franchises/src/components/StripeRedirectForm/index.tsx +0 -159
  163. package/themes/franchises/src/components/StripeRedirectForm/styles.tsx +0 -23
  164. package/themes/franchises/src/components/TagSelector/index.tsx +0 -94
  165. package/themes/franchises/src/components/TagSelector/styles.ts +0 -0
  166. package/themes/franchises/src/components/TaxInformation/index.tsx +0 -51
  167. package/themes/franchises/src/components/TaxInformation/styles.tsx +0 -9
  168. package/themes/franchises/src/components/UpsellingProducts/index.tsx +0 -222
  169. package/themes/franchises/src/components/UpsellingProducts/styles.tsx +0 -50
  170. package/themes/franchises/src/components/UserDetails/index.tsx +0 -134
  171. package/themes/franchises/src/components/UserDetails/styles.tsx +0 -26
  172. package/themes/franchises/src/components/UserFormDetails/index.tsx +0 -351
  173. package/themes/franchises/src/components/UserFormDetails/styles.tsx +0 -35
  174. package/themes/franchises/src/components/UserProfile/index.tsx +0 -179
  175. package/themes/franchises/src/components/UserProfile/styles.ts +0 -42
  176. package/themes/franchises/src/components/UserProfileForm/index.tsx +0 -253
  177. package/themes/franchises/src/components/UserProfileForm/styles.tsx +0 -29
  178. package/themes/franchises/src/components/VerifyPhone/index.tsx +0 -188
  179. package/themes/franchises/src/components/VerifyPhone/styles.tsx +0 -43
  180. package/themes/franchises/src/components/shared/OAlert.tsx +0 -55
  181. package/themes/franchises/src/components/shared/OBottomPopup.tsx +0 -73
  182. package/themes/franchises/src/components/shared/OBottomStickBar.tsx +0 -62
  183. package/themes/franchises/src/components/shared/OButton.tsx +0 -132
  184. package/themes/franchises/src/components/shared/ODropDown.tsx +0 -169
  185. package/themes/franchises/src/components/shared/OIcon.tsx +0 -53
  186. package/themes/franchises/src/components/shared/OIconButton.tsx +0 -127
  187. package/themes/franchises/src/components/shared/OIconText.tsx +0 -54
  188. package/themes/franchises/src/components/shared/OInput.tsx +0 -113
  189. package/themes/franchises/src/components/shared/OKeyButton.tsx +0 -35
  190. package/themes/franchises/src/components/shared/OModal.tsx +0 -172
  191. package/themes/franchises/src/components/shared/OText.tsx +0 -52
  192. package/themes/franchises/src/components/shared/OTextarea.tsx +0 -36
  193. package/themes/franchises/src/components/shared/OToast.tsx +0 -93
  194. package/themes/franchises/src/components/shared/OToggle.tsx +0 -158
  195. package/themes/franchises/src/components/shared/index.tsx +0 -29
  196. package/themes/franchises/src/config/constants.tsx +0 -57
  197. package/themes/franchises/src/layouts/Container.tsx +0 -23
  198. package/themes/franchises/src/layouts/SafeAreaContainer.tsx +0 -6
  199. package/themes/franchises/src/providers/AlertProvider.tsx +0 -43
  200. package/themes/franchises/src/providers/StoreUtil.tsx +0 -50
  201. package/themes/franchises/src/types/index.tsx +0 -445
  202. package/themes/franchises/src/utils/index.tsx +0 -222
@@ -1,25 +1,25 @@
1
1
  import React, { useState } from 'react';
2
- import { TouchableOpacity, View } from 'react-native'
2
+ import { ActivityIndicator, TouchableOpacity, View } from 'react-native'
3
3
  import {
4
- Cart,
5
- useOrder,
6
- useLanguage,
7
- useUtils,
8
- useConfig,
9
- useValidationFields,
4
+ Cart,
5
+ useOrder,
6
+ useLanguage,
7
+ useUtils,
8
+ useConfig,
9
+ useValidationFields,
10
10
  } from 'ordering-components/native';
11
11
 
12
12
  import {
13
- OSContainer,
14
- OSProductList,
15
- OSBill,
16
- OSTable,
13
+ OSContainer,
14
+ OSProductList,
15
+ OSBill,
16
+ OSTable,
17
17
  OSRow
18
18
  } from './styles';
19
19
 
20
20
  import { ProductItemAccordion } from '../ProductItemAccordion';
21
21
  import { CouponControl } from '../CouponControl';
22
- import { OModal, OText } from '../shared';
22
+ import { OInput, OModal, OText } from '../shared';
23
23
  import { ProductForm } from '../ProductForm';
24
24
  import { verifyDecimals } from '../../utils';
25
25
  import { useTheme } from 'styled-components/native';
@@ -27,42 +27,44 @@ import { TaxInformation } from '../TaxInformation';
27
27
  import AntIcon from 'react-native-vector-icons/AntDesign'
28
28
 
29
29
  const OrderSummaryUI = (props: any) => {
30
- const {
31
- cart,
32
- changeQuantity,
33
- getProductMax,
34
- offsetDisabled,
35
- removeProduct,
36
- isCartPending,
37
- isFromCheckout
38
- } = props;
30
+ const {
31
+ cart,
32
+ changeQuantity,
33
+ getProductMax,
34
+ offsetDisabled,
35
+ removeProduct,
36
+ isCartPending,
37
+ isFromCheckout,
38
+ handleChangeComment,
39
+ commentState
40
+ } = props;
39
41
 
40
42
  const theme = useTheme()
41
- const [, t] = useLanguage();
42
- const [{ configs }] = useConfig();
43
- const [orderState] = useOrder();
44
- const [{ parsePrice, parseNumber }] = useUtils();
45
- const [validationFields] = useValidationFields();
46
- const [openProduct, setModalIsOpen] = useState(false)
47
- const [curProduct, setCurProduct] = useState<any>(null)
43
+ const [, t] = useLanguage();
44
+ const [{ configs }] = useConfig();
45
+ const [orderState] = useOrder();
46
+ const [{ parsePrice, parseNumber }] = useUtils();
47
+ const [validationFields] = useValidationFields();
48
+ const [openProduct, setModalIsOpen] = useState(false)
49
+ const [curProduct, setCurProduct] = useState<any>(null)
48
50
  const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null })
49
51
 
50
- const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled;
52
+ const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled;
51
53
 
52
- const handleDeleteClick = (product: any) => {
53
- removeProduct(product, cart)
54
- }
54
+ const handleDeleteClick = (product: any) => {
55
+ removeProduct(product, cart)
56
+ }
55
57
 
56
- const handleEditProduct = (product: any) => {
57
- setCurProduct(product)
58
- setModalIsOpen(true)
59
- }
58
+ const handleEditProduct = (product: any) => {
59
+ setCurProduct(product)
60
+ setModalIsOpen(true)
61
+ }
60
62
 
61
- const handlerProductAction = (product: any) => {
62
- if (Object.keys(product).length) {
63
- setModalIsOpen(false)
64
- }
65
- }
63
+ const handlerProductAction = (product: any) => {
64
+ if (Object.keys(product).length) {
65
+ setModalIsOpen(false)
66
+ }
67
+ }
66
68
 
67
69
  const getIncludedTaxes = () => {
68
70
  if (cart?.taxes === null) {
@@ -74,46 +76,46 @@ const OrderSummaryUI = (props: any) => {
74
76
  }
75
77
  }
76
78
 
77
- return (
78
- <OSContainer>
79
- {cart?.products?.length > 0 && (
80
- <>
81
- <OSProductList>
82
- {cart?.products.map((product: any) => (
83
- <ProductItemAccordion
84
- key={product.code}
85
- product={product}
86
- isCartPending={isCartPending}
87
- isCartProduct
88
- changeQuantity={changeQuantity}
89
- getProductMax={getProductMax}
90
- offsetDisabled={offsetDisabled}
91
- onDeleteProduct={handleDeleteClick}
92
- onEditProduct={handleEditProduct}
93
- isFromCheckout={isFromCheckout}
94
- />
95
- ))}
96
- </OSProductList>
97
- {cart?.valid && (
98
- <OSBill>
99
- <OSTable>
100
- <OText size={12}>{t('SUBTOTAL', 'Subtotal')}</OText>
101
- <OText size={12}>{parsePrice(cart?.subtotal + getIncludedTaxes())}</OText>
102
- </OSTable>
103
- {cart?.discount > 0 && cart?.total >= 0 && (
104
- <OSTable>
105
- {cart?.discount_type === 1 ? (
106
- <OText size={12}>
107
- {t('DISCOUNT', 'Discount')}
108
- <OText size={12}>{`(${verifyDecimals(cart?.discount_rate, parsePrice)}%)`}</OText>
109
- </OText>
110
- ) : (
111
- <OText size={12}>{t('DISCOUNT', 'Discount')}</OText>
112
- )}
113
- <OText size={12}>- {parsePrice(cart?.discount || 0)}</OText>
114
- </OSTable>
115
- )}
116
- {
79
+ return (
80
+ <OSContainer>
81
+ {cart?.products?.length > 0 && (
82
+ <>
83
+ <OSProductList>
84
+ {cart?.products.map((product: any) => (
85
+ <ProductItemAccordion
86
+ key={product.code}
87
+ product={product}
88
+ isCartPending={isCartPending}
89
+ isCartProduct
90
+ changeQuantity={changeQuantity}
91
+ getProductMax={getProductMax}
92
+ offsetDisabled={offsetDisabled}
93
+ onDeleteProduct={handleDeleteClick}
94
+ onEditProduct={handleEditProduct}
95
+ isFromCheckout={isFromCheckout}
96
+ />
97
+ ))}
98
+ </OSProductList>
99
+ {cart?.valid && (
100
+ <OSBill>
101
+ <OSTable>
102
+ <OText size={12}>{t('SUBTOTAL', 'Subtotal')}</OText>
103
+ <OText size={12}>{parsePrice(cart?.subtotal + getIncludedTaxes())}</OText>
104
+ </OSTable>
105
+ {cart?.discount > 0 && cart?.total >= 0 && (
106
+ <OSTable>
107
+ {cart?.discount_type === 1 ? (
108
+ <OText size={12}>
109
+ {t('DISCOUNT', 'Discount')}
110
+ <OText size={12}>{`(${verifyDecimals(cart?.discount_rate, parsePrice)}%)`}</OText>
111
+ </OText>
112
+ ) : (
113
+ <OText size={12}>{t('DISCOUNT', 'Discount')}</OText>
114
+ )}
115
+ <OText size={12}>- {parsePrice(cart?.discount || 0)}</OText>
116
+ </OSTable>
117
+ )}
118
+ {
117
119
  cart?.taxes?.length > 0 && cart?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0).map((tax: any) => (
118
120
  <OSTable key={tax?.id}>
119
121
  <OSRow>
@@ -145,68 +147,101 @@ const OrderSummaryUI = (props: any) => {
145
147
  </OSTable>
146
148
  ))
147
149
  }
148
- {orderState?.options?.type === 1 && cart?.delivery_price > 0 && (
149
- <OSTable>
150
- <OText size={12}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
151
- <OText size={12}>{parsePrice(cart?.delivery_price)}</OText>
152
- </OSTable>
153
- )}
154
- {cart?.driver_tip > 0 && (
155
- <OSTable>
156
- <OText size={12}>
157
- {t('DRIVER_TIP', 'Driver tip')}
158
- {cart?.driver_tip_rate > 0 &&
159
- parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
160
- !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
161
- (
162
- `(${verifyDecimals(cart?.driver_tip_rate, parseNumber)}%)`
163
- )}
164
- </OText>
165
- <OText size={12}>{parsePrice(cart?.driver_tip)}</OText>
166
- </OSTable>
167
- )}
168
- {isCouponEnabled && !isCartPending && (
169
- <View>
170
- <View style={{ paddingVertical: 5 }}>
171
- <CouponControl
172
- businessId={cart.business_id}
173
- price={cart.total}
174
- />
175
- </View>
176
- </View>
177
- )}
178
- {cart?.total >= 1 && (
179
- <View style={{ marginTop: 15, borderTopWidth: 1, borderTopColor: '#d9d9d9' }}>
180
- <OSTable style={{ marginTop: 15 }}>
181
- <OText size={14} style={{ fontWeight: 'bold' }}>
182
- {t('TOTAL', 'Total')}
183
- </OText>
184
- <OText size={14} style={{ fontWeight: 'bold' }} >
185
- {parsePrice(cart?.total)}
186
- </OText>
187
- </OSTable>
188
- </View>
189
- )}
190
- </OSBill>
191
- )}
192
- <OModal
193
- open={openProduct}
194
- entireModal
195
- customClose
196
- onClose={() => setModalIsOpen(false)}
197
- >
198
- <ProductForm
199
- isCartProduct
200
- productCart={curProduct}
201
- businessSlug={cart?.business?.slug}
202
- businessId={cart?.business_id}
203
- categoryId={curProduct?.category_id}
204
- productId={curProduct?.id}
205
- onSave={handlerProductAction}
206
- onClose={() => setModalIsOpen(false)}
207
- isFromCheckout={isFromCheckout}
208
- />
209
- </OModal>
150
+ {orderState?.options?.type === 1 && cart?.delivery_price > 0 && (
151
+ <OSTable>
152
+ <OText size={12}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
153
+ <OText size={12}>{parsePrice(cart?.delivery_price)}</OText>
154
+ </OSTable>
155
+ )}
156
+ {cart?.driver_tip > 0 && (
157
+ <OSTable>
158
+ <OText size={12}>
159
+ {t('DRIVER_TIP', 'Driver tip')}
160
+ {cart?.driver_tip_rate > 0 &&
161
+ parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
162
+ !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
163
+ (
164
+ `(${verifyDecimals(cart?.driver_tip_rate, parseNumber)}%)`
165
+ )}
166
+ </OText>
167
+ <OText size={12}>{parsePrice(cart?.driver_tip)}</OText>
168
+ </OSTable>
169
+ )}
170
+ {isCouponEnabled && !isCartPending && (
171
+ <View>
172
+ <View style={{ paddingVertical: 5 }}>
173
+ <CouponControl
174
+ businessId={cart.business_id}
175
+ price={cart.total}
176
+ />
177
+ </View>
178
+ </View>
179
+ )}
180
+ {cart?.total >= 1 && (
181
+ <View style={{ marginTop: 15, borderTopWidth: 1, borderTopColor: '#d9d9d9' }}>
182
+ <OSTable style={{ marginTop: 15 }}>
183
+ <OText size={14} style={{ fontWeight: 'bold' }}>
184
+ {t('TOTAL', 'Total')}
185
+ </OText>
186
+ <OText size={14} style={{ fontWeight: 'bold' }} >
187
+ {parsePrice(cart?.total)}
188
+ </OText>
189
+ </OSTable>
190
+ </View>
191
+ )}
192
+ {cart?.status !== 2 && (
193
+ <OSTable>
194
+ <View style={{ width: '100%', marginTop: 20 }}>
195
+ <OText size={12}>{t('COMMENTS', 'Comments')}</OText>
196
+ <View style={{ flex: 1, width: '100%' }}>
197
+ <OInput
198
+ value={cart?.comment}
199
+ placeholder={t('SPECIAL_COMMENTS', 'Special Comments')}
200
+ onChange={(value: string) => handleChangeComment(value)}
201
+ style={{
202
+ alignItems: 'flex-start',
203
+ width: '100%',
204
+ height: 100,
205
+ borderColor: theme.colors.textSecondary,
206
+ paddingRight: 50,
207
+ marginTop: 10
208
+ }}
209
+ multiline
210
+ inputStyle={{ color: theme.colors.textPrimary, fontSize: 12 }}
211
+ />
212
+ {commentState?.loading && (
213
+ <View style={{ position: 'absolute', right: 20 }}>
214
+ <ActivityIndicator
215
+ size='large'
216
+ style={{ height: 100 }}
217
+ color={theme.colors.primary}
218
+ />
219
+ </View>
220
+ )}
221
+ </View>
222
+ </View>
223
+ </OSTable>
224
+ )}
225
+ </OSBill>
226
+ )}
227
+ <OModal
228
+ open={openProduct}
229
+ entireModal
230
+ customClose
231
+ onClose={() => setModalIsOpen(false)}
232
+ >
233
+ <ProductForm
234
+ isCartProduct
235
+ productCart={curProduct}
236
+ businessSlug={cart?.business?.slug}
237
+ businessId={cart?.business_id}
238
+ categoryId={curProduct?.category_id}
239
+ productId={curProduct?.id}
240
+ onSave={handlerProductAction}
241
+ onClose={() => setModalIsOpen(false)}
242
+ isFromCheckout={isFromCheckout}
243
+ />
244
+ </OModal>
210
245
  <OModal
211
246
  open={openTaxModal.open}
212
247
  onClose={() => setOpenTaxModal({ open: false, data: null })}
@@ -214,19 +249,19 @@ const OrderSummaryUI = (props: any) => {
214
249
  >
215
250
  <TaxInformation data={openTaxModal.data} products={cart.products} />
216
251
  </OModal>
217
- </>
218
- )}
219
- </OSContainer>
220
- )
252
+ </>
253
+ )}
254
+ </OSContainer>
255
+ )
221
256
  }
222
257
 
223
258
  export const OrderSummary = (props: any) => {
224
- const orderSummaryProps = {
225
- ...props,
226
- UIComponent: OrderSummaryUI
227
- }
259
+ const orderSummaryProps = {
260
+ ...props,
261
+ UIComponent: OrderSummaryUI
262
+ }
228
263
 
229
- return (
230
- <Cart {...orderSummaryProps} />
231
- )
264
+ return (
265
+ <Cart {...orderSummaryProps} />
266
+ )
232
267
  }
@@ -15,7 +15,7 @@ const SafeAreaStyled = styled.SafeAreaView`
15
15
  export const Container = (props: any) => {
16
16
  return (
17
17
  <SafeAreaStyled>
18
- <ContainerStyled keyboardShouldPersistTaps='handled' {...props} style={{...props.style}}>
18
+ <ContainerStyled {...props} keyboardShouldPersistTaps='handled' ref={props?.forwardRef} style={{...props.style}}>
19
19
  {props.children}
20
20
  </ContainerStyled>
21
21
  </SafeAreaStyled>
@@ -16,14 +16,14 @@ import { ProductItemAccordion } from '../ProductItemAccordion';
16
16
  import { BusinessItemAccordion } from '../BusinessItemAccordion';
17
17
  import { CouponControl } from '../CouponControl';
18
18
 
19
- import { OButton, OModal, OText } from '../shared';
19
+ import { OButton, OInput, OModal, OText } from '../shared';
20
20
  import { ProductForm } from '../ProductForm';
21
21
  import { UpsellingProducts } from '../UpsellingProducts';
22
22
  import { verifyDecimals } from '../../utils';
23
23
  import { useTheme } from 'styled-components/native';
24
24
  import AntIcon from 'react-native-vector-icons/AntDesign'
25
25
  import { TaxInformation } from '../TaxInformation';
26
- import { TouchableOpacity } from 'react-native';
26
+ import { ActivityIndicator, TouchableOpacity, View } from 'react-native';
27
27
 
28
28
  const CartUI = (props: any) => {
29
29
  const {
@@ -36,7 +36,9 @@ const CartUI = (props: any) => {
36
36
  handleCartOpen,
37
37
  setIsCartsLoading,
38
38
  isForceOpenCart,
39
- isBusinessCart
39
+ isBusinessCart,
40
+ handleChangeComment,
41
+ commentState
40
42
  } = props
41
43
 
42
44
  const theme = useTheme()
@@ -235,6 +237,38 @@ const CartUI = (props: any) => {
235
237
  </OText>
236
238
  </OSTable>
237
239
  </OSTotal>
240
+ {cart?.status !== 2 && (
241
+ <OSTable>
242
+ <View style={{ width: '100%', marginTop: 20 }}>
243
+ <OText>{t('COMMENTS', 'Comments')}</OText>
244
+ <View style={{ flex: 1, width: '100%' }}>
245
+ <OInput
246
+ value={cart?.comment}
247
+ placeholder={t('SPECIAL_COMMENTS', 'Special Comments')}
248
+ onChange={(value: string) => handleChangeComment(value)}
249
+ style={{
250
+ alignItems: 'flex-start',
251
+ width: '100%',
252
+ height: 100,
253
+ borderColor: theme.colors.textSecondary,
254
+ paddingRight: 50,
255
+ marginTop: 10
256
+ }}
257
+ multiline
258
+ />
259
+ {commentState?.loading && (
260
+ <View style={{ position: 'absolute', right: 20 }}>
261
+ <ActivityIndicator
262
+ size='large'
263
+ style={{ height: 100 }}
264
+ color={theme.colors.primary}
265
+ />
266
+ </View>
267
+ )}
268
+ </View>
269
+ </View>
270
+ </OSTable>
271
+ )}
238
272
  </OSBill>
239
273
  )}
240
274
  </CartContent>
@@ -410,6 +410,14 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
410
410
  <OText style={styles.textBold} color={theme.colors.primary}>{parsePrice(order?.summary?.total || order?.total)}</OText>
411
411
  </Table>
412
412
  </Total>
413
+ {order?.comment && (
414
+ <Table>
415
+ <OText style={{ flex: 1 }}>{t('COMMENT', 'Comment')}</OText>
416
+ <OText style={{ maxWidth: '70%' }}>
417
+ {order?.comment}
418
+ </OText>
419
+ </Table>
420
+ )}
413
421
  </OrderBill>
414
422
  <OrderCustomer>
415
423
  <OText size={18} mBottom={5} style={{ textAlign: 'left' }}>{t('CUSTOMER', 'Customer')}</OText>
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react';
2
- import { TouchableOpacity, View } from 'react-native'
2
+ import { ActivityIndicator, TouchableOpacity, View } from 'react-native'
3
3
  import {
4
4
  Cart,
5
5
  useOrder,
@@ -19,7 +19,7 @@ import {
19
19
 
20
20
  import { ProductItemAccordion } from '../ProductItemAccordion';
21
21
  import { CouponControl } from '../CouponControl';
22
- import { OModal, OText } from '../shared';
22
+ import { OInput, OModal, OText } from '../shared';
23
23
  import { ProductForm } from '../ProductForm';
24
24
  import { verifyDecimals } from '../../utils';
25
25
  import { useTheme } from 'styled-components/native';
@@ -34,7 +34,9 @@ const OrderSummaryUI = (props: any) => {
34
34
  offsetDisabled,
35
35
  removeProduct,
36
36
  isCartPending,
37
- isFromCheckout
37
+ isFromCheckout,
38
+ handleChangeComment,
39
+ commentState
38
40
  } = props;
39
41
 
40
42
  const theme = useTheme();
@@ -158,9 +160,9 @@ const OrderSummaryUI = (props: any) => {
158
160
  {cart?.driver_tip_rate > 0 &&
159
161
  parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
160
162
  !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
161
- (
162
- `(${verifyDecimals(cart?.driver_tip_rate, parseNumber)}%)`
163
- )}
163
+ (
164
+ `(${verifyDecimals(cart?.driver_tip_rate, parseNumber)}%)`
165
+ )}
164
166
  </OText>
165
167
  <OText size={16}>{parsePrice(cart?.driver_tip)}</OText>
166
168
  </OSTable>
@@ -187,6 +189,38 @@ const OrderSummaryUI = (props: any) => {
187
189
  </OSTable>
188
190
  </View>
189
191
  )}
192
+ {cart?.status !== 2 && (
193
+ <OSTable>
194
+ <View style={{ width: '100%', marginTop: 20 }}>
195
+ <OText>{t('COMMENTS', 'Comments')}</OText>
196
+ <View style={{ flex: 1, width: '100%' }}>
197
+ <OInput
198
+ value={cart?.comment}
199
+ placeholder={t('SPECIAL_COMMENTS', 'Special Comments')}
200
+ onChange={(value: string) => handleChangeComment(value)}
201
+ style={{
202
+ alignItems: 'flex-start',
203
+ width: '100%',
204
+ height: 100,
205
+ borderColor: theme.colors.textSecondary,
206
+ paddingRight: 50,
207
+ marginTop: 10
208
+ }}
209
+ multiline
210
+ />
211
+ {commentState?.loading && (
212
+ <View style={{ position: 'absolute', right: 20 }}>
213
+ <ActivityIndicator
214
+ size='large'
215
+ style={{ height: 100 }}
216
+ color={theme.colors.primary}
217
+ />
218
+ </View>
219
+ )}
220
+ </View>
221
+ </View>
222
+ </OSTable>
223
+ )}
190
224
  </OSBill>
191
225
  )}
192
226
  <OModal
@@ -18,7 +18,7 @@ const ContentView = styled.View`
18
18
  export const Container = (props: any) => {
19
19
  return (
20
20
  <SafeAreaStyled>
21
- <ContainerStyled keyboardShouldPersistTaps='handled'>
21
+ <ContainerStyled ref={props?.forwardRef} keyboardShouldPersistTaps='handled'>
22
22
  <ContentView>
23
23
  {props.children}
24
24
  </ContentView>