Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

1.0 KB
Raw Blame
// SPDX-License-Identifier: AGPL-3.0-only
// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,
// including ports, remain AGPLv3; serving them over a network requires releasing their source.

import { Status } from "@carbon/react";
import { FIXED_ASSET_STATUS_COLOR_MAP } from "@carbon/utils";
import { useLingui } from "@lingui/react/macro";
import type { fixedAssetStatuses } from "../../accounting.models";

type FixedAssetStatusProps = {
  status?: (typeof fixedAssetStatuses)[number] | null;
};

const FixedAssetStatus = ({ status }: FixedAssetStatusProps) => {
  const { t } = useLingui();
  if (!status) return null;
  const color = FIXED_ASSET_STATUS_COLOR_MAP[status];
  if (!color) return null;

  const labels: Record<(typeof fixedAssetStatuses)[number], string> = {
    Draft: t`Draft`,
    Active: t`Active`,
    "Fully Depreciated": t`Fully Depreciated`,
    Disposed: t`Disposed`,
    "Under Construction": t`Under Construction`
  };

  return <Status color={color}>{labels[status]}</Status>;
};

export default FixedAssetStatus;