ordering-ui-admin-external 1.42.14 → 1.42.16

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 (30) hide show
  1. package/_bundles/{ordering-ui-admin.12d91da09a4a1eb7c6e3.js → ordering-ui-admin.fe5b500282e81ee0fd32.js} +2 -2
  2. package/_modules/components/Banners/index.js +62 -0
  3. package/_modules/components/Banners/styles.js +17 -0
  4. package/_modules/components/Home/HomePage/index.js +5 -2
  5. package/_modules/components/Layout/index.js +3 -1
  6. package/_modules/components/Orders/DeliveryDashboard/index.js +1 -1
  7. package/_modules/components/Orders/OrdersCards/index.js +5 -1
  8. package/_modules/components/Orders/OrdersDashboard/index.js +1 -1
  9. package/_modules/components/Orders/OrdersTable/Order.js +9 -1
  10. package/_modules/components/Orders/OrdersTable/index.js +21 -2
  11. package/_modules/components/Orders/OrdersTable/styles.js +35 -34
  12. package/_modules/index.js +7 -0
  13. package/_modules/styles/Buttons/index.js +34 -23
  14. package/index-template.js +5 -2
  15. package/package.json +2 -2
  16. package/src/components/Banners/index.js +69 -0
  17. package/src/components/Banners/styles.js +68 -0
  18. package/src/components/Home/HomePage/index.js +2 -1
  19. package/src/components/Layout/index.js +1 -1
  20. package/src/components/Orders/DeliveryDashboard/index.js +1 -1
  21. package/src/components/Orders/OrdersCards/index.js +9 -0
  22. package/src/components/Orders/OrdersDashboard/index.js +1 -1
  23. package/src/components/Orders/OrdersTable/Order.js +11 -2
  24. package/src/components/Orders/OrdersTable/index.js +17 -4
  25. package/src/components/Orders/OrdersTable/styles.js +11 -0
  26. package/src/index.js +2 -0
  27. package/src/styles/Buttons/index.js +11 -0
  28. package/template/app.js +14 -1
  29. package/template/config.json +1 -1
  30. /package/_bundles/{ordering-ui-admin.12d91da09a4a1eb7c6e3.js.LICENSE.txt → ordering-ui-admin.fe5b500282e81ee0fd32.js.LICENSE.txt} +0 -0
package/index-template.js CHANGED
@@ -8,6 +8,7 @@ import { Integrations } from '@sentry/tracing'
8
8
  import { ThemeProvider } from './src/contexts/ThemeContext'
9
9
  import { ConfigFileContext } from './src/contexts/ConfigFileContext'
10
10
  import { InfoShareProvider } from './src/contexts/InfoShareContext'
11
+ import { ProjectProvider } from './src/contexts/ProjectContext'
11
12
  import { Toast } from './src/styles/Toast'
12
13
  import theme from './template/theme.json'
13
14
  import settings from './template/config.json'
@@ -656,8 +657,10 @@ const RouteApp = () => {
656
657
  <AutologinParams configFile={configFile}>
657
658
  <OrderingProvider Alert={Alert}>
658
659
  <InfoShareProvider>
659
- <Router />
660
- <Toast />
660
+ <ProjectProvider>
661
+ <Router />
662
+ <Toast />
663
+ </ProjectProvider>
661
664
  </InfoShareProvider>
662
665
  </OrderingProvider>
663
666
  </AutologinParams>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-admin-external",
3
- "version": "1.42.14",
3
+ "version": "1.42.16",
4
4
  "description": "Ordering UI Admin Components",
5
5
  "main": "./_modules/index.js",
6
6
  "exports": {
@@ -83,7 +83,7 @@
83
83
  "lodash": "^4.17.20",
84
84
  "moment": "^2.29.1",
85
85
  "moment-range": "^4.0.2",
86
- "ordering-components-admin-external": "1.42.9",
86
+ "ordering-components-admin-external": "1.42.11",
87
87
  "polished": "^3.6.7",
88
88
  "prop-types": "^15.7.2",
89
89
  "react-big-calendar": "^1.4.2",
@@ -0,0 +1,69 @@
1
+ import React, { useEffect, useRef } from 'react'
2
+ import { useLanguage, useSession } from 'ordering-components-admin-external'
3
+ import { useTheme } from 'styled-components'
4
+ import { ExclamationTriangle } from 'react-bootstrap-icons'
5
+
6
+ import {
7
+ Container,
8
+ Banner,
9
+ Icon,
10
+ Content,
11
+ ButtonWrap
12
+ } from './styles'
13
+ import { Button } from '../../styles'
14
+
15
+ export const Banners = (props) => {
16
+ const { type, urlToGo, setLayoutPT } = props
17
+
18
+ const fixedRef = useRef(null)
19
+ const theme = useTheme()
20
+ const [, t] = useLanguage()
21
+ const [{ user }] = useSession()
22
+
23
+ const handleClick = () => {
24
+ if (!urlToGo) return
25
+ window.open(urlToGo, '_blank').focus()
26
+ }
27
+
28
+ useEffect(() => {
29
+ if (fixedRef.current) {
30
+ setLayoutPT(fixedRef.current.offsetHeight)
31
+ }
32
+ })
33
+
34
+ return (
35
+ type === 'past_due' ? (
36
+ <Container ref={fixedRef}>
37
+ <Banner>
38
+ <Icon>
39
+ <ExclamationTriangle
40
+ size={26}
41
+ color={theme.colors.warning}
42
+ />
43
+ </Icon>
44
+ <Content>
45
+ <h1>{t('PAST_DUE_TITLE_BANNER', 'Hey :user:, we have a problem, your account is past due.').replace(':user:', user?.name)}</h1>
46
+ <p>{t('PAST_DUE_SUBTITLE_BANNER', 'There appears to be an issue with your payment. Kindly update the card on file and complete your payment.')}</p>
47
+ </Content>
48
+ <ButtonWrap>
49
+ <Button
50
+ color='warning'
51
+ style={{
52
+ borderRadius: 8,
53
+ padding: '5px 30px',
54
+ maxHeight: '40px'
55
+ }}
56
+ onClick={() => handleClick()}
57
+ >
58
+ {t('PAY_NOW', 'Pay now')}
59
+ </Button>
60
+ </ButtonWrap>
61
+ </Banner>
62
+ </Container>
63
+ ) : null
64
+ )
65
+ }
66
+
67
+ Banners.defaultProps = {
68
+ type: 'past_due'
69
+ }
@@ -0,0 +1,68 @@
1
+ import styled from 'styled-components'
2
+
3
+ export const Container = styled.div`
4
+ width: 100vw;
5
+ position: fixed;
6
+ top: 0;
7
+ left: 0;
8
+ z-index: 10000;
9
+ `
10
+
11
+ export const Banner = styled.div`
12
+ display: flex;
13
+ justify-content: space-between;
14
+ align-items: center;
15
+ width: 100%;
16
+ background-color: ${props => props.theme.colors.warning100};
17
+ padding: 20px;
18
+ border-radius: 8px;
19
+
20
+ @media (max-width: 768px) {
21
+ flex-direction: column;
22
+ height: auto;
23
+ }
24
+ `
25
+
26
+ export const Icon = styled.div`
27
+ flex: 1;
28
+ max-width: 5%;
29
+ text-align: center;
30
+
31
+ @media (max-width: 768px) {
32
+ max-width: 100%;
33
+ margin-bottom: 10px;
34
+ }
35
+ `
36
+
37
+ export const Content = styled.div`
38
+ flex: 2;
39
+ max-width: 80%;
40
+ text-align: left;
41
+
42
+ h1, p {
43
+ font-size: 1rem;
44
+ margin: 0;
45
+ padding: 0;
46
+ }
47
+
48
+ h1 {
49
+ font-weight: bold;
50
+ }
51
+
52
+ @media (max-width: 768px) {
53
+ max-width: 100%;
54
+ text-align: center;
55
+ margin-bottom: 10px;
56
+ }
57
+ `
58
+
59
+ export const ButtonWrap = styled.div`
60
+ flex: 1;
61
+ max-width: 15%;
62
+ text-align: center;
63
+
64
+ @media (max-width: 768px) {
65
+ max-width: 100%;
66
+ margin-bottom: 10px;
67
+ }
68
+ `
@@ -4,6 +4,7 @@ import { Line } from 'react-chartjs-2'
4
4
  import moment from 'moment'
5
5
  import { IconButton, Button } from '../../../styles/Buttons'
6
6
  import { useInfoShare } from '../../../contexts/InfoShareContext'
7
+ import { useProjectState } from '../../../contexts/ProjectContext'
7
8
  import Skeleton from 'react-loading-skeleton'
8
9
  import { useWindowSize } from '../../../hooks/useWindowSize'
9
10
  import { useTheme } from 'styled-components'
@@ -51,7 +52,6 @@ import {
51
52
 
52
53
  const HomeUI = (props) => {
53
54
  const {
54
- projectStatus,
55
55
  ordersList,
56
56
  todaySalelsList,
57
57
  monthSalesList,
@@ -65,6 +65,7 @@ const HomeUI = (props) => {
65
65
  const [{ isCollapse }, { handleMenuCollapse }] = useInfoShare()
66
66
  const [timeAxes, setTimeAxes] = useState([])
67
67
  const [events] = useEvent()
68
+ const [projectStatus] = useProjectState()
68
69
  const { width } = useWindowSize()
69
70
  const [{ parsePrice }] = useUtils()
70
71
  const [sessionState] = useSession()
@@ -2,7 +2,7 @@ import React from 'react'
2
2
 
3
3
  export const Layout = (props) => {
4
4
  return (
5
- <div className='d-flex' style={{ maxWidth: '100vw', width: '100vw' }}>
5
+ <div className='d-flex' style={{ maxWidth: '100vw', width: '100vw', paddingTop: props.pt ?? 0 }}>
6
6
  {props.children}
7
7
  </div>
8
8
  )
@@ -32,7 +32,7 @@ export const DeliveryDashboard = (props) => {
32
32
  const [{ configs }] = useConfig()
33
33
 
34
34
  if ((configs?.optimize_order_data && (configs?.optimize_order_data?.value === '1'))) {
35
- ordersDashboardListProps.propsToFetch = ['app_id', 'business', 'business_id', 'created_at', 'customer', 'customer_id', 'delivery_type', 'driver_group_id', 'driver_id', 'driver', 'delivery_datetime', 'delivery_datetime_utc', 'external_id', 'eta_time', 'id', 'logistic_status', 'logistic_attemps', 'uuid', 'order_group', 'order_group_id', 'priority', 'summary', 'status', 'time_status', 'total']
35
+ ordersDashboardListProps.propsToFetch = ['app_id', 'business', 'business_id', 'created_at', 'customer', 'customer_id', 'delivery_type', 'driver_group_id', 'driver_id', 'driver', 'delivery_datetime', 'delivery_datetime_utc', 'external_id', 'eta_time', 'id', 'logistic_status', 'logistic_attemps', 'uuid', 'order_group', 'order_group_id', 'priority', 'summary', 'status', 'time_status', 'total', 'metadata']
36
36
  }
37
37
 
38
38
  const [interActionMapOrder, setInterActionMapOrder] = useState(null)
@@ -256,6 +256,15 @@ export const OrdersCards = (props) => {
256
256
  <p className={order?.time_status}>{displayDelayedTime(order)}</p>
257
257
  </Timer>
258
258
  )}
259
+ { order?.codigoPod && (
260
+ <div style={{paddingTop: 50}}>
261
+ <p>
262
+ {
263
+ `${t('PODS', 'Pod')}: ${order?.codigoPod}`
264
+ }
265
+ </p>
266
+ </div>
267
+ )}
259
268
  </CardHeading>
260
269
  {isMessagesView && order?.unread_count > 0 && (
261
270
  <UnreadMessageCounter>
@@ -11,7 +11,7 @@ export const OrdersDashboard = (props) => {
11
11
  ...props
12
12
  }
13
13
  if ((configs?.optimize_order_data && (configs?.optimize_order_data?.value === '1'))) {
14
- ordersDashboardListProps.propsToFetch = ['app_id', 'business', 'business_id', 'created_at', 'customer', 'customer_id', 'delivery_type', 'driver_group_id', 'driver_id', 'driver', 'delivery_datetime', 'delivery_datetime_utc', 'external_id', 'eta_time', 'id', 'logistic_status', 'logistic_attemps', 'uuid', 'order_group', 'order_group_id', 'priority', 'summary', 'status', 'time_status', 'total', 'driver_group_business']
14
+ ordersDashboardListProps.propsToFetch = ['app_id', 'business', 'business_id', 'created_at', 'customer', 'customer_id', 'delivery_type', 'driver_group_id', 'driver_id', 'driver', 'delivery_datetime', 'delivery_datetime_utc', 'external_id', 'eta_time', 'id', 'logistic_status', 'logistic_attemps', 'uuid', 'order_group', 'order_group_id', 'priority', 'summary', 'status', 'time_status', 'total', 'driver_group_business', 'metadata']
15
15
  }
16
16
  return (
17
17
  <OrdersManageContainer>
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { BusinessInfo, CheckBox, CustomerInfo, LogisticStatusDot, OrderNumberContainer, OrdersCountWrapper, PriorityDot, StatusInfo, Timer, Timestatus, WrapperImage, InfoWrapper, ChannelInfo, EtaInfo } from './styles'
2
+ import { BusinessInfo, CheckBox, CustomerInfo, LogisticStatusDot, OrderNumberContainer, OrdersCountWrapper, PriorityDot, StatusInfo, Timer, Timestatus, WrapperImage, InfoWrapper, ChannelInfo, EtaInfo, PodInfo } from './styles'
3
3
  import RiCheckboxFill from '@meronex/icons/ri/RiCheckboxFill'
4
4
  import RiCheckboxBlankLine from '@meronex/icons/ri/RiCheckboxBlankLine'
5
5
  import { useLanguage, useUtils } from 'ordering-components-admin-external'
@@ -287,11 +287,20 @@ export const Order = React.memo((props) => {
287
287
  return (
288
288
  <td className='channelInfo' key={`channelInfo${i}-${index}`}>
289
289
  <ChannelInfo>
290
- <p className='bold'>{order.app_id}</p>
290
+ <p className='bold'>{order?.app_id}</p>
291
291
  </ChannelInfo>
292
292
  </td>
293
293
  )
294
294
  }
295
+ if (column === 'pod') {
296
+ return (
297
+ <td className='podInfo' key={`podInfo${i}-${index}`}>
298
+ <PodInfo>
299
+ <p className='bold'>{order?.codigoPod}</p>
300
+ </PodInfo>
301
+ </td>
302
+ )
303
+ }
295
304
  if (column === 'total') {
296
305
  return (
297
306
  <td className='orderPrice' key={`total${i}-${index}`}>
@@ -146,6 +146,10 @@ export const OrdersTable = memo((props) => {
146
146
  {
147
147
  value: 'channel',
148
148
  content: t('CHANNEL', 'Channel')
149
+ },
150
+ {
151
+ value: 'pod',
152
+ content: t('PODS', 'Pod')
149
153
  }
150
154
  ]
151
155
 
@@ -263,11 +267,13 @@ export const OrdersTable = memo((props) => {
263
267
 
264
268
  const handleChangeAllowColumns = (type) => {
265
269
  let _column = {}
266
- if (type === 'channel'){
267
- _column = { visable:allowColumns[type].visable ,title: t('CHANNEL', 'Channel'), className: 'channelInfo', draggable: true, colSpan: 1, order: 12 }
268
- }else{
270
+ if (type === 'channel') {
271
+ _column = { visable: allowColumns[type]?.visable ?? false, title: t('CHANNEL', 'Channel'), className: 'channelInfo', draggable: true, colSpan: 1, order: 12 }
272
+ } else if (type === 'pod') {
273
+ _column = { visable: allowColumns[type]?.visable ?? false, title: t('PODS', 'Pod'), className: 'podInfo', draggable: true, colSpan: 1, order: 13 }
274
+ } else {
269
275
  _column = allowColumns[type]
270
- }
276
+ }
271
277
  const updatedAllowColumns = {
272
278
  ...allowColumns,
273
279
  [type]: { ..._column, visable: !_column?.visable }
@@ -629,6 +635,13 @@ export const OrdersTable = memo((props) => {
629
635
  </WrapOrderStatusSelector>
630
636
  </td>
631
637
  )}
638
+ {allowColumns?.pod?.visable && !isSelectedOrders && (
639
+ <td className='orderStatusTitle'>
640
+ <WrapOrderStatusSelector>
641
+ <Skeleton width={100} height={30} />
642
+ </WrapOrderStatusSelector>
643
+ </td>
644
+ )}
632
645
  {!isSelectedOrders && (
633
646
  <td className='orderPrice'>
634
647
  <div className='info'>
@@ -178,6 +178,7 @@ export const CustomerInfo = styled(BusinessInfo)`
178
178
  max-width: 125px;
179
179
  }
180
180
  `
181
+
181
182
  export const StatusInfo = styled.div`
182
183
  .bold {
183
184
  max-width: 150px;
@@ -185,6 +186,7 @@ export const StatusInfo = styled.div`
185
186
  margin: 0;
186
187
  }
187
188
  `
189
+
188
190
  export const ChannelInfo = styled.div`
189
191
  .bold {
190
192
  max-width: 150px;
@@ -192,6 +194,7 @@ export const ChannelInfo = styled.div`
192
194
  margin: 0;
193
195
  }
194
196
  `
197
+
195
198
  export const EtaInfo = styled.div`
196
199
  .bold {
197
200
  max-width: 150px;
@@ -200,6 +203,14 @@ export const EtaInfo = styled.div`
200
203
  }
201
204
  `
202
205
 
206
+ export const PodInfo = styled.div`
207
+ .bold {
208
+ max-width: 150px;
209
+ font-weight: 600;
210
+ margin: 0;
211
+ }
212
+ `
213
+
203
214
  export const DriversInfo = styled.div`
204
215
  .select {
205
216
  > div:first-child {
package/src/index.js CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  OrderingProductDetails
9
9
  } from './components/OrderingProducts'
10
10
  import { PageNotFound } from './components/PageNotFound'
11
+ import { Banners } from './components/Banners'
11
12
  import {
12
13
  AllInOne,
13
14
  Appointments,
@@ -436,6 +437,7 @@ export {
436
437
  ChatBusinessesList,
437
438
  OrdersManager,
438
439
  PageNotFound,
440
+ Banners,
439
441
  Messages,
440
442
  OrdersContentHeader,
441
443
  OrdersDashboardList,
@@ -219,6 +219,17 @@ export const Button = styled.button`
219
219
  background: ${props => darken(0.1, props.theme.colors.lightPrimary)};
220
220
  }
221
221
  `}
222
+ ${({ color }) => color === 'warning' && css`
223
+ background: ${props => props.theme.colors.warning};
224
+ color: #FFF;
225
+ border-color: ${props => props.theme.colors.warning};
226
+ &:hover {
227
+ background: ${props => darken(0.04, props.theme.colors.warning)};
228
+ }
229
+ &:active {
230
+ background: ${props => darken(0.1, props.theme.colors.warning)};
231
+ }
232
+ `}
222
233
  ${({ color }) => color === 'secundaryDark' && css`
223
234
  background: ${props => props.theme.colors.secundaryDarkContrast};
224
235
  color: ${props => props.theme.colors.secundaryDark};
package/template/app.js CHANGED
@@ -86,14 +86,18 @@ import { CustomProject } from './pages/CustomProject'
86
86
  import { OrderingWidgets } from './pages/OrderingWidgets'
87
87
  import { BusinessDevicesList } from './pages/BusinessDevicesList'
88
88
  import { SettingsLogs } from './pages/SettingsLogs'
89
+ import { Banners } from '../src/components/Banners'
90
+ import { useProjectState } from '../src/contexts/ProjectContext'
89
91
 
90
92
  export const App = () => {
91
93
  const history = useHistory()
92
94
  const [events] = useEvent()
93
95
  const [{ auth, loading, user }] = useSession()
94
96
  const [orderStatus] = useOrder()
97
+ const [projectStatus] = useProjectState()
95
98
  const [{ configs, loading: configLoading }] = useConfig()
96
99
  const [loaded, setLoaded] = useState(false)
100
+ const [layoutPT, setLayoutPT] = useState(0)
97
101
  const [oneSignalState, setOneSignalState] = useState({
98
102
  notification_app: settings.notification_app
99
103
  })
@@ -102,6 +106,8 @@ export const App = () => {
102
106
  const { height } = useWindowSize()
103
107
 
104
108
  const cannyAppId = '5b05e5e2d3f6c47201694ad4'
109
+ const isPastDue = projectStatus.project?.current_status === 'past_due'
110
+ const showBanner = auth && isPastDue
105
111
 
106
112
  const { search } = useLocation()
107
113
  let queryProject
@@ -207,7 +213,14 @@ export const App = () => {
207
213
  {cannyAppId && (
208
214
  <CannyIdentification appId={cannyAppId} />
209
215
  )}
210
- <Layout>
216
+ {showBanner && (
217
+ <Banners
218
+ type={projectStatus.project?.current_status}
219
+ urlToGo={settings?.billing_url}
220
+ setLayoutPT={setLayoutPT}
221
+ />
222
+ )}
223
+ <Layout pt={showBanner && `${layoutPT}px`}>
211
224
  {auth && (
212
225
  <SidebarMenu billingUrl={settings?.billing_url} />
213
226
  )}
@@ -2,7 +2,7 @@
2
2
  "app_id": "ordering-admin-react",
3
3
  "notification_app": "dashboardweb",
4
4
  "app_name": "Ordering Admin",
5
- "billing_url": "https://billing-dashboard.tryordering.com",
5
+ "billing_url": "https://start-free.tryordering.com",
6
6
  "api": {
7
7
  "url": "https://apiv4.ordering.co",
8
8
  "language": "en",