ordering-ui-admin-external 1.30.2 → 1.30.3

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 (53) hide show
  1. package/_bundles/{ordering-ui-admin.6be018fe653b04c6fa85.js → ordering-ui-admin.78d273d2999264e3e020.js} +2 -2
  2. package/_modules/components/BusinessIntelligence/AnalyticsOrdersAcceptSpend/index.js +3 -2
  3. package/_modules/components/BusinessIntelligence/AnalyticsOrdersAcceptSpend/styles.js +2 -2
  4. package/_modules/components/BusinessIntelligence/AnalyticsSpendList/index.js +3 -2
  5. package/_modules/components/BusinessIntelligence/AnalyticsSpendList/styles.js +2 -2
  6. package/_modules/components/BusinessIntelligence/AnalyticsSpendTimes/index.js +11 -11
  7. package/_modules/components/Orders/BusinessesSelector/styles.js +1 -1
  8. package/_modules/components/Orders/CountryFilter/styles.js +1 -1
  9. package/_modules/components/Orders/CreateCustomOrder/CustomOrderDetails/index.js +7 -4
  10. package/_modules/components/Orders/CreateCustomOrder/Map/index.js +125 -3
  11. package/_modules/components/Orders/CreateCustomOrder/OrderTypeSelector/index.js +93 -0
  12. package/_modules/components/Orders/CreateCustomOrder/SelectCustomer/index.js +7 -13
  13. package/_modules/components/Orders/CreateCustomOrder/SelectCustomer/styles.js +1 -1
  14. package/_modules/components/Orders/CurrencyFilter/styles.js +1 -1
  15. package/_modules/components/Orders/DateTypeSelector/styles.js +1 -1
  16. package/_modules/components/Orders/DriverMultiSelector/index.js +0 -2
  17. package/_modules/components/Orders/DriverMultiSelector/styles.js +27 -35
  18. package/_modules/components/Orders/DriversGroupTypeSelector/styles.js +1 -1
  19. package/_modules/components/Orders/DriversList/index.js +3 -1
  20. package/_modules/components/Orders/DriversList/styles.js +1 -1
  21. package/_modules/components/Orders/OrderDetails/index.js +32 -0
  22. package/_modules/components/Orders/OrdersFilterGroup/styles.js +2 -2
  23. package/_modules/components/Shared/CitySelector/styles.js +4 -7
  24. package/_modules/components/Shared/InputPhoneNumber/index.js +4 -2
  25. package/_modules/components/Users/UserAddForm/index.js +3 -2
  26. package/_modules/utils/index.js +1 -1
  27. package/package.json +2 -2
  28. package/src/components/BusinessIntelligence/AnalyticsOrdersAcceptSpend/index.js +2 -2
  29. package/src/components/BusinessIntelligence/AnalyticsOrdersAcceptSpend/styles.js +1 -1
  30. package/src/components/BusinessIntelligence/AnalyticsSpendList/index.js +2 -2
  31. package/src/components/BusinessIntelligence/AnalyticsSpendList/styles.js +1 -1
  32. package/src/components/BusinessIntelligence/AnalyticsSpendTimes/index.js +4 -4
  33. package/src/components/Orders/BusinessesSelector/styles.js +1 -1
  34. package/src/components/Orders/CountryFilter/styles.js +1 -1
  35. package/src/components/Orders/CreateCustomOrder/CustomOrderDetails/index.js +6 -4
  36. package/src/components/Orders/CreateCustomOrder/Map/index.js +82 -3
  37. package/src/components/Orders/CreateCustomOrder/OrderTypeSelector/index.js +79 -0
  38. package/src/components/Orders/CreateCustomOrder/SelectCustomer/index.js +7 -10
  39. package/src/components/Orders/CreateCustomOrder/SelectCustomer/styles.js +2 -0
  40. package/src/components/Orders/CurrencyFilter/styles.js +1 -1
  41. package/src/components/Orders/DateTypeSelector/styles.js +1 -1
  42. package/src/components/Orders/DriverMultiSelector/index.js +1 -2
  43. package/src/components/Orders/DriverMultiSelector/styles.js +1 -9
  44. package/src/components/Orders/DriversGroupTypeSelector/styles.js +1 -1
  45. package/src/components/Orders/DriversList/index.js +1 -0
  46. package/src/components/Orders/DriversList/styles.js +5 -1
  47. package/src/components/Orders/OrderDetails/index.js +21 -1
  48. package/src/components/Orders/OrdersFilterGroup/styles.js +4 -0
  49. package/src/components/Shared/CitySelector/styles.js +1 -5
  50. package/src/components/Shared/InputPhoneNumber/index.js +4 -2
  51. package/src/components/Users/UserAddForm/index.js +3 -2
  52. package/src/utils/index.js +1 -1
  53. /package/_bundles/{ordering-ui-admin.6be018fe653b04c6fa85.js.LICENSE.txt → ordering-ui-admin.78d273d2999264e3e020.js.LICENSE.txt} +0 -0
@@ -0,0 +1,79 @@
1
+ import React, { useState } from 'react'
2
+ import { useLanguage, useConfig, OrderTypeControl } from 'ordering-components-admin-external'
3
+ import { DefaultSelect as Select } from '../../../../styles'
4
+
5
+ import {
6
+ SelectWrapper,
7
+ Option
8
+ } from './styles'
9
+
10
+ const OrderTypeSelectorUI = (props) => {
11
+ const {
12
+ typeSelected,
13
+ defaultValue,
14
+ orderTypes,
15
+ handleChangeOrderType
16
+ } = props
17
+
18
+ const [, t] = useLanguage()
19
+ const [configState] = useConfig()
20
+
21
+ const configTypes = configState?.configs?.order_types_allowed?.value.split('|').map(value => Number(value)) || []
22
+ const defaultType = configTypes?.includes(typeSelected) ? null : configTypes?.[0]
23
+
24
+ const [searchValue, setSearchValue] = useState('')
25
+
26
+ return (
27
+ <SelectWrapper>
28
+ <p>{t('HOW_WILL_YOU_DELIVERY_TYPE', 'How will you delivery type?')}</p>
29
+ <Select
30
+ placeholder={<Option>{t('SELECT_DELIVERY_TYPE', 'Select delivery type')}</Option>}
31
+ options={configTypes
32
+ ? orderTypes.filter(type => configTypes?.includes(type.value)).filter(type => type.name.toLocaleLowerCase().includes(searchValue.toLocaleLowerCase()))
33
+ : orderTypes.filter(type => type.name.toLocaleLowerCase().includes(searchValue.toLocaleLowerCase()))}
34
+ defaultValue={defaultType || typeSelected || defaultValue}
35
+ onChange={(orderType) => handleChangeOrderType(orderType)}
36
+ isShowSearchBar
37
+ searchValue={searchValue}
38
+ handleChangeSearch={setSearchValue}
39
+ />
40
+ </SelectWrapper>
41
+ )
42
+ }
43
+
44
+ export const OrderTypeSelector = (props) => {
45
+ const [, t] = useLanguage()
46
+
47
+ const orderTypeProps = {
48
+ ...props,
49
+ UIComponent: OrderTypeSelectorUI,
50
+ orderTypes: props.orderTypes || [
51
+ {
52
+ value: 1,
53
+ name: t('DELIVERY', 'Delivery'),
54
+ content: <Option>{t('DELIVERY', 'Delivery')}</Option>
55
+ },
56
+ {
57
+ value: 2,
58
+ name: t('PICKUP', 'Pickup'),
59
+ content: <Option>{t('PICKUP', 'Pickup')}</Option>
60
+ },
61
+ {
62
+ value: 3,
63
+ name: t('EAT_IN', 'Eat in'),
64
+ content: <Option>{t('EAT_IN', 'Eat in')}</Option>
65
+ },
66
+ {
67
+ value: 4,
68
+ name: t('CURBSIDE', 'Curbside'),
69
+ content: <Option>{t('CURBSIDE', 'Curbside')}</Option>
70
+ },
71
+ {
72
+ value: 5,
73
+ name: t('DRIVE_THRU', 'Drive thru'),
74
+ content: <Option>{t('DRIVE_THRU', 'Drive thru')}</Option>
75
+ }
76
+ ]
77
+ }
78
+ return <OrderTypeControl {...orderTypeProps} />
79
+ }
@@ -1,13 +1,13 @@
1
1
  import React, { useEffect, useState } from 'react'
2
- import { useLanguage, useUtils, useConfig, useCustomer } from 'ordering-components-admin-external'
2
+ import { useLanguage, useUtils, useCustomer } from 'ordering-components-admin-external'
3
3
  import { UserAddForm } from '../../../Users'
4
4
  import { AddressList } from '../../../Delivery'
5
- import { findExitingCountryPhoneCode } from '../../../../utils'
6
5
  import { Dot, HouseDoor } from 'react-bootstrap-icons'
7
6
  import FaUserAlt from '@meronex/icons/fa/FaUserAlt'
8
7
  import CgSpinnerTwoAlt from '@meronex/icons/cg/CgSpinnerTwoAlt'
9
8
  import { SideBar } from '../../../Shared'
10
9
  import { Button, Input, LinkButton } from '../../../../styles'
10
+ import { findExitingCountryPhoneCode } from '../../../../utils'
11
11
  import {
12
12
  SectionContainer,
13
13
  SearchBarContainer,
@@ -29,12 +29,12 @@ export const SelectCustomer = (props) => {
29
29
  setSelectedUser,
30
30
  onChangeNumber,
31
31
  handleParentSidebarMove,
32
- customerAddress
32
+ customerAddress,
33
+ defaultCountryCodeState
33
34
  } = props
34
35
 
35
36
  const [, t] = useLanguage()
36
37
  const [{ optimizeImage }] = useUtils()
37
- const [{ configs }] = useConfig()
38
38
  const [, { setUserCustomer }] = useCustomer()
39
39
 
40
40
  const [searchInputFocus, setSearchInputFocus] = useState(false)
@@ -169,7 +169,7 @@ export const SelectCustomer = (props) => {
169
169
  <Button
170
170
  borderRadius='8px'
171
171
  color='primary'
172
- disabled={openSidebar === 'user_add_form'}
172
+ disabled={openSidebar === 'user_add_form' || defaultCountryCodeState.loading}
173
173
  onClick={() => handleOpenAddForm()}
174
174
  >
175
175
  {t('USERS_REGISTER', 'New user')}
@@ -205,11 +205,8 @@ export const SelectCustomer = (props) => {
205
205
  <UserAddForm
206
206
  isFromCustomOrder
207
207
  hideUserTypeSelector
208
- // defaultPhoneNumber={
209
- // findExitingCountryPhoneCode(configs?.default_country_code?.value?.toUpperCase())
210
- // ? `+${findExitingCountryPhoneCode(configs?.default_country_code?.value?.toUpperCase())} ${selectedUser?.cellphone || selectedUser?.phone || phone}`
211
- // : `+1 ${selectedUser?.cellphone || selectedUser?.phone || phone}`
212
- // }
208
+ defaultCountry={defaultCountryCodeState.code}
209
+ defaultPhoneNumber={(selectedUser?.cellphone || phone) && `+${findExitingCountryPhoneCode(defaultCountryCodeState?.code)} ${selectedUser?.cellphone || phone}`}
213
210
  handleSuccessAdd={onSelectUser}
214
211
  onClose={() => handleCloseSidebar()}
215
212
  />
@@ -13,10 +13,12 @@ export const SectionContainer = styled.div`
13
13
  export const SearchBarContainer = styled.div`
14
14
  display: flex;
15
15
  align-items: center;
16
+ flex-wrap: wrap;
16
17
 
17
18
  > button {
18
19
  height: 44px;
19
20
  white-space: nowrap;
21
+ margin: 10px 0;
20
22
  }
21
23
  `
22
24
  export const SearchBarWrapper = styled.div`
@@ -10,7 +10,7 @@ export const Option = styled.div`
10
10
  display: flex;
11
11
  align-items: center;
12
12
  justify-content: space-between;
13
- padding: 10px 15px;
13
+ padding: 10px;
14
14
  column-gap: 20px;
15
15
 
16
16
  svg {
@@ -3,7 +3,7 @@ import styled, { css } from 'styled-components'
3
3
  export const Option = styled.div`
4
4
  display: flex;
5
5
  align-items: center;
6
- padding: 5px 15px;
6
+ padding: 5px 10px;
7
7
 
8
8
  svg {
9
9
  margin-right: 5px;
@@ -18,7 +18,6 @@ const DriverMultiSelectorUI = (props) => {
18
18
  const {
19
19
  driversList,
20
20
  defaultValue,
21
- isPhoneView,
22
21
  small,
23
22
  padding,
24
23
  handleChangeDriver,
@@ -51,7 +50,7 @@ const DriverMultiSelectorUI = (props) => {
51
50
  value: driver.id,
52
51
  showDisable: true,
53
52
  content: (
54
- <Option small={small} isPhoneView={isPhoneView} padding={padding}>
53
+ <Option small={small} padding={padding}>
55
54
  <WrapperDriverImage small={small} className='driver-photo'>
56
55
  <DriverImage bgimage={driver.photo || theme.images.icons?.noDriver} small={small} />
57
56
  </WrapperDriverImage>
@@ -5,16 +5,8 @@ export const Option = styled.div`
5
5
  display: flex;
6
6
  align-items: center;
7
7
  color: ${props => props.theme.colors?.headingColor};
8
- padding: ${({ padding }) => padding || '5px 10px'};
8
+ padding: ${({ padding }) => padding || '5px'};
9
9
  white-space: nowrap;
10
- ${({ isPhoneView }) => isPhoneView && css`
11
- width: 100%;
12
- `}
13
- ${({ isRemove }) => isRemove && css`
14
- color: ${props => props.theme.colors.danger};
15
- padding: 3px 10px;
16
- font-size: 14px;
17
- `}
18
10
 
19
11
  img {
20
12
  width: 45px;
@@ -10,7 +10,7 @@ export const Option = styled.div`
10
10
  display: flex;
11
11
  align-items: center;
12
12
  justify-content: space-between;
13
- padding: 10px 15px;
13
+ padding: 10px;
14
14
  column-gap: 20px;
15
15
 
16
16
  svg {
@@ -91,6 +91,7 @@ export const DriversList = (props) => {
91
91
  >
92
92
  {driver?.assigned_orders_count} {t('ORDERS', 'Orders')}
93
93
  </LinkButton>
94
+ <p className='text-red'>{(driver?.busy && `(${t('BUSY', 'Busy')})`)}</p>
94
95
  </div>
95
96
  {driver?.qualification && (
96
97
  <WrapperStar width={getStarWidth(driver?.qualification)} />
@@ -105,7 +105,7 @@ export const DriverInfo = styled.div`
105
105
  svg {
106
106
  margin: 0 5px;
107
107
  }
108
-
108
+
109
109
  p {
110
110
  font-size: 14px;
111
111
  color: ${props => props.theme.colors?.headingColor};
@@ -113,6 +113,10 @@ export const DriverInfo = styled.div`
113
113
  margin: 0px;
114
114
  flex: 1;
115
115
  }
116
+ .text-red {
117
+ margin-left: 2px;
118
+ color: red;
119
+ }
116
120
  }
117
121
  `
118
122
 
@@ -11,7 +11,7 @@ import { OrderDetailsHeader } from '../OrderDetailsHeader'
11
11
  import { OrderBill } from '../OrderBill'
12
12
  import { OrderContactInformation } from '../OrderContactInformation'
13
13
  import { XLg } from 'react-bootstrap-icons'
14
- import { NotFoundSource, Modal } from '../../Shared'
14
+ import { NotFoundSource, Modal, Alert } from '../../Shared'
15
15
  import { IconButton } from '../../../styles'
16
16
  import { OrderToPrint } from '../OrderToPrint'
17
17
  import { OrderToPrintTicket } from '../OrderToPrintTicket'
@@ -72,6 +72,8 @@ const OrderDetailsUI = (props) => {
72
72
  const [isMenuOpen, setIsMenuOpen] = useState(false)
73
73
  const [extraOpen, setExtraOpen] = useState(false)
74
74
  const [isExpand, setIsExpand] = useState(false)
75
+ const [alertState, setAlertState] = useState({ open: false, content: [] })
76
+
75
77
  const placeSpotEnabled = [3, 4]
76
78
  const {
77
79
  order,
@@ -268,6 +270,14 @@ const OrderDetailsUI = (props) => {
268
270
  }
269
271
  }, [loading])
270
272
 
273
+ useEffect(() => {
274
+ if (!actionStatus?.error) return
275
+ setAlertState({
276
+ open: true,
277
+ content: actionStatus?.error
278
+ })
279
+ }, [actionStatus?.error])
280
+
271
281
  const progressBarObjt = order?.delivery_type && order?.delivery_type === 2 ? getOrderStatuPickUp : getOrderStatus
272
282
 
273
283
  return (
@@ -524,6 +534,16 @@ const OrderDetailsUI = (props) => {
524
534
  getOrderStatus={progressBarObjt}
525
535
  />
526
536
  )}
537
+
538
+ <Alert
539
+ title={t('WEB_APPNAME', 'Ordering')}
540
+ content={alertState.content}
541
+ acceptText={t('ACCEPT', 'Accept')}
542
+ open={alertState.open}
543
+ onClose={() => setAlertState({ open: false, content: [] })}
544
+ onAccept={() => setAlertState({ open: false, content: [] })}
545
+ closeOnBackdrop={false}
546
+ />
527
547
  </Container>
528
548
  )
529
549
  }
@@ -41,6 +41,9 @@ export const WrapperRow = styled.div`
41
41
  border: none;
42
42
  font-size: 14px;
43
43
  border-radius: 8px;
44
+ > div:first-child {
45
+ height: 100%;
46
+ }
44
47
  }
45
48
 
46
49
  .order-status-multi-select {
@@ -189,4 +192,5 @@ export const Option = styled.div`
189
192
  color: ${props => props.theme.colors.secundaryContrast};
190
193
  display: flex;
191
194
  align-items: center;
195
+ padding: 5px;
192
196
  `
@@ -25,11 +25,7 @@ export const Option = styled.div`
25
25
  }
26
26
 
27
27
  ${({ isDefault }) => !isDefault && css`
28
- ${props => props.theme?.rtl ? css`
29
- margin-right: 10px;
30
- ` : css`
31
- margin-left: 10px;
32
- `}
28
+ padding: 10px;
33
29
  `}
34
30
  `
35
31
 
@@ -11,7 +11,9 @@ export const InputPhoneNumber = (props) => {
11
11
  value,
12
12
  setValue,
13
13
  handleIsValid,
14
- disabled
14
+ disabled,
15
+ isUser,
16
+ defaultCountry
15
17
  } = props
16
18
 
17
19
  const [, t] = useLanguage()
@@ -42,7 +44,7 @@ export const InputPhoneNumber = (props) => {
42
44
  <PhoneInput
43
45
  disabled={disabled}
44
46
  placeholder={t('PHONE_NUMBER', 'Phone number')}
45
- defaultCountry={findExitingCode(configs?.default_country_code?.value?.toUpperCase())}
47
+ defaultCountry={defaultCountry ?? findExitingCode(configs?.default_country_code?.value?.toUpperCase())}
46
48
  value={value}
47
49
  displayInitialValueAsLocalNumber
48
50
  onChange={(val) => setValue && setValue(val, isValidPhoneNumber(val))}
@@ -40,6 +40,7 @@ const UserAddFormUI = (props) => {
40
40
  handleChangeUserType,
41
41
  handlechangeImage,
42
42
  handleChangeSwtich,
43
+ defaultCountry,
43
44
  defaultPhoneNumber,
44
45
  isFromCustomOrder,
45
46
  hideUserTypeSelector
@@ -203,7 +204,6 @@ const UserAddFormUI = (props) => {
203
204
 
204
205
  useEffect(() => {
205
206
  if (defaultPhoneNumber) {
206
- setUserPhoneNumber(defaultPhoneNumber)
207
207
  handleChangePhoneNumber(defaultPhoneNumber, true)
208
208
  }
209
209
  }, [defaultPhoneNumber])
@@ -287,12 +287,13 @@ const UserAddFormUI = (props) => {
287
287
  )}
288
288
  {!!showInputPhoneNumber && (
289
289
  <InputPhoneNumber
290
+ defaultCountry={defaultCountry}
290
291
  value={userPhoneNumber}
291
292
  setValue={handleChangePhoneNumber}
292
293
  handleIsValid={setIsValidPhoneNumber}
293
294
  />
294
295
  )}
295
- {!isCheckout && (
296
+ {!isCheckout && !isFromCustomOrder && (
296
297
  <Input
297
298
  type='password'
298
299
  name='password'
@@ -266,7 +266,7 @@ export const convertHMS = (value) => {
266
266
  if (hours < 10) { hours = '0' + hours }
267
267
  if (minutes < 10) { minutes = '0' + minutes }
268
268
  if (seconds < 10) { seconds = '0' + seconds }
269
- return sec < 0 ? '-' : '' + hours + ':' + minutes + ':' + seconds // Return is HH : MM : SS
269
+ return sec < 0 ? '-' : '' + (hours === '00' ? '' : hours + ':') + minutes + ':' + seconds // Return is HH : MM : SS
270
270
  }
271
271
 
272
272
  /**