+ {/*LOCATION*/}
+
+
+
{t("orders.returns.location")}
+
+ {t("orders.returns.locationHint")}
+
+
+
+
{
+ return (
+
+
+ {
+ onChange(v)
+ }}
+ {...field}
+ options={(stock_locations ?? []).map(
+ (stockLocation) => ({
+ label: stockLocation.name,
+ value: stockLocation.id,
+ })
+ )}
+ />
+
+
+ )
+ }}
+ />
+
+
+ {/*INBOUND SHIPPING*/}
+
+
+
+ {t("orders.returns.inboundShipping")}
+
+
+ {t("orders.returns.inboundShippingHint")}
+
+
+
+ {/*TODO: WHAT IF THE RETURN OPTION HAS COMPUTED PRICE*/}
+
{
+ return (
+
+
+ {
+ onChange(v)
+ onShippingOptionChange(v)
+ }}
+ {...field}
+ options={(shipping_options ?? [])
+ .filter(
+ (so) =>
+ (locationId
+ ? so.service_zone.fulfillment_set!
+ .location.id === locationId
+ : true) &&
+ !!so.rules.find(
+ (r) =>
+ r.attribute === "is_return" &&
+ r.value === "true"
+ )
+ )
+ .map((so) => ({
+ label: so.name,
+ value: so.id,
+ }))}
+ disabled={!locationId}
+ />
+
+
+ )
+ }}
+ />
+
+
+ )}
+
+ {showLevelsWarning && (
+
+
+
+ {t("orders.returns.returnTotal")}
+
+
+ {getStylizedAmount(
+ returnTotal ? -1 * returnTotal : returnTotal,
+ order.currency_code
+ )}
+
+
+
+
+
+ {t("orders.returns.inboundShipping")}
+
+
+ {!isShippingPriceEdit && (
+ setIsShippingPriceEdit(true)}
+ variant="transparent"
+ className="text-ui-fg-muted"
+ disabled={showPlaceholder || !shippingOptionId}
+ >
+
+
+ )}
+ {isShippingPriceEdit ? (
+ {
+ let actionId
+
+ preview.shipping_methods.forEach((s) => {
+ if (s.actions) {
+ for (let a of s.actions) {
+ if (a.action === "SHIPPING_ADD") {
+ actionId = a.id
+ }
+ }
+ }
+ })
+
+ if (actionId) {
+ updateReturnShipping({
+ actionId,
+ custom_price:
+ typeof customShippingAmount === "string"
+ ? null
+ : customShippingAmount,
+ })
+ }
+ setIsShippingPriceEdit(false)
+ }}
+ symbol={
+ currencies[order.currency_code.toUpperCase()]
+ .symbol_native
+ }
+ code={order.currency_code}
+ onValueChange={(value) =>
+ setCustomShippingAmount(value ? parseInt(value) : "")
+ }
+ value={customShippingAmount}
+ disabled={showPlaceholder}
+ />
+ ) : (
+ getStylizedAmount(shippingTotal, order.currency_code)
+ )}
+
+
+
+
+
+ {t("orders.returns.refundAmount")}
+
+
+ {getStylizedAmount(
+ refundAmount ? -1 * refundAmount : refundAmount,
+ order.currency_code
+ )}
+
+
+
+
+ {/*SEND NOTIFICATION*/}
+