ordering-ui-react-native 0.16.48-release → 0.16.49-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.
- package/package.json +1 -1
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +23 -23
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
- package/themes/original/index.tsx +2 -0
- package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
- package/themes/original/src/components/BusinessProductsListing/index.tsx +2 -0
- package/themes/original/src/components/Checkout/index.tsx +1 -1
- package/themes/original/src/components/OrdersOption/index.tsx +8 -9
- package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
- package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
- package/themes/original/src/components/ServiceForm/index.tsx +10 -4
- package/themes/original/src/types/index.tsx +3 -0
package/package.json
CHANGED
|
@@ -337,7 +337,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
337
337
|
<View style={{ marginTop: 10 }}>
|
|
338
338
|
{order?.delivery_option !== undefined && order?.delivery_type === 1 && (
|
|
339
339
|
<OText>
|
|
340
|
-
{order?.delivery_option?.name}
|
|
340
|
+
{t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}
|
|
341
341
|
</OText>
|
|
342
342
|
)}
|
|
343
343
|
{!!order?.comment && (
|
|
@@ -382,7 +382,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
382
382
|
<Table>
|
|
383
383
|
<OText mBottom={4}>{t('SUBTOTAL', 'Subtotal')}</OText>
|
|
384
384
|
<OText mBottom={4}>
|
|
385
|
-
{parsePrice(((order?.summary?.subtotal ?? order?.subtotal) + getIncludedTaxes()), { currency: order?.currency})}
|
|
385
|
+
{parsePrice(((order?.summary?.subtotal ?? order?.subtotal) + getIncludedTaxes()), { currency: order?.currency })}
|
|
386
386
|
</OText>
|
|
387
387
|
</Table>
|
|
388
388
|
{(order?.summary?.discount > 0 ?? order?.discount > 0) && order?.offers?.length === 0 && (
|
|
@@ -395,7 +395,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
395
395
|
) : (
|
|
396
396
|
<OText mBottom={4}>{t('DISCOUNT', theme?.defaultLanguages?.DISCOUNT || 'Discount')}</OText>
|
|
397
397
|
)}
|
|
398
|
-
<OText>- {parsePrice(order?.summary?.discount ?? order?.discount, { currency: order?.currency})}</OText>
|
|
398
|
+
<OText>- {parsePrice(order?.summary?.discount ?? order?.discount, { currency: order?.currency })}</OText>
|
|
399
399
|
</Table>
|
|
400
400
|
)}
|
|
401
401
|
{
|
|
@@ -403,13 +403,13 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
403
403
|
<Table key={offer.id}>
|
|
404
404
|
<OSRow>
|
|
405
405
|
<OText mBottom={4}>
|
|
406
|
-
{offer.name}
|
|
406
|
+
{t(offer.name?.toUpperCase()?.replace(/ /g, '_'), offer.name)}
|
|
407
407
|
{offer.rate_type === 1 && (
|
|
408
408
|
<OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
|
|
409
409
|
)}
|
|
410
410
|
</OText>
|
|
411
411
|
</OSRow>
|
|
412
|
-
<OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency})}</OText>
|
|
412
|
+
<OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency })}</OText>
|
|
413
413
|
</Table>
|
|
414
414
|
))
|
|
415
415
|
}
|
|
@@ -417,9 +417,9 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
417
417
|
<Table>
|
|
418
418
|
<OText mBottom={4}>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
|
|
419
419
|
{order?.tax_type === 1 ? (
|
|
420
|
-
<OText mBottom={4}>{parsePrice((order?.summary?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0), { currency: order?.currency})}</OText>
|
|
420
|
+
<OText mBottom={4}>{parsePrice((order?.summary?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0), { currency: order?.currency })}</OText>
|
|
421
421
|
) : (
|
|
422
|
-
<OText mBottom={4}>{parsePrice(order?.summary?.subtotal_with_discount ?? 0, { currency: order?.currency})}</OText>
|
|
422
|
+
<OText mBottom={4}>{parsePrice(order?.summary?.subtotal_with_discount ?? 0, { currency: order?.currency })}</OText>
|
|
423
423
|
)}
|
|
424
424
|
</Table>
|
|
425
425
|
)}
|
|
@@ -429,7 +429,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
429
429
|
{t('TAX', 'Tax')} {`(${verifyDecimals(order?.tax, parseNumber)}%)`}
|
|
430
430
|
</OText>
|
|
431
431
|
<OText mBottom={4}>
|
|
432
|
-
{parsePrice(order?.summary?.tax ?? 0, { currency: order?.currency})}
|
|
432
|
+
{parsePrice(order?.summary?.tax ?? 0, { currency: order?.currency })}
|
|
433
433
|
</OText>
|
|
434
434
|
</Table>
|
|
435
435
|
)}
|
|
@@ -440,7 +440,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
440
440
|
{t('SERVICE_FEE', 'Service fee')}
|
|
441
441
|
{`(${verifyDecimals(order?.service_fee, parseNumber)}%)`}
|
|
442
442
|
</OText>
|
|
443
|
-
<OText mBottom={4}>{parsePrice(order?.summary?.service_fee ?? 0, { currency: order?.currency})}</OText>
|
|
443
|
+
<OText mBottom={4}>{parsePrice(order?.summary?.service_fee ?? 0, { currency: order?.currency })}</OText>
|
|
444
444
|
</Table>
|
|
445
445
|
)
|
|
446
446
|
}
|
|
@@ -449,11 +449,11 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
449
449
|
<Table key={tax.id}>
|
|
450
450
|
<OSRow>
|
|
451
451
|
<OText mBottom={4}>
|
|
452
|
-
{tax
|
|
452
|
+
{t(tax?.name?.toUpperCase()?.replace(/ /g, '_'), tax?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
453
453
|
{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
|
|
454
454
|
</OText>
|
|
455
455
|
</OSRow>
|
|
456
|
-
<OText mBottom={4}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0, { currency: order?.currency})}</OText>
|
|
456
|
+
<OText mBottom={4}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0, { currency: order?.currency })}</OText>
|
|
457
457
|
</Table>
|
|
458
458
|
))
|
|
459
459
|
}
|
|
@@ -462,11 +462,11 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
462
462
|
<Table key={fee.id}>
|
|
463
463
|
<OSRow>
|
|
464
464
|
<OText mBottom={4}>
|
|
465
|
-
{fee
|
|
466
|
-
({fee?.fixed > 0 && `${parsePrice(fee?.fixed, { currency: order?.currency})} + `}{fee.percentage}%){' '}
|
|
465
|
+
{t(fee?.name?.toUpperCase()?.replace(/ /g, '_'), fee?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
466
|
+
({fee?.fixed > 0 && `${parsePrice(fee?.fixed, { currency: order?.currency })} + `}{fee.percentage}%){' '}
|
|
467
467
|
</OText>
|
|
468
468
|
</OSRow>
|
|
469
|
-
<OText mBottom={4}>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0, { currency: order?.currency})}</OText>
|
|
469
|
+
<OText mBottom={4}>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0, { currency: order?.currency })}</OText>
|
|
470
470
|
</Table>
|
|
471
471
|
))
|
|
472
472
|
}
|
|
@@ -475,13 +475,13 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
475
475
|
<Table key={offer.id}>
|
|
476
476
|
<OSRow>
|
|
477
477
|
<OText mBottom={4}>
|
|
478
|
-
{offer.name}
|
|
478
|
+
{t(offer.name?.toUpperCase()?.replace(/ /g, '_'), offer.name)}
|
|
479
479
|
{offer.rate_type === 1 && (
|
|
480
480
|
<OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
|
|
481
481
|
)}
|
|
482
482
|
</OText>
|
|
483
483
|
</OSRow>
|
|
484
|
-
<OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency})}</OText>
|
|
484
|
+
<OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency })}</OText>
|
|
485
485
|
</Table>
|
|
486
486
|
))
|
|
487
487
|
}
|
|
@@ -493,7 +493,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
493
493
|
</OText>
|
|
494
494
|
|
|
495
495
|
<OText mBottom={4}>
|
|
496
|
-
{parsePrice(order?.summary?.delivery_price, { currency: order?.currency})}
|
|
496
|
+
{parsePrice(order?.summary?.delivery_price, { currency: order?.currency })}
|
|
497
497
|
</OText>
|
|
498
498
|
</Table>
|
|
499
499
|
)
|
|
@@ -503,13 +503,13 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
503
503
|
<Table key={offer.id}>
|
|
504
504
|
<OSRow>
|
|
505
505
|
<OText mBottom={4}>
|
|
506
|
-
{offer.name}
|
|
506
|
+
{t(offer.name?.toUpperCase()?.replace(/ /g, '_'), offer.name)}
|
|
507
507
|
{offer.rate_type === 1 && (
|
|
508
508
|
<OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
|
|
509
509
|
)}
|
|
510
510
|
</OText>
|
|
511
511
|
</OSRow>
|
|
512
|
-
<OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency})}</OText>
|
|
512
|
+
<OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency })}</OText>
|
|
513
513
|
</Table>
|
|
514
514
|
))
|
|
515
515
|
}
|
|
@@ -524,7 +524,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
524
524
|
`(${verifyDecimals(order?.summary?.driver_tip, parseNumber)}%)`
|
|
525
525
|
)}
|
|
526
526
|
</OText>
|
|
527
|
-
<OText mBottom={4}>{parsePrice(order?.summary?.driver_tip ?? order?.totalDriverTip, { currency: order?.currency})}</OText>
|
|
527
|
+
<OText mBottom={4}>{parsePrice(order?.summary?.driver_tip ?? order?.totalDriverTip, { currency: order?.currency })}</OText>
|
|
528
528
|
</Table>
|
|
529
529
|
)}
|
|
530
530
|
|
|
@@ -538,7 +538,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
538
538
|
mBottom={4}
|
|
539
539
|
style={styles.textBold}
|
|
540
540
|
color={theme.colors.primary}>
|
|
541
|
-
{parsePrice(order?.summary?.total ?? order?.total, { currency: order?.currency})}
|
|
541
|
+
{parsePrice(order?.summary?.total ?? order?.total, { currency: order?.currency })}
|
|
542
542
|
</OText>
|
|
543
543
|
</Table>
|
|
544
544
|
</Total>
|
|
@@ -572,7 +572,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
572
572
|
<OText>
|
|
573
573
|
{event?.wallet_event
|
|
574
574
|
? walletName[event?.wallet_event?.wallet?.type]?.name
|
|
575
|
-
: event?.paymethod?.name}
|
|
575
|
+
: t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)}
|
|
576
576
|
</OText>
|
|
577
577
|
{event?.data?.charge_id && (
|
|
578
578
|
<OText>
|
|
@@ -581,7 +581,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
581
581
|
)}
|
|
582
582
|
</View>
|
|
583
583
|
<OText>
|
|
584
|
-
-{parsePrice(event.amount, { currency: order?.currency})}
|
|
584
|
+
-{parsePrice(event.amount, { currency: order?.currency })}
|
|
585
585
|
</OText>
|
|
586
586
|
</View>
|
|
587
587
|
))}
|
|
@@ -271,7 +271,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
271
271
|
{order?.delivery_option && (
|
|
272
272
|
<OText size={13}>
|
|
273
273
|
<OText size={13} weight='bold'>{`${t('DELIVERY_PREFERENCE', 'Delivery Preference')}: `}</OText>
|
|
274
|
-
{order?.delivery_option?.name}
|
|
274
|
+
{t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}
|
|
275
275
|
</OText>
|
|
276
276
|
)}
|
|
277
277
|
{order?.payment_events?.length > 0 && (
|
|
@@ -286,8 +286,8 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
286
286
|
? `${walletName[event?.wallet_event?.wallet?.type]?.name} - `
|
|
287
287
|
: walletName[event?.wallet_event?.wallet?.type]?.name
|
|
288
288
|
: idx < order?.payment_events?.length - 1
|
|
289
|
-
? `${event?.paymethod?.name} - `
|
|
290
|
-
: event?.paymethod?.name
|
|
289
|
+
? `${t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)} - `
|
|
290
|
+
: t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)
|
|
291
291
|
})}
|
|
292
292
|
</OText>
|
|
293
293
|
</View>
|
|
@@ -68,6 +68,7 @@ import { SingleProductCard } from './src/components/SingleProductCard';
|
|
|
68
68
|
import { SingleOrderCard } from './src/components/SingleOrderCard';
|
|
69
69
|
import { UpsellingRedirect } from './src/components/BusinessProductsListing/UpsellingRedirect';
|
|
70
70
|
import { ProductItemAccordion } from './src/components/ProductItemAccordion';
|
|
71
|
+
import { ScheduleAccordion } from './src/components/ScheduleAccordion';
|
|
71
72
|
import { BusinessItemAccordion } from './src/components/BusinessItemAccordion';
|
|
72
73
|
import { CouponControl } from './src/components/CouponControl';
|
|
73
74
|
import { TaxInformation } from './src/components/TaxInformation';
|
|
@@ -231,6 +232,7 @@ export {
|
|
|
231
232
|
SingleOrderCard,
|
|
232
233
|
UpsellingRedirect,
|
|
233
234
|
ProductItemAccordion,
|
|
235
|
+
ScheduleAccordion,
|
|
234
236
|
BusinessItemAccordion,
|
|
235
237
|
CouponControl,
|
|
236
238
|
TaxInformation,
|
|
@@ -16,26 +16,19 @@ import {
|
|
|
16
16
|
DivideView,
|
|
17
17
|
MediaWrapper,
|
|
18
18
|
} from './styles';
|
|
19
|
-
import {
|
|
19
|
+
import { StyleSheet, View } from 'react-native';
|
|
20
20
|
import { BusinessInformationParams } from '../../types';
|
|
21
21
|
import { GoogleMap } from '../GoogleMap';
|
|
22
22
|
import { WebView } from 'react-native-webview';
|
|
23
23
|
import { formatUrlVideo } from '../../utils'
|
|
24
|
+
import { ScheduleAccordion } from '../ScheduleAccordion';
|
|
24
25
|
const BusinessInformationUI = (props: BusinessInformationParams) => {
|
|
25
26
|
const { businessState, businessSchedule, businessLocation } = props;
|
|
26
27
|
|
|
27
28
|
const theme = useTheme();
|
|
28
29
|
const [, t] = useLanguage();
|
|
29
30
|
const [{ optimizeImage }] = useUtils();
|
|
30
|
-
|
|
31
|
-
t('SUNDAY_ABBREVIATION', 'Sun'),
|
|
32
|
-
t('MONDAY_ABBREVIATION', 'Mon'),
|
|
33
|
-
t('TUESDAY_ABBREVIATION', 'Tues'),
|
|
34
|
-
t('WEDNESDAY_ABBREVIATION', 'Wed'),
|
|
35
|
-
t('THURSDAY_ABBREVIATION', 'Thur'),
|
|
36
|
-
t('FRIDAY_ABBREVIATION', 'Fri'),
|
|
37
|
-
t('SATURDAY_ABBREVIATION', 'Sat'),
|
|
38
|
-
];
|
|
31
|
+
|
|
39
32
|
const scheduleFormatted = ({
|
|
40
33
|
hour,
|
|
41
34
|
minute,
|
|
@@ -112,25 +105,11 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
|
|
|
112
105
|
<WrapScheduleBlock>
|
|
113
106
|
{businessSchedule.map((schedule: any, i: number) => (
|
|
114
107
|
<ScheduleBlock key={i}>
|
|
115
|
-
<
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
style={{ flexBasis: '20%' }}>
|
|
121
|
-
{daysOfWeek[i].toUpperCase()}
|
|
122
|
-
</OText>
|
|
123
|
-
{schedule.enabled ? (
|
|
124
|
-
<OText mBottom={16}>
|
|
125
|
-
{scheduleFormatted(schedule.lapses[0].open) +
|
|
126
|
-
' - ' +
|
|
127
|
-
scheduleFormatted(schedule.lapses[0].close)}
|
|
128
|
-
</OText>
|
|
129
|
-
) : (
|
|
130
|
-
<OText color={theme.colors.red} mBottom={16}>
|
|
131
|
-
{t('CLOSED', 'Closed')}
|
|
132
|
-
</OText>
|
|
133
|
-
)}
|
|
108
|
+
<ScheduleAccordion
|
|
109
|
+
weekIndex={i}
|
|
110
|
+
scheduleFormatted={scheduleFormatted}
|
|
111
|
+
schedule={schedule}
|
|
112
|
+
/>
|
|
134
113
|
</ScheduleBlock>
|
|
135
114
|
))}
|
|
136
115
|
</WrapScheduleBlock>
|
|
@@ -152,10 +131,10 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
|
|
|
152
131
|
style={{ width: 210, height: 127, borderRadius: 7.6 }}
|
|
153
132
|
javaScriptEnabled={true}
|
|
154
133
|
domStorageEnabled={true}
|
|
155
|
-
source={{
|
|
134
|
+
source={{
|
|
156
135
|
html: `
|
|
157
136
|
<iframe width='80%' height='80%' src="${formatUrlVideo(v.video)}" frameBorder='0' allow='autoplay; encrypted-media' allowFullScreen />
|
|
158
|
-
`,
|
|
137
|
+
`,
|
|
159
138
|
}}
|
|
160
139
|
mediaPlaybackRequiresUserAction={true}
|
|
161
140
|
/>
|
|
@@ -66,6 +66,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
66
66
|
getNextProducts,
|
|
67
67
|
handleUpdateProducts,
|
|
68
68
|
professionalSelected,
|
|
69
|
+
handleUpdateProfessionals,
|
|
69
70
|
handleChangeProfessionalSelected,
|
|
70
71
|
onBusinessClick
|
|
71
72
|
} = props
|
|
@@ -569,6 +570,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
569
570
|
professionalList={business?.professionals}
|
|
570
571
|
professionalSelected={professionalSelected}
|
|
571
572
|
handleChangeProfessional={handleChangeProfessionalSelected}
|
|
573
|
+
handleUpdateProfessionals={handleUpdateProfessionals}
|
|
572
574
|
onSave={() => setOpenService(false)}
|
|
573
575
|
onClose={() => setOpenService(false)}
|
|
574
576
|
/>
|
|
@@ -452,7 +452,7 @@ const CheckoutUI = (props: any) => {
|
|
|
452
452
|
<OText
|
|
453
453
|
size={14}
|
|
454
454
|
>
|
|
455
|
-
{deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)
|
|
455
|
+
{deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)?.label}
|
|
456
456
|
</OText>
|
|
457
457
|
<MaterialIcons name='keyboard-arrow-down' style={styles.icon} />
|
|
458
458
|
</DeliveryOptionItem>
|
|
@@ -84,16 +84,15 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
84
84
|
review: orderCompleted.review && currentOrder.review,
|
|
85
85
|
user_review: orderCompleted.user_review && currentOrder.user_review,
|
|
86
86
|
products: [orderCompleted.products, currentOrder.products].flat()
|
|
87
|
-
}))
|
|
87
|
+
})).filter((order: any) => {
|
|
88
|
+
const isDuplicate = uniqueOrders.includes(order?.cart_group_id)
|
|
89
|
+
if (!isDuplicate) {
|
|
90
|
+
uniqueOrders.push(order?.cart_group_id)
|
|
91
|
+
return true
|
|
92
|
+
}
|
|
93
|
+
return false
|
|
94
|
+
})
|
|
88
95
|
: order)
|
|
89
|
-
.filter((order: any) => {
|
|
90
|
-
const isDuplicate = uniqueOrders.includes(order?.cart_group_id)
|
|
91
|
-
if (!isDuplicate) {
|
|
92
|
-
uniqueOrders.push(order?.cart_group_id)
|
|
93
|
-
return true
|
|
94
|
-
}
|
|
95
|
-
return false
|
|
96
|
-
})
|
|
97
96
|
setOrders(orders)
|
|
98
97
|
}, [JSON.stringify(_orders)])
|
|
99
98
|
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { Platform, View } from 'react-native'
|
|
3
|
+
import { useLanguage } from 'ordering-components/native';
|
|
4
|
+
import { useTheme } from 'styled-components/native';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
Accordion,
|
|
8
|
+
AccordionSection,
|
|
9
|
+
DropdownWrapper,
|
|
10
|
+
} from './styles'
|
|
11
|
+
import { OIcon, OText } from '../shared';
|
|
12
|
+
|
|
13
|
+
export const ScheduleAccordion = (props: any) => {
|
|
14
|
+
|
|
15
|
+
const {
|
|
16
|
+
scheduleFormatted,
|
|
17
|
+
schedule,
|
|
18
|
+
weekIndex
|
|
19
|
+
} = props
|
|
20
|
+
|
|
21
|
+
const [isActive, setActiveState] = useState(false)
|
|
22
|
+
const [, t] = useLanguage()
|
|
23
|
+
const theme = useTheme();
|
|
24
|
+
|
|
25
|
+
const daysOfWeek = [
|
|
26
|
+
t('DAY7', 'Sunday'),
|
|
27
|
+
t('DAY1', 'Monday'),
|
|
28
|
+
t('DAY2', 'Tuesday'),
|
|
29
|
+
t('DAY3', 'Wednesday'),
|
|
30
|
+
t('DAY4', 'Thursday'),
|
|
31
|
+
t('DAY5', 'Friday'),
|
|
32
|
+
t('DAY6', 'Saturday'),
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<AccordionSection>
|
|
37
|
+
<Accordion
|
|
38
|
+
onPress={() => setActiveState(!isActive)}
|
|
39
|
+
activeOpacity={1}
|
|
40
|
+
>
|
|
41
|
+
<DropdownWrapper>
|
|
42
|
+
<OText
|
|
43
|
+
mBottom={16}
|
|
44
|
+
mRight={8}
|
|
45
|
+
lineHeight={21}
|
|
46
|
+
size={14}
|
|
47
|
+
weight={Platform.OS === 'android' ? 'bold' : '600'}
|
|
48
|
+
>{daysOfWeek[weekIndex]}</OText>
|
|
49
|
+
<OIcon src={theme.images.general.arrow_down} color={theme.colors.textNormal} width={8} />
|
|
50
|
+
</DropdownWrapper>
|
|
51
|
+
<View style={{ display: isActive ? 'flex' : 'none', paddingStart: 20 }}>
|
|
52
|
+
{schedule?.lapses?.map((lapse: any) => (
|
|
53
|
+
schedule?.enabled ?
|
|
54
|
+
<OText mBottom={16}>
|
|
55
|
+
{scheduleFormatted(lapse.open) +
|
|
56
|
+
' - ' +
|
|
57
|
+
scheduleFormatted(lapse.close)}
|
|
58
|
+
</OText>
|
|
59
|
+
:
|
|
60
|
+
<OText color={theme.colors.red} mBottom={16}>
|
|
61
|
+
{t('CLOSED', 'Closed')}
|
|
62
|
+
</OText>
|
|
63
|
+
))}
|
|
64
|
+
</View>
|
|
65
|
+
</Accordion>
|
|
66
|
+
</AccordionSection>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import styled from 'styled-components/native'
|
|
2
|
+
|
|
3
|
+
export const AccordionSection = styled.View`
|
|
4
|
+
background: #FFF;
|
|
5
|
+
`
|
|
6
|
+
|
|
7
|
+
export const Accordion = styled.TouchableOpacity`
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
justify-content: space-between;
|
|
10
|
+
`
|
|
11
|
+
|
|
12
|
+
export const DropdownWrapper = styled.View`
|
|
13
|
+
flex-direction: row;
|
|
14
|
+
`
|
|
@@ -111,9 +111,15 @@ const ServiceFormUI = (props: ServiceFormParams) => {
|
|
|
111
111
|
|
|
112
112
|
const isBusyTime = (professional: any) => {
|
|
113
113
|
if (professional?.busy_times?.length === 0 || !dateSelected) return false
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
const duration = product?.duration ?? 0
|
|
115
|
+
const busyTimes = isCartProduct
|
|
116
|
+
? professional?.busy_times.filter((item: any) => !(item.start === productCart?.calendar_event?.start && item.end === productCart?.calendar_event?.end))
|
|
117
|
+
: [...professional?.busy_times]
|
|
118
|
+
const valid = busyTimes.some((item: any) => {
|
|
119
|
+
return (moment.utc(item?.start).local().valueOf() <= moment(dateSelected).valueOf() &&
|
|
120
|
+
moment(dateSelected).valueOf() <= moment.utc(item?.end).local().valueOf()) ||
|
|
121
|
+
(moment.utc(item?.start).local().valueOf() <= moment(dateSelected).add(duration, 'minutes').valueOf() &&
|
|
122
|
+
moment(dateSelected).add(duration, 'minutes').valueOf() <= moment.utc(item?.end).local().valueOf())
|
|
117
123
|
})
|
|
118
124
|
return valid
|
|
119
125
|
}
|
|
@@ -523,7 +529,7 @@ const ServiceFormUI = (props: ServiceFormParams) => {
|
|
|
523
529
|
? t('SOLD_OUT', 'Sold out')
|
|
524
530
|
: t('BOOK', 'Book'))}
|
|
525
531
|
style={styles.buttonStyle}
|
|
526
|
-
isDisabled={isSoldOut || maxProductQuantity <= 0 || !currentProfessional?.id || !dateSelected}
|
|
532
|
+
isDisabled={isSoldOut || maxProductQuantity <= 0 || !currentProfessional?.id || !dateSelected || isBusyTime(currentProfessional)}
|
|
527
533
|
textStyle={{ fontSize: 14, color: theme.colors.white }}
|
|
528
534
|
/>
|
|
529
535
|
)}
|
|
@@ -249,6 +249,8 @@ export interface BusinessProductsListingParams {
|
|
|
249
249
|
handleUpdateProducts?: any;
|
|
250
250
|
professionalSelected?: any;
|
|
251
251
|
handleChangeProfessionalSelected?: any;
|
|
252
|
+
handleUpdateProfessionals?: any;
|
|
253
|
+
onBusinessClick?: any;
|
|
252
254
|
}
|
|
253
255
|
export interface BusinessBasicInformationParams {
|
|
254
256
|
navigation?: any;
|
|
@@ -651,6 +653,7 @@ export interface BusinessSearchParams {
|
|
|
651
653
|
onNavigationRedirect?: any,
|
|
652
654
|
handleUpdateProducts: any,
|
|
653
655
|
handleUpdateBusinessList?: any;
|
|
656
|
+
brandId?: number
|
|
654
657
|
}
|
|
655
658
|
|
|
656
659
|
export interface NoNetworkParams {
|