ordering-ui-admin-external 1.8.4 → 1.9.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 (110) hide show
  1. package/_bundles/{ordering-ui-admin.ec185d6eb5351ecebfac.js → ordering-ui-admin.46b3298439d9527907e3.js} +2 -2
  2. package/_bundles/{ordering-ui-admin.ec185d6eb5351ecebfac.js.LICENSE.txt → ordering-ui-admin.46b3298439d9527907e3.js.LICENSE.txt} +0 -0
  3. package/_modules/components/MyProducts/OrderingWebsite/index.js +50 -8
  4. package/_modules/components/Settings/Deliverect/index.js +103 -0
  5. package/_modules/components/Settings/Deliverect/styles.js +115 -0
  6. package/_modules/components/Settings/IntegrationListing/index.js +41 -2
  7. package/_modules/components/Settings/IntegrationListing/styles.js +7 -4
  8. package/_modules/components/Settings/ItsaCheckmate/index.js +112 -0
  9. package/_modules/components/Settings/ItsaCheckmate/styles.js +118 -0
  10. package/_modules/components/Settings/PickerExpress/index.js +178 -0
  11. package/_modules/components/Settings/PickerExpress/styles.js +111 -0
  12. package/_modules/components/Settings/PlaceListing/index.js +1 -6
  13. package/_modules/components/Stores/BusinessAdd/BusinessDetails/index.js +95 -0
  14. package/_modules/components/Stores/BusinessAdd/BusinessDetails/styles.js +43 -0
  15. package/_modules/components/Stores/BusinessAdd/DeliveryZone/index.js +233 -0
  16. package/_modules/components/Stores/BusinessAdd/DeliveryZone/styles.js +40 -0
  17. package/_modules/components/Stores/BusinessAdd/Images/index.js +181 -0
  18. package/_modules/components/Stores/BusinessAdd/Images/styles.js +42 -0
  19. package/_modules/components/Stores/BusinessAdd/OrderTypePriceLevel/index.js +53 -0
  20. package/_modules/components/Stores/BusinessAdd/OrderTypePriceLevel/styles.js +31 -0
  21. package/_modules/components/Stores/BusinessAdd/OtherDetails/index.js +43 -0
  22. package/_modules/components/Stores/BusinessAdd/OtherDetails/styles.js +25 -0
  23. package/_modules/components/Stores/BusinessAdd/PaymentMethods/index.js +48 -0
  24. package/_modules/components/Stores/BusinessAdd/PaymentMethods/styles.js +31 -0
  25. package/_modules/components/Stores/BusinessAdd/Photos/index.js +174 -0
  26. package/_modules/components/Stores/BusinessAdd/Photos/styles.js +46 -0
  27. package/_modules/components/Stores/BusinessAdd/ReceiveOrders/index.js +48 -0
  28. package/_modules/components/Stores/BusinessAdd/ReceiveOrders/styles.js +24 -0
  29. package/_modules/components/Stores/BusinessAdd/Schedule/index.js +31 -0
  30. package/_modules/components/Stores/BusinessAdd/Schedule/styles.js +14 -0
  31. package/_modules/components/Stores/BusinessAdd/index.js +170 -0
  32. package/_modules/components/Stores/BusinessAdd/styles.js +29 -0
  33. package/_modules/components/Stores/BusinessDeliveryDetails/styles.js +1 -1
  34. package/_modules/components/Stores/BusinessDeliveryPickupMore/index.js +4 -0
  35. package/_modules/components/Stores/BusinessDeliveryZoneInformation/index.js +1 -1
  36. package/_modules/components/Stores/BusinessPickupDetails/styles.js +1 -1
  37. package/_modules/components/Stores/BusinessProductAddForm/index.js +4 -4
  38. package/_modules/components/Stores/BusinessProductsCategoyInfo/index.js +1 -6
  39. package/_modules/components/Stores/BusinessProductsListing/index.js +38 -14
  40. package/_modules/components/Stores/BusinessesList/index.js +3 -2
  41. package/_modules/components/Stores/BusinessesListing/index.js +51 -26
  42. package/_modules/components/Stores/BusinessesListing/styles.js +22 -15
  43. package/_modules/components/Stores/BusinessesListingHeader/index.js +6 -5
  44. package/_modules/components/Stores/ProductStartGuide/index.js +69 -0
  45. package/_modules/components/Stores/ProductStartGuide/styles.js +28 -0
  46. package/_modules/components/Stores/ProductStep/index.js +92 -0
  47. package/_modules/components/Stores/ProductStep/styles.js +18 -0
  48. package/_modules/components/Stores/RestaurantSelectGuide/index.js +104 -0
  49. package/_modules/components/Stores/RestaurantSelectGuide/styles.js +44 -0
  50. package/_modules/components/Stores/index.js +7 -0
  51. package/_modules/index.js +6 -0
  52. package/index-template.js +64 -2
  53. package/package.json +2 -2
  54. package/src/components/MyProducts/OrderingWebsite/index.js +45 -3
  55. package/src/components/Settings/Deliverect/index.js +149 -0
  56. package/src/components/Settings/Deliverect/styles.js +344 -0
  57. package/src/components/Settings/IntegrationListing/index.js +46 -12
  58. package/src/components/Settings/IntegrationListing/styles.js +7 -1
  59. package/src/components/Settings/ItsaCheckmate/index.js +170 -0
  60. package/src/components/Settings/ItsaCheckmate/styles.js +366 -0
  61. package/src/components/Settings/PickerExpress/index.js +222 -0
  62. package/src/components/Settings/PickerExpress/styles.js +330 -0
  63. package/src/components/Settings/PlaceListing/index.js +2 -2
  64. package/src/components/Stores/BusinessAdd/BusinessDetails/index.js +106 -0
  65. package/src/components/Stores/BusinessAdd/BusinessDetails/styles.js +107 -0
  66. package/src/components/Stores/BusinessAdd/DeliveryZone/index.js +250 -0
  67. package/src/components/Stores/BusinessAdd/DeliveryZone/styles.js +101 -0
  68. package/src/components/Stores/BusinessAdd/Images/index.js +168 -0
  69. package/src/components/Stores/BusinessAdd/Images/styles.js +94 -0
  70. package/src/components/Stores/BusinessAdd/OrderTypePriceLevel/index.js +43 -0
  71. package/src/components/Stores/BusinessAdd/OrderTypePriceLevel/styles.js +70 -0
  72. package/src/components/Stores/BusinessAdd/OtherDetails/index.js +51 -0
  73. package/src/components/Stores/BusinessAdd/OtherDetails/styles.js +49 -0
  74. package/src/components/Stores/BusinessAdd/PaymentMethods/index.js +39 -0
  75. package/src/components/Stores/BusinessAdd/PaymentMethods/styles.js +46 -0
  76. package/src/components/Stores/BusinessAdd/Photos/index.js +156 -0
  77. package/src/components/Stores/BusinessAdd/Photos/styles.js +108 -0
  78. package/src/components/Stores/BusinessAdd/ReceiveOrders/index.js +46 -0
  79. package/src/components/Stores/BusinessAdd/ReceiveOrders/styles.js +69 -0
  80. package/src/components/Stores/BusinessAdd/Schedule/index.js +23 -0
  81. package/src/components/Stores/BusinessAdd/Schedule/styles.js +14 -0
  82. package/src/components/Stores/BusinessAdd/index.js +184 -0
  83. package/src/components/Stores/BusinessAdd/styles.js +85 -0
  84. package/src/components/Stores/BusinessDeliveryDetails/styles.js +1 -0
  85. package/src/components/Stores/BusinessDeliveryPickupMore/index.js +9 -1
  86. package/src/components/Stores/BusinessDeliveryZoneInformation/index.js +8 -10
  87. package/src/components/Stores/BusinessPickupDetails/styles.js +1 -0
  88. package/src/components/Stores/BusinessProductAddForm/index.js +1 -1
  89. package/src/components/Stores/BusinessProductsCategoyInfo/index.js +4 -7
  90. package/src/components/Stores/BusinessProductsListing/index.js +20 -0
  91. package/src/components/Stores/BusinessesList/index.js +3 -2
  92. package/src/components/Stores/BusinessesListing/index.js +101 -67
  93. package/src/components/Stores/BusinessesListing/styles.js +36 -0
  94. package/src/components/Stores/BusinessesListingHeader/index.js +58 -51
  95. package/src/components/Stores/ProductStartGuide/index.js +60 -0
  96. package/src/components/Stores/ProductStartGuide/styles.js +62 -0
  97. package/src/components/Stores/ProductStep/index.js +84 -0
  98. package/src/components/Stores/ProductStep/styles.js +29 -0
  99. package/src/components/Stores/RestaurantSelectGuide/index.js +119 -0
  100. package/src/components/Stores/RestaurantSelectGuide/styles.js +150 -0
  101. package/src/components/Stores/index.js +2 -0
  102. package/src/index.js +2 -0
  103. package/template/app.js +4 -0
  104. package/template/assets/images/dummies/no-businesses.png +0 -0
  105. package/template/assets/images/import-menu.png +0 -0
  106. package/template/assets/images/imported-menu.png +0 -0
  107. package/template/assets/images/picker-express.png +0 -0
  108. package/template/components/ListenPageChanges/index.js +1 -0
  109. package/template/helmetdata.json +7 -0
  110. package/template/pages/BusinessAdd/index.js +11 -0
@@ -0,0 +1,94 @@
1
+ import styled, { css } from 'styled-components'
2
+
3
+ export const ImagesContainer = styled.div`
4
+ h2 {
5
+ font-weight: 600;
6
+ font-size: 16px;
7
+ line-height: 24px;
8
+ margin: 0;
9
+ }
10
+ `
11
+
12
+ export const ImageFormGroup = styled.div`
13
+ margin-top: 30px;
14
+ `
15
+
16
+ export const LogoImage = styled.div`
17
+ height: 160px;
18
+ width: 160px;
19
+ position: relative;
20
+ border-radius: 8px;
21
+ overflow: hidden;
22
+ cursor: -webkit-grab;
23
+ cursor: grab;
24
+ filter: drop-shadow(0px 1px 4px rgba(0, 0, 0, 0.1));
25
+
26
+ img,
27
+ div {
28
+ width: 100%;
29
+ border-radius: 8px;
30
+ height: 100%;
31
+ overflow: hidden;
32
+ };
33
+
34
+ img{
35
+ object-fit: contain;
36
+ }
37
+ `
38
+
39
+ export const BackgroundImage = styled(LogoImage)`
40
+ height: 190px;
41
+ width: 100%;
42
+ `
43
+
44
+ export const UploadImageIconContainer = styled.div`
45
+ position: absolute;
46
+ top: 0px;
47
+ background: ${props => props.theme.colors.secundaryDarkContrast};
48
+ ${({ bgimage }) => bgimage && css`
49
+ background: transparent;
50
+ svg, span {
51
+ color: ${props => props.theme.colors.white};
52
+ }
53
+ border: 1px dashed ${props => props.theme.colors.secundaryDarkContrast};
54
+ `}
55
+ ${({ small }) => small ? css`
56
+ padding: 4px;
57
+ ` : css`
58
+ padding: 8px;
59
+ `}
60
+ `
61
+
62
+ export const UploadImageIcon = styled.div`
63
+ display: flex;
64
+ justify-content: center;
65
+ align-items: center;
66
+ flex-direction: column;
67
+ color: ${props => props.theme.colors.disabled};
68
+ span {
69
+ margin-top: 14px;
70
+ font-size: 14px;
71
+ }
72
+
73
+ svg {
74
+ width: 52px;
75
+ height: 45px;
76
+ }
77
+ `
78
+
79
+ export const ImgInfoWrapper = styled.div`
80
+ margin-top: 15px;
81
+ h4 {
82
+ font-size: 14px;
83
+ line-height: 24px;
84
+ font-weight: 400;
85
+ margin: 0px;
86
+ }
87
+ p {
88
+ font-size: 12px;
89
+ line-height: 18px;
90
+ margin-top: 2px;
91
+ margin-bottom: 0px;
92
+ color: ${props => props.theme.colors.secundaryContrast};
93
+ }
94
+ `
@@ -0,0 +1,43 @@
1
+ import React from 'react'
2
+ import { useLanguage } from 'ordering-components-admin-external'
3
+ import { RecordCircleFill, Circle } from 'react-bootstrap-icons'
4
+ import {
5
+ Container,
6
+ PriceLevelContainer,
7
+ PriceLevelList,
8
+ PriceLevelItem
9
+ } from './styles'
10
+
11
+ export const OrderTypePriceLevel = (props) => {
12
+ const { formState, changeFormState } = props
13
+
14
+ const [, t] = useLanguage()
15
+
16
+ const priceList = [
17
+ { key: '1', value: '$' },
18
+ { key: '2', value: '$$' },
19
+ { key: '3', value: '$$$' },
20
+ { key: '4', value: '$$$$' },
21
+ { key: '5', value: '$$$$$' }
22
+ ]
23
+
24
+ return (
25
+ <Container>
26
+ <PriceLevelContainer>
27
+ <h2>{t('PRICE_LEVEL', 'Price level')}</h2>
28
+ <PriceLevelList>
29
+ {priceList.map((item, i) => (
30
+ <PriceLevelItem
31
+ key={i}
32
+ onClick={() => changeFormState({ price_level: item.key })}
33
+ active={formState?.changes?.price_level === item.key}
34
+ >
35
+ {(formState?.changes?.price_level === item.key) ? <RecordCircleFill /> : <Circle />}
36
+ <span>{item.value}</span>
37
+ </PriceLevelItem>
38
+ ))}
39
+ </PriceLevelList>
40
+ </PriceLevelContainer>
41
+ </Container>
42
+ )
43
+ }
@@ -0,0 +1,70 @@
1
+ import styled, { css } from 'styled-components'
2
+
3
+ export const Container = styled.div`
4
+ h2 {
5
+ font-weight: 600;
6
+ font-size: 16px;
7
+ line-height: 24px;
8
+ margin-top: 0;
9
+ margin-bottom: 25px;
10
+ }
11
+ `
12
+
13
+ export const PriceLevelContainer = styled.div`
14
+ h2 {
15
+ margin-bottom: 15px;
16
+ }
17
+ `
18
+
19
+ export const PriceLevelList = styled.div`
20
+ width: 100%;
21
+ display: flex;
22
+ flex-wrap: wrap;
23
+ width: calc(100% + 20px);
24
+ margin-left: -10px;
25
+
26
+ ${props => props.theme.rtl && css`
27
+ margin-right: -10px;
28
+ margin-left: 0px;
29
+ `}
30
+
31
+ > div {
32
+ width: calc(33.33% - 20px);
33
+ margin: 10px;
34
+ }
35
+
36
+ @media (min-width: 576px) {
37
+ > div {
38
+ width: calc(20% - 20px);
39
+ }
40
+ }
41
+ `
42
+
43
+ export const PriceLevelItem = styled.div`
44
+ display: flex;
45
+ align-items: center;
46
+ cursor: pointer;
47
+
48
+ svg {
49
+ font-size: 16px;
50
+ color: ${props => props.theme.colors.secundaryLight};
51
+ transition: all 0.3s linear;
52
+ min-width: 16px;
53
+ }
54
+
55
+ span {
56
+ font-weight: 400;
57
+ font-size: 14px;
58
+ margin-left: 8px;
59
+ ${props => props.theme.rtl && css`
60
+ margin-right: 8px;
61
+ margin-left: 0px;
62
+ `}
63
+ }
64
+
65
+ ${({ active }) => active && css`
66
+ svg {
67
+ color: ${props => props.theme.colors.primary};
68
+ }
69
+ `}
70
+ `
@@ -0,0 +1,51 @@
1
+ import React from 'react'
2
+ import { useLanguage } from 'ordering-components-admin-external'
3
+ import {
4
+ OrderDetailsContainer,
5
+ ContentWrapper,
6
+ FormControl,
7
+ SwitchControl
8
+ } from './styles'
9
+ import { Input, Switch, TextArea } from '../../../../styles'
10
+
11
+ export const OtherDetails = (props) => {
12
+ const { formState, handleChangeInput } = props
13
+
14
+ const [, t] = useLanguage()
15
+
16
+ return (
17
+ <OrderDetailsContainer>
18
+ <h2>{t('OTHER_DETAILS', 'Other Details')}</h2>
19
+ <ContentWrapper>
20
+ <FormControl>
21
+ <label>{t('GOOGLE_MAPS_URL', 'Google Maps URL')}</label>
22
+ <Input
23
+ placeholder={t('URL', 'URL')}
24
+ />
25
+ </FormControl>
26
+ <SwitchControl>
27
+ <label>{t('RESERVATION_WITH_OPEN_TABLE', 'Reservation with open table')}</label>
28
+ <Switch
29
+ defaultChecked
30
+ onChange={val => console.log(val)}
31
+ />
32
+ </SwitchControl>
33
+ <FormControl>
34
+ <label>{t('WEBSITE_ORIGINAL', 'Website')}</label>
35
+ <Input
36
+ placeholder='www.yourbusiness.com'
37
+ />
38
+ </FormControl>
39
+ <FormControl noBottom>
40
+ <label>{t('DESCRIPTION', 'Description')}</label>
41
+ <TextArea
42
+ name='description'
43
+ placeholder={t('WRITE_DESCRIPTION', 'Write description')}
44
+ defaultValue={formState?.changes?.description ?? ''}
45
+ onChange={handleChangeInput}
46
+ />
47
+ </FormControl>
48
+ </ContentWrapper>
49
+ </OrderDetailsContainer>
50
+ )
51
+ }
@@ -0,0 +1,49 @@
1
+ import styled, { css } from 'styled-components'
2
+
3
+ export const OrderDetailsContainer = styled.div`
4
+ h2 {
5
+ font-weight: 600;
6
+ font-size: 16px;
7
+ line-height: 24px;
8
+ margin-top: 0;
9
+ margin-bottom: 25px;
10
+ }
11
+ `
12
+
13
+ export const ContentWrapper = styled.div``
14
+
15
+ export const FormControl = styled.div`
16
+ margin-bottom: 23px;
17
+ label {
18
+ font-weight: 400;
19
+ font-size: 14px;
20
+ line-height: 24px;
21
+ margin-bottom: 12px;
22
+ }
23
+ input {
24
+ width: 100%;
25
+ height: 44px;
26
+ }
27
+ textarea {
28
+ width: 100%;
29
+ height: 100px;
30
+ }
31
+
32
+ ${({ noBottom }) => noBottom && css`
33
+ margin-bottom: 0px;
34
+ `}
35
+ `
36
+
37
+ export const SwitchControl = styled.div`
38
+ display: flex;
39
+ align-items: center;
40
+ margin-bottom: 23px;
41
+ label {
42
+ margin-bottom: 0px;
43
+ margin-right: 16px;
44
+ ${props => props.theme.rtl && css`
45
+ margin-left: 16px;
46
+ margin-right: 0px;
47
+ `}
48
+ }
49
+ `
@@ -0,0 +1,39 @@
1
+ import React from 'react'
2
+ import { useLanguage } from 'ordering-components-admin-external'
3
+ import { CheckSquareFill, Square } from 'react-bootstrap-icons'
4
+ import {
5
+ Container,
6
+ ContentWrapper,
7
+ PaymethodItem
8
+ } from './styles'
9
+
10
+ export const PaymentMethods = (props) => {
11
+ const {
12
+ paymethodsList,
13
+ handleChangePaymethodIds,
14
+ paymethodIds
15
+ } = props
16
+
17
+ const [, t] = useLanguage()
18
+
19
+ const handleChangeIds = (id) => {
20
+ let updateIds = []
21
+ if (paymethodIds.includes(id)) updateIds = paymethodIds.filter(paymethodId => paymethodId !== id)
22
+ else updateIds = [...paymethodIds, id]
23
+ handleChangePaymethodIds(updateIds)
24
+ }
25
+
26
+ return (
27
+ <Container>
28
+ <h2>{t('PAYMENT_METHODS', 'Payment methods')}</h2>
29
+ <ContentWrapper>
30
+ {!paymethodsList?.loading && paymethodsList?.paymethods.map((paymethod, idx) => (
31
+ <PaymethodItem key={paymethod?.id} isBorderTop={idx === 0} onClick={() => handleChangeIds(paymethod.id)}>
32
+ {paymethodIds.includes(paymethod?.id) ? <CheckSquareFill className='enabled' /> : <Square />}
33
+ <span>{paymethod?.name}</span>
34
+ </PaymethodItem>
35
+ ))}
36
+ </ContentWrapper>
37
+ </Container>
38
+ )
39
+ }
@@ -0,0 +1,46 @@
1
+ import styled, { css } from 'styled-components'
2
+
3
+ export const Container = styled.div`
4
+ h2 {
5
+ font-weight: 600;
6
+ font-size: 16px;
7
+ line-height: 24px;
8
+ margin-top: 0;
9
+ margin-bottom: 25px;
10
+ }
11
+ `
12
+
13
+ export const ContentWrapper = styled.div`
14
+ overflow: auto;
15
+ max-height: 500px;
16
+ `
17
+
18
+ export const PaymethodItem = styled.div`
19
+ display: flex;
20
+ align-items: center;
21
+ padding: 16px 0px;
22
+ border-bottom: 1px solid ${props => props.theme.colors.borderColor};
23
+ cursor: pointer;
24
+ ${({ isBorderTop }) => isBorderTop && css`
25
+ border-top: 1px solid ${props => props.theme.colors.borderColor};
26
+ `}
27
+
28
+ svg {
29
+ font-size: 16px;
30
+ color: ${props => props.theme.colors.secundaryLight};
31
+
32
+ &.enabled {
33
+ color: ${props => props.theme.colors.primary};
34
+ }
35
+ }
36
+ span {
37
+ font-weight: 400;
38
+ font-size: 14px;
39
+ line-height: 24px;
40
+ margin-left: 20px;
41
+ ${props => props.theme.rtl && css`
42
+ margin-left: 0px;
43
+ margin-right: 20px;
44
+ `}
45
+ }
46
+ `
@@ -0,0 +1,156 @@
1
+ import React, { useRef, useState } from 'react'
2
+ import { useLanguage, ExamineClick, DragAndDrop, useUtils } from 'ordering-components-admin-external'
3
+ import { Image as DumyPhoto, X as CloseIcon } from 'react-bootstrap-icons'
4
+ import { Alert, Modal, ImageCrop, DragScroll } from '../../../Shared'
5
+ import { bytesConverter } from '../../../../utils'
6
+ import {
7
+ PhotosContainer,
8
+ ContentWrapper,
9
+ UploadImageContainer,
10
+ UploadImageIconContainer,
11
+ UploadImageIcon,
12
+ GalleryList,
13
+ Tab,
14
+ DeleteButton
15
+ } from './styles'
16
+
17
+ export const Photos = (props) => {
18
+ const { gallery, handleChangeGallery } = props
19
+
20
+ const [, t] = useLanguage()
21
+ const [{ optimizeImage }] = useUtils()
22
+
23
+ const [alertState, setAlertState] = useState({ open: false, content: [] })
24
+ const [cropState, setCropState] = useState({ data: null, open: false })
25
+
26
+ const imageRef = useRef()
27
+
28
+ const closeAlert = () => {
29
+ setAlertState({
30
+ open: false,
31
+ content: []
32
+ })
33
+ }
34
+
35
+ const handleClickImage = () => {
36
+ imageRef.current.click()
37
+ }
38
+
39
+ const handleChangePhoto = (croppedImg) => {
40
+ const uniqueId = getUniqueId()
41
+ const updatedGallery = JSON.parse(JSON.stringify([...gallery, { file: croppedImg, type: 1, temp_id: uniqueId }]))
42
+ handleChangeGallery(updatedGallery)
43
+ setCropState({ data: null, open: false })
44
+ }
45
+
46
+ const handleDeleteGalleryImage = (id) => {
47
+ const updatedGallery = gallery.filter(item => item.temp_id !== id)
48
+ handleChangeGallery(updatedGallery)
49
+ }
50
+
51
+ const getUniqueId = () => {
52
+ const dateString = Date.now().toString(36)
53
+ const randomness = Math.random().toString(36).substr(2)
54
+ return dateString + randomness
55
+ }
56
+
57
+ const handleFiles = (files) => {
58
+ if (files.length === 1) {
59
+ const type = files[0].type.split('/')[0]
60
+ if (type !== 'image') {
61
+ setAlertState({
62
+ open: true,
63
+ content: [t('ERROR_ONLY_IMAGES', 'Only images can be accepted')]
64
+ })
65
+ return
66
+ }
67
+
68
+ if (bytesConverter(files[0]?.size) > 2048) {
69
+ setAlertState({
70
+ open: true,
71
+ content: [t('IMAGE_MAXIMUM_SIZE', 'The maximum image size is 2 megabytes')]
72
+ })
73
+ return
74
+ }
75
+ const reader = new window.FileReader()
76
+ reader.readAsDataURL(files[0])
77
+ reader.onload = () => {
78
+ setCropState({ data: reader.result, open: true })
79
+ }
80
+ reader.onerror = error => console.log(error)
81
+ }
82
+ }
83
+
84
+ return (
85
+ <>
86
+ <PhotosContainer>
87
+ <h2>{t('PHOTOS', 'Photos')}</h2>
88
+ <ContentWrapper>
89
+ <UploadImageContainer
90
+ onClick={() => handleClickImage()}
91
+ >
92
+ <ExamineClick
93
+ onFiles={files => handleFiles(files, 'header')}
94
+ childRef={(e) => { imageRef.current = e }}
95
+ accept='image/png, image/jpeg, image/jpg'
96
+ >
97
+ <DragAndDrop
98
+ onDrop={dataTransfer => handleFiles(dataTransfer.files, 'header')}
99
+ accept='image/png, image/jpeg, image/jpg'
100
+ >
101
+ <UploadImageIconContainer>
102
+ <UploadImageIcon>
103
+ <DumyPhoto />
104
+ <span>{t('DRAG_AND_DROP', 'Drag and drop')}</span>
105
+ </UploadImageIcon>
106
+ </UploadImageIconContainer>
107
+ </DragAndDrop>
108
+ </ExamineClick>
109
+ </UploadImageContainer>
110
+ {gallery?.length > 0 && (
111
+ <GalleryList>
112
+ <DragScroll>
113
+ {gallery.map(photo => (
114
+ <Tab
115
+ key={photo.temp_id}
116
+ >
117
+ <img
118
+ src={optimizeImage(photo.file, 'h_200,c_limit')}
119
+ />
120
+ <DeleteButton
121
+ onClick={() => handleDeleteGalleryImage(photo.temp_id)}
122
+ >
123
+ <CloseIcon />
124
+ </DeleteButton>
125
+ </Tab>
126
+ ))}
127
+ </DragScroll>
128
+ </GalleryList>
129
+ )}
130
+ </ContentWrapper>
131
+ </PhotosContainer>
132
+ <Alert
133
+ title={t('ORDERING', 'Ordering')}
134
+ content={alertState.content}
135
+ acceptText={t('ACCEPT', 'Accept')}
136
+ open={alertState.open}
137
+ onClose={() => closeAlert()}
138
+ onAccept={() => closeAlert()}
139
+ closeOnBackdrop={false}
140
+ />
141
+ <Modal
142
+ width='700px'
143
+ height='80vh'
144
+ padding='30px'
145
+ title={t('IMAGE_CROP', 'Image crop')}
146
+ open={cropState?.open}
147
+ onClose={() => setCropState({ ...cropState, open: false })}
148
+ >
149
+ <ImageCrop
150
+ photo={cropState?.data}
151
+ handleChangePhoto={handleChangePhoto}
152
+ />
153
+ </Modal>
154
+ </>
155
+ )
156
+ }
@@ -0,0 +1,108 @@
1
+ import styled, { css } from 'styled-components'
2
+
3
+ export const PhotosContainer = styled.div`
4
+ h2 {
5
+ font-weight: 600;
6
+ font-size: 16px;
7
+ line-height: 24px;
8
+ margin-top: 0;
9
+ margin-bottom: 25px;
10
+ }
11
+ `
12
+
13
+ export const ContentWrapper = styled.div``
14
+
15
+ export const UploadImageContainer = styled.div`
16
+ height: 160px;
17
+ max-width: 415px;
18
+ width: 100%;
19
+ position: relative;
20
+ border-radius: 8px;
21
+ overflow: hidden;
22
+ cursor: -webkit-grab;
23
+ cursor: grab;
24
+ filter: drop-shadow(0px 1px 4px rgba(0, 0, 0, 0.1));
25
+
26
+ img,
27
+ div {
28
+ width: 100%;
29
+ border-radius: 8px;
30
+ height: 100%;
31
+ overflow: hidden;
32
+ };
33
+
34
+ img{
35
+ object-fit: contain;
36
+ }
37
+ `
38
+
39
+ export const UploadImageIconContainer = styled.div`
40
+ position: absolute;
41
+ top: 0px;
42
+ background: ${props => props.theme.colors.secundaryDarkContrast};
43
+ ${({ bgimage }) => bgimage && css`
44
+ background: transparent;
45
+ svg, span {
46
+ color: ${props => props.theme.colors.white};
47
+ }
48
+ border: 1px dashed ${props => props.theme.colors.secundaryDarkContrast};
49
+ `}
50
+ ${({ small }) => small ? css`
51
+ padding: 4px;
52
+ ` : css`
53
+ padding: 8px;
54
+ `}
55
+ `
56
+
57
+ export const UploadImageIcon = styled.div`
58
+ display: flex;
59
+ justify-content: center;
60
+ align-items: center;
61
+ flex-direction: column;
62
+ color: ${props => props.theme.colors.disabled};
63
+ span {
64
+ margin-top: 14px;
65
+ font-size: 14px;
66
+ }
67
+
68
+ svg {
69
+ width: 52px;
70
+ height: 45px;
71
+ }
72
+ `
73
+
74
+ export const GalleryList = styled.div`
75
+ width: 100%;
76
+ margin-top: 25px;
77
+ `
78
+
79
+ export const Tab = styled.div`
80
+ position: relative;
81
+ width: 300px;
82
+ height: 160px;
83
+ img {
84
+ width: 100%;
85
+ height: 100%;
86
+ object-fit: cover;
87
+ }
88
+ `
89
+
90
+ export const DeleteButton = styled.span`
91
+ cursor: pointer;
92
+ background: ${props => props.theme.colors.danger};
93
+ border-radius: 100%;
94
+ padding: 3px;
95
+ position: absolute;
96
+ top: 10px;
97
+ left: 10px;
98
+ width: 24px;
99
+ height: 24px;
100
+ display: flex;
101
+ align-items: center;
102
+ justify-content: center;
103
+
104
+ svg {
105
+ font-size: 24px;
106
+ color: ${props => props.theme.colors.white};
107
+ }
108
+ `
@@ -0,0 +1,46 @@
1
+ import React from 'react'
2
+ import { useLanguage } from 'ordering-components-admin-external'
3
+ import { useTheme } from 'styled-components'
4
+ import { Input } from '../../../../styles'
5
+ import {
6
+ ReceiveOrdersContainer,
7
+ FormControl,
8
+ ContentWrapper,
9
+ DownloadWrapper,
10
+ DownloadIconWrapper
11
+ } from './styles'
12
+
13
+ export const ReceiveOrders = (props) => {
14
+ const { formState, handleChangeInput } = props
15
+
16
+ const [, t] = useLanguage()
17
+ const theme = useTheme()
18
+
19
+ return (
20
+ <ReceiveOrdersContainer>
21
+ <h2>{t('RECEIVE_ORDERS', 'Receive orders')}</h2>
22
+ <ContentWrapper>
23
+ <FormControl>
24
+ <label>{t('BY_EMAIL', 'By Email')}</label>
25
+ <Input
26
+ name='email'
27
+ defaultValue={formState?.changes?.email ?? ''}
28
+ onChange={handleChangeInput}
29
+ placeholder={t('ADD_EMAIL', 'Add email')}
30
+ />
31
+ </FormControl>
32
+ <DownloadWrapper>
33
+ <label>{t('DOWNLOADS_APPS', 'Downloads apps')}</label>
34
+ <DownloadIconWrapper>
35
+ <a href='https://apps.apple.com/us/app/customer-app-2-0/id1607414555' target='_blank' rel='noopener noreferrer'>
36
+ <img src={theme.images.general.appStore} alt='' />
37
+ </a>
38
+ <a href='https://play.google.com/store/apps/details?id=com.ordering.onlineorderingappv5&hl=en&gl=US' target='_blank' rel='noopener noreferrer'>
39
+ <img src={theme.images.general.googlePlay} alt='' />
40
+ </a>
41
+ </DownloadIconWrapper>
42
+ </DownloadWrapper>
43
+ </ContentWrapper>
44
+ </ReceiveOrdersContainer>
45
+ )
46
+ }