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.2 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 { formatDate } from "@carbon/utils";
import { View } from "@react-pdf/renderer";
import { Summary } from "../../components";
import { useTw } from "../tw";
import type { StockTransferData } from "./types";

/** Company + transfer metadata (date, id, location, assignee). */
export function DetailsBlock({ data }: { data: StockTransferData }) {
  const tw = useTw();
  const { company, stockTransfer, location, locale } = data;

  const items: { label: string; value: string | null | undefined }[] = [
    {
      label: "Date",
      value: stockTransfer?.createdAt
        ? formatDate(stockTransfer.createdAt, undefined, locale)
        : ""
    },
    { label: "Stock Transfer", value: stockTransfer?.stockTransferId },
    { label: "Location", value: location?.name }
  ];
  if (stockTransfer?.assignee) {
    items.push({ label: "Assignee", value: stockTransfer.assignee });
  }

  return (
    <View style={tw("mb-4")}>
      <Summary company={company} items={items} />
    </View>
  );
}