fix(dashboard,order): preview pending diff summary (#14221)
* wip: preview pending diff summary * fix: return test * fix: rm return calc from processAction_ * chore: cleanup * chore: changeset * feat: add estimated diff for return,claim,exchange forms * chore: changeset
This commit is contained in:
+11
-4
@@ -568,6 +568,16 @@ export const ClaimCreateForm = ({
|
||||
}
|
||||
}, [])
|
||||
|
||||
/**
|
||||
* For estimated difference show pending difference and subtract the total of inbound items (assume all items will be returned correctly)
|
||||
* We don't include inbound total in the pending difference because it will be considered returned when the receive flow is completed
|
||||
*/
|
||||
const estimatedDifference =
|
||||
preview.summary.pending_difference -
|
||||
inboundPreviewItems.reduce((acc, item) => {
|
||||
return acc + item.total
|
||||
}, 0)
|
||||
|
||||
const inboundShippingTotal = useMemo(() => {
|
||||
const method = preview.shipping_methods.find(
|
||||
(sm) =>
|
||||
@@ -1010,10 +1020,7 @@ export const ClaimCreateForm = ({
|
||||
{t("orders.claims.refundAmount")}
|
||||
</span>
|
||||
<span className="txt-small font-medium">
|
||||
{getStylizedAmount(
|
||||
preview.summary.pending_difference,
|
||||
order.currency_code
|
||||
)}
|
||||
{getStylizedAmount(estimatedDifference, order.currency_code)}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+11
-4
@@ -272,6 +272,16 @@ export const ExchangeCreateForm = ({
|
||||
}
|
||||
}, [])
|
||||
|
||||
/**
|
||||
* For estimated difference show pending difference and subtract the total of inbound items (assume all items will be returned correctly)
|
||||
* We don't include inbound total in the pending difference because it will be considered returned when the receive flow is completed
|
||||
*/
|
||||
const estimatedDifference =
|
||||
preview.summary.pending_difference -
|
||||
inboundPreviewItems.reduce((acc, item) => {
|
||||
return acc + item.total
|
||||
}, 0)
|
||||
|
||||
const inboundShippingTotal = useMemo(() => {
|
||||
const method = preview.shipping_methods.find(
|
||||
(sm) =>
|
||||
@@ -516,10 +526,7 @@ export const ExchangeCreateForm = ({
|
||||
{t("orders.exchanges.refundAmount")}
|
||||
</span>
|
||||
<span className="txt-small font-medium">
|
||||
{getStylizedAmount(
|
||||
preview.summary.pending_difference,
|
||||
order.currency_code
|
||||
)}
|
||||
{getStylizedAmount(estimatedDifference, order.currency_code)}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+11
-4
@@ -402,6 +402,16 @@ export const ReturnCreateForm = ({
|
||||
return method?.total || 0
|
||||
}, [preview.shipping_methods])
|
||||
|
||||
/**
|
||||
* For estimated difference show pending difference and subtract the total of inbound items (assume all items will be returned correctly)
|
||||
* We don't include inbound total in the pending difference because it will be considered returned when the receive flow is completed
|
||||
*/
|
||||
const estimatedDifference =
|
||||
preview.summary.pending_difference -
|
||||
previewItems.reduce((acc, item) => {
|
||||
return acc + item.total
|
||||
}, 0)
|
||||
|
||||
return (
|
||||
<RouteFocusModal.Form
|
||||
form={form}
|
||||
@@ -707,10 +717,7 @@ export const ReturnCreateForm = ({
|
||||
{t("orders.returns.estDifference")}
|
||||
</span>
|
||||
<span className="txt-small font-medium">
|
||||
{getStylizedAmount(
|
||||
preview.summary.pending_difference,
|
||||
order.currency_code
|
||||
)}
|
||||
{getStylizedAmount(estimatedDifference, order.currency_code)}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user