ordering-ui-external 1.3.2 → 1.4.1
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/_bundles/0.ordering-ui.eec38d66166bc4458215.js +1 -0
- package/_bundles/{0.ordering-ui.8d3ec9f208550df10621.js → 1.ordering-ui.eec38d66166bc4458215.js} +1 -1
- package/_bundles/{1.ordering-ui.8d3ec9f208550df10621.js → 2.ordering-ui.eec38d66166bc4458215.js} +1 -1
- package/_bundles/{4.ordering-ui.8d3ec9f208550df10621.js → 4.ordering-ui.eec38d66166bc4458215.js} +1 -1
- package/_bundles/{5.ordering-ui.8d3ec9f208550df10621.js → 5.ordering-ui.eec38d66166bc4458215.js} +1 -1
- package/_bundles/{6.ordering-ui.8d3ec9f208550df10621.js → 6.ordering-ui.eec38d66166bc4458215.js} +1 -1
- package/_bundles/7.ordering-ui.eec38d66166bc4458215.js +2 -0
- package/_bundles/{7.ordering-ui.8d3ec9f208550df10621.js.LICENSE.txt → 7.ordering-ui.eec38d66166bc4458215.js.LICENSE.txt} +0 -0
- package/_bundles/{8.ordering-ui.8d3ec9f208550df10621.js → 8.ordering-ui.eec38d66166bc4458215.js} +1 -1
- package/_bundles/{9.ordering-ui.8d3ec9f208550df10621.js → 9.ordering-ui.eec38d66166bc4458215.js} +1 -1
- package/_bundles/ordering-ui.eec38d66166bc4458215.js +2 -0
- package/_bundles/{ordering-ui.8d3ec9f208550df10621.js.LICENSE.txt → ordering-ui.eec38d66166bc4458215.js.LICENSE.txt} +0 -0
- package/_modules/themes/five/index.js +7 -0
- package/_modules/themes/five/src/components/BusinessListingSearch/MaxSectionItem/index.js +47 -0
- package/_modules/themes/five/src/components/BusinessListingSearch/index.js +14 -29
- package/_modules/themes/five/src/components/BusinessProductsList/index.js +10 -6
- package/_modules/themes/five/src/components/BusinessProductsList/styles.js +8 -7
- package/_modules/themes/five/src/components/BusinessProductsListing/index.js +1 -1
- package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +3 -3
- package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +4 -1
- package/_modules/themes/five/src/components/Cart/index.js +3 -1
- package/_modules/themes/five/src/components/Checkout/index.js +52 -39
- package/_modules/themes/five/src/components/Favorite/index.js +16 -2
- package/_modules/themes/five/src/components/FavoriteList/index.js +15 -1
- package/_modules/themes/five/src/components/Header/index.js +2 -2
- package/_modules/themes/five/src/components/Header/styles.js +5 -3
- package/_modules/themes/five/src/components/Modal/index.js +2 -2
- package/_modules/themes/five/src/components/Modal/styles.js +8 -4
- package/_modules/themes/five/src/components/MyOrders/index.js +9 -2
- package/_modules/themes/five/src/components/OrderDetails/ActionsSection.js +1 -0
- package/_modules/themes/five/src/components/OrdersOption/PreviousBusinessOrdered/index.js +10 -40
- package/_modules/themes/five/src/components/OrdersOption/PreviousProfessionalOrdered/index.js +25 -0
- package/_modules/themes/five/src/components/OrdersOption/PreviousProfessionalOrdered/styles.js +19 -0
- package/_modules/themes/five/src/components/OrdersOption/index.js +16 -13
- package/_modules/themes/five/src/components/ProductForm/index.js +5 -5
- package/_modules/themes/five/src/components/RenderProductsLayout/styles.js +1 -1
- package/_modules/themes/five/src/components/SidebarMenu/index.js +39 -17
- package/_modules/themes/five/src/components/SingleProductCard/styles.js +1 -1
- package/_modules/themes/five/src/components/SingleProfessionalCard/index.js +95 -0
- package/_modules/themes/five/src/components/SingleProfessionalCard/styles.js +47 -0
- package/_modules/themes/five/src/styles/Selects/index.js +1 -1
- package/index-template.js +28 -5
- package/package.json +6 -3
- package/src/themes/five/index.js +2 -0
- package/src/themes/five/src/components/BusinessListingSearch/MaxSectionItem/index.js +44 -0
- package/src/themes/five/src/components/BusinessListingSearch/index.js +8 -30
- package/src/themes/five/src/components/BusinessProductsList/index.js +29 -22
- package/src/themes/five/src/components/BusinessProductsList/styles.js +25 -2
- package/src/themes/five/src/components/BusinessProductsListing/index.js +1 -1
- package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +4 -3
- package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +1 -1
- package/src/themes/five/src/components/Cart/index.js +2 -0
- package/src/themes/five/src/components/Checkout/index.js +22 -14
- package/src/themes/five/src/components/Favorite/index.js +19 -1
- package/src/themes/five/src/components/FavoriteList/index.js +24 -0
- package/src/themes/five/src/components/Header/index.js +11 -8
- package/src/themes/five/src/components/Header/styles.js +5 -0
- package/src/themes/five/src/components/Modal/index.js +9 -6
- package/src/themes/five/src/components/Modal/styles.js +15 -1
- package/src/themes/five/src/components/MyOrders/index.js +11 -1
- package/src/themes/five/src/components/OrderDetails/ActionsSection.js +1 -0
- package/src/themes/five/src/components/OrdersOption/PreviousBusinessOrdered/index.js +8 -29
- package/src/themes/five/src/components/OrdersOption/PreviousProfessionalOrdered/index.js +32 -0
- package/src/themes/five/src/components/OrdersOption/PreviousProfessionalOrdered/styles.js +38 -0
- package/src/themes/five/src/components/OrdersOption/index.js +18 -9
- package/src/themes/five/src/components/ProductForm/index.js +5 -5
- package/src/themes/five/src/components/RenderProductsLayout/styles.js +1 -1
- package/src/themes/five/src/components/SidebarMenu/index.js +98 -42
- package/src/themes/five/src/components/SingleProductCard/styles.js +5 -1
- package/src/themes/five/src/components/SingleProfessionalCard/index.js +82 -0
- package/src/themes/five/src/components/SingleProfessionalCard/styles.js +92 -0
- package/src/themes/five/src/styles/Selects/index.js +1 -0
- package/template/Utils/index.js +4 -0
- package/template/app.js +554 -143
- package/template/assets/images/business-hero.jpg +0 -0
- package/template/assets/images/business-signup-background.png +0 -0
- package/template/assets/images/business_signup.png +0 -0
- package/template/assets/images/congratulation_approval.png +0 -0
- package/template/assets/images/congratulation_no_approval.png +0 -0
- package/template/assets/images/credit.png +0 -0
- package/template/assets/images/delivery-types/curbside.jpg +0 -0
- package/template/assets/images/delivery-types/delivery.jpg +0 -0
- package/template/assets/images/delivery-types/drive_thru.jpg +0 -0
- package/template/assets/images/delivery-types/eat_in.jpg +0 -0
- package/template/assets/images/delivery-types/pickup.jpg +0 -0
- package/template/assets/images/driver-signup-background.png +0 -0
- package/template/assets/images/driver-signup-hero.png +0 -0
- package/template/assets/images/driver_congratulation_approval.png +0 -0
- package/template/assets/images/driver_congratulation_no_approval.png +0 -0
- package/template/assets/images/driver_signup.png +0 -0
- package/template/assets/images/home-hero.jpg +0 -0
- package/template/assets/images/loyalty_level.png +0 -0
- package/template/assets/images/mastercard.png +0 -0
- package/template/assets/images/not-found.svg +94 -1
- package/template/assets/images/not-network.svg +226 -1
- package/template/assets/images/visa.png +0 -0
- package/template/components/HelmetTags/index.js +5 -4
- package/template/components/ListenPageChanges/index.js +25 -12
- package/template/components/ScrollToTop/index.js +4 -0
- package/template/config.js +14 -0
- package/template/config.json +1 -0
- package/template/helmetdata.json +91 -28
- package/template/pages/AddressList/index.js +34 -0
- package/template/pages/AddressList/styles.js +43 -0
- package/template/pages/BusinessListingSearch/index.js +106 -0
- package/template/pages/BusinessProductsList/index.js +152 -29
- package/template/pages/BusinessesList/index.js +17 -6
- package/template/pages/Checkout/index.js +14 -4
- package/template/pages/Favorite/index.js +12 -0
- package/template/pages/Help/index.js +7 -2
- package/template/pages/Home/index.js +58 -36
- package/template/pages/Home/styles.js +14 -0
- package/template/pages/MessagesList/index.js +19 -0
- package/template/pages/MultiCheckout/index.js +26 -0
- package/template/pages/MultiOrdersDetails/index.js +21 -0
- package/template/pages/MyOrders/index.js +87 -3
- package/template/pages/OrderDetails/index.js +12 -2
- package/template/pages/Profile/index.js +16 -3
- package/template/pages/Promotions/index.js +13 -0
- package/template/pages/ResetPassword/index.js +15 -9
- package/template/pages/SessionsList/index.js +12 -0
- package/template/pages/SignUpBusiness/index.js +12 -0
- package/template/pages/SignUpDriver/index.js +12 -0
- package/template/pages/UserVerification/index.js +12 -0
- package/template/pages/Wallets/index.js +12 -0
- package/template/service-worker.js +72 -0
- package/template/theme.json +27 -51
- package/_bundles/3.ordering-ui.8d3ec9f208550df10621.js +0 -1
- package/_bundles/7.ordering-ui.8d3ec9f208550df10621.js +0 -2
- package/_bundles/ordering-ui.8d3ec9f208550df10621.js +0 -2
- package/template/assets/images/exclamation.svg +0 -3
- package/template/assets/images/order-creating.png +0 -0
- package/template/assets/images/order-sucess.png +0 -0
|
@@ -125,6 +125,7 @@ const CheckoutUI = (props) => {
|
|
|
125
125
|
placing ||
|
|
126
126
|
errorCash ||
|
|
127
127
|
loading ||
|
|
128
|
+
(options?.type === 3 && !(cartState?.cart?.spot_number || cart?.spot_number)) ||
|
|
128
129
|
!cart?.valid_maximum ||
|
|
129
130
|
(!cart?.valid_minimum && !(cart?.discount_type === 1 && cart?.discount_rate === 100)) ||
|
|
130
131
|
// (((placeSpotTypes.includes(options?.type) && !cart?.place) && hasBusinessPlaces)) ||
|
|
@@ -507,11 +508,11 @@ const CheckoutUI = (props) => {
|
|
|
507
508
|
</WarningText>
|
|
508
509
|
)}
|
|
509
510
|
|
|
510
|
-
{
|
|
511
|
+
{options?.type === 3 && !cart?.spot_number && (
|
|
511
512
|
<WarningText>
|
|
512
513
|
{t('WARNING_PLACE_SPOT', 'Please, select your spot to place order.')}
|
|
513
514
|
</WarningText>
|
|
514
|
-
)}
|
|
515
|
+
)}
|
|
515
516
|
|
|
516
517
|
{options.type === 1 &&
|
|
517
518
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
@@ -624,19 +625,26 @@ export const Checkout = (props) => {
|
|
|
624
625
|
|
|
625
626
|
const getOrder = async (cartId) => {
|
|
626
627
|
try {
|
|
627
|
-
|
|
628
|
+
let result = {}
|
|
629
|
+
const cart = cartsWithProducts.find(cart => cart.uuid === cartId)
|
|
628
630
|
const userCustomer = JSON.parse(window.localStorage.getItem('user-customer'))
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
631
|
+
if (cart && !userCustomer) {
|
|
632
|
+
result = { ...cart }
|
|
633
|
+
} else {
|
|
634
|
+
setCartState({ ...cartState, loading: true })
|
|
635
|
+
const url = userCustomer
|
|
636
|
+
? `${ordering.root}/carts/${cartId}?user_id=${userCustomer?.id}`
|
|
637
|
+
: `${ordering.root}/carts/${cartId}`
|
|
638
|
+
const response = await fetch(url, {
|
|
639
|
+
method: 'GET',
|
|
640
|
+
headers: {
|
|
641
|
+
'Content-Type': 'application/json',
|
|
642
|
+
Authorization: `Bearer ${token}`
|
|
643
|
+
}
|
|
644
|
+
})
|
|
645
|
+
const content = await response.json()
|
|
646
|
+
result = content.result
|
|
647
|
+
}
|
|
640
648
|
|
|
641
649
|
if (result.status === 1 && result.order?.uuid) {
|
|
642
650
|
handleOrderRedirect(result.order.uuid)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
|
-
import { useLanguage, useOrder } from 'ordering-components-external'
|
|
2
|
+
import { useLanguage, useOrder, useOrderingTheme } from 'ordering-components-external'
|
|
3
3
|
import { FavoriteList } from '../FavoriteList'
|
|
4
4
|
import { Tabs } from '../../styles/Tabs'
|
|
5
5
|
import {
|
|
@@ -12,7 +12,9 @@ import {
|
|
|
12
12
|
|
|
13
13
|
export const Favorite = (props) => {
|
|
14
14
|
const [, t] = useLanguage()
|
|
15
|
+
const [orderingTheme] = useOrderingTheme()
|
|
15
16
|
const [orderState] = useOrder()
|
|
17
|
+
const layout = orderingTheme?.theme?.favorite?.components?.layout?.type || 'original'
|
|
16
18
|
|
|
17
19
|
const [tabSelected, setTabSelected] = useState('businesses')
|
|
18
20
|
|
|
@@ -44,6 +46,15 @@ export const Favorite = (props) => {
|
|
|
44
46
|
{item?.name}
|
|
45
47
|
</Tab>
|
|
46
48
|
))}
|
|
49
|
+
{layout === 'appointments' && (
|
|
50
|
+
<Tab
|
|
51
|
+
borderBottom
|
|
52
|
+
active={tabSelected === 'professionals'}
|
|
53
|
+
onClick={() => setTabSelected('professionals')}
|
|
54
|
+
>
|
|
55
|
+
{t('PROFESSIONALS', 'Professionals')}
|
|
56
|
+
</Tab>
|
|
57
|
+
)}
|
|
47
58
|
</Tabs>
|
|
48
59
|
</TabsContainer>
|
|
49
60
|
<ContentWrapper>
|
|
@@ -70,6 +81,13 @@ export const Favorite = (props) => {
|
|
|
70
81
|
isOrder
|
|
71
82
|
/>
|
|
72
83
|
)}
|
|
84
|
+
{tabSelected === 'professionals' && (
|
|
85
|
+
<FavoriteList
|
|
86
|
+
favoriteURL='favorite_users'
|
|
87
|
+
originalURL='users'
|
|
88
|
+
isProfessional
|
|
89
|
+
/>
|
|
90
|
+
)}
|
|
73
91
|
</ContentWrapper>
|
|
74
92
|
</FavoritesContainer>
|
|
75
93
|
{props.afterComponents?.map((AfterComponent, i) => (
|
|
@@ -11,6 +11,7 @@ import { SingleProductCard } from '../SingleProductCard'
|
|
|
11
11
|
import { useTheme } from 'styled-components'
|
|
12
12
|
import { SingleOrderCard } from '../SingleOrderCard'
|
|
13
13
|
import { checkSiteUrl } from '../../../../../utils'
|
|
14
|
+
import { SingleProfessionalCard } from '../SingleProfessionalCard'
|
|
14
15
|
|
|
15
16
|
import {
|
|
16
17
|
Container,
|
|
@@ -29,6 +30,7 @@ const FavoriteListUI = (props) => {
|
|
|
29
30
|
isBusiness,
|
|
30
31
|
isProduct,
|
|
31
32
|
isOrder,
|
|
33
|
+
isProfessional,
|
|
32
34
|
handleReorder,
|
|
33
35
|
reorderState
|
|
34
36
|
} = props
|
|
@@ -323,6 +325,28 @@ const FavoriteListUI = (props) => {
|
|
|
323
325
|
)}
|
|
324
326
|
</>
|
|
325
327
|
)}
|
|
328
|
+
{isProfessional && (
|
|
329
|
+
<>
|
|
330
|
+
{
|
|
331
|
+
!favoriteList?.loading && favoriteList?.favorites?.map((professional, i) => (
|
|
332
|
+
<SingleProfessionalCard
|
|
333
|
+
key={i}
|
|
334
|
+
professional={professional}
|
|
335
|
+
handleUpdateProfessionals={handleUpdateFavoriteList}
|
|
336
|
+
/>
|
|
337
|
+
))
|
|
338
|
+
}
|
|
339
|
+
{favoriteList?.loading && (
|
|
340
|
+
[...Array(5).keys()].map(i => (
|
|
341
|
+
<SingleProfessionalCard
|
|
342
|
+
key={i}
|
|
343
|
+
professional={{}}
|
|
344
|
+
isSkeleton
|
|
345
|
+
/>
|
|
346
|
+
))
|
|
347
|
+
)}
|
|
348
|
+
</>
|
|
349
|
+
)}
|
|
326
350
|
{!favoriteList?.loading && pagination?.totalPages && pagination?.currentPage < pagination?.totalPages && (
|
|
327
351
|
<ReadMoreCard>
|
|
328
352
|
<Button
|
|
@@ -24,7 +24,8 @@ import {
|
|
|
24
24
|
AddressMenu,
|
|
25
25
|
MomentMenu,
|
|
26
26
|
FarAwayMessage,
|
|
27
|
-
Divider
|
|
27
|
+
Divider,
|
|
28
|
+
AddressFormWrapper
|
|
28
29
|
} from './styles'
|
|
29
30
|
import { useWindowSize } from '../../../../../hooks/useWindowSize'
|
|
30
31
|
import { useOnlineStatus } from '../../../../../hooks/useOnlineStatus'
|
|
@@ -433,13 +434,15 @@ export const Header = (props) => {
|
|
|
433
434
|
isCustomerMode={isCustomerMode}
|
|
434
435
|
/>
|
|
435
436
|
) : (
|
|
436
|
-
<
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
437
|
+
<AddressFormWrapper>
|
|
438
|
+
<AddressForm
|
|
439
|
+
useValidationFileds
|
|
440
|
+
address={orderState?.options?.address || {}}
|
|
441
|
+
onCancel={() => setModalIsOpen(false)}
|
|
442
|
+
onSaveAddress={() => setModalIsOpen(false)}
|
|
443
|
+
isCustomerMode={isCustomerMode}
|
|
444
|
+
/>
|
|
445
|
+
</AddressFormWrapper>
|
|
443
446
|
)
|
|
444
447
|
)}
|
|
445
448
|
{modalSelected === 'moment' && (
|
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
ModalTitle,
|
|
8
8
|
ModalIcon,
|
|
9
9
|
ModalHeader,
|
|
10
|
-
ModalBackHeader
|
|
10
|
+
ModalBackHeader,
|
|
11
|
+
ModalIconWrapper
|
|
11
12
|
} from './styles'
|
|
12
13
|
|
|
13
14
|
import { Button } from '../../styles/Buttons'
|
|
@@ -68,11 +69,13 @@ const ModalUI = (props) => {
|
|
|
68
69
|
<ModalBackHeader />
|
|
69
70
|
)}
|
|
70
71
|
{!hideCloseDefault && (
|
|
71
|
-
<
|
|
72
|
-
{
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
<ModalIconWrapper>
|
|
73
|
+
<ModalIcon isProductForm={isProductForm}>
|
|
74
|
+
{
|
|
75
|
+
(authModal && onRemove) ? <MdClose onClick={() => onRemove()} /> : <MdClose onClick={() => onClose()} />
|
|
76
|
+
}
|
|
77
|
+
</ModalIcon>
|
|
78
|
+
</ModalIconWrapper>
|
|
76
79
|
)}
|
|
77
80
|
<ModalHeader>
|
|
78
81
|
{title && (
|
|
@@ -86,7 +86,7 @@ export const ModalActions = styled.div`
|
|
|
86
86
|
`
|
|
87
87
|
export const ModalHeader = styled.div`
|
|
88
88
|
display: flex;
|
|
89
|
-
margin-top:
|
|
89
|
+
margin-top: 40px;
|
|
90
90
|
|
|
91
91
|
@media(min-width: 450px){
|
|
92
92
|
margin-top: 0;
|
|
@@ -172,3 +172,17 @@ export const ModalBackHeader = styled.div`
|
|
|
172
172
|
display: none;
|
|
173
173
|
}
|
|
174
174
|
`
|
|
175
|
+
export const ModalIconWrapper = styled.div`
|
|
176
|
+
position: fixed;
|
|
177
|
+
top: 0;
|
|
178
|
+
left: 0;
|
|
179
|
+
width: 100%;
|
|
180
|
+
background-color: ${props => props.theme.colors.backgroundPage};
|
|
181
|
+
z-index: 100;
|
|
182
|
+
height: 70px;
|
|
183
|
+
|
|
184
|
+
@media (min-width: 450px) {
|
|
185
|
+
position: initial;
|
|
186
|
+
height: initial;
|
|
187
|
+
}
|
|
188
|
+
`
|
|
@@ -48,7 +48,7 @@ export const MyOrders = (props) => {
|
|
|
48
48
|
{ key: 'products', value: t('PRODUCTS', 'Products') }
|
|
49
49
|
]
|
|
50
50
|
|
|
51
|
-
const notOrderOptions = ['business', 'products']
|
|
51
|
+
const notOrderOptions = ['business', 'products', 'professionals']
|
|
52
52
|
const allEmpty = (isEmptyActive && isEmptyPast && isEmptyPreorder) || ((isEmptyBusinesses || businessOrderIds?.length === 0) && hideOrders)
|
|
53
53
|
|
|
54
54
|
const handleChangeFilter = (key) => {
|
|
@@ -87,6 +87,15 @@ export const MyOrders = (props) => {
|
|
|
87
87
|
{option?.value}
|
|
88
88
|
</Tab>
|
|
89
89
|
))}
|
|
90
|
+
{layout === 'appointments' && (
|
|
91
|
+
<Tab
|
|
92
|
+
onClick={() => setSelectedOption('professionals')}
|
|
93
|
+
active={selectedOption === 'professionals'}
|
|
94
|
+
borderBottom
|
|
95
|
+
>
|
|
96
|
+
{t('PROFESSIONALS', 'Professionals')}
|
|
97
|
+
</Tab>
|
|
98
|
+
)}
|
|
90
99
|
</Tabs>
|
|
91
100
|
</MyOrdersMenuContainer>
|
|
92
101
|
)}
|
|
@@ -165,6 +174,7 @@ export const MyOrders = (props) => {
|
|
|
165
174
|
horizontal
|
|
166
175
|
isBusiness={selectedOption === 'business'}
|
|
167
176
|
isProducts={selectedOption === 'products'}
|
|
177
|
+
isProfessionals={selectedOption === 'professionals'}
|
|
168
178
|
activeOrders
|
|
169
179
|
pastOrders
|
|
170
180
|
preOrders
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { useOrder } from 'ordering-components-external'
|
|
3
3
|
import { BusinessController } from '../../BusinessController'
|
|
4
4
|
import { AutoScroll } from '../../AutoScroll'
|
|
5
5
|
import { BusinessList, BusinessListWrapper } from './styles'
|
|
6
6
|
import { useWindowSize } from '../../../../../../hooks/useWindowSize'
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
export const PreviousBusinessOrdered = (props) => {
|
|
8
9
|
const {
|
|
9
|
-
businessesList,
|
|
10
10
|
isCustomLayout,
|
|
11
11
|
isCustomerMode,
|
|
12
|
-
setBusinessLoading,
|
|
13
12
|
onRedirectPage,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
handleUpdateBusinessList
|
|
13
|
+
handleUpdateBusinessList,
|
|
14
|
+
businesses
|
|
17
15
|
} = props
|
|
18
16
|
|
|
19
17
|
const [orderState] = useOrder()
|
|
@@ -21,20 +19,13 @@ export const PreviousBusinessOrderedUI = (props) => {
|
|
|
21
19
|
const onBusinessClick = (business) => {
|
|
22
20
|
onRedirectPage({ page: 'business', params: { store: business.slug } })
|
|
23
21
|
}
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
if (businessesList?.loading && businessesList?.businesses?.length === 0) {
|
|
26
|
-
setBusinessLoading(true)
|
|
27
|
-
} else {
|
|
28
|
-
setBusinessLoading(false)
|
|
29
|
-
}
|
|
30
|
-
}, [businessesList?.loading])
|
|
31
22
|
|
|
32
23
|
return (
|
|
33
|
-
<BusinessListWrapper isLoading={
|
|
24
|
+
<BusinessListWrapper isLoading={businesses?.loading}>
|
|
34
25
|
<BusinessList>
|
|
35
26
|
<AutoScroll scrollId='searchlistorder'>
|
|
36
27
|
{
|
|
37
|
-
|
|
28
|
+
businesses?.result?.map((business, i) => (
|
|
38
29
|
<BusinessController
|
|
39
30
|
key={business.id}
|
|
40
31
|
className='card'
|
|
@@ -63,15 +54,3 @@ export const PreviousBusinessOrderedUI = (props) => {
|
|
|
63
54
|
</BusinessListWrapper>
|
|
64
55
|
)
|
|
65
56
|
}
|
|
66
|
-
|
|
67
|
-
export const PreviousBusinessOrdered = (props) => {
|
|
68
|
-
const previousBusinessOrderedController = {
|
|
69
|
-
...props,
|
|
70
|
-
UIComponent: PreviousBusinessOrderedUI,
|
|
71
|
-
paginationSettings: { initialPage: 1, pageSize: 50, controlType: 'infinity' }
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return (
|
|
75
|
-
<BusinessListController {...previousBusinessOrderedController} />
|
|
76
|
-
)
|
|
77
|
-
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
ProductsList,
|
|
5
|
+
ProductsListContainer
|
|
6
|
+
} from './styles'
|
|
7
|
+
|
|
8
|
+
import { AutoScroll } from '../../AutoScroll'
|
|
9
|
+
import { SingleProfessionalCard } from '../../SingleProfessionalCard'
|
|
10
|
+
|
|
11
|
+
export const PreviousProfessionalOrdered = (props) => {
|
|
12
|
+
const {
|
|
13
|
+
professionals,
|
|
14
|
+
handleUpdateProfessionals
|
|
15
|
+
} = props
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<ProductsListContainer isLoading={professionals?.length < 1}>
|
|
19
|
+
<ProductsList>
|
|
20
|
+
<AutoScroll>
|
|
21
|
+
{professionals?.map(professional => (
|
|
22
|
+
<SingleProfessionalCard
|
|
23
|
+
key={professional?.id}
|
|
24
|
+
professional={professional}
|
|
25
|
+
handleUpdateProfessionals={handleUpdateProfessionals}
|
|
26
|
+
/>
|
|
27
|
+
))}
|
|
28
|
+
</AutoScroll>
|
|
29
|
+
</ProductsList>
|
|
30
|
+
</ProductsListContainer>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components'
|
|
2
|
+
|
|
3
|
+
export const ProductsList = styled.div`
|
|
4
|
+
display: flex;
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
|
|
7
|
+
#autoscroll {
|
|
8
|
+
> div {
|
|
9
|
+
width: 300px;
|
|
10
|
+
max-width: 300px;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@media(min-width: 480px){
|
|
15
|
+
#autoscroll {
|
|
16
|
+
> div {
|
|
17
|
+
width: 350px;
|
|
18
|
+
max-width: 350px;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`
|
|
23
|
+
|
|
24
|
+
export const ProductsListContainer = styled.div`
|
|
25
|
+
margin-top: 10px;
|
|
26
|
+
display: flex;
|
|
27
|
+
overflow: scroll hidden;
|
|
28
|
+
::-webkit-scrollbar {
|
|
29
|
+
width: 6px;
|
|
30
|
+
height: 6px;
|
|
31
|
+
}
|
|
32
|
+
${({ isLoading }) => isLoading && css`
|
|
33
|
+
::-webkit-scrollbar {
|
|
34
|
+
width: 0px;
|
|
35
|
+
height: 0px;
|
|
36
|
+
}
|
|
37
|
+
`}
|
|
38
|
+
`
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
2
|
import Skeleton from 'react-loading-skeleton'
|
|
3
3
|
import moment from 'moment'
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { useLanguage, useOrder, useEvent, OrderList } from 'ordering-components-external'
|
|
6
5
|
import { HorizontalOrdersLayout } from '../HorizontalOrdersLayout'
|
|
7
6
|
import { VerticalOrdersLayout } from '../../../../../components/VerticalOrdersLayout'
|
|
8
7
|
import { NotFoundSource } from '../../../../../components/NotFoundSource'
|
|
@@ -28,6 +27,7 @@ import { BusinessController } from '../BusinessController'
|
|
|
28
27
|
import { SingleProductCard } from '../SingleProductCard'
|
|
29
28
|
import { useWindowSize } from '../../../../../hooks/useWindowSize'
|
|
30
29
|
import { Alert } from '../Confirm'
|
|
30
|
+
import { PreviousProfessionalOrdered } from './PreviousProfessionalOrdered'
|
|
31
31
|
|
|
32
32
|
const OrdersOptionUI = (props) => {
|
|
33
33
|
const {
|
|
@@ -56,13 +56,17 @@ const OrdersOptionUI = (props) => {
|
|
|
56
56
|
handleReorder,
|
|
57
57
|
isBusiness,
|
|
58
58
|
isProducts,
|
|
59
|
+
isProfessionals,
|
|
59
60
|
businessOrderIds,
|
|
60
61
|
products,
|
|
61
62
|
hideOrders,
|
|
62
63
|
onProductRedirect,
|
|
63
64
|
businessesSearchList,
|
|
64
65
|
handleUpdateProducts,
|
|
65
|
-
onBusinessClick
|
|
66
|
+
onBusinessClick,
|
|
67
|
+
professionals,
|
|
68
|
+
handleUpdateProfessionals,
|
|
69
|
+
businesses
|
|
66
70
|
} = props
|
|
67
71
|
|
|
68
72
|
const [, t] = useLanguage()
|
|
@@ -82,7 +86,6 @@ const OrdersOptionUI = (props) => {
|
|
|
82
86
|
: orders.length > 0
|
|
83
87
|
|
|
84
88
|
const [loadingOrders, setLoadingOrders] = useState(true)
|
|
85
|
-
const [businessLoading, setBusinessLoading] = useState(true)
|
|
86
89
|
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
87
90
|
const closeOrderModal = (e) => {
|
|
88
91
|
const outsideModal = !window.document.getElementById('app-modals') ||
|
|
@@ -94,7 +97,7 @@ const OrdersOptionUI = (props) => {
|
|
|
94
97
|
}
|
|
95
98
|
}
|
|
96
99
|
|
|
97
|
-
const showSkeletons = (!isBusiness && !isProducts && loading) || (
|
|
100
|
+
const showSkeletons = (!isBusiness && !isProducts && loading) || (businesses?.loading && isBusiness) || (products?.length === 0 && isProducts && ((!businessesSearchList && loading) || businessesSearchList?.loading))
|
|
98
101
|
|
|
99
102
|
const getOrderStatus = (s) => {
|
|
100
103
|
const status = parseInt(s)
|
|
@@ -222,8 +225,7 @@ const OrdersOptionUI = (props) => {
|
|
|
222
225
|
)}
|
|
223
226
|
{isBusiness && businessOrderIds?.length > 0 && (
|
|
224
227
|
<PreviousBusinessOrdered
|
|
225
|
-
|
|
226
|
-
setBusinessLoading={setBusinessLoading}
|
|
228
|
+
businesses={businesses}
|
|
227
229
|
onRedirectPage={onRedirectPage}
|
|
228
230
|
isLoadingOrders={loading}
|
|
229
231
|
/>
|
|
@@ -238,9 +240,16 @@ const OrdersOptionUI = (props) => {
|
|
|
238
240
|
/>
|
|
239
241
|
)}
|
|
240
242
|
|
|
241
|
-
{
|
|
243
|
+
{isProfessionals && (
|
|
244
|
+
<PreviousProfessionalOrdered
|
|
245
|
+
professionals={professionals}
|
|
246
|
+
handleUpdateProfessionals={handleUpdateProfessionals}
|
|
247
|
+
/>
|
|
248
|
+
)}
|
|
249
|
+
|
|
250
|
+
{(isCustomLayout ? (loadingOrders || loading || businesses?.loading) : showSkeletons) && (
|
|
242
251
|
<>
|
|
243
|
-
{(
|
|
252
|
+
{(businesses?.loading && isBusiness) ? (
|
|
244
253
|
<BusinessControllerSkeleton>
|
|
245
254
|
{[...Array(3).keys()].map((item, i) => (
|
|
246
255
|
<BusinessController
|
|
@@ -640,15 +640,15 @@ const ProductOptionsUI = (props) => {
|
|
|
640
640
|
<div className='price-amount-block'>
|
|
641
641
|
<div className='price'>
|
|
642
642
|
<h4>{productCart.total && parsePrice(productCart.total)}</h4>
|
|
643
|
-
{product?.minimum_per_order && productCart?.quantity
|
|
644
|
-
{product?.maximum_per_order && productCart?.quantity
|
|
643
|
+
{product?.minimum_per_order && productCart?.quantity <= product?.minimum_per_order && productCart?.quantity !== 1 && <span>{t('MINIMUM_TO_ORDER', 'Minimum _number_ to order').replace('_number_', product?.minimum_per_order)}</span>}
|
|
644
|
+
{product?.maximum_per_order && productCart?.quantity >= product?.maximum_per_order && <span>{t('MAXIMUM_TO_ORDER', 'Max. _number_ to order'.replace('_number_', product?.maximum_per_order))}</span>}
|
|
645
645
|
</div>
|
|
646
646
|
{
|
|
647
647
|
productCart && !isSoldOut && maxProductQuantity > 0 && (
|
|
648
648
|
<div className={isHaveWeight ? 'incdec-control show-weight-unit' : 'incdec-control'}>
|
|
649
649
|
<FiMinusCircle
|
|
650
650
|
onClick={decrement}
|
|
651
|
-
className={`${productCart.quantity === 1 || !productCart.quantity || isSoldOut ? 'disabled' : ''}`}
|
|
651
|
+
className={`${productCart.quantity === 1 || !productCart.quantity || isSoldOut || (productCart?.quantity <= product?.minimum_per_order) ? 'disabled' : ''}`}
|
|
652
652
|
/>
|
|
653
653
|
{
|
|
654
654
|
qtyBy?.pieces && (
|
|
@@ -669,7 +669,7 @@ const ProductOptionsUI = (props) => {
|
|
|
669
669
|
)}
|
|
670
670
|
<FiPlusCircle
|
|
671
671
|
onClick={increment}
|
|
672
|
-
className={`${maxProductQuantity <= 0 || productCart.quantity >= maxProductQuantity || isSoldOut ? 'disabled' : ''}`}
|
|
672
|
+
className={`${maxProductQuantity <= 0 || productCart.quantity >= maxProductQuantity || (productCart.quantity >= product?.maximum_per_order && product?.maximum_per_order) || isSoldOut ? 'disabled' : ''}`}
|
|
673
673
|
/>
|
|
674
674
|
{isHaveWeight && (
|
|
675
675
|
<WeightUnitSwitch>
|
|
@@ -817,7 +817,7 @@ const ProductOptionsUI = (props) => {
|
|
|
817
817
|
export const ProductForm = (props) => {
|
|
818
818
|
const productOptionsProps = {
|
|
819
819
|
...props,
|
|
820
|
-
productCart: { quantity: props?.product?.minimum_per_order || 1 },
|
|
820
|
+
productCart: { quantity: props?.product?.maximum_per_order || props?.product?.minimum_per_order || 1 },
|
|
821
821
|
UIComponent: ProductOptionsUI
|
|
822
822
|
}
|
|
823
823
|
|