ordering-ui-react-native 0.14.23 → 0.14.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +2 -1
- package/themes/original/src/components/Cart/index.tsx +27 -9
- package/themes/original/src/components/CartContent/index.tsx +1 -0
- package/themes/original/src/components/OrderSummary/index.tsx +9 -47
package/package.json
CHANGED
|
@@ -17,6 +17,7 @@ export const BusinessItemAccordion = (props: any) => {
|
|
|
17
17
|
const {
|
|
18
18
|
cart,
|
|
19
19
|
moment,
|
|
20
|
+
singleBusiness,
|
|
20
21
|
handleClearProducts
|
|
21
22
|
} = props
|
|
22
23
|
|
|
@@ -29,7 +30,7 @@ export const BusinessItemAccordion = (props: any) => {
|
|
|
29
30
|
const isClosed = !cart?.valid_schedule
|
|
30
31
|
const isProducts = cart?.products?.length
|
|
31
32
|
|
|
32
|
-
const [isActive, setActiveState] = useState(
|
|
33
|
+
const [isActive, setActiveState] = useState(!!singleBusiness)
|
|
33
34
|
|
|
34
35
|
useEffect(() => {
|
|
35
36
|
const cartsArray = Object.values(orderState?.carts)
|
|
@@ -113,6 +113,15 @@ const CartUI = (props: any) => {
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
const walletName: any = {
|
|
117
|
+
cash: {
|
|
118
|
+
name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet'),
|
|
119
|
+
},
|
|
120
|
+
credit_point: {
|
|
121
|
+
name: t('PAY_WITH_CREDITS_POINTS_WALLET', 'Pay with Credit Points Wallet'),
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
116
125
|
return (
|
|
117
126
|
<CContainer>
|
|
118
127
|
{openUpselling && (
|
|
@@ -130,6 +139,7 @@ const CartUI = (props: any) => {
|
|
|
130
139
|
)}
|
|
131
140
|
<BusinessItemAccordion
|
|
132
141
|
cart={cart}
|
|
142
|
+
singleBusiness={props.singleBusiness}
|
|
133
143
|
moment={momentFormatted}
|
|
134
144
|
handleClearProducts={handleClearProducts}
|
|
135
145
|
handleCartOpen={handleCartOpen}
|
|
@@ -191,7 +201,7 @@ const CartUI = (props: any) => {
|
|
|
191
201
|
cart?.fees?.length > 0 && cart?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0)).map((fee: any) => (
|
|
192
202
|
<OSTable key={fee?.id}>
|
|
193
203
|
<OSRow>
|
|
194
|
-
<OText numberOfLines={1}>
|
|
204
|
+
<OText numberOfLines={1} size={12} lineHeight={18}>
|
|
195
205
|
{fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
|
|
196
206
|
({parsePrice(fee?.fixed)} + {fee?.percentage}%){' '}
|
|
197
207
|
</OText>
|
|
@@ -203,6 +213,15 @@ const CartUI = (props: any) => {
|
|
|
203
213
|
</OSTable>
|
|
204
214
|
))
|
|
205
215
|
}
|
|
216
|
+
{cart?.service_fee > 0 && !cart?.fees?.length && (
|
|
217
|
+
<OSTable>
|
|
218
|
+
<OText size={12} lineHeight={18}>
|
|
219
|
+
{t('SERVICE_FEE', 'Service Fee')}
|
|
220
|
+
{`(${verifyDecimals(cart?.business?.service_fee, parseNumber)}%)`}
|
|
221
|
+
</OText>
|
|
222
|
+
<OText size={12} lineHeight={18}>{parsePrice(cart?.service_fee)}</OText>
|
|
223
|
+
</OSTable>
|
|
224
|
+
)}
|
|
206
225
|
{orderState?.options?.type === 1 && cart?.delivery_price > 0 && (
|
|
207
226
|
<OSTable>
|
|
208
227
|
<OText size={12} lineHeight={18}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
@@ -223,15 +242,14 @@ const CartUI = (props: any) => {
|
|
|
223
242
|
<OText size={12} lineHeight={18}>{parsePrice(cart?.driver_tip)}</OText>
|
|
224
243
|
</OSTable>
|
|
225
244
|
)}
|
|
226
|
-
{cart?.
|
|
227
|
-
<OSTable>
|
|
228
|
-
<OText size={12}
|
|
229
|
-
{
|
|
230
|
-
{`(${verifyDecimals(cart?.business?.service_fee, parseNumber)}%)`}
|
|
245
|
+
{cart?.payment_events?.length > 0 && cart?.payment_events?.map((event: any) => (
|
|
246
|
+
<OSTable key={event.id}>
|
|
247
|
+
<OText size={12} numberOfLines={1}>
|
|
248
|
+
{walletName[cart?.wallets?.find((wallet: any) => wallet.id === event.wallet_id)?.type]?.name}
|
|
231
249
|
</OText>
|
|
232
|
-
<OText size={12}
|
|
250
|
+
<OText size={12}>-{parsePrice(event.amount)}</OText>
|
|
233
251
|
</OSTable>
|
|
234
|
-
)}
|
|
252
|
+
))}
|
|
235
253
|
{isCouponEnabled && !isCartPending && (
|
|
236
254
|
<OSTable>
|
|
237
255
|
<OSCoupon>
|
|
@@ -249,7 +267,7 @@ const CartUI = (props: any) => {
|
|
|
249
267
|
{t('TOTAL', 'Total')}
|
|
250
268
|
</OText>
|
|
251
269
|
<OText size={14} lineHeight={21} weight={'600'}>
|
|
252
|
-
{cart?.
|
|
270
|
+
{parsePrice(cart?.balance ?? cart?.total)}
|
|
253
271
|
</OText>
|
|
254
272
|
</OSTable>
|
|
255
273
|
</OSTotal>
|
|
@@ -177,6 +177,14 @@ const OrderSummaryUI = (props: any) => {
|
|
|
177
177
|
<OText size={12}>{parsePrice(cart?.driver_tip)}</OText>
|
|
178
178
|
</OSTable>
|
|
179
179
|
)}
|
|
180
|
+
{cart?.payment_events?.length > 0 && cart?.payment_events?.map((event: any) => (
|
|
181
|
+
<OSTable key={event.id}>
|
|
182
|
+
<OText size={12} numberOfLines={1}>
|
|
183
|
+
{walletName[cart?.wallets?.find((wallet: any) => wallet.id === event.wallet_id)?.type]?.name}
|
|
184
|
+
</OText>
|
|
185
|
+
<OText size={12}>-{parsePrice(event.amount)}</OText>
|
|
186
|
+
</OSTable>
|
|
187
|
+
))}
|
|
180
188
|
{isCouponEnabled && !isCartPending && (
|
|
181
189
|
<View>
|
|
182
190
|
<View style={{ paddingVertical: 5 }}>
|
|
@@ -194,7 +202,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
194
202
|
{t('TOTAL', 'Total')}
|
|
195
203
|
</OText>
|
|
196
204
|
<OText size={14} style={{ fontWeight: 'bold' }} >
|
|
197
|
-
{parsePrice(cart?.total)}
|
|
205
|
+
{parsePrice(cart?.balance ?? cart?.total)}
|
|
198
206
|
</OText>
|
|
199
207
|
</OSTable>
|
|
200
208
|
</View>
|
|
@@ -232,52 +240,6 @@ const OrderSummaryUI = (props: any) => {
|
|
|
232
240
|
</View>
|
|
233
241
|
</OSTable>
|
|
234
242
|
)}
|
|
235
|
-
{cart?.payment_events?.length > 0 && (
|
|
236
|
-
<View
|
|
237
|
-
style={{
|
|
238
|
-
width: '100%',
|
|
239
|
-
marginTop: 20
|
|
240
|
-
}}
|
|
241
|
-
>
|
|
242
|
-
{cart?.payment_events?.map((event: any) => (
|
|
243
|
-
<View
|
|
244
|
-
key={event.id}
|
|
245
|
-
style={{
|
|
246
|
-
display: 'flex',
|
|
247
|
-
flexDirection: 'row',
|
|
248
|
-
justifyContent: 'space-between',
|
|
249
|
-
marginBottom: 10
|
|
250
|
-
}}
|
|
251
|
-
>
|
|
252
|
-
<OText>
|
|
253
|
-
{walletName[cart?.wallets?.find((wallet: any) => wallet.id === event.wallet_id)?.type]?.name}
|
|
254
|
-
</OText>
|
|
255
|
-
<OText>
|
|
256
|
-
-{parsePrice(event.amount)}
|
|
257
|
-
</OText>
|
|
258
|
-
</View>
|
|
259
|
-
))}
|
|
260
|
-
<View
|
|
261
|
-
style={{
|
|
262
|
-
display: 'flex',
|
|
263
|
-
flexDirection: 'row',
|
|
264
|
-
justifyContent: 'space-between',
|
|
265
|
-
marginBottom: 10
|
|
266
|
-
}}
|
|
267
|
-
>
|
|
268
|
-
<OText
|
|
269
|
-
weight={'bold'}
|
|
270
|
-
>
|
|
271
|
-
{t('TOTAL_TO_PAY', 'Total to pay')}
|
|
272
|
-
</OText>
|
|
273
|
-
<OText
|
|
274
|
-
weight={'bold'}
|
|
275
|
-
>
|
|
276
|
-
{parsePrice(cart?.balance)}
|
|
277
|
-
</OText>
|
|
278
|
-
</View>
|
|
279
|
-
</View>
|
|
280
|
-
)}
|
|
281
243
|
</OSBill>
|
|
282
244
|
)}
|
|
283
245
|
<OModal
|