fix(dashboard): order list statuses (#7948)
* fix: order list statuses * refactor: remove todo
This commit is contained in:
-4
@@ -1,4 +1,3 @@
|
|||||||
import type { PaymentStatus } from "@medusajs/medusa"
|
|
||||||
import { useTranslation } from "react-i18next"
|
import { useTranslation } from "react-i18next"
|
||||||
import { getOrderPaymentStatus } from "../../../../../lib/order-helpers"
|
import { getOrderPaymentStatus } from "../../../../../lib/order-helpers"
|
||||||
import { StatusCell } from "../../common/status-cell"
|
import { StatusCell } from "../../common/status-cell"
|
||||||
@@ -10,9 +9,6 @@ type PaymentStatusCellProps = {
|
|||||||
export const PaymentStatusCell = ({ status }: PaymentStatusCellProps) => {
|
export const PaymentStatusCell = ({ status }: PaymentStatusCellProps) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
|
||||||
// TODO: remove this when Order<>Payments are linked
|
|
||||||
return "-"
|
|
||||||
|
|
||||||
const { label, color } = getOrderPaymentStatus(t, status)
|
const { label, color } = getOrderPaymentStatus(t, status)
|
||||||
|
|
||||||
return <StatusCell color={color}>{label}</StatusCell>
|
return <StatusCell color={color}>{label}</StatusCell>
|
||||||
|
|||||||
@@ -632,9 +632,12 @@
|
|||||||
"statusTitle": "Payment Status",
|
"statusTitle": "Payment Status",
|
||||||
"status": {
|
"status": {
|
||||||
"notPaid": "Not paid",
|
"notPaid": "Not paid",
|
||||||
|
"authorized": "Authorized",
|
||||||
|
"partiallyAuthorized": "Partially authorized",
|
||||||
"awaiting": "Awaiting",
|
"awaiting": "Awaiting",
|
||||||
"captured": "Captured",
|
"captured": "Captured",
|
||||||
"partiallyRefunded": "Partially refunded",
|
"partiallyRefunded": "Partially refunded",
|
||||||
|
"partiallyCaptured": "Partially captured",
|
||||||
"refunded": "Refunded",
|
"refunded": "Refunded",
|
||||||
"canceled": "Canceled",
|
"canceled": "Canceled",
|
||||||
"requiresAction": "Requires action"
|
"requiresAction": "Requires action"
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
import { FulfillmentStatus, PaymentStatus } from "@medusajs/medusa"
|
|
||||||
import { TFunction } from "i18next"
|
import { TFunction } from "i18next"
|
||||||
|
|
||||||
export const getOrderPaymentStatus = (
|
export const getOrderPaymentStatus = (
|
||||||
t: TFunction<"translation">,
|
t: TFunction<"translation">,
|
||||||
status: PaymentStatus
|
status: string
|
||||||
) => {
|
) => {
|
||||||
const [label, color] = ({
|
const [label, color] = {
|
||||||
not_paid: [t("orders.payment.status.notPaid"), "red"],
|
not_paid: [t("orders.payment.status.notPaid"), "red"],
|
||||||
|
authorized: [t("orders.payment.status.authorized"), "orange"],
|
||||||
|
partially_authorized: [
|
||||||
|
t("orders.payment.status.partiallyAuthorized"),
|
||||||
|
"red",
|
||||||
|
],
|
||||||
awaiting: [t("orders.payment.status.awaiting"), "orange"],
|
awaiting: [t("orders.payment.status.awaiting"), "orange"],
|
||||||
captured: [t("orders.payment.status.captured"), "green"],
|
captured: [t("orders.payment.status.captured"), "green"],
|
||||||
refunded: [t("orders.payment.status.refunded"), "green"],
|
refunded: [t("orders.payment.status.refunded"), "green"],
|
||||||
@@ -14,18 +18,20 @@ export const getOrderPaymentStatus = (
|
|||||||
t("orders.payment.status.partiallyRefunded"),
|
t("orders.payment.status.partiallyRefunded"),
|
||||||
"orange",
|
"orange",
|
||||||
],
|
],
|
||||||
|
partially_captured: [
|
||||||
|
t("orders.payment.status.partiallyCaptured"),
|
||||||
|
"orange",
|
||||||
|
],
|
||||||
canceled: [t("orders.payment.status.canceled"), "red"],
|
canceled: [t("orders.payment.status.canceled"), "red"],
|
||||||
requires_action: [t("orders.payment.status.requiresAction"), "orange"],
|
requires_action: [t("orders.payment.status.requiresAction"), "orange"],
|
||||||
}[status] ||
|
}[status]
|
||||||
// TODO: remove this when Order<>Payment are linked
|
|
||||||
"not_paid") as [string, "red" | "orange" | "green"]
|
|
||||||
|
|
||||||
return { label, color }
|
return { label, color }
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getOrderFulfillmentStatus = (
|
export const getOrderFulfillmentStatus = (
|
||||||
t: TFunction<"translation">,
|
t: TFunction<"translation">,
|
||||||
status: FulfillmentStatus
|
status: string
|
||||||
) => {
|
) => {
|
||||||
const [label, color] = {
|
const [label, color] = {
|
||||||
not_fulfilled: [t("orders.fulfillment.status.notFulfilled"), "red"],
|
not_fulfilled: [t("orders.fulfillment.status.notFulfilled"), "red"],
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ const DEFAULT_PROPERTIES = [
|
|||||||
"created_at",
|
"created_at",
|
||||||
"canceled_at",
|
"canceled_at",
|
||||||
"email",
|
"email",
|
||||||
// "payment_status", // -> TODO replacement for this
|
|
||||||
"display_id",
|
"display_id",
|
||||||
"currency_code",
|
"currency_code",
|
||||||
// --- TOTALS ---
|
// --- TOTALS ---
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ const DEFAULT_PROPERTIES = [
|
|||||||
"created_at",
|
"created_at",
|
||||||
"email",
|
"email",
|
||||||
"display_id",
|
"display_id",
|
||||||
// "payment_status", // -> TODO replacement for this
|
"payment_status",
|
||||||
|
"fulfillment_status",
|
||||||
"total",
|
"total",
|
||||||
"currency_code",
|
"currency_code",
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user