ordering-ui-admin-external 1.5.1 → 1.6.0

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 (161) hide show
  1. package/_bundles/{ordering-ui-admin.743f7975ef6f607887b2.js → ordering-ui-admin.0fd83f227d29409cb170.js} +2 -2
  2. package/_bundles/{ordering-ui-admin.743f7975ef6f607887b2.js.LICENSE.txt → ordering-ui-admin.0fd83f227d29409cb170.js.LICENSE.txt} +1 -1
  3. package/_modules/components/Delivery/UserFormDetails/index.js +10 -3
  4. package/_modules/components/Login/LoginForm/index.js +4 -3
  5. package/_modules/components/Login/ResetPassword/index.js +251 -0
  6. package/_modules/components/Login/ResetPassword/styles.js +64 -0
  7. package/_modules/components/Login/index.js +8 -1
  8. package/_modules/components/Marketing/CampaignDetailContent/index.js +41 -5
  9. package/_modules/components/Marketing/CampaignDetailGeneral/index.js +2 -2
  10. package/_modules/components/Marketing/CampaignEmail/index.js +155 -12
  11. package/_modules/components/Marketing/CampaignEmail/styles.js +18 -4
  12. package/_modules/components/Marketing/CampaignHeader/index.js +11 -1
  13. package/_modules/components/Marketing/CampaignHeader/styles.js +25 -6
  14. package/_modules/components/Marketing/CampaignList/index.js +41 -25
  15. package/_modules/components/Marketing/CampaignNotification/index.js +14 -1
  16. package/_modules/components/Marketing/CampaignNotification/styles.js +7 -3
  17. package/_modules/components/Marketing/CampaignSMS/index.js +14 -1
  18. package/_modules/components/Marketing/CampaignSMS/styles.js +7 -3
  19. package/_modules/components/Marketing/CampaignWebHook/index.js +13 -1
  20. package/_modules/components/Marketing/CampaignWebHook/styles.js +7 -3
  21. package/_modules/components/MyProducts/BoxLayout/index.js +20 -0
  22. package/_modules/components/MyProducts/BoxLayout/styles.js +22 -0
  23. package/_modules/components/MyProducts/CustomerApp/index.js +48 -0
  24. package/_modules/components/MyProducts/CustomerApp/styles.js +25 -0
  25. package/_modules/components/MyProducts/DriverApp/index.js +69 -0
  26. package/_modules/components/MyProducts/DriverApp/styles.js +29 -0
  27. package/_modules/components/MyProducts/OrderingWebsite/index.js +40 -0
  28. package/_modules/components/MyProducts/OrderingWebsite/styles.js +29 -0
  29. package/_modules/components/MyProducts/StoreApp/index.js +69 -0
  30. package/_modules/components/MyProducts/StoreApp/styles.js +29 -0
  31. package/_modules/components/MyProducts/index.js +33 -0
  32. package/_modules/components/OrderingProducts/OrderingProductDetails/index.js +4 -4
  33. package/_modules/components/Orders/OrdersTable/index.js +8 -9
  34. package/_modules/components/Profile/ProfilePage/index.js +70 -0
  35. package/_modules/components/Profile/ProfilePage/styles.js +22 -0
  36. package/_modules/components/Profile/index.js +12 -0
  37. package/_modules/components/Settings/InsertLink/index.js +3 -2
  38. package/_modules/components/Settings/PluginList/index.js +31 -1
  39. package/_modules/components/Shared/ColumnAllowSettingPopover/index.js +4 -3
  40. package/_modules/components/SidebarMenu/index.js +82 -55
  41. package/_modules/components/SidebarMenu/styles.js +3 -1
  42. package/_modules/components/Stores/BusinessLocation/index.js +1 -1
  43. package/_modules/components/Stores/BusinessProductAddForm/index.js +4 -4
  44. package/_modules/components/Stores/BusinessProductsListing/index.js +7 -0
  45. package/_modules/components/Stores/BusinessWebhooks/index.js +2 -2
  46. package/_modules/components/Stores/PaymentOption/index.js +23 -4
  47. package/_modules/components/Stores/PaymentOptionMethods/index.js +23 -4
  48. package/_modules/components/Stores/PaymentOptionPaypal/index.js +23 -4
  49. package/_modules/components/Stores/PaymentOptionStripeDirect/index.js +23 -4
  50. package/_modules/components/Stores/PaymethodOptionPaypalExpress/index.js +23 -4
  51. package/_modules/components/Stores/PaymethodOptionStripeConnect/index.js +23 -4
  52. package/_modules/components/Stores/PaymethodOptionStripeRedirect/index.js +23 -4
  53. package/_modules/components/Users/CustomerDetails/index.js +8 -10
  54. package/_modules/components/Users/CustomersListing/index.js +4 -2
  55. package/_modules/components/Users/OccupationSelector/index.js +48 -0
  56. package/_modules/components/Users/OccupationSelector/styles.js +16 -0
  57. package/_modules/components/Users/OccupationsFilter/index.js +49 -0
  58. package/_modules/components/Users/OccupationsFilter/styles.js +22 -0
  59. package/_modules/components/Users/ProfessionalDetail/index.js +47 -8
  60. package/_modules/components/Users/ProfessionalDetail/styles.js +10 -5
  61. package/_modules/components/Users/ProfessionalList/index.js +43 -6
  62. package/_modules/components/Users/ProfessionalList/styles.js +5 -3
  63. package/_modules/components/Users/ProfessionalListing/index.js +14 -3
  64. package/_modules/components/Users/ProfessionalSchedule/styles.js +1 -1
  65. package/_modules/components/Users/UserDetails/index.js +11 -13
  66. package/_modules/components/Users/UserFormDetails/index.js +8 -1
  67. package/_modules/components/Users/UserTypeSelector/index.js +7 -0
  68. package/_modules/components/Users/UsersList/index.js +40 -5
  69. package/_modules/components/Users/UsersList/styles.js +7 -5
  70. package/_modules/components/Users/UsersListing/index.js +4 -2
  71. package/_modules/contexts/ThemeContext/index.js +1 -1
  72. package/_modules/index.js +38 -0
  73. package/index-template.js +22 -4
  74. package/package.json +2 -2
  75. package/src/components/Delivery/UserFormDetails/index.js +8 -10
  76. package/src/components/Login/LoginForm/index.js +23 -20
  77. package/src/components/Login/ResetPassword/index.js +283 -0
  78. package/src/components/Login/ResetPassword/styles.js +215 -0
  79. package/src/components/Login/index.js +3 -1
  80. package/src/components/Marketing/CampaignDetail/index.js +0 -1
  81. package/src/components/Marketing/CampaignDetailContent/index.js +54 -24
  82. package/src/components/Marketing/CampaignDetailGeneral/index.js +1 -1
  83. package/src/components/Marketing/CampaignEmail/index.js +152 -15
  84. package/src/components/Marketing/CampaignEmail/styles.js +64 -3
  85. package/src/components/Marketing/CampaignHeader/index.js +19 -3
  86. package/src/components/Marketing/CampaignHeader/styles.js +77 -0
  87. package/src/components/Marketing/CampaignList/index.js +75 -65
  88. package/src/components/Marketing/CampaignNotification/index.js +11 -3
  89. package/src/components/Marketing/CampaignNotification/styles.js +13 -0
  90. package/src/components/Marketing/CampaignSMS/index.js +11 -2
  91. package/src/components/Marketing/CampaignSMS/styles.js +13 -0
  92. package/src/components/Marketing/CampaignWebHook/index.js +11 -2
  93. package/src/components/Marketing/CampaignWebHook/styles.js +13 -0
  94. package/src/components/MyProducts/BoxLayout/index.js +25 -0
  95. package/src/components/MyProducts/BoxLayout/styles.js +78 -0
  96. package/src/components/MyProducts/CustomerApp/index.js +52 -0
  97. package/src/components/MyProducts/CustomerApp/styles.js +59 -0
  98. package/src/components/MyProducts/DriverApp/index.js +83 -0
  99. package/src/components/MyProducts/DriverApp/styles.js +104 -0
  100. package/src/components/MyProducts/OrderingWebsite/index.js +41 -0
  101. package/src/components/MyProducts/OrderingWebsite/styles.js +104 -0
  102. package/src/components/MyProducts/StoreApp/index.js +83 -0
  103. package/src/components/MyProducts/StoreApp/styles.js +104 -0
  104. package/src/components/MyProducts/index.js +11 -0
  105. package/src/components/OrderingProducts/OrderingProductDetails/index.js +1 -1
  106. package/src/components/Orders/OrdersTable/index.js +3 -6
  107. package/src/components/Profile/ProfilePage/index.js +81 -0
  108. package/src/components/Profile/ProfilePage/styles.js +64 -0
  109. package/src/components/Profile/index.js +5 -0
  110. package/src/components/Settings/InsertLink/index.js +6 -2
  111. package/src/components/Settings/PluginList/index.js +2 -2
  112. package/src/components/Shared/ColumnAllowSettingPopover/index.js +11 -7
  113. package/src/components/SidebarMenu/index.js +120 -58
  114. package/src/components/SidebarMenu/styles.js +7 -0
  115. package/src/components/Stores/BusinessLocation/index.js +1 -1
  116. package/src/components/Stores/BusinessProductAddForm/index.js +2 -2
  117. package/src/components/Stores/BusinessProductsListing/index.js +8 -0
  118. package/src/components/Stores/BusinessWebhooks/index.js +2 -2
  119. package/src/components/Stores/PaymentOption/index.js +12 -2
  120. package/src/components/Stores/PaymentOptionMethods/index.js +12 -2
  121. package/src/components/Stores/PaymentOptionPaypal/index.js +12 -2
  122. package/src/components/Stores/PaymentOptionStripeDirect/index.js +12 -2
  123. package/src/components/Stores/PaymethodOptionPaypalExpress/index.js +12 -2
  124. package/src/components/Stores/PaymethodOptionStripeConnect/index.js +12 -2
  125. package/src/components/Stores/PaymethodOptionStripeRedirect/index.js +12 -2
  126. package/src/components/Users/CustomerDetails/index.js +1 -1
  127. package/src/components/Users/CustomersListing/index.js +3 -1
  128. package/src/components/Users/OccupationSelector/index.js +37 -0
  129. package/src/components/Users/OccupationSelector/styles.js +18 -0
  130. package/src/components/Users/OccupationsFilter/index.js +50 -0
  131. package/src/components/Users/OccupationsFilter/styles.js +32 -0
  132. package/src/components/Users/ProfessionalDetail/index.js +42 -7
  133. package/src/components/Users/ProfessionalDetail/styles.js +16 -2
  134. package/src/components/Users/ProfessionalList/index.js +41 -3
  135. package/src/components/Users/ProfessionalList/styles.js +5 -0
  136. package/src/components/Users/ProfessionalListing/index.js +14 -1
  137. package/src/components/Users/ProfessionalSchedule/styles.js +1 -0
  138. package/src/components/Users/UserDetails/index.js +1 -1
  139. package/src/components/Users/UserFormDetails/index.js +11 -2
  140. package/src/components/Users/UserTypeSelector/index.js +6 -0
  141. package/src/components/Users/UsersList/index.js +44 -8
  142. package/src/components/Users/UsersList/styles.js +7 -2
  143. package/src/components/Users/UsersListing/index.js +4 -2
  144. package/src/contexts/ThemeContext/index.js +4 -0
  145. package/src/index.js +17 -1
  146. package/template/app.js +55 -3
  147. package/template/assets/images/myProducts/customer-app.png +0 -0
  148. package/template/assets/images/myProducts/driver-app.png +0 -0
  149. package/template/assets/images/myProducts/ordering-website.png +0 -0
  150. package/template/assets/images/myProducts/store-app.png +0 -0
  151. package/template/components/ListenPageChanges/index.js +7 -1
  152. package/template/config.json +2 -1
  153. package/template/helmetdata.json +49 -0
  154. package/template/pages/CustomerApp/index.js +12 -0
  155. package/template/pages/DriverApp/index.js +12 -0
  156. package/template/pages/Login/index.js +7 -1
  157. package/template/pages/OrderingWebsite/index.js +12 -0
  158. package/template/pages/Professionals/index.js +2 -1
  159. package/template/pages/Profile/index.js +12 -0
  160. package/template/pages/ResetPassword/index.js +42 -0
  161. package/template/pages/StoreApp/index.js +12 -0
@@ -47,7 +47,8 @@ const CustomersListingUI = (props) => {
47
47
  onUserRedirect,
48
48
  handleSuccessUpdate,
49
49
  handleSuccessAddUser,
50
- handleSuccessDeleteUser
50
+ handleSuccessDeleteUser,
51
+ setSelectedUsers
51
52
  } = props
52
53
 
53
54
  const [, t] = useLanguage()
@@ -160,6 +161,7 @@ const CustomersListingUI = (props) => {
160
161
  userDetailsId={openUser?.id || queryId}
161
162
  handleOpenUserDetails={handleOpenUserDetails}
162
163
  handleOpenUserAddForm={handleOpenUserAddForm}
164
+ setSelectedUsers={setSelectedUsers}
163
165
  />
164
166
  </UsersListingContainer>
165
167
 
@@ -0,0 +1,37 @@
1
+ import React, { useState, useEffect } from 'react'
2
+ import { useLanguage } from 'ordering-components-admin-external'
3
+ import { Select } from '../../../styles/Select'
4
+ import { SelectWrapper, Option } from './styles'
5
+
6
+ export const OccupationSelector = (props) => {
7
+ const {
8
+ occupationId,
9
+ occupations,
10
+ handleChangeOccupation
11
+ } = props
12
+
13
+ const [, t] = useLanguage()
14
+ const [options, setOptions] = useState([])
15
+
16
+ useEffect(() => {
17
+ if (!occupations.length) return
18
+ const _occupationList = occupations.map(occupation => {
19
+ return {
20
+ value: occupation.id,
21
+ content: <Option>{occupation.name}</Option>
22
+ }
23
+ })
24
+ setOptions(_occupationList)
25
+ }, [occupations])
26
+
27
+ return (
28
+ <SelectWrapper>
29
+ <Select
30
+ placeholder={<Option>{t('SELECT_OCCUPATION', 'Select occupation')}</Option>}
31
+ defaultValue={occupationId}
32
+ options={options}
33
+ onChange={handleChangeOccupation}
34
+ />
35
+ </SelectWrapper>
36
+ )
37
+ }
@@ -0,0 +1,18 @@
1
+ import styled from 'styled-components'
2
+
3
+ export const SelectWrapper = styled.div`
4
+ width: 100%;
5
+ margin-bottom: 20px;
6
+
7
+ .select-wrapper {
8
+ .select {
9
+ border: 1px solid ${props => props.theme.colors.borderColor};
10
+ padding: 6px 0;
11
+ font-size: 14px;
12
+ }
13
+ }
14
+ `
15
+ export const Option = styled.div`
16
+ font-size: 14px;
17
+ padding: 4px 0;
18
+ `
@@ -0,0 +1,50 @@
1
+ import React from 'react'
2
+ import Skeleton from 'react-loading-skeleton'
3
+ import { useLanguage } from 'ordering-components-admin-external'
4
+ import { Button } from '../../../styles'
5
+ import {
6
+ Container,
7
+ SkeletonWrapper
8
+ } from './styles'
9
+
10
+ export const OccupationsFilter = (props) => {
11
+ const {
12
+ occupationsState,
13
+ selectedOccupation,
14
+ handleSelectOccupation
15
+ } = props
16
+
17
+ const [, t] = useLanguage()
18
+
19
+ return (
20
+ <Container>
21
+ {occupationsState.loading ? (
22
+ [...Array(3).keys()].map(i =>
23
+ <SkeletonWrapper key={i}>
24
+ <Skeleton />
25
+ </SkeletonWrapper>
26
+ )
27
+ ) : (
28
+ occupationsState.occupations.length > 0 && (
29
+ <>
30
+ <Button
31
+ color={selectedOccupation ? 'secundaryDark' : 'primary'}
32
+ onClick={() => handleSelectOccupation(null)}
33
+ >
34
+ {t('ALL', 'All')}
35
+ </Button>
36
+ {occupationsState.occupations.map(occupation => (
37
+ <Button
38
+ key={occupation.id}
39
+ color={selectedOccupation === occupation.id ? 'primary' : 'secundaryDark'}
40
+ onClick={() => handleSelectOccupation(occupation.id)}
41
+ >
42
+ {occupation.name}
43
+ </Button>
44
+ ))}
45
+ </>
46
+ )
47
+ )}
48
+ </Container>
49
+ )
50
+ }
@@ -0,0 +1,32 @@
1
+ import styled, { css } from 'styled-components'
2
+
3
+ export const Container = styled.div`
4
+ display: flex;
5
+ align-items: center;
6
+
7
+ > button {
8
+ ${props => props.theme?.rtl ? css`
9
+ margin-left: 10px;
10
+ ` : css`
11
+ margin-right: 10px;
12
+ `}
13
+ font-size: 12px;
14
+ white-space: nowrap;
15
+ }
16
+ `
17
+ export const SkeletonWrapper = styled.span`
18
+ height: 34px;
19
+ width: 120px;
20
+ border-radius: 30px;
21
+ overflow: hidden;
22
+ ${props => props.theme?.rtl ? css`
23
+ margin-left: 10px;
24
+ ` : css`
25
+ margin-right: 10px;
26
+ `}
27
+ > span {
28
+ display: flex;
29
+ height: 100%;
30
+ width: 100%;
31
+ }
32
+ `
@@ -1,31 +1,35 @@
1
1
  import React, { useEffect, useState } from 'react'
2
2
  import Skeleton from 'react-loading-skeleton'
3
- import { ThreeDots } from 'react-bootstrap-icons'
3
+ import { ThreeDots, Calendar4Event } from 'react-bootstrap-icons'
4
4
  import { Dropdown, DropdownButton } from 'react-bootstrap'
5
5
  import { useTheme } from 'styled-components'
6
- import { UserDetails as UserDetailsController, useLanguage, useSession } from 'ordering-components-admin-external'
7
- import { Confirm, Personalization, SideBar } from '../../Shared'
6
+ import { useLanguage, useSession, UserDetails as UserDetailsController } from 'ordering-components-admin-external'
7
+ import { Confirm, Personalization, SideBar, Alert } from '../../Shared'
8
8
  import { UserDetailsMenu } from '../UserDetailsMenu'
9
9
  import { UserProfileForm } from '../UserProfileForm'
10
10
  import { ProfessionalSchedule } from '../ProfessionalSchedule'
11
11
  import { ProfessionalBusinessService } from '../ProfessionalBusinessService'
12
12
  import { UserMetaFields } from '../UserMetaFields'
13
- import { Switch } from '../../../styles'
13
+ import { Button, Switch } from '../../../styles'
14
14
 
15
15
  import {
16
16
  DetailsHeader,
17
17
  UserName,
18
18
  ActionSelectorWrapper,
19
- SideBarWrapper
19
+ SideBarWrapper,
20
+ CalendarSyncWrapper
20
21
  } from './styles'
21
22
 
22
23
  export const ProfessionalDetailUI = (props) => {
23
24
  const {
24
25
  userState,
26
+ occupations,
25
27
  setExtraOpen,
26
28
  handleSuccessUserUpdate,
27
29
  handleDeleteUser,
28
- handleChangeActiveUser
30
+ handleChangeActiveUser,
31
+ handleGoogleCalendarSync,
32
+ actionStatus
29
33
  } = props
30
34
 
31
35
  const theme = useTheme()
@@ -34,6 +38,7 @@ export const ProfessionalDetailUI = (props) => {
34
38
  const [currentMenuSelected, setCurrentMenuSelected] = useState('profile')
35
39
  const [extraSelected, setExtraSelected] = useState(null)
36
40
  const [confirm, setConfirm] = useState({ open: false, content: null, handleOnAccept: null })
41
+ const [alertState, setAlertState] = useState({ open: false, content: [] })
37
42
 
38
43
  const onDeleteCustomer = () => {
39
44
  setConfirm({
@@ -61,6 +66,15 @@ export const ProfessionalDetailUI = (props) => {
61
66
  setExtraSelected(null)
62
67
  }, [currentMenuSelected])
63
68
 
69
+ useEffect(() => {
70
+ if (actionStatus.error) {
71
+ setAlertState({
72
+ open: true,
73
+ content: actionStatus.error
74
+ })
75
+ }
76
+ }, [actionStatus.error])
77
+
64
78
  return (
65
79
  <>
66
80
  <DetailsHeader>
@@ -77,13 +91,24 @@ export const ProfessionalDetailUI = (props) => {
77
91
  {handleChangeActiveUser && (
78
92
  <Switch
79
93
  defaultChecked={userState?.user?.enabled || false}
80
- onChange={enabled => handleChangeActiveUser({ id: userState?.user?.id, enabled: enabled })}
94
+ onChange={enabled => handleChangeActiveUser({ ...userState?.user, enabled: enabled })}
81
95
  />
82
96
  )}
83
97
  </>
84
98
  )}
85
99
  </UserName>
86
100
 
101
+ <CalendarSyncWrapper>
102
+ <Button
103
+ borderRadius='8px'
104
+ color='lightPrimary'
105
+ onClick={handleGoogleCalendarSync}
106
+ >
107
+ <span>{t('CALENDAR_SYNC', 'Calendar sync')}</span>
108
+ <Calendar4Event />
109
+ </Button>
110
+ </CalendarSyncWrapper>
111
+
87
112
  {adminUserState.user?.id !== userState.user?.id && (
88
113
  <ActionSelectorWrapper>
89
114
  <DropdownButton
@@ -114,6 +139,7 @@ export const ProfessionalDetailUI = (props) => {
114
139
  {currentMenuSelected === 'profile' && (
115
140
  <UserProfileForm
116
141
  user={userState.user}
142
+ occupations={occupations}
117
143
  handleSuccessUpdate={handleSuccessUserUpdate}
118
144
  isProfessional
119
145
  />
@@ -174,6 +200,15 @@ export const ProfessionalDetailUI = (props) => {
174
200
  onAccept={confirm.handleOnAccept}
175
201
  closeOnBackdrop={false}
176
202
  />
203
+ <Alert
204
+ title={t('WEB_APPNAME', 'Ordering')}
205
+ content={alertState.content}
206
+ acceptText={t('ACCEPT', 'Accept')}
207
+ open={alertState.open}
208
+ onClose={() => setAlertState({ open: false, content: [] })}
209
+ onAccept={() => setAlertState({ open: false, content: [] })}
210
+ closeOnBackdrop={false}
211
+ />
177
212
  </>
178
213
  )
179
214
  }
@@ -12,6 +12,7 @@ export const DetailsHeader = styled.div`
12
12
  export const UserName = styled.div`
13
13
  display: flex;
14
14
  align-items: center;
15
+ flex: 1;
15
16
  > span {
16
17
  font-size: 20px;
17
18
  font-weight: 700;
@@ -29,9 +30,9 @@ export const UserName = styled.div`
29
30
 
30
31
  export const ActionSelectorWrapper = styled.div`
31
32
  ${props => props.theme?.rtl ? css`
32
- margin-left: 35px;
33
+ margin-left: 25px;
33
34
  ` : css`
34
- margin-right: 35px;
35
+ margin-right: 25px;
35
36
  `}
36
37
  button {
37
38
  background: transparent !important;
@@ -101,3 +102,16 @@ export const SideBarWrapper = styled.div`
101
102
  height: calc(100% - 50px);
102
103
  }
103
104
  `
105
+ export const CalendarSyncWrapper = styled.div`
106
+ margin: 0 10px;
107
+ > button {
108
+ height: 44px;
109
+ span {
110
+ ${props => props.theme?.rtl ? css`
111
+ margin-left: 8px;
112
+ ` : css`
113
+ margin-right: 8px;
114
+ `}
115
+ }
116
+ }
117
+ `
@@ -22,7 +22,8 @@ import {
22
22
  AddNewUserButton,
23
23
  UsersBottomContainer,
24
24
  VerifiedItemsContainer,
25
- VerifiedItem
25
+ VerifiedItem,
26
+ AllCheckWrapper
26
27
  } from './styles'
27
28
 
28
29
  export const ProfessionalList = (props) => {
@@ -35,7 +36,8 @@ export const ProfessionalList = (props) => {
35
36
  selectedUsers,
36
37
  handleSelectedUsers,
37
38
  handleOpenUserDetails,
38
- handleOpenUserAddForm
39
+ handleOpenUserAddForm,
40
+ setSelectedUsers
39
41
  } = props
40
42
 
41
43
  const [, t] = useLanguage()
@@ -44,6 +46,7 @@ export const ProfessionalList = (props) => {
44
46
  const [confirmAdmin, setConfirmAdmin] = useState({ open: false, handleOnConfirm: null })
45
47
 
46
48
  const [openPopover, setOpenPopover] = useState(false)
49
+ const [isAllChecked, setIsAllChecked] = useState(false)
47
50
  const [allowColumns, setAllowColumns] = useState({
48
51
  user: true,
49
52
  city: true,
@@ -112,6 +115,19 @@ export const ProfessionalList = (props) => {
112
115
  }
113
116
  }
114
117
 
118
+ const handleSelecteAllUser = () => {
119
+ const userIds = usersList.users?.reduce((ids, user) => [...ids, user.id], [])
120
+ if (!isAllChecked) {
121
+ setSelectedUsers([...selectedUsers, ...userIds])
122
+ } else {
123
+ const userIdsToDeleteSet = new Set(userIds)
124
+ const updatedSelectedOrderIds = selectedUsers.filter((name) => {
125
+ return !userIdsToDeleteSet.has(name)
126
+ })
127
+ setSelectedUsers(updatedSelectedOrderIds)
128
+ }
129
+ }
130
+
115
131
  useEffect(() => {
116
132
  if (usersList.loading || usersList.users.length > 0 || paginationProps.totalPages <= 1) return
117
133
  if (paginationProps.currentPage !== paginationProps.totalPages) {
@@ -121,6 +137,13 @@ export const ProfessionalList = (props) => {
121
137
  }
122
138
  }, [usersList.users, paginationProps])
123
139
 
140
+ useEffect(() => {
141
+ if (usersList.loading) return
142
+ const userIds = usersList.users?.reduce((ids, user) => [...ids, user.id], [])
143
+ const _isAllChecked = userIds.every(elem => selectedUsers.includes(elem))
144
+ setIsAllChecked(_isAllChecked)
145
+ }, [usersList.users, selectedUsers])
146
+
124
147
  return (
125
148
  <>
126
149
  <UsersConatiner>
@@ -129,7 +152,22 @@ export const ProfessionalList = (props) => {
129
152
  <thead>
130
153
  <tr>
131
154
  {allowColumns?.user && (
132
- <th>{t('USER', 'User')}</th>
155
+ <th>
156
+ <AllCheckWrapper>
157
+ <CheckBoxWrapper
158
+ className='user_checkbox'
159
+ isChecked={!usersList?.loading && isAllChecked}
160
+ onClick={() => handleSelecteAllUser()}
161
+ >
162
+ {(!usersList?.loading && isAllChecked) ? (
163
+ <CheckSquareFill />
164
+ ) : (
165
+ <Square />
166
+ )}
167
+ </CheckBoxWrapper>
168
+ {t('USER', 'User')}
169
+ </AllCheckWrapper>
170
+ </th>
133
171
  )}
134
172
  {allowColumns?.phone && (
135
173
  <th>{t('PHONE', 'Phone')}</th>
@@ -240,3 +240,8 @@ export const VerifiedItemsContainer = styled.div`
240
240
  }
241
241
  }
242
242
  `
243
+
244
+ export const AllCheckWrapper = styled.div`
245
+ display: flex;
246
+ align-items: center;
247
+ `
@@ -10,6 +10,7 @@ import { SideBar } from '../../Shared'
10
10
  import { UsersDeleteButton } from '../UsersDeleteButton'
11
11
  import { UsersExportCSV } from '../UsersExportCSV'
12
12
  import { Button } from '../../../styles'
13
+ import { OccupationsFilter } from '../OccupationsFilter'
13
14
 
14
15
  import {
15
16
  UsersListingContainer,
@@ -41,7 +42,12 @@ const ProfessionalListingUI = (props) => {
41
42
  onUserRedirect,
42
43
  handleSuccessUpdate,
43
44
  handleSuccessAddUser,
44
- handleSuccessDeleteUser
45
+ handleSuccessDeleteUser,
46
+
47
+ occupationsState,
48
+ selectedOccupation,
49
+ handleSelectOccupation,
50
+ setSelectedUsers
45
51
  } = props
46
52
 
47
53
  const [, t] = useLanguage()
@@ -102,6 +108,11 @@ const ProfessionalListingUI = (props) => {
102
108
  handleChangeUserActiveState={handleChangeUserActiveState}
103
109
  />
104
110
  <ActionsContainer>
111
+ <OccupationsFilter
112
+ occupationsState={occupationsState}
113
+ selectedOccupation={selectedOccupation}
114
+ handleSelectOccupation={handleSelectOccupation}
115
+ />
105
116
  <ActionButtonsGroup>
106
117
  <Button
107
118
  borderRadius='8px'
@@ -134,6 +145,7 @@ const ProfessionalListingUI = (props) => {
134
145
  userDetailsId={openUser?.id || queryId}
135
146
  handleOpenUserDetails={handleOpenUserDetails}
136
147
  handleOpenUserAddForm={handleOpenUserAddForm}
148
+ setSelectedUsers={setSelectedUsers}
137
149
  />
138
150
  </UsersListingContainer>
139
151
 
@@ -143,6 +155,7 @@ const ProfessionalListingUI = (props) => {
143
155
  open={isOpenUserDetails}
144
156
  user={openUser}
145
157
  userId={openUser?.id || queryId}
158
+ occupations={occupationsState.occupations}
146
159
  onClose={() => handleBackRedirect()}
147
160
  handleSuccessUpdate={handleSuccessUpdate}
148
161
  handleSuccessDeleteUser={handleSuccessDeleteUser}
@@ -125,6 +125,7 @@ export const ScheduleContentWrapper = styled.div`
125
125
  export const ButtonWrapper = styled.div`
126
126
  position: sticky;
127
127
  top: 100%;
128
+ padding: 20px 0 30px 0;
128
129
 
129
130
  button {
130
131
  height: 44px;
@@ -72,7 +72,7 @@ export const UserDetailsUI = (props) => {
72
72
  {handleChangeActiveUser && (
73
73
  <Switch
74
74
  defaultChecked={userState?.user?.enabled || false}
75
- onChange={enabled => handleChangeActiveUser({ id: userState?.user?.id, enabled: enabled })}
75
+ onChange={enabled => handleChangeActiveUser({ ...userState?.user, enabled: enabled })}
76
76
  />
77
77
  )}
78
78
  </>
@@ -8,6 +8,7 @@ import { sortInputFields } from '../../../utils'
8
8
  import { Switch, Input, Button } from '../../../styles'
9
9
  import { Eye, EyeSlash } from 'react-bootstrap-icons'
10
10
  import { UserTypeSelector } from '../UserTypeSelector'
11
+ import { OccupationSelector } from '../OccupationSelector'
11
12
 
12
13
  import {
13
14
  FormInput,
@@ -35,7 +36,9 @@ export const UserFormDetailsUI = (props) => {
35
36
  isDriversPage,
36
37
  handleChangeSwtich,
37
38
  handleChangeUserType,
38
- isProfessional
39
+ isProfessional,
40
+ occupations,
41
+ handleChangeOccupation
39
42
  } = props
40
43
 
41
44
  const formMethods = useForm()
@@ -257,10 +260,16 @@ export const UserFormDetailsUI = (props) => {
257
260
  autoComplete='off'
258
261
  />
259
262
  )}
260
-
261
263
  </React.Fragment>
262
264
  )
263
265
  )}
266
+ {isProfessional && occupations.length > 0 && (
267
+ <OccupationSelector
268
+ occupationId={user?.occupation_id}
269
+ occupations={occupations}
270
+ handleChangeOccupation={handleChangeOccupation}
271
+ />
272
+ )}
264
273
  {!!showInputPhoneNumber && (
265
274
  <InputPhoneNumber
266
275
  user={user}
@@ -39,6 +39,12 @@ export const UserTypeSelector = (props) => {
39
39
  content: <Option>{t('CALL_CENTER_AGENT', 'Call center agent')}</Option>,
40
40
  showOnSelected: <Option padding>{t('CALL_CENTER_AGENT', 'Call center agent')}</Option>,
41
41
  disabled: !isPrimary && defaultUserType === 9
42
+ },
43
+ {
44
+ value: 8,
45
+ content: <Option>{t('PROFESSIONAL', 'Professional')}</Option>,
46
+ showOnSelected: <Option padding>{t('PROFESSIONAL', 'Professional')}</Option>,
47
+ disabled: !isPrimary && defaultUserType === 8
42
48
  }
43
49
  ]
44
50
  const placeholder = <Option isWeight>{t('TYPE', 'Type')}</Option>
@@ -1,11 +1,9 @@
1
1
  import React, { useState, useEffect } from 'react'
2
2
  import Skeleton from 'react-loading-skeleton'
3
3
  import { useLanguage, useUtils } from 'ordering-components-admin-external'
4
- import MdCheckBoxOutlineBlank from '@meronex/icons/md/MdCheckBoxOutlineBlank'
5
- import MdCheckBox from '@meronex/icons/md/MdCheckBox'
6
4
  import FaUserAlt from '@meronex/icons/fa/FaUserAlt'
7
5
 
8
- import { Envelope, Phone } from 'react-bootstrap-icons'
6
+ import { Envelope, Phone, CheckSquareFill, Square } from 'react-bootstrap-icons'
9
7
  import { Switch } from '../../../styles'
10
8
  import { ConfirmAdmin, Pagination } from '../../Shared'
11
9
 
@@ -24,7 +22,8 @@ import {
24
22
  AddNewUserButton,
25
23
  UsersBottomContainer,
26
24
  VerifiedItemsContainer,
27
- VerifiedItem
25
+ VerifiedItem,
26
+ AllCheckWrapper
28
27
  } from './styles'
29
28
 
30
29
  export const UsersList = (props) => {
@@ -37,13 +36,15 @@ export const UsersList = (props) => {
37
36
  selectedUsers,
38
37
  handleSelectedUsers,
39
38
  handleOpenUserDetails,
40
- handleOpenUserAddForm
39
+ handleOpenUserAddForm,
40
+ setSelectedUsers
41
41
  } = props
42
42
 
43
43
  const [, t] = useLanguage()
44
44
  const [{ optimizeImage }] = useUtils()
45
45
 
46
46
  const [confirmAdmin, setConfirmAdmin] = useState({ open: false, handleOnConfirm: null })
47
+ const [isAllChecked, setIsAllChecked] = useState(false)
47
48
 
48
49
  const getUserType = (type) => {
49
50
  const userTypes = [
@@ -87,6 +88,26 @@ export const UsersList = (props) => {
87
88
  }
88
89
  }
89
90
 
91
+ const handleSelecteAllUser = () => {
92
+ const userIds = usersList.users?.reduce((ids, user) => [...ids, user.id], [])
93
+ if (!isAllChecked) {
94
+ setSelectedUsers([...selectedUsers, ...userIds])
95
+ } else {
96
+ const userIdsToDeleteSet = new Set(userIds)
97
+ const updatedSelectedOrderIds = selectedUsers.filter((name) => {
98
+ return !userIdsToDeleteSet.has(name)
99
+ })
100
+ setSelectedUsers(updatedSelectedOrderIds)
101
+ }
102
+ }
103
+
104
+ useEffect(() => {
105
+ if (usersList.loading) return
106
+ const userIds = usersList.users?.reduce((ids, user) => [...ids, user.id], [])
107
+ const _isAllChecked = userIds.every(elem => selectedUsers.includes(elem))
108
+ setIsAllChecked(_isAllChecked)
109
+ }, [usersList.users, selectedUsers])
110
+
90
111
  useEffect(() => {
91
112
  if (usersList.loading || usersList.users.length > 0 || paginationProps.totalPages <= 1) return
92
113
  if (paginationProps.currentPage !== paginationProps.totalPages) {
@@ -103,7 +124,22 @@ export const UsersList = (props) => {
103
124
  <UsersTable>
104
125
  <thead>
105
126
  <tr>
106
- <th>{t('USER', 'User')}</th>
127
+ <th>
128
+ <AllCheckWrapper>
129
+ <CheckBoxWrapper
130
+ className='all-checkbox'
131
+ isChecked={!usersList?.loading && isAllChecked}
132
+ onClick={() => handleSelecteAllUser()}
133
+ >
134
+ {(!usersList?.loading && isAllChecked) ? (
135
+ <CheckSquareFill />
136
+ ) : (
137
+ <Square />
138
+ )}
139
+ </CheckBoxWrapper>
140
+ {t('USER', 'User')}
141
+ </AllCheckWrapper>
142
+ </th>
107
143
  <th>{t('PHONE', 'Phone')}</th>
108
144
  <th>{t('TYPE', 'Type')}</th>
109
145
  <th className='amout-orders '>{t('AMOUNT_OF_ORDERS', 'Amount of orders')}</th>
@@ -159,9 +195,9 @@ export const UsersList = (props) => {
159
195
  onClick={() => handleSelectedUsers(user.id)}
160
196
  >
161
197
  {selectedUsers.includes(user.id) ? (
162
- <MdCheckBox />
198
+ <CheckSquareFill />
163
199
  ) : (
164
- <MdCheckBoxOutlineBlank />
200
+ <Square />
165
201
  )}
166
202
  </CheckBoxWrapper>
167
203
  <WrapperImage>
@@ -136,7 +136,7 @@ export const CheckBoxWrapper = styled.div`
136
136
  margin-right: 10px;
137
137
  `}
138
138
  svg {
139
- font-size: 24px;
139
+ font-size: 16px;
140
140
  color: #B1BCCC;
141
141
  }
142
142
 
@@ -144,7 +144,7 @@ export const CheckBoxWrapper = styled.div`
144
144
  svg {
145
145
  color: ${props => props.theme.colors?.primary};
146
146
  }
147
- `}
147
+ `}
148
148
  `
149
149
 
150
150
  export const InfoBlock = styled.div`
@@ -249,3 +249,8 @@ export const VerifiedItemsContainer = styled.div`
249
249
  }
250
250
  }
251
251
  `
252
+
253
+ export const AllCheckWrapper = styled.div`
254
+ display: flex;
255
+ align-items: center;
256
+ `
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useEffect } from 'react'
2
2
  import { useLocation } from 'react-router-dom'
3
- import { UsersList as UsersListController, useLanguage } from 'ordering-components-admin-external'
3
+ import { useLanguage, UsersList as UsersListController } from 'ordering-components-admin-external'
4
4
  import { UsersList } from '../UsersList'
5
5
  import { UsersListingHeader } from '../UsersListingHeader'
6
6
  import { UserTypeFilter } from '../UserTypeFilter'
@@ -42,7 +42,8 @@ const UsersListingUI = (props) => {
42
42
  onUserRedirect,
43
43
  handleSuccessUpdate,
44
44
  handleSuccessAddUser,
45
- handleSuccessDeleteUser
45
+ handleSuccessDeleteUser,
46
+ setSelectedUsers
46
47
  } = props
47
48
 
48
49
  const [, t] = useLanguage()
@@ -139,6 +140,7 @@ const UsersListingUI = (props) => {
139
140
  userDetailsId={openUser?.id || queryId}
140
141
  handleOpenUserDetails={handleOpenUserDetails}
141
142
  handleOpenUserAddForm={handleOpenUserAddForm}
143
+ setSelectedUsers={setSelectedUsers}
142
144
  />
143
145
  </UsersListingContainer>
144
146