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.1 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 type { JSONContent } from "@carbon/react";
import { Text, View } from "@react-pdf/renderer";
import { Note } from "../../components";
import { useTw } from "../tw";
import type { PurchaseOrderData } from "./types";

export function NotesBlock({ data }: { data: PurchaseOrderData }) {
  const tw = useTw();
  const notes = (data.purchaseOrder?.externalNotes ?? {}) as JSONContent;
  const hasNotes = Object.keys(notes).length > 0;

  return (
    <View style={tw("border border-gray-200 mb-4")}>
      <View style={tw("p-3")}>
        <Text style={tw("text-[9px] font-bold text-gray-600 mb-1 uppercase")}>
          Notes
        </Text>
        <View style={tw("text-[9px] text-gray-800")}>
          {hasNotes ? (
            <Note content={notes} />
          ) : (
            <Text style={tw("text-gray-400")}>None</Text>
          )}
        </View>
      </View>
    </View>
  );
}