Skip to content

Commit

Permalink
Merge pull request #3 from commercelayer/fix-destination-visualization
Browse files Browse the repository at this point in the history
Use `return.stock_location` as Destination
  • Loading branch information
pfferrari committed Nov 16, 2023
2 parents b001bae + 0b581f8 commit 787bdd2
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 61 deletions.
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"dependencies": {
"@ac-dev/countries-service": "^1.2.0",
"@commercelayer/app-elements": "^1.6.3",
"@commercelayer/app-elements": "1.6.5",
"@commercelayer/sdk": "5.21.1",
"@hookform/resolvers": "^3.3.1",
"lodash": "^4.17.21",
Expand Down
7 changes: 4 additions & 3 deletions packages/app/src/components/ReturnInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export const ReturnInfo = withSkeletonTemplate<Props>(
settings: { mode }
} = useTokenProvider()

const returnOrderNumber = `#${returnObj?.order?.number}`
const returnOrderMarket = returnObj.order?.market?.name
const returnOrderNumber = `#${returnObj.order?.number}`
const navigateToOrder = canAccess('orders')
? navigateTo({
destination: {
Expand Down Expand Up @@ -51,10 +52,10 @@ export const ReturnInfo = withSkeletonTemplate<Props>(
<Text tag='div' weight='semibold'>
{canAccess('orders') ? (
<Button variant='link' {...navigateToOrder}>
{returnOrderNumber}
{`${returnOrderMarket} ${returnOrderNumber}`}
</Button>
) : (
returnOrderNumber
`${returnOrderMarket} ${returnOrderNumber}`
)}
</Text>
</ListItem>
Expand Down
4 changes: 2 additions & 2 deletions packages/app/src/components/ReturnSteps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ export const ReturnSteps = withSkeletonTemplate<Props>(
<div>
<Spacer bottom='2'>
<Text size='small' tag='div' variant='info' weight='semibold'>
To
Destination
</Text>
</Spacer>
<Text weight='semibold' className='text-lg'>
{returnObj?.order?.market?.name}
{returnObj?.stock_location?.name}
</Text>
</div>
</Stack>
Expand Down
1 change: 1 addition & 0 deletions packages/app/src/hooks/useReturnDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { isMockedId, makeReturn } from '#mocks'
import { useCoreApi } from '@commercelayer/app-elements'

export const returnIncludeAttribute = [
'stock_location',
'order',
'order.market',
'customer',
Expand Down
10 changes: 8 additions & 2 deletions packages/app/src/pages/ReturnsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,16 @@ export function ReturnsList(): JSX.Element {
ItemTemplate={ListItemReturn}
query={{
fields: {
returns: ['id', 'number', 'updated_at', 'status', 'order'],
returns: [
'id',
'number',
'updated_at',
'status',
'stock_location'
],
stock_location: ['id', 'name']
},
include: ['stock_location', 'order', 'order.market'],
include: ['stock_location'],
pageSize: 25,
sort: {
updated_at: 'desc'
Expand Down
106 changes: 53 additions & 53 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 787bdd2

Please sign in to comment.