Skip to content

Commit

Permalink
fix: orders list status
Browse files Browse the repository at this point in the history
  • Loading branch information
kris liu authored and kris-liu-smile committed Nov 22, 2022
1 parent 8a08a6a commit 49537d3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions apps/storefront/src/pages/order/Order.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import {
FilterSearchProps,
getFilterMoreData,
currencySymbol,
getOrderStatusText,
} from './config'

import {
Expand Down Expand Up @@ -166,6 +167,8 @@ const Order = ({

const [filterInfo, setFilterInfo] = useState<Array<any>>([])

const [getOrderStatuses, setOrderStatuses] = useState<Array<any>>([])

useEffect(() => {
const search = getInitFilter(isCompanyOrder, isB2BUser)
setFilterData(search)
Expand All @@ -175,7 +178,7 @@ const Order = ({
orderStatuses = [],
}: any = await fn()
const filterInfo = getFilterMoreData(isB2BUser, isCompanyOrder, orderStatuses)

setOrderStatuses(orderStatuses)
setFilterInfo(filterInfo)
}

Expand Down Expand Up @@ -263,7 +266,7 @@ const Order = ({
title: 'Order status',
render: (item: ListItem) => (
<OrderStatus
text={item.customStatus}
text={getOrderStatusText(item.status, getOrderStatuses)}
code={item.status}
/>
),
Expand Down
2 changes: 2 additions & 0 deletions apps/storefront/src/pages/order/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,5 @@ export const currencySymbol = (currencyItem: string) => {
return ''
}
}

export const getOrderStatusText = (status: number | string, getOrderStatuses: any) => getOrderStatuses.find((item: any) => item.systemLabel === status)?.customLabel || ''

0 comments on commit 49537d3

Please sign in to comment.