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.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
feat: add external notes to quote, sales order, and rfq lines
Brad Barbind67fa5ce91a7
diff --git a/apps/carbon/app/modules/sales/ui/Opportunity/OpportunityLineNotes.tsx b/apps/carbon/app/modules/sales/ui/Opportunity/OpportunityLineNotes.tsxindex 9e456a2686..f786162331 100644--- a/apps/carbon/app/modules/sales/ui/Opportunity/OpportunityLineNotes.tsx+++ b/apps/carbon/app/modules/sales/ui/Opportunity/OpportunityLineNotes.tsx@@ -2,10 +2,16 @@ import { useCarbon } from "@carbon/auth";import type { JSONContent } from "@carbon/react";import {Card,+ CardAction,CardContent,CardDescription,CardHeader,CardTitle,+ HStack,+ Tabs,+ TabsContent,+ TabsList,+ TabsTrigger,toast,useDebounce,} from "@carbon/react";@@ -21,13 +27,15 @@ const OpportunityLineNotes = ({table,title,subTitle,- notes: initialNotes,+ internalNotes: initialInternalNotes,+ externalNotes: initialExternalNotes,}: {id: string | null;table: "salesRfqLine" | "quoteLine" | "salesOrderLine";title: string;subTitle: string;- notes?: JSONContent;+ internalNotes?: JSONContent;+ externalNotes?: JSONContent;}) => {const {id: userId,@@ -35,8 +43,13 @@ const OpportunityLineNotes = ({} = useUser();const { carbon } = useCarbon();const permissions = usePermissions();-- const [notes, setInternalNotes] = useState(initialNotes ?? {});+ const [tab, setTab] = useState("internal");+ const [internalNotes, setInternalNotes] = useState(+ initialInternalNotes ?? {}+ );+ const [externalNotes, setExternalNotes] = useState(+ initialExternalNotes ?? {}+ );const onUploadImage = async (file: File) => {const fileType = file.name.split(".").pop();@@ -56,12 +69,27 @@ const OpportunityLineNotes = ({return getPrivateUrl(result.data.path);};+ const onUpdateExternalNotes = useDebounce(+ async (content: JSONContent) => {+ await carbon+ ?.from(table)+ .update({+ externalNotes: content,+ updatedAt: today(getLocalTimeZone()).toString(),+ updatedBy: userId,+ })+ .eq("id", id!);+ },+ 2500,+ true+ );+const onUpdateInternalNotes = useDebounce(async (content: JSONContent) => {await carbon?.from(table).update({- [table === "salesRfqLine" ? "internalNotes" : "notes"]: content,+ internalNotes: content,updatedAt: today(getLocalTimeZone()).toString(),updatedBy: userId,})@@ -76,30 +104,63 @@ const OpportunityLineNotes = ({return (<><Card>- <CardHeader>- <CardTitle>{title}</CardTitle>- <CardDescription>{subTitle}</CardDescription>- </CardHeader>-- <CardContent>- {permissions.can("update", "sales") ? (- <Editor- initialValue={(notes ?? {}) as JSONContent}- onUpload={onUploadImage}- onChange={(value) => {- setInternalNotes(value);- onUpdateInternalNotes(value);- }}- />- ) : (- <div- className="prose dark:prose-invert"- dangerouslySetInnerHTML={{- __html: generateHTML(notes as JSONContent),- }}- />- )}- </CardContent>+ <Tabs value={tab} onValueChange={setTab}>+ <HStack className="w-full justify-between">+ <CardHeader>+ <CardTitle>{title}</CardTitle>+ <CardDescription>+ {subTitle} -{" "}+ {tab === "internal" ? "Internal Notes" : "External Notes"}+ </CardDescription>+ </CardHeader>+ <CardAction>+ <TabsList>+ <TabsTrigger value="internal">Internal</TabsTrigger>+ <TabsTrigger value="external">External</TabsTrigger>+ </TabsList>+ </CardAction>+ </HStack>+ <CardContent>+ <TabsContent value="internal">+ {permissions.can("update", "sales") ? (+ <Editor+ initialValue={(internalNotes ?? {}) as JSONContent}+ onUpload={onUploadImage}+ onChange={(value) => {+ setInternalNotes(value);+ onUpdateInternalNotes(value);+ }}+ />+ ) : (+ <div+ className="prose dark:prose-invert"+ dangerouslySetInnerHTML={{+ __html: generateHTML(internalNotes as JSONContent),+ }}+ />+ )}+ </TabsContent>+ <TabsContent value="external">+ {permissions.can("update", "sales") ? (+ <Editor+ initialValue={(externalNotes ?? {}) as JSONContent}+ onUpload={onUploadImage}+ onChange={(value) => {+ setExternalNotes(value);+ onUpdateExternalNotes(value);+ }}+ />+ ) : (+ <div+ className="prose dark:prose-invert"+ dangerouslySetInnerHTML={{+ __html: generateHTML(externalNotes as JSONContent),+ }}+ />+ )}+ </TabsContent>+ </CardContent>+ </Tabs></Card></>);diff --git a/apps/carbon/app/modules/sales/ui/SalesRFQ/SalesRFQHeader.tsx b/apps/carbon/app/modules/sales/ui/SalesRFQ/SalesRFQHeader.tsxindex 9b0044b6ac..5cf0918500 100644--- a/apps/carbon/app/modules/sales/ui/SalesRFQ/SalesRFQHeader.tsx+++ b/apps/carbon/app/modules/sales/ui/SalesRFQ/SalesRFQHeader.tsx@@ -164,7 +164,7 @@ const SalesRFQHeader = () => {{routeData?.opportunity?.quoteId === null ? (<ButtonisDisabled={- !["Ready for Quote", "Closed"].includes(status) ||+ !["Ready for Quote", "Closed", "Quoted"].includes(status) ||statusFetcher.state !== "idle" ||!permissions.can("update", "sales")}diff --git a/apps/carbon/app/routes/share+/quote.$id.tsx b/apps/carbon/app/routes/share+/quote.$id.tsxindex 5341992405..676613e5a2 100644--- a/apps/carbon/app/routes/share+/quote.$id.tsx+++ b/apps/carbon/app/routes/share+/quote.$id.tsx@@ -301,7 +301,10 @@ export async function loader({ params, request }: LoaderFunctionArgs) {quote: quote.data,company: company.data,companySettings: companySettings.data,- quoteLines: quoteLines.data,+ quoteLines:+ quoteLines.data?.map(({ internalNotes, ...line }) => ({+ ...line,+ })) ?? [],thumbnails: thumbnails,quoteLinePrices: quoteLinePrices.data,customerDetails: customerDetails.data,@@ -426,7 +429,6 @@ const LineItems = ({? quoteLines.map((line) => line.id!).filter(Boolean): []);-useEffect(() => {Object.entries(selectedLines).forEach(([lineId, line]) => {if (line.quantity === 0 && openItems.includes(lineId)) {@@ -498,14 +500,6 @@ const LineItems = ({<div className="flex items-center gap-x-4 justify-between flex-grow"><Heading>{line.itemReadableId}</Heading><HStack spacing={4}>- {/* <span className="font-medium text-xl">- {formatter.format(- (selectedLines[line.id!]?.convertedNetUnitPrice ??- 0) *- (selectedLines[line.id!]?.quantity ?? 0) +- (selectedLines[line.id!]?.convertedAddOn ?? 0)- )}- </span> */}<MotionNumberclassName="font-bold text-xl"value={@@ -535,6 +529,14 @@ const LineItems = ({<span className="text-muted-foreground text-base truncate">{line.description}</span>+ {Object.keys(line.externalNotes ?? {}).length > 0 && (+ <div+ className="prose dark:prose-invert prose-sm mt-2 text-muted-foreground"+ dangerouslySetInnerHTML={{+ __html: generateHTML(line.externalNotes as JSONContent),+ }}+ />+ )}</div></VStack></HStack>@@ -570,7 +572,7 @@ const LineItems = ({};type LinePricingOptionsProps = {- line: QuotationLine;+ line: Omit<QuotationLine, "internalNotes">;options: QuotationPrice[];quoteCurrency: string;shouldConvertCurrency: boolean;@@ -860,7 +862,7 @@ const LinePricingOptions = ({{selectedLine.quantity !== 0 && !hasSalesOrder && (<HStack spacing={2} className="w-full justify-end items-center"><Button- variant="secondary"+ variant="primary"leftIcon={<LuXCircle />}onClick={() => {setSelectedValue("0");diff --git a/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.details.tsx b/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.details.tsxindex f01c92bc19..70e94f28cb 100644--- a/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.details.tsx+++ b/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.details.tsx@@ -185,7 +185,8 @@ export default function QuoteLine() {table="quoteLine"title="Notes"subTitle={line.itemReadableId ?? ""}- notes={line.notes as JSONContent}+ internalNotes={line.internalNotes as JSONContent}+ externalNotes={line.externalNotes as JSONContent}/><div className="grid grid-cols-1 2xl:grid-cols-2 w-full flex-grow gap-2 "><Suspensediff --git a/apps/carbon/app/routes/x+/sales-order+/$orderId.$lineId.details.tsx b/apps/carbon/app/routes/x+/sales-order+/$orderId.$lineId.details.tsxindex 4bf775ec9d..6ea2c68b90 100644--- a/apps/carbon/app/routes/x+/sales-order+/$orderId.$lineId.details.tsx+++ b/apps/carbon/app/routes/x+/sales-order+/$orderId.$lineId.details.tsx@@ -210,7 +210,8 @@ export default function EditSalesOrderLineRoute() {table="salesOrderLine"title="Notes"subTitle={line.itemReadableId ?? ""}- notes={line.notes as JSONContent}+ internalNotes={line.internalNotes as JSONContent}+ externalNotes={line.externalNotes as JSONContent}/><div className="grid grid-cols-1 2xl:grid-cols-2 w-full flex-grow gap-2 "><Suspensediff --git a/apps/carbon/app/routes/x+/sales-rfq+/$rfqId.$lineId.details.tsx b/apps/carbon/app/routes/x+/sales-rfq+/$rfqId.$lineId.details.tsxindex bea8ef510a..9060b736d0 100644--- a/apps/carbon/app/routes/x+/sales-rfq+/$rfqId.$lineId.details.tsx+++ b/apps/carbon/app/routes/x+/sales-rfq+/$rfqId.$lineId.details.tsx@@ -121,7 +121,8 @@ export default function SalesRFQLine() {table="salesRfqLine"title="Notes"subTitle={line.customerPartId ?? ""}- notes={line.internalNotes as JSONContent}+ internalNotes={line.internalNotes as JSONContent}+ externalNotes={line.externalNotes as JSONContent}/><div className="grid grid-cols-1 2xl:grid-cols-2 w-full flex-grow gap-2 "><Suspensediff --git a/packages/database/src/types.ts b/packages/database/src/types.tsindex b4372a54c6..fe6599d1f7 100644--- a/packages/database/src/types.ts+++ b/packages/database/src/types.ts@@ -14990,7 +14990,9 @@ export type Database = {customFields: Json | nulldescription: stringestimatorId: string | null+ externalNotes: Json | nullid: string+ internalNotes: Json | nullitemId: stringitemReadableId: string | nullitemType: string@@ -14998,7 +15000,6 @@ export type Database = {methodType: Database["public"]["Enums"]["methodType"]modelUploadId: string | nullnoQuoteReason: string | null- notes: Json | nullquantity: number[] | nullquoteId: stringquoteRevisionId: number@@ -15018,7 +15019,9 @@ export type Database = {customFields?: Json | nulldescription: stringestimatorId?: string | null+ externalNotes?: Json | nullid?: string+ internalNotes?: Json | nullitemId: stringitemReadableId?: string | nullitemType?: string@@ -15026,7 +15029,6 @@ export type Database = {methodType?: Database["public"]["Enums"]["methodType"]modelUploadId?: string | nullnoQuoteReason?: string | null- notes?: Json | nullquantity?: number[] | nullquoteId: stringquoteRevisionId?: number@@ -15046,7 +15048,9 @@ export type Database = {customFields?: Json | nulldescription?: stringestimatorId?: string | null+ externalNotes?: Json | nullid?: string+ internalNotes?: Json | nullitemId?: stringitemReadableId?: string | nullitemType?: string@@ -15054,7 +15058,6 @@ export type Database = {methodType?: Database["public"]["Enums"]["methodType"]modelUploadId?: string | nullnoQuoteReason?: string | null- notes?: Json | nullquantity?: number[] | nullquoteId?: stringquoteRevisionId?: number@@ -17434,14 +17437,15 @@ export type Database = {customFields: Json | nulldescription: string | nullexchangeRate: number | null+ externalNotes: Json | nullid: string+ internalNotes: Json | nullinvoicedComplete: booleanitemId: string | nullitemReadableId: string | nulllocationId: string | nullmethodType: Database["public"]["Enums"]["methodType"]modelUploadId: string | null- notes: Json | nullpromisedDate: string | nullquantityInvoiced: number | nullquantitySent: number | null@@ -17475,14 +17479,15 @@ export type Database = {customFields?: Json | nulldescription?: string | nullexchangeRate?: number | null+ externalNotes?: Json | nullid?: string+ internalNotes?: Json | nullinvoicedComplete?: booleanitemId?: string | nullitemReadableId?: string | nulllocationId?: string | nullmethodType?: Database["public"]["Enums"]["methodType"]modelUploadId?: string | null- notes?: Json | nullpromisedDate?: string | nullquantityInvoiced?: number | nullquantitySent?: number | null@@ -17516,14 +17521,15 @@ export type Database = {customFields?: Json | nulldescription?: string | nullexchangeRate?: number | null+ externalNotes?: Json | nullid?: string+ internalNotes?: Json | nullinvoicedComplete?: booleanitemId?: string | nullitemReadableId?: string | nulllocationId?: string | nullmethodType?: Database["public"]["Enums"]["methodType"]modelUploadId?: string | null- notes?: Json | nullpromisedDate?: string | nullquantityInvoiced?: number | nullquantitySent?: number | null@@ -27419,14 +27425,14 @@ export type Database = {Relationships: [{foreignKeyName: "address_countryCode_fkey"- columns: ["customerCountryCode"]+ columns: ["supplierCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["alpha2"]},{foreignKeyName: "address_countryCode_fkey"- columns: ["supplierCountryCode"]+ columns: ["customerCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["alpha2"]@@ -27767,7 +27773,9 @@ export type Database = {customFields: Json | nulldescription: string | nullestimatorId: string | null+ externalNotes: Json | nullid: string | null+ internalNotes: Json | nullitemId: string | nullitemReadableId: string | nullitemType: string | null@@ -27779,11 +27787,11 @@ export type Database = {modelSize: number | nullmodelUploadId: string | nullnoQuoteReason: string | null- notes: Json | nullquantity: number[] | nullquoteId: string | nullquoteRevisionId: number | nullstatus: Database["public"]["Enums"]["quoteLineStatus"] | null+ tags: string[] | nulltaxPercent: number | nullthumbnailPath: string | nullunitCost: number | null@@ -29014,7 +29022,9 @@ export type Database = {customFields: Json | nulldescription: string | nullexchangeRate: number | null+ externalNotes: Json | nullid: string | null+ internalNotes: Json | nullinvoicedComplete: boolean | nullitemId: string | nullitemReadableId: string | null@@ -29025,7 +29035,6 @@ export type Database = {modelPath: string | nullmodelSize: number | nullmodelUploadId: string | null- notes: Json | nullpromisedDate: string | nullquantityInvoiced: number | nullquantitySent: number | null@@ -29202,14 +29211,14 @@ export type Database = {Relationships: [{foreignKeyName: "address_countryCode_fkey"- columns: ["customerCountryCode"]+ columns: ["paymentCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["alpha2"]},{foreignKeyName: "address_countryCode_fkey"- columns: ["paymentCountryCode"]+ columns: ["customerCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["alpha2"]@@ -29510,6 +29519,7 @@ export type Database = {order: number | nullquantity: number[] | nullsalesRfqId: string | null+ tags: string[] | nullthumbnailPath: string | nullunitOfMeasureCode: string | nullupdatedAt: string | nulldiff --git a/packages/database/supabase/functions/convert/index.ts b/packages/database/supabase/functions/convert/index.tsindex e02be64038..26d2678421 100644--- a/packages/database/supabase/functions/convert/index.ts+++ b/packages/database/supabase/functions/convert/index.ts@@ -193,7 +193,8 @@ serve(async (req: Request) => {itemReadableId: line.itemReadableId,locationId: line.locationId ?? quote.data.locationId,methodType: line.methodType,- notes: line.notes,+ internalNotes: line.internalNotes,+ externalNotes: line.externalNotes,saleQuantity: selectedLines![line.id!].quantity,status: "Ordered",unitOfMeasureCode: line.unitOfMeasureCode,@@ -547,6 +548,7 @@ serve(async (req: Request) => {.selectAll().where("salesRfqId", "=", id).execute();+const quoteLineInserts: Database["public"]["Tables"]["quoteLine"]["Insert"][] =salesRfqLinesWithItemIds.map((line) => ({id: line.id ?? undefined,@@ -560,7 +562,8 @@ serve(async (req: Request) => {locationId: salesRfq.data?.locationId,methodType: line.methodType!,modelUploadId: line.modelUploadId,- notes: line.internalNotes,+ internalNotes: line.internalNotes,+ externalNotes: line.externalNotes,quantity: line.quantity,status: "Not Started",unitOfMeasureCode: line.unitOfMeasureCode,diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.tsindex b4372a54c6..fe6599d1f7 100644--- a/packages/database/supabase/functions/lib/types.ts+++ b/packages/database/supabase/functions/lib/types.ts@@ -14990,7 +14990,9 @@ export type Database = {customFields: Json | nulldescription: stringestimatorId: string | null+ externalNotes: Json | nullid: string+ internalNotes: Json | nullitemId: stringitemReadableId: string | nullitemType: string@@ -14998,7 +15000,6 @@ export type Database = {methodType: Database["public"]["Enums"]["methodType"]modelUploadId: string | nullnoQuoteReason: string | null- notes: Json | nullquantity: number[] | nullquoteId: stringquoteRevisionId: number@@ -15018,7 +15019,9 @@ export type Database = {customFields?: Json | nulldescription: stringestimatorId?: string | null+ externalNotes?: Json | nullid?: string+ internalNotes?: Json | nullitemId: stringitemReadableId?: string | nullitemType?: string@@ -15026,7 +15029,6 @@ export type Database = {methodType?: Database["public"]["Enums"]["methodType"]modelUploadId?: string | nullnoQuoteReason?: string | null- notes?: Json | nullquantity?: number[] | nullquoteId: stringquoteRevisionId?: number@@ -15046,7 +15048,9 @@ export type Database = {customFields?: Json | nulldescription?: stringestimatorId?: string | null+ externalNotes?: Json | nullid?: string+ internalNotes?: Json | nullitemId?: stringitemReadableId?: string | nullitemType?: string@@ -15054,7 +15058,6 @@ export type Database = {methodType?: Database["public"]["Enums"]["methodType"]modelUploadId?: string | nullnoQuoteReason?: string | null- notes?: Json | nullquantity?: number[] | nullquoteId?: stringquoteRevisionId?: number@@ -17434,14 +17437,15 @@ export type Database = {customFields: Json | nulldescription: string | nullexchangeRate: number | null+ externalNotes: Json | nullid: string+ internalNotes: Json | nullinvoicedComplete: booleanitemId: string | nullitemReadableId: string | nulllocationId: string | nullmethodType: Database["public"]["Enums"]["methodType"]modelUploadId: string | null- notes: Json | nullpromisedDate: string | nullquantityInvoiced: number | nullquantitySent: number | null@@ -17475,14 +17479,15 @@ export type Database = {customFields?: Json | nulldescription?: string | nullexchangeRate?: number | null+ externalNotes?: Json | nullid?: string+ internalNotes?: Json | nullinvoicedComplete?: booleanitemId?: string | nullitemReadableId?: string | nulllocationId?: string | nullmethodType?: Database["public"]["Enums"]["methodType"]modelUploadId?: string | null- notes?: Json | nullpromisedDate?: string | nullquantityInvoiced?: number | nullquantitySent?: number | null@@ -17516,14 +17521,15 @@ export type Database = {customFields?: Json | nulldescription?: string | nullexchangeRate?: number | null+ externalNotes?: Json | nullid?: string+ internalNotes?: Json | nullinvoicedComplete?: booleanitemId?: string | nullitemReadableId?: string | nulllocationId?: string | nullmethodType?: Database["public"]["Enums"]["methodType"]modelUploadId?: string | null- notes?: Json | nullpromisedDate?: string | nullquantityInvoiced?: number | nullquantitySent?: number | null@@ -27419,14 +27425,14 @@ export type Database = {Relationships: [{foreignKeyName: "address_countryCode_fkey"- columns: ["customerCountryCode"]+ columns: ["supplierCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["alpha2"]},{foreignKeyName: "address_countryCode_fkey"- columns: ["supplierCountryCode"]+ columns: ["customerCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["alpha2"]@@ -27767,7 +27773,9 @@ export type Database = {customFields: Json | nulldescription: string | nullestimatorId: string | null+ externalNotes: Json | nullid: string | null+ internalNotes: Json | nullitemId: string | nullitemReadableId: string | nullitemType: string | null@@ -27779,11 +27787,11 @@ export type Database = {modelSize: number | nullmodelUploadId: string | nullnoQuoteReason: string | null- notes: Json | nullquantity: number[] | nullquoteId: string | nullquoteRevisionId: number | nullstatus: Database["public"]["Enums"]["quoteLineStatus"] | null+ tags: string[] | nulltaxPercent: number | nullthumbnailPath: string | nullunitCost: number | null@@ -29014,7 +29022,9 @@ export type Database = {customFields: Json | nulldescription: string | nullexchangeRate: number | null+ externalNotes: Json | nullid: string | null+ internalNotes: Json | nullinvoicedComplete: boolean | nullitemId: string | nullitemReadableId: string | null@@ -29025,7 +29035,6 @@ export type Database = {modelPath: string | nullmodelSize: number | nullmodelUploadId: string | null- notes: Json | nullpromisedDate: string | nullquantityInvoiced: number | nullquantitySent: number | null@@ -29202,14 +29211,14 @@ export type Database = {Relationships: [{foreignKeyName: "address_countryCode_fkey"- columns: ["customerCountryCode"]+ columns: ["paymentCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["alpha2"]},{foreignKeyName: "address_countryCode_fkey"- columns: ["paymentCountryCode"]+ columns: ["customerCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["alpha2"]@@ -29510,6 +29519,7 @@ export type Database = {order: number | nullquantity: number[] | nullsalesRfqId: string | null+ tags: string[] | nullthumbnailPath: string | nullunitOfMeasureCode: string | nullupdatedAt: string | nulldiff --git a/packages/database/supabase/migrations/20241206190113_external-opporutnity-line-notes.sql b/packages/database/supabase/migrations/20241206190113_external-opporutnity-line-notes.sqlnew file mode 100644index 0000000000..1c07e6d739--- /dev/null+++ b/packages/database/supabase/migrations/20241206190113_external-opporutnity-line-notes.sql@@ -0,0 +1,80 @@++DROP VIEW IF EXISTS "quoteLines";+DROP VIEW IF EXISTS "salesOrderLines";++ALTER TABLE "quoteLine" ADD COLUMN "externalNotes" jsonb;+ALTER TABLE "salesOrderLine" ADD COLUMN "externalNotes" jsonb;++ALTER TABLE "quoteLine" RENAME COLUMN "notes" TO "internalNotes";+ALTER TABLE "salesOrderLine" RENAME COLUMN "notes" TO "internalNotes";++-- Update salesRfqLines view+DROP VIEW IF EXISTS "salesRfqLines";+CREATE OR REPLACE VIEW "salesRfqLines" WITH(SECURITY_INVOKER=true) AS+ SELECT+ srl.*,+ mu.id as "modelId",+ mu."autodeskUrn",+ mu."modelPath",+ mu."name" as "modelName",+ mu."size" as "modelSize",+ CASE+ WHEN i."thumbnailPath" IS NULL AND mu."thumbnailPath" IS NOT NULL THEN mu."thumbnailPath"+ ELSE i."thumbnailPath"+ END as "thumbnailPath",+ i."name" as "itemName",+ i."defaultMethodType" AS "methodType",+ i."readableId" AS "itemReadableId",+ i."type" AS "itemType"+ FROM "salesRfqLine" srl+ LEFT JOIN "item" i ON i.id = srl."itemId"+ LEFT JOIN "modelUpload" mu ON mu.id = srl."modelUploadId";++-- Update quoteLines view+DROP VIEW IF EXISTS "quoteLines";+CREATE OR REPLACE VIEW "quoteLines" WITH(SECURITY_INVOKER=true) AS (+ SELECT+ ql.*,+ CASE+ WHEN i."thumbnailPath" IS NULL AND mu."thumbnailPath" IS NOT NULL THEN mu."thumbnailPath"+ WHEN i."thumbnailPath" IS NULL AND imu."thumbnailPath" IS NOT NULL THEN imu."thumbnailPath"+ ELSE i."thumbnailPath"+ END as "thumbnailPath",+ COALESCE(mu.id, imu.id) as "modelId",+ COALESCE(mu."autodeskUrn", imu."autodeskUrn") as "autodeskUrn",+ COALESCE(mu."modelPath", imu."modelPath") as "modelPath",+ COALESCE(mu."name", imu."name") as "modelName",+ COALESCE(mu."size", imu."size") as "modelSize",+ ic."unitCost" as "unitCost"+ FROM "quoteLine" ql+ LEFT JOIN "modelUpload" mu ON ql."modelUploadId" = mu."id"+ INNER JOIN "item" i ON i.id = ql."itemId"+ LEFT JOIN "itemCost" ic ON ic."itemId" = i.id+ LEFT JOIN "modelUpload" imu ON imu.id = i."modelUploadId"+);++DROP VIEW IF EXISTS "salesOrderLines";+CREATE OR REPLACE VIEW "salesOrderLines" WITH(SECURITY_INVOKER=true) AS (+ SELECT+ sl.*,+ CASE+ WHEN i."thumbnailPath" IS NULL AND mu."thumbnailPath" IS NOT NULL THEN mu."thumbnailPath"+ WHEN i."thumbnailPath" IS NULL AND imu."thumbnailPath" IS NOT NULL THEN imu."thumbnailPath"+ ELSE i."thumbnailPath"+ END as "thumbnailPath",+ COALESCE(mu.id, imu.id) as "modelId",+ COALESCE(mu."autodeskUrn", imu."autodeskUrn") as "autodeskUrn",+ COALESCE(mu."modelPath", imu."modelPath") as "modelPath",+ COALESCE(mu."name", imu."name") as "modelName",+ COALESCE(mu."size", imu."size") as "modelSize",+ ic."unitCost" as "unitCost",+ cp."customerPartId",+ cp."customerPartRevision"+ FROM "salesOrderLine" sl+ INNER JOIN "salesOrder" so ON so.id = sl."salesOrderId"+ LEFT JOIN "modelUpload" mu ON sl."modelUploadId" = mu."id"+ INNER JOIN "item" i ON i.id = sl."itemId"+ LEFT JOIN "itemCost" ic ON ic."itemId" = i.id+ LEFT JOIN "modelUpload" imu ON imu.id = i."modelUploadId"+ LEFT JOIN "customerPartToItem" cp ON cp."customerId" = so."customerId" AND cp."itemId" = i.id+);\ No newline at end of filediff --git a/packages/documents/src/pdf/PurchaseOrderPDF.tsx b/packages/documents/src/pdf/PurchaseOrderPDF.tsxindex 0cd3b636d2..59fa3d88e6 100644--- a/packages/documents/src/pdf/PurchaseOrderPDF.tsx+++ b/packages/documents/src/pdf/PurchaseOrderPDF.tsx@@ -99,7 +99,7 @@ const PurchaseOrderPDF = ({]}/><View style={tw("flex flex-row justify-between mb-5")}>- <View style={tw("flex flex-col w-1/3 text-sm gap-1")}>+ <View style={tw("flex flex-col w-1/3 text-sm gap-2")}><Text style={tw("text-gray-500 text-xs")}>Supplier</Text><Text>{supplierName}</Text>{supplierAddressLine1 && <Text>{supplierAddressLine1}</Text>}@@ -114,7 +114,7 @@ const PurchaseOrderPDF = ({<Text>{supplierCountryName}</Text></View>{dropShipment ? (- <View style={tw("flex flex-col text-sm gap-1 w-1/3")}>+ <View style={tw("flex flex-col text-sm gap-2 w-1/3")}><Text style={tw("text-gray-500 text-xs")}>Ship To</Text><Text>{customerName}</Text>{customerAddressLine1 && <Text>{customerAddressLine1}</Text>}@@ -129,7 +129,7 @@ const PurchaseOrderPDF = ({<Text>{customerCountryName}</Text></View>) : (- <View style={tw("flex flex-col text-sm gap-1 w-1/3")}>+ <View style={tw("flex flex-col text-sm gap-2 w-1/3")}><Text style={tw("text-gray-500 text-xs")}>Ship To</Text><Text>{deliveryName}</Text>{deliveryAddressLine1 && <Text>{deliveryAddressLine1}</Text>}@@ -146,29 +146,29 @@ const PurchaseOrderPDF = ({)}</View><View style={tw("flex flex-row justify-between mb-5 text-sm")}>- <View style={tw("flex flex-col gap-1 w-1/3")}>+ <View style={tw("flex flex-col gap-2 w-1/3")}><Text style={tw("text-gray-500 text-xs")}>Supplier Order #</Text><Text>{purchaseOrder?.supplierReference}</Text></View>- <View style={tw("flex flex-col gap-1 w-1/3")}>+ <View style={tw("flex flex-col gap-2 w-1/3")}><Text style={tw("text-gray-500 text-xs")}>Requested Date</Text><Text>{purchaseOrder?.receiptRequestedDate}</Text></View>- <View style={tw("flex flex-col gap-1 w-1/3")}>+ <View style={tw("flex flex-col gap-2 w-1/3")}><Text style={tw("text-gray-500 text-xs")}>Promised Date</Text><Text>{purchaseOrder?.receiptPromisedDate}</Text></View></View><View style={tw("flex flex-row justify-between mb-5")}>- <View style={tw("flex flex-col gap-1 w-1/3")}>+ <View style={tw("flex flex-col gap-2 w-1/3")}><Text style={tw("text-gray-500 text-xs")}>Shipping Method</Text><Text>{purchaseOrder?.shippingMethodName}</Text></View>- <View style={tw("flex flex-col gap-1 w-1/3")}>+ <View style={tw("flex flex-col gap-2 w-1/3")}><Text style={tw("text-gray-500 text-xs")}>Shipping Terms</Text><Text>{purchaseOrder?.shippingTermName}</Text></View>- <View style={tw("flex flex-col gap-1 w-1/3")}>+ <View style={tw("flex flex-col gap-2 w-1/3")}><Text style={tw("text-gray-500 text-xs")}>Payment Terms</Text><Text>{purchaseOrder?.paymentTermName}</Text></View>@@ -176,7 +176,7 @@ const PurchaseOrderPDF = ({<View style={tw("mb-5 text-xs")}><Viewstyle={tw(- "flex flex-row justify-between items-center py-1.5 px-[6px] border-t border-b border-gray-300 font-bold text-gray-500 uppercase"+ "flex flex-row justify-between items-center mt-5 py-3 px-[6px] border-t border-b border-gray-300 font-bold uppercase")}><Text style={tw("w-1/2")}>Description</Text>@@ -187,38 +187,46 @@ const PurchaseOrderPDF = ({{purchaseOrderLines.map((line) => (<Viewstyle={tw(- "flex flex-row justify-between py-1.5 px-[6px] border-b border-gray-300"+ "flex flex-col w-full gap-4 py-3 px-[6px] border-b border-gray-300")}key={line.id}>- <View style={tw("w-1/2")}>- <Text style={tw("font-bold mb-1")}>- {getLineDescription(line)}+ <View style={tw("flex flex-row justify-between")}>+ <View style={tw("w-1/2")}>+ <Text style={tw("font-bold mb-1")}>+ {getLineDescription(line)}+ </Text>+ <Text style={tw("text-[9px] opacity-80")}>+ {getLineDescriptionDetails(line)}+ </Text>+ </View>+ <Text style={tw("w-1/6 text-right")}>+ {line.purchaseOrderLineType === "Comment"+ ? ""+ : `${line.purchaseQuantity} ${line.purchaseUnitOfMeasureCode}`}</Text>- <Text style={tw("text-[9px] opacity-80")}>- {getLineDescriptionDetails(line)}+ <Text style={tw("w-1/6 text-right")}>+ {line.purchaseOrderLineType === "Comment"+ ? null+ : formatter.format(line.unitPrice ?? 0)}+ </Text>+ <Text style={tw("w-1/5 text-right")}>+ {line.purchaseOrderLineType === "Comment"+ ? null+ : formatter.format(getLineTotal(line))}</Text></View>- <Text style={tw("w-1/6 text-right")}>- {line.purchaseOrderLineType === "Comment"- ? ""- : `${line.purchaseQuantity} ${line.purchaseUnitOfMeasureCode}`}- </Text>- <Text style={tw("w-1/6 text-right")}>- {line.purchaseOrderLineType === "Comment"- ? null- : formatter.format(line.unitPrice ?? 0)}- </Text>- <Text style={tw("w-1/5 text-right")}>- {line.purchaseOrderLineType === "Comment"- ? null- : formatter.format(getLineTotal(line))}- </Text>+ {/* {Object.keys(line.externalNotes ?? {}).length > 0 && (+ <Note+ key={`${line.id}-notes`}+ content={line.externalNotes as JSONContent}+ />+ )} */}</View>))}<Viewstyle={tw(- "flex flex-row justify-between items-center py-1.5 px-[6px] border-b border-gray-300 font-bold text-gray-500 uppercase"+ "flex flex-row justify-between items-center py-3 px-[6px] border-b border-gray-300 font-bold uppercase")}><Text>Total</Text>diff --git a/packages/documents/src/pdf/QuotePDF.tsx b/packages/documents/src/pdf/QuotePDF.tsxindex 9e6c3eda5b..bb315b9e1b 100644--- a/packages/documents/src/pdf/QuotePDF.tsx+++ b/packages/documents/src/pdf/QuotePDF.tsx@@ -142,9 +142,7 @@ const QuotePDF = ({/><View style={tw("flex flex-row mb-5")}><View style={tw("flex flex-col gap-1 w-1/3 text-xs")}>- <Text style={tw("text-gray-500 font-bold text-xs")}>- Quote Submitted To- </Text>+ <Text style={tw(" font-bold text-xs")}>Quote Submitted To</Text><Text>{customerName}</Text>{customerAddressLine1 && <Text>{customerAddressLine1}</Text>}{customerAddressLine2 && <Text>{customerAddressLine2}</Text>}@@ -162,7 +160,7 @@ const QuotePDF = ({<View style={tw("mb-5 text-xs")}><Viewstyle={tw(- "flex flex-row justify-between items-center py-3 px-[6px] border-t border-b border-gray-300 text-gray-500 font-bold uppercase"+ "flex flex-row justify-between items-center py-3 px-[6px] border-t border-b border-gray-300 font-bold uppercase")}><View style={tw("w-1/3")}>@@ -198,137 +196,150 @@ const QuotePDF = ({return (<Viewstyle={tw(- "flex flex-row justify-between py-3 px-[6px] border-b border-gray-300 mb-2"+ "flex flex-col gap-2 py-3 px-[6px] border-b border-gray-300 mb-2")}key={line.id}>- <View style={tw("w-1/3")}>- <View>- <Text style={tw("font-bold mb-1")}>- {getLineDescription(line)}- </Text>- <Text style={tw("text-[9px] opacity-80")}>- {getLineDescriptionDetails(line)}- </Text>- </View>-- {thumbnails && line.id in thumbnails && (- <View style={tw("mt-2")}>- <Image- src={thumbnails[line.id]!}- style={tw("w-full h-auto")}- />+ <View style={tw("flex flex-row justify-between")}>+ <View style={tw("w-1/3")}>+ <View>+ <Text style={tw("font-bold mb-1")}>+ {getLineDescription(line)}+ </Text>+ <Text style={tw("text-[9px] opacity-80")}>+ {getLineDescriptionDetails(line)}+ </Text></View>- )}- {line.status !== "No Quote" &&- (Object.keys(additionalCharges).length > 0 ||- pricesByLine[line.id]?.some(- (price) => (price.shippingCost ?? 0) > 0- ) ||- line.taxPercent) && (- <View style={tw("mt-2.5")}>- <Text style={tw("text-[9px] font-bold")}>- Tax & Fees- </Text>- {pricesByLine[line.id]?.some(- (price) => (price.shippingCost ?? 0) > 0- ) && (- <Text style={tw("text-[9px] opacity-80")}>- - Shipping- </Text>- )}- {Object.values(additionalCharges)- .sort((a, b) =>- a.description.localeCompare(b.description)- )- .map((charge) => {- return charge.description ? (- <Text- key={charge.description}- style={tw("text-[9px] opacity-80")}- >- - {charge.description}- </Text>- ) : null;- })}- {line.taxPercent && (- <Text style={tw("text-[9px] opacity-80")}>- - Tax ({line.taxPercent * 100}%)- </Text>- )}+ {thumbnails && line.id in thumbnails && (+ <View style={tw("mt-2")}>+ <Image+ src={thumbnails[line.id]!}+ style={tw("w-full h-auto")}+ /></View>)}- </View>- <View style={tw("flex flex-col w-2/3 gap-2")}>- {line.status !== "No Quote" ? (- line.quantity.map((quantity, index) => {- const prices = pricesByLine[line.id] ?? [];- const price = prices.find(- (price) => price.quantity === quantity- );- const netUnitPrice = price?.convertedNetUnitPrice ?? 0;- const netExtendedPrice =- price?.convertedNetExtendedPrice ?? 0;- const additionalCharge =- additionalChargesByQuantity[index] ?? 0;+ {line.status !== "No Quote" &&+ (Object.keys(additionalCharges).length > 0 ||+ pricesByLine[line.id]?.some(+ (price) => (price.shippingCost ?? 0) > 0+ ) ||+ line.taxPercent) && (+ <View style={tw("mt-2.5")}>+ <Text style={tw("text-[9px] font-bold")}>+ Tax & Fees+ </Text>+ {pricesByLine[line.id]?.some(+ (price) => (price.shippingCost ?? 0) > 0+ ) && (+ <Text style={tw("text-[9px] opacity-80")}>+ - Shipping+ </Text>+ )}+ {Object.values(additionalCharges)+ .sort((a, b) =>+ a.description.localeCompare(b.description)+ )+ .map((charge) => {+ return charge.description ? (+ <Text+ key={charge.description}+ style={tw("text-[9px] opacity-80")}+ >+ - {charge.description}+ </Text>+ ) : null;+ })}+ {line.taxPercent && (+ <Text style={tw("text-[9px] opacity-80")}>+ - Tax ({line.taxPercent * 100}%)+ </Text>+ )}+ </View>+ )}+ </View>+ <View style={tw("flex flex-col w-2/3 gap-2")}>+ {line.status !== "No Quote" ? (+ line.quantity.map((quantity, index) => {+ const prices = pricesByLine[line.id] ?? [];+ const price = prices.find(+ (price) => price.quantity === quantity+ );+ const netUnitPrice = price?.convertedNetUnitPrice ?? 0;+ const netExtendedPrice =+ price?.convertedNetExtendedPrice ?? 0;- const additionalChargePlusShipping =- additionalCharge + (price?.convertedShippingCost ?? 0);+ const additionalCharge =+ additionalChargesByQuantity[index] ?? 0;- const taxPercent = line.taxPercent ?? 0;+ const additionalChargePlusShipping =+ additionalCharge ++ (price?.convertedShippingCost ?? 0);- const totalPrice =- (netExtendedPrice + additionalChargePlusShipping) *- (1 + taxPercent);+ const taxPercent = line.taxPercent ?? 0;- return (- <View key={quantity} style={tw("flex flex-row")}>- <Text style={tw("w-1/5 text-right")}>{quantity}</Text>- <Text style={tw("w-1/5 text-right")}>- {netUnitPrice- ? formatter.format(netUnitPrice)- : "-"}- </Text>- <Text style={tw("w-1/5 text-right")}>- {additionalChargePlusShipping- ? formatter.format(additionalChargePlusShipping)- : "-"}- </Text>- <Text style={tw("w-1/5 text-right")}>- {price ? `${price.leadTime} days` : "-"}- </Text>- <Text style={tw("w-1/5 text-right")}>- {netUnitPrice ? formatter.format(totalPrice) : "-"}- </Text>- </View>- );- })- ) : (- <View>- <View style={tw("flex flex-row")}>- <Text style={tw("w-1/5 text-right font-bold")}>- No Quote- </Text>- <View style={tw("w-3/5 ml-auto")}>- {line.noQuoteReason && (- <Text style={tw("text-sm")}>- {line.noQuoteReason}+ const totalPrice =+ (netExtendedPrice + additionalChargePlusShipping) *+ (1 + taxPercent);++ return (+ <View key={quantity} style={tw("flex flex-row")}>+ <Text style={tw("w-1/5 text-right")}>+ {quantity}</Text>- )}+ <Text style={tw("w-1/5 text-right")}>+ {netUnitPrice+ ? formatter.format(netUnitPrice)+ : "-"}+ </Text>+ <Text style={tw("w-1/5 text-right")}>+ {additionalChargePlusShipping+ ? formatter.format(additionalChargePlusShipping)+ : "-"}+ </Text>+ <Text style={tw("w-1/5 text-right")}>+ {price ? `${price.leadTime} days` : "-"}+ </Text>+ <Text style={tw("w-1/5 text-right")}>+ {netUnitPrice+ ? formatter.format(totalPrice)+ : "-"}+ </Text>+ </View>+ );+ })+ ) : (+ <View>+ <View style={tw("flex flex-row")}>+ <Text style={tw("w-1/5 text-right font-bold")}>+ No Quote+ </Text>+ <View style={tw("w-3/5 ml-auto")}>+ {line.noQuoteReason && (+ <Text style={tw("text-sm")}>+ {line.noQuoteReason}+ </Text>+ )}+ </View></View></View>- </View>- )}+ )}+ </View></View>+ {Object.keys(line.externalNotes ?? {}).length > 0 && (+ <Note+ key={`${line.id}-notes`}+ content={line.externalNotes as JSONContent}+ />+ )}</View>);})}{shipment?.shippingCost && (<Viewstyle={tw(- "flex flex-row justify-between items-center py-3 px-[6px] border-b border-gray-300 font-bold text-gray-500 uppercase"+ "flex flex-row justify-between items-center py-3 px-[6px] border-b border-gray-300 font-bold uppercase")}><Text>Shipping</Text>@@ -342,10 +353,12 @@ const QuotePDF = ({</View></View><View style={tw("flex flex-col gap-4 w-full")}>- <Note- title="Notes"- content={(quote.externalNotes ?? {}) as JSONContent}- />+ {Object.keys(quote.externalNotes ?? {}).length > 0 && (+ <Note+ title="Notes"+ content={(quote.externalNotes ?? {}) as JSONContent}+ />+ )}<Note title="Standard Terms & Conditions" content={terms} /></View></Template>diff --git a/packages/documents/src/pdf/SalesOrderPDF.tsx b/packages/documents/src/pdf/SalesOrderPDF.tsxindex a978a06f53..ecdc15a60c 100644--- a/packages/documents/src/pdf/SalesOrderPDF.tsx+++ b/packages/documents/src/pdf/SalesOrderPDF.tsx@@ -92,7 +92,7 @@ const SalesOrderPDF = ({]}/><View style={tw("flex flex-row justify-between mb-5")}>- <View style={tw("flex flex-col gap-1 w-1/3")}>+ <View style={tw("flex flex-col gap-2 w-1/3")}><Text style={tw("text-gray-500 text-xs")}>Ship To</Text><Text style={tw("text-sm")}>{customerName}</Text>{customerAddressLine1 && (@@ -110,7 +110,7 @@ const SalesOrderPDF = ({</Text><Text style={tw("text-sm")}>{customerCountryName}</Text></View>- <View style={tw("flex flex-col gap-1 w-1/3")}>+ <View style={tw("flex flex-col gap-2 w-1/3")}><Text style={tw("text-gray-500 text-xs")}>Bill To</Text><Text style={tw("text-sm")}>{paymentCustomerName}</Text>{paymentAddressLine1 && (@@ -130,31 +130,31 @@ const SalesOrderPDF = ({</View></View><View style={tw("flex flex-row justify-between mb-5")}>- <View style={tw("flex flex-col gap-1 w-1/3")}>+ <View style={tw("flex flex-col gap-2 w-1/3")}><Text style={tw("text-gray-500 text-xs")}>Customer Order #</Text><Text style={tw("text-sm")}>{salesOrder?.customerReference}</Text></View>- <View style={tw("flex flex-col gap-1 w-1/3")}>+ <View style={tw("flex flex-col gap-2 w-1/3")}><Text style={tw("text-gray-500 text-xs")}>Requested Date</Text><Text style={tw("text-sm")}>{salesOrder?.receiptRequestedDate}</Text></View>- <View style={tw("flex flex-col gap-1 w-1/3")}>+ <View style={tw("flex flex-col gap-2 w-1/3")}><Text style={tw("text-gray-500 text-xs")}>Promised Date</Text><Text style={tw("text-sm")}>{salesOrder?.receiptPromisedDate}</Text></View></View><View style={tw("flex flex-row justify-between mb-5")}>- <View style={tw("flex flex-col gap-1 w-1/3")}>+ <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")}>{salesOrder?.shippingMethodName}</Text></View>- <View style={tw("flex flex-col gap-1 w-1/3")}>+ <View style={tw("flex flex-col gap-2 w-1/3")}><Text style={tw("text-gray-500 text-xs")}>Shipping Terms</Text><Text style={tw("text-sm")}>{salesOrder?.shippingTermName}</Text></View>- <View style={tw("flex flex-col gap-1 w-1/3")}>+ <View style={tw("flex flex-col gap-2 w-1/3")}><Text style={tw("text-gray-500 text-xs")}>Payment Terms</Text><Text style={tw("text-sm")}>{salesOrder?.paymentTermName}</Text></View>@@ -162,7 +162,7 @@ const SalesOrderPDF = ({<View style={tw("mb-5 text-xs")}><Viewstyle={tw(- "flex flex-row justify-between items-center mt-5 py-3 px-[6px] border-t border-b border-gray-300 font-bold text-gray-500 uppercase"+ "flex flex-row justify-between items-center mt-5 py-3 px-[6px] border-t border-b border-gray-300 font-bold uppercase")}><Text style={tw("w-5/12 text-left")}>Description</Text>@@ -175,44 +175,53 @@ const SalesOrderPDF = ({return (<Viewstyle={tw(- "flex flex-row justify-between py-3 px-[6px] border-b border-gray-300"+ "flex flex-col w-full gap-4 py-3 px-[6px] border-b border-gray-300")}key={line.id}>- <View style={tw("w-5/12")}>- <Text style={tw("font-bold mb-1")}>- {getLineDescription(line)}+ <View style={tw("flex flex-row justify-between ")}>+ <View style={tw("w-5/12")}>+ <Text style={tw("font-bold mb-1")}>+ {getLineDescription(line)}+ </Text>+ <Text style={tw("text-[9px] opacity-80")}>+ {getLineDescriptionDetails(line)}+ </Text>+ </View>+ <Text style={tw("w-1/6 text-right")}>+ {line.salesOrderLineType === "Comment"+ ? ""+ : `${line.saleQuantity} ${line.unitOfMeasureCode}`}</Text>- <Text style={tw("text-[9px] opacity-80")}>- {getLineDescriptionDetails(line)}+ <Text style={tw("w-1/6 text-right")}>+ {line.salesOrderLineType === "Comment"+ ? null+ : formatter.format(line.convertedUnitPrice ?? 0)}+ </Text>+ <Text style={tw("w-1/6 text-right")}>+ {line.salesOrderLineType === "Comment"+ ? null+ : formatter.format(+ (line.convertedAddOnCost ?? 0) ++ (line.convertedShippingCost ?? 0)+ )}+ </Text>+ <Text style={tw("w-1/6 text-right")}>+ {line.salesOrderLineType === "Comment"+ ? null+ : formatter.format(getLineTotal(line))}</Text></View>- <Text style={tw("w-1/6 text-right")}>- {line.salesOrderLineType === "Comment"- ? ""- : `${line.saleQuantity} ${line.unitOfMeasureCode}`}- </Text>- <Text style={tw("w-1/6 text-right")}>- {line.salesOrderLineType === "Comment"- ? null- : formatter.format(line.convertedUnitPrice ?? 0)}- </Text>- <Text style={tw("w-1/6 text-right")}>- {line.salesOrderLineType === "Comment"- ? null- : formatter.format(- (line.convertedAddOnCost ?? 0) +- (line.convertedShippingCost ?? 0)- )}- </Text>- <Text style={tw("w-1/6 text-right")}>- {line.salesOrderLineType === "Comment"- ? null- : formatter.format(getLineTotal(line))}- </Text>+ {Object.keys(line.externalNotes ?? {}).length > 0 && (+ <Note+ key={`${line.id}-notes`}+ content={line.externalNotes as JSONContent}+ />+ )}</View>);})}+{salesOrder.shippingCost && (<Viewstyle={tw(@@ -230,7 +239,7 @@ const SalesOrderPDF = ({)}<Viewstyle={tw(- "flex flex-row justify-between items-center py-3 px-[6px] border-b border-gray-300 font-bold text-gray-500 uppercase"+ "flex flex-row justify-between items-center py-3 px-[6px] border-b border-gray-300 font-bold uppercase")}><Text>Total</Text>diff --git a/packages/documents/src/pdf/components/Note.tsx b/packages/documents/src/pdf/components/Note.tsxindex 85744657d6..1e74e07573 100644--- a/packages/documents/src/pdf/components/Note.tsx+++ b/packages/documents/src/pdf/components/Note.tsx@@ -13,9 +13,11 @@ const convertTiptapJSON = (case "doc":return (<View style={{ fontSize: 11 }}>- <View style={styles.thead}>- <Text>{args?.title ?? "Notes"}</Text>- </View>+ {args?.title && (+ <View style={styles.thead}>+ <Text>{args?.title}</Text>+ </View>+ )}{node.content.map((child, index) => convertTiptapJSON(child))}</View>);@@ -113,7 +115,7 @@ const convertTiptapJSON = (}};-const Note = ({ title, content }: { title: string; content: JSONContent }) => {+const Note = ({ title, content }: { title?: string; content: JSONContent }) => {if (!content || !("content" in content)) return null;return <View>{convertTiptapJSON(content, { title })}</View>;};@@ -127,6 +129,7 @@ const styles = StyleSheet.create({justifyContent: "space-between",alignItems: "center",marginTop: "20px",+ marginBottom: "10px",padding: "6px 3px 6px 3px",borderTop: 1,borderTopColor: "#CCCCCC",@@ -136,7 +139,6 @@ const styles = StyleSheet.create({borderBottomStyle: "solid",fontSize: 9,fontWeight: 700,- color: "#7d7d7d",textTransform: "uppercase",},tfoot: {diff --git a/packages/react/src/Editor/index.ts b/packages/react/src/Editor/index.tsindex affb66f1cd..84a5cd8068 100644--- a/packages/react/src/Editor/index.ts+++ b/packages/react/src/Editor/index.ts@@ -1,6 +1,8 @@import TextStyle from "@tiptap/extension-text-style";+import Underline from "@tiptap/extension-underline";import type { JSONContent } from "@tiptap/react";import { generateHTML as DefaultGenerateHTML } from "@tiptap/react";+import StarterKit from "@tiptap/starter-kit";import Editor from "./Editor";import { defaultExtensions } from "./extensions";@@ -11,7 +13,12 @@ const generateHTML = (content: JSONContent) => {if (!content || !("type" in content)) {return "";}- return DefaultGenerateHTML(content, [...defaultExtensions, TextStyle]);+ return DefaultGenerateHTML(content, [+ ...defaultExtensions,+ TextStyle,+ StarterKit,+ Underline,+ ]);};export { Editor, generateHTML };