ordering-ui-admin-external 1.30.7 → 1.31.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 (164) hide show
  1. package/_bundles/{ordering-ui-admin.a29dbc53a1f823ce0ce5.js → ordering-ui-admin.b84e1f62fd043e740aba.js} +2 -2
  2. package/_modules/components/BusinessIntelligence/AnalyticsDriverOrders/index.js +80 -47
  3. package/_modules/components/BusinessIntelligence/BusinessAnalytics/index.js +2 -1
  4. package/_modules/components/BusinessIntelligence/BusinessAnalytics/styles.js +6 -4
  5. package/_modules/components/BusinessIntelligence/ReportsAverageSales/index.js +3 -2
  6. package/_modules/components/BusinessIntelligence/ReportsAverageSales/styles.js +13 -3
  7. package/_modules/components/BusinessIntelligence/ReportsBusinessDistance/index.js +3 -2
  8. package/_modules/components/BusinessIntelligence/ReportsBusinessDistance/styles.js +13 -3
  9. package/_modules/components/BusinessIntelligence/ReportsBusinessSpend/index.js +3 -2
  10. package/_modules/components/BusinessIntelligence/ReportsBusinessSpend/styles.js +13 -3
  11. package/_modules/components/BusinessIntelligence/ReportsCustomer/index.js +3 -2
  12. package/_modules/components/BusinessIntelligence/ReportsCustomer/styles.js +13 -3
  13. package/_modules/components/BusinessIntelligence/ReportsDriverDistance/index.js +4 -3
  14. package/_modules/components/BusinessIntelligence/ReportsDriverDistance/styles.js +13 -3
  15. package/_modules/components/BusinessIntelligence/ReportsDriverOrder/index.js +3 -2
  16. package/_modules/components/BusinessIntelligence/ReportsDriverOrder/styles.js +13 -3
  17. package/_modules/components/BusinessIntelligence/ReportsDriverOrderTime/index.js +3 -2
  18. package/_modules/components/BusinessIntelligence/ReportsDriverOrderTime/styles.js +13 -3
  19. package/_modules/components/BusinessIntelligence/ReportsDriverSchedule/index.js +4 -3
  20. package/_modules/components/BusinessIntelligence/ReportsDriverSchedule/styles.js +13 -3
  21. package/_modules/components/BusinessIntelligence/ReportsDriverSpend/index.js +3 -2
  22. package/_modules/components/BusinessIntelligence/ReportsDriverSpend/styles.js +13 -3
  23. package/_modules/components/BusinessIntelligence/ReportsGeneralSales/index.js +3 -2
  24. package/_modules/components/BusinessIntelligence/ReportsGeneralSales/styles.js +13 -3
  25. package/_modules/components/BusinessIntelligence/ReportsHeatMap/index.js +3 -2
  26. package/_modules/components/BusinessIntelligence/ReportsHeatMap/styles.js +13 -3
  27. package/_modules/components/BusinessIntelligence/ReportsOrderDistance/index.js +3 -2
  28. package/_modules/components/BusinessIntelligence/ReportsOrderDistance/styles.js +13 -3
  29. package/_modules/components/BusinessIntelligence/ReportsOrderStatus/index.js +4 -3
  30. package/_modules/components/BusinessIntelligence/ReportsOrderStatus/styles.js +13 -3
  31. package/_modules/components/BusinessIntelligence/ReportsOrders/index.js +3 -2
  32. package/_modules/components/BusinessIntelligence/ReportsOrders/styles.js +13 -3
  33. package/_modules/components/BusinessIntelligence/ReportsPaymethodSales/index.js +3 -2
  34. package/_modules/components/BusinessIntelligence/ReportsPaymethodSales/styles.js +13 -3
  35. package/_modules/components/BusinessIntelligence/ReportsSaleAndCategory/index.js +3 -2
  36. package/_modules/components/BusinessIntelligence/ReportsSaleAndCategory/styles.js +13 -3
  37. package/_modules/components/BusinessIntelligence/ReportsSales/index.js +3 -2
  38. package/_modules/components/BusinessIntelligence/ReportsSales/styles.js +13 -3
  39. package/_modules/components/BusinessIntelligence/ReportsSpentTIme/index.js +3 -2
  40. package/_modules/components/BusinessIntelligence/ReportsSpentTIme/styles.js +13 -3
  41. package/_modules/components/BusinessIntelligence/ReportsTopDrivers/index.js +3 -2
  42. package/_modules/components/BusinessIntelligence/ReportsTopDrivers/styles.js +13 -3
  43. package/_modules/components/BusinessIntelligence/ReportsUsers/index.js +3 -2
  44. package/_modules/components/BusinessIntelligence/ReportsUsers/styles.js +13 -3
  45. package/_modules/components/Delivery/AddressList/index.js +15 -5
  46. package/_modules/components/Delivery/DriversGroupAutoassign/index.js +14 -7
  47. package/_modules/components/Delivery/DriversGroupAutoassign/styles.js +5 -3
  48. package/_modules/components/Home/HomePage/index.js +3 -2
  49. package/_modules/components/MyProducts/OrderingWebsite/index.js +25 -18
  50. package/_modules/components/MyProducts/OrderingWebsite/styles.js +1 -1
  51. package/_modules/components/Orders/AllInOne/index.js +15 -6
  52. package/_modules/components/Orders/CreateCustomOrder/CustomOrderDetails/index.js +102 -9
  53. package/_modules/components/Orders/CreateCustomOrder/CustomOrderDetails/styles.js +19 -3
  54. package/_modules/components/Orders/CreateCustomOrder/OrderTypeSelector/index.js +1 -1
  55. package/_modules/components/Orders/CreateCustomOrder/SelectCustomer/index.js +21 -9
  56. package/_modules/components/Orders/CreateCustomOrder/SelectCustomer/styles.js +8 -5
  57. package/_modules/components/Orders/DeliveriesManager/index.js +11 -2
  58. package/_modules/components/Orders/DeliveryDashboard/index.js +6 -6
  59. package/_modules/components/Orders/OrderNotification/index.js +43 -14
  60. package/_modules/components/Orders/OrderNotification/styles.js +18 -3
  61. package/_modules/components/Orders/OrderStatusFilterBar/index.js +6 -6
  62. package/_modules/components/Orders/OrdersContentHeader/index.js +11 -2
  63. package/_modules/components/Orders/OrdersContentHeader/styles.js +20 -4
  64. package/_modules/components/Orders/OrdersDashboardList/index.js +34 -5
  65. package/_modules/components/Orders/OrdersFilterGroup/index.js +18 -1
  66. package/_modules/components/Orders/OrdersListing/index.js +6 -0
  67. package/_modules/components/Orders/OrdersManager/index.js +16 -7
  68. package/_modules/components/Orders/WebsocketStatus/index.js +6 -1
  69. package/_modules/components/Settings/WebhookListSelector/index.js +6 -0
  70. package/_modules/components/Shared/InputPhoneNumber/index.js +2 -3
  71. package/_modules/components/Stores/BusinessAdd/ReceiveOrders/index.js +6 -2
  72. package/_modules/components/Stores/BusinessDeviceDetail/index.js +1 -1
  73. package/_modules/components/Stores/BusinessProductsListing/index.js +5 -1
  74. package/_modules/components/Stores/BusinessSummary/index.js +7 -4
  75. package/_modules/components/Stores/BusinessWebhooks/index.js +6 -0
  76. package/_modules/components/Stores/ProductExtraOptionDetails/index.js +6 -1
  77. package/_modules/components/Stores/ProductExtraOptions/index.js +8 -2
  78. package/_modules/components/Stores/ProductExtraSuboption/index.js +6 -1
  79. package/_modules/components/Stores/ProductExtras/index.js +8 -3
  80. package/_modules/components/Stores/ProductSummary/index.js +4 -1
  81. package/_modules/components/Users/UserAddForm/index.js +0 -2
  82. package/package.json +2 -2
  83. package/src/components/BusinessIntelligence/AnalyticsDriverOrders/index.js +39 -17
  84. package/src/components/BusinessIntelligence/BusinessAnalytics/index.js +6 -1
  85. package/src/components/BusinessIntelligence/BusinessAnalytics/styles.js +2 -0
  86. package/src/components/BusinessIntelligence/ReportsAverageSales/index.js +15 -7
  87. package/src/components/BusinessIntelligence/ReportsAverageSales/styles.js +34 -0
  88. package/src/components/BusinessIntelligence/ReportsBusinessDistance/index.js +9 -1
  89. package/src/components/BusinessIntelligence/ReportsBusinessDistance/styles.js +34 -0
  90. package/src/components/BusinessIntelligence/ReportsBusinessSpend/index.js +9 -1
  91. package/src/components/BusinessIntelligence/ReportsBusinessSpend/styles.js +34 -0
  92. package/src/components/BusinessIntelligence/ReportsCustomer/index.js +15 -7
  93. package/src/components/BusinessIntelligence/ReportsCustomer/styles.js +34 -0
  94. package/src/components/BusinessIntelligence/ReportsDriverDistance/index.js +10 -2
  95. package/src/components/BusinessIntelligence/ReportsDriverDistance/styles.js +34 -0
  96. package/src/components/BusinessIntelligence/ReportsDriverOrder/index.js +9 -1
  97. package/src/components/BusinessIntelligence/ReportsDriverOrder/styles.js +34 -0
  98. package/src/components/BusinessIntelligence/ReportsDriverOrderTime/index.js +9 -1
  99. package/src/components/BusinessIntelligence/ReportsDriverOrderTime/styles.js +34 -0
  100. package/src/components/BusinessIntelligence/ReportsDriverSchedule/index.js +16 -8
  101. package/src/components/BusinessIntelligence/ReportsDriverSchedule/styles.js +34 -0
  102. package/src/components/BusinessIntelligence/ReportsDriverSpend/index.js +9 -1
  103. package/src/components/BusinessIntelligence/ReportsDriverSpend/styles.js +34 -0
  104. package/src/components/BusinessIntelligence/ReportsGeneralSales/index.js +9 -1
  105. package/src/components/BusinessIntelligence/ReportsGeneralSales/styles.js +34 -0
  106. package/src/components/BusinessIntelligence/ReportsHeatMap/index.js +9 -1
  107. package/src/components/BusinessIntelligence/ReportsHeatMap/styles.js +34 -0
  108. package/src/components/BusinessIntelligence/ReportsOrderDistance/index.js +10 -1
  109. package/src/components/BusinessIntelligence/ReportsOrderDistance/styles.js +34 -0
  110. package/src/components/BusinessIntelligence/ReportsOrderStatus/index.js +10 -2
  111. package/src/components/BusinessIntelligence/ReportsOrderStatus/styles.js +34 -0
  112. package/src/components/BusinessIntelligence/ReportsOrders/index.js +9 -1
  113. package/src/components/BusinessIntelligence/ReportsOrders/styles.js +34 -0
  114. package/src/components/BusinessIntelligence/ReportsPaymethodSales/index.js +9 -1
  115. package/src/components/BusinessIntelligence/ReportsPaymethodSales/styles.js +34 -0
  116. package/src/components/BusinessIntelligence/ReportsSaleAndCategory/index.js +9 -1
  117. package/src/components/BusinessIntelligence/ReportsSaleAndCategory/styles.js +34 -0
  118. package/src/components/BusinessIntelligence/ReportsSales/index.js +9 -1
  119. package/src/components/BusinessIntelligence/ReportsSales/styles.js +34 -0
  120. package/src/components/BusinessIntelligence/ReportsSpentTIme/index.js +15 -7
  121. package/src/components/BusinessIntelligence/ReportsSpentTIme/styles.js +34 -0
  122. package/src/components/BusinessIntelligence/ReportsTopDrivers/index.js +9 -2
  123. package/src/components/BusinessIntelligence/ReportsTopDrivers/styles.js +34 -0
  124. package/src/components/BusinessIntelligence/ReportsUsers/index.js +15 -7
  125. package/src/components/BusinessIntelligence/ReportsUsers/styles.js +34 -0
  126. package/src/components/Delivery/AddressList/index.js +11 -1
  127. package/src/components/Delivery/DriversGroupAutoassign/index.js +17 -6
  128. package/src/components/Delivery/DriversGroupAutoassign/styles.js +10 -0
  129. package/src/components/Home/HomePage/index.js +5 -1
  130. package/src/components/MyProducts/OrderingWebsite/index.js +25 -12
  131. package/src/components/MyProducts/OrderingWebsite/styles.js +0 -2
  132. package/src/components/Orders/AllInOne/index.js +8 -2
  133. package/src/components/Orders/CreateCustomOrder/CustomOrderDetails/index.js +118 -6
  134. package/src/components/Orders/CreateCustomOrder/CustomOrderDetails/styles.js +56 -0
  135. package/src/components/Orders/CreateCustomOrder/OrderTypeSelector/index.js +1 -1
  136. package/src/components/Orders/CreateCustomOrder/SelectCustomer/index.js +19 -11
  137. package/src/components/Orders/CreateCustomOrder/SelectCustomer/styles.js +3 -0
  138. package/src/components/Orders/DeliveriesManager/index.js +8 -2
  139. package/src/components/Orders/DeliveryDashboard/index.js +4 -4
  140. package/src/components/Orders/OrderNotification/index.js +31 -5
  141. package/src/components/Orders/OrderNotification/styles.js +37 -0
  142. package/src/components/Orders/OrderStatusFilterBar/index.js +10 -9
  143. package/src/components/Orders/OrdersContentHeader/index.js +17 -3
  144. package/src/components/Orders/OrdersContentHeader/styles.js +54 -0
  145. package/src/components/Orders/OrdersDashboardList/index.js +6 -1
  146. package/src/components/Orders/OrdersFilterGroup/index.js +16 -0
  147. package/src/components/Orders/OrdersListing/index.js +7 -0
  148. package/src/components/Orders/OrdersManager/index.js +11 -3
  149. package/src/components/Orders/WebsocketStatus/index.js +5 -2
  150. package/src/components/Settings/WebhookListSelector/index.js +3 -1
  151. package/src/components/Shared/InputPhoneNumber/index.js +2 -3
  152. package/src/components/Stores/BusinessAdd/ReceiveOrders/index.js +16 -12
  153. package/src/components/Stores/BusinessDeviceDetail/index.js +1 -1
  154. package/src/components/Stores/BusinessProductsListing/index.js +4 -0
  155. package/src/components/Stores/BusinessSummary/index.js +21 -15
  156. package/src/components/Stores/BusinessWebhooks/index.js +3 -1
  157. package/src/components/Stores/ProductExtraOptionDetails/index.js +8 -0
  158. package/src/components/Stores/ProductExtraOptions/index.js +10 -1
  159. package/src/components/Stores/ProductExtraSuboption/index.js +7 -1
  160. package/src/components/Stores/ProductExtras/index.js +6 -1
  161. package/src/components/Stores/ProductSummary/index.js +7 -1
  162. package/src/components/Users/UserAddForm/index.js +0 -2
  163. package/template/config.json +1 -1
  164. /package/_bundles/{ordering-ui-admin.a29dbc53a1f823ce0ce5.js.LICENSE.txt → ordering-ui-admin.b84e1f62fd043e740aba.js.LICENSE.txt} +0 -0
@@ -19,7 +19,8 @@ import {
19
19
  AreaWrapper,
20
20
  LargeArea,
21
21
  MediumArea,
22
- SmallArea
22
+ SmallArea,
23
+ CheckboxContainer
23
24
  } from './styles'
24
25
 
25
26
  const DriversGroupAutoassignUI = (props) => {
@@ -125,8 +126,8 @@ const DriversGroupAutoassignUI = (props) => {
125
126
  />
126
127
  </FieldContainer>
127
128
  </div>
128
- <div>
129
- {(autoAssign !== 2 && (changesState?.autoassign_amount_drivers < 2 || (typeof changesState?.autoassign_amount_drivers === 'undefined' && curDriversGroup?.autoassign_amount_drivers < 2))) && (
129
+ {(autoAssign !== 2 && (changesState?.autoassign_amount_drivers < 2 || (typeof changesState?.autoassign_amount_drivers === 'undefined' && curDriversGroup?.autoassign_amount_drivers < 2))) && (
130
+ <CheckboxContainer>
130
131
  <CheckboxWrapper>
131
132
  <Checkbox
132
133
  checked={changesState?.autoassign_autoaccept_by_driver ?? curDriversGroup?.autoassign_autoaccept_by_driver}
@@ -134,11 +135,21 @@ const DriversGroupAutoassignUI = (props) => {
134
135
  />
135
136
  <span>{t('ORDER_CONFIRMED_ACCEPTED_BY_DRIVER', 'Accepted by Driver')}</span>
136
137
  </CheckboxWrapper>
137
- )}
138
- </div>
138
+ {(typeof changesState?.autoassign_autoaccept_by_driver === 'undefined' ? !curDriversGroup?.autoassign_autoaccept_by_driver : !changesState?.autoassign_autoaccept_by_driver) && (
139
+ <CheckboxWrapper>
140
+ <Checkbox
141
+ checked={changesState?.autoassign_autoassign_driver ?? curDriversGroup?.autoassign_autoassign_driver}
142
+ onChange={e => onChangeSave({ autoassign_autoassign_driver: e.target.checked })}
143
+ />
144
+ <span>{t('AUTO_ASSIGNED', 'Auto assigned')}</span>
145
+ </CheckboxWrapper>
146
+ )}
147
+ </CheckboxContainer>
148
+ )}
139
149
  </RowGroupContainer>
140
150
 
141
- {(((typeof changesState?.autoassign_autoaccept_by_driver === 'undefined' ? !curDriversGroup?.autoassign_autoaccept_by_driver : !changesState?.autoassign_autoaccept_by_driver)) ||
151
+ {(((typeof changesState?.autoassign_autoaccept_by_driver === 'undefined' ? !curDriversGroup?.autoassign_autoaccept_by_driver : !changesState?.autoassign_autoaccept_by_driver) &&
152
+ (typeof changesState?.autoassign_autoassign_driver === 'undefined' ? !curDriversGroup?.autoassign_autoassign_driver : !changesState?.autoassign_autoassign_driver)) ||
142
153
  (changesState?.type === 1 || (typeof changesState?.type === 'undefined' && curDriversGroup?.type === 1))) && (
143
154
  <FieldContainer>
144
155
  <label>{t('AUTO_REJECT_ORDER_GROUP_AFTER', 'Auto reject Orders After')}</label>
@@ -220,3 +220,13 @@ export const SmallArea = styled.div`
220
220
  border-color: ${props => props.theme.colors.primary};
221
221
  `}
222
222
  `
223
+ export const CheckboxContainer = styled.div`
224
+ display: flex;
225
+ flex-direction: column;
226
+
227
+ > div {
228
+ &:not(:first-child) {
229
+ margin-top: 5px;
230
+ }
231
+ }
232
+ `
@@ -71,6 +71,8 @@ const HomeUI = (props) => {
71
71
  const [isSubmitted, setIsSubmitted] = useState(false)
72
72
  const [ordering] = useApi()
73
73
 
74
+ const isEnabledWhiteLabelModule = configs?.white_label_module?.value
75
+
74
76
  const project = {
75
77
  active: {
76
78
  description: t('ORDERING_GUIDE_MSG', 'Our guide helps you to configure your Ordering products.'),
@@ -234,7 +236,9 @@ const HomeUI = (props) => {
234
236
  {width > 997 && (
235
237
  <OrderingButtonWrapper>
236
238
  <span>{t('WHAT_DO_YOU_WANT_SEE_ORDERING', 'What do you want to see in ordering?')}</span>
237
- <Button color='primary' onClick={() => setShowForm(true)}>{t('CLICK_HERE', 'Click here')}</Button>
239
+ {!isEnabledWhiteLabelModule && (
240
+ <Button color='primary' onClick={() => setShowForm(true)}>{t('CLICK_HERE', 'Click here')}</Button>
241
+ )}
238
242
  </OrderingButtonWrapper>
239
243
  )}
240
244
  <Breadcrumb>
@@ -71,7 +71,8 @@ const OrderingWebsiteUI = (props) => {
71
71
  site,
72
72
  setSite,
73
73
  businessesList,
74
- franchisesList
74
+ franchisesList,
75
+ handleChangeInput
75
76
  } = props
76
77
 
77
78
  const [, t] = useLanguage()
@@ -178,6 +179,7 @@ const OrderingWebsiteUI = (props) => {
178
179
 
179
180
  const handleChangeSiteSettings = (e) => {
180
181
  handleChangeValue(e.target.value, 'website_settings', `values.${e.target.name}`)
182
+ handleChangeInput(e)
181
183
  }
182
184
 
183
185
  const handleChangeContent = (type, content) => {
@@ -290,7 +292,7 @@ const OrderingWebsiteUI = (props) => {
290
292
  <Input
291
293
  name='name'
292
294
  placeholder={t('SOURCE_DEMO_WEBSITE', 'Source demo website')}
293
- value={themeValues?.website_settings?.components?.values?.name || ''}
295
+ value={site?.name || ''}
294
296
  onChange={handleChangeSiteSettings}
295
297
  />
296
298
  )}
@@ -311,7 +313,7 @@ const OrderingWebsiteUI = (props) => {
311
313
  <TextArea
312
314
  name='description'
313
315
  placeholder={t('DESCRIPTION', 'Decription')}
314
- value={themeValues?.website_settings?.components?.values?.description || ''}
316
+ value={site?.description || ''}
315
317
  onChange={handleChangeSiteSettings}
316
318
  />
317
319
  )}
@@ -587,15 +589,26 @@ const OrderingWebsiteUI = (props) => {
587
589
  <InputFormWrapper>
588
590
  <h4>{t('THEME_SETTINGS', 'Theme Settings')}</h4>
589
591
  <InnerBlock>
590
- <ColorPickerWrapper>
591
- <div>
592
- <p>{t('PRIMARY_COLOR_BUTTONS', 'Primary Color for Buttons')}</p>
593
- <ColorPicker
594
- defaultColor={themeValues?.theme_settings?.components?.style?.primary_btn_color}
595
- onChangeColor={(color) => handleChangeValue(color, 'theme_settings', 'style.primary_btn_color')}
596
- />
597
- </div>
598
- </ColorPickerWrapper>
592
+ <ContentWrapper>
593
+ <ColorPickerWrapper>
594
+ <div>
595
+ <p>{t('BACKGROUND_COLOR', 'Background color')}</p>
596
+ <ColorPicker
597
+ defaultColor={themeValues?.theme_settings?.components?.style?.background_page ?? '#FFFFFF'}
598
+ onChangeColor={(color) => handleChangeValue(color, 'theme_settings', 'style.background_page')}
599
+ />
600
+ </div>
601
+ </ColorPickerWrapper>
602
+ <ColorPickerWrapper>
603
+ <div>
604
+ <p>{t('PRIMARY_COLOR_BUTTONS', 'Primary Color for Buttons')}</p>
605
+ <ColorPicker
606
+ defaultColor={themeValues?.theme_settings?.components?.style?.primary_btn_color}
607
+ onChangeColor={(color) => handleChangeValue(color, 'theme_settings', 'style.primary_btn_color')}
608
+ />
609
+ </div>
610
+ </ColorPickerWrapper>
611
+ </ContentWrapper>
599
612
  <ContentWrapper>
600
613
  <div>
601
614
  <p>{t('HOMEPAGE_CONTENT', 'Homepage Content')}</p>
@@ -309,12 +309,10 @@ export const CheckBoxWrapper = styled.div`
309
309
  `
310
310
 
311
311
  export const ColorPickerWrapper = styled.div`
312
- padding-top: 25px;
313
312
  display: flex;
314
313
  flex-direction: column;
315
314
  justify-content: space-between;
316
315
  > div {
317
- margin-top: 25px;
318
316
  > p {
319
317
  font-weight: 400;
320
318
  font-size: 14px;
@@ -54,7 +54,6 @@ const OrdersManagerUI = (props) => {
54
54
  handleSelectedSubOrderStatus,
55
55
  handleCustomOrderDetail,
56
56
  setSelectedOrderIds,
57
- numberOfOrdersByStatus,
58
57
  allowColumns,
59
58
  setAllowColumns
60
59
  } = props
@@ -75,6 +74,12 @@ const OrdersManagerUI = (props) => {
75
74
  const [timeStatus, setTimeStatus] = useState(null)
76
75
  const [slaSettingTime, setSlaSettingTime] = useState(60000)
77
76
  const [totalSelectedOrder, setTotalSelectedOrder] = useState(0)
77
+ const [ordersAmountByStatus, setOrdersAmountByStatus] = useState({
78
+ pending: null,
79
+ inProgress: null,
80
+ completed: null,
81
+ cancelled: null
82
+ })
78
83
 
79
84
  const [mapsData, setMapsData] = useState({
80
85
  driversIsOnline: true,
@@ -213,7 +218,7 @@ const OrdersManagerUI = (props) => {
213
218
  <OrderStatusFilterBar
214
219
  selectedOrderStatus={ordersStatusGroup}
215
220
  changeOrderStatus={handleOrdersStatusGroupFilter}
216
- numberOfOrdersByStatus={numberOfOrdersByStatus}
221
+ ordersAmountByStatus={ordersAmountByStatus}
217
222
  />
218
223
  <OrderSubFilterControls isColumn={selectedOrderIds?.length}>
219
224
  <OrderStatusSubFilterWrapper isColumn={selectedOrderIds?.length}>
@@ -261,6 +266,7 @@ const OrdersManagerUI = (props) => {
261
266
  slaSettingTime={slaSettingTime}
262
267
  allowColumns={allowColumns}
263
268
  setAllowColumns={setAllowColumns}
269
+ setOrdersAmountByStatus={setOrdersAmountByStatus}
264
270
  />
265
271
  </WrapItemView>
266
272
  </OrdersInnerContent>
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useEffect, useMemo } from 'react'
2
- import { useLanguage, useOrder, CustomOrderDetails as CustomOrderDetailsController } from 'ordering-components-admin-external'
2
+ import { useLanguage, useOrder, useValidationFields, CustomOrderDetails as CustomOrderDetailsController } from 'ordering-components-admin-external'
3
3
  import { SelectCustomer } from '../SelectCustomer'
4
4
  import { OrderTypeSelector } from '../OrderTypeSelector'
5
5
  import { SelectBusinesses } from '../SelectBusinesses'
@@ -7,9 +7,15 @@ import { Map } from '../Map'
7
7
  import { SelectProducts } from '../SelectProducts'
8
8
  import { Checkout } from '../Checkout'
9
9
  import { Alert } from '../../../Shared'
10
+ import { Button, Input, TextArea } from '../../../../styles'
11
+ import { RecordCircleFill, Circle } from 'react-bootstrap-icons'
10
12
 
11
13
  import {
12
- DetailsContainer
14
+ DetailsContainer,
15
+ FormControl,
16
+ ToggleOptions,
17
+ RaidoButton,
18
+ ButtonWrapper
13
19
  } from './styles'
14
20
 
15
21
  const CustomOrderDetailsUI = (props) => {
@@ -31,19 +37,56 @@ const CustomOrderDetailsUI = (props) => {
31
37
  cart,
32
38
  onClose,
33
39
  handleOpenCustomOrderDetail,
34
- defaultCountryCodeState
40
+ handlePlaceOrderByTotal,
41
+ extraFields,
42
+ setExtraFields,
43
+ actionState
35
44
  } = props
36
45
 
37
46
  const [, t] = useLanguage()
47
+ const [validationFields] = useValidationFields()
38
48
  const [orderState, { changeAddress }] = useOrder()
39
49
 
40
50
  const [alertState, setAlertState] = useState({ open: false, content: [] })
51
+ const [isOrderByProducts, setIsOrderByProducts] = useState(true)
41
52
 
42
53
  const handleCloseAlert = () => {
43
54
  setCustomersPhones({ ...customersPhones, error: null })
44
55
  setAlertState({ open: false, content: [] })
45
56
  }
46
57
 
58
+ const handlePlaceOrder = () => {
59
+ const errMessage = []
60
+
61
+ if (!selectedBusiness) {
62
+ errMessage.push(t(
63
+ 'VALIDATION_ERROR_REQUIRED',
64
+ 'Name is required'
65
+ ).replace('_attribute_', t('BUSINESS', 'Business')))
66
+ }
67
+ if (!extraFields?.total) {
68
+ errMessage.push(t(
69
+ 'VALIDATION_ERROR_REQUIRED',
70
+ 'Name is required'
71
+ ).replace('_attribute_', t('TOTAL', 'Total')))
72
+ }
73
+ if (validationFields?.fields?.checkout?.comments?.enabled && validationFields?.fields?.checkout?.comments?.required && !extraFields?.comment) {
74
+ errMessage.push(t(
75
+ 'VALIDATION_ERROR_REQUIRED',
76
+ 'Name is required'
77
+ ).replace('_attribute_', t('COMMENT', 'Comment')))
78
+ }
79
+ if (errMessage.length > 0) {
80
+ setAlertState({
81
+ open: true,
82
+ content: errMessage
83
+ })
84
+ return
85
+ }
86
+
87
+ handlePlaceOrderByTotal()
88
+ }
89
+
47
90
  const customerAddress = useMemo(() => {
48
91
  let address = null
49
92
  if (selectedUser?.addresses) {
@@ -68,6 +111,18 @@ const CustomOrderDetailsUI = (props) => {
68
111
  }
69
112
  }, [customersPhones?.error])
70
113
 
114
+ useEffect(() => {
115
+ if (actionState?.error) {
116
+ setAlertState({ open: true, content: actionState?.error })
117
+ }
118
+ }, [actionState])
119
+
120
+ useEffect(() => {
121
+ if (!isOrderByProducts) {
122
+ setExtraFields({ external_id: extraFields?.external_id })
123
+ }
124
+ }, [isOrderByProducts])
125
+
71
126
  return (
72
127
  <>
73
128
  <DetailsContainer className='custom-order-content'>
@@ -80,7 +135,6 @@ const CustomOrderDetailsUI = (props) => {
80
135
  onChangeNumber={onChangeNumber}
81
136
  handleParentSidebarMove={handleParentSidebarMove}
82
137
  customerAddress={customerAddress}
83
- defaultCountryCodeState={defaultCountryCodeState}
84
138
  />
85
139
  {customerAddress?.location && (
86
140
  <>
@@ -95,7 +149,53 @@ const CustomOrderDetailsUI = (props) => {
95
149
  customerLocation={customerAddress?.location}
96
150
  business={selectedBusiness}
97
151
  />
98
- {selectedBusiness && (
152
+ <ToggleOptions>
153
+ <RaidoButton onClick={() => setIsOrderByProducts(true)}>
154
+ {isOrderByProducts ? <RecordCircleFill className='active' /> : <Circle />}
155
+ <span>{t('ORDER_BY_PRODUCTS', 'Order by products')}</span>
156
+ </RaidoButton>
157
+ <RaidoButton onClick={() => setIsOrderByProducts(false)}>
158
+ {isOrderByProducts ? <Circle /> : <RecordCircleFill className='active' />}
159
+ <span>{t('ORDER_BY_TOTAL', 'Order by total')}</span>
160
+ </RaidoButton>
161
+ </ToggleOptions>
162
+ {!isOrderByProducts && (
163
+ <FormControl>
164
+ <label>{t('TOTAL', 'Total')}</label>
165
+ <Input
166
+ value={extraFields?.total || ''}
167
+ onKeyPress={(e) => {
168
+ if (!/^[0-9]$/.test(e.key)) {
169
+ e.preventDefault()
170
+ }
171
+ }}
172
+ onChange={(e) => setExtraFields({ ...extraFields, total: e.target.value })}
173
+ placeholder={t('TOTAL', 'Total')}
174
+ />
175
+ </FormControl>
176
+ )}
177
+ <FormControl>
178
+ <label>
179
+ {t('EXTERNAL_ID', 'External id')}
180
+ <span>{t('OPTIONAL', 'Optional')}</span>
181
+ </label>
182
+ <Input
183
+ value={extraFields?.external_id || ''}
184
+ onChange={(e) => setExtraFields({ ...extraFields, external_id: e.target.value })}
185
+ placeholder={t('EXTERNAL_ID', 'External id')}
186
+ />
187
+ </FormControl>
188
+ {!isOrderByProducts && (
189
+ <FormControl>
190
+ <label>{t('COMMENT', 'Comment')}</label>
191
+ <TextArea
192
+ value={extraFields?.comment || ''}
193
+ onChange={(e) => setExtraFields({ ...extraFields, comment: e.target.value })}
194
+ placeholder={t('COMMENT', 'Comment')}
195
+ />
196
+ </FormControl>
197
+ )}
198
+ {selectedBusiness && isOrderByProducts && (
99
199
  <SelectProducts
100
200
  productList={productList}
101
201
  getProducts={getProducts}
@@ -104,15 +204,27 @@ const CustomOrderDetailsUI = (props) => {
104
204
  business={selectedBusiness}
105
205
  />
106
206
  )}
107
- {cart && cart?.products.length > 0 && (
207
+ {cart && cart?.products.length > 0 && isOrderByProducts && (
108
208
  <Checkout
109
209
  cartUuid={cart.uuid}
110
210
  onPlaceOrderClick={(data, paymethod, cart) => {
111
211
  cart?.uuid && handleOpenCustomOrderDetail(cart.uuid)
112
212
  onClose()
113
213
  }}
214
+ extraFields={extraFields}
114
215
  />
115
216
  )}
217
+ {!isOrderByProducts && (
218
+ <ButtonWrapper>
219
+ <Button
220
+ color='primary'
221
+ onClick={handlePlaceOrder}
222
+ disabled={actionState?.loading}
223
+ >
224
+ {t('PLACE_ORDER', 'Place Order')}
225
+ </Button>
226
+ </ButtonWrapper>
227
+ )}
116
228
  </>
117
229
  )}
118
230
  <Alert
@@ -26,3 +26,59 @@ export const DetailsContainer = styled.div`
26
26
  margin-bottom: 4px;
27
27
  }
28
28
  `
29
+
30
+ export const FormControl = styled.div`
31
+ margin-top: 20px;
32
+ label {
33
+ display: flex;
34
+ align-items: center;
35
+ justify-content: space-between;
36
+ font-size: 14px;
37
+ margin-bottom: 10px;
38
+ span {
39
+ font-size: 12px;
40
+ color: ${props => props.theme.colors.primary};
41
+ }
42
+ }
43
+ input, textarea {
44
+ width: 100%;
45
+ }
46
+ `
47
+
48
+ export const ToggleOptions = styled.div`
49
+ margin-top: 30px;
50
+ `
51
+
52
+ export const RaidoButton = styled.div`
53
+ display: flex;
54
+ align-items: center;
55
+ margin-bottom: 15px;
56
+ cursor: pointer;
57
+
58
+ svg {
59
+ color: ${props => props.theme.colors.secundaryLight};
60
+ &.active {
61
+ color: ${props => props.theme.colors.primary};
62
+ }
63
+ font-size: 16px;
64
+ min-width: 16px;
65
+ margin-right: 12px;
66
+ ${props => props.theme.rtl && css`
67
+ margin-left: 13px;
68
+ margin-right: 0px;
69
+ `}
70
+ }
71
+ span {
72
+ font-size: 14px;
73
+ line-height: 24px;
74
+ margin: 0px;
75
+ }
76
+ `
77
+
78
+ export const ButtonWrapper = styled.div`
79
+ margin-top: 30px;
80
+ button {
81
+ border-radius: 8px;
82
+ height: 44px;
83
+ }
84
+ `
@@ -28,7 +28,7 @@ const OrderTypeSelectorUI = (props) => {
28
28
  <p>{t('HOW_WILL_YOU_DELIVERY_TYPE', 'How will you delivery type?')}</p>
29
29
  <Select
30
30
  placeholder={<Option>{t('SELECT_DELIVERY_TYPE', 'Select delivery type')}</Option>}
31
- options={configTypes
31
+ options={configTypes.length > 0
32
32
  ? orderTypes.filter(type => configTypes?.includes(type.value)).filter(type => type.name.toLocaleLowerCase().includes(searchValue.toLocaleLowerCase()))
33
33
  : orderTypes.filter(type => type.name.toLocaleLowerCase().includes(searchValue.toLocaleLowerCase()))}
34
34
  defaultValue={defaultType || typeSelected || defaultValue}
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useState } from 'react'
2
- import { useLanguage, useUtils, useCustomer } from 'ordering-components-admin-external'
2
+ import { useLanguage, useUtils, useCustomer, useConfig } from 'ordering-components-admin-external'
3
3
  import { UserAddForm } from '../../../Users'
4
4
  import { AddressList } from '../../../Delivery'
5
5
  import { Dot, HouseDoor } from 'react-bootstrap-icons'
@@ -29,13 +29,13 @@ export const SelectCustomer = (props) => {
29
29
  setSelectedUser,
30
30
  onChangeNumber,
31
31
  handleParentSidebarMove,
32
- customerAddress,
33
- defaultCountryCodeState
32
+ customerAddress
34
33
  } = props
35
34
 
36
35
  const [, t] = useLanguage()
37
36
  const [{ optimizeImage }] = useUtils()
38
37
  const [, { setUserCustomer }] = useCustomer()
38
+ const [{ configs }] = useConfig()
39
39
 
40
40
  const [searchInputFocus, setSearchInputFocus] = useState(false)
41
41
  const [showSearchbar, setShowSearchbar] = useState(true)
@@ -77,11 +77,22 @@ export const SelectCustomer = (props) => {
77
77
  onChangeNumber(trimmedValue)
78
78
  }
79
79
 
80
+ const handleOpenAddressListSidebar = () => {
81
+ setOpenSidebar('address_list')
82
+ handleParentSidebarMove(500)
83
+ }
84
+
80
85
  useEffect(() => {
81
86
  setOpenSidebar(null)
82
87
  handleParentSidebarMove(0)
83
88
  }, [customerAddress?.location])
84
89
 
90
+ useEffect(() => {
91
+ if (!customerAddress?.address && selectedUser) {
92
+ handleOpenAddressListSidebar()
93
+ }
94
+ }, [customerAddress?.address, selectedUser])
95
+
85
96
  return (
86
97
  <>
87
98
  <SectionContainer>
@@ -169,7 +180,7 @@ export const SelectCustomer = (props) => {
169
180
  <Button
170
181
  borderRadius='8px'
171
182
  color='primary'
172
- disabled={openSidebar === 'user_add_form' || defaultCountryCodeState.loading}
183
+ disabled={openSidebar === 'user_add_form'}
173
184
  onClick={() => handleOpenAddForm()}
174
185
  >
175
186
  {t('USERS_REGISTER', 'New user')}
@@ -184,10 +195,7 @@ export const SelectCustomer = (props) => {
184
195
  </div>
185
196
  )}
186
197
  <LinkButton
187
- onClick={() => {
188
- setOpenSidebar('address_list')
189
- handleParentSidebarMove(500)
190
- }}
198
+ onClick={() => handleOpenAddressListSidebar()}
191
199
  >
192
200
  {customerAddress?.address ? t('CHANGE', 'Change') : t('ADD_NEW_ADDRESS', 'Add new address')}
193
201
  </LinkButton>
@@ -205,8 +213,7 @@ export const SelectCustomer = (props) => {
205
213
  <UserAddForm
206
214
  isFromCustomOrder
207
215
  hideUserTypeSelector
208
- defaultCountry={defaultCountryCodeState.code}
209
- defaultPhoneNumber={(selectedUser?.cellphone || phone) && `+${findExitingCountryPhoneCode(defaultCountryCodeState?.code)} ${selectedUser?.cellphone || phone}`}
216
+ defaultPhoneNumber={(selectedUser?.cellphone || phone) && `+${findExitingCountryPhoneCode(configs?.default_country_code?.value?.toUpperCase())} ${selectedUser?.cellphone || phone}`}
210
217
  handleSuccessAdd={onSelectUser}
211
218
  onClose={() => handleCloseSidebar()}
212
219
  />
@@ -221,11 +228,12 @@ export const SelectCustomer = (props) => {
221
228
  open={openSidebar === 'address_list'}
222
229
  onClose={() => handleCloseSidebar()}
223
230
  >
224
- <SavedPlaces>
231
+ <SavedPlaces openExtraAdddress={openExtraAdddress}>
225
232
  <h2>{selectedUser?.name} {selectedUser?.lastname}</h2>
226
233
  <p>{t('SELECT_CUSTOMER_ADDRESS', 'Select customer address')}</p>
227
234
  <AddressListWrapper>
228
235
  <AddressList
236
+ isAutoOpenAddNewAddress
229
237
  isSeletectedUserAddresses
230
238
  userId={selectedUser?.id}
231
239
  addresses={selectedUser?.addresses}
@@ -172,6 +172,9 @@ export const SavedPlaces = styled.div`
172
172
  width: 100%;
173
173
  padding: 25px 20px;
174
174
  overflow: auto;
175
+ ${({ openExtraAdddress }) => openExtraAdddress && css`
176
+ z-index: 10;
177
+ `}
175
178
 
176
179
  > h2 {
177
180
  font-size: 20px;
@@ -29,7 +29,6 @@ const DeliveriesManagerUI = (props) => {
29
29
  selectedSubOrderStatus,
30
30
  handleSelectedSubOrderStatus,
31
31
  onOrderRedirect,
32
- numberOfOrdersByStatus,
33
32
  numberOfOrdersBySubstatus,
34
33
  timeStatus,
35
34
  setTimeStatus
@@ -42,6 +41,12 @@ const DeliveriesManagerUI = (props) => {
42
41
  const [detailsOrder, setDetailsOrder] = useState(null)
43
42
  const [filterModalOpen, setFilterModalOpen] = useState(false)
44
43
  const [slaSettingTime, setSlaSettingTime] = useState(60000)
44
+ const [ordersAmountByStatus, setOrdersAmountByStatus] = useState({
45
+ pending: null,
46
+ inProgress: null,
47
+ completed: null,
48
+ cancelled: null
49
+ })
45
50
 
46
51
  const [configState] = useConfig()
47
52
  const googleMapsApiKey = configState?.configs?.google_maps_api_key?.value
@@ -104,7 +109,8 @@ const DeliveriesManagerUI = (props) => {
104
109
  setFilterModalOpen={setFilterModalOpen}
105
110
  slaSettingTime={slaSettingTime}
106
111
  timeStatus={timeStatus}
107
- numberOfOrdersByStatus={numberOfOrdersByStatus}
112
+ ordersAmountByStatus={ordersAmountByStatus}
113
+ setOrdersAmountByStatus={setOrdersAmountByStatus}
108
114
  numberOfOrdersBySubstatus={numberOfOrdersBySubstatus}
109
115
  />
110
116
  </WrapItemView>
@@ -17,8 +17,8 @@ export const DeliveryDashboard = (props) => {
17
17
  selectedSubOrderStatus,
18
18
  handleOrdersStatusGroupFilter,
19
19
  handleSelectedSubOrderStatus,
20
- numberOfOrdersByStatus,
21
- numberOfOrdersBySubstatus
20
+ ordersAmountByStatus,
21
+ setOrdersAmountByStatus
22
22
  } = props
23
23
 
24
24
  const [interActionMapOrder, setInterActionMapOrder] = useState(null)
@@ -42,13 +42,12 @@ export const DeliveryDashboard = (props) => {
42
42
  <OrderStatusFilterBar
43
43
  selectedOrderStatus={ordersStatusGroup}
44
44
  changeOrderStatus={handleOrdersStatusGroupFilter}
45
- numberOfOrdersByStatus={numberOfOrdersByStatus}
45
+ ordersAmountByStatus={ordersAmountByStatus}
46
46
  />
47
47
  <OrderStatusSubFilter
48
48
  ordersStatusGroup={ordersStatusGroup}
49
49
  selectedSubOrderStatus={selectedSubOrderStatus}
50
50
  handleSelectedSubOrderStatus={handleSelectedSubOrderStatus}
51
- numberOfOrdersBySubstatus={numberOfOrdersBySubstatus}
52
51
  />
53
52
  </FilterContainer>
54
53
  <WrapperOrderlist id='cardOrders'>
@@ -59,6 +58,7 @@ export const DeliveryDashboard = (props) => {
59
58
  handleOrderCardClick={handleLocation}
60
59
  handleUpdateDriverLocation={handleUpdateDriverLocation}
61
60
  isDelivery
61
+ setOrdersAmountByStatus={setOrdersAmountByStatus}
62
62
  />
63
63
  </WrapperOrderlist>
64
64
  </OrdersContainer>