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