@bjsdistribution/dms-client-return 0.1.99-prod → 0.2.0-prod

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 (48) hide show
  1. package/dist/components/client-portal/OutstandingTable.js +118 -112
  2. package/dist/components/client-portal/OutstandingTable.js.map +1 -1
  3. package/dist/components/fakeData.js.map +1 -1
  4. package/dist/components/order-daily-overview/common/fakedata.js.map +1 -1
  5. package/dist/components/order-daily-overview/return-after-table/table/OrderTable.js +33 -31
  6. package/dist/components/order-daily-overview/return-after-table/table/OrderTable.js.map +1 -1
  7. package/dist/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.js +82 -79
  8. package/dist/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.js.map +1 -1
  9. package/dist/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.js +157 -151
  10. package/dist/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.js.map +1 -1
  11. package/dist/components/order-view/order-actions/Dropdown.js +3 -3
  12. package/dist/components/order-view/order-actions/Dropdown.js.map +1 -1
  13. package/dist/components/order-view/order-actions/actions/cancel-order/CancelOrderTable.js +47 -45
  14. package/dist/components/order-view/order-actions/actions/cancel-order/CancelOrderTable.js.map +1 -1
  15. package/dist/components/order-view/order-actions/actions/cancel-order/ReturnReason.js +36 -23
  16. package/dist/components/order-view/order-actions/actions/cancel-order/ReturnReason.js.map +1 -1
  17. package/dist/components/order-view/order-actions/actions/confirm-order/tables/ProductTable.js +25 -23
  18. package/dist/components/order-view/order-actions/actions/confirm-order/tables/ProductTable.js.map +1 -1
  19. package/dist/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.js +89 -88
  20. package/dist/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.js.map +1 -1
  21. package/dist/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.js +16 -16
  22. package/dist/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.js.map +1 -1
  23. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.js +23 -22
  24. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.js.map +1 -1
  25. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.js +56 -52
  26. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.js.map +1 -1
  27. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.js +27 -26
  28. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.js.map +1 -1
  29. package/dist/components/order-view/order-actions/actions/hold-order/HoldOrderModal.js +29 -29
  30. package/dist/components/order-view/order-actions/actions/hold-order/HoldOrderModal.js.map +1 -1
  31. package/dist/components/order-view/order-actions/actions/split-order/SplitOrderTable.js +72 -71
  32. package/dist/components/order-view/order-actions/actions/split-order/SplitOrderTable.js.map +1 -1
  33. package/dist/components/order-view/order-actions/actions/uncancel-order/UncancelOrderTable.js +37 -35
  34. package/dist/components/order-view/order-actions/actions/uncancel-order/UncancelOrderTable.js.map +1 -1
  35. package/dist/components/order-view/order-details/expanded-content/services-section/OrderServices.js +20 -18
  36. package/dist/components/order-view/order-details/expanded-content/services-section/OrderServices.js.map +1 -1
  37. package/dist/components/order-view/order-details/expanded-content/services-section/ServiceType.js +26 -22
  38. package/dist/components/order-view/order-details/expanded-content/services-section/ServiceType.js.map +1 -1
  39. package/dist/components/order-view/order-details/helper.js.map +1 -1
  40. package/dist/components/order-view/return-client-products/product-table/ReturnProductTable.js +53 -53
  41. package/dist/components/order-view/return-client-products/product-table/ReturnProductTable.js.map +1 -1
  42. package/dist/components/order-view/toolbox-resources/expanded-content/index.js +6 -7
  43. package/dist/components/order-view/toolbox-resources/expanded-content/index.js.map +1 -1
  44. package/dist/components/utils.js +4 -5
  45. package/dist/components/utils.js.map +1 -1
  46. package/dist/types/components/order-view/order-actions/Dropdown.d.ts +1 -0
  47. package/dist/types/components/utils.d.ts +0 -1
  48. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"SplitOrderTable.js","sources":["../../../../../../src/components/order-view/order-actions/actions/split-order/SplitOrderTable.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react';\nimport { useReturnProductDetails } from '../../../store';\n\nimport { Empty, Skeleton } from 'antd';\nimport { Checkbox } from '@bjsdistribution/dms-component-library';\nimport { useLoading } from '../../../../order-daily-overview/store/store';\nimport { useSelectedSplit, useSplitOrderPayload } from '../../store';\nimport {\n EmptyDataContainer,\n StyledTable,\n StyledTableWrapper,\n} from '../confirm-order/tables/ReminderStyles';\nimport styled from 'styled-components';\nimport ChevronDownIcon from '../../../../../assets/icons/ChevronDownIcon';\nimport {\n groupProductsByPallet,\n hasAnyPallet,\n PalletGroup,\n toggleGroupSelectionIds,\n} from '../../../return-client-products/product-table/palletGrouping';\n\nconst COLUMN_COUNT = 7;\n\nfunction SplitOrderTable() {\n /**\n * Reads the return-products atom rather than the shared `productDetails` one:\n * this modal splits a return order, and only that payload carries pallet data.\n */\n const [orderProductDetails] = useReturnProductDetails();\n const [loading] = useLoading();\n const [selectedSplits, setSelectedSplit] = useSelectedSplit();\n const [selectAll, setSelectAll] = useState(false);\n const [payload, setPayload] = useSplitOrderPayload();\n\n const selectedIds = useMemo(\n () => (selectedSplits ?? []).map((order: any) => order?.id),\n [selectedSplits]\n );\n\n const palletGroups = useMemo(\n () => groupProductsByPallet(orderProductDetails),\n [orderProductDetails]\n );\n\n /** Return orders picked before pallet scanning keep the original flat list. */\n const isGrouped = useMemo(() => hasAnyPallet(orderProductDetails), [\n orderProductDetails,\n ]);\n\n /** Pallet groups start collapsed; the No Pallet ID group is always open. */\n const [expandedPallets, setExpandedPallets] = useState<\n Record<string, boolean>\n >({});\n\n const isGroupExpanded = (group: PalletGroup) =>\n group.isNoPallet || !!expandedPallets[group.key];\n\n const togglePallet = (key: string) =>\n setExpandedPallets(prev => ({ ...prev, [key]: !prev[key] }));\n\n const applySelection = (ids: any[]) => {\n setSelectedSplit(ids.map((id: any) => ({ id })));\n setSelectAll(ids.length === orderProductDetails?.length);\n };\n\n // Handle Select All\n const handleSelectAll = (e: any) => {\n const isChecked = e.target.checked;\n setSelectAll(isChecked);\n\n if (isChecked) {\n setSelectedSplit(\n orderProductDetails?.map((order: any) => ({ id: order.id }))\n );\n } else {\n setSelectedSplit([]);\n }\n };\n\n const handleSelectedSplitList = (id: any) => {\n setSelectedSplit((prevSelectedOrder: any) => {\n const isSelected = prevSelectedOrder?.some(\n (order: any) => order.id === id\n );\n\n const updatedSelection = isSelected\n ? prevSelectedOrder?.filter((order: any) => order.id !== id)\n : [...prevSelectedOrder, { id }];\n\n setSelectAll(updatedSelection?.length === orderProductDetails?.length);\n\n return updatedSelection;\n });\n };\n\n /** Selecting a whole pallet is a shortcut for ticking each of its rows. */\n const toggleGroupSelection = (group: PalletGroup, allSelected: boolean) => {\n const groupIds = group.items.map((item: any) => item?.id);\n applySelection(toggleGroupSelectionIds(selectedIds, groupIds, allSelected));\n };\n\n useEffect(() => {\n setPayload({\n ...payload,\n return_order: 1, // FOR SPLIT ORDER WE ARE ASKED TO SET THIS AS 1\n products: selectedSplits?.map((order: any) => order.id),\n force: true,\n });\n }, [selectedSplits, setPayload]);\n\n const renderProductRow = (product: any) => (\n <tr key={product.id}>\n <td style={{ position: 'relative' }}>\n <Checkbox\n checked={selectedSplits?.some(\n (selectedOrder: any) => selectedOrder.id === product.id\n )}\n onChange={() => handleSelectedSplitList(product.id)}\n />\n </td>\n <td>{product?.order_product_type?.type}</td>\n <td>{product?.code}</td>\n <td>{product?.description}</td>\n <td>{product?.description}</td>\n <td>{product?.description}</td>\n <td>{product?.sku}</td>\n </tr>\n );\n\n const renderPalletGroup = (group: PalletGroup) => {\n const expanded = isGroupExpanded(group);\n const selectedInGroup = group.items.filter((item: any) =>\n selectedIds.includes(item?.id)\n ).length;\n const allSelectedInGroup =\n group.items.length > 0 && selectedInGroup === group.items.length;\n const itemLabel = `${group.items.length} ${\n group.items.length === 1 ? 'item' : 'items'\n }`;\n\n return (\n <React.Fragment key={group.key}>\n <PalletHeaderRow>\n <td colSpan={COLUMN_COUNT}>\n <div className={group.isNoPallet ? 'no-pallet-divider' : undefined}>\n <PalletHeaderBar>\n <Checkbox\n checked={allSelectedInGroup}\n onChange={() => toggleGroupSelection(group, allSelectedInGroup)}\n aria-label={\n group.isNoPallet\n ? 'Select all items with no pallet ID'\n : `Select whole pallet ${group.label}`\n }\n />\n\n <PalletHeaderToggle\n type=\"button\"\n disabled={group.isNoPallet}\n onClick={\n group.isNoPallet ? undefined : () => togglePallet(group.key)\n }\n aria-expanded={group.isNoPallet ? undefined : expanded}\n >\n {!group.isNoPallet && (\n <Chevron $isExpanded={expanded}>\n <ChevronDownIcon />\n </Chevron>\n )}\n\n <span className=\"title\">\n {group.isNoPallet ? (\n <span>No Pallet ID</span>\n ) : (\n <>\n <span>Pallet ID:</span>\n <strong>{group.label}</strong>\n </>\n )}\n </span>\n\n <span className=\"count\">({itemLabel})</span>\n\n {selectedInGroup > 0 && (\n <span className=\"selected\">{selectedInGroup} selected</span>\n )}\n\n {!group.isNoPallet && (\n <ToggleGlyph aria-hidden=\"true\">\n {expanded ? '−' : '+'}\n </ToggleGlyph>\n )}\n </PalletHeaderToggle>\n </PalletHeaderBar>\n </div>\n </td>\n </PalletHeaderRow>\n\n {expanded && group.items.map(renderProductRow)}\n </React.Fragment>\n );\n };\n\n return (\n <>\n <StyledTableWrapper id=\"tableScrolling\">\n <StyledTable>\n <thead>\n <tr>\n <th style={{ position: 'relative' }}>\n <Checkbox\n checked={selectAll}\n onChange={handleSelectAll}\n disabled={\n orderProductDetails?.length === 0 ||\n orderProductDetails?.length === null\n }\n />\n </th>\n <th>Type</th>\n <th>Code</th>\n <th>Scan</th>\n <th>Description</th>\n <th>Delivery Instructions</th>\n <th>Barcode</th>\n </tr>\n </thead>\n <tbody>\n {loading ? (\n <tr>\n <td colSpan={6}>\n <Skeleton active />\n </td>\n <td colSpan={6}></td>\n </tr>\n ) : orderProductDetails?.length === 0 ? (\n <tr>\n <td className=\"emptyTd\" colSpan={COLUMN_COUNT}>\n <EmptyDataContainer>\n <Empty description=\"No Data Found\" />\n </EmptyDataContainer>\n </td>\n </tr>\n ) : isGrouped ? (\n palletGroups.map(renderPalletGroup)\n ) : (\n orderProductDetails?.length > 0 &&\n orderProductDetails?.map((product: any) =>\n renderProductRow(product)\n )\n )}\n </tbody>\n </StyledTable>\n </StyledTableWrapper>\n </>\n );\n}\n\nconst PalletHeaderRow = styled.tr`\n && > td {\n padding: 4px 0;\n background: transparent;\n border: none;\n border-radius: 0;\n }\n\n /*\n Divider separating the No Pallet ID group from the palletised groups. Applied\n to an inner wrapper rather than the td, because the rule above resets cell\n borders at && specificity and would win over a border on the td itself.\n */\n && .no-pallet-divider {\n border-top: 1px solid #c9c6c1;\n padding-top: 10px;\n margin-top: 4px;\n }\n`;\n\nconst PalletHeaderBar = styled.div`\n /*\n Required. The library Checkbox renders its real <input> as position:absolute\n with no offsets, so it needs a positioned ancestor here — otherwise its\n containing block resolves outside this scrolling modal, the invisible input\n stops scrolling with the visible box, and clicks land on another pallet's\n checkbox. Same reason the product cells set position:relative inline.\n */\n position: relative;\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n padding: 8px 12px;\n border: 1px solid #e2e0db;\n border-radius: 6px;\n background: #f1f5f9;\n font-family: 'Roboto', sans-serif;\n font-size: 13px;\n font-weight: 500;\n color: #3a3630;\n\n`;\n\nconst PalletHeaderToggle = styled.button`\n display: flex;\n align-items: center;\n gap: 8px;\n flex: 1;\n padding: 0;\n border: none;\n background: transparent;\n cursor: pointer;\n text-align: left;\n font: inherit;\n color: inherit;\n\n &:disabled {\n cursor: default;\n opacity: 1;\n }\n\n .title {\n display: flex;\n align-items: center;\n gap: 6px;\n text-transform: uppercase;\n letter-spacing: 0.3px;\n\n strong {\n font-weight: 700;\n text-transform: none;\n letter-spacing: 0;\n }\n }\n\n .count {\n color: #6a7378;\n font-weight: 400;\n }\n\n .selected {\n color: #0099ff;\n font-weight: 600;\n font-size: 12px;\n }\n`;\n\nconst Chevron = styled.span<{ $isExpanded: boolean }>`\n display: inline-flex;\n align-items: center;\n transition: transform 0.15s ease-in-out;\n transform: rotate(${props => (props.$isExpanded ? '0deg' : '-90deg')});\n`;\n\nconst ToggleGlyph = styled.span`\n margin-left: auto;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n border: 1px solid #cbd5e1;\n border-radius: 4px;\n background: #fff;\n font-size: 14px;\n line-height: 1;\n color: #475569;\n`;\n\nexport default SplitOrderTable;\n"],"names":["COLUMN_COUNT","SplitOrderTable","orderProductDetails","useReturnProductDetails","loading","useLoading","selectedSplits","setSelectedSplit","useSelectedSplit","selectAll","setSelectAll","useState","payload","setPayload","useSplitOrderPayload","selectedIds","useMemo","order","palletGroups","groupProductsByPallet","isGrouped","hasAnyPallet","expandedPallets","setExpandedPallets","isGroupExpanded","group","togglePallet","key","prev","applySelection","ids","id","handleSelectAll","isChecked","handleSelectedSplitList","prevSelectedOrder","updatedSelection","toggleGroupSelection","allSelected","groupIds","item","toggleGroupSelectionIds","useEffect","renderProductRow","product","jsxs","jsx","Checkbox","selectedOrder","renderPalletGroup","expanded","selectedInGroup","allSelectedInGroup","itemLabel","React","PalletHeaderRow","PalletHeaderBar","PalletHeaderToggle","Chevron","ChevronDownIcon","Fragment","ToggleGlyph","StyledTableWrapper","StyledTable","Skeleton","EmptyDataContainer","Empty","styled","props"],"mappings":";;;;;;;;;;;AAqBA,MAAMA,IAAe;AAErB,SAASC,KAAkB;AAKzB,QAAM,CAACC,CAAmB,IAAIC,EAAA,GACxB,CAACC,CAAO,IAAIC,EAAA,GACZ,CAACC,GAAgBC,CAAgB,IAAIC,EAAA,GACrC,CAACC,GAAWC,CAAY,IAAIC,EAAS,EAAK,GAC1C,CAACC,GAASC,CAAU,IAAIC,EAAA,GAExBC,IAAcC;AAAA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AAA;AAAA,GA4C5BT,IAAUS,EAAO;AAAA;AAAA;AAAA;AAAA,sBAID,CAAAC,MAAUA,EAAM,cAAc,SAAS,QAAS;AAAA,GAGhEP,KAAcM,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
1
+ {"version":3,"file":"SplitOrderTable.js","sources":["../../../../../../src/components/order-view/order-actions/actions/split-order/SplitOrderTable.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react';\nimport { useReturnProductDetails } from '../../../store';\n\nimport { Empty, Skeleton } from 'antd';\nimport { Checkbox, toReverseDeliveryLabel } from '@bjsdistribution/dms-component-library';\nimport { useLoading } from '../../../../order-daily-overview/store/store';\nimport { useSelectedSplit, useSplitOrderPayload } from '../../store';\nimport {\n EmptyDataContainer,\n StyledTable,\n StyledTableWrapper,\n} from '../confirm-order/tables/ReminderStyles';\nimport { useClientPortal } from '../../../../store';\nimport styled from 'styled-components';\nimport ChevronDownIcon from '../../../../../assets/icons/ChevronDownIcon';\nimport {\n groupProductsByPallet,\n hasAnyPallet,\n PalletGroup,\n toggleGroupSelectionIds,\n} from '../../../return-client-products/product-table/palletGrouping';\n\nconst COLUMN_COUNT = 7;\n\nfunction SplitOrderTable() {\n /**\n * Reads the return-products atom rather than the shared `productDetails` one:\n * this modal splits a return order, and only that payload carries pallet data.\n */\n const [orderProductDetails] = useReturnProductDetails();\n const [loading] = useLoading();\n const [selectedSplits, setSelectedSplit] = useSelectedSplit();\n const [selectAll, setSelectAll] = useState(false);\n const [payload, setPayload] = useSplitOrderPayload();\n const [isClientPortal] = useClientPortal();\n\n const selectedIds = useMemo(\n () => (selectedSplits ?? []).map((order: any) => order?.id),\n [selectedSplits]\n );\n\n const palletGroups = useMemo(\n () => groupProductsByPallet(orderProductDetails),\n [orderProductDetails]\n );\n\n /** Return orders picked before pallet scanning keep the original flat list. */\n const isGrouped = useMemo(() => hasAnyPallet(orderProductDetails), [\n orderProductDetails,\n ]);\n\n /** Pallet groups start collapsed; the No Pallet ID group is always open. */\n const [expandedPallets, setExpandedPallets] = useState<\n Record<string, boolean>\n >({});\n\n const isGroupExpanded = (group: PalletGroup) =>\n group.isNoPallet || !!expandedPallets[group.key];\n\n const togglePallet = (key: string) =>\n setExpandedPallets(prev => ({ ...prev, [key]: !prev[key] }));\n\n const applySelection = (ids: any[]) => {\n setSelectedSplit(ids.map((id: any) => ({ id })));\n setSelectAll(ids.length === orderProductDetails?.length);\n };\n\n // Handle Select All\n const handleSelectAll = (e: any) => {\n const isChecked = e.target.checked;\n setSelectAll(isChecked);\n\n if (isChecked) {\n setSelectedSplit(\n orderProductDetails?.map((order: any) => ({ id: order.id }))\n );\n } else {\n setSelectedSplit([]);\n }\n };\n\n const handleSelectedSplitList = (id: any) => {\n setSelectedSplit((prevSelectedOrder: any) => {\n const isSelected = prevSelectedOrder?.some(\n (order: any) => order.id === id\n );\n\n const updatedSelection = isSelected\n ? prevSelectedOrder?.filter((order: any) => order.id !== id)\n : [...prevSelectedOrder, { id }];\n\n setSelectAll(updatedSelection?.length === orderProductDetails?.length);\n\n return updatedSelection;\n });\n };\n\n /** Selecting a whole pallet is a shortcut for ticking each of its rows. */\n const toggleGroupSelection = (group: PalletGroup, allSelected: boolean) => {\n const groupIds = group.items.map((item: any) => item?.id);\n applySelection(toggleGroupSelectionIds(selectedIds, groupIds, allSelected));\n };\n\n useEffect(() => {\n setPayload({\n ...payload,\n return_order: 1, // FOR SPLIT ORDER WE ARE ASKED TO SET THIS AS 1\n products: selectedSplits?.map((order: any) => order.id),\n force: true,\n });\n }, [selectedSplits, setPayload]);\n\n const renderProductRow = (product: any) => (\n <tr key={product.id}>\n <td style={{ position: 'relative' }}>\n <Checkbox\n checked={selectedSplits?.some(\n (selectedOrder: any) => selectedOrder.id === product.id\n )}\n onChange={() => handleSelectedSplitList(product.id)}\n />\n </td>\n <td>{isClientPortal\n ? product?.order_product_type?.type\n : toReverseDeliveryLabel(product?.order_product_type?.type)}</td>\n <td>{product?.code}</td>\n <td>{product?.description}</td>\n <td>{product?.description}</td>\n <td>{product?.description}</td>\n <td>{product?.sku}</td>\n </tr>\n );\n\n const renderPalletGroup = (group: PalletGroup) => {\n const expanded = isGroupExpanded(group);\n const selectedInGroup = group.items.filter((item: any) =>\n selectedIds.includes(item?.id)\n ).length;\n const allSelectedInGroup =\n group.items.length > 0 && selectedInGroup === group.items.length;\n const itemLabel = `${group.items.length} ${group.items.length === 1 ? 'item' : 'items'\n }`;\n\n return (\n <React.Fragment key={group.key}>\n <PalletHeaderRow>\n <td colSpan={COLUMN_COUNT}>\n <div className={group.isNoPallet ? 'no-pallet-divider' : undefined}>\n <PalletHeaderBar>\n <Checkbox\n checked={allSelectedInGroup}\n onChange={() => toggleGroupSelection(group, allSelectedInGroup)}\n aria-label={\n group.isNoPallet\n ? 'Select all items with no pallet ID'\n : `Select whole pallet ${group.label}`\n }\n />\n\n <PalletHeaderToggle\n type=\"button\"\n disabled={group.isNoPallet}\n onClick={\n group.isNoPallet ? undefined : () => togglePallet(group.key)\n }\n aria-expanded={group.isNoPallet ? undefined : expanded}\n >\n {!group.isNoPallet && (\n <Chevron $isExpanded={expanded}>\n <ChevronDownIcon />\n </Chevron>\n )}\n\n <span className=\"title\">\n {group.isNoPallet ? (\n <span>No Pallet ID</span>\n ) : (\n <>\n <span>Pallet ID:</span>\n <strong>{group.label}</strong>\n </>\n )}\n </span>\n\n <span className=\"count\">({itemLabel})</span>\n\n {selectedInGroup > 0 && (\n <span className=\"selected\">{selectedInGroup} selected</span>\n )}\n\n {!group.isNoPallet && (\n <ToggleGlyph aria-hidden=\"true\">\n {expanded ? '−' : '+'}\n </ToggleGlyph>\n )}\n </PalletHeaderToggle>\n </PalletHeaderBar>\n </div>\n </td>\n </PalletHeaderRow>\n\n {expanded && group.items.map(renderProductRow)}\n </React.Fragment>\n );\n };\n\n return (\n <>\n <StyledTableWrapper id=\"tableScrolling\">\n <StyledTable>\n <thead>\n <tr>\n <th style={{ position: 'relative' }}>\n <Checkbox\n checked={selectAll}\n onChange={handleSelectAll}\n disabled={\n orderProductDetails?.length === 0 ||\n orderProductDetails?.length === null\n }\n />\n </th>\n <th>Type</th>\n <th>Code</th>\n <th>Scan</th>\n <th>Description</th>\n <th>Delivery Instructions</th>\n <th>Barcode</th>\n </tr>\n </thead>\n <tbody>\n {loading ? (\n <tr>\n <td colSpan={6}>\n <Skeleton active />\n </td>\n <td colSpan={6}></td>\n </tr>\n ) : orderProductDetails?.length === 0 ? (\n <tr>\n <td className=\"emptyTd\" colSpan={COLUMN_COUNT}>\n <EmptyDataContainer>\n <Empty description=\"No Data Found\" />\n </EmptyDataContainer>\n </td>\n </tr>\n ) : isGrouped ? (\n palletGroups.map(renderPalletGroup)\n ) : (\n orderProductDetails?.length > 0 &&\n orderProductDetails?.map((product: any) =>\n renderProductRow(product)\n )\n )}\n </tbody>\n </StyledTable>\n </StyledTableWrapper>\n </>\n );\n}\n\nconst PalletHeaderRow = styled.tr`\n && > td {\n padding: 4px 0;\n background: transparent;\n border: none;\n border-radius: 0;\n }\n\n /*\n Divider separating the No Pallet ID group from the palletised groups. Applied\n to an inner wrapper rather than the td, because the rule above resets cell\n borders at && specificity and would win over a border on the td itself.\n */\n && .no-pallet-divider {\n border-top: 1px solid #c9c6c1;\n padding-top: 10px;\n margin-top: 4px;\n }\n`;\n\nconst PalletHeaderBar = styled.div`\n /*\n Required. The library Checkbox renders its real <input> as position:absolute\n with no offsets, so it needs a positioned ancestor here — otherwise its\n containing block resolves outside this scrolling modal, the invisible input\n stops scrolling with the visible box, and clicks land on another pallet's\n checkbox. Same reason the product cells set position:relative inline.\n */\n position: relative;\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n padding: 8px 12px;\n border: 1px solid #e2e0db;\n border-radius: 6px;\n background: #f1f5f9;\n font-family: 'Roboto', sans-serif;\n font-size: 13px;\n font-weight: 500;\n color: #3a3630;\n\n`;\n\nconst PalletHeaderToggle = styled.button`\n display: flex;\n align-items: center;\n gap: 8px;\n flex: 1;\n padding: 0;\n border: none;\n background: transparent;\n cursor: pointer;\n text-align: left;\n font: inherit;\n color: inherit;\n\n &:disabled {\n cursor: default;\n opacity: 1;\n }\n\n .title {\n display: flex;\n align-items: center;\n gap: 6px;\n text-transform: uppercase;\n letter-spacing: 0.3px;\n\n strong {\n font-weight: 700;\n text-transform: none;\n letter-spacing: 0;\n }\n }\n\n .count {\n color: #6a7378;\n font-weight: 400;\n }\n\n .selected {\n color: #0099ff;\n font-weight: 600;\n font-size: 12px;\n }\n`;\n\nconst Chevron = styled.span<{ $isExpanded: boolean }>`\n display: inline-flex;\n align-items: center;\n transition: transform 0.15s ease-in-out;\n transform: rotate(${props => (props.$isExpanded ? '0deg' : '-90deg')});\n`;\n\nconst ToggleGlyph = styled.span`\n margin-left: auto;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n border: 1px solid #cbd5e1;\n border-radius: 4px;\n background: #fff;\n font-size: 14px;\n line-height: 1;\n color: #475569;\n`;\n\nexport default SplitOrderTable;\n"],"names":["COLUMN_COUNT","SplitOrderTable","orderProductDetails","useReturnProductDetails","loading","useLoading","selectedSplits","setSelectedSplit","useSelectedSplit","selectAll","setSelectAll","useState","payload","setPayload","useSplitOrderPayload","isClientPortal","useClientPortal","selectedIds","useMemo","order","palletGroups","groupProductsByPallet","isGrouped","hasAnyPallet","expandedPallets","setExpandedPallets","isGroupExpanded","group","togglePallet","key","prev","applySelection","ids","id","handleSelectAll","isChecked","handleSelectedSplitList","prevSelectedOrder","updatedSelection","toggleGroupSelection","allSelected","groupIds","item","toggleGroupSelectionIds","useEffect","renderProductRow","product","jsxs","jsx","Checkbox","selectedOrder","toReverseDeliveryLabel","renderPalletGroup","expanded","selectedInGroup","allSelectedInGroup","itemLabel","React","PalletHeaderRow","PalletHeaderBar","PalletHeaderToggle","Chevron","ChevronDownIcon","Fragment","ToggleGlyph","StyledTableWrapper","StyledTable","Sk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A;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAwBzBV,KAAqBU,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GA4C5BT,KAAUS,EAAO;AAAA;AAAA;AAAA;AAAA,sBAID,CAAAC,MAAUA,EAAM,cAAc,SAAS,QAAS;AAAA,GAGhEP,KAAcM,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
@@ -1,39 +1,41 @@
1
- import { jsx as e, jsxs as o, Fragment as g } from "react/jsx-runtime";
2
- import { useCancelOrderProducts as y, useOrderStaticData as v } from "../../../store.js";
3
- import { useLoading as w } from "../../../../order-daily-overview/store/store.js";
4
- import { Select as _, Skeleton as S, Empty as O } from "antd";
5
- import R from "../../Dropdown.js";
1
+ import { jsx as e, jsxs as o, Fragment as y } from "react/jsx-runtime";
2
+ import { useCancelOrderProducts as v, useOrderStaticData as w } from "../../../store.js";
3
+ import { useLoading as _ } from "../../../../order-daily-overview/store/store.js";
4
+ import { Select as S, Skeleton as O, Empty as R } from "antd";
5
+ import C from "../../Dropdown.js";
6
6
  import l from "styled-components";
7
- import { EmptyDataContainer as C } from "../confirm-order/tables/ReminderStyles.js";
8
- import b from "../../../../../assets/icons/DeliverProductIcon.js";
9
- import s from "../../../../../assets/icons/ReturnProductIcon.js";
10
- const D = [
7
+ import { EmptyDataContainer as D } from "../confirm-order/tables/ReminderStyles.js";
8
+ import x from "../../../../../assets/icons/DeliverProductIcon.js";
9
+ import c from "../../../../../assets/icons/ReturnProductIcon.js";
10
+ import { useClientPortal as T } from "../../../../store.js";
11
+ import { toReverseDeliveryLabel as k } from "@bjsdistribution/dms-component-library";
12
+ const P = [
11
13
  {
12
14
  label: "Deliver",
13
15
  value: "deliver",
14
- icon: /* @__PURE__ */ e(b, {})
16
+ icon: /* @__PURE__ */ e(x, {})
15
17
  },
16
18
  {
17
19
  label: "Return",
18
20
  value: "return",
19
- icon: /* @__PURE__ */ e(s, {})
21
+ icon: /* @__PURE__ */ e(c, {})
20
22
  }
21
- ], T = [
23
+ ], I = [
22
24
  {
23
25
  label: "Return",
24
26
  value: "return",
25
- icon: /* @__PURE__ */ e(s, {})
27
+ icon: /* @__PURE__ */ e(c, {})
26
28
  }
27
- ], Y = () => {
29
+ ], M = () => {
28
30
  const [
29
31
  d,
30
32
  f
31
- ] = y(), [m] = w(), [p] = v();
33
+ ] = v(), [m] = _(), [p] = w(), [g] = T();
32
34
  if (!d?.length)
33
35
  return null;
34
36
  const h = p?.return_reasons?.map(
35
37
  (r) => ({
36
- label: r?.reason,
38
+ label: g ? r?.reason : k(r?.reason),
37
39
  value: r?.reason
38
40
  })
39
41
  ), u = p?.order_product_return_action?.map(
@@ -44,14 +46,14 @@ const D = [
44
46
  ), a = (r, n, i) => {
45
47
  console.log(r, n, i);
46
48
  const t = d?.map(
47
- (c) => c.order_product_id === n ? {
48
- ...c,
49
+ (s) => s.order_product_id === n ? {
50
+ ...s,
49
51
  [i]: r
50
- } : c
52
+ } : s
51
53
  );
52
54
  f(t);
53
55
  };
54
- return /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(I, { children: /* @__PURE__ */ o(P, { className: "scrollClass", children: [
56
+ return /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ o(N, { className: "scrollClass", children: [
55
57
  /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ o("tr", { children: [
56
58
  /* @__PURE__ */ e("th", { children: "Status" }),
57
59
  /* @__PURE__ */ e("th", { children: "Original Type" }),
@@ -59,8 +61,8 @@ const D = [
59
61
  /* @__PURE__ */ e("th", { children: "Description" }),
60
62
  /* @__PURE__ */ e("th", { children: "SKU" })
61
63
  ] }) }),
62
- /* @__PURE__ */ e("tbody", { children: m ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 5, children: /* @__PURE__ */ e(S, { active: !0 }) }) }) : d?.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { className: "emptyTd", colSpan: 5, children: /* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(O, {}) }) }) }) : d?.map((r) => {
63
- const n = r?.product_type === "deliver" ? D : T, i = r?.action === "return";
64
+ /* @__PURE__ */ e("tbody", { children: m ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 5, children: /* @__PURE__ */ e(O, { active: !0 }) }) }) : d?.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { className: "emptyTd", colSpan: 5, children: /* @__PURE__ */ e(D, { children: /* @__PURE__ */ e(R, {}) }) }) }) : d?.map((r) => {
65
+ const n = r?.product_type === "deliver" ? P : I, i = r?.action === "return";
64
66
  return /* @__PURE__ */ e(
65
67
  "tr",
66
68
  {
@@ -70,7 +72,7 @@ const D = [
70
72
  children: /* @__PURE__ */ e("td", { colSpan: 5, children: /* @__PURE__ */ e("table", { style: { width: "100%" }, children: /* @__PURE__ */ o("tbody", { children: [
71
73
  /* @__PURE__ */ o("tr", { children: [
72
74
  /* @__PURE__ */ e("td", { style: { width: "20%" }, children: /* @__PURE__ */ e(
73
- k,
75
+ A,
74
76
  {
75
77
  options: n,
76
78
  placeholder: "Select",
@@ -79,7 +81,7 @@ const D = [
79
81
  r?.order_product_id,
80
82
  "action"
81
83
  ),
82
- prefix: r?.action === "deliver" ? /* @__PURE__ */ e(b, {}) : r?.action === "return" ? /* @__PURE__ */ e(s, {}) : /* @__PURE__ */ e(g, {}),
84
+ prefix: r?.action === "deliver" ? /* @__PURE__ */ e(x, {}) : r?.action === "return" ? /* @__PURE__ */ e(c, {}) : /* @__PURE__ */ e(y, {}),
83
85
  style: { width: "100%" },
84
86
  value: n?.filter(
85
87
  (t) => t?.value === r?.action
@@ -112,9 +114,9 @@ const D = [
112
114
  /* @__PURE__ */ e("td", { style: { width: "20%" }, children: r?.description }),
113
115
  /* @__PURE__ */ e("td", { style: { width: "20%" }, children: r?.sku })
114
116
  ] }),
115
- i && /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 5, children: /* @__PURE__ */ o(A, { children: [
117
+ i && /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 5, children: /* @__PURE__ */ o(j, { children: [
116
118
  /* @__PURE__ */ e(
117
- x,
119
+ b,
118
120
  {
119
121
  label: "Return Action",
120
122
  required: !0,
@@ -131,7 +133,7 @@ const D = [
131
133
  }
132
134
  ),
133
135
  /* @__PURE__ */ e(
134
- x,
136
+ b,
135
137
  {
136
138
  label: "Return Reason",
137
139
  required: !0,
@@ -154,7 +156,7 @@ const D = [
154
156
  );
155
157
  }) })
156
158
  ] }) }) });
157
- }, k = l(_)`
159
+ }, A = l(S)`
158
160
  .ant-select-selector {
159
161
  border-radius: 25px !important;
160
162
  /* border: none !important; */
@@ -172,16 +174,16 @@ const D = [
172
174
  font-weight: 400;
173
175
  font-size: 13px;
174
176
  }
175
- `, I = l.div`
177
+ `, L = l.div`
176
178
  width: 100%;
177
179
  overflow-x: auto;
178
180
  background-color: #fff;
179
181
  border-radius: 12px;
180
182
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
181
183
  padding: 16px;
182
- `, x = l(R)`
184
+ `, b = l(C)`
183
185
  flex: 1;
184
- `, P = l.table`
186
+ `, N = l.table`
185
187
  width: 100%;
186
188
  font-size: 14px;
187
189
  color: #333;
@@ -246,7 +248,7 @@ const D = [
246
248
  background: transparent;
247
249
  padding: 8px 12px;
248
250
  }
249
- `, A = l.div`
251
+ `, j = l.div`
250
252
  display: flex;
251
253
  flex-direction: row;
252
254
  gap: 12px;
@@ -254,8 +256,8 @@ const D = [
254
256
  width: 100%;
255
257
  `;
256
258
  export {
257
- P as StyledTable,
258
- I as StyledTableWrapper,
259
- Y as default
259
+ N as StyledTable,
260
+ L as StyledTableWrapper,
261
+ M as default
260
262
  };
261
263
  //# sourceMappingURL=UncancelOrderTable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UncancelOrderTable.js","sources":["../../../../../../src/components/order-view/order-actions/actions/uncancel-order/UncancelOrderTable.tsx"],"sourcesContent":["import React from 'react';\nimport { useCancelOrderProducts, useOrderStaticData } from '../../../store';\nimport { useLoading } from '../../../../order-daily-overview/store/store';\nimport { Empty, Select, Skeleton } from 'antd';\nimport { CancelOrderProductsType } from '../../../types';\nimport OrderActionsDropdown from '../../Dropdown';\nimport styled from 'styled-components';\nimport { EmptyDataContainer } from '../confirm-order/tables/ReminderStyles';\nimport DeliverProductIcon from '../../../../../assets/icons/DeliverProductIcon';\nimport ReturnProductIcon from '../../../../../assets/icons/ReturnProductIcon';\n\nconst deliverTypeOptions = [\n {\n label: 'Deliver',\n value: 'deliver',\n icon: <DeliverProductIcon />,\n },\n {\n label: 'Return',\n value: 'return',\n icon: <ReturnProductIcon />,\n },\n];\n\nconst collectTypeOptions = [\n {\n label: 'Return',\n value: 'return',\n icon: <ReturnProductIcon />,\n },\n];\n\nconst UnCancelOrderTable = () => {\n const [\n cancelOrderProducts,\n setCancelOrderProducts,\n ] = useCancelOrderProducts();\n\n const [loading] = useLoading();\n const [orderStaticData] = useOrderStaticData();\n\n if (!cancelOrderProducts?.length) {\n return null;\n }\n\n const returnReasonsOptions = orderStaticData?.return_reasons?.map(\n (option: any) => ({\n label: option?.reason,\n value: option?.reason,\n })\n );\n\n const returnActionOptions = orderStaticData?.order_product_return_action?.map(\n (option: any) => ({\n label: option?.value,\n value: option?.value,\n })\n );\n\n const onChange = (\n selectedVal: string,\n id: number,\n type: keyof CancelOrderProductsType\n ) => {\n console.log(selectedVal, id, type);\n const updatedList = cancelOrderProducts?.map(\n (item: CancelOrderProductsType) => {\n const newItem =\n item.order_product_id === id\n ? {\n ...item,\n [type]: selectedVal,\n }\n : item;\n return newItem;\n }\n );\n setCancelOrderProducts(updatedList);\n };\n\n return (\n <div>\n <StyledTableWrapper>\n <StyledTable className=\"scrollClass\">\n <thead>\n <tr>\n <th>Status</th>\n <th>Original Type</th>\n <th>Code</th>\n <th>Description</th>\n <th>SKU</th>\n </tr>\n </thead>\n <tbody>\n {loading ? (\n <tr>\n <td colSpan={5}>\n <Skeleton active />\n </td>\n </tr>\n ) : cancelOrderProducts?.length === 0 ? (\n <tr>\n <td className=\"emptyTd\" colSpan={5}>\n <EmptyDataContainer>\n <Empty />\n </EmptyDataContainer>\n </td>\n </tr>\n ) : (\n cancelOrderProducts?.map((product: CancelOrderProductsType) => {\n const dropdownOptions =\n product?.product_type === 'deliver'\n ? deliverTypeOptions\n : collectTypeOptions;\n\n const isReturn = product?.action === 'return';\n\n return (\n <tr\n key={product?.order_product_id}\n style={{\n boxShadow: '0px 1px 3px 0px rgba(16, 24, 40, 0.1)',\n }}\n >\n <td colSpan={5}>\n <table style={{ width: '100%' }}>\n <tbody>\n <tr>\n <td style={{ width: '20%' }}>\n <CustomSelectDropdown\n options={dropdownOptions}\n placeholder=\"Select\"\n onChange={(val: any) =>\n onChange(\n val,\n product?.order_product_id!,\n 'action'\n )\n }\n prefix={\n product?.action === 'deliver' ? (\n <DeliverProductIcon />\n ) : product?.action === 'return' ? (\n <ReturnProductIcon />\n ) : (\n <></>\n )\n }\n style={{ width: '100%' }}\n // popupClassName={'dropDownStyle'}\n // selectWrapperClass={'rounded'}\n value={dropdownOptions?.filter(\n (item: any) => item?.value === product?.action\n )}\n optionRender={(option: any) => (\n <div\n style={{\n display: 'flex',\n gap: '8px',\n alignItems: 'center',\n }}\n >\n <span\n style={{ display: 'flex' }}\n aria-label={option.data.label}\n >\n {option.data.icon}\n </span>\n <span style={{ color: '#8D8F90' }}>\n {option.data.label}\n </span>\n </div>\n )}\n />\n </td>\n <td style={{ width: '20%' }}>\n {product?.previous_product_type === null\n ? 'N/A'\n : product?.previous_product_type}\n </td>\n <td style={{ width: '20%' }}>{product?.code}</td>\n <td style={{ width: '20%' }}>\n {product?.description}\n </td>\n <td style={{ width: '20%' }}>{product?.sku}</td>\n </tr>\n\n {isReturn && (\n <tr>\n <td colSpan={5}>\n <ReturnRowWrapper>\n <StyledDropdown\n label=\"Return Action\"\n required\n placeholder=\"Select action\"\n options={returnActionOptions}\n onSelect={(val: any) =>\n onChange(\n val,\n product?.order_product_id!,\n 'return_action'\n )\n }\n value={returnActionOptions?.filter(\n (option: any) =>\n option.value === product?.return_action\n )}\n />\n <StyledDropdown\n label=\"Return Reason\"\n required\n placeholder=\"Select reason\"\n options={returnReasonsOptions}\n onSelect={(val: any) =>\n onChange(\n val,\n product?.order_product_id!,\n 'return_reason'\n )\n }\n value={returnReasonsOptions?.filter(\n (option: any) =>\n option.value === product?.return_reason\n )}\n />\n </ReturnRowWrapper>\n </td>\n </tr>\n )}\n </tbody>\n </table>\n </td>\n </tr>\n );\n })\n )}\n </tbody>\n </StyledTable>\n </StyledTableWrapper>\n </div>\n );\n};\n\nconst CustomSelectDropdown: any = styled(Select)`\n .ant-select-selector {\n border-radius: 25px !important;\n /* border: none !important; */\n min-width: 100px;\n padding: 0 10px;\n display: flex;\n gap: 8px;\n align-items: center !important;\n\n .ant-select-prefix {\n margin-top: 4px;\n }\n }\n .ant-select-selection-item {\n font-weight: 400;\n font-size: 13px;\n }\n`;\n\nexport const StyledTableWrapper = styled.div`\n width: 100%;\n overflow-x: auto;\n background-color: #fff;\n border-radius: 12px;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);\n padding: 16px;\n`;\n\nconst StyledDropdown = styled(OrderActionsDropdown)`\n flex: 1;\n`;\n\nexport const StyledTable = styled.table`\n width: 100%;\n font-size: 14px;\n color: #333;\n border-spacing: 0 10px;\n\n th,\n td {\n padding: 12px 16px;\n background: #fff;\n }\n\n th {\n background: #f0f2f2;\n\n &:first-child {\n border-top-left-radius: 40px;\n border-bottom-left-radius: 40px;\n }\n\n &:last-child {\n border-top-right-radius: 40px;\n border-bottom-right-radius: 40px;\n }\n }\n\n // This affects ONLY top-level rows\n > tbody > tr {\n background: #fff;\n border-radius: 40px;\n box-shadow: 0px 1px 3px rgba(16, 24, 40, 0.1);\n }\n\n // Round the outer row's corners only on first/last td\n > tbody > tr > td:first-child {\n border-top-left-radius: 40px;\n border-bottom-left-radius: 40px;\n }\n\n > tbody > tr > td:last-child {\n border-top-right-radius: 40px;\n border-bottom-right-radius: 40px;\n }\n\n .scrollClass {\n overflow-x: auto;\n }\n\n .emptyTd {\n text-align: center;\n padding: 40px 0;\n color: #999;\n background: transparent;\n box-shadow: none;\n }\n\n td table {\n border-spacing: 0;\n width: 100%;\n }\n\n td table td {\n background: transparent;\n padding: 8px 12px;\n }\n`;\n\nconst ReturnRowWrapper = styled.div`\n display: flex;\n flex-direction: row;\n gap: 12px;\n padding: 0 12px;\n width: 100%;\n`;\n\nexport default UnCancelOrderTable;\n"],"names":["deliverTypeOptions","DeliverProductIcon","ReturnProductIcon","collectTypeOptions","UnCancelOrderTable","cancelOrderProducts","setCancelOrderProducts","useCancelOrderProducts","loading","useLoading","orderStaticData","useOrderStaticData","returnReasonsOptions","option","returnActionOptions","onChange","selectedVal","id","type","updatedList","item","jsx","StyledTableWrapper","jsxs","StyledTable","Skeleton","EmptyDataContainer","Empty","product","dropdownOptions","isReturn","CustomSelectDropdown","val","Fragment","ReturnRowWrapper","StyledDropdown","styled","Select","OrderActionsDropdown"],"mappings":";;;;;;;;;AAWA,MAAMA,IAAqB;AAAA,EACzB;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,wBAAOC,GAAA,CAAA,CAAmB;AAAA,EAAA;AAAA,EAE5B;AAAA,IACE,OAAO;AAA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A;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAmE5BF,IAAmBE,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
1
+ {"version":3,"file":"UncancelOrderTable.js","sources":["../../../../../../src/components/order-view/order-actions/actions/uncancel-order/UncancelOrderTable.tsx"],"sourcesContent":["import React from 'react';\nimport { useCancelOrderProducts, useOrderStaticData } from '../../../store';\nimport { useLoading } from '../../../../order-daily-overview/store/store';\nimport { Empty, Select, Skeleton } from 'antd';\nimport { CancelOrderProductsType } from '../../../types';\nimport OrderActionsDropdown from '../../Dropdown';\nimport styled from 'styled-components';\nimport { EmptyDataContainer } from '../confirm-order/tables/ReminderStyles';\nimport DeliverProductIcon from '../../../../../assets/icons/DeliverProductIcon';\nimport ReturnProductIcon from '../../../../../assets/icons/ReturnProductIcon';\nimport { useClientPortal } from '../../../../store';\nimport { toReverseDeliveryLabel } from '@bjsdistribution/dms-component-library';\n\nconst deliverTypeOptions = [\n {\n label: 'Deliver',\n value: 'deliver',\n icon: <DeliverProductIcon />,\n },\n {\n label: 'Return',\n value: 'return',\n icon: <ReturnProductIcon />,\n },\n];\n\nconst collectTypeOptions = [\n {\n label: 'Return',\n value: 'return',\n icon: <ReturnProductIcon />,\n },\n];\n\nconst UnCancelOrderTable = () => {\n const [\n cancelOrderProducts,\n setCancelOrderProducts,\n ] = useCancelOrderProducts();\n\n const [loading] = useLoading();\n const [orderStaticData] = useOrderStaticData();\n const [isClientPortal] = useClientPortal();\n\n if (!cancelOrderProducts?.length) {\n return null;\n }\n\n const returnReasonsOptions = orderStaticData?.return_reasons?.map(\n (option: any) => ({\n label: isClientPortal\n ? option?.reason\n : toReverseDeliveryLabel(option?.reason),\n value: option?.reason,\n })\n );\n\n const returnActionOptions = orderStaticData?.order_product_return_action?.map(\n (option: any) => ({\n label: option?.value,\n value: option?.value,\n })\n );\n\n const onChange = (\n selectedVal: string,\n id: number,\n type: keyof CancelOrderProductsType\n ) => {\n console.log(selectedVal, id, type);\n const updatedList = cancelOrderProducts?.map(\n (item: CancelOrderProductsType) => {\n const newItem =\n item.order_product_id === id\n ? {\n ...item,\n [type]: selectedVal,\n }\n : item;\n return newItem;\n }\n );\n setCancelOrderProducts(updatedList);\n };\n\n return (\n <div>\n <StyledTableWrapper>\n <StyledTable className=\"scrollClass\">\n <thead>\n <tr>\n <th>Status</th>\n <th>Original Type</th>\n <th>Code</th>\n <th>Description</th>\n <th>SKU</th>\n </tr>\n </thead>\n <tbody>\n {loading ? (\n <tr>\n <td colSpan={5}>\n <Skeleton active />\n </td>\n </tr>\n ) : cancelOrderProducts?.length === 0 ? (\n <tr>\n <td className=\"emptyTd\" colSpan={5}>\n <EmptyDataContainer>\n <Empty />\n </EmptyDataContainer>\n </td>\n </tr>\n ) : (\n cancelOrderProducts?.map((product: CancelOrderProductsType) => {\n const dropdownOptions =\n product?.product_type === 'deliver'\n ? deliverTypeOptions\n : collectTypeOptions;\n\n const isReturn = product?.action === 'return';\n\n return (\n <tr\n key={product?.order_product_id}\n style={{\n boxShadow: '0px 1px 3px 0px rgba(16, 24, 40, 0.1)',\n }}\n >\n <td colSpan={5}>\n <table style={{ width: '100%' }}>\n <tbody>\n <tr>\n <td style={{ width: '20%' }}>\n <CustomSelectDropdown\n options={dropdownOptions}\n placeholder=\"Select\"\n onChange={(val: any) =>\n onChange(\n val,\n product?.order_product_id!,\n 'action'\n )\n }\n prefix={\n product?.action === 'deliver' ? (\n <DeliverProductIcon />\n ) : product?.action === 'return' ? (\n <ReturnProductIcon />\n ) : (\n <></>\n )\n }\n style={{ width: '100%' }}\n // popupClassName={'dropDownStyle'}\n // selectWrapperClass={'rounded'}\n value={dropdownOptions?.filter(\n (item: any) => item?.value === product?.action\n )}\n optionRender={(option: any) => (\n <div\n style={{\n display: 'flex',\n gap: '8px',\n alignItems: 'center',\n }}\n >\n <span\n style={{ display: 'flex' }}\n aria-label={option.data.label}\n >\n {option.data.icon}\n </span>\n <span style={{ color: '#8D8F90' }}>\n {option.data.label}\n </span>\n </div>\n )}\n />\n </td>\n <td style={{ width: '20%' }}>\n {product?.previous_product_type === null\n ? 'N/A'\n : product?.previous_product_type}\n </td>\n <td style={{ width: '20%' }}>{product?.code}</td>\n <td style={{ width: '20%' }}>\n {product?.description}\n </td>\n <td style={{ width: '20%' }}>{product?.sku}</td>\n </tr>\n\n {isReturn && (\n <tr>\n <td colSpan={5}>\n <ReturnRowWrapper>\n <StyledDropdown\n label=\"Return Action\"\n required\n placeholder=\"Select action\"\n options={returnActionOptions}\n onSelect={(val: any) =>\n onChange(\n val,\n product?.order_product_id!,\n 'return_action'\n )\n }\n value={returnActionOptions?.filter(\n (option: any) =>\n option.value === product?.return_action\n )}\n />\n <StyledDropdown\n label=\"Return Reason\"\n required\n placeholder=\"Select reason\"\n options={returnReasonsOptions}\n onSelect={(val: any) =>\n onChange(\n val,\n product?.order_product_id!,\n 'return_reason'\n )\n }\n value={returnReasonsOptions?.filter(\n (option: any) =>\n option.value === product?.return_reason\n )}\n />\n </ReturnRowWrapper>\n </td>\n </tr>\n )}\n </tbody>\n </table>\n </td>\n </tr>\n );\n })\n )}\n </tbody>\n </StyledTable>\n </StyledTableWrapper>\n </div>\n );\n};\n\nconst CustomSelectDropdown: any = styled(Select)`\n .ant-select-selector {\n border-radius: 25px !important;\n /* border: none !important; */\n min-width: 100px;\n padding: 0 10px;\n display: flex;\n gap: 8px;\n align-items: center !important;\n\n .ant-select-prefix {\n margin-top: 4px;\n }\n }\n .ant-select-selection-item {\n font-weight: 400;\n font-size: 13px;\n }\n`;\n\nexport const StyledTableWrapper = styled.div`\n width: 100%;\n overflow-x: auto;\n background-color: #fff;\n border-radius: 12px;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);\n padding: 16px;\n`;\n\nconst StyledDropdown = styled(OrderActionsDropdown)`\n flex: 1;\n`;\n\nexport const StyledTable = styled.table`\n width: 100%;\n font-size: 14px;\n color: #333;\n border-spacing: 0 10px;\n\n th,\n td {\n padding: 12px 16px;\n background: #fff;\n }\n\n th {\n background: #f0f2f2;\n\n &:first-child {\n border-top-left-radius: 40px;\n border-bottom-left-radius: 40px;\n }\n\n &:last-child {\n border-top-right-radius: 40px;\n border-bottom-right-radius: 40px;\n }\n }\n\n // This affects ONLY top-level rows\n > tbody > tr {\n background: #fff;\n border-radius: 40px;\n box-shadow: 0px 1px 3px rgba(16, 24, 40, 0.1);\n }\n\n // Round the outer row's corners only on first/last td\n > tbody > tr > td:first-child {\n border-top-left-radius: 40px;\n border-bottom-left-radius: 40px;\n }\n\n > tbody > tr > td:last-child {\n border-top-right-radius: 40px;\n border-bottom-right-radius: 40px;\n }\n\n .scrollClass {\n overflow-x: auto;\n }\n\n .emptyTd {\n text-align: center;\n padding: 40px 0;\n color: #999;\n background: transparent;\n box-shadow: none;\n }\n\n td table {\n border-spacing: 0;\n width: 100%;\n }\n\n td table td {\n background: transparent;\n padding: 8px 12px;\n }\n`;\n\nconst ReturnRowWrapper = styled.div`\n display: flex;\n flex-direction: row;\n gap: 12px;\n padding: 0 12px;\n width: 100%;\n`;\n\nexport default UnCancelOrderTable;\n"],"names":["deliverTypeOptions","DeliverProductIcon","ReturnProductIcon","collectTypeOptions","UnCancelOrderTable","cancelOrderProducts","setCancelOrderProducts","useCancelOrderProducts","loading","useLoading","orderStaticData","useOrderStaticData","isClientPortal","useClientPortal","returnReasonsOptions","option","toReverseDeliveryLabel","returnActionOptions","onChange","selectedVal","id","type","updatedList","item","jsx","StyledTableWrapper","jsxs","StyledTable","Skeleton","EmptyDataContainer","Empty","product","dropdownOptions","isReturn","CustomSelectDropdown","val","Fragment","ReturnRowWrapper","StyledDropdown","styled","Select","OrderActionsDropdown"],"mappings":";;;;;;;;;;;AAaA,MAAMA,IAAqB;AAAA,EACzB;AAAA,IACE,OAAO;A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AA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAmE5BF,IAAmBE,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
@@ -1,39 +1,41 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import f from "styled-components";
3
- import u from "../../../../../common/services-slider/ServiceSlider.js";
4
- import { useOrderStaticData as v, useOrderDetails as S } from "../../../store.js";
5
- function b() {
6
- const [r] = v(), [i, c] = S(), d = r?.order_service_list, o = [
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import u from "styled-components";
3
+ import v from "../../../../../common/services-slider/ServiceSlider.js";
4
+ import { useOrderStaticData as y, useOrderDetails as S } from "../../../store.js";
5
+ import { useClientPortal as x } from "../../../../store.js";
6
+ import { toReverseDeliveryLabel as D } from "@bjsdistribution/dms-component-library";
7
+ function A() {
8
+ const [r] = y(), [i, n] = S(), [c] = x(), o = r?.order_service_list, a = [
7
9
  "unpack_items",
8
10
  "take_packaging_away",
9
11
  "assemble",
10
12
  "disassemble",
11
13
  "collect_disposal"
12
- ], l = d?.sort((e, t) => o.indexOf(e.type) - o.indexOf(t.type)), p = (e) => {
13
- const a = d?.find(
14
+ ], p = o?.sort((e, t) => a.indexOf(e.type) - a.indexOf(t.type)), m = (e) => {
15
+ const d = o?.find(
14
16
  (s) => s.id === e
15
- )?.type, m = !i[a];
16
- c((s) => ({
17
+ )?.type, f = !i[d];
18
+ n((s) => ({
17
19
  ...s,
18
- [a]: m
20
+ [d]: f
19
21
  }));
20
22
  };
21
- return /* @__PURE__ */ n(x, { disabled: !0, children: l?.map((e) => {
23
+ return /* @__PURE__ */ l(O, { disabled: !0, children: p?.map((e) => {
22
24
  const t = i[e?.type];
23
- return /* @__PURE__ */ n(
24
- u,
25
+ return /* @__PURE__ */ l(
26
+ v,
25
27
  {
26
- serviceName: e?.type?.replaceAll("_", " "),
28
+ serviceName: c ? e?.type?.replaceAll("_", " ") : D(e?.type?.replaceAll("_", " ")),
27
29
  serviceId: e?.id,
28
30
  isSelected: t,
29
- toggle: p,
31
+ toggle: m,
30
32
  disabled: !0
31
33
  },
32
34
  e?.id
33
35
  );
34
36
  }) });
35
37
  }
36
- const x = f.div`
38
+ const O = u.div`
37
39
  display: flex;
38
40
  gap: 30px;
39
41
  flex: 1;
@@ -50,6 +52,6 @@ const x = f.div`
50
52
  }
51
53
  `;
52
54
  export {
53
- b as default
55
+ A as default
54
56
  };
55
57
  //# sourceMappingURL=OrderServices.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OrderServices.js","sources":["../../../../../../src/components/order-view/order-details/expanded-content/services-section/OrderServices.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nimport ServiceSlider from '../../../../../common/services-slider/ServiceSlider';\nimport {\n useOrderDetails,\n useOrderStaticData,\n} from '../../../store';\nimport { OrdersType } from '../../../types';\n\nfunction OrderServices() {\n const [orderStaticData] = useOrderStaticData();\n const [orderDetails, setOrderDetails] = useOrderDetails();\n\n const orderServicesOptions = orderStaticData?.order_service_list;\n\n const desiredOrder = [\n 'unpack_items',\n 'take_packaging_away',\n 'assemble',\n 'disassemble',\n 'collect_disposal',\n ];\n\n const sortedServices = orderServicesOptions?.sort((a: any, b: any) => {\n return desiredOrder.indexOf(a.type) - desiredOrder.indexOf(b.type);\n });\n\n const toggleServices = (id: number) => {\n const selectedService = orderServicesOptions?.find(\n (item: any) => item.id === id\n );\n const key = selectedService?.type;\n const value = !orderDetails[key as keyof OrdersType];\n setOrderDetails(prev => ({\n ...prev,\n [key]: value,\n }));\n };\n const isDisabled = true;\n\n return (\n <Container disabled={isDisabled}>\n {sortedServices?.map((service: any) => {\n const selected = orderDetails[service?.type as keyof OrdersType];\n return (\n <ServiceSlider\n serviceName={service?.type?.replaceAll('_', ' ')}\n serviceId={service?.id}\n isSelected={selected}\n toggle={toggleServices}\n key={service?.id}\n disabled={true}\n />\n );\n })}\n </Container>\n );\n}\n\nconst Container = styled.div<{ disabled: boolean }>`\n display: flex;\n gap: 30px;\n flex: 1;\n @media screen and (max-width: 1170px) {\n flex-wrap: wrap;\n\n ${({ disabled }) =>\n disabled &&\n `\n pointer-events: none;\n\n > * {\n pointer-events: none;\n }\n `}\n }\n`;\n\nexport default OrderServices;\n"],"names":["OrderServices","orderStaticData","useOrderStaticData","orderDetails","setOrderDetails","useOrderDetails","orderServicesOptions","desiredOrder","sortedServices","a","b","toggleServices","id","key","item","value","prev","Container","service","selected","jsx","ServiceSlider","styled","disabled"],"mappings":";;;;AASA,SAASA,IAAgB;AACvB,QAAM,CAACC,CAAe,IAAIC,EAAA,GACpB,CAACC,GAAcC,CAAe,IAAIC,EAAA,GAElCC,IAAuBL,GAAiB,oBAExCM,IAAe;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,GAGIC,IAAiBF,GAAsB,KAAK,CAACG,GAAQC,MAClDH,EAAa,QAAQE,EAAE,IAAI,IAAIF,EAAa,QAAQG,EAAE,IAAI,CAClE,GAEKC,IAAiB,CAACC,MAAe;AAIrC,UAAMC,IAHkBP,GAAsB;AAAA,MAC5C,CAACQ,MAAcA,EAAK,OAAOF;AAAA,IAAA,GAEA,MACvBG,IAAQ,CAACZ,EAAaU,CAAuB;AACnD,IAAAT,EAAgB,CAAAY,OAAS;AAAA,MACvB,GAAGA;AAAA,MACH,CAACH,CAAG,GAAGE;AAAA,IAAA,EACP;AAAA,EACJ;AAGA,2BACGE,GAAA,EAAU,UAHM,IAId,UAAAT,GAAgB,IAAI,CAACU,MAAiB;AACrC,UAAMC,IAAWhB,EAAae,GAAS,IAAwB;AAC/D,WACE,gBAAAE;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,aAAaH,GAAS,MAAM,WAAW,KAAK,GAAG;AAAA,QAC/C,WAAWA,GAAS;AAAA,QACpB,YAAYC;AAAA,QACZ,QAAQR;AAAA,QAER,UAAU;AAAA,MAAA;AAAA,MADLO,GAAS;AAAA,IAAA;AAAA,EAIpB,CAAC,EAAA,CACH;AAEJ;AAEA,MAAMD,IAAYK,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOnB,CAAC,EAAE,UAAAC,EAAA,MACHA,KACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAMH;AAAA;AAAA;"}
1
+ {"version":3,"file":"OrderServices.js","sources":["../../../../../../src/components/order-view/order-details/expanded-content/services-section/OrderServices.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nimport ServiceSlider from '../../../../../common/services-slider/ServiceSlider';\nimport {\n useOrderDetails,\n useOrderStaticData,\n} from '../../../store';\nimport { OrdersType } from '../../../types';\nimport { useClientPortal } from '../../../../store';\nimport { toReverseDeliveryLabel } from '@bjsdistribution/dms-component-library';\n\nfunction OrderServices() {\n const [orderStaticData] = useOrderStaticData();\n const [orderDetails, setOrderDetails] = useOrderDetails();\n const [isClientPortal] = useClientPortal();\n\n const orderServicesOptions = orderStaticData?.order_service_list;\n\n const desiredOrder = [\n 'unpack_items',\n 'take_packaging_away',\n 'assemble',\n 'disassemble',\n 'collect_disposal',\n ];\n\n const sortedServices = orderServicesOptions?.sort((a: any, b: any) => {\n return desiredOrder.indexOf(a.type) - desiredOrder.indexOf(b.type);\n });\n\n const toggleServices = (id: number) => {\n const selectedService = orderServicesOptions?.find(\n (item: any) => item.id === id\n );\n const key = selectedService?.type;\n const value = !orderDetails[key as keyof OrdersType];\n setOrderDetails(prev => ({\n ...prev,\n [key]: value,\n }));\n };\n const isDisabled = true;\n\n return (\n <Container disabled={isDisabled}>\n {sortedServices?.map((service: any) => {\n const selected = orderDetails[service?.type as keyof OrdersType];\n return (\n <ServiceSlider\n serviceName={\n isClientPortal\n ? service?.type?.replaceAll('_', ' ')\n : toReverseDeliveryLabel(service?.type?.replaceAll('_', ' '))\n }\n serviceId={service?.id}\n isSelected={selected}\n toggle={toggleServices}\n key={service?.id}\n disabled={true}\n />\n );\n })}\n </Container>\n );\n}\n\nconst Container = styled.div<{ disabled: boolean }>`\n display: flex;\n gap: 30px;\n flex: 1;\n @media screen and (max-width: 1170px) {\n flex-wrap: wrap;\n\n ${({ disabled }) =>\n disabled &&\n `\n pointer-events: none;\n\n > * {\n pointer-events: none;\n }\n `}\n }\n`;\n\nexport default OrderServices;\n"],"names":["OrderServices","orderStaticData","useOrderStaticData","orderDetails","setOrderDetails","useOrderDetails","isClientPortal","useClientPortal","orderServicesOptions","desiredOrder","sortedServices","a","b","toggleServices","id","key","item","value","prev","Container","service","selected","jsx","ServiceSlider","toReverseDeliveryLabel","styled","disabled"],"mappings":";;;;;;AAWA,SAASA,IAAgB;AACvB,QAAM,CAACC,CAAe,IAAIC,EAAA,GACpB,CAACC,GAAcC,CAAe,IAAIC,EAAA,GAClC,CAACC,CAAc,IAAIC,EAAA,GAEnBC,IAAuBP,GAAiB,oBAExCQ,IAAe;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,GAGIC,IAAiBF,GAAsB,KAAK,CAACG,GAAQC,MAClDH,EAAa,QAAQE,EAAE,IAAI,IAAIF,EAAa,QAAQG,EAAE,IAAI,CAClE,GAEKC,IAAiB,CAACC,MAAe;AAIrC,UAAMC,IAHkBP,GAAsB;AAAA,MAC5C,CAACQ,MAAcA,EAAK,OAAOF;AAAA,IAAA,GAEA,MACvBG,IAAQ,CAACd,EAAaY,CAAuB;AACnD,IAAAX,EAAgB,CAAAc,OAAS;AAAA,MACvB,GAAGA;AAAA,MACH,CAACH,CAAG,GAAGE;AAAA,IAAA,EACP;AAAA,EACJ;AAGA,2BACGE,GAAA,EAAU,UAHM,IAId,UAAAT,GAAgB,IAAI,CAACU,MAAiB;AACrC,UAAMC,IAAWlB,EAAaiB,GAAS,IAAwB;AAC/D,WACE,gBAAAE;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,aACEjB,IACIc,GAAS,MAAM,WAAW,KAAK,GAAG,IAClCI,EAAuBJ,GAAS,MAAM,WAAW,KAAK,GAAG,CAAC;AAAA,QAEhE,WAAWA,GAAS;AAAA,QACpB,YAAYC;AAAA,QACZ,QAAQR;AAAA,QAER,UAAU;AAAA,MAAA;AAAA,MADLO,GAAS;AAAA,IAAA;AAAA,EAIpB,CAAC,EAAA,CACH;AAEJ;AAEA,MAAMD,IAAYM,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOnB,CAAC,EAAE,UAAAC,EAAA,MACHA,KACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAMH;AAAA;AAAA;"}
@@ -1,26 +1,30 @@
1
- import { jsxs as s, jsx as o } from "react/jsx-runtime";
2
- import { SelectDropdown as c, Label as m } from "@bjsdistribution/dms-component-library";
3
- import { useOrderStaticData as u, useOrderDetails as y } from "../../../store.js";
4
- import a from "styled-components";
5
- import { capitalize as D } from "../../../utils.js";
6
- function _() {
7
- const [i] = u(), [r, l] = y(), p = r?.order_type_id, t = i?.order_type?.map(
8
- (e) => ({
9
- label: D(e.type.replaceAll("_", " ")),
10
- value: e.id
11
- })
1
+ import { jsxs as c, jsx as a } from "react/jsx-runtime";
2
+ import { SelectDropdown as m, toReverseDeliveryLabel as u, Label as y } from "@bjsdistribution/dms-component-library";
3
+ import { useOrderStaticData as v, useOrderDetails as D } from "../../../store.js";
4
+ import l from "styled-components";
5
+ import { capitalize as f } from "../../../utils.js";
6
+ import { useClientPortal as w } from "../../../../store.js";
7
+ function L() {
8
+ const [i] = v(), [t, n] = D(), [p] = w(), s = t?.order_type_id, o = i?.order_type?.map(
9
+ (e) => {
10
+ const r = f(e.type.replaceAll("_", " "));
11
+ return {
12
+ label: p ? r : u(r),
13
+ value: e.id
14
+ };
15
+ }
12
16
  ), d = (e) => {
13
- const n = { ...r, order_type_id: e.value };
14
- l(n);
17
+ const r = { ...t, order_type_id: e.value };
18
+ n(r);
15
19
  };
16
- return /* @__PURE__ */ s(f, { children: [
17
- /* @__PURE__ */ o(m, { label: "Service Type", htmlFor: "serviceTypeDropdown" }),
18
- /* @__PURE__ */ o(
19
- v,
20
+ return /* @__PURE__ */ c(S, { children: [
21
+ /* @__PURE__ */ a(y, { label: "Service Type", htmlFor: "serviceTypeDropdown" }),
22
+ /* @__PURE__ */ a(
23
+ b,
20
24
  {
21
25
  placeholder: "Select Service Type",
22
- options: t || [],
23
- value: t?.filter((e) => e.value === p),
26
+ options: o || [],
27
+ value: o?.filter((e) => e.value === s),
24
28
  inputId: "serviceTypeDropdown",
25
29
  openMenuOnFocus: !0,
26
30
  onChange: d,
@@ -30,19 +34,19 @@ function _() {
30
34
  )
31
35
  ] });
32
36
  }
33
- const f = a.div`
37
+ const S = l.div`
34
38
  display: flex;
35
39
  flex-direction: column;
36
40
  gap: 6px;
37
41
  // flex: 1;
38
42
  min-width: 250px;
39
- `, v = a(c)`
43
+ `, b = l(m)`
40
44
  &.disabled {
41
45
  cursor: not-allowed !important;
42
46
  opacity: 0.7;
43
47
  }
44
48
  `;
45
49
  export {
46
- _ as default
50
+ L as default
47
51
  };
48
52
  //# sourceMappingURL=ServiceType.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ServiceType.js","sources":["../../../../../../src/components/order-view/order-details/expanded-content/services-section/ServiceType.tsx"],"sourcesContent":["import React from 'react';\nimport { Label, SelectDropdown } from '@bjsdistribution/dms-component-library';\nimport { useOrderDetails, useOrderStaticData } from '../../../store';\nimport styled from 'styled-components';\nimport { capitalize } from '../../../utils';\n\nfunction ServiceTypeDropdown() {\n const [orderStaticData] = useOrderStaticData();\n const [orderData, setOrderData] = useOrderDetails();\n\n const orderTypeId = orderData?.order_type_id;\n\n const serviceTypeOptions = orderStaticData?.order_type?.map(\n (option: any) => ({\n label: capitalize(option.type.replaceAll('_', ' ')),\n value: option.id,\n })\n );\n\n const onChange = (event: any) => {\n const newData = { ...orderData, order_type_id: event.value };\n setOrderData(newData);\n };\n const isDisabled = true;\n\n return (\n <Container>\n <Label label=\"Service Type\" htmlFor=\"serviceTypeDropdown\" />\n <StyledSelectDropdown\n placeholder=\"Select Service Type\"\n options={serviceTypeOptions || []}\n value={serviceTypeOptions?.filter((f: any) => f.value === orderTypeId)}\n inputId=\"serviceTypeDropdown\"\n openMenuOnFocus\n onChange={onChange}\n isDisabled={true}\n className={isDisabled ? 'disabled' : ''}\n />\n </Container>\n );\n}\n\nconst Container = styled.div`\n display: flex;\n flex-direction: column;\n gap: 6px;\n // flex: 1;\n min-width: 250px;\n`;\n\nconst StyledSelectDropdown = styled(SelectDropdown)`\n &.disabled {\n cursor: not-allowed !important;\n opacity: 0.7;\n }\n`;\n\nexport default ServiceTypeDropdown;\n"],"names":["ServiceTypeDropdown","orderStaticData","useOrderStaticData","orderData","setOrderData","useOrderDetails","orderTypeId","serviceTypeOptions","option","capitalize","onChange","event","newData","Container","jsx","Label","StyledSelectDropdown","f","styled","SelectDropdown"],"mappings":";;;;;AAMA,SAASA,IAAsB;AAC7B,QAAM,CAACC,CAAe,IAAIC,EAAA,GACpB,CAACC,GAAWC,CAAY,IAAIC,EAAA,GAE5BC,IAAcH,GAAW,eAEzBI,IAAqBN,GAAiB,YAAY;AAAA,IACtD,CAACO,OAAiB;AAAA,MAChB,OAAOC,EAAWD,EAAO,KAAK,WAAW,KAAK,GAAG,CAAC;AAAA,MAClD,OAAOA,EAAO;AAAA,IAAA;AAAA,EAChB,GAGIE,IAAW,CAACC,MAAe;AAC/B,UAAMC,IAAU,EAAE,GAAGT,GAAW,eAAeQ,EAAM,MAAA;AACrD,IAAAP,EAAaQ,CAAO;AAAA,EACtB;AAGA,2BACGC,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAC,EAACC,GAAA,EAAM,OAAM,gBAAe,SAAQ,uBAAsB;AAAA,IAC1D,gBAAAD;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,aAAY;AAAA,QACZ,SAAST,KAAsB,CAAA;AAAA,QAC/B,OAAOA,GAAoB,OAAO,CAACU,MAAWA,EAAE,UAAUX,CAAW;AAAA,QACrE,SAAQ;AAAA,QACR,iBAAe;AAAA,QACf,UAAAI;AAAA,QACA,YAAY;AAAA,QACZ,WAAwB;AAAA,MAAa;AAAA,IAAA;AAAA,EACvC,GACF;AAEJ;AAEA,MAAMG,IAAYK,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAQnBF,IAAuBE,EAAOC,CAAc;AAAA;AAAA;AAAA;AAAA;AAAA;"}
1
+ {"version":3,"file":"ServiceType.js","sources":["../../../../../../src/components/order-view/order-details/expanded-content/services-section/ServiceType.tsx"],"sourcesContent":["import React from 'react';\nimport { Label, SelectDropdown, toReverseDeliveryLabel } from '@bjsdistribution/dms-component-library';\nimport { useOrderDetails, useOrderStaticData } from '../../../store';\nimport styled from 'styled-components';\nimport { capitalize } from '../../../utils';\nimport { useClientPortal } from '../../../../store';\n\nfunction ServiceTypeDropdown() {\n const [orderStaticData] = useOrderStaticData();\n const [orderData, setOrderData] = useOrderDetails();\n const [isClientPortal] = useClientPortal();\n\n const orderTypeId = orderData?.order_type_id;\n\n const serviceTypeOptions = orderStaticData?.order_type?.map(\n (option: any) => {\n const rawLabel = capitalize(option.type.replaceAll('_', ' '));\n return {\n label: isClientPortal ? rawLabel : toReverseDeliveryLabel(rawLabel),\n value: option.id,\n };\n }\n );\n\n const onChange = (event: any) => {\n const newData = { ...orderData, order_type_id: event.value };\n setOrderData(newData);\n };\n const isDisabled = true;\n\n return (\n <Container>\n <Label label=\"Service Type\" htmlFor=\"serviceTypeDropdown\" />\n <StyledSelectDropdown\n placeholder=\"Select Service Type\"\n options={serviceTypeOptions || []}\n value={serviceTypeOptions?.filter((f: any) => f.value === orderTypeId)}\n inputId=\"serviceTypeDropdown\"\n openMenuOnFocus\n onChange={onChange}\n isDisabled={true}\n className={isDisabled ? 'disabled' : ''}\n />\n </Container>\n );\n}\n\nconst Container = styled.div`\n display: flex;\n flex-direction: column;\n gap: 6px;\n // flex: 1;\n min-width: 250px;\n`;\n\nconst StyledSelectDropdown = styled(SelectDropdown)`\n &.disabled {\n cursor: not-allowed !important;\n opacity: 0.7;\n }\n`;\n\nexport default ServiceTypeDropdown;\n"],"names":["ServiceTypeDropdown","orderStaticData","useOrderStaticData","orderData","setOrderData","useOrderDetails","isClientPortal","useClientPortal","orderTypeId","serviceTypeOptions","option","rawLabel","capitalize","toReverseDeliveryLabel","onChange","event","newData","Container","jsx","Label","StyledSelectDropdown","f","styled","SelectDropdown"],"mappings":";;;;;;AAOA,SAASA,IAAsB;AAC7B,QAAM,CAACC,CAAe,IAAIC,EAAA,GACpB,CAACC,GAAWC,CAAY,IAAIC,EAAA,GAC5B,CAACC,CAAc,IAAIC,EAAA,GAEnBC,IAAcL,GAAW,eAEzBM,IAAqBR,GAAiB,YAAY;AAAA,IACtD,CAACS,MAAgB;AACf,YAAMC,IAAWC,EAAWF,EAAO,KAAK,WAAW,KAAK,GAAG,CAAC;AAC5D,aAAO;AAAA,QACL,OAAOJ,IAAiBK,IAAWE,EAAuBF,CAAQ;AAAA,QAClE,OAAOD,EAAO;AAAA,MAAA;AAAA,IAElB;AAAA,EAAA,GAGII,IAAW,CAACC,MAAe;AAC/B,UAAMC,IAAU,EAAE,GAAGb,GAAW,eAAeY,EAAM,MAAA;AACrD,IAAAX,EAAaY,CAAO;AAAA,EACtB;AAGA,2BACGC,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAC,EAACC,GAAA,EAAM,OAAM,gBAAe,SAAQ,uBAAsB;AAAA,IAC1D,gBAAAD;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,aAAY;AAAA,QACZ,SAASX,KAAsB,CAAA;AAAA,QAC/B,OAAOA,GAAoB,OAAO,CAACY,MAAWA,EAAE,UAAUb,CAAW;AAAA,QACrE,SAAQ;AAAA,QACR,iBAAe;AAAA,QACf,UAAAM;AAAA,QACA,YAAY;AAAA,QACZ,WAAwB;AAAA,MAAa;AAAA,IAAA;AAAA,EACvC,GACF;AAEJ;AAEA,MAAMG,IAAYK,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAQnBF,IAAuBE,EAAOC,CAAc;AAAA;AAAA;AAAA;AAAA;AAAA;"}
@@ -1 +1 @@
1
- {"version":3,"file":"helper.js","sources":["../../../../src/components/order-view/order-details/helper.ts"],"sourcesContent":["export const depotOptions = [\n {\n label: 'BJS COURIERS',\n value: 'bjs_couriers',\n },\n {\n label: 'BRD 01',\n value: 'brd_01',\n },\n {\n label: 'EXE 01',\n value: 'exe_01',\n },\n];\n\nexport const timedServiceOptions = [\n {\n label: 'All Day',\n value: 'all_day',\n },\n {\n label: 'Business Hours',\n value: 'business_hours',\n },\n {\n label: 'AM (07:00 - 12:00)',\n value: 'am',\n },\n {\n label: 'PM (12:00 - 17:00)',\n value: 'pm',\n },\n {\n label: 'Evening (17:00 - 21:00)',\n value: 'evening',\n },\n {\n label: 'Daytime (11:00 - 16:00)',\n value: 'daytime',\n },\n {\n label: 'Morning (07:00 - 12:00)',\n value: 'morning',\n },\n {\n label: 'Late AM (09:00 - 12:00)',\n value: 'late_am',\n },\n {\n label: 'Late PM (15:00 - 20:00)',\n value: 'late_pm',\n },\n];\n\nexport const serviceTypeOptions = [\n {\n label: 'Delivery',\n value: 'delivery',\n },\n {\n label: 'Collection',\n value: 'collection',\n },\n {\n label: 'Exchange',\n value: 'exchange',\n },\n {\n label: 'Service Order',\n value: 'service_order',\n },\n];\n\nexport const deliveryPointOptions = [\n {\n label: 'Room of Choice',\n value: 'roc',\n },\n {\n label: 'Hallway',\n value: 'hallway',\n },\n {\n label: 'Front Door',\n value: 'front_door',\n },\n {\n label: 'Garden',\n value: 'garden',\n },\n];\n\nexport const serviceLevelOptions = [\n {\n label: '1 Man',\n value: '1man',\n },\n {\n label: '1.5 Man',\n value: '1.5man',\n },\n {\n label: '2 Man',\n value: '2man',\n },\n];\n\nexport const assemblyTypeOptions = [\n {\n label: 'Small',\n value: 'small',\n },\n {\n label: 'Medium',\n value: 'medium',\n },\n {\n label: 'Large',\n value: 'large',\n },\n];\n\nexport const vehicleTypeOptions = [\n {\n label: 'LGV',\n value: '1',\n },\n {\n label: 'HGV',\n value: '2',\n },\n];\n"],"names":["vehicleTypeOptions"],"mappings":"AA0HO,MAAMA,IAAqB;AAAA,EAChC;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAEX;"}
1
+ {"version":3,"file":"helper.js","sources":["../../../../src/components/order-view/order-details/helper.ts"],"sourcesContent":["export const depotOptions = [\n {\n label: 'BJS COURIERS',\n value: 'bjs_couriers',\n },\n {\n label: 'BRD 01',\n value: 'brd_01',\n },\n {\n label: 'EXE 01',\n value: 'exe_01',\n },\n];\n\nexport const timedServiceOptions = [\n {\n label: 'All Day',\n value: 'all_day',\n },\n {\n label: 'Business Hours',\n value: 'business_hours',\n },\n {\n label: 'AM (07:00 - 12:00)',\n value: 'am',\n },\n {\n label: 'PM (12:00 - 17:00)',\n value: 'pm',\n },\n {\n label: 'Evening (17:00 - 21:00)',\n value: 'evening',\n },\n {\n label: 'Daytime (11:00 - 16:00)',\n value: 'daytime',\n },\n {\n label: 'Morning (07:00 - 12:00)',\n value: 'morning',\n },\n {\n label: 'Late AM (09:00 - 12:00)',\n value: 'late_am',\n },\n {\n label: 'Late PM (15:00 - 20:00)',\n value: 'late_pm',\n },\n];\n\nexport const serviceTypeOptions = [\n {\n label: 'Delivery',\n value: 'delivery',\n },\n {\n label: 'Reverse Delivery',\n value: 'collection',\n },\n {\n label: 'Exchange',\n value: 'exchange',\n },\n {\n label: 'Service Order',\n value: 'service_order',\n },\n];\n\nexport const deliveryPointOptions = [\n {\n label: 'Room of Choice',\n value: 'roc',\n },\n {\n label: 'Hallway',\n value: 'hallway',\n },\n {\n label: 'Front Door',\n value: 'front_door',\n },\n {\n label: 'Garden',\n value: 'garden',\n },\n];\n\nexport const serviceLevelOptions = [\n {\n label: '1 Man',\n value: '1man',\n },\n {\n label: '1.5 Man',\n value: '1.5man',\n },\n {\n label: '2 Man',\n value: '2man',\n },\n];\n\nexport const assemblyTypeOptions = [\n {\n label: 'Small',\n value: 'small',\n },\n {\n label: 'Medium',\n value: 'medium',\n },\n {\n label: 'Large',\n value: 'large',\n },\n];\n\nexport const vehicleTypeOptions = [\n {\n label: 'LGV',\n value: '1',\n },\n {\n label: 'HGV',\n value: '2',\n },\n];\n"],"names":["vehicleTypeOptions"],"mappings":"AA0HO,MAAMA,IAAqB;AAAA,EAChC;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAEX;"}