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ć authored and GitHub committed 2025-03-28 09:14:04 +00:00
1 parent 3145c5f20d
commit 29f6c2a8dd
4 files changed
+15 -9

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
"@medusajs/dashboard": patch
---
fix(dashboard): display pending difference in the create return form
@@ -220,6 +220,7 @@
"plusCount", "plusCount",
"plusCountMore", "plusCountMore",
"areYouSure", "areYouSure",
"areYouSureDescription",
"noRecordsFound", "noRecordsFound",
"typeToConfirm", "typeToConfirm",
"noResultsTitle", "noResultsTitle",
@@ -1407,6 +1408,7 @@
} }
}, },
"required": [ "required": [
"title",
"shippingAddress", "shippingAddress",
"billingAddress", "billingAddress",
"contactHeading", "contactHeading",
@@ -3573,7 +3575,7 @@
"additionalProperties": false "additionalProperties": false
} }
}, },
"required": ["title", "create"], "required": ["title", "fields", "create"],
"additionalProperties": false "additionalProperties": false
} }
}, },
@@ -3587,7 +3589,8 @@
"fields", "fields",
"registered", "registered",
"guest", "guest",
"hasAccount" "hasAccount",
"addresses"
], ],
"additionalProperties": false "additionalProperties": false
}, },
@@ -4243,7 +4246,7 @@
"inboundTotal": { "inboundTotal": {
"type": "string" "type": "string"
}, },
"refundAmount": { "estDifference": {
"type": "string" "type": "string"
}, },
"outstandingAmount": { "outstandingAmount": {
@@ -4457,7 +4460,7 @@
"sendNotificationHint", "sendNotificationHint",
"returnTotal", "returnTotal",
"inboundTotal", "inboundTotal",
"refundAmount", "estDifference",
"outstandingAmount", "outstandingAmount",
"reason", "reason",
"reasonHint", "reasonHint",
@@ -1133,7 +1133,7 @@
"sendNotificationHint": "Notify customer about return.", "sendNotificationHint": "Notify customer about return.",
"returnTotal": "Return total", "returnTotal": "Return total",
"inboundTotal": "Inbound total", "inboundTotal": "Inbound total",
"refundAmount": "Refund amount", "estDifference": "Estimated difference",
"outstandingAmount": "Outstanding amount", "outstandingAmount": "Outstanding amount",
"reason": "Reason", "reason": "Reason",
"reasonHint": "Choose why the customer want to return items.", "reasonHint": "Choose why the customer want to return items.",
@@ -392,8 +392,6 @@ export const ReturnCreateForm = ({
return method?.total || 0 return method?.total || 0
}, [preview.shipping_methods]) }, [preview.shipping_methods])
const refundAmount = returnTotal - shippingTotal
return ( return (
<RouteFocusModal.Form <RouteFocusModal.Form
form={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"> <div className="mt-4 flex items-center justify-between border-t border-dotted pt-4">
<span className="txt-small font-medium"> <span className="txt-small font-medium">
{t("orders.returns.refundAmount")} {t("orders.returns.estDifference")}
</span> </span>
<span className="txt-small font-medium"> <span className="txt-small font-medium">
{getStylizedAmount( {getStylizedAmount(
refundAmount ? -1 * refundAmount : refundAmount, preview.summary.pending_difference,
order.currency_code order.currency_code
)} )}
</span> </span>