ordering-ui-react-native 0.21.75 → 0.21.76-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 (164) hide show
  1. package/package.json +6 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessesListing/index.tsx +1 -1
  4. package/src/components/PaymentOptionsWebView/index.tsx +1 -0
  5. package/src/components/StripeMethodForm/index.tsx +6 -4
  6. package/src/components/VerifyPhone/styles.tsx +1 -2
  7. package/src/types/index.tsx +3 -1
  8. package/themes/business/index.tsx +4 -0
  9. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -6
  10. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
  11. package/themes/business/src/components/BusinessProductList/index.tsx +2 -1
  12. package/themes/business/src/components/Chat/index.tsx +3 -1
  13. package/themes/business/src/components/DriverMap/index.tsx +44 -27
  14. package/themes/business/src/components/GoogleMap/index.tsx +15 -8
  15. package/themes/business/src/components/Home/index.tsx +5 -1
  16. package/themes/business/src/components/LanguageSelector/index.tsx +2 -3
  17. package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
  18. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  19. package/themes/business/src/components/MapView/index.tsx +36 -17
  20. package/themes/business/src/components/NewOrderNotification/index.tsx +74 -24
  21. package/themes/business/src/components/OrderDetails/Business.tsx +65 -7
  22. package/themes/business/src/components/OrderDetails/Delivery.tsx +35 -20
  23. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +110 -40
  24. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +61 -35
  25. package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
  26. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
  27. package/themes/business/src/components/OrderSummary/index.tsx +219 -71
  28. package/themes/business/src/components/OrdersListManager/index.tsx +9 -1
  29. package/themes/business/src/components/OrdersOption/index.tsx +247 -159
  30. package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
  31. package/themes/business/src/components/PreviousMessages/index.tsx +12 -0
  32. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +25 -15
  33. package/themes/business/src/components/PreviousOrders/index.tsx +5 -3
  34. package/themes/business/src/components/PrinterEdition/index.tsx +363 -0
  35. package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
  36. package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
  37. package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
  38. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  39. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  40. package/themes/business/src/components/Sessions/index.tsx +187 -0
  41. package/themes/business/src/components/Sessions/styles.tsx +20 -0
  42. package/themes/business/src/components/StoresList/index.tsx +2 -2
  43. package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
  44. package/themes/business/src/components/UserProfileForm/index.tsx +85 -49
  45. package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
  46. package/themes/business/src/components/shared/OInput.tsx +2 -0
  47. package/themes/business/src/components/shared/OTextarea.tsx +8 -9
  48. package/themes/business/src/hooks/useLocation.tsx +5 -4
  49. package/themes/business/src/types/index.tsx +22 -4
  50. package/themes/business/src/utils/index.tsx +19 -1
  51. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  52. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  53. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  54. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  55. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  56. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  57. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  58. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  59. package/themes/original/index.tsx +13 -1
  60. package/themes/original/src/components/AddressDetails/index.tsx +20 -10
  61. package/themes/original/src/components/AddressForm/index.tsx +32 -17
  62. package/themes/original/src/components/AddressList/index.tsx +8 -7
  63. package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
  64. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  65. package/themes/original/src/components/BusinessBasicInformation/index.tsx +6 -9
  66. package/themes/original/src/components/BusinessController/index.tsx +12 -7
  67. package/themes/original/src/components/BusinessItemAccordion/index.tsx +13 -5
  68. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +2 -3
  69. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +1 -3
  70. package/themes/original/src/components/BusinessListingSearch/index.tsx +1 -2
  71. package/themes/original/src/components/BusinessPreorder/index.tsx +20 -15
  72. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +5 -5
  73. package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
  74. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  75. package/themes/original/src/components/BusinessProductsListing/index.tsx +20 -8
  76. package/themes/original/src/components/BusinessTypeFilter/index.tsx +9 -8
  77. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  78. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +1 -1
  79. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  80. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  81. package/themes/original/src/components/Cart/index.tsx +39 -12
  82. package/themes/original/src/components/CartContent/index.tsx +21 -8
  83. package/themes/original/src/components/Checkout/index.tsx +39 -27
  84. package/themes/original/src/components/CitiesControl/index.tsx +0 -3
  85. package/themes/original/src/components/CouponControl/index.tsx +1 -3
  86. package/themes/original/src/components/DriverTips/index.tsx +1 -3
  87. package/themes/original/src/components/Favorite/index.tsx +1 -5
  88. package/themes/original/src/components/FavoriteList/index.tsx +0 -1
  89. package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -7
  90. package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
  91. package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
  92. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +15 -17
  93. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +3 -7
  94. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +24 -32
  95. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +7 -9
  96. package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
  97. package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
  98. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +82 -0
  99. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
  100. package/themes/original/src/components/GoogleMap/index.tsx +39 -18
  101. package/themes/original/src/components/Help/index.tsx +2 -0
  102. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  103. package/themes/original/src/components/Home/index.tsx +2 -10
  104. package/themes/original/src/components/LoginForm/Otp/index.tsx +0 -3
  105. package/themes/original/src/components/LoginForm/index.tsx +4 -7
  106. package/themes/original/src/components/MessageListing/index.tsx +1 -0
  107. package/themes/original/src/components/Messages/index.tsx +8 -7
  108. package/themes/original/src/components/MomentOption/index.tsx +13 -2
  109. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
  110. package/themes/original/src/components/MultiCheckout/index.tsx +112 -90
  111. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -14
  112. package/themes/original/src/components/MyOrders/index.tsx +21 -26
  113. package/themes/original/src/components/NavBar/index.tsx +4 -2
  114. package/themes/original/src/components/NetworkError/index.tsx +0 -5
  115. package/themes/original/src/components/NotFoundSource/index.tsx +0 -3
  116. package/themes/original/src/components/OrderDetails/OrderEta.tsx +1 -1
  117. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +5 -7
  118. package/themes/original/src/components/OrderDetails/index.tsx +26 -9
  119. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  120. package/themes/original/src/components/OrderProgress/index.tsx +22 -3
  121. package/themes/original/src/components/OrderSummary/index.tsx +23 -5
  122. package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -6
  123. package/themes/original/src/components/OrdersOption/index.tsx +2 -4
  124. package/themes/original/src/components/PaymentOptionStripe/index.tsx +0 -5
  125. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  126. package/themes/original/src/components/PaymentOptions/index.tsx +46 -5
  127. package/themes/original/src/components/PlaceSpot/index.tsx +1 -3
  128. package/themes/original/src/components/PreviousOrders/index.tsx +1 -2
  129. package/themes/original/src/components/ProductForm/ActionButton.tsx +16 -19
  130. package/themes/original/src/components/ProductForm/index.tsx +108 -105
  131. package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -49
  132. package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
  133. package/themes/original/src/components/ProductOptionSubOption/index.tsx +8 -1
  134. package/themes/original/src/components/ProfessionalProfile/index.tsx +4 -5
  135. package/themes/original/src/components/Promotions/index.tsx +6 -9
  136. package/themes/original/src/components/ReviewDriver/index.tsx +1 -1
  137. package/themes/original/src/components/ReviewOrder/index.tsx +2 -2
  138. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  139. package/themes/original/src/components/ReviewTrigger/index.tsx +2 -2
  140. package/themes/original/src/components/ServiceForm/index.tsx +52 -54
  141. package/themes/original/src/components/Sessions/index.tsx +3 -3
  142. package/themes/original/src/components/SignupForm/index.tsx +86 -78
  143. package/themes/original/src/components/SingleOrderCard/index.tsx +1 -2
  144. package/themes/original/src/components/SingleProductCard/index.tsx +5 -6
  145. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  146. package/themes/original/src/components/StripeCardForm/index.tsx +0 -3
  147. package/themes/original/src/components/StripeCardsList/index.tsx +10 -35
  148. package/themes/original/src/components/StripeElementsForm/index.tsx +78 -59
  149. package/themes/original/src/components/StripeElementsForm/naked.tsx +48 -1
  150. package/themes/original/src/components/StripeRedirectForm/index.tsx +0 -3
  151. package/themes/original/src/components/TaxInformation/index.tsx +3 -2
  152. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +10 -7
  153. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +8 -3
  154. package/themes/original/src/components/UserFormDetails/index.tsx +98 -87
  155. package/themes/original/src/components/UserProfile/index.tsx +11 -2
  156. package/themes/original/src/components/Wallets/index.tsx +6 -3
  157. package/themes/original/src/components/WebsocketStatus/index.tsx +169 -0
  158. package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
  159. package/themes/original/src/components/shared/OAlert.tsx +2 -1
  160. package/themes/original/src/components/shared/OButton.tsx +5 -4
  161. package/themes/original/src/components/shared/OInput.tsx +4 -8
  162. package/themes/original/src/types/index.tsx +5 -1
  163. package/themes/original/src/utils/index.tsx +12 -1
  164. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -0,0 +1,220 @@
1
+ import { useConfig, useUtils, useLanguage} from 'ordering-components/native'
2
+
3
+ import { verifyDecimals, getProductPrice } from '../../utils';
4
+
5
+ /**
6
+ * Hook to create commands for star micronics printer using PassPRNT library
7
+ * @returns array of strings
8
+ */
9
+
10
+ export const usePrinterCommands = () => {
11
+ const [, t] = useLanguage()
12
+ const [{ configs }] = useConfig();
13
+ const [{ parsePrice, parseNumber, parseDate }] = useUtils();
14
+
15
+ const deliveryStatus: any = {
16
+ 1: t('DELIVERY', 'Delivery'),
17
+ 2: t('PICK_UP', 'Pick up'),
18
+ 3: t('EAT_IN', 'Eat In'),
19
+ 4: t('CURBSIDE', 'Curbside'),
20
+ 5: t('DRIVER_THRU', 'Driver thru'),
21
+ };
22
+
23
+ const walletName: any = {
24
+ cash: {
25
+ name: t('CASH_WALLET', 'Cash Wallet')
26
+ },
27
+ credit_point: {
28
+ name: t('POINTS_WALLET', 'Points Wallet')
29
+ }
30
+ }
31
+
32
+ const percentTip = (order: any) =>
33
+ parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
34
+ !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
35
+ verifyDecimals(order?.summary?.driver_tip, parseNumber);
36
+
37
+ const handlePaymethodsListString = (order: any) => {
38
+ const paymethodsList = order?.payment_events?.filter((item: any) => item.event === 'payment').map((paymethod: any) => {
39
+ return paymethod?.wallet_event
40
+ ? walletName[paymethod?.wallet_event?.wallet?.type]?.name
41
+ : paymethod?.paymethod?.gateway && paymethod?.paymethod?.gateway === 'cash' && order?.cash > 0
42
+ ? `${t(paymethod?.paymethod?.gateway?.toUpperCase(), paymethod?.paymethod?.name)} (${t('CASH_CHANGE_OF', 'Change of :amount:').replace(':amount:', parsePrice(order?.cash))})`
43
+ : paymethod?.paymethod?.gateway
44
+ ? t(paymethod?.paymethod?.gateway?.toUpperCase(), paymethod?.paymethod?.name)
45
+ : t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)
46
+ })
47
+ return paymethodsList.join(', ')
48
+ }
49
+
50
+ const paymethodsLength = (order: any) => order?.payment_events?.filter((item: any) => item.event === 'payment')?.length
51
+
52
+ const customerName = (order: any) => `${order?.customer?.name ?? ''} ${order?.customer?.middle_name ?? ''} ${order?.customer?.lastname ?? ''} ${order?.customer?.second_lastname ?? ''}`?.replace(' ', ' ')?.trim() ?? ''
53
+
54
+ const deliveryDate = (order: any) => {
55
+ const dateString = order?.delivery_datetime_utc ?? order?.delivery_datetime
56
+ const currentDate = new Date();
57
+ const receivedDate: any = new Date(order?.delivery_datetime);
58
+
59
+ const formattedDate = receivedDate <= currentDate
60
+ ? `${t('ASAP_ABBREVIATION', 'ASAP')}(${parseDate(dateString, { utc: !!order?.delivery_datetime_utc })})`
61
+ : parseDate(dateString, { utc: !!order?.delivery_datetime_utc })
62
+ return formattedDate
63
+ }
64
+
65
+ const generateProductsText = (order: any, { endLine }: any) => {
66
+ const list: any = []
67
+
68
+ if (order?.products.length) {
69
+ order?.products.map((product: any) => {
70
+ list.push(`${product?.quantity} ${product?.name} \t ${parsePrice(product.total ?? getProductPrice(product))}${endLine}`)
71
+
72
+ if (product?.ingredients?.length) {
73
+ list.push({ text: `\t ${t('INGREDIENTS', 'Ingredients')}:${endLine}`, props: { fontSize: 10 } })
74
+ product?.ingredients?.map((ingredient: any) => {
75
+ list.push({ text: `\t ${t('NO', 'No')} ${ingredient.name}${endLine}` , fontSize: 10 })
76
+ })
77
+ }
78
+
79
+ product.options?.map((option: any) => {
80
+ list.push({ text: `\t ${option.name}${endLine}`, props: { fontSize: 10 } })
81
+
82
+ option.suboptions?.map((suboption: any) => {
83
+ const { quantity, name, position, price } = suboption
84
+ const pos = position && position !== 'whole' ? `(${t(position.toUpperCase(), position)})` : ''
85
+ const string = name !== 'No'
86
+ ? pos
87
+ ? `${quantity} x ${name} ${pos} +${parsePrice(price)}`
88
+ : `${quantity} x ${name} +${parsePrice(price)}`
89
+ : 'No'
90
+
91
+ list.push({ text: `\t\t ${string}${endLine}`, props: { fontSize: 10 } })
92
+ })
93
+ })
94
+
95
+ if (product.comment) {
96
+ list.push({ text: `\t ${t('COMMENT', 'Comment')}${endLine}`, props: { fontSize: 10 } })
97
+ list.push({ text: `\t\t ${product.comment}${endLine}`, props: { fontSize: 10 } })
98
+ }
99
+
100
+ list.push('_separator_')
101
+ })
102
+ }
103
+
104
+ return list
105
+ }
106
+
107
+ const paymethodsList = (order: any, { endLine }: any) => {
108
+ const list: any = []
109
+
110
+ if (order?.payment_events?.length > 0) {
111
+ order?.payment_events.map((event: any) => {
112
+ const payment = event?.wallet_event
113
+ ? walletName[event?.wallet_event?.wallet?.type]?.name
114
+ : t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)
115
+
116
+ const amount = (event?.paymethod?.gateway === 'cash' && order?.cash)
117
+ ? parsePrice(order?.cash, { currency: order?.currency })
118
+ : `-${parsePrice(event?.amount, { currency: order?.currency })}`
119
+
120
+ list.push(`${payment} \t ${amount}${endLine}`)
121
+ })
122
+ }
123
+
124
+ return list
125
+ }
126
+
127
+ const replaceChars = (string: string) => {
128
+ const accents: any = {
129
+ 'á': 'a',
130
+ 'é': 'e',
131
+ 'í': 'i',
132
+ 'ó': 'o',
133
+ 'ú': 'u',
134
+ 'Á': 'A',
135
+ 'É': 'E',
136
+ 'Í': 'I',
137
+ 'Ó': 'O',
138
+ 'Ú': 'U',
139
+ 'ü': 'u',
140
+ 'Ü': 'U',
141
+ 'ñ': 'n',
142
+ 'Ñ': 'N',
143
+ "'": '',
144
+ "’": '',
145
+ "`": '',
146
+ };
147
+ return string.replace(/[áéíóúÁÉÍÓÚüÜñÑ'’`]/g, (match: any) => accents[match])
148
+ }
149
+
150
+ const generateCommands = (order: any, printMode: string = 'append') => {
151
+ let commands: any = [];
152
+
153
+ const isAppendMode = printMode === 'append'
154
+ const jumpLine = isAppendMode ? '\n' : ' '
155
+ const endLine = isAppendMode ? '\n' : ''
156
+
157
+ const textProps = { fontSize: 12 }
158
+
159
+ const appends: any = [
160
+ { text: `${t('ORDER_NO', 'Order No.')} ${order.id}${endLine}`, props: { fontSize: 16 } },
161
+ jumpLine,
162
+ `${order.orderStatus}${endLine}`,
163
+ { text: `${t('ORDER_TYPE', 'Order Type')}: ${deliveryStatus[order?.delivery_type]}${endLine}`, props: { fontSize: 14 } },
164
+ { text: `${t(`PAYMENT_METHOD${paymethodsLength(order) > 1 ? 'S' : ''}`, `Payment method${paymethodsLength(order) > 1 ? 's' : ''}`)}: ${handlePaymethodsListString(order)}${endLine}`, props: { fontSize: 14 } },
165
+ `${!!order?.delivery_option ? `${t('DELIVERY_PREFERENCE', 'Delivery Preference')}: ${t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}${endLine}` : ''}`,
166
+ `${t('DELIVERY_DATE', 'Delivery Date')}: ${deliveryDate(order)}${endLine}`,
167
+ '_separator_',
168
+ { text: `${t('CUSTOMER_DETAILS', 'Customer details')}${endLine}`, props: { fontSize: 14 } },
169
+ `${t('FULL_NAME', 'Full Name')}: ${customerName(order)}${endLine}`,
170
+ `${t('EMAIL', 'Email')}: ${order?.customer?.email}${endLine}`,
171
+ `${!!order?.customer?.cellphone ? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.cellphone}${endLine}` : ''}`,
172
+ `${!!order?.customer?.phone ? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.phone}${endLine}` : ''}`,
173
+ `${t('FULL_ADDRESS', 'Full Addres')}: ${order?.customer?.address}${endLine}`,
174
+ `${!!order?.customer?.internal_number ? `${t('INTERNAL_NUMBER', 'Internal Number')}: ${order?.customer?.internal_number}${endLine}` : ''}`,
175
+ `${!!order?.customer?.zipcode ? `${t('ZIPCODE', 'Zipcode')}: ${order?.customer?.zipcode}${endLine}` : ''}`,
176
+ '_separator_',
177
+ { text: `${t('BUSINESS_DETAILS', 'Business details')}${endLine}`, props: { fontSize: 14 } },
178
+ `${order?.business?.name}${endLine}`,
179
+ `${order?.business?.email}${endLine}`,
180
+ `${!!order?.business?.cellphone ? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.cellphone}${endLine}` : ''}`,
181
+ `${!!order?.business?.phone ? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.phone}${endLine}` : ''}`,
182
+ `${t('ADDRESS', 'Address')}: ${order?.business?.address}${endLine}`,
183
+ `${!!order?.business?.address_notes ? `${t('SPECIAL_ADDRESS', 'Special Address')}: ${order?.business?.address_notes}${endLine}` : ''}`,
184
+ '_separator_',
185
+ { text: `${t('ORDER_DETAILS', 'Order Details')}${endLine}`, props: { fontSize: 14 } },
186
+ `${!!order?.comment ? `${t('ORDER_COMMENT', 'Order Comment')}: ${order?.comment}${endLine}` : ''}`,
187
+ ...generateProductsText(order, { endLine }),
188
+ `${t('SUBTOTAL', 'Subtotal')} \t\t ${parsePrice(order.tax_type === 1 ? (order?.summary?.subtotal + order?.summary?.tax) ?? 0 : order?.summary?.subtotal ?? 0)}${endLine}`,
189
+ `${order?.summary?.discount > 0 ? `${order?.offer_type === 1 ? `${t('DISCOUNT', 'Discount')} (${verifyDecimals(order?.offer_rate, parsePrice)}%)${endLine}` : t('DISCOUNT', 'Discount')} \t\t ${parsePrice(order?.summary?.discount)}${endLine}` : ''}`,
190
+ `${order?.tax_type !== 1 ? `${t('TAX', 'Tax')} (${verifyDecimals(order?.summary?.tax_rate, parseNumber)}%) \t\t ${parsePrice(order?.summary?.tax ?? 0)}${endLine}` : ''}`,
191
+ `${order?.summary?.delivery_price > 0 && order.delivery_type !== 2 ? `${t('DELIVERY_FEE', 'Delivery Fee')} \t\t ${parsePrice(order?.summary?.delivery_price ?? 0)}${endLine}` : ''}`,
192
+ `${(order?.summary?.driver_tip > 0 || order?.driver_tip > 0) && order.delivery_type !== 2 ? `${t('DRIVER_TIP', 'Driver tip')} ${percentTip(order) ? `(${percentTip(order)}%)` : ''} \t\t ${parsePrice(order?.summary?.driver_tip ?? 0)}${endLine}` : ''}`,
193
+ `${order?.summary?.service_fee > 0 ? `${t('SERVICE_FEE', 'Service Fee')} (${verifyDecimals(order?.summary?.service_fee, parseNumber)}%) \t\t ${parsePrice(order?.summary?.service_fee ?? 0)}${endLine}` : ''}`,
194
+ '_separator_',
195
+ `${t('TOTAL', 'Total')} \t\t ${parsePrice(order?.summary?.total ?? 0)}${endLine}`,
196
+ jumpLine,
197
+ `${order?.payment_events?.length > 0 ? `${t('PAYMENTS', 'Payments')}${endLine}` : ''}`,
198
+ ...paymethodsList(order, { endLine }),
199
+ jumpLine,
200
+ jumpLine,
201
+ ]
202
+
203
+ commands = [
204
+ ...commands,
205
+ ...appends.map((append: any) => {
206
+ return append === '_separator_'
207
+ ? { [printMode]: `---------------------------------------${endLine}` }
208
+ : {
209
+ [printMode]: replaceChars(append?.text ?? append),
210
+ ...textProps,
211
+ ...append?.props
212
+ }
213
+ })
214
+ ]
215
+
216
+ return commands
217
+ }
218
+
219
+ return { generateCommands }
220
+ }
@@ -75,6 +75,40 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
75
75
  return array.join('')
76
76
  }
77
77
 
78
+ const getIngredients = (ingredients: any) => {
79
+ const _ingredients: any = (ingredients.length > 0 && ingredients.filter((i: any) => !i.selected)) || []
80
+ const texts: any = []
81
+
82
+ _ingredients.map((ingredient: any) => {
83
+ texts.push(`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${t('NO', 'No')} ${ingredient.name} <br/>`)
84
+ })
85
+
86
+ if (_ingredients.length) {
87
+ return `
88
+ <div style="font-size: 26px;width:100%">
89
+ <div style=width:90%;display:flex;justifyContent:center;margin:auto;">
90
+ <div>
91
+ ${t('INGREDIENTS', 'Ingredients')}:
92
+ </div>
93
+ </div>
94
+ ${texts.join('')}
95
+ </div>
96
+ `
97
+ }
98
+ return ''
99
+ }
100
+
101
+ const deliveryDate = (order: any) => {
102
+ const dateString = order?.delivery_datetime_utc ?? order?.delivery_datetime
103
+ const currentDate = new Date();
104
+ const receivedDate: any = new Date(order?.delivery_datetime);
105
+
106
+ const formattedDate = receivedDate <= currentDate
107
+ ? `${t('ASAP_ABBREVIATION', 'ASAP')}(${parseDate(dateString, { utc: !!order?.delivery_datetime_utc })})`
108
+ : parseDate(dateString, { utc: !!order?.delivery_datetime_utc })
109
+ return formattedDate
110
+ }
111
+
78
112
  const theme = useTheme();
79
113
  const percentTip =
80
114
  parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
@@ -97,7 +131,11 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
97
131
  const paymethodsList = order?.payment_events?.filter((item: any) => item.event === 'payment').map((paymethod: any) => {
98
132
  return paymethod?.wallet_event
99
133
  ? walletName[paymethod?.wallet_event?.wallet?.type]?.name
100
- : t(paymethod?.paymethod?.gateway?.toUpperCase(), paymethod?.paymethod?.name)
134
+ : paymethod?.paymethod?.gateway && paymethod?.paymethod?.gateway === 'cash' && order?.cash > 0
135
+ ? `${t(paymethod?.paymethod?.gateway?.toUpperCase(), paymethod?.paymethod?.name)} (${t('CASH_CHANGE_OF', 'Change of :amount:').replace(':amount:', parsePrice(order?.cash))})`
136
+ : paymethod?.paymethod?.gateway
137
+ ? t(paymethod?.paymethod?.gateway?.toUpperCase(), paymethod?.paymethod?.name)
138
+ : t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)
101
139
  })
102
140
  return paymethodsList.join(', ')
103
141
  }
@@ -110,15 +148,18 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
110
148
 
111
149
  ${orderStatus} </br>
112
150
 
113
- ${t('DELIVERY_TYPE', 'Delivery Type')}: ${deliveryStatus[order?.delivery_type]
114
- }
151
+ ${t('ORDER_TYPE', 'Order Type')}: ${deliveryStatus[order?.delivery_type]}
115
152
  </br>
116
- ${t('DELIVERY_DATE', 'Delivery Date')}: ${order?.delivery_datetime_utc
117
- ? parseDate(order?.delivery_datetime_utc)
118
- : parseDate(order?.delivery_datetime, { utc: false })
119
- }
153
+
154
+ ${!!order?.delivery_option
155
+ ? `${t('DELIVERY_PREFERENCE', 'Delivery Preference')}: ${t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)
156
+ } </br>`
157
+ : ''
158
+ }
159
+
160
+ ${t('DELIVERY_DATE', 'Delivery Date')}: ${deliveryDate(order)}
120
161
  </br>
121
- ${paymethodsLength > 1 ? 'PAYMENT_METHODS' : 'PAYMENT_METHOD'}: ${handlePaymethodsListString()}
162
+ ${t(paymethodsLength > 1 ? 'PAYMENT_METHODS' : 'PAYMENT_METHOD', paymethodsLength > 1 ? 'Payment methods' : 'Payment method')}: ${handlePaymethodsListString()}
122
163
  </p>
123
164
 
124
165
  <h1>${t('CUSTOMER_DETAILS', 'Customer details')}</h1>
@@ -126,8 +167,11 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
126
167
  </br>
127
168
  ${t('EMAIL', 'Email')}: ${order?.customer?.email}
128
169
  </br>
129
- ${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.cellphone}
130
- </br>
170
+ ${!!order?.customer?.cellphone
171
+ ? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.cellphone
172
+ } </br>`
173
+ : ''}
174
+
131
175
  ${!!order?.customer?.phone
132
176
  ? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.phone
133
177
  } </br>`
@@ -140,24 +184,29 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
140
184
  } </br>`
141
185
  : ''
142
186
  }
143
- ${t('ZIPCODE', 'Zipcode')}: ${order?.customer.zipcode}
144
- </p>
187
+ ${order?.customer.zipcode ?
188
+ `${t('ZIPCODE', 'Zipcode')}: ${order?.customer.zipcode}`
189
+ : ''}
190
+ </p>
145
191
 
146
192
  <h1>${t('BUSINESS_DETAILS', 'Business details')}</h1>
147
- <p style="font-size: 27px">
148
- ${order?.business?.name}
149
- </br>
193
+ <p style="font-size: 27px">
194
+ ${order?.business?.name}
195
+ </br>
150
196
  ${order?.business?.email}
151
- </br>
152
- ${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.cellphone}
153
- </br>
197
+ </br>
198
+ ${!!order?.business?.cellphone
199
+ ? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.cellphone
200
+ } </br>`
201
+ : ''
202
+ }
154
203
  ${!!order?.business?.phone
155
204
  ? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.phone
156
205
  } </br>`
157
206
  : ''
158
- }
207
+ }
159
208
 
160
- ${t('ADDRESS', 'Address')}: ${order?.business?.address}
209
+ ${t('ADDRESS', 'Address')}: ${order?.business?.address}
161
210
  </br>
162
211
  ${!!order?.business?.address_notes
163
212
  ? `${t('SPECIAL_ADDRESS', 'Special Address')}: ${order?.business?.address_notes
@@ -167,6 +216,8 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
167
216
  </p>
168
217
  <h1> ${t('ORDER_DETAILS', 'Order Details')}</h1>
169
218
 
219
+ ${order?.comment ? ('</br>'+ t('ORDER_COMMENT', 'Order Comment') + ':' + order?.comment) : ''}
220
+
170
221
  ${order?.products.length &&
171
222
  order?.products.map(
172
223
  (product: any, i: number) =>
@@ -181,6 +232,8 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
181
232
  </div>
182
233
  </div>
183
234
 
235
+ ${getIngredients(product?.ingredients)}
236
+
184
237
  <div style="font-size: 26px;width:100%">
185
238
  <div style="width:90%;display:flex;justifyContent:center;margin:auto;">
186
239
  ${getOptions(product.options, product.comment)}
@@ -241,18 +294,21 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
241
294
  : ''
242
295
  }
243
296
 
244
- ${order?.summary?.delivery_price > 0
245
- ? `<div style="font-size: 25px;"> ${t(
246
- 'DELIVERY_FEE',
247
- 'Delivery Fee',
248
- )}
249
- </div>`
250
- : ''
251
- }
297
+ ${order?.summary?.delivery_price > 0 && order.delivery_type !== 2 ?
298
+ ` <div style="display: flex">
299
+ <div style="font-size: 26px; width: 70%; display: flex; justify-content: flex-start">
300
+ ${t('DELIVERY_FEE', 'Delivery Fee')}
301
+ </div>
302
+
303
+ <div style="font-size: 26px; width: 30%; display: flex; justify-content: flex-end">
304
+ ${parsePrice(order?.summary?.delivery_price ?? 0)}
305
+ </div>` :
306
+ ''}
252
307
 
308
+ </div>
253
309
  <div style="display: flex">
254
310
 
255
- <div style="font-size: 26px; width: 70%; display: flex; justify-content: flex-start">
311
+ <div style="font-size: 26px; width: 70%; display: flex; justify-content: flex-start">
256
312
  ${t('DRIVER_TIP', 'Driver tip')}
257
313
  ${percentTip ? `(${percentTip}%)` : ''}
258
314
  </div>
@@ -263,22 +319,23 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
263
319
 
264
320
  </div>
265
321
 
266
- <div style="display: flex">
322
+ ${order?.summary?.service_fee > 0 && `
323
+ <div style="display: flex">
324
+ <div style="font-size: 26px; width: 70%; display: flex; justify-content: flex-start">
325
+ ${t('SERVICE_FEE', 'Service Fee')}
326
+ (${verifyDecimals(order?.summary?.service_fee, parseNumber)}%)
327
+ </div>
267
328
 
268
- <div style="font-size: 26px; width: 70%; display: flex; justify-content: flex-start">
269
- ${t('SERVICE_FEE', 'Service Fee')}
270
- (${verifyDecimals(order?.summary?.service_fee, parseNumber)}%)
271
- </div>
329
+ <div style="font-size: 26px; width: 30%; display: flex; justify-content: flex-end">
330
+ ${parsePrice(order?.summary?.service_fee ?? 0)}
331
+ </div>
272
332
 
273
- <div style="font-size: 26px; width: 30%; display: flex; justify-content: flex-end">
274
- ${parsePrice(order?.summary?.service_fee ?? 0)}
275
333
  </div>
276
-
277
- </div>
334
+ `}
278
335
 
279
336
  <div style="display: flex">
280
337
 
281
- <div style="font-size: 26px; width: 70%; display: flex; justify-content: flex-start; font-weight: bold">
338
+ <div style="font-size: 26px; width: 70%; display: flex; justify-content: flex-start; font-weight: bold">
282
339
  ${t('TOTAL', 'Total')}
283
340
  </div>
284
341
 
@@ -287,7 +344,36 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
287
344
  </div>
288
345
 
289
346
  </div>
290
-
347
+
348
+ ${order?.payment_events.length && `
349
+ <div style="font-size: 26px; width: 70%; display: flex; justify-content: flex-start; font-weight: bold">
350
+ ${t('PAYMENTS', 'Payments')}
351
+ </div>
352
+ `}
353
+
354
+ ${order?.payment_events.length &&
355
+ order?.payment_events.map(
356
+ (event: any, i: number) =>
357
+ `<div style="display: flex;flexDirection:row;flex-wrap:wrap">
358
+ <div style="display:flex;width:100%">
359
+ <div style="display:flex; justify-content: flex-start; font-size: 26px; width: 70%">
360
+ ${event?.wallet_event
361
+ ? walletName[event?.wallet_event?.wallet?.type]?.name
362
+ : event?.paymethod?.gateway && event?.paymethod?.gateway === 'cash' && order?.cash > 0
363
+ ? `${t(event?.paymethod?.gateway?.toUpperCase(), event?.paymethod?.name)} (${t('CASH_CHANGE_OF', 'Change of :amount:').replace(':amount:', parsePrice(order?.cash))})`
364
+ : event?.paymethod?.gateway
365
+ ? t(event?.paymethod?.gateway?.toUpperCase(), event?.paymethod?.name)
366
+ : t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)}
367
+ </div>
368
+
369
+ <div style="display:flex; justify-content: flex-end; font-size: 26px; width: 30%">
370
+ ${(event?.paymethod?.gateway === 'cash' && order?.cash)
371
+ ? parsePrice(order?.cash, { currency: order?.currency })
372
+ : `-${parsePrice(event?.amount, { currency: order?.currency })}`}
373
+ </div>
374
+ </div>
375
+ </div>`
376
+ )}
291
377
  </div>`;
292
378
  };
293
379
 
@@ -387,18 +473,23 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
387
473
  </OText>
388
474
 
389
475
  <OText style={{ marginBottom: 5 }}>
390
- {`${t('DELIVERY_TYPE', 'Delivery Type')}: ${deliveryStatus[order?.delivery_type]
476
+ {`${t('ORDER_TYPE', 'Order Type')}: ${deliveryStatus[order?.delivery_type]
391
477
  }`}
392
478
  </OText>
393
479
 
480
+ {order?.delivery_option && (
481
+ <OText size={13}>
482
+ <OText size={13} weight='bold'>{`${t('DELIVERY_PREFERENCE', 'Delivery Preference')}: `}</OText>
483
+ {t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}
484
+ </OText>
485
+ )}
486
+
394
487
  <OText style={{ marginBottom: 5 }}>
395
- {`${t('DELIVERY_DATE', 'Delivery Date')}: ${order?.delivery_datetime_utc
396
- ? parseDate(order?.delivery_datetime_utc)
397
- : parseDate(order?.delivery_datetime, { utc: false })
398
- }`}
488
+ {`${t('DELIVERY_DATE', 'Delivery Date')}: ${deliveryDate(order)}`}
399
489
  </OText>
400
490
 
401
491
  <OText style={{ marginBottom: 5 }}>{`${t(`${paymethodsLength > 1 ? 'PAYMENT_METHODS' : 'PAYMENT_METHOD'}`, `${paymethodsLength > 1 ? 'Payment methods' : 'Payment method'}`)}: ${handlePaymethodsListString()}`}</OText>
492
+
402
493
  </OrderHeader>
403
494
 
404
495
  <OrderCustomer>
@@ -430,16 +521,18 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
430
521
  {`${t('EMAIL', 'Email')}: ${order?.customer?.email}`}
431
522
  </OText>
432
523
 
433
- <OText
434
- style={{ marginBottom: 5 }}
435
- size={14}
436
- numberOfLines={2}
437
- adjustsFontSizeToFit
438
- ellipsizeMode="tail"
439
- color={theme.colors.textGray}>
440
- {`${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.cellphone
441
- }`}
442
- </OText>
524
+ {!!order?.customer?.cellphone && (
525
+ <OText
526
+ style={{ marginBottom: 5 }}
527
+ size={14}
528
+ numberOfLines={2}
529
+ adjustsFontSizeToFit
530
+ ellipsizeMode="tail"
531
+ color={theme.colors.textGray}>
532
+ {`${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.cellphone
533
+ }`}
534
+ </OText>
535
+ )}
443
536
 
444
537
  {!!order?.customer?.phone && (
445
538
  <OText
@@ -570,6 +663,12 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
570
663
  {t('ORDER_DETAILS', 'Order Details')}
571
664
  </OText>
572
665
 
666
+ {order?.comment && (
667
+ <OText style={{ marginBottom: 5 }}>
668
+ {`${t('ORDER_COMMENT', 'Order Comment')}: ${order?.comment}`}
669
+ </OText>
670
+ )}
671
+
573
672
  {order?.products.length &&
574
673
  order?.products.map((product: any, i: number) => (
575
674
  <View key={i}>
@@ -637,7 +736,7 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
637
736
  </Table>
638
737
  )}
639
738
 
640
- {order?.summary?.delivery_price > 0 && (
739
+ {order?.summary?.delivery_price > 0 && order.delivery_type !== 2 && (
641
740
  <Table>
642
741
  <OText style={{ marginBottom: 5 }}>
643
742
  {t('DELIVERY_FEE', 'Delivery Fee')}
@@ -647,22 +746,24 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
647
746
  </Table>
648
747
  )}
649
748
 
650
- <Table>
651
- <OText style={{ marginBottom: 5 }}>
652
- {t('DRIVER_TIP', 'Driver tip')}
653
- {order?.summary?.driver_tip > 0 &&
654
- parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
655
- !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
656
- `(${verifyDecimals(
657
- order?.summary?.driver_tip,
658
- parseNumber,
659
- )}%)`}
660
- </OText>
749
+ {(order?.summary?.driver_tip > 0 || order?.driver_tip > 0) && order.delivery_type !== 2 && (
750
+ <Table>
751
+ <OText style={{ marginBottom: 5 }}>
752
+ {t('DRIVER_TIP', 'Driver tip')}
753
+ {order?.summary?.driver_tip > 0 &&
754
+ parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
755
+ !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
756
+ `(${verifyDecimals(
757
+ order?.summary?.driver_tip,
758
+ parseNumber,
759
+ )}%)`}
760
+ </OText>
661
761
 
662
- <OText style={{ marginBottom: 5 }}>
663
- {parsePrice(order?.summary?.driver_tip ?? 0)}
664
- </OText>
665
- </Table>
762
+ <OText style={{ marginBottom: 5 }}>
763
+ {parsePrice(order?.summary?.driver_tip ?? 0)}
764
+ </OText>
765
+ </Table>
766
+ )}
666
767
 
667
768
  {order?.summary?.service_fee > 0 && (
668
769
  <Table>
@@ -688,6 +789,53 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
688
789
  </OText>
689
790
  </Table>
690
791
  </Total>
792
+
793
+ {order?.payment_events?.length > 0 && (
794
+ <View>
795
+ <OText size={14} color={theme.colors.textNormal}>{t('PAYMENTS', 'Payments')}</OText>
796
+ <View
797
+ style={{
798
+ width: '100%',
799
+ marginTop: 5
800
+ }}
801
+ >
802
+ {order?.payment_events?.map((event: any) => (
803
+ <View
804
+ key={event.id}
805
+ style={{
806
+ display: 'flex',
807
+ flexDirection: 'row',
808
+ justifyContent: 'space-between',
809
+ alignItems: 'center',
810
+ marginBottom: 10
811
+ }}
812
+ >
813
+ <View
814
+ style={{
815
+ display: 'flex',
816
+ flexDirection: 'column',
817
+ }}
818
+ >
819
+ <OText>
820
+ {event?.wallet_event
821
+ ? walletName[event?.wallet_event?.wallet?.type]?.name
822
+ : event?.paymethod?.gateway
823
+ ? t(event?.paymethod?.gateway?.toUpperCase(), event?.paymethod?.name)
824
+ : order?.paymethod?.id === event?.paymethod_id
825
+ ? t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)
826
+ : ''}
827
+ </OText>
828
+ </View>
829
+ <OText>
830
+ {(event?.paymethod?.gateway === 'cash' && order?.cash)
831
+ ? parsePrice(order?.cash, { currency: order?.currency })
832
+ : `-${parsePrice(event?.amount, { currency: order?.currency })}`}
833
+ </OText>
834
+ </View>
835
+ ))}
836
+ </View>
837
+ </View>
838
+ )}
691
839
  </OrderBill>
692
840
  </OrderContent>
693
841
  <View style={{ height: 40 }} />
@@ -846,6 +846,14 @@ export const OrdersListManager = (props: OrdersOptionParams) => {
846
846
  {
847
847
  key: 23,
848
848
  text: t('ORDER_DRIVER_ON_WAY', 'Driver on way')
849
+ },
850
+ {
851
+ key: 24,
852
+ text: t('ORDER_DRIVER_WAITING_FOR_ORDER', 'Driver waiting for order')
853
+ },
854
+ {
855
+ key: 25,
856
+ text: t('ORDER_ACCEPTED_BY_DRIVER_COMPANY', 'Accepted by driver company')
849
857
  }
850
858
  ],
851
859
  tabs: [
@@ -858,7 +866,7 @@ export const OrdersListManager = (props: OrdersOptionParams) => {
858
866
  {
859
867
  key: 1,
860
868
  text: t('IN_PROGRESS', 'In Progress'),
861
- tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23],
869
+ tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23, 24, 25],
862
870
  title: 'inProgress',
863
871
  },
864
872
  {