ordering-ui-admin-external 1.7.4 → 1.8.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.
Files changed (119) hide show
  1. package/_bundles/{ordering-ui-admin.215ac926de72666d96e4.js → ordering-ui-admin.454226bc68f34a7e18d9.js} +2 -2
  2. package/_bundles/{ordering-ui-admin.215ac926de72666d96e4.js.LICENSE.txt → ordering-ui-admin.454226bc68f34a7e18d9.js.LICENSE.txt} +0 -0
  3. package/_modules/components/Delivery/DriversGroupDeliveryDetails/index.js +104 -0
  4. package/_modules/components/Delivery/DriversGroupDeliveryDetails/styles.js +12 -0
  5. package/_modules/components/Delivery/DriversGroupDeliveryZoneInformation/index.js +274 -0
  6. package/_modules/components/Delivery/DriversGroupDeliveryZoneInformation/styles.js +40 -0
  7. package/_modules/components/Delivery/DriversGroupDeliveryZoneList/index.js +119 -0
  8. package/_modules/components/Delivery/DriversGroupDeliveryZoneList/styles.js +54 -0
  9. package/_modules/components/Delivery/DriversGroupDetails/index.js +37 -8
  10. package/_modules/components/Delivery/DriversGroupsDeliveryZoneDetails/index.js +125 -0
  11. package/_modules/components/Delivery/DriversGroupsDeliveryZoneDetails/styles.js +62 -0
  12. package/_modules/components/Delivery/DriversGroupsList/index.js +2 -1
  13. package/_modules/components/Delivery/DriversGroupsListing/index.js +12 -6
  14. package/_modules/components/Home/HomePage/index.js +2 -2
  15. package/_modules/components/MyProducts/AppLayout/index.js +36 -26
  16. package/_modules/components/MyProducts/AppLayout/styles.js +12 -15
  17. package/_modules/components/MyProducts/CallCenterApp/index.js +12 -3
  18. package/_modules/components/MyProducts/CustomerApp/index.js +21 -4
  19. package/_modules/components/MyProducts/DriverApp/index.js +23 -6
  20. package/_modules/components/MyProducts/KioskApp/index.js +21 -5
  21. package/_modules/components/MyProducts/PosApp/index.js +21 -5
  22. package/_modules/components/MyProducts/StoreApp/index.js +21 -5
  23. package/_modules/components/Orders/Messages/index.js +1 -1
  24. package/_modules/components/SidebarMenu/index.js +4 -3
  25. package/_modules/components/SidebarMenu/styles.js +22 -18
  26. package/_modules/components/Stores/BusinessDelete/index.js +99 -0
  27. package/_modules/components/Stores/BusinessDelete/styles.js +19 -0
  28. package/_modules/components/Stores/BusinessDeliveryGroupsDetails/index.js +181 -0
  29. package/_modules/components/Stores/BusinessDeliveryGroupsDetails/styles.js +14 -0
  30. package/_modules/components/Stores/BusinessDeliveryPickupMore/index.js +5 -1
  31. package/_modules/components/Stores/BusinessDeliveryZoneInformation/index.js +34 -12
  32. package/_modules/components/Stores/BusinessDeliveryZoneInformation/styles.js +1 -1
  33. package/_modules/components/Stores/BusinessProductAddForm/index.js +4 -4
  34. package/_modules/components/Stores/BusinessesList/index.js +75 -10
  35. package/_modules/components/Stores/BusinessesList/styles.js +26 -3
  36. package/_modules/components/Stores/BusinessesListing/index.js +19 -4
  37. package/_modules/components/Stores/BusinessesListing/styles.js +10 -3
  38. package/_modules/components/Stores/PaymentOptionMethods/index.js +11 -12
  39. package/_modules/components/Stores/PaymentOptionMethods/styles.js +1 -5
  40. package/_modules/components/Stores/PaymentOptionPaypal/index.js +6 -7
  41. package/_modules/components/Stores/PaymentOptionPaypal/styles.js +1 -5
  42. package/_modules/components/Stores/PaymentOptionSquare/index.js +1 -1
  43. package/_modules/components/Stores/PaymentOptionStripeDirect/index.js +11 -12
  44. package/_modules/components/Stores/PaymentOptionStripeDirect/styles.js +1 -5
  45. package/_modules/components/Stores/PaymethodOptionPaypalExpress/index.js +11 -12
  46. package/_modules/components/Stores/PaymethodOptionPaypalExpress/styles.js +1 -5
  47. package/_modules/components/Stores/PaymethodOptionStripeRedirect/index.js +11 -12
  48. package/_modules/components/Stores/PaymethodOptionStripeRedirect/styles.js +1 -5
  49. package/_modules/components/Stores/SingleBusiness/index.js +37 -19
  50. package/_modules/components/Stores/SingleBusiness/styles.js +20 -3
  51. package/_modules/components/Stores/index.js +7 -0
  52. package/_modules/utils/index.js +33 -2
  53. package/index-template.js +5 -1
  54. package/package.json +2 -2
  55. package/src/components/Delivery/DriversGroupDeliveryDetails/index.js +84 -0
  56. package/src/components/Delivery/DriversGroupDeliveryDetails/styles.js +11 -0
  57. package/src/components/Delivery/DriversGroupDeliveryZoneInformation/index.js +278 -0
  58. package/src/components/Delivery/DriversGroupDeliveryZoneInformation/styles.js +93 -0
  59. package/src/components/Delivery/DriversGroupDeliveryZoneList/index.js +134 -0
  60. package/src/components/Delivery/DriversGroupDeliveryZoneList/styles.js +87 -0
  61. package/src/components/Delivery/DriversGroupDetails/index.js +29 -6
  62. package/src/components/Delivery/DriversGroupsDeliveryZoneDetails/index.js +123 -0
  63. package/src/components/Delivery/DriversGroupsDeliveryZoneDetails/styles.js +125 -0
  64. package/src/components/Delivery/DriversGroupsList/index.js +2 -2
  65. package/src/components/Delivery/DriversGroupsListing/index.js +4 -1
  66. package/src/components/Home/HomePage/index.js +3 -3
  67. package/src/components/MyProducts/AppLayout/index.js +41 -27
  68. package/src/components/MyProducts/AppLayout/styles.js +34 -29
  69. package/src/components/MyProducts/CallCenterApp/index.js +10 -2
  70. package/src/components/MyProducts/CustomerApp/index.js +14 -3
  71. package/src/components/MyProducts/DriverApp/index.js +15 -5
  72. package/src/components/MyProducts/KioskApp/index.js +14 -4
  73. package/src/components/MyProducts/PosApp/index.js +14 -4
  74. package/src/components/MyProducts/StoreApp/index.js +14 -4
  75. package/src/components/Orders/Messages/index.js +1 -1
  76. package/src/components/SidebarMenu/index.js +25 -15
  77. package/src/components/SidebarMenu/styles.js +10 -2
  78. package/src/components/Stores/BusinessDelete/index.js +99 -0
  79. package/src/components/Stores/BusinessDelete/styles.js +40 -0
  80. package/src/components/Stores/BusinessDeliveryGroupsDetails/index.js +127 -0
  81. package/src/components/Stores/BusinessDeliveryGroupsDetails/styles.js +16 -0
  82. package/src/components/Stores/BusinessDeliveryPickupMore/index.js +6 -1
  83. package/src/components/Stores/BusinessDeliveryZoneInformation/index.js +35 -10
  84. package/src/components/Stores/BusinessDeliveryZoneInformation/styles.js +1 -1
  85. package/src/components/Stores/BusinessProductAddForm/index.js +2 -2
  86. package/src/components/Stores/BusinessesList/index.js +83 -10
  87. package/src/components/Stores/BusinessesList/styles.js +52 -0
  88. package/src/components/Stores/BusinessesListing/index.js +27 -8
  89. package/src/components/Stores/BusinessesListing/styles.js +34 -0
  90. package/src/components/Stores/PaymentOptionMethods/index.js +9 -12
  91. package/src/components/Stores/PaymentOptionMethods/styles.js +0 -10
  92. package/src/components/Stores/PaymentOptionPaypal/index.js +9 -12
  93. package/src/components/Stores/PaymentOptionPaypal/styles.js +0 -10
  94. package/src/components/Stores/PaymentOptionSquare/index.js +1 -1
  95. package/src/components/Stores/PaymentOptionStripeDirect/index.js +9 -12
  96. package/src/components/Stores/PaymentOptionStripeDirect/styles.js +0 -10
  97. package/src/components/Stores/PaymethodOptionPaypalExpress/index.js +9 -12
  98. package/src/components/Stores/PaymethodOptionPaypalExpress/styles.js +0 -10
  99. package/src/components/Stores/PaymethodOptionStripeRedirect/index.js +9 -12
  100. package/src/components/Stores/PaymethodOptionStripeRedirect/styles.js +0 -10
  101. package/src/components/Stores/SingleBusiness/index.js +38 -13
  102. package/src/components/Stores/SingleBusiness/styles.js +30 -0
  103. package/src/components/Stores/index.js +2 -0
  104. package/src/utils/index.js +30 -0
  105. package/template/assets/images/myProducts/app-store.png +0 -0
  106. package/template/assets/images/myProducts/driver-app-brand.png +0 -0
  107. package/template/assets/images/myProducts/driver-app-free.png +0 -0
  108. package/template/assets/images/myProducts/multi-store-customer-app.png +0 -0
  109. package/template/assets/images/myProducts/my-callcenter-app-brand.png +0 -0
  110. package/template/assets/images/myProducts/my-callcenter-app-live.png +0 -0
  111. package/template/assets/images/myProducts/my-kiosk-app-brand.png +0 -0
  112. package/template/assets/images/myProducts/my-kiosk-app-live.png +0 -0
  113. package/template/assets/images/myProducts/my-pos-app-brand.png +0 -0
  114. package/template/assets/images/myProducts/my-pos-app-live.png +0 -0
  115. package/template/assets/images/myProducts/ordering-website.png +0 -0
  116. package/template/assets/images/myProducts/play-store.png +0 -0
  117. package/template/assets/images/myProducts/single-store-customer-app.png +0 -0
  118. package/template/assets/images/myProducts/store-app-brand.png +0 -0
  119. package/template/assets/images/myProducts/store-app-free.png +0 -0
@@ -0,0 +1,93 @@
1
+ import styled, { css } from 'styled-components'
2
+
3
+ export const FormContainer = styled.form`
4
+ display: flex;
5
+ flex-direction: column;
6
+ min-height: calc(100% - 130px);
7
+
8
+ > button {
9
+ width: fit-content;
10
+ position: sticky;
11
+ top: 100%;
12
+ margin-top: 30px;
13
+ height: 42px;
14
+ }
15
+ `
16
+ export const TypeSelectWrapper = styled.div`
17
+ .select {
18
+ background: ${props => props.theme.colors.secundary};
19
+ width: 100%;
20
+ border: none;
21
+ font-size: 14px;
22
+ color: ${props => props.theme.colors.headingColor};
23
+ > div:first-child {
24
+ padding-top: 4px;
25
+ padding-bottom: 4px;
26
+ }
27
+ }
28
+ `
29
+ export const WrapperMap = styled.div`
30
+ width: 100%;
31
+ height: 300px;
32
+ display: flex;
33
+ justify-content: center;
34
+ box-sizing: border-box;
35
+ margin: 29px 0 20px 0;
36
+ position: relative;
37
+ > div {
38
+ position: relative !important;
39
+ width: 100% !important;
40
+ height: 100% !important;
41
+ border-radius: 8px;
42
+ }
43
+
44
+ > button {
45
+ position: absolute;
46
+ font-size: 14px;
47
+ padding: 0 5px;
48
+ background: ${props => props.theme.colors?.backgroundPage || '#FFF'};
49
+ top: 10px;
50
+ z-index: 10;
51
+ border: none;
52
+ box-shadow: rgb(0 0 0 / 30%) 0px 1px 4px;
53
+ color: ${props => props.theme.colors.headingColor};
54
+ ${props => props.theme?.rtl ? css`
55
+ right: 10px;
56
+ ` : css`
57
+ left: 10px;
58
+ `}
59
+ &:hover {
60
+ background: #eee;
61
+ }
62
+ }
63
+ `
64
+
65
+ export const ErrorText = styled.div`
66
+ font-size: 14px;
67
+ color: ${props => props.theme.colors.lightGray};
68
+ text-align: center;
69
+ margin: 20px 0;
70
+ `
71
+ export const FormControl = styled.div`
72
+ display: flex;
73
+ flex-direction: column;
74
+ label {
75
+ font-size: 14px;
76
+ margin-bottom: 9px;
77
+ }
78
+ input {
79
+ width: 100%;
80
+ }
81
+ `
82
+ export const Row = styled.div`
83
+ display: flex;
84
+ justify-content: space-between;
85
+ margin-bottom: 29px;
86
+
87
+ > div {
88
+ width: 45%;
89
+ }
90
+ `
91
+ export const KmlButtonWrapper = styled.div`
92
+ margin-bottom: 20px;
93
+ `
@@ -0,0 +1,134 @@
1
+ import React, { useState } from 'react'
2
+ import { useLanguage } from 'ordering-components-admin-external'
3
+ import { DriverGroupDeliveryZoneDetails } from '../DriversGroupsDeliveryZoneDetails'
4
+ import { SideBar } from '../../Shared'
5
+ import { ChevronRight } from 'react-bootstrap-icons'
6
+ import { Checkbox } from '../../../styles'
7
+
8
+ import {
9
+ ZoneContainer,
10
+ DeliveryZonesTable,
11
+ AddDeliveryZoneButton,
12
+ ZoneTbody,
13
+ CheckboxWrapper,
14
+ DeliveryZonesTableWrapper,
15
+ CheckSkeleteon,
16
+ InfoBlock
17
+ } from './styles'
18
+ import Skeleton from 'react-loading-skeleton'
19
+
20
+ export const DriverGroupDeliveryZoneList = (props) => {
21
+ const {
22
+ drivergroup,
23
+ setIsExtendExtraOpen,
24
+ handleSuccessUpdate,
25
+ zoneListState,
26
+ handleChangeZoneState,
27
+ handleChangeAllZoneState,
28
+ handleParentSidebarMove,
29
+ zoneList,
30
+ setZoneList,
31
+ setIsOpenDetails,
32
+ isOpenDetails
33
+ } = props
34
+
35
+ const [, t] = useLanguage()
36
+ const [curZone, setCurZone] = useState(null)
37
+
38
+ const handleCloseOption = () => {
39
+ setIsOpenDetails(false)
40
+ setIsExtendExtraOpen(false)
41
+ setCurZone(null)
42
+ handleParentSidebarMove(0)
43
+ }
44
+
45
+ const handleOpenZone = (e, zone) => {
46
+ const isInvalid = e.target.closest('.zone-enabled')
47
+ if (isInvalid) return
48
+ setCurZone(zone)
49
+ handleParentSidebarMove(500)
50
+ setIsExtendExtraOpen(true)
51
+ setIsOpenDetails(true)
52
+ }
53
+
54
+ return (
55
+ <>
56
+ <ZoneContainer>
57
+ {zoneList.loading ? (
58
+ [...Array(5).keys()].map(i => (
59
+ <DeliveryZonesTableWrapper key={i}>
60
+ <CheckSkeleteon>
61
+ <Skeleton width={18} height={18} />
62
+ </CheckSkeleteon>
63
+ <InfoBlock>
64
+ <Skeleton width='100%' height={18} />
65
+ </InfoBlock>
66
+ </DeliveryZonesTableWrapper>
67
+ ))
68
+ ) :
69
+ <DeliveryZonesTable>
70
+ <thead>
71
+ <tr>
72
+ <th>
73
+ <CheckboxWrapper>
74
+ <Checkbox
75
+ checked={zoneListState?.isCheckAll}
76
+ onChange={e => handleChangeAllZoneState(e.target.checked)}
77
+ />
78
+ </CheckboxWrapper>
79
+ </th>
80
+ <th>{t('NAME', 'Name')}</th>
81
+ <th>{t('MINIMUM', 'Minimum')}</th>
82
+ <th>{t('PRICE', 'Price')}</th>
83
+ <th />
84
+ </tr>
85
+ </thead>
86
+ {zoneList?.zones?.filter(zone => zone?.type !== 3)?.map(zone => (
87
+ <ZoneTbody
88
+ key={zone?.id}
89
+ active={zone?.id === curZone?.id}
90
+ onClick={(e) => handleOpenZone(e, zone)}
91
+ >
92
+ <tr>
93
+ <td>
94
+ <CheckboxWrapper className='zone-enabled'>
95
+ <Checkbox
96
+ checked={!!zoneListState?.changes[zone.id]}
97
+ onChange={e => handleChangeZoneState(zone?.id, e?.target?.checked)}
98
+ />
99
+ </CheckboxWrapper>
100
+ </td>
101
+ <td>{zone?.name}</td>
102
+ <td>{zone?.minimum}</td>
103
+ <td>{zone?.price}</td>
104
+ <td className='arrow'><ChevronRight /></td>
105
+ </tr>
106
+ </ZoneTbody>
107
+ ))}
108
+ </DeliveryZonesTable>
109
+ }
110
+ <AddDeliveryZoneButton
111
+ onClick={(e) => handleOpenZone(e, null)}
112
+ >
113
+ {t('ADD_DELIVERY_ZONE', 'Add delivery zone')}
114
+ </AddDeliveryZoneButton>
115
+ </ZoneContainer>
116
+ {isOpenDetails && (
117
+ <SideBar
118
+ isBorderShow
119
+ open={isOpenDetails}
120
+ onClose={() => handleCloseOption()}
121
+ >
122
+ <DriverGroupDeliveryZoneDetails
123
+ zone={curZone}
124
+ setZoneList={setZoneList}
125
+ drivergroup={drivergroup}
126
+ onClose={() => handleCloseOption()}
127
+ handleSuccessUpdate={handleSuccessUpdate}
128
+ driverGroupsZones={zoneList}
129
+ />
130
+ </SideBar>
131
+ )}
132
+ </>
133
+ )
134
+ }
@@ -0,0 +1,87 @@
1
+ import styled, { css } from 'styled-components'
2
+
3
+ export const ZoneContainer = styled.div`
4
+ margin: 30px 0 20px 0;
5
+ @media (min-width: 1000px) {
6
+ max-width: 500px;
7
+ }
8
+ `
9
+
10
+ export const DeliveryZonesTable = styled.table`
11
+ width: 100%;
12
+ border-collapse: collapse;
13
+ thead {
14
+ border-bottom: 1px solid ${props => props.theme.colors.borderColor};
15
+ tr {
16
+ th {
17
+ font-size: 12px;
18
+ font-weight: 700;
19
+ padding: 10px 0;
20
+ }
21
+ }
22
+ }
23
+ `
24
+
25
+ export const DeliveryZonesTableWrapper = styled.div`
26
+ width: 100%;
27
+ display: flex;
28
+ margin-bottom: 20px;
29
+ `
30
+
31
+ export const CheckSkeleteon = styled.div`
32
+ width: 18px;
33
+ height: 18px;
34
+ margin-right: 5px;
35
+ `
36
+
37
+ export const InfoBlock = styled.div`
38
+ width: 100%;
39
+ `
40
+
41
+ export const ZoneTbody = styled.tbody`
42
+ cursor: pointer;
43
+ border-bottom: 1px solid ${props => props.theme.colors.borderColor};
44
+ tr {
45
+ td {
46
+ font-size: 14px;
47
+ padding: 13px 0;
48
+ &.arrow {
49
+ font-size: 13px;
50
+ color: ${props => props.theme.colors.secundaryLight};
51
+ }
52
+ }
53
+ }
54
+ &:hover {
55
+ background-color: ${props => props.theme.colors.lightPrimary};
56
+ }
57
+ ${({ active }) => active && css`
58
+ background-color: ${props => props.theme.colors.lightPrimary};
59
+ td {
60
+ border-top: 1px solid ${props => props.theme.colors.primary};
61
+ border-bottom: 1px solid ${props => props.theme.colors.primary};
62
+ }
63
+ `}
64
+ `
65
+ export const ActionsWrapper = styled.div`
66
+ display: flex;
67
+ align-items: center;
68
+ `
69
+
70
+ export const AddDeliveryZoneButton = styled.div`
71
+ color: ${props => props.theme.colors.lightGray};
72
+ font-size: 14px;
73
+ padding: 10px 0;
74
+ cursor: pointer;
75
+ width: fit-content;
76
+ &:hover {
77
+ color: ${props => props.theme.colors.primary};
78
+ }
79
+ `
80
+ export const CheckboxWrapper = styled.div`
81
+ display: flex;
82
+ ${props => props.theme?.rtl ? css`
83
+ margin-left: 10px;
84
+ ` : css`
85
+ margin-right: 10px;
86
+ `}
87
+ `
@@ -14,6 +14,8 @@ import { DriversGroupBusinesses } from '../DriversGroupBusinesses'
14
14
  import { DriversGroupPaymethods } from '../DriversGroupPaymethods'
15
15
  import { DriversGroupLogistics } from '../DriversGroupLogistics'
16
16
  import { DriversGroupLogs } from '../DriversGroupLogs'
17
+ import { DriverGroupDeliveryDetails } from '../DriversGroupDeliveryDetails'
18
+ import { useWindowSize } from '../../../hooks/useWindowSize'
17
19
 
18
20
  import {
19
21
  DetailsContainer,
@@ -30,11 +32,13 @@ const DriversGroupDetailsUI = (props) => {
30
32
  handleParentSidebarMove,
31
33
  handleDeleteDriversGroup,
32
34
  handleNextTour,
33
- handleUpdateDriversGroup
35
+ handleUpdateDriversGroup,
36
+ setIsExtendExtraOpen
34
37
  } = props
35
38
 
36
39
  const theme = useTheme()
37
40
  const [, t] = useLanguage()
41
+ const { width } = useWindowSize()
38
42
  const [configState] = useConfig()
39
43
 
40
44
  const autoAssignType = configState?.configs?.autoassign_type?.value
@@ -44,12 +48,14 @@ const DriversGroupDetailsUI = (props) => {
44
48
  const [driversGroupMenus, setDriversGroupMenus] = useState([])
45
49
  const [confirm, setConfirm] = useState({ open: false, content: null, handleOnAccept: null })
46
50
  const [alertState, setAlertState] = useState({ open: false, content: [] })
51
+ const [isOpenDetails, setIsOpenDetails] = useState(false)
47
52
 
48
53
  useEffect(() => {
49
54
  const _driversGroupMenus = !driversGroupState.driversGroup
50
55
  ? [
51
56
  { key: 'general', value: t('GENERAL', 'General') },
52
- { key: 'businesses', value: t('BUSINESSES', 'Businesses') }
57
+ { key: 'businesses', value: t('BUSINESSES', 'Businesses') },
58
+ { key: 'delivery_zones', value: t('DELIVERY_ZONES', 'Delivery Zones') }
53
59
  ]
54
60
  : (useAdvanced && autoAssignType !== 'basic')
55
61
  ? [
@@ -57,18 +63,20 @@ const DriversGroupDetailsUI = (props) => {
57
63
  { key: 'businesses', value: t('BUSINESSES', 'Businesses') },
58
64
  { key: 'paymethods', value: t('PAYMENT_METHODS', 'Payment methods') },
59
65
  { key: 'advanced_logistics', value: t('ADVANCED_LOGISTICS', 'Advanced logistics') },
60
- { key: 'logs', value: t('LOGS', 'Logs') }
66
+ { key: 'logs', value: t('LOGS', 'Logs') },
67
+ { key: 'delivery_zones', value: t('DELIVERY_ZONES', 'Delivery Zones') }
61
68
  ]
62
69
  : [
63
70
  { key: 'general', value: t('GENERAL', 'General') },
64
71
  { key: 'businesses', value: t('BUSINESSES', 'Businesses') },
65
72
  { key: 'paymethods', value: t('PAYMENT_METHODS', 'Payment methods') },
66
- { key: 'logs', value: t('LOGS', 'Logs') }
73
+ { key: 'logs', value: t('LOGS', 'Logs') },
74
+ { key: 'delivery_zones', value: t('DELIVERY_ZONES', 'Delivery Zones') }
67
75
  ]
68
76
  setDriversGroupMenus(_driversGroupMenus)
69
77
  }, [useAdvanced])
70
78
 
71
- const onDeleteGroup = (driversGroupId) => {
79
+ const onDeleteGroup = () => {
72
80
  setConfirm({
73
81
  open: true,
74
82
  content: t('QUESTION_DELETE_DRIVER_GROUP', 'Are you sure to remove this driver group?'),
@@ -79,6 +87,10 @@ const DriversGroupDetailsUI = (props) => {
79
87
  })
80
88
  }
81
89
 
90
+ useEffect(() => {
91
+ if (width > 1000) setIsExtendExtraOpen(false)
92
+ }, [width])
93
+
82
94
  const handleNextClick = () => {
83
95
  setShowMenu('businesses')
84
96
  handleNextTour()
@@ -90,7 +102,9 @@ const DriversGroupDetailsUI = (props) => {
90
102
 
91
103
  useEffect(() => {
92
104
  handleParentSidebarMove(0)
93
- }, [showMenu])
105
+ setIsOpenDetails(false)
106
+ setIsExtendExtraOpen(false)
107
+ }, [showMenu, driversGroupState.driversGroup?.id])
94
108
 
95
109
  useEffect(() => {
96
110
  if (!actionState?.error) return
@@ -166,6 +180,15 @@ const DriversGroupDetailsUI = (props) => {
166
180
  {showMenu === 'logs' && (
167
181
  <DriversGroupLogs driversGroupId={driversGroupState.driversGroup?.id} />
168
182
  )}
183
+ {showMenu === 'delivery_zones' && (
184
+ <DriverGroupDeliveryDetails {...props}
185
+ handleParentSidebarMove={handleParentSidebarMove}
186
+ drivergroup={driversGroupState.driversGroup}
187
+ setIsExtendExtraOpen={setIsExtendExtraOpen}
188
+ setIsOpenDetails={setIsOpenDetails}
189
+ isOpenDetails={isOpenDetails}
190
+ />
191
+ )}
169
192
  </DetailsContainer>
170
193
  <Alert
171
194
  title={t('WEB_APPNAME', 'Ordering')}
@@ -0,0 +1,123 @@
1
+ import React, { useState } from 'react'
2
+ import {
3
+ useLanguage,
4
+ DriverGroupDeliveryZone as DriverGroupDeliveryZoneController
5
+ } from 'ordering-components-admin-external'
6
+ import { DriverGroupDeliveryZoneInformation } from '../DriversGroupDeliveryZoneInformation'
7
+ import { ThreeDots } from 'react-bootstrap-icons'
8
+ import { Dropdown, DropdownButton } from 'react-bootstrap'
9
+ import { useTheme } from 'styled-components'
10
+ import { Confirm } from '../../Shared'
11
+
12
+ import {
13
+ Container,
14
+ Header,
15
+ TabContainer,
16
+ Tab,
17
+ ActionSelectorWrapper
18
+ } from './styles'
19
+
20
+ const DriverGroupDeliveryZoneDetailsUI = (props) => {
21
+ const {
22
+ drivergroup,
23
+ driverGroupsZones,
24
+ zoneState,
25
+ formState,
26
+ handleChangeInput,
27
+ handleChangeFormState,
28
+ handleUpdateDriverGroupDeliveryZone,
29
+ handleAddDriverGroupDeliveryZone,
30
+ handleDeleteDriverGroupDeliveryZone,
31
+ handleUploadKmlFiles,
32
+ kmlData,
33
+ } = props
34
+
35
+ const theme = useTheme()
36
+ const [, t] = useLanguage()
37
+ const [confirm, setConfirm] = useState({ open: false, content: null, handleOnAccept: null })
38
+ const [selectedMenuOption, setSelectedMenuOption] = useState('information')
39
+ const tabs = [
40
+ { key: 'information', content: t('INFORMATION', 'Information') }
41
+ ]
42
+
43
+ const onClickDelete = () => {
44
+ setConfirm({
45
+ open: true,
46
+ content: t('QUESTION_DELETE_DELIVERYZONE', 'Are you sure that you want to delete this delivery zone?'),
47
+ handleOnAccept: () => {
48
+ setConfirm({ ...confirm, open: false })
49
+ handleDeleteDriverGroupDeliveryZone()
50
+ }
51
+ })
52
+ }
53
+
54
+ return (
55
+ <>
56
+ <Container>
57
+ <Header>
58
+ <h1>
59
+ {zoneState?.zone ? zoneState?.zone?.name : t('ZONE_DELIVERY_SETTINGS', 'Zone delivery settings')}
60
+ </h1>
61
+ <ActionSelectorWrapper>
62
+ <DropdownButton
63
+ menuAlign={theme?.rtl ? 'left' : 'right'}
64
+ title={<ThreeDots />}
65
+ id={theme?.rtl ? 'dropdown-menu-align-left' : 'dropdown-menu-align-right'}
66
+ >
67
+ <Dropdown.Item
68
+ onClick={() => onClickDelete()}
69
+ >
70
+ {t('DELETE', 'Delete')}
71
+ </Dropdown.Item>
72
+ </DropdownButton>
73
+ </ActionSelectorWrapper>
74
+ </Header>
75
+ <TabContainer>
76
+ {tabs?.map(tab => (
77
+ <Tab
78
+ key={tab?.key}
79
+ active={selectedMenuOption === tab?.key}
80
+ onClick={() => setSelectedMenuOption(tab?.key)}
81
+ >
82
+ {tab?.content}
83
+ </Tab>
84
+ ))}
85
+ </TabContainer>
86
+
87
+ {selectedMenuOption === 'information' && (
88
+ <DriverGroupDeliveryZoneInformation
89
+ drivergroup={drivergroup}
90
+ zone={zoneState?.zone}
91
+ driverGroupsZones={driverGroupsZones?.zones}
92
+ formState={formState}
93
+ handleChangeInput={handleChangeInput}
94
+ handleChangeFormState={handleChangeFormState}
95
+ handleUpdateDriverGroupDeliveryZone={handleUpdateDriverGroupDeliveryZone}
96
+ handleAddDriverGroupDeliveryZone={handleAddDriverGroupDeliveryZone}
97
+ kmlData={kmlData}
98
+ handleUploadKmlFiles={handleUploadKmlFiles}
99
+ />
100
+ )}
101
+ </Container>
102
+ <Confirm
103
+ width='700px'
104
+ title={t('WEB_APPNAME', 'Ordering')}
105
+ content={confirm?.content}
106
+ acceptText={t('ACCEPT', 'Accept')}
107
+ open={confirm?.open}
108
+ onClose={() => setConfirm({ ...confirm, open: false })}
109
+ onCancel={() => setConfirm({ ...confirm, open: false })}
110
+ onAccept={confirm.handleOnAccept}
111
+ closeOnBackdrop={false}
112
+ />
113
+ </>
114
+ )
115
+ }
116
+
117
+ export const DriverGroupDeliveryZoneDetails = (props) => {
118
+ const driverGroupDeliveryZoneProps = {
119
+ ...props,
120
+ UIComponent: DriverGroupDeliveryZoneDetailsUI
121
+ }
122
+ return <DriverGroupDeliveryZoneController {...driverGroupDeliveryZoneProps} />
123
+ }
@@ -0,0 +1,125 @@
1
+ import styled, { css } from 'styled-components'
2
+ import { darken } from 'polished'
3
+
4
+ export const Container = styled.div`
5
+ width: 100%;
6
+ padding: 20px;
7
+ box-sizing: border-box;
8
+
9
+ > button {
10
+ margin: 20px 0;
11
+ }
12
+ `
13
+
14
+ export const Header = styled.div`
15
+ display: flex;
16
+ align-items: center;
17
+ justify-content: space-between;
18
+ h1 {
19
+ font-size: 20px;
20
+ font-weight: 700;
21
+ color: ${props => props.theme.colors.headingColor};
22
+ margin-bottom: 0;
23
+ }
24
+ ${props => props.theme?.rtl ? css`
25
+ margin-left: 35px;
26
+ ` : css`
27
+ margin-right: 35px;
28
+ `}
29
+ `
30
+
31
+ export const TabContainer = styled.div`
32
+ width: 100%;
33
+ display: flex;
34
+ border-bottom: 1px solid ${props => props.theme.colors.borderColor};
35
+ margin-bottom: 24px;
36
+ margin-top: 15px;
37
+ `
38
+
39
+ export const Tab = styled.div`
40
+ padding: 10px 0px;
41
+ cursor: pointer;
42
+ color: ${props => props.theme.colors?.headingColor};
43
+ white-space: nowrap;
44
+ font-size: 14px;
45
+ position: relative;
46
+ ${props => props.theme?.rtl ? css`
47
+ margin-left: 30px;
48
+ ` : css`
49
+ margin-right: 30px;
50
+ `}
51
+
52
+ ${({ active }) => active && css`
53
+ font-weight: 500;
54
+
55
+ &::after {
56
+ content: "";
57
+ background: #344050;
58
+ height: 1px;
59
+ position: absolute;
60
+ width: 100%;
61
+ bottom: -1px;
62
+ ${props => props.theme?.rtl ? css`
63
+ right: 0;
64
+ ` : css`
65
+ left: 0;
66
+ `}
67
+ }
68
+ `}
69
+ ${({ active }) => !active && css`
70
+ color: ${props => props.theme.colors?.lightGray};
71
+ `}
72
+ `
73
+ export const ActionSelectorWrapper = styled.div`
74
+ button {
75
+ background: transparent !important;
76
+ border: none;
77
+ padding: 0px 5px;
78
+ &:active,
79
+ &:focus {
80
+ border-color: unset !important;
81
+ box-shadow: none !important;
82
+ }
83
+ svg {
84
+ color: ${props => props.theme.colors.headingColor};
85
+ font-size: 20px;
86
+ }
87
+
88
+ &:after {
89
+ display: none;
90
+ }
91
+
92
+ &:hover {
93
+ background: ${props => darken(0.04, props.theme.colors.secundary)} !important;
94
+ }
95
+ &:active {
96
+ background: ${props => darken(0.1, props.theme.colors.secundary)} !important;
97
+ }
98
+ }
99
+
100
+ .show {
101
+ button {
102
+ background: ${props => darken(0.04, props.theme.colors.secundary)} !important;
103
+ }
104
+ >div {
105
+ border: 1px solid ${props => props.theme.colors.borderColor};
106
+ box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.12);
107
+ }
108
+ }
109
+
110
+ > div {
111
+ > div {
112
+ border-radius: 8px;
113
+ .dropdown-item {
114
+ font-size: 12px;
115
+ color: ${props => props.theme.colors.headingColor};
116
+ &:active {
117
+ background: ${props => darken(0.1, props.theme.colors.secundary)} !important;
118
+ }
119
+ }
120
+ .dropdown-item:last-child {
121
+ color: #E63757;
122
+ }
123
+ }
124
+ }
125
+ `
@@ -32,7 +32,7 @@ export const DriversGroupsList = (props) => {
32
32
  handleOpenDetails,
33
33
  handleUpdateDriversGroup,
34
34
  selectedGroupList,
35
-
35
+ isFromStore,
36
36
  handleSelectGroup,
37
37
  handleAllSelectGroup
38
38
  } = props
@@ -79,7 +79,7 @@ export const DriversGroupsList = (props) => {
79
79
  const handleClickDriverGroup = (e, group) => {
80
80
  const isInvalid = e.target.closest('.group-checkbox') || e.target.closest('.group-enabled')
81
81
  if (isInvalid) return
82
- handleOpenDetails(group)
82
+ !isFromStore && handleOpenDetails(group)
83
83
  }
84
84
 
85
85
  const getTypeTag = (type) => {
@@ -45,6 +45,7 @@ const DriversGroupsListingUI = (props) => {
45
45
  const [moveDistance, setMoveDistance] = useState(0)
46
46
  const [openDetails, setOpenDetails] = useState(false)
47
47
  const [curDriversGroup, setCurDriversGroup] = useState(null)
48
+ const [isExtendExtraOpen, setIsExtendExtraOpen] = useState(false)
48
49
 
49
50
  const [isTourOpen, setIsTourOpen] = useState(false)
50
51
  const [currentTourStep, setCurrentTourStep] = useState(4)
@@ -186,7 +187,7 @@ const DriversGroupsListingUI = (props) => {
186
187
  {openDetails && (
187
188
  <SideBar
188
189
  sidebarId='driver_group_details'
189
- defaultSideBarWidth={550 + moveDistance}
190
+ defaultSideBarWidth={!isExtendExtraOpen ? 540 + moveDistance : 1040}
190
191
  open={openDetails}
191
192
  moveDistance={moveDistance}
192
193
  noAnimation={isTourOpen}
@@ -207,6 +208,8 @@ const DriversGroupsListingUI = (props) => {
207
208
  companies={driversCompanyList?.companies}
208
209
  handleUpdateDriversGroup={handleUpdateDriversGroup}
209
210
  handleParentSidebarMove={val => setMoveDistance(val)}
211
+ setIsExtendExtraOpen={setIsExtendExtraOpen}
212
+ isExtendExtraOpen={isExtendExtraOpen}
210
213
  onClose={() => {
211
214
  setOpenDetails(false)
212
215
  if (isTourOpen) {