ordering-ui-admin-external 1.2.0 → 1.3.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 (153) hide show
  1. package/_bundles/main.css +2 -2
  2. package/_bundles/{ordering-ui-admin.509785f9d6ed069b4b5d.js → ordering-ui-admin.0bfe9a0aef33a990bc0a.js} +2 -2
  3. package/_bundles/{ordering-ui-admin.509785f9d6ed069b4b5d.js.LICENSE.txt → ordering-ui-admin.0bfe9a0aef33a990bc0a.js.LICENSE.txt} +10 -4
  4. package/_modules/components/BusinessIntelligence/Reports/index.js +27 -3
  5. package/_modules/components/BusinessIntelligence/Reports/styles.js +9 -2
  6. package/_modules/components/BusinessIntelligence/ReviewsListing/index.js +9 -1
  7. package/_modules/components/DisabledFeatureAlert/index.js +63 -0
  8. package/_modules/components/DisabledFeatureAlert/styles.js +42 -0
  9. package/_modules/components/Loyalty/RewardsPrograms/index.js +38 -12
  10. package/_modules/components/Loyalty/RewardsPrograms/styles.js +13 -6
  11. package/_modules/components/Marketing/CampaignHeader/index.js +5 -2
  12. package/_modules/components/Marketing/CampaignHeader/styles.js +7 -4
  13. package/_modules/components/Marketing/CampaignList/index.js +8 -4
  14. package/_modules/components/Marketing/CampaignList/styles.js +30 -22
  15. package/_modules/components/Marketing/CampaignListing/index.js +29 -3
  16. package/_modules/components/Marketing/EnterprisePromotionListing/index.js +46 -22
  17. package/_modules/components/Marketing/EnterprisePromotionListing/styles.js +1 -1
  18. package/_modules/components/OrderingProducts/OrderingProductDetails/index.js +24 -428
  19. package/_modules/components/OrderingProducts/OrderingProductDetails/styles.js +35 -114
  20. package/_modules/components/OrderingProducts/OrderingProductGeneralDetails/index.js +480 -0
  21. package/_modules/components/OrderingProducts/OrderingProductGeneralDetails/styles.js +127 -0
  22. package/_modules/components/OrderingProducts/OrderingProductsListing/index.js +3 -1
  23. package/_modules/components/OrderingProducts/OrderingProductsListing/styles.js +23 -3
  24. package/_modules/components/OrderingProducts/SiteTheme/ThemeComponent.js +119 -0
  25. package/_modules/components/OrderingProducts/SiteTheme/ThemeImage.js +267 -0
  26. package/_modules/components/OrderingProducts/SiteTheme/ThemeOption.js +135 -0
  27. package/_modules/components/OrderingProducts/SiteTheme/index.js +266 -0
  28. package/_modules/components/OrderingProducts/SiteTheme/styles.js +114 -0
  29. package/_modules/components/Orders/CountryFilter/index.js +114 -0
  30. package/_modules/components/Orders/CountryFilter/styles.js +34 -0
  31. package/_modules/components/Orders/CurrencyFilter/index.js +114 -0
  32. package/_modules/components/Orders/CurrencyFilter/styles.js +34 -0
  33. package/_modules/components/Orders/DeliveriesLocation/index.js +22 -12
  34. package/_modules/components/Orders/DriversLocation/index.js +13 -7
  35. package/_modules/components/Orders/OrdersFilterGroup/index.js +13 -1
  36. package/_modules/components/Orders/OrdersListing/index.js +8 -2
  37. package/_modules/components/Orders/OrdersTable/index.js +296 -174
  38. package/_modules/components/Orders/OrdersTable/styles.js +30 -4
  39. package/_modules/components/Orders/index.js +9 -1
  40. package/_modules/components/Settings/SettingItemUI/index.js +3 -1
  41. package/_modules/components/Settings/SettingItemUI/styles.js +18 -11
  42. package/_modules/components/Settings/Settings/index.js +1 -11
  43. package/_modules/components/Settings/SettingsDetail/index.js +40 -3
  44. package/_modules/components/Settings/SettingsDetail/styles.js +27 -8
  45. package/_modules/components/Settings/SettingsList/index.js +43 -6
  46. package/_modules/components/Shared/ColorPicker/styles.js +3 -1
  47. package/_modules/components/Shared/ColumnAllowSettingPopover/index.js +4 -2
  48. package/_modules/components/Shared/SearchBar/index.js +4 -2
  49. package/_modules/components/SidebarMenu/index.js +25 -14
  50. package/_modules/components/SidebarMenu/styles.js +19 -9
  51. package/_modules/components/Stores/BusinessMenu/index.js +36 -5
  52. package/_modules/components/Stores/BusinessMenu/styles.js +27 -16
  53. package/_modules/components/Stores/BusinessMenuOptions/styles.js +9 -4
  54. package/_modules/components/Stores/BusinessPaymentMethods/index.js +53 -16
  55. package/_modules/components/Stores/BusinessProductList/index.js +7 -10
  56. package/_modules/components/Stores/BusinessProductsCategories/index.js +2 -2
  57. package/_modules/components/Stores/BusinessProductsListing/index.js +44 -21
  58. package/_modules/components/Stores/BusinessProductsListing/styles.js +20 -16
  59. package/_modules/components/Stores/BusinessesListing/index.js +4 -1
  60. package/_modules/components/Stores/BusinessesListingHeader/index.js +20 -3
  61. package/_modules/components/Stores/BusinessesListingHeader/styles.js +6 -2
  62. package/_modules/components/Stores/ImportersList/index.js +5 -2
  63. package/_modules/components/Stores/ImportersList/styles.js +18 -15
  64. package/_modules/components/Stores/ImportersListing/index.js +31 -4
  65. package/_modules/components/Stores/PaymentOption/index.js +12 -7
  66. package/_modules/components/Stores/PaymentOption/styles.js +9 -4
  67. package/_modules/components/Stores/PaymentOptionMethods/index.js +9 -4
  68. package/_modules/components/Stores/PaymentOptionMethods/styles.js +10 -5
  69. package/_modules/components/Stores/PaymentOptionPaypal/index.js +9 -4
  70. package/_modules/components/Stores/PaymentOptionSquare/index.js +10 -5
  71. package/_modules/components/Stores/PaymentOptionStripeDirect/index.js +10 -5
  72. package/_modules/components/Stores/PaymentOptionStripeDirect/styles.js +10 -5
  73. package/_modules/components/Stores/PaymethodOptionPaypalExpress/index.js +9 -4
  74. package/_modules/components/Stores/PaymethodOptionStripeConnect/index.js +9 -4
  75. package/_modules/components/Stores/PaymethodOptionStripeRedirect/index.js +9 -4
  76. package/_modules/components/Users/UsersList/index.js +8 -2
  77. package/_modules/components/Users/UsersList/styles.js +15 -12
  78. package/package.json +2 -2
  79. package/src/components/BusinessIntelligence/Reports/index.js +18 -4
  80. package/src/components/BusinessIntelligence/Reports/styles.js +11 -0
  81. package/src/components/BusinessIntelligence/ReviewsListing/index.js +12 -0
  82. package/src/components/DisabledFeatureAlert/index.js +37 -0
  83. package/src/components/DisabledFeatureAlert/styles.js +32 -0
  84. package/src/components/Loyalty/RewardsPrograms/index.js +18 -5
  85. package/src/components/Loyalty/RewardsPrograms/styles.js +10 -0
  86. package/src/components/Marketing/CampaignHeader/index.js +3 -2
  87. package/src/components/Marketing/CampaignHeader/styles.js +8 -0
  88. package/src/components/Marketing/CampaignList/index.js +5 -3
  89. package/src/components/Marketing/CampaignList/styles.js +16 -0
  90. package/src/components/Marketing/CampaignListing/index.js +18 -2
  91. package/src/components/Marketing/EnterprisePromotionListing/index.js +17 -4
  92. package/src/components/Marketing/EnterprisePromotionListing/styles.js +5 -1
  93. package/src/components/OrderingProducts/OrderingProductDetails/index.js +34 -497
  94. package/src/components/OrderingProducts/OrderingProductDetails/styles.js +38 -288
  95. package/src/components/OrderingProducts/OrderingProductGeneralDetails/index.js +514 -0
  96. package/src/components/OrderingProducts/OrderingProductGeneralDetails/styles.js +279 -0
  97. package/src/components/OrderingProducts/OrderingProductsListing/index.js +14 -2
  98. package/src/components/OrderingProducts/OrderingProductsListing/styles.js +62 -0
  99. package/src/components/OrderingProducts/SiteTheme/ThemeComponent.js +104 -0
  100. package/src/components/OrderingProducts/SiteTheme/ThemeImage.js +151 -0
  101. package/src/components/OrderingProducts/SiteTheme/ThemeOption.js +118 -0
  102. package/src/components/OrderingProducts/SiteTheme/index.js +221 -0
  103. package/src/components/OrderingProducts/SiteTheme/styles.js +160 -0
  104. package/src/components/Orders/CountryFilter/index.js +68 -0
  105. package/src/components/Orders/CountryFilter/styles.js +29 -0
  106. package/src/components/Orders/CurrencyFilter/index.js +68 -0
  107. package/src/components/Orders/CurrencyFilter/styles.js +29 -0
  108. package/src/components/Orders/DeliveriesLocation/index.js +60 -8
  109. package/src/components/Orders/DriversLocation/index.js +32 -4
  110. package/src/components/Orders/OrdersFilterGroup/index.js +15 -1
  111. package/src/components/Orders/OrdersListing/index.js +8 -1
  112. package/src/components/Orders/OrdersTable/index.js +297 -252
  113. package/src/components/Orders/OrdersTable/styles.js +33 -0
  114. package/src/components/Orders/index.js +3 -1
  115. package/src/components/Settings/SettingItemUI/index.js +2 -1
  116. package/src/components/Settings/SettingItemUI/styles.js +5 -0
  117. package/src/components/Settings/Settings/index.js +0 -11
  118. package/src/components/Settings/SettingsDetail/index.js +23 -4
  119. package/src/components/Settings/SettingsDetail/styles.js +9 -2
  120. package/src/components/Settings/SettingsList/index.js +30 -3
  121. package/src/components/Shared/ColorPicker/styles.js +1 -0
  122. package/src/components/Shared/ColumnAllowSettingPopover/index.js +2 -2
  123. package/src/components/Shared/SearchBar/index.js +3 -2
  124. package/src/components/SidebarMenu/index.js +22 -7
  125. package/src/components/SidebarMenu/styles.js +13 -0
  126. package/src/components/Stores/BusinessMenu/index.js +21 -3
  127. package/src/components/Stores/BusinessMenu/styles.js +19 -0
  128. package/src/components/Stores/BusinessMenuOptions/styles.js +6 -0
  129. package/src/components/Stores/BusinessPaymentMethods/index.js +62 -32
  130. package/src/components/Stores/BusinessProductList/index.js +2 -1
  131. package/src/components/Stores/BusinessProductsCategories/index.js +2 -2
  132. package/src/components/Stores/BusinessProductsListing/index.js +18 -4
  133. package/src/components/Stores/BusinessProductsListing/styles.js +40 -10
  134. package/src/components/Stores/BusinessesListing/index.js +3 -0
  135. package/src/components/Stores/BusinessesListingHeader/index.js +15 -3
  136. package/src/components/Stores/BusinessesListingHeader/styles.js +38 -0
  137. package/src/components/Stores/ImportersList/index.js +3 -2
  138. package/src/components/Stores/ImportersList/styles.js +8 -1
  139. package/src/components/Stores/ImportersListing/index.js +25 -1
  140. package/src/components/Stores/PaymentOption/index.js +9 -5
  141. package/src/components/Stores/PaymentOption/styles.js +8 -0
  142. package/src/components/Stores/PaymentOptionMethods/index.js +8 -3
  143. package/src/components/Stores/PaymentOptionMethods/styles.js +8 -0
  144. package/src/components/Stores/PaymentOptionPaypal/index.js +8 -3
  145. package/src/components/Stores/PaymentOptionSquare/index.js +183 -176
  146. package/src/components/Stores/PaymentOptionStripeDirect/index.js +8 -3
  147. package/src/components/Stores/PaymentOptionStripeDirect/styles.js +8 -0
  148. package/src/components/Stores/PaymethodOptionPaypalExpress/index.js +8 -3
  149. package/src/components/Stores/PaymethodOptionStripeConnect/index.js +8 -3
  150. package/src/components/Stores/PaymethodOptionStripeRedirect/index.js +8 -3
  151. package/src/components/Users/UsersList/index.js +10 -1
  152. package/src/components/Users/UsersList/styles.js +9 -0
  153. package/template/app.js +8 -8
@@ -30,7 +30,9 @@ import {
30
30
  LogisticStatusDot,
31
31
  PriorityDot,
32
32
  Timestatus,
33
- Timer
33
+ Timer,
34
+ OrdersCountWrapper,
35
+ DragTh
34
36
  } from './styles'
35
37
 
36
38
  export const OrdersTable = (props) => {
@@ -49,13 +51,17 @@ export const OrdersTable = (props) => {
49
51
  handleOpenTour,
50
52
  setIsTourOpen,
51
53
  slaSettingTime,
52
- groupStatus
54
+ groupStatus,
55
+ allowColumns,
56
+ setAllowColumns,
57
+ handleDrop
53
58
  } = props
54
59
  const [, t] = useLanguage()
55
60
  const theme = useTheme()
56
- const [{ parsePrice, parseDate, optimizeImage, getTimeAgo }] = useUtils()
61
+ const [{ parseDate, optimizeImage, getTimeAgo }] = useUtils()
57
62
  const [isAllChecked, setIsAllChecked] = useState(false)
58
63
  const [, setCurrentTime] = useState()
64
+ const [dragOverd, setDragOverd] = useState('')
59
65
  const handleChangePage = (page) => {
60
66
  getPageOrders(pagination.pageSize, page)
61
67
  }
@@ -64,18 +70,6 @@ export const OrdersTable = (props) => {
64
70
  getPageOrders(pageSize, expectedPage)
65
71
  }
66
72
  const [configState] = useConfig()
67
- const [allowColumns, setAllowColumns] = useState({
68
- status: true,
69
- orderNumber: true,
70
- dateTime: true,
71
- business: true,
72
- customer: true,
73
- driver: true,
74
- advanced: true,
75
- timer: configState?.configs?.order_deadlines_enabled?.value === '1',
76
- slaBar: configState?.configs?.order_deadlines_enabled?.value === '1',
77
- total: true
78
- })
79
73
 
80
74
  const optionsDefault = [
81
75
  {
@@ -227,9 +221,10 @@ export const OrdersTable = (props) => {
227
221
  }
228
222
 
229
223
  const handleChangeAllowColumns = (type) => {
224
+ const _column = allowColumns[type]
230
225
  setAllowColumns({
231
226
  ...allowColumns,
232
- [type]: !allowColumns[type]
227
+ [type]: { ..._column, visable: !_column?.visable }
233
228
  })
234
229
  }
235
230
 
@@ -251,6 +246,35 @@ export const OrdersTable = (props) => {
251
246
  setSelectedOrderIds(updatedSelectedOrderIds)
252
247
  }
253
248
  }
249
+ /**
250
+ * Method to handle drag start
251
+ */
252
+ const handleDragStart = (event, columnName) => {
253
+ event.dataTransfer.setData('transferColumnName', columnName)
254
+ const ghostEle = document.createElement('div')
255
+ ghostEle.classList.add('ghostDragging')
256
+ ghostEle.innerHTML = allowColumns[columnName]?.title
257
+ document.body.appendChild(ghostEle)
258
+ event.dataTransfer.setDragImage(ghostEle, 0, 0)
259
+ }
260
+ /**
261
+ * Method to handle drag over
262
+ */
263
+ const handleDragOver = (event, columnName) => {
264
+ event.preventDefault()
265
+ setDragOverd(columnName)
266
+ }
267
+
268
+ /**
269
+ * Method to handle drag end
270
+ */
271
+ const handleDragEnd = () => {
272
+ const elements = document.getElementsByClassName('ghostDragging')
273
+ while (elements.length > 0) {
274
+ elements[0].parentNode.removeChild(elements[0])
275
+ }
276
+ setDragOverd('')
277
+ }
254
278
 
255
279
  useEffect(() => {
256
280
  if (orderList.loading) return
@@ -272,24 +296,6 @@ export const OrdersTable = (props) => {
272
296
  return () => document.removeEventListener('keydown', handleChangeKeyboard)
273
297
  }, [isTourOpen, currentTourStep])
274
298
 
275
- useEffect(() => {
276
- if (groupStatus === 'completed' || groupStatus === 'cancelled') {
277
- setAllowColumns({
278
- ...allowColumns,
279
- timer: false
280
- })
281
- }
282
- }, [groupStatus])
283
-
284
- useEffect(() => {
285
- const slaSettings = configState?.configs?.order_deadlines_enabled?.value === '1'
286
- setAllowColumns({
287
- ...allowColumns,
288
- timer: slaSettings,
289
- slaBar: slaSettings
290
- })
291
- }, [configState.loading])
292
-
293
299
  return (
294
300
  <>
295
301
  <OrdersContainer
@@ -304,82 +310,97 @@ export const OrdersTable = (props) => {
304
310
  {!isSelectedOrders && (
305
311
  <thead>
306
312
  <tr>
307
- {allowColumns?.slaBar && (
308
- <th>
309
- <Timestatus />
310
- </th>
311
- )}
312
- <th
313
- className={!(allowColumns?.orderNumber || allowColumns?.dateTime) ? 'orderNo small' : 'orderNo'}
314
- >
315
- <CheckBox
316
- isChecked={!orderList.loading && isAllChecked}
317
- onClick={() => handleSelecteAllOrder()}
318
- className='orderCheckBox'
319
- >
320
- {(!orderList.loading && isAllChecked) ? (
321
- <RiCheckboxFill />
322
- ) : (
323
- <RiCheckboxBlankLine />
324
- )}
325
- </CheckBox>
326
- {t('ORDER', 'Order')}
327
- </th>
328
- {allowColumns?.status && (
329
- <th className='statusInfo'>{t('STATUS', 'Status')}</th>
330
- )}
331
- {allowColumns?.business && (
332
- <th className='businessInfo'>{t('BUSINESS', 'Business')}</th>
333
- )}
334
- {allowColumns?.customer && (
335
- <th className='customerInfo'>{t('CUSTOMER', 'Customer')}</th>
336
- )}
337
- {allowColumns?.driver && (
338
- <th className='driverInfo'>{t('DRIVER', 'Driver')}</th>
339
- )}
340
- {allowColumns?.advanced && (
341
- <th colSpan='3' className='advanced'>{t('ADVANCED_LOGISTICS', 'Advanced logistics')}</th>
342
- )}
343
- {(allowColumns?.timer && (groupStatus === 'pending' || groupStatus === 'inProgress')) && (
344
- <th colSpan='2' className='timer'>{t('SLA_TIMER', 'SLA’s timer')}</th>
345
- )}
346
- <th className='orderPrice'>
347
- <ColumnAllowSettingPopover
348
- allowColumns={allowColumns}
349
- optionsDefault={optionsDefault}
350
- handleChangeAllowColumns={handleChangeAllowColumns}
351
- />
352
- </th>
313
+ {allowColumns && Object.keys(allowColumns).filter(col => allowColumns[col]?.visable && allowColumns[col]?.order !== 0)
314
+ .sort((col1, col2) => allowColumns[col1]?.order - allowColumns[col2]?.order)
315
+ .map((column, i) => {
316
+ if (column === 'slaBar') {
317
+ return (
318
+ <th key={`noDragTh-${i}`}>
319
+ <Timestatus />
320
+ </th>
321
+ )
322
+ }
323
+ if (column === 'orderNumber') {
324
+ return (
325
+ <th
326
+ className={!(allowColumns?.orderNumber?.visable || allowColumns?.dateTime?.visable) ? 'orderNo small' : 'orderNo'}
327
+ key={`noDragTh-${i}`}
328
+ >
329
+ <CheckBox
330
+ isChecked={!orderList.loading && isAllChecked}
331
+ onClick={() => handleSelecteAllOrder()}
332
+ className='orderCheckBox'
333
+ >
334
+ {(!orderList.loading && isAllChecked) ? (
335
+ <RiCheckboxFill />
336
+ ) : (
337
+ <RiCheckboxBlankLine />
338
+ )}
339
+ </CheckBox>
340
+ {t('ORDER', 'Order')}
341
+ </th>
342
+ )
343
+ }
344
+ if (column === 'total') {
345
+ return (
346
+ <th className='orderPrice' key={`noDragTh-${i}`}>
347
+ <ColumnAllowSettingPopover
348
+ allowColumns={allowColumns}
349
+ optionsDefault={optionsDefault}
350
+ handleChangeAllowColumns={handleChangeAllowColumns}
351
+ />
352
+ </th>
353
+ )
354
+ }
355
+ return (column !== 'timer' || (column === 'timer' && (groupStatus === 'pending' || groupStatus === 'inProgress'))) && (
356
+ <DragTh
357
+ key={`dragTh-${i}`}
358
+ onDragOver={e => handleDragOver?.(e, column)}
359
+ onDrop={e => handleDrop(e, column)}
360
+ onDragEnd={e => handleDragEnd(e)}
361
+ colSpan={allowColumns[column]?.colSpan ?? 1}
362
+ className={allowColumns[column]?.className}
363
+ selectedDragOver={column === dragOverd}
364
+ >
365
+ <div draggable onDragStart={e => handleDragStart?.(e, column)}>
366
+ <img
367
+ src={theme.images.icons?.sixDots}
368
+ alt='six dots'
369
+ />
370
+ <span>{allowColumns[column]?.title}</span>
371
+ </div>
372
+ </DragTh>)
373
+ })}
353
374
  </tr>
354
375
  </thead>
355
376
  )}
356
- {orderList.loading ? (
377
+ {(orderList.loading || !allowColumns) ? (
357
378
  [...Array(10).keys()].map(i => (
358
379
  <OrderTbody key={i}>
359
380
  <tr>
360
- {allowColumns?.slaBar && (
381
+ {allowColumns?.slaBar?.visable && (
361
382
  <td>
362
383
  <Timestatus />
363
384
  </td>
364
385
  )}
365
386
  <td
366
- className={!(allowColumns?.orderNumber || allowColumns?.dateTime) ? 'orderNo small' : 'orderNo'}
387
+ className={!(allowColumns?.orderNumber?.visable || allowColumns?.dateTime?.visable) ? 'orderNo small' : 'orderNo'}
367
388
  >
368
389
  <OrderNumberContainer>
369
390
  <CheckBox>
370
391
  <Skeleton width={25} height={25} style={{ margin: '10px' }} />
371
392
  </CheckBox>
372
393
  <div className='info'>
373
- {allowColumns?.orderNumber && (
394
+ {allowColumns?.orderNumber?.visable && (
374
395
  <p><Skeleton width={100} /></p>
375
396
  )}
376
- {allowColumns?.dateTime && (
397
+ {allowColumns?.dateTime?.visable && (
377
398
  <Skeleton width={120} />
378
399
  )}
379
400
  </div>
380
401
  </OrderNumberContainer>
381
402
  </td>
382
- {allowColumns?.status && !isSelectedOrders && (
403
+ {allowColumns?.status?.visable && !isSelectedOrders && (
383
404
  <td className='statusInfo'>
384
405
  <StatusInfo>
385
406
  <div className='info'>
@@ -388,7 +409,7 @@ export const OrdersTable = (props) => {
388
409
  </StatusInfo>
389
410
  </td>
390
411
  )}
391
- {allowColumns?.business && (
412
+ {allowColumns?.business?.visable && (
392
413
  <td className='businessInfo'>
393
414
  <BusinessInfo>
394
415
  <Skeleton width={45} height={45} />
@@ -399,7 +420,7 @@ export const OrdersTable = (props) => {
399
420
  </BusinessInfo>
400
421
  </td>
401
422
  )}
402
- {allowColumns?.customer && (
423
+ {allowColumns?.customer?.visable && (
403
424
  <td className='customerInfo'>
404
425
  <CustomerInfo>
405
426
  <Skeleton width={45} height={45} />
@@ -410,7 +431,7 @@ export const OrdersTable = (props) => {
410
431
  </CustomerInfo>
411
432
  </td>
412
433
  )}
413
- {allowColumns?.driver && !isSelectedOrders && (
434
+ {allowColumns?.driver?.visable && !isSelectedOrders && (
414
435
  <td className='driverInfo'>
415
436
  <DriversInfo className='d-flex align-items-center'>
416
437
  <Skeleton width={45} height={45} />
@@ -418,21 +439,21 @@ export const OrdersTable = (props) => {
418
439
  </DriversInfo>
419
440
  </td>
420
441
  )}
421
- {allowColumns?.deliveryType && !isSelectedOrders && (
442
+ {allowColumns?.deliveryType?.visable && !isSelectedOrders && (
422
443
  <td className='orderType'>
423
444
  <OrderType>
424
445
  <Skeleton width={35} height={35} />
425
446
  </OrderType>
426
447
  </td>
427
448
  )}
428
- {allowColumns?.status && !isSelectedOrders && (
449
+ {allowColumns?.status?.visable && !isSelectedOrders && (
429
450
  <td className='orderStatusTitle'>
430
451
  <WrapOrderStatusSelector>
431
452
  <Skeleton width={100} height={30} />
432
453
  </WrapOrderStatusSelector>
433
454
  </td>
434
455
  )}
435
- {allowColumns?.advanced && !isSelectedOrders && (
456
+ {allowColumns?.advanced?.visable && !isSelectedOrders && (
436
457
  <td className='logistic'>
437
458
  <div className='info'>
438
459
  <p className='bold'><Skeleton width={60} /></p>
@@ -440,7 +461,7 @@ export const OrdersTable = (props) => {
440
461
  </div>
441
462
  </td>
442
463
  )}
443
- {allowColumns?.advanced && !isSelectedOrders && (
464
+ {allowColumns?.advanced?.visable && !isSelectedOrders && (
444
465
  <td className='attempts'>
445
466
  <div className='info'>
446
467
  <p className='bold'><Skeleton width={60} /></p>
@@ -448,7 +469,7 @@ export const OrdersTable = (props) => {
448
469
  </div>
449
470
  </td>
450
471
  )}
451
- {allowColumns?.advanced && !isSelectedOrders && (
472
+ {allowColumns?.advanced?.visable && !isSelectedOrders && (
452
473
  <td className='priority'>
453
474
  <div className='info'>
454
475
  <p className='bold'><Skeleton width={60} /></p>
@@ -459,7 +480,7 @@ export const OrdersTable = (props) => {
459
480
  {!isSelectedOrders && (
460
481
  <td className='orderPrice'>
461
482
  <div className='info'>
462
- {allowColumns?.total && (
483
+ {allowColumns?.total?.visable && (
463
484
  <p className='bold'><Skeleton width={60} /></p>
464
485
  )}
465
486
  <p>
@@ -480,164 +501,188 @@ export const OrdersTable = (props) => {
480
501
  data-tour={i === 0 ? 'tour_start' : ''}
481
502
  >
482
503
  <tr>
483
- {allowColumns?.slaBar && (
484
- <td>
485
- <Timestatus
486
- timeState={getStatusClassName(getDelayMinutes(order))}
487
- />
488
- </td>
489
- )}
490
- <td
491
- className={!(allowColumns?.orderNumber || allowColumns?.dateTime) ? 'small' : ''}
492
- >
493
- <OrderNumberContainer>
494
- {!isSelectedOrders && (
495
- <CheckBox
496
- isChecked={selectedOrderIds.includes(order?.id)}
497
- onClick={() => handleSelectedOrderIds(order.id)}
498
- className='orderCheckBox'
499
- >
500
- {selectedOrderIds.includes(order?.id) ? (
501
- <RiCheckboxFill />
502
- ) : (
503
- <RiCheckboxBlankLine />
504
- )}
505
- </CheckBox>
506
- )}
507
- <div className='info'>
508
- {allowColumns?.orderNumber && (
509
- <p className='bold'>{t('INVOICE_ORDER_NO', 'Order No.')} {order?.id}</p>
510
- )}
511
- {allowColumns?.dateTime && (
512
- <p className='date'>
513
- {parseDate(order?.delivery_datetime, { utc: false })}
514
- </p>
515
- )}
516
- </div>
517
- </OrderNumberContainer>
518
- </td>
519
- {allowColumns?.status && !isSelectedOrders && (
520
- <td className='statusInfo'>
521
- <StatusInfo>
522
- <p className='bold'>{getOrderStatus(order.status)?.value}</p>
523
- </StatusInfo>
524
- </td>
525
- )}
526
- {allowColumns?.business && (
527
- <td className='businessInfo'>
528
- <BusinessInfo>
529
- <WrapperImage>
530
- <img src={optimizeImage(order.business?.logo || theme.images?.dummies?.businessLogo, 'h_50,c_limit')} loading='lazy' alt='' />
531
- </WrapperImage>
532
- <div className='info'>
533
- <p className='bold'>{order?.business?.name}</p>
534
- <p>{order?.business?.city?.name}</p>
535
- </div>
536
- </BusinessInfo>
537
- </td>
538
- )}
539
- {allowColumns?.customer && (
540
- <td className='customerInfo'>
541
- <CustomerInfo>
542
- <WrapperImage>
543
- {order?.customer?.photo ? (
544
- <img src={optimizeImage(order?.customer?.photo, 'h_50,c_limit')} loading='lazy' alt='' />
545
- ) : (
546
- <FaUserAlt />
547
- )}
548
- </WrapperImage>
549
- <div className='info'>
550
- <p className='bold'>{order?.customer?.name}</p>
551
- <p>{order?.customer?.cellphone}</p>
552
- </div>
553
- </CustomerInfo>
554
- </td>
555
- )}
556
- {isSelectedOrders && (
557
- <td>
558
- <ChevronRight color='#B1BCCC' />
559
- </td>
560
- )}
561
- {allowColumns?.driver && !isSelectedOrders && (
562
- <td>
563
- {order?.delivery_type === 1 && (
564
- <CustomerInfo>
565
- <WrapperImage>
566
- {order?.driver?.photo ? (
567
- <img src={optimizeImage(order?.driver?.photo, 'h_50,c_limit')} loading='lazy' alt='' />
568
- ) : (
569
- <FaUserAlt />
570
- )}
571
- </WrapperImage>
572
- <div className='info'>
573
- {order?.driver ? (
574
- <>
575
- <p className='bold'>{order?.driver?.name}</p>
576
- <p>{order?.driver?.cellphone}</p>
577
- </>
578
- ) : (
579
- <p className='bold'>{t('NO_DRIVER', 'No Driver')}</p>
504
+ {Object.keys(allowColumns).filter(col => allowColumns[col]?.visable)
505
+ .sort((col1, col2) => allowColumns[col1]?.order - allowColumns[col2]?.order)
506
+ .map((column, index) => {
507
+ if (column === 'slaBar') {
508
+ return (
509
+ <td key={`slaBar${i}-${index}`}>
510
+ <Timestatus
511
+ timeState={getStatusClassName(getDelayMinutes(order))}
512
+ />
513
+ </td>
514
+ )
515
+ }
516
+ if (column === 'orderNumber') {
517
+ return (
518
+ <td
519
+ className={!(allowColumns?.orderNumber?.visable || allowColumns?.dateTime?.visable) ? 'small' : ''}
520
+ key={`orderNumber${i}-${index}`}
521
+ >
522
+ <OrderNumberContainer>
523
+ {!isSelectedOrders && (
524
+ <CheckBox
525
+ isChecked={selectedOrderIds.includes(order?.id)}
526
+ onClick={() => handleSelectedOrderIds(order.id)}
527
+ className='orderCheckBox'
528
+ >
529
+ {selectedOrderIds.includes(order?.id) ? (
530
+ <RiCheckboxFill />
531
+ ) : (
532
+ <RiCheckboxBlankLine />
533
+ )}
534
+ </CheckBox>
535
+ )}
536
+ <div className='info'>
537
+ {allowColumns?.orderNumber?.visable && (
538
+ <p className='bold'>{t('INVOICE_ORDER_NO', 'Order No.')} {order?.id}</p>
539
+ )}
540
+ {allowColumns?.dateTime?.visable && (
541
+ <p className='date'>
542
+ {parseDate(order?.delivery_datetime, { utc: false })}
543
+ </p>
544
+ )}
545
+ </div>
546
+ </OrderNumberContainer>
547
+ </td>
548
+ )
549
+ }
550
+ if (column === 'status' && !isSelectedOrders) {
551
+ return (
552
+ <td className='statusInfo' key={`statusInfo${i}-${index}`}>
553
+ <StatusInfo>
554
+ <p className='bold'>{getOrderStatus(order.status)?.value}</p>
555
+ </StatusInfo>
556
+ </td>
557
+ )
558
+ }
559
+ if (column === 'business') {
560
+ return (
561
+ <td className='businessInfo' key={`businessInfo${i}-${index}`}>
562
+ <BusinessInfo>
563
+ <WrapperImage>
564
+ <img src={optimizeImage(order.business?.logo || theme.images?.dummies?.businessLogo, 'h_50,c_limit')} loading='lazy' alt='' />
565
+ </WrapperImage>
566
+ <div className='info'>
567
+ <p className='bold'>{order?.business?.name}</p>
568
+ <p>{order?.business?.city?.name}</p>
569
+ </div>
570
+ </BusinessInfo>
571
+ </td>
572
+ )
573
+ }
574
+ if (column === 'customer') {
575
+ return (
576
+ <td className='customerInfo' key={`customerInfo${i}-${index}`}>
577
+ <CustomerInfo>
578
+ <WrapperImage>
579
+ {order?.customer?.photo ? (
580
+ <img src={optimizeImage(order?.customer?.photo, 'h_50,c_limit')} loading='lazy' alt='' />
581
+ ) : (
582
+ <FaUserAlt />
583
+ )}
584
+ <OrdersCountWrapper isNew={order?.customer?.orders_count === 0}>
585
+ {order?.customer?.orders_count || t('NEW', 'New')}
586
+ </OrdersCountWrapper>
587
+ </WrapperImage>
588
+ <div className='info'>
589
+ <p className='bold'>{order?.customer?.name}</p>
590
+ <p>{order?.customer?.cellphone}</p>
591
+ </div>
592
+ </CustomerInfo>
593
+ </td>
594
+ )
595
+ }
596
+ if (column === 'driver' && !isSelectedOrders) {
597
+ return (
598
+ <td key={`driver${i}-${index}`}>
599
+ {order?.delivery_type === 1 && (
600
+ <CustomerInfo>
601
+ <WrapperImage>
602
+ {order?.driver?.photo ? (
603
+ <img src={optimizeImage(order?.driver?.photo, 'h_50,c_limit')} loading='lazy' alt='' />
604
+ ) : (
605
+ <FaUserAlt />
606
+ )}
607
+ </WrapperImage>
608
+ <div className='info'>
609
+ {order?.driver ? (
610
+ <>
611
+ <p className='bold'>{order?.driver?.name}</p>
612
+ <p>{order?.driver?.cellphone}</p>
613
+ </>
614
+ ) : (
615
+ <p className='bold'>{t('NO_DRIVER', 'No Driver')}</p>
616
+ )}
617
+ </div>
618
+ </CustomerInfo>
580
619
  )}
581
- </div>
582
- </CustomerInfo>
583
- )}
584
- </td>
585
- )}
586
- {allowColumns?.advanced && !isSelectedOrders && (
587
- <td className='logistic'>
588
- <div className='info'>
589
- <p className='bold'>{t('LOGISTIC', 'Logistic')}</p>
590
- <p>
591
- {getLogisticTag(order?.logistic_status)}
592
- <LogisticStatusDot
593
- status={order?.logistic_status}
594
- />
595
- </p>
596
- </div>
597
- </td>
598
- )}
599
- {allowColumns?.advanced && !isSelectedOrders && (
600
- <td className='attempts'>
601
- <div className='info'>
602
- <p className='bold'>{t('ATTEMPTS', 'Attempts')}</p>
603
- <p>{order?.logistic_attemps}</p>
604
- </div>
605
- </td>
606
- )}
607
- {allowColumns?.advanced && !isSelectedOrders && (
608
- <td className='priority'>
609
- <div className='info'>
610
- <p className='bold'>{t('PRIORITY', 'Priority')}</p>
611
- <p>
612
- {getPriorityTag(order?.priority)}
613
- <PriorityDot priority={order?.priority} />
614
- </p>
615
- </div>
616
- </td>
617
- )}
618
- {(allowColumns?.timer && (groupStatus === 'pending' || groupStatus === 'inProgress')) && (
619
- <td className='timer'>
620
- <Timer>
621
- <p className='bold'>{t('TIMER', 'Timer')}</p>
622
- <p className={getStatusClassName(getDelayMinutes(order))}>{displayDelayedTime(order)}</p>
623
- </Timer>
624
- </td>)}
625
- <td className='orderPrice'>
626
- <div className='info'>
627
- {allowColumns?.total && (
628
- <p className='bold'>{parsePrice(order?.summary?.total)}</p>
629
- )}
630
- {!(order?.status === 1 || order?.status === 11 || order?.status === 2 || order?.status === 5 || order?.status === 6 || order?.status === 10 || order.status === 12) && (
631
- <p>
632
- {
633
- order?.delivery_datetime_utc
634
- ? getTimeAgo(order?.delivery_datetime_utc)
635
- : getTimeAgo(order?.delivery_datetime, { utc: false })
636
- }
637
- </p>
638
- )}
639
- </div>
640
- </td>
620
+ </td>
621
+ )
622
+ }
623
+ if (column === 'advanced' && !isSelectedOrders) {
624
+ return (
625
+ <React.Fragment key={`advanced${i}-${index}`}>
626
+ <td className='logistic'>
627
+ <div className='info'>
628
+ <p className='bold'>{t('LOGISTIC', 'Logistic')}</p>
629
+ <p>
630
+ {getLogisticTag(order?.logistic_status)}
631
+ <LogisticStatusDot
632
+ status={order?.logistic_status}
633
+ />
634
+ </p>
635
+ </div>
636
+ </td>
637
+ <td className='attempts'>
638
+ <div className='info'>
639
+ <p className='bold'>{t('ATTEMPTS', 'Attempts')}</p>
640
+ <p>{order?.logistic_attemps}</p>
641
+ </div>
642
+ </td>
643
+ <td className='priority'>
644
+ <div className='info'>
645
+ <p className='bold'>{t('PRIORITY', 'Priority')}</p>
646
+ <p>
647
+ {getPriorityTag(order?.priority)}
648
+ <PriorityDot priority={order?.priority} />
649
+ </p>
650
+ </div>
651
+ </td>
652
+ </React.Fragment>
653
+ )
654
+ }
655
+ if (column === 'timer' && (groupStatus === 'pending' || groupStatus === 'inProgress')) {
656
+ return (
657
+ <td className='timer' key={`timer${i}-${index}`}>
658
+ <Timer>
659
+ <p className='bold'>{t('TIMER', 'Timer')}</p>
660
+ <p className={getStatusClassName(getDelayMinutes(order))}>{displayDelayedTime(order)}</p>
661
+ </Timer>
662
+ </td>
663
+ )
664
+ }
665
+ if (column === 'total') {
666
+ return (
667
+ <td className='orderPrice' key={`total${i}-${index}`}>
668
+ <div className='info'>
669
+ {allowColumns?.total?.visable && (
670
+ <p className='bold'>{order?.summary?.total} {order?.currency}</p>
671
+ )}
672
+ {!(order?.status === 1 || order?.status === 11 || order?.status === 2 || order?.status === 5 || order?.status === 6 || order?.status === 10 || order.status === 12) && (
673
+ <p>
674
+ {
675
+ order?.delivery_datetime_utc
676
+ ? getTimeAgo(order?.delivery_datetime_utc)
677
+ : getTimeAgo(order?.delivery_datetime, { utc: false })
678
+ }
679
+ </p>
680
+ )}
681
+ </div>
682
+ </td>
683
+ )
684
+ }
685
+ })}
641
686
  </tr>
642
687
  </OrderTbody>
643
688
  ))