fix(dashboard): return form pending diff (#12007)

**What**
- display est. difference in returns as for claims/exchanges
- display order pending difference instead of value computed on FE

---

CLOSES CMRC-949
This commit is contained in:
Frane Polić
2025-03-28 10:14:04 +01:00
committed by GitHub
parent 3145c5f20d
commit 29f6c2a8dd
4 changed files with 15 additions and 9 deletions

View File

@@ -0,0 +1,5 @@
---
"@medusajs/dashboard": patch
---
fix(dashboard): display pending difference in the create return form

View File

@@ -220,6 +220,7 @@
"plusCount",
"plusCountMore",
"areYouSure",
"areYouSureDescription",
"noRecordsFound",
"typeToConfirm",
"noResultsTitle",
@@ -1407,6 +1408,7 @@
}
},
"required": [
"title",
"shippingAddress",
"billingAddress",
"contactHeading",
@@ -3573,7 +3575,7 @@
"additionalProperties": false
}
},
"required": ["title", "create"],
"required": ["title", "fields", "create"],
"additionalProperties": false
}
},
@@ -3587,7 +3589,8 @@
"fields",
"registered",
"guest",
"hasAccount"
"hasAccount",
"addresses"
],
"additionalProperties": false
},
@@ -4243,7 +4246,7 @@
"inboundTotal": {
"type": "string"
},
"refundAmount": {
"estDifference": {
"type": "string"
},
"outstandingAmount": {
@@ -4457,7 +4460,7 @@
"sendNotificationHint",
"returnTotal",
"inboundTotal",
"refundAmount",
"estDifference",
"outstandingAmount",
"reason",
"reasonHint",

View File

@@ -1133,7 +1133,7 @@
"sendNotificationHint": "Notify customer about return.",
"returnTotal": "Return total",
"inboundTotal": "Inbound total",
"refundAmount": "Refund amount",
"estDifference": "Estimated difference",
"outstandingAmount": "Outstanding amount",
"reason": "Reason",
"reasonHint": "Choose why the customer want to return items.",

View File

@@ -392,8 +392,6 @@ export const ReturnCreateForm = ({
return method?.total || 0
}, [preview.shipping_methods])
const refundAmount = returnTotal - shippingTotal
return (
<RouteFocusModal.Form
form={form}
@@ -696,11 +694,11 @@ export const ReturnCreateForm = ({
<div className="mt-4 flex items-center justify-between border-t border-dotted pt-4">
<span className="txt-small font-medium">
{t("orders.returns.refundAmount")}
{t("orders.returns.estDifference")}
</span>
<span className="txt-small font-medium">
{getStylizedAmount(
refundAmount ? -1 * refundAmount : refundAmount,
preview.summary.pending_difference,
order.currency_code
)}
</span>