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.

style: update pdfs

Brad Barbina1271865d57b
diff --git a/packages/documents/src/pdf/IssuePDF.tsx b/packages/documents/src/pdf/IssuePDF.tsx
index b33646ba8d..65cb1d642d 100644
--- a/packages/documents/src/pdf/IssuePDF.tsx
+++ b/packages/documents/src/pdf/IssuePDF.tsx
@@ -3,7 +3,7 @@ import type { JSONContent } from "@carbon/react";
import { Text, View } from "@react-pdf/renderer";
import { createTw } from "react-pdf-tailwind";
import type { PDF } from "../types";
-import { Header, Note, Summary, Template } from "./components";
+import { Header, Note, Template } from "./components";
type ListItem = {
id: string;
@@ -55,42 +55,61 @@ interface IssuePDFProps extends PDF {
operationToJobId?: Record<string, string>;
}
-// Initialize tailwind-styled-components
const tw = createTw({
theme: {
fontFamily: {
- sans: ["Helvetica", "Arial", "sans-serif"]
+ sans: ["Inter", "Helvetica", "Arial", "sans-serif"]
},
extend: {
colors: {
gray: {
- 500: "#7d7d7d"
+ 50: "#f9fafb",
+ 200: "#e5e7eb",
+ 400: "#9ca3af",
+ 600: "#4b5563",
+ 800: "#1f2937"
}
}
}
}
});
+const formatDate = (dateStr: string | null) => {
+ if (!dateStr) return null;
+ try {
+ const date = new Date(dateStr);
+ return date.toLocaleDateString("en-US", {
+ year: "numeric",
+ month: "long",
+ day: "numeric"
+ });
+ } catch {
+ return dateStr;
+ }
+};
+
const IssuePDF = ({
company,
- locale,
meta,
nonConformance,
nonConformanceTypes,
actionTasks,
requiredActions,
reviewers,
- items,
associations,
assignees = {},
jobOperationStepRecords = [],
operationToJobId = {},
title = "Issue Report"
}: IssuePDFProps) => {
- // Sort action tasks by sortOrder
const sortedActionTasks = [...actionTasks].sort(
(a, b) => (a.sortOrder ?? 0) - (b.sortOrder ?? 0)
);
+
+ const ncType = nonConformanceTypes.find(
+ (type) => type.id === nonConformance.nonConformanceTypeId
+ );
+
return (
<Template
title={title}
@@ -101,68 +120,91 @@ const IssuePDF = ({
}}
footerLabel={`Issue #${nonConformance.nonConformanceId}`}
>
- <View>
- <Header title={title} company={company} />
- <Summary
- company={company}
- items={[
- {
- label: "Issue #",
- value: nonConformance.nonConformanceId
- },
- {
- label: "Type",
- value: nonConformanceTypes.find(
- (type) => type.id === nonConformance.nonConformanceTypeId
- )?.name
- },
- {
- label: "Status",
- value: nonConformance.status
- },
- {
- label: "Initiated By",
- value: assignees[nonConformance.createdBy] || "Unknown"
- },
- {
- label: "Started",
- value: nonConformance.openDate
- },
- {
- label: "Completed",
- value: nonConformance.closeDate
- }
- ]}
- />
- <View style={tw("flex flex-col gap-2 mb-4")}>
- <View style={tw("flex flex-row justify-between")}>
- <Text style={[tw("font-bold"), { letterSpacing: -0.5 }]}>
- {nonConformance.name}
+ <Header
+ company={company}
+ title="Issue Report"
+ documentId={nonConformance.nonConformanceId}
+ />
+
+ {/* Issue Details */}
+ <View style={tw("border border-gray-200 mb-4")}>
+ <View style={tw("flex flex-row")}>
+ <View style={tw("w-1/2 p-3 border-r border-gray-200")}>
+ <Text
+ style={tw("text-[9px] font-bold text-gray-600 mb-1 uppercase")}
+ >
+ Issue Details
</Text>
+ <View style={tw("text-[10px] text-gray-800")}>
+ {nonConformance.name && (
+ <Text style={tw("font-bold")}>{nonConformance.name}</Text>
+ )}
+ {ncType?.name && (
+ <Text style={tw("mt-1")}>Type: {ncType.name}</Text>
+ )}
+ {nonConformance.status && (
+ <Text>Status: {nonConformance.status}</Text>
+ )}
+ <Text>
+ Initiated By: {assignees[nonConformance.createdBy] || "Unknown"}
+ </Text>
+ </View>
+ </View>
+ <View style={tw("w-1/2 p-3")}>
+ <Text
+ style={tw("text-[9px] font-bold text-gray-600 mb-1 uppercase")}
+ >
+ Dates
+ </Text>
+ <View style={tw("text-[10px] text-gray-800")}>
+ {nonConformance.openDate && (
+ <Text>Started: {formatDate(nonConformance.openDate)}</Text>
+ )}
+ {nonConformance.closeDate && (
+ <Text>Completed: {formatDate(nonConformance.closeDate)}</Text>
+ )}
+ </View>
</View>
</View>
- {associations && (
- <View style={tw("mb-10")}>
- <View style={tw("flex flex-col gap-1")}>
+ </View>
+
+ {/* Associations */}
+ {associations && (
+ <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")}
+ >
+ Associations
+ </Text>
+ <View style={tw("flex flex-col")}>
{associations.items?.map((item: any) => (
<View
key={item.id}
- style={tw("flex flex-row gap-2 text-sm py-1")}
+ style={tw(
+ "flex flex-row gap-2 text-[10px] py-1 border-b border-gray-200"
+ )}
>
- <View style={tw("w-1/4")}>
- <Text style={tw("font-bold text-[#7d7d7d]")}>Item:</Text>
- </View>
- <Text>{item.documentReadableId}</Text>
+ <Text style={tw("w-1/4 font-bold text-gray-600")}>
+ Item:
+ </Text>
+ <Text style={tw("text-gray-800")}>
+ {item.documentReadableId}
+ </Text>
{item.disposition && (
<>
- <Text>-</Text>
- <Text>{item.disposition}</Text>
+ <Text style={tw("text-gray-400")}>-</Text>
+ <Text style={tw("text-gray-800")}>
+ {item.disposition}
+ </Text>
</>
)}
{item.quantity && (
<>
- <Text>-</Text>
- <Text>Qty: {item.quantity}</Text>
+ <Text style={tw("text-gray-400")}>-</Text>
+ <Text style={tw("text-gray-800")}>
+ Qty: {item.quantity}
+ </Text>
</>
)}
</View>
@@ -170,175 +212,200 @@ const IssuePDF = ({
{associations.customers?.map((customer: any) => (
<View
key={customer.id}
- style={tw("flex flex-row gap-2 text-sm py-1")}
+ style={tw(
+ "flex flex-row gap-2 text-[10px] py-1 border-b border-gray-200"
+ )}
>
- <View style={tw("w-1/4")}>
- <Text style={tw("font-bold text-[#7d7d7d]")}>
- Customer:
- </Text>
- </View>
- <Text>{customer.documentReadableId}</Text>
+ <Text style={tw("w-1/4 font-bold text-gray-600")}>
+ Customer:
+ </Text>
+ <Text style={tw("text-gray-800")}>
+ {customer.documentReadableId}
+ </Text>
</View>
))}
{associations.suppliers?.map((supplier: any) => (
<View
key={supplier.id}
- style={tw("flex flex-row gap-2 text-sm py-1")}
+ style={tw(
+ "flex flex-row gap-2 text-[10px] py-1 border-b border-gray-200"
+ )}
>
- <View style={tw("w-1/4")}>
- <Text style={tw("font-bold text-[#7d7d7d]")}>
- Supplier:
- </Text>
- </View>
- <Text>{supplier.documentReadableId}</Text>
+ <Text style={tw("w-1/4 font-bold text-gray-600")}>
+ Supplier:
+ </Text>
+ <Text style={tw("text-gray-800")}>
+ {supplier.documentReadableId}
+ </Text>
</View>
))}
{associations.jobOperations?.map((job: any) => (
<View
key={job.id}
- style={tw("flex flex-row gap-2 text-sm py-1")}
+ style={tw(
+ "flex flex-row gap-2 text-[10px] py-1 border-b border-gray-200"
+ )}
>
- <View style={tw("w-1/4")}>
- <Text style={tw("font-bold text-[#7d7d7d]")}>
- Job Operation:
- </Text>
- </View>
- <Text>{job.documentReadableId}</Text>
+ <Text style={tw("w-1/4 font-bold text-gray-600")}>
+ Job Operation:
+ </Text>
+ <Text style={tw("text-gray-800")}>
+ {job.documentReadableId}
+ </Text>
</View>
))}
{associations.purchaseOrderLines?.map((po: any) => (
<View
key={po.id}
- style={tw("flex flex-row gap-2 text-sm py-1")}
+ style={tw(
+ "flex flex-row gap-2 text-[10px] py-1 border-b border-gray-200"
+ )}
>
- <View style={tw("w-1/4")}>
- <Text style={tw("font-bold text-[#7d7d7d]")}>
- Purchase Order:
- </Text>
- </View>
- <Text>{po.documentReadableId}</Text>
+ <Text style={tw("w-1/4 font-bold text-gray-600")}>
+ Purchase Order:
+ </Text>
+ <Text style={tw("text-gray-800")}>
+ {po.documentReadableId}
+ </Text>
</View>
))}
{associations.salesOrderLines?.map((so: any) => (
<View
key={so.id}
- style={tw("flex flex-row gap-2 text-sm py-1")}
+ style={tw(
+ "flex flex-row gap-2 text-[10px] py-1 border-b border-gray-200"
+ )}
>
- <View style={tw("w-1/4")}>
- <Text style={tw("font-bold text-[#7d7d7d]")}>
- Sales Order:
- </Text>
- </View>
- <Text>{so.documentReadableId}</Text>
+ <Text style={tw("w-1/4 font-bold text-gray-600")}>
+ Sales Order:
+ </Text>
+ <Text style={tw("text-gray-800")}>
+ {so.documentReadableId}
+ </Text>
</View>
))}
{associations.shipmentLines?.map((shipment: any) => (
<View
key={shipment.id}
- style={tw("flex flex-row gap-2 text-sm py-1")}
+ style={tw(
+ "flex flex-row gap-2 text-[10px] py-1 border-b border-gray-200"
+ )}
>
- <View style={tw("w-1/4")}>
- <Text style={tw("font-bold text-[#7d7d7d]")}>
- Shipment:
- </Text>
- </View>
- <Text>{shipment.documentReadableId}</Text>
+ <Text style={tw("w-1/4 font-bold text-gray-600")}>
+ Shipment:
+ </Text>
+ <Text style={tw("text-gray-800")}>
+ {shipment.documentReadableId}
+ </Text>
</View>
))}
{associations.receiptLines?.map((receipt: any) => (
<View
key={receipt.id}
- style={tw("flex flex-row gap-2 text-sm py-1")}
+ style={tw(
+ "flex flex-row gap-2 text-[10px] py-1 border-b border-gray-200"
+ )}
>
- <View style={tw("w-1/4")}>
- <Text style={tw("font-bold text-[#7d7d7d]")}>Receipt:</Text>
- </View>
- <Text>{receipt.documentReadableId}</Text>
+ <Text style={tw("w-1/4 font-bold text-gray-600")}>
+ Receipt:
+ </Text>
+ <Text style={tw("text-gray-800")}>
+ {receipt.documentReadableId}
+ </Text>
</View>
))}
{associations.trackedEntities?.map((entity: any) => (
<View
key={entity.id}
- style={tw("flex flex-row gap-2 text-sm py-1")}
+ style={tw(
+ "flex flex-row gap-2 text-[10px] py-1 border-b border-gray-200"
+ )}
>
- <View style={tw("w-1/4")}>
- <Text style={tw("font-bold text-[#7d7d7d]")}>
- Tracked Entity:
- </Text>
- </View>
- <Text>{entity.documentReadableId}</Text>
+ <Text style={tw("w-1/4 font-bold text-gray-600")}>
+ Tracked Entity:
+ </Text>
+ <Text style={tw("text-gray-800")}>
+ {entity.documentReadableId}
+ </Text>
</View>
))}
</View>
</View>
- )}
- {Object.keys(nonConformance.content ?? {}).length > 0 && (
- <View style={tw("flex flex-col gap-2 mb-10")}>
- <View style={tw("flex flex-row justify-between")}>
- <Text style={[tw("font-bold"), { letterSpacing: -0.5 }]}>
- Description of Issue
- </Text>
- </View>
+ </View>
+ )}
- <View style={tw("flex flex-col my-2")}>
+ {/* Description of Issue */}
+ {Object.keys(nonConformance.content ?? {}).length > 0 && (
+ <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")}
+ >
+ Description of Issue
+ </Text>
+ <View style={tw("mt-1")}>
<Note content={nonConformance.content as JSONContent} />
</View>
</View>
- )}
+ </View>
+ )}
- {sortedActionTasks.length > 0 && (
- <View style={tw("mb-10")}>
- {sortedActionTasks.map((task) => (
- <View
- key={task.id}
- style={tw("flex flex-col gap-2 mb-10")}
- wrap={false}
- >
- <View style={tw("flex flex-row justify-between")}>
- <Text style={[tw("font-bold"), { letterSpacing: -0.5 }]}>
- {task.supplier?.name ? "Supplier " : ""}
- {
- requiredActions.find(
- (action) => action.id === task.actionTypeId
- )?.name
- }
- </Text>
- </View>
- <View style={tw("flex flex-col gap-1")}>
+ {/* Action Tasks */}
+ {sortedActionTasks.length > 0 && (
+ <View style={tw("mb-4")}>
+ {sortedActionTasks.map((task) => (
+ <View
+ key={task.id}
+ style={tw("border border-gray-200 mb-4")}
+ wrap={false}
+ >
+ <View style={tw("p-3")}>
+ <Text
+ style={tw(
+ "text-[9px] font-bold text-gray-600 mb-1 uppercase"
+ )}
+ >
+ {task.supplier?.name ? "Supplier " : ""}
+ {
+ requiredActions.find(
+ (action) => action.id === task.actionTypeId
+ )?.name
+ }
+ </Text>
+ <View style={tw("flex flex-col gap-1 text-[10px]")}>
{task.supplier?.name && (
- <View style={tw("flex flex-row gap-2 text-sm")}>
- <View style={tw("w-1/4")}>
- <Text style={tw("font-bold text-[#7d7d7d]")}>
- Supplier:
- </Text>
- </View>
- <Text>{task.supplier.name}</Text>
+ <View style={tw("flex flex-row gap-2")}>
+ <Text style={tw("font-bold text-gray-600")}>
+ Supplier:
+ </Text>
+ <Text style={tw("text-gray-800")}>
+ {task.supplier.name}
+ </Text>
</View>
)}
{task.assignee && assignees[task.assignee] && (
- <View style={tw("flex flex-row gap-2 text-sm")}>
- <View style={tw("w-1/4")}>
- <Text style={tw("font-bold text-[#7d7d7d]")}>
- {task.supplier?.name ? "Verified by" : "Completed by"}
- :
- </Text>
- </View>
- <Text>{assignees[task.assignee]}</Text>
+ <View style={tw("flex flex-row gap-2")}>
+ <Text style={tw("font-bold text-gray-600")}>
+ {task.supplier?.name ? "Verified by" : "Completed by"}:
+ </Text>
+ <Text style={tw("text-gray-800")}>
+ {assignees[task.assignee]}
+ </Text>
</View>
)}
{task.completedDate && (
- <View style={tw("flex flex-row gap-2 text-sm")}>
- <View style={tw("w-1/4")}>
- <Text style={tw("font-bold text-[#7d7d7d]")}>
- Completed on:
- </Text>
- </View>
- <Text>{task.completedDate}</Text>
+ <View style={tw("flex flex-row gap-2")}>
+ <Text style={tw("font-bold text-gray-600")}>
+ Completed on:
+ </Text>
+ <Text style={tw("text-gray-800")}>
+ {task.completedDate}
+ </Text>
</View>
)}
</View>
{Object.keys(task.notes ?? {}).length > 0 && (
- <View style={tw("flex flex-col my-2")}>
+ <View style={tw("mt-2 pt-2 border-t border-gray-200")}>
<Note content={task.notes as JSONContent} />
</View>
)}
@@ -350,27 +417,33 @@ const IssuePDF = ({
(record) => record.booleanValue !== null
)
) && (
- <View style={tw("flex flex-col gap-2")}>
+ <View style={tw("mt-2 pt-2 border-t border-gray-200")}>
<Text
- style={[tw("font-bold text-sm"), { letterSpacing: -0.5 }]}
+ style={tw(
+ "text-[9px] font-bold text-gray-600 mb-1 uppercase"
+ )}
>
Inspections
</Text>
{jobOperationStepRecords
- .filter((step) => step.nonConformanceActionId === task.id)
+ .filter(
+ (step) => step.nonConformanceActionId === task.id
+ )
.map((step) =>
step.jobOperationStepRecord
?.filter((record) => record.booleanValue !== null)
.map((record) => (
<View
key={record.id}
- style={tw("flex flex-row gap-2 text-sm")}
+ style={tw(
+ "flex flex-row gap-2 text-[10px] py-0.5"
+ )}
>
<View
style={{
- width: 12,
- height: 12,
- border: "1px solid #000",
+ width: 10,
+ height: 10,
+ border: "1px solid #9ca3af",
marginTop: 2,
position: "relative"
}}
@@ -378,28 +451,34 @@ const IssuePDF = ({
<Text
style={{
position: "absolute",
- fontSize: 12,
+ fontSize: 10,
fontWeight: "bold",
lineHeight: 1,
textAlign: "center",
top: -3,
- left: -2
+ left: -1.5
}}
>
{record.booleanValue ? "✓" : ""}
</Text>
</View>
<View style={tw("flex flex-col")}>
- <Text style={tw("font-medium")}>
+ <Text style={tw("text-gray-800")}>
{step.name}
</Text>
- <Text style={tw("text-xs")}>
+ <Text
+ style={tw(
+ "text-[8px] text-gray-400 mt-0.5"
+ )}
+ >
{operationToJobId[step.operationId] && (
<>
- Job {operationToJobId[step.operationId]} •{" "}
+ Job{" "}
+ {operationToJobId[step.operationId]} •{" "}
</>
)}
- {assignees[record.createdBy] || "Unknown"} •{" "}
+ {assignees[record.createdBy] || "Unknown"}{" "}
+ •{" "}
{
new Date(record.createdAt)
.toISOString()
@@ -413,36 +492,50 @@ const IssuePDF = ({
</View>
)}
</View>
- ))}
- </View>
- )}
+ </View>
+ ))}
+ </View>
+ )}
- {reviewers.length > 0 && (
- <View style={tw("mb-5")}>
- <Text style={[tw("font-bold mb-2"), { letterSpacing: -0.5 }]}>
+ {/* MRB Reviewers */}
+ {reviewers.length > 0 && (
+ <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-2 uppercase")}
+ >
MRB
</Text>
- {reviewers.map((reviewer) => (
- <View key={reviewer.id} style={tw("flex flex-col gap-2 py-2")}>
+ {reviewers.map((reviewer, index) => (
+ <View
+ key={reviewer.id}
+ style={tw(
+ `flex flex-col gap-1 py-2 ${
+ index < reviewers.length - 1
+ ? "border-b border-gray-200"
+ : ""
+ }`
+ )}
+ >
<View style={tw("flex flex-row justify-between")}>
- <Text
- style={[tw("font-bold text-sm"), { letterSpacing: -0.5 }]}
- >
+ <Text style={tw("text-[10px] font-bold text-gray-800")}>
{reviewer.title}
</Text>
- <Text style={tw("text-gray-500 text-sm")}>
+ <Text style={tw("text-[10px] text-gray-600")}>
{reviewer.status}
</Text>
</View>
{Object.keys(reviewer.notes ?? {}).length > 0 && (
- <Note content={reviewer.notes as JSONContent} />
+ <View style={tw("mt-1")}>
+ <Note content={reviewer.notes as JSONContent} />
+ </View>
)}
</View>
))}
</View>
- )}
- </View>
+ </View>
+ )}
</Template>
);
};
diff --git a/packages/documents/src/pdf/JobTravelerPDF.tsx b/packages/documents/src/pdf/JobTravelerPDF.tsx
index 29f8abcfe6..43ca4e05a8 100644
--- a/packages/documents/src/pdf/JobTravelerPDF.tsx
+++ b/packages/documents/src/pdf/JobTravelerPDF.tsx
@@ -265,10 +265,9 @@ export const JobTravelerPageContent = ({
{/* Original Header Section with company logo and job title */}
<View style={tw("mb-6")}>
<Header
- title={job.jobId}
- subtitle={subtitle}
- tertiaryTitle={tertiaryTitle}
company={company}
+ title="Job Traveler"
+ documentId={job.jobId}
/>
</View>
diff --git a/packages/documents/src/pdf/PackingSlipPDF.tsx b/packages/documents/src/pdf/PackingSlipPDF.tsx
index f91136b2f5..6e1049cc94 100644
--- a/packages/documents/src/pdf/PackingSlipPDF.tsx
+++ b/packages/documents/src/pdf/PackingSlipPDF.tsx
@@ -7,7 +7,7 @@ import { Image, Text, View } from "@react-pdf/renderer";
import { createTw } from "react-pdf-tailwind";
import { generateQRCode } from "../qr/qr-code";
import type { PDF } from "../types";
-import { Header, Note, Summary, Template } from "./components";
+import { Header, Note, Template } from "./components";
interface PackingSlipProps extends PDF {
customer:
@@ -26,22 +26,39 @@ interface PackingSlipProps extends PDF {
thumbnails?: Record<string, string | null>;
}
-// Initialize tailwind-styled-components
const tw = createTw({
theme: {
fontFamily: {
- sans: ["Helvetica", "Arial", "sans-serif"]
+ sans: ["Inter", "Helvetica", "Arial", "sans-serif"]
},
extend: {
colors: {
gray: {
- 500: "#7d7d7d"
+ 50: "#f9fafb",
+ 200: "#e5e7eb",
+ 400: "#9ca3af",
+ 600: "#4b5563",
+ 800: "#1f2937"
}
}
}
}
});
+const formatDate = (dateStr: string | null) => {
+ if (!dateStr) return null;
+ try {
+ const date = new Date(dateStr);
+ return date.toLocaleDateString("en-US", {
+ year: "numeric",
+ month: "long",
+ day: "numeric"
+ });
+ } catch {
+ return dateStr;
+ }
+};
+
const PackingSlipPDF = ({
company,
customer,
@@ -68,33 +85,10 @@ const PackingSlipPDF = ({
countryCode
} = shippingAddress ?? {};
- const details = [
- {
- label: "Date",
- value: shipment?.postingDate
- },
- {
- label: "Shipment",
- value: shipment?.shipmentId
- }
- ];
-
- if (sourceDocument) {
- details.push({
- label: sourceDocument,
- value: sourceDocumentId
- });
- }
-
- if (customerReference) {
- details.push({
- label: "Reference",
- value: customerReference
- });
- }
-
const hasTrackedEntities = trackedEntities.length > 0;
+ let rowIndex = 0;
+
return (
<Template
title={title}
@@ -104,163 +98,204 @@ const PackingSlipPDF = ({
subject: meta?.subject ?? "Packing Slip"
}}
>
- <View style={tw("flex flex-col")}>
- {/* Header Section - Always at the top */}
- <View style={tw("mb-4")}>
- <Header title={title} company={company} />
- <Summary company={company} items={details} />
- {shipment?.trackingNumber && (
- <View style={tw("flex flex-col gap-2 justify-between mb-5")}>
- <Text style={tw("text-gray-500 text-xs")}>Tracking Number</Text>
- <Text style={tw("text-sm")}>{shipment?.trackingNumber}</Text>
- </View>
- )}
- </View>
+ <Header
+ company={company}
+ title="Packing Slip"
+ documentId={shipment?.shipmentId}
+ />
- {/* Shipping Information Section */}
- <View
- style={tw(
- "flex flex-row justify-between mb-6 page-break-inside-avoid"
- )}
- >
- <View style={tw("flex flex-col gap-2 w-1/3")}>
- <Text style={tw("text-gray-500 text-xs")}>Ship To</Text>
- <View style={tw("flex flex-col")}>
- <Text style={tw("text-sm")}>{customer.name}</Text>
- {shippingAddress && (
- <>
- {addressLine1 && (
- <Text style={tw("text-sm")}>{addressLine1}</Text>
- )}
- {addressLine2 && (
- <Text style={tw("text-sm")}>{addressLine2}</Text>
- )}
- <Text style={tw("text-sm")}>
- {formatCityStatePostalCode(city, stateProvince, postalCode)}
- </Text>
- <Text style={tw("text-sm")}>{countryCode}</Text>
- </>
+ {/* Ship To */}
+ <View style={tw("border border-gray-200 mb-4")}>
+ <View style={tw("flex flex-row")}>
+ <View style={tw("w-1/2 p-3 border-r border-gray-200")}>
+ <Text
+ style={tw("text-[9px] font-bold text-gray-600 mb-1 uppercase")}
+ >
+ Ship To
+ </Text>
+ <View style={tw("text-[10px] text-gray-800")}>
+ {customer.name && (
+ <Text style={tw("font-bold")}>{customer.name}</Text>
+ )}
+ {addressLine1 && (
+ <Text style={tw("mt-1")}>{addressLine1}</Text>
)}
+ {addressLine2 && <Text>{addressLine2}</Text>}
+ {(city || stateProvince || postalCode) && (
+ <Text>
+ {formatCityStatePostalCode(city, stateProvince, postalCode)}
+ </Text>
+ )}
+ {countryCode && <Text>{countryCode}</Text>}
</View>
</View>
-
- <View style={tw("flex flex-col gap-2 w-1/3")}>
- <Text style={tw("text-gray-500 text-xs")}>Shipping Method</Text>
- <Text style={tw("text-sm")}>{shippingMethod.name}</Text>
- </View>
-
- <View style={tw("flex flex-col gap-2 w-1/3")}>
- <Text style={tw("text-gray-500 text-xs")}>Payment Term</Text>
- <Text style={tw("text-sm")}>{paymentTerm.name}</Text>
+ <View style={tw("w-1/2 p-3")}>
+ <Text
+ style={tw("text-[9px] font-bold text-gray-600 mb-1 uppercase")}
+ >
+ Shipment Details
+ </Text>
+ <View style={tw("text-[10px] text-gray-800")}>
+ {shipment?.postingDate && (
+ <Text>Date: {formatDate(shipment.postingDate)}</Text>
+ )}
+ {sourceDocument && sourceDocumentId && (
+ <Text>
+ {sourceDocument}: {sourceDocumentId}
+ </Text>
+ )}
+ {customerReference && (
+ <Text>Customer PO #: {customerReference}</Text>
+ )}
+ {shipment?.trackingNumber && (
+ <Text>Tracking: {shipment.trackingNumber}</Text>
+ )}
+ </View>
</View>
</View>
+ </View>
- {/* Line Items Section */}
- <View style={tw("mb-6 text-xs")}>
- <View
- style={tw(
- "flex flex-row justify-between items-center mt-5 py-3 px-[6px] border-t border-b border-gray-300 font-bold uppercase page-break-inside-avoid"
- )}
- >
+ {/* Shipping & Payment */}
+ <View style={tw("border border-gray-200 mb-4")}>
+ <View style={tw("flex flex-row")}>
+ <View style={tw("w-1/2 p-3 border-r border-gray-200")}>
<Text
- style={tw(`w-${hasTrackedEntities ? "7/12" : "9/12"} text-left`)}
+ style={tw("text-[9px] font-bold text-gray-600 mb-1 uppercase")}
>
- Description
+ Shipping
</Text>
+ <View style={tw("text-[10px] text-gray-800")}>
+ {shippingMethod?.name && (
+ <Text>Method: {shippingMethod.name}</Text>
+ )}
+ </View>
+ </View>
+ <View style={tw("w-1/2 p-3")}>
<Text
- style={tw(`w-${hasTrackedEntities ? "1/6" : "3/12"} text-center`)}
+ style={tw("text-[9px] font-bold text-gray-600 mb-1 uppercase")}
>
- Qty
+ Payment
</Text>
- {hasTrackedEntities && (
- <Text style={tw("w-1/4 text-right")}>Serial/Batch</Text>
- )}
+ <View style={tw("text-[10px] text-gray-800")}>
+ {paymentTerm?.name && (
+ <Text>Terms: {paymentTerm.name}</Text>
+ )}
+ </View>
</View>
+ </View>
+ </View>
+
+ {/* Line Items Table */}
+ <View style={tw("mb-4")}>
+ {/* Header */}
+ <View
+ style={tw(
+ "flex flex-row bg-gray-800 py-2 px-3 text-white text-[9px] font-bold"
+ )}
+ >
+ <Text
+ style={tw(`w-${hasTrackedEntities ? "5/12" : "7/12"} text-left`)}
+ >
+ Description
+ </Text>
+ <Text style={tw("w-2/12 text-right")}>Qty</Text>
+ {hasTrackedEntities && (
+ <Text style={tw("w-5/12 text-right")}>Serial/Batch</Text>
+ )}
+ </View>
+
+ {/* Rows */}
+ {shipmentLines
+ .filter((line) => line.shippedQuantity > 0)
+ .map((line) => {
+ const barcodeDataUrl = generateBarcode(line.itemReadableId);
+ const trackedEntitiesForLine = trackedEntities.filter(
+ (entity) =>
+ (entity.attributes as TrackedEntityAttributes)?.[
+ "Shipment Line"
+ ] === line.id
+ );
+ const isEven = rowIndex % 2 === 0;
+ rowIndex++;
- {shipmentLines
- .filter((line) => line.shippedQuantity > 0)
- .map((line) => {
- const barcodeDataUrl = generateBarcode(line.itemReadableId);
- const trackedEntitiesForLine = trackedEntities.filter(
- (entity) =>
- (entity.attributes as TrackedEntityAttributes)?.[
- "Shipment Line"
- ] === line.id
- );
- return (
+ return (
+ <View
+ key={line.id}
+ style={tw(
+ `flex flex-row py-2 px-3 border-b border-gray-200 text-[10px] ${
+ isEven ? "bg-white" : "bg-gray-50"
+ }`
+ )}
+ wrap={false}
+ >
<View
style={tw(
- "flex flex-row justify-between py-3 px-[6px] border-b border-gray-300 page-break-inside-avoid"
+ `w-${hasTrackedEntities ? "5/12" : "7/12"} pr-2`
)}
- key={line.id}
- wrap={false}
>
- <View style={tw(`w-${hasTrackedEntities ? "7/12" : "9/12"}`)}>
- <Text style={tw("font-bold mb-1")}>
- {getLineDescription(line)}
- </Text>
- <Text style={tw("text-[9px] opacity-80 mb-2")}>
- {getLineDescriptionDetails(line)}
- </Text>
+ <Text style={tw("text-gray-800")}>
+ {getLineDescription(line)}
+ </Text>
+ <Text style={tw("text-[8px] text-gray-400 mt-0.5")}>
+ {getLineDescriptionDetails(line)}
+ </Text>
- {thumbnails &&
- line.id in thumbnails &&
- thumbnails[line.id] && (
- <View style={tw("mt-2 mb-2")}>
+ {thumbnails &&
+ line.id in thumbnails &&
+ thumbnails[line.id] && (
+ <View style={tw("mt-1 w-16")}>
+ <Image
+ src={thumbnails[line.id]!}
+ style={tw("w-full h-auto")}
+ />
+ </View>
+ )}
+
+ <View style={tw("mt-1")}>
+ <Image
+ src={barcodeDataUrl}
+ style={tw("max-w-[50%]")}
+ />
+ </View>
+ </View>
+ <Text style={tw("w-2/12 text-right text-gray-600")}>
+ {getLineQuantity(line)}
+ </Text>
+ {hasTrackedEntities && (
+ <View style={tw("w-5/12 flex flex-col gap-1 items-end")}>
+ {trackedEntitiesForLine.map((entity) => {
+ const qrCodeDataUrl = generateQRCode(entity.id, 8);
+ return (
+ <View
+ key={entity.id}
+ style={tw("mb-1 flex flex-row items-center gap-1")}
+ >
+ <Text style={tw("text-[8px] text-gray-600")}>
+ {entity.id}
+ </Text>
<Image
- src={thumbnails[line.id]!}
- style={tw("w-1/4 h-auto max-w-[25%]")}
+ src={qrCodeDataUrl}
+ style={{ width: 24, height: 24 }}
/>
</View>
- )}
-
- <Image src={barcodeDataUrl} style={tw("max-w-[50%]")} />
+ );
+ })}
</View>
- <Text
- style={tw(
- `w-${hasTrackedEntities ? "1/6" : "3/12"} text-center`
- )}
- >
- {getLineQuantity(line)}
- </Text>
- {hasTrackedEntities && (
- <View style={tw("flex flex-col gap-2 w-1/4 text-right")}>
- {trackedEntitiesForLine.length > 0 && (
- <View>
- {trackedEntitiesForLine.map((entity) => {
- const qrCodeDataUrl = generateQRCode(entity.id, 8);
- return (
- <View
- key={entity.id}
- style={tw("mb-2 text-right")}
- >
- <Text style={tw("text-[8px] mb-1")}>
- {entity.id}
- </Text>
- <Image
- src={qrCodeDataUrl}
- style={tw("max-w-[80%] ml-auto")}
- />
- </View>
- );
- })}
- </View>
- )}
- </View>
- )}
- </View>
- );
- })}
- </View>
+ )}
+ </View>
+ );
+ })}
+ </View>
- {/* Notes and Terms Section */}
- <View style={tw("flex flex-col gap-4 w-full")}>
+ {/* Notes & Terms */}
+ <View style={tw("flex flex-col gap-3 w-full")}>
+ {Object.keys(shipment.externalNotes ?? {}).length > 0 && (
<Note
title="Notes"
content={(shipment.externalNotes ?? {}) as JSONContent}
/>
- <Note title="Standard Terms & Conditions" content={terms} />
- </View>
+ )}
+ <Note title="Standard Terms & Conditions" content={terms} />
</View>
</Template>
);
diff --git a/packages/documents/src/pdf/PurchaseOrderPDF.tsx b/packages/documents/src/pdf/PurchaseOrderPDF.tsx
index ec11cee34f..366f1c3d0f 100644
--- a/packages/documents/src/pdf/PurchaseOrderPDF.tsx
+++ b/packages/documents/src/pdf/PurchaseOrderPDF.tsx
@@ -11,7 +11,7 @@ import {
getTotal
} from "../utils/purchase-order";
import { getCurrencyFormatter } from "../utils/shared";
-import { Note, Template } from "./components";
+import { Header, Note, Template } from "./components";
interface PurchaseOrderPDFProps extends PDF {
purchaseOrder: Database["public"]["Views"]["purchaseOrders"]["Row"];
@@ -112,45 +112,11 @@ const PurchaseOrderPDF = ({
subject: meta?.subject ?? "Purchase Order"
}}
>
- {/* Header */}
- <View style={tw("flex flex-row justify-between mb-1")}>
- <View style={tw("flex flex-col")}>
- {company.logoLightIcon && (
- <Image
- src={company.logoLightIcon}
- style={{ height: 50, width: 50, marginBottom: 4 }}
- />
- )}
- <Text style={tw("text-xl font-bold text-gray-800")}>
- {company.name}
- </Text>
- <View style={tw("text-[10px] text-gray-600 mt-0.5")}>
- {company.addressLine1 && <Text>{company.addressLine1}</Text>}
- {(company.city || company.stateProvince || company.postalCode) && (
- <Text>
- {formatCityStatePostalCode(
- company.city,
- company.stateProvince,
- company.postalCode
- )}
- </Text>
- )}
- {company.phone && <Text>{company.phone}</Text>}
- {company.website && <Text>{company.website}</Text>}
- </View>
- </View>
- <View style={tw("flex flex-col items-end")}>
- <Text style={tw("text-2xl font-bold text-gray-800")}>
- PURCHASE ORDER
- </Text>
- <Text style={tw("text-sm font-bold text-gray-600")}>
- #{purchaseOrder?.purchaseOrderId}
- </Text>
- </View>
- </View>
-
- {/* Gray Divider */}
- <View style={tw("h-[2px] bg-gray-200 mb-4")} />
+ <Header
+ company={company}
+ title="Purchase Order"
+ documentId={purchaseOrder?.purchaseOrderId}
+ />
{/* Supplier & Ship To Details */}
<View style={tw("border border-gray-200 mb-4")}>
@@ -395,7 +361,7 @@ const PurchaseOrderPDF = ({
</View>
)}
- <View style={tw("h-[2px] bg-gray-400")} />
+ <View style={tw("h-[1px] bg-gray-200")} />
<View style={tw("flex flex-row py-2 px-3 text-[11px]")}>
<View style={tw("w-4/6")} />
<Text style={tw("w-1/6 text-right text-gray-800 font-bold")}>
diff --git a/packages/documents/src/pdf/QuotePDF.tsx b/packages/documents/src/pdf/QuotePDF.tsx
index 85d5a2b2fd..ad386fabb2 100644
--- a/packages/documents/src/pdf/QuotePDF.tsx
+++ b/packages/documents/src/pdf/QuotePDF.tsx
@@ -7,7 +7,7 @@ import { createTw } from "react-pdf-tailwind";
import type { PDF } from "../types";
import { getLineDescription, getLineDescriptionDetails } from "../utils/quote";
import { getCurrencyFormatter } from "../utils/shared";
-import { Note, Template } from "./components";
+import { Header, Note, Template } from "./components";
interface QuotePDFProps extends PDF {
exchangeRate: number;
@@ -208,43 +208,11 @@ const QuotePDF = ({
subject: meta?.subject ?? "Quote"
}}
>
- {/* Header */}
- <View style={tw("flex flex-row justify-between mb-1")}>
- <View style={tw("flex flex-col")}>
- {company.logoLightIcon && (
- <Image
- src={company.logoLightIcon}
- style={{ height: 50, width: 50, marginBottom: 4 }}
- />
- )}
- <Text style={tw("text-xl font-bold text-gray-800")}>
- {company.name}
- </Text>
- <View style={tw("text-[10px] text-gray-600 mt-0.5")}>
- {company.addressLine1 && <Text>{company.addressLine1}</Text>}
- {(company.city || company.stateProvince || company.postalCode) && (
- <Text>
- {formatCityStatePostalCode(
- company.city,
- company.stateProvince,
- company.postalCode
- )}
- </Text>
- )}
- {company.phone && <Text>{company.phone}</Text>}
- {company.website && <Text>{company.website}</Text>}
- </View>
- </View>
- <View style={tw("flex flex-col items-end")}>
- <Text style={tw("text-2xl font-bold text-gray-800")}>QUOTE</Text>
- <Text style={tw("text-sm font-bold text-gray-600")}>
- #{quote?.quoteId}
- </Text>
- </View>
- </View>
-
- {/* Blue Divider */}
- <View style={tw("h-[2px] bg-gray-200 mb-4")} />
+ <Header
+ company={company}
+ title="Quote"
+ documentId={quote?.quoteId}
+ />
{/* Customer & Quote Details */}
<View style={tw("border border-gray-200 mb-4")}>
@@ -522,7 +490,7 @@ const QuotePDF = ({
{formatter.format(getTotalTaxes())}
</Text>
</View>
- <View style={tw("h-[2px] bg-gray-400")} />
+ <View style={tw("h-[1px] bg-gray-200")} />
<View style={tw("flex flex-row py-2 px-3 text-[11px]")}>
<View style={tw("w-4/6")} />
<Text style={tw("w-1/6 text-right text-gray-800 font-bold")}>
diff --git a/packages/documents/src/pdf/SalesInvoicePDF.tsx b/packages/documents/src/pdf/SalesInvoicePDF.tsx
index 89c8005c78..f9b0066451 100644
--- a/packages/documents/src/pdf/SalesInvoicePDF.tsx
+++ b/packages/documents/src/pdf/SalesInvoicePDF.tsx
@@ -12,7 +12,7 @@ import {
getTotal
} from "../utils/sales-invoice";
import { getCurrencyFormatter } from "../utils/shared";
-import { Note, Template } from "./components";
+import { Header, Note, Template } from "./components";
interface SalesInvoicePDFProps extends PDF {
salesInvoice: Database["public"]["Views"]["salesInvoices"]["Row"];
@@ -111,43 +111,11 @@ const SalesInvoicePDF = ({
subject: meta?.subject ?? "Invoice"
}}
>
- {/* Header */}
- <View style={tw("flex flex-row justify-between mb-1")}>
- <View style={tw("flex flex-col")}>
- {company.logoLightIcon && (
- <Image
- src={company.logoLightIcon}
- style={{ height: 50, width: 50, marginBottom: 4 }}
- />
- )}
- <Text style={tw("text-xl font-bold text-gray-800")}>
- {company.name}
- </Text>
- <View style={tw("text-[10px] text-gray-600 mt-0.5")}>
- {company.addressLine1 && <Text>{company.addressLine1}</Text>}
- {(company.city || company.stateProvince || company.postalCode) && (
- <Text>
- {formatCityStatePostalCode(
- company.city,
- company.stateProvince,
- company.postalCode
- )}
- </Text>
- )}
- {company.phone && <Text>{company.phone}</Text>}
- {company.website && <Text>{company.website}</Text>}
- </View>
- </View>
- <View style={tw("flex flex-col items-end")}>
- <Text style={tw("text-2xl font-bold text-gray-800")}>INVOICE</Text>
- <Text style={tw("text-sm font-bold text-gray-600")}>
- #{salesInvoice?.invoiceId}
- </Text>
- </View>
- </View>
-
- {/* Divider */}
- <View style={tw("h-[2px] bg-gray-200 mb-4")} />
+ <Header
+ company={company}
+ title="Invoice"
+ documentId={salesInvoice?.invoiceId}
+ />
{/* Ship To & Bill To */}
<View style={tw("border border-gray-200 mb-4")}>
@@ -372,7 +340,7 @@ const SalesInvoicePDF = ({
</View>
)}
- <View style={tw("h-[2px] bg-gray-400")} />
+ <View style={tw("h-[1px] bg-gray-200")} />
<View style={tw("flex flex-row py-2 px-3 text-[11px]")}>
<View style={tw("w-4/6")} />
<Text style={tw("w-1/6 text-right text-gray-800 font-bold")}>
diff --git a/packages/documents/src/pdf/SalesOrderPDF.tsx b/packages/documents/src/pdf/SalesOrderPDF.tsx
index ad1a3ae148..3c14c4ecca 100644
--- a/packages/documents/src/pdf/SalesOrderPDF.tsx
+++ b/packages/documents/src/pdf/SalesOrderPDF.tsx
@@ -12,7 +12,7 @@ import {
getTotal
} from "../utils/sales-order";
import { getCurrencyFormatter } from "../utils/shared";
-import { Note, Template } from "./components";
+import { Header, Note, Template } from "./components";
interface SalesOrderPDFProps extends PDF {
salesOrder: Database["public"]["Views"]["salesOrders"]["Row"];
@@ -109,45 +109,11 @@ const SalesOrderPDF = ({
subject: meta?.subject ?? "Sales Order"
}}
>
- {/* Header */}
- <View style={tw("flex flex-row justify-between mb-1")}>
- <View style={tw("flex flex-col")}>
- {company.logoLightIcon && (
- <Image
- src={company.logoLightIcon}
- style={{ height: 50, width: 50, marginBottom: 4 }}
- />
- )}
- <Text style={tw("text-xl font-bold text-gray-800")}>
- {company.name}
- </Text>
- <View style={tw("text-[10px] text-gray-600 mt-0.5")}>
- {company.addressLine1 && <Text>{company.addressLine1}</Text>}
- {(company.city || company.stateProvince || company.postalCode) && (
- <Text>
- {formatCityStatePostalCode(
- company.city,
- company.stateProvince,
- company.postalCode
- )}
- </Text>
- )}
- {company.phone && <Text>{company.phone}</Text>}
- {company.website && <Text>{company.website}</Text>}
- </View>
- </View>
- <View style={tw("flex flex-col items-end")}>
- <Text style={tw("text-2xl font-bold text-gray-800")}>
- SALES ORDER
- </Text>
- <Text style={tw("text-sm font-bold text-gray-600")}>
- #{salesOrder?.salesOrderId}
- </Text>
- </View>
- </View>
-
- {/* Divider */}
- <View style={tw("h-[2px] bg-gray-200 mb-4")} />
+ <Header
+ company={company}
+ title="Sales Order"
+ documentId={salesOrder?.salesOrderId}
+ />
{/* Ship To & Bill To */}
<View style={tw("border border-gray-200 mb-4")}>
@@ -376,7 +342,7 @@ const SalesOrderPDF = ({
</View>
)}
- <View style={tw("h-[2px] bg-gray-400")} />
+ <View style={tw("h-[1px] bg-gray-200")} />
<View style={tw("flex flex-row py-2 px-3 text-[11px]")}>
<View style={tw("w-4/6")} />
<Text style={tw("w-1/6 text-right text-gray-800 font-bold")}>
diff --git a/packages/documents/src/pdf/StockTransferPDF.tsx b/packages/documents/src/pdf/StockTransferPDF.tsx
index 4f8829670e..1d9dc2dc91 100644
--- a/packages/documents/src/pdf/StockTransferPDF.tsx
+++ b/packages/documents/src/pdf/StockTransferPDF.tsx
@@ -18,12 +18,17 @@ interface StockTransferPDFProps extends PDF {
const tw = createTw({
theme: {
fontFamily: {
- sans: ["Helvetica", "Arial", "sans-serif"]
+ sans: ["Inter", "Helvetica", "Arial", "sans-serif"]
},
extend: {
colors: {
gray: {
- 500: "#7d7d7d"
+ 50: "#f9fafb",
+ 200: "#e5e7eb",
+ 400: "#9ca3af",
+ 500: "#7d7d7d",
+ 600: "#4b5563",
+ 800: "#1f2937"
}
}
}
@@ -74,7 +79,7 @@ const StockTransferPDF = ({
<View style={tw("flex flex-col")}>
{/* Header Section - Always at the top */}
<View style={tw("mb-4")}>
- <Header title={title} company={company} />
+ <Header company={company} title={title} />
<Summary company={company} items={details} />
</View>
@@ -82,7 +87,7 @@ const StockTransferPDF = ({
<View style={tw("mb-6 text-xs")}>
<View
style={tw(
- "flex flex-row justify-between items-center mt-5 py-3 px-[6px] border-t border-b border-gray-300 font-bold uppercase page-break-inside-avoid"
+ "flex flex-row bg-gray-800 py-2 px-3 text-white text-[9px] font-bold"
)}
>
<Text style={tw("w-2/5 text-left")}>Description</Text>
@@ -110,7 +115,7 @@ const StockTransferPDF = ({
return (
<View
style={tw(
- "flex flex-row justify-between py-3 px-[6px] border-b border-gray-300 page-break-inside-avoid"
+ "flex flex-row justify-between py-2 px-3 border-b border-gray-200 text-[10px]"
)}
key={line.id}
wrap={false}
diff --git a/packages/documents/src/pdf/components/Header.tsx b/packages/documents/src/pdf/components/Header.tsx
index 12e20844f2..2e99405098 100644
--- a/packages/documents/src/pdf/components/Header.tsx
+++ b/packages/documents/src/pdf/components/Header.tsx
@@ -1,107 +1,92 @@
-import { Image, StyleSheet, Text, View } from "@react-pdf/renderer";
+import { formatCityStatePostalCode } from "@carbon/utils";
+import { Image, Text, View } from "@react-pdf/renderer";
+import { createTw } from "react-pdf-tailwind";
import type { Company } from "../../types";
type HeaderProps = {
company: Company;
title: string;
- subtitle?: string;
- tertiaryTitle?: string;
+ documentId?: string | null;
};
-const styles = StyleSheet.create({
- header: {
- fontSize: 11,
- display: "flex",
- flexDirection: "row-reverse",
- justifyContent: "space-between",
- alignItems: "flex-start",
- marginBottom: 20
- },
- logo: {
- height: 50
- },
- titleWithoutSubtitle: {
- height: 50,
- fontSize: 20,
- letterSpacing: -1,
- fontWeight: 700
- },
- title: {
- fontSize: 20,
- letterSpacing: -1,
- fontWeight: 700
- },
- subtitle: {
- fontSize: 18,
- fontWeight: 500,
- color: "gray"
- },
- tertiaryTitle: {
- fontSize: 12,
- fontWeight: 400,
- color: "gray"
- },
- jobHeader: {
- fontSize: 10,
- display: "flex",
- flexDirection: "row",
- justifyContent: "space-between",
- alignItems: "flex-start",
- marginBottom: 20,
- gap: 20
- },
- leftSection: {
- flex: 1
- },
- rightSection: {
- flex: 1
- },
- infoRow: {
- display: "flex",
- flexDirection: "row",
- justifyContent: "space-between",
- marginBottom: 4
- },
- label: {
- fontSize: 9,
- fontWeight: 600,
- color: "#374151"
- },
- value: {
- fontSize: 9,
- fontWeight: 400,
- color: "#111827"
- },
- sectionTitle: {
- fontSize: 11,
- fontWeight: 700,
- marginBottom: 8,
- color: "#111827",
- borderBottom: "1px solid #d1d5db",
- paddingBottom: 2
+const tw = createTw({
+ theme: {
+ fontFamily: {
+ sans: ["Inter", "Helvetica", "Arial", "sans-serif"]
+ },
+ extend: {
+ colors: {
+ gray: {
+ 50: "#f9fafb",
+ 200: "#e5e7eb",
+ 400: "#9ca3af",
+ 600: "#4b5563",
+ 800: "#1f2937"
+ }
+ }
+ }
}
});
-const Header = ({ title, subtitle, tertiaryTitle, company }: HeaderProps) => {
+const Header = ({ company, title, documentId }: HeaderProps) => {
return (
- <View style={styles.header}>
- <View>
- {company.logoLightIcon && (
- <View>
- <Image src={company.logoLightIcon} style={styles.logo} />
+ <>
+ <View style={tw("flex flex-row justify-between mb-1")}>
+ <View style={tw("flex flex-col flex-1")}>
+ {company.logoLightIcon ? (
+ <Image
+ src={company.logoLightIcon}
+ style={{ height: 50, width: 50, marginBottom: 4 }}
+ />
+ ) : (
+ <View>
+ <Text
+ style={tw("text-2xl font-bold text-gray-800 tracking-tight")}
+ >
+ {company.name}
+ </Text>
+ </View>
+ )}
+
+ <View
+ style={tw(
+ "text-[10px] text-gray-600 {company.logoLightIcon ? 'mt-0.5' : '-mt-2'}"
+ )}
+ >
+ {company.logoLightIcon && company.name && (
+ <Text style={tw("font-semibold text-black")}>{company.name}</Text>
+ )}
+ {company.addressLine1 && <Text>{company.addressLine1}</Text>}
+ {(company.city || company.stateProvince || company.postalCode) && (
+ <Text>
+ {formatCityStatePostalCode(
+ company.city,
+ company.stateProvince,
+ company.postalCode
+ )}
+ </Text>
+ )}
+ {company.phone && <Text>{company.phone}</Text>}
+ {company.website && <Text>{company.website}</Text>}
</View>
- )}
- </View>
- <View>
- <Text style={subtitle ? styles.title : styles.titleWithoutSubtitle}>
- {title}
- </Text>
- {subtitle && <Text style={styles.subtitle}>{subtitle}</Text>}
- {tertiaryTitle && (
- <Text style={styles.tertiaryTitle}>{tertiaryTitle}</Text>
- )}
+ </View>
+ <View style={tw("flex flex-col items-end justify-start")}>
+ <Text style={tw("text-2xl font-bold text-gray-800 tracking-tight")}>
+ {title}
+ </Text>
+ {documentId && (
+ <Text
+ style={tw("text-sm font-bold text-gray-600 tracking-tight -mt-4")}
+ >
+ #{documentId}
+ </Text>
+ )}
+ </View>
</View>
- </View>
+
+ {/* Divider */}
+ <View style={tw("h-[1px] bg-gray-200 mb-4")} />
+ </>
);
};
diff --git a/packages/documents/src/pdf/components/index.ts b/packages/documents/src/pdf/components/index.ts
index 4cf9e726a8..a5e9be1656 100644
--- a/packages/documents/src/pdf/components/index.ts
+++ b/packages/documents/src/pdf/components/index.ts
@@ -1,7 +1,7 @@
import Footer from "./Footer";
-import { Header, JobHeader } from "./Header";
+import { Header } from "./Header";
import Note from "./Note";
import Summary from "./Summary";
import Template from "./Template";
-export { Footer, Header, JobHeader, Note, Summary, Template };
+export { Footer, Header, Note, Summary, Template };