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.

feat: add locations to purchase order document

Brad Barbin27409ef0d0bd
diff --git a/apps/carbon/app/modules/purchasing/purchasing.models.ts b/apps/carbon/app/modules/purchasing/purchasing.models.ts
index 961231c79b..0ec81115c0 100644
--- a/apps/carbon/app/modules/purchasing/purchasing.models.ts
+++ b/apps/carbon/app/modules/purchasing/purchasing.models.ts
@@ -37,6 +37,7 @@ export const purchaseOrderValidator = withZod(
status: z.enum(purchaseOrderStatusType).optional(),
notes: zfd.text(z.string().optional()),
supplierId: z.string().min(36, { message: "Supplier is required" }),
+ supplierLocationId: zfd.text(z.string().optional()),
supplierContactId: zfd.text(z.string().optional()),
supplierReference: zfd.text(z.string().optional()),
})
diff --git a/apps/carbon/app/modules/purchasing/purchasing.service.ts b/apps/carbon/app/modules/purchasing/purchasing.service.ts
index 01b271ce93..10954b91ca 100644
--- a/apps/carbon/app/modules/purchasing/purchasing.service.ts
+++ b/apps/carbon/app/modules/purchasing/purchasing.service.ts
@@ -149,6 +149,17 @@ export async function getPurchaseOrderDelivery(
.single();
}
+export async function getPurchaseOrderLocations(
+ client: SupabaseClient<Database>,
+ purchaseOrderId: string
+) {
+ return client
+ .from("purchaseOrderLocations")
+ .select("*")
+ .eq("id", purchaseOrderId)
+ .single();
+}
+
export async function getPurchaseOrderPayment(
client: SupabaseClient<Database>,
purchaseOrderId: string
diff --git a/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderForm/PurchaseOrderForm.tsx b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderForm/PurchaseOrderForm.tsx
index 1cda66d928..99f6785522 100644
--- a/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderForm/PurchaseOrderForm.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderForm/PurchaseOrderForm.tsx
@@ -19,6 +19,7 @@ import {
Submit,
Supplier,
SupplierContact,
+ SupplierLocation,
TextArea,
} from "~/components/Form";
import { usePermissions } from "~/hooks";
@@ -91,15 +92,22 @@ const PurchaseOrderForm = ({ initialValues }: PurchaseOrderFormProps) => {
}
/>
{isEditing && (
- <SupplierContact
- name="supplierContactId"
- label="Supplier Contact"
- supplier={supplier}
- />
+ <>
+ <SupplierLocation
+ name="supplierLocationId"
+ label="Supplier Location"
+ supplier={supplier}
+ />
+ <SupplierContact
+ name="supplierContactId"
+ label="Supplier Contact"
+ supplier={supplier}
+ />
+ </>
)}
- <Input name="supplierReference" label="Supplier Order Number" />
</VStack>
<VStack alignItems="start" spacing={2} w="full">
+ <Input name="supplierReference" label="Supplier Order Number" />
<DatePicker
name="orderDate"
label="Order Date"
@@ -111,19 +119,19 @@ const PurchaseOrderForm = ({ initialValues }: PurchaseOrderFormProps) => {
options={typeOptions}
isReadOnly={isSupplier}
/>
- {isEditing && permissions.can("delete", "purchasing") && (
- <SelectControlled
- name="status"
- label="Status"
- value={initialValues.status}
- options={statusOptions}
- isReadOnly={isSupplier}
- />
- )}
</VStack>
<VStack alignItems="start" spacing={2} w="full">
{isEditing && (
<>
+ {permissions.can("delete", "purchasing") && (
+ <SelectControlled
+ name="status"
+ label="Status"
+ value={initialValues.status}
+ options={statusOptions}
+ isReadOnly={isSupplier}
+ />
+ )}
<TextArea
name="notes"
label="Notes"
diff --git a/apps/carbon/app/routes/x+/index.tsx b/apps/carbon/app/routes/x+/index.tsx
index ec8ff18ed1..1b2e53116d 100644
--- a/apps/carbon/app/routes/x+/index.tsx
+++ b/apps/carbon/app/routes/x+/index.tsx
@@ -1,20 +1,26 @@
import { PurchaseOrderPDFView } from "@carbon/documents";
import { json, type LoaderFunctionArgs } from "@remix-run/node";
import { useLoaderData } from "@remix-run/react";
-import { getPurchaseOrder, getPurchaseOrderLines } from "~/modules/purchasing";
+import {
+ getPurchaseOrder,
+ getPurchaseOrderLines,
+ getPurchaseOrderLocations,
+} from "~/modules/purchasing";
import { getCompany } from "~/modules/settings";
import { requirePermissions } from "~/services/auth";
// import { Editor, useEditor } from "@carbon/react";
export async function loader({ request }: LoaderFunctionArgs) {
const { client } = await requirePermissions(request, {});
- const orderId = "cm2ttji240kgaqs4q1vg";
+ const orderId = "cm3dngba00l02e3p9f8g";
- const [company, purchaseOrder, purchaseOrderLines] = await Promise.all([
- getCompany(client),
- getPurchaseOrder(client, orderId),
- getPurchaseOrderLines(client, orderId),
- ]);
+ const [company, purchaseOrder, purchaseOrderLines, purchaseOrderLocations] =
+ await Promise.all([
+ getCompany(client),
+ getPurchaseOrder(client, orderId),
+ getPurchaseOrderLines(client, orderId),
+ getPurchaseOrderLocations(client, orderId),
+ ]);
if (company.error) {
console.error(company.error);
@@ -25,18 +31,22 @@ export async function loader({ request }: LoaderFunctionArgs) {
if (purchaseOrderLines.error) {
console.error(purchaseOrderLines.error);
}
+ if (purchaseOrderLocations.error) {
+ console.error(purchaseOrderLocations.error);
+ }
return json({
company: company.data,
purchaseOrder: purchaseOrder.data,
purchaseOrderLines: purchaseOrderLines.data,
+ purchaseOrderLocations: purchaseOrderLocations.data,
});
}
export default function AppIndexRoute() {
// const editor = useEditor(`<h2>Hello, World</h2><p>Welcome to Carbon!</p>`);
// return <Editor editor={editor} h="calc(100vh - 98px)" />;
- const { company, purchaseOrder, purchaseOrderLines } =
+ const { company, purchaseOrder, purchaseOrderLines, purchaseOrderLocations } =
useLoaderData<typeof loader>();
return (
@@ -44,6 +54,7 @@ export default function AppIndexRoute() {
company={company}
purchaseOrder={purchaseOrder}
purchaseOrderLines={purchaseOrderLines ?? []}
+ purchaseOrderLocations={purchaseOrderLocations}
/>
);
}
diff --git a/apps/carbon/app/routes/x+/purchase-order+/$orderId.details.tsx b/apps/carbon/app/routes/x+/purchase-order+/$orderId.details.tsx
index 9f39fee68e..72c7bc07e8 100644
--- a/apps/carbon/app/routes/x+/purchase-order+/$orderId.details.tsx
+++ b/apps/carbon/app/routes/x+/purchase-order+/$orderId.details.tsx
@@ -36,6 +36,8 @@ export async function action({ request, params }: ActionFunctionArgs) {
const { purchaseOrderId, ...data } = validation.data;
if (!purchaseOrderId) throw new Error("Could not find purchaseOrderId");
+ console.log({ data });
+
const updatePurchaseOrder = await upsertPurchaseOrder(client, {
id: orderId,
purchaseOrderId,
@@ -71,6 +73,7 @@ export default function PurchaseOrderBasicRoute() {
purchaseOrderId: orderData?.purchaseOrder?.purchaseOrderId ?? "",
supplierId: orderData?.purchaseOrder?.supplierId ?? "",
supplierContactId: orderData?.purchaseOrder?.supplierContactId ?? "",
+ supplierLocationId: orderData?.purchaseOrder?.supplierLocationId ?? "",
supplierReference: orderData?.purchaseOrder?.supplierReference ?? "",
orderDate: orderData?.purchaseOrder?.orderDate ?? "",
type: orderData?.purchaseOrder?.type ?? ("Purchase" as "Purchase"),
diff --git a/packages/database/SCHEMA.md b/packages/database/SCHEMA.md
index 58fa23d33a..daa5d6be32 100644
--- a/packages/database/SCHEMA.md
+++ b/packages/database/SCHEMA.md
@@ -716,12 +716,12 @@ CREATE TABLE "contact" (
"city" TEXT,
"state" TEXT,
"postalCode" TEXT,
- "countryId" INTEGER,
+ "countryCode" INTEGER,
"birthday" DATE,
"notes" TEXT,
CONSTRAINT "contact_pkey" PRIMARY KEY ("id"),
- CONSTRAINT "contact_countryId_fkey" FOREIGN KEY ("countryId") REFERENCES "country"("id") ON DELETE SET NULL ON UPDATE CASCADE
+ CONSTRAINT "contact_countryCode_fkey" FOREIGN KEY ("countryCode") REFERENCES "country"("id") ON DELETE SET NULL ON UPDATE CASCADE
);
@@ -732,12 +732,12 @@ CREATE TABLE "address" (
"city" TEXT,
"state" TEXT,
"postalCode" TEXT,
- "countryId" INTEGER,
+ "countryCode" INTEGER,
"phone" TEXT,
"fax" TEXT,
CONSTRAINT "address_pkey" PRIMARY KEY ("id"),
- CONSTRAINT "address_countryId_fkey" FOREIGN KEY ("countryId") REFERENCES "country"("id") ON DELETE SET NULL ON UPDATE CASCADE
+ CONSTRAINT "address_countryCode_fkey" FOREIGN KEY ("countryCode") REFERENCES "country"("id") ON DELETE SET NULL ON UPDATE CASCADE
);
CREATE TABLE "supplierStatus" (
@@ -2141,7 +2141,7 @@ CREATE TABLE "location" (
"city" TEXT NOT NULL,
"state" TEXT NOT NULL,
"postalCode" TEXT NOT NULL,
- "country" TEXT,
+ "countryCode" TEXT,
"timezone" TEXT NOT NULL,
"latitude" NUMERIC,
"longitude" NUMERIC,
@@ -3600,10 +3600,13 @@ CREATE INDEX "partSupplier_partId_index" ON "partSupplier"("partId");
ALTER TABLE "partSupplier" ENABLE ROW LEVEL SECURITY;
-CREATE POLICY "Employees with part_view can view part suppliers" ON "partSupplier"
+CREATE POLICY "Employees with part/purchasing_view can view part suppliers" ON "partSupplier"
FOR SELECT
USING (
- coalesce(get_my_claim('parts_view')::boolean,false)
+ (
+ coalesce(get_my_claim('parts_view')::boolean,false) OR
+ coalesce(get_my_claim('purchasing_view')::boolean,false)
+ )
AND (get_my_claim('role'::text)) = '"employee"'::jsonb
);
@@ -4071,10 +4074,13 @@ CREATE INDEX "serviceSupplier_serviceId_index" ON "serviceSupplier"("serviceId")
ALTER TABLE "serviceSupplier" ENABLE ROW LEVEL SECURITY;
-CREATE POLICY "Employees with part_view can view service suppliers" ON "serviceSupplier"
+CREATE POLICY "Employees with part/purchasing_view can view service suppliers" ON "serviceSupplier"
FOR SELECT
USING (
- coalesce(get_my_claim('parts_view')::boolean,false)
+ (
+ coalesce(get_my_claim('parts_view')::boolean,false) OR
+ coalesce(get_my_claim('purchasing_view')::boolean,false)
+ )
AND (get_my_claim('role'::text)) = '"employee"'::jsonb
);
@@ -4567,6 +4573,7 @@ CREATE TABLE "purchaseOrder" (
"orderDate" DATE NOT NULL DEFAULT CURRENT_DATE,
"notes" TEXT,
"supplierId" TEXT NOT NULL,
+ "supplierLocationId" TEXT,
"supplierContactId" TEXT,
"supplierReference" TEXT,
"closedAt" DATE,
@@ -4579,7 +4586,8 @@ CREATE TABLE "purchaseOrder" (
CONSTRAINT "purchaseOrder_pkey" PRIMARY KEY ("id"),
CONSTRAINT "purchaseOrder_purchaseOrderId_key" UNIQUE ("purchaseOrderId"),
CONSTRAINT "purchaseOrder_supplierId_fkey" FOREIGN KEY ("supplierId") REFERENCES "supplier" ("id") ON DELETE CASCADE,
- CONSTRAINT "purchaseOrder_supplierContactId_fkey" FOREIGN KEY ("supplierContactId") REFERENCES "supplierContact" ("id") ON DELETE CASCADE,
+ CONSTRAINT "purchaseOrder_supplierLocationId_fkey" FOREIGN KEY ("supplierLocationId") REFERENCES "supplierLocation" ("id") ON UPDATE CASCADE ON DELETE RESTRICT,
+ CONSTRAINT "purchaseOrder_supplierContactId_fkey" FOREIGN KEY ("supplierContactId") REFERENCES "supplierContact" ("id") ON UPDATE CASCADE ON DELETE RESTRICT,
CONSTRAINT "purchaseOrder_closedBy_fkey" FOREIGN KEY ("closedBy") REFERENCES "user" ("id") ON DELETE RESTRICT,
CONSTRAINT "purchaseOrder_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "user" ("id") ON DELETE RESTRICT,
CONSTRAINT "purchaseOrder_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE RESTRICT
@@ -7296,3 +7304,77 @@ CREATE POLICY "Employees with settings_update can update company" ON "company"
);
```
+
+
+## `purchase-order-document`
+
+```sql
+CREATE OR REPLACE VIEW "purchaseOrderLines" WITH(SECURITY_INVOKER=true) AS
+ SELECT
+ pol.*,
+ po."supplierId" ,
+ p.name AS "partName",
+ p.description AS "partDescription",
+ ps."supplierPartId",
+ s.name AS "serviceName",
+ s.description AS "serviceDescription",
+ ss."supplierServiceId"
+ FROM "purchaseOrderLine" pol
+ INNER JOIN "purchaseOrder" po
+ ON po.id = pol."purchaseOrderId"
+ LEFT OUTER JOIN "part" p
+ ON p.id = pol."partId"
+ LEFT OUTER JOIN "partSupplier" ps
+ ON p.id = ps."partId" AND po."supplierId" = ps."supplierId"
+ LEFT OUTER JOIN "service" s
+ ON s.id = pol."serviceId"
+ LEFT OUTER JOIN "serviceSupplier" ss
+ ON s.id = ss."serviceId" AND po."supplierId" = ss."supplierId";
+
+CREATE OR REPLACE VIEW "purchaseOrderLocations" WITH(SECURITY_INVOKER=true) AS
+ SELECT
+ po.id,
+ s.name AS "supplierName",
+ sa."addressLine1" AS "supplierAddressLine1",
+ sa."addressLine2" AS "supplierAddressLine2",
+ sa."city" AS "supplierCity",
+ sa."state" AS "supplierState",
+ sa."postalCode" AS "supplierPostalCode",
+ sa."countryCode" AS "supplierCountryCode",
+ dl.name AS "deliveryName",
+ dl."addressLine1" AS "deliveryAddressLine1",
+ dl."addressLine2" AS "deliveryAddressLine2",
+ dl."city" AS "deliveryCity",
+ dl."state" AS "deliveryState",
+ dl."postalCode" AS "deliveryPostalCode",
+ dl."countryCode" AS "deliveryCountryCode",
+ pod."dropShipment",
+ c.name AS "customerName",
+ ca."addressLine1" AS "customerAddressLine1",
+ ca."addressLine2" AS "customerAddressLine2",
+ ca."city" AS "customerCity",
+ ca."state" AS "customerState",
+ ca."postalCode" AS "customerPostalCode",
+ ca."countryCode" AS "customerCountryCode"
+ FROM "purchaseOrder" po
+ LEFT OUTER JOIN "supplier" s
+ ON s.id = po."supplierId"
+ LEFT OUTER JOIN "supplierLocation" sl
+ ON sl.id = po."supplierLocationId"
+ LEFT OUTER JOIN "address" sa
+ ON sa.id = sl."addressId"
+ INNER JOIN "purchaseOrderDelivery" pod
+ ON pod.id = po.id
+ LEFT OUTER JOIN "location" dl
+ ON dl.id = pod."locationId"
+ LEFT OUTER JOIN "customer" c
+ ON c.id = pod."customerId"
+ LEFT OUTER JOIN "customerLocation" cl
+ ON cl.id = pod."customerLocationId"
+ LEFT OUTER JOIN "address" ca
+ ON ca.id = cl."addressId";
+
+
+
+```
+
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index 7f796a65fa..fc05416088 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -1002,7 +1002,7 @@ export interface Database {
addressLine1: string | null;
addressLine2: string | null;
city: string | null;
- countryId: number | null;
+ countryCode: number | null;
fax: string | null;
id: string;
phone: string | null;
@@ -1013,7 +1013,7 @@ export interface Database {
addressLine1?: string | null;
addressLine2?: string | null;
city?: string | null;
- countryId?: number | null;
+ countryCode?: number | null;
fax?: string | null;
id?: string;
phone?: string | null;
@@ -1024,7 +1024,7 @@ export interface Database {
addressLine1?: string | null;
addressLine2?: string | null;
city?: string | null;
- countryId?: number | null;
+ countryCode?: number | null;
fax?: string | null;
id?: string;
phone?: string | null;
@@ -1033,8 +1033,8 @@ export interface Database {
};
Relationships: [
{
- foreignKeyName: "address_countryId_fkey";
- columns: ["countryId"];
+ foreignKeyName: "address_countryCode_fkey";
+ columns: ["countryCode"];
referencedRelation: "country";
referencedColumns: ["id"];
}
@@ -1146,7 +1146,7 @@ export interface Database {
addressLine2: string | null;
birthday: string | null;
city: string | null;
- countryId: number | null;
+ countryCode: number | null;
email: string;
fax: string | null;
firstName: string;
@@ -1166,7 +1166,7 @@ export interface Database {
addressLine2?: string | null;
birthday?: string | null;
city?: string | null;
- countryId?: number | null;
+ countryCode?: number | null;
email: string;
fax?: string | null;
firstName: string;
@@ -1186,7 +1186,7 @@ export interface Database {
addressLine2?: string | null;
birthday?: string | null;
city?: string | null;
- countryId?: number | null;
+ countryCode?: number | null;
email?: string;
fax?: string | null;
firstName?: string;
@@ -1203,8 +1203,8 @@ export interface Database {
};
Relationships: [
{
- foreignKeyName: "contact_countryId_fkey";
- columns: ["countryId"];
+ foreignKeyName: "contact_countryCode_fkey";
+ columns: ["countryCode"];
referencedRelation: "country";
referencedColumns: ["id"];
}
@@ -3004,7 +3004,7 @@ export interface Database {
addressLine1: string;
addressLine2: string | null;
city: string;
- country: string | null;
+ countryCode: string | null;
createdAt: string;
createdBy: string;
id: string;
@@ -3021,7 +3021,7 @@ export interface Database {
addressLine1: string;
addressLine2?: string | null;
city: string;
- country?: string | null;
+ countryCode?: string | null;
createdAt?: string;
createdBy: string;
id?: string;
@@ -3038,7 +3038,7 @@ export interface Database {
addressLine1?: string;
addressLine2?: string | null;
city?: string;
- country?: string | null;
+ countryCode?: string | null;
createdAt?: string;
createdBy?: string;
id?: string;
@@ -5155,6 +5155,12 @@ export interface Database {
referencedRelation: "purchaseOrder";
referencedColumns: ["id"];
},
+ {
+ foreignKeyName: "purchaseInvoiceLines_purchaseOrderId_fkey";
+ columns: ["purchaseOrderId"];
+ referencedRelation: "purchaseOrderLocations";
+ referencedColumns: ["id"];
+ },
{
foreignKeyName: "purchaseInvoiceLines_purchaseOrderId_fkey";
columns: ["purchaseOrderId"];
@@ -5359,6 +5365,7 @@ export interface Database {
status: Database["public"]["Enums"]["purchaseOrderStatus"];
supplierContactId: string | null;
supplierId: string;
+ supplierLocationId: string | null;
supplierReference: string | null;
type: Database["public"]["Enums"]["purchaseOrderType"];
updatedAt: string | null;
@@ -5376,6 +5383,7 @@ export interface Database {
status?: Database["public"]["Enums"]["purchaseOrderStatus"];
supplierContactId?: string | null;
supplierId: string;
+ supplierLocationId?: string | null;
supplierReference?: string | null;
type: Database["public"]["Enums"]["purchaseOrderType"];
updatedAt?: string | null;
@@ -5393,6 +5401,7 @@ export interface Database {
status?: Database["public"]["Enums"]["purchaseOrderStatus"];
supplierContactId?: string | null;
supplierId?: string;
+ supplierLocationId?: string | null;
supplierReference?: string | null;
type?: Database["public"]["Enums"]["purchaseOrderType"];
updatedAt?: string | null;
@@ -5459,6 +5468,12 @@ export interface Database {
referencedRelation: "suppliers";
referencedColumns: ["id"];
},
+ {
+ foreignKeyName: "purchaseOrder_supplierLocationId_fkey";
+ columns: ["supplierLocationId"];
+ referencedRelation: "supplierLocation";
+ referencedColumns: ["id"];
+ },
{
foreignKeyName: "purchaseOrder_updatedBy_fkey";
columns: ["updatedBy"];
@@ -5547,6 +5562,12 @@ export interface Database {
referencedRelation: "purchaseOrder";
referencedColumns: ["id"];
},
+ {
+ foreignKeyName: "purchaseOrderDelivery_id_fkey";
+ columns: ["id"];
+ referencedRelation: "purchaseOrderLocations";
+ referencedColumns: ["id"];
+ },
{
foreignKeyName: "purchaseOrderDelivery_id_fkey";
columns: ["id"];
@@ -5617,6 +5638,12 @@ export interface Database {
referencedRelation: "purchaseOrder";
referencedColumns: ["id"];
},
+ {
+ foreignKeyName: "purchaseOrderFavorites_purchaseOrderId_fkey";
+ columns: ["purchaseOrderId"];
+ referencedRelation: "purchaseOrderLocations";
+ referencedColumns: ["id"];
+ },
{
foreignKeyName: "purchaseOrderFavorites_purchaseOrderId_fkey";
columns: ["purchaseOrderId"];
@@ -5768,6 +5795,12 @@ export interface Database {
referencedRelation: "purchaseOrder";
referencedColumns: ["id"];
},
+ {
+ foreignKeyName: "purchaseOrderLine_purchaseOrderId_fkey";
+ columns: ["purchaseOrderId"];
+ referencedRelation: "purchaseOrderLocations";
+ referencedColumns: ["id"];
+ },
{
foreignKeyName: "purchaseOrderLine_purchaseOrderId_fkey";
columns: ["purchaseOrderId"];
@@ -5859,6 +5892,12 @@ export interface Database {
referencedRelation: "purchaseOrder";
referencedColumns: ["id"];
},
+ {
+ foreignKeyName: "purchaseOrderPayment_id_fkey";
+ columns: ["id"];
+ referencedRelation: "purchaseOrderLocations";
+ referencedColumns: ["id"];
+ },
{
foreignKeyName: "purchaseOrderPayment_id_fkey";
columns: ["id"];
@@ -5956,6 +5995,12 @@ export interface Database {
referencedRelation: "purchaseOrder";
referencedColumns: ["id"];
},
+ {
+ foreignKeyName: "purchaseOrderStatusHistory_purchaseOrderId_fkey";
+ columns: ["purchaseOrderId"];
+ referencedRelation: "purchaseOrderLocations";
+ referencedColumns: ["id"];
+ },
{
foreignKeyName: "purchaseOrderStatusHistory_purchaseOrderId_fkey";
columns: ["purchaseOrderId"];
@@ -5993,6 +6038,12 @@ export interface Database {
referencedRelation: "purchaseOrder";
referencedColumns: ["id"];
},
+ {
+ foreignKeyName: "purchaseOrderTransaction_purchaseOrderId_fkey";
+ columns: ["purchaseOrderId"];
+ referencedRelation: "purchaseOrderLocations";
+ referencedColumns: ["id"];
+ },
{
foreignKeyName: "purchaseOrderTransaction_purchaseOrderId_fkey";
columns: ["purchaseOrderId"];
@@ -8901,6 +8952,12 @@ export interface Database {
referencedRelation: "purchaseOrder";
referencedColumns: ["id"];
},
+ {
+ foreignKeyName: "purchaseOrderLine_purchaseOrderId_fkey";
+ columns: ["purchaseOrderId"];
+ referencedRelation: "purchaseOrderLocations";
+ referencedColumns: ["id"];
+ },
{
foreignKeyName: "purchaseOrderLine_purchaseOrderId_fkey";
columns: ["purchaseOrderId"];
@@ -8945,6 +9002,47 @@ export interface Database {
}
];
};
+ purchaseOrderLocations: {
+ Row: {
+ customerAddressLine1: string | null;
+ customerAddressLine2: string | null;
+ customerCity: string | null;
+ customerCountryCode: number | null;
+ customerName: string | null;
+ customerPostalCode: string | null;
+ customerState: string | null;
+ deliveryAddressLine1: string | null;
+ deliveryAddressLine2: string | null;
+ deliveryCity: string | null;
+ deliveryCountryCode: string | null;
+ deliveryName: string | null;
+ deliveryPostalCode: string | null;
+ deliveryState: string | null;
+ dropShipment: boolean | null;
+ id: string | null;
+ supplierAddressLine1: string | null;
+ supplierAddressLine2: string | null;
+ supplierCity: string | null;
+ supplierCountryCode: number | null;
+ supplierName: string | null;
+ supplierPostalCode: string | null;
+ supplierState: string | null;
+ };
+ Relationships: [
+ {
+ foreignKeyName: "address_countryCode_fkey";
+ columns: ["supplierCountryCode"];
+ referencedRelation: "country";
+ referencedColumns: ["id"];
+ },
+ {
+ foreignKeyName: "address_countryCode_fkey";
+ columns: ["customerCountryCode"];
+ referencedRelation: "country";
+ referencedColumns: ["id"];
+ }
+ ];
+ };
purchaseOrders: {
Row: {
closedAt: string | null;
@@ -8971,6 +9069,7 @@ export interface Database {
status: Database["public"]["Enums"]["purchaseOrderStatus"] | null;
supplierContactId: string | null;
supplierId: string | null;
+ supplierLocationId: string | null;
supplierName: string | null;
supplierReference: string | null;
type: Database["public"]["Enums"]["purchaseOrderType"] | null;
@@ -9040,6 +9139,12 @@ export interface Database {
referencedRelation: "suppliers";
referencedColumns: ["id"];
},
+ {
+ foreignKeyName: "purchaseOrder_supplierLocationId_fkey";
+ columns: ["supplierLocationId"];
+ referencedRelation: "supplierLocation";
+ referencedColumns: ["id"];
+ },
{
foreignKeyName: "purchaseOrder_updatedBy_fkey";
columns: ["updatedBy"];
diff --git a/packages/database/supabase/migrations/20230123004612_suppliers-and-customers.sql b/packages/database/supabase/migrations/20230123004612_suppliers-and-customers.sql
index ce8af9e5ec..0e64d1f153 100644
--- a/packages/database/supabase/migrations/20230123004612_suppliers-and-customers.sql
+++ b/packages/database/supabase/migrations/20230123004612_suppliers-and-customers.sql
@@ -20,12 +20,12 @@ CREATE TABLE "contact" (
"city" TEXT,
"state" TEXT,
"postalCode" TEXT,
- "countryId" INTEGER,
+ "countryCode" INTEGER,
"birthday" DATE,
"notes" TEXT,
CONSTRAINT "contact_pkey" PRIMARY KEY ("id"),
- CONSTRAINT "contact_countryId_fkey" FOREIGN KEY ("countryId") REFERENCES "country"("id") ON DELETE SET NULL ON UPDATE CASCADE
+ CONSTRAINT "contact_countryCode_fkey" FOREIGN KEY ("countryCode") REFERENCES "country"("id") ON DELETE SET NULL ON UPDATE CASCADE
);
@@ -36,12 +36,12 @@ CREATE TABLE "address" (
"city" TEXT,
"state" TEXT,
"postalCode" TEXT,
- "countryId" INTEGER,
+ "countryCode" INTEGER,
"phone" TEXT,
"fax" TEXT,
CONSTRAINT "address_pkey" PRIMARY KEY ("id"),
- CONSTRAINT "address_countryId_fkey" FOREIGN KEY ("countryId") REFERENCES "country"("id") ON DELETE SET NULL ON UPDATE CASCADE
+ CONSTRAINT "address_countryCode_fkey" FOREIGN KEY ("countryCode") REFERENCES "country"("id") ON DELETE SET NULL ON UPDATE CASCADE
);
CREATE TABLE "supplierStatus" (
diff --git a/packages/database/supabase/migrations/20230224035103_shifts.sql b/packages/database/supabase/migrations/20230224035103_shifts.sql
index 3544adb5aa..8cad23973f 100644
--- a/packages/database/supabase/migrations/20230224035103_shifts.sql
+++ b/packages/database/supabase/migrations/20230224035103_shifts.sql
@@ -6,7 +6,7 @@ CREATE TABLE "location" (
"city" TEXT NOT NULL,
"state" TEXT NOT NULL,
"postalCode" TEXT NOT NULL,
- "country" TEXT,
+ "countryCode" TEXT,
"timezone" TEXT NOT NULL,
"latitude" NUMERIC,
"longitude" NUMERIC,
diff --git a/packages/database/supabase/migrations/20230330024716_parts.sql b/packages/database/supabase/migrations/20230330024716_parts.sql
index e5031b6805..426687e910 100644
--- a/packages/database/supabase/migrations/20230330024716_parts.sql
+++ b/packages/database/supabase/migrations/20230330024716_parts.sql
@@ -342,8 +342,8 @@ ALTER TABLE "partSupplier" ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Employees with part/purchasing_view can view part suppliers" ON "partSupplier"
FOR SELECT
USING (
- OR(
- coalesce(get_my_claim('parts_view')::boolean,false),
+ (
+ coalesce(get_my_claim('parts_view')::boolean,false) OR
coalesce(get_my_claim('purchasing_view')::boolean,false)
)
AND (get_my_claim('role'::text)) = '"employee"'::jsonb
diff --git a/packages/database/supabase/migrations/20230412120726_services.sql b/packages/database/supabase/migrations/20230412120726_services.sql
index c8de870451..1db639ca06 100644
--- a/packages/database/supabase/migrations/20230412120726_services.sql
+++ b/packages/database/supabase/migrations/20230412120726_services.sql
@@ -81,8 +81,8 @@ ALTER TABLE "serviceSupplier" ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Employees with part/purchasing_view can view service suppliers" ON "serviceSupplier"
FOR SELECT
USING (
- OR(
- coalesce(get_my_claim('parts_view')::boolean,false),
+ (
+ coalesce(get_my_claim('parts_view')::boolean,false) OR
coalesce(get_my_claim('purchasing_view')::boolean,false)
)
AND (get_my_claim('role'::text)) = '"employee"'::jsonb
diff --git a/packages/database/supabase/migrations/20230510035345_purchasing.sql b/packages/database/supabase/migrations/20230510035345_purchasing.sql
index 5b3a1fc116..beb94ca870 100644
--- a/packages/database/supabase/migrations/20230510035345_purchasing.sql
+++ b/packages/database/supabase/migrations/20230510035345_purchasing.sql
@@ -166,6 +166,7 @@ CREATE TABLE "purchaseOrder" (
"orderDate" DATE NOT NULL DEFAULT CURRENT_DATE,
"notes" TEXT,
"supplierId" TEXT NOT NULL,
+ "supplierLocationId" TEXT,
"supplierContactId" TEXT,
"supplierReference" TEXT,
"closedAt" DATE,
@@ -178,7 +179,8 @@ CREATE TABLE "purchaseOrder" (
CONSTRAINT "purchaseOrder_pkey" PRIMARY KEY ("id"),
CONSTRAINT "purchaseOrder_purchaseOrderId_key" UNIQUE ("purchaseOrderId"),
CONSTRAINT "purchaseOrder_supplierId_fkey" FOREIGN KEY ("supplierId") REFERENCES "supplier" ("id") ON DELETE CASCADE,
- CONSTRAINT "purchaseOrder_supplierContactId_fkey" FOREIGN KEY ("supplierContactId") REFERENCES "supplierContact" ("id") ON DELETE CASCADE,
+ CONSTRAINT "purchaseOrder_supplierLocationId_fkey" FOREIGN KEY ("supplierLocationId") REFERENCES "supplierLocation" ("id") ON UPDATE CASCADE ON DELETE RESTRICT,
+ CONSTRAINT "purchaseOrder_supplierContactId_fkey" FOREIGN KEY ("supplierContactId") REFERENCES "supplierContact" ("id") ON UPDATE CASCADE ON DELETE RESTRICT,
CONSTRAINT "purchaseOrder_closedBy_fkey" FOREIGN KEY ("closedBy") REFERENCES "user" ("id") ON DELETE RESTRICT,
CONSTRAINT "purchaseOrder_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "user" ("id") ON DELETE RESTRICT,
CONSTRAINT "purchaseOrder_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE RESTRICT
diff --git a/packages/database/supabase/migrations/20231222200612_purchase-order-document.sql b/packages/database/supabase/migrations/20231222200612_purchase-order-document.sql
index 7ddeb3de08..410396c6a9 100644
--- a/packages/database/supabase/migrations/20231222200612_purchase-order-document.sql
+++ b/packages/database/supabase/migrations/20231222200612_purchase-order-document.sql
@@ -18,4 +18,49 @@ CREATE OR REPLACE VIEW "purchaseOrderLines" WITH(SECURITY_INVOKER=true) AS
LEFT OUTER JOIN "service" s
ON s.id = pol."serviceId"
LEFT OUTER JOIN "serviceSupplier" ss
- ON s.id = ss."serviceId" AND po."supplierId" = ss."supplierId";
\ No newline at end of file
+ ON s.id = ss."serviceId" AND po."supplierId" = ss."supplierId";
+
+CREATE OR REPLACE VIEW "purchaseOrderLocations" WITH(SECURITY_INVOKER=true) AS
+ SELECT
+ po.id,
+ s.name AS "supplierName",
+ sa."addressLine1" AS "supplierAddressLine1",
+ sa."addressLine2" AS "supplierAddressLine2",
+ sa."city" AS "supplierCity",
+ sa."state" AS "supplierState",
+ sa."postalCode" AS "supplierPostalCode",
+ sa."countryCode" AS "supplierCountryCode",
+ dl.name AS "deliveryName",
+ dl."addressLine1" AS "deliveryAddressLine1",
+ dl."addressLine2" AS "deliveryAddressLine2",
+ dl."city" AS "deliveryCity",
+ dl."state" AS "deliveryState",
+ dl."postalCode" AS "deliveryPostalCode",
+ dl."countryCode" AS "deliveryCountryCode",
+ pod."dropShipment",
+ c.name AS "customerName",
+ ca."addressLine1" AS "customerAddressLine1",
+ ca."addressLine2" AS "customerAddressLine2",
+ ca."city" AS "customerCity",
+ ca."state" AS "customerState",
+ ca."postalCode" AS "customerPostalCode",
+ ca."countryCode" AS "customerCountryCode"
+ FROM "purchaseOrder" po
+ LEFT OUTER JOIN "supplier" s
+ ON s.id = po."supplierId"
+ LEFT OUTER JOIN "supplierLocation" sl
+ ON sl.id = po."supplierLocationId"
+ LEFT OUTER JOIN "address" sa
+ ON sa.id = sl."addressId"
+ INNER JOIN "purchaseOrderDelivery" pod
+ ON pod.id = po.id
+ LEFT OUTER JOIN "location" dl
+ ON dl.id = pod."locationId"
+ LEFT OUTER JOIN "customer" c
+ ON c.id = pod."customerId"
+ LEFT OUTER JOIN "customerLocation" cl
+ ON cl.id = pod."customerLocationId"
+ LEFT OUTER JOIN "address" ca
+ ON ca.id = cl."addressId";
+
+
diff --git a/packages/documents/src/PurchaseOrderPDF/PurchaseOrderPDF.tsx b/packages/documents/src/PurchaseOrderPDF/PurchaseOrderPDF.tsx
index 1343ac4c7b..3ef1fbbb49 100644
--- a/packages/documents/src/PurchaseOrderPDF/PurchaseOrderPDF.tsx
+++ b/packages/documents/src/PurchaseOrderPDF/PurchaseOrderPDF.tsx
@@ -7,117 +7,144 @@ import type { PDF } from "../types";
interface PurchaseOrderPDFProps extends PDF {
purchaseOrder: Database["public"]["Views"]["purchaseOrders"]["Row"];
purchaseOrderLines: Database["public"]["Views"]["purchaseOrderLines"]["Row"][];
+ purchaseOrderLocations: Database["public"]["Views"]["purchaseOrderLocations"]["Row"];
}
// TODO: format currency based on settings
+const styles = StyleSheet.create({
+ row: {
+ display: "flex",
+ alignItems: "flex-start",
+ flexDirection: "row",
+ justifyContent: "space-between",
+ marginBottom: 20,
+ width: "100%",
+ },
+ colFull: {
+ display: "flex",
+ flexDirection: "column",
+ rowGap: 3,
+ fontSize: 11,
+ fontWeight: 500,
+ width: "100%",
+ },
+ colHalf: {
+ display: "flex",
+ flexDirection: "column",
+ rowGap: 3,
+ fontSize: 11,
+ fontWeight: 500,
+ width: "50%",
+ },
+ colThird: {
+ display: "flex",
+ flexDirection: "column",
+ rowGap: 3,
+ fontSize: 11,
+ fontWeight: 500,
+ width: "32%",
+ },
+ label: {
+ color: "#7d7d7d",
+ },
+ bold: {
+ fontWeight: 700,
+ color: "#000000",
+ },
+ table: {
+ marginBottom: 20,
+ fontSize: 10,
+ },
+ thead: {
+ flexGrow: 1,
+ flexDirection: "row",
+ justifyContent: "space-between",
+ alignItems: "center",
+ marginTop: "20px",
+ padding: "6px 3px 6px 3px",
+ borderTop: 1,
+ borderTopColor: "#CCCCCC",
+ borderTopStyle: "solid",
+ borderBottom: 1,
+ borderBottomColor: "#CCCCCC",
+ borderBottomStyle: "solid",
+ fontWeight: 700,
+ color: "#7d7d7d",
+ textTransform: "uppercase",
+ },
+ tr: {
+ flexGrow: 1,
+ flexDirection: "row",
+ justifyContent: "space-between",
+ padding: "6px 3px 6px 3px",
+ borderBottom: 1,
+ borderBottomColor: "#CCCCCC",
+ },
+ tfoot: {
+ flexGrow: 1,
+ flexDirection: "row",
+ justifyContent: "space-between",
+ alignItems: "center",
+ padding: "6px 3px 6px 3px",
+ borderTopStyle: "solid",
+ borderBottom: 1,
+ borderBottomColor: "#CCCCCC",
+ borderBottomStyle: "solid",
+ fontWeight: 700,
+ color: "#7d7d7d",
+ textTransform: "uppercase",
+ },
+ tableCol1: {
+ width: "50%",
+ textAlign: "left",
+ },
+ tableCol2: {
+ width: "15%",
+ textAlign: "right",
+ },
+ tableCol3: {
+ width: "15%",
+ textAlign: "right",
+ },
+ tableCol4: {
+ width: "20%",
+ textAlign: "right",
+ },
+});
+
const PurchaseOrderPDF = ({
company,
meta,
purchaseOrder,
purchaseOrderLines,
+ purchaseOrderLocations,
title = "Purchase Order",
}: PurchaseOrderPDFProps) => {
- const styles = StyleSheet.create({
- row: {
- display: "flex",
- alignItems: "flex-start",
- flexDirection: "row",
- justifyContent: "space-between",
- marginBottom: 20,
- width: "100%",
- },
- colFull: {
- display: "flex",
- flexDirection: "column",
- rowGap: 3,
- fontSize: 11,
- fontWeight: 500,
- width: "100%",
- },
- colHalf: {
- display: "flex",
- flexDirection: "column",
- rowGap: 3,
- fontSize: 11,
- fontWeight: 500,
- width: "50%",
- },
- colThird: {
- display: "flex",
- flexDirection: "column",
- rowGap: 3,
- fontSize: 11,
- fontWeight: 500,
- width: "32%",
- },
- label: {
- color: "#7d7d7d",
- },
- bold: {
- fontWeight: 700,
- color: "#000000",
- },
- table: {
- marginBottom: 20,
- fontSize: 10,
- },
- thead: {
- flexGrow: 1,
- flexDirection: "row",
- justifyContent: "space-between",
- alignItems: "center",
- marginTop: "20px",
- padding: "6px 3px 6px 3px",
- borderTop: 1,
- borderTopColor: "#CCCCCC",
- borderTopStyle: "solid",
- borderBottom: 1,
- borderBottomColor: "#CCCCCC",
- borderBottomStyle: "solid",
- fontWeight: 700,
- color: "#7d7d7d",
- textTransform: "uppercase",
- },
- tr: {
- flexGrow: 1,
- flexDirection: "row",
- justifyContent: "space-between",
- padding: "6px 3px 6px 3px",
- borderBottom: 1,
- borderBottomColor: "#CCCCCC",
- },
- tfoot: {
- flexGrow: 1,
- flexDirection: "row",
- justifyContent: "space-between",
- alignItems: "center",
- padding: "6px 3px 6px 3px",
- borderTopStyle: "solid",
- borderBottom: 1,
- borderBottomColor: "#CCCCCC",
- borderBottomStyle: "solid",
- fontWeight: 700,
- color: "#7d7d7d",
- textTransform: "uppercase",
- },
- tableCol1: {
- width: "50%",
- textAlign: "left",
- },
- tableCol2: {
- width: "15%",
- textAlign: "right",
- },
- tableCol3: {
- width: "15%",
- textAlign: "right",
- },
- tableCol4: {
- width: "20%",
- textAlign: "right",
- },
- });
+ const {
+ supplierName,
+ supplierAddressLine1,
+ supplierAddressLine2,
+ supplierCity,
+ supplierState,
+ supplierPostalCode,
+ supplierCountryCode,
+ deliveryName,
+ deliveryAddressLine1,
+ deliveryAddressLine2,
+ deliveryCity,
+ deliveryState,
+ deliveryPostalCode,
+ deliveryCountryCode,
+ dropShipment,
+ customerName,
+ customerAddressLine1,
+ customerAddressLine2,
+ customerCity,
+ customerState,
+ customerPostalCode,
+ customerCountryCode,
+ } = purchaseOrderLocations;
return (
<Template
@@ -146,17 +173,37 @@ const PurchaseOrderPDF = ({
<View style={styles.row}>
<View style={styles.colThird}>
<Text style={styles.label}>Supplier</Text>
- <Text>John Doe</Text>
- <Text>123 Main Street</Text>
- <Text>Anytown, CA 12345</Text>
- </View>
- <View style={styles.colThird}>
- <Text style={styles.label}>Ship To</Text>
- <Text>Headquarters</Text>
- <Text>Barry Mantelow</Text>
- <Text>123 Strange Rd</Text>
- <Text>Bazooka, AL 12345</Text>
+ <Text>{supplierName}</Text>
+ {supplierAddressLine1 && <Text>{supplierAddressLine1}</Text>}
+ {supplierAddressLine2 && <Text>{supplierAddressLine2}</Text>}
+ <Text>
+ {formatAddress(supplierCity, supplierState, supplierPostalCode)}
+ </Text>
+ <Text>{supplierCountryCode}</Text>
</View>
+ {dropShipment ? (
+ <View style={styles.colThird}>
+ <Text style={styles.label}>Ship To</Text>
+ <Text>{customerName}</Text>
+ {customerAddressLine1 && <Text>{customerAddressLine1}</Text>}
+ {customerAddressLine2 && <Text>{customerAddressLine2}</Text>}
+ <Text>
+ {formatAddress(customerCity, customerState, customerPostalCode)}
+ </Text>
+ <Text>{customerCountryCode}</Text>
+ </View>
+ ) : (
+ <View style={styles.colThird}>
+ <Text style={styles.label}>Ship To</Text>
+ <Text>{deliveryName}</Text>
+ {deliveryAddressLine1 && <Text>{deliveryAddressLine1}</Text>}
+ {deliveryAddressLine2 && <Text>{deliveryAddressLine2}</Text>}
+ <Text>
+ {formatAddress(deliveryCity, deliveryState, deliveryPostalCode)}
+ </Text>
+ <Text>{deliveryCountryCode}</Text>
+ </View>
+ )}
</View>
<View style={styles.row}>
<View style={styles.colThird}>
@@ -249,6 +296,18 @@ const PurchaseOrderPDF = ({
);
};
+function formatAddress(
+ city: string | null,
+ state: string | null,
+ postalCode: string | null
+) {
+ if (city && state && postalCode) {
+ return `${city}, ${state}, ${postalCode}`;
+ }
+
+ return "";
+}
+
function getLineDescription(
line: Database["public"]["Views"]["purchaseOrderLines"]["Row"]
) {
diff --git a/packages/documents/src/components/Header.tsx b/packages/documents/src/components/Header.tsx
index 81294b0a30..0853c24afe 100644
--- a/packages/documents/src/components/Header.tsx
+++ b/packages/documents/src/components/Header.tsx
@@ -6,26 +6,26 @@ type HeaderProps = {
title: string;
};
-const Header = ({ title, company }: HeaderProps) => {
- const styles = StyleSheet.create({
- header: {
- fontSize: 11,
- display: "flex",
- flexDirection: "row-reverse",
- justifyContent: "space-between",
- alignItems: "flex-start",
- marginBottom: 20,
- },
- logo: {
- height: 70,
- },
- title: {
- height: 70,
- fontSize: 26,
- fontWeight: 900,
- },
- });
+const styles = StyleSheet.create({
+ header: {
+ fontSize: 11,
+ display: "flex",
+ flexDirection: "row-reverse",
+ justifyContent: "space-between",
+ alignItems: "flex-start",
+ marginBottom: 20,
+ },
+ logo: {
+ height: 70,
+ },
+ title: {
+ height: 70,
+ fontSize: 26,
+ fontWeight: 900,
+ },
+});
+const Header = ({ title, company }: HeaderProps) => {
return (
<View style={styles.header}>
<View>
diff --git a/packages/documents/src/components/Summary.tsx b/packages/documents/src/components/Summary.tsx
index 4ab3f1fd89..ff1a102d1c 100644
--- a/packages/documents/src/components/Summary.tsx
+++ b/packages/documents/src/components/Summary.tsx
@@ -9,52 +9,52 @@ type SummaryProps = {
}[];
};
-const Summary = ({ company, items }: SummaryProps) => {
- const styles = StyleSheet.create({
- summary: {
- display: "flex",
- flexDirection: "row",
- justifyContent: "space-between",
- alignItems: "flex-start",
- marginBottom: 20,
- },
- companyDetails: {
- display: "flex",
- flexDirection: "column",
- rowGap: 3,
- fontSize: 11,
- fontWeight: 500,
- width: "68%",
- },
- companyName: {
- fontSize: 13,
- color: "#000000",
- fontWeight: 900,
- },
- documentSummary: {
- display: "flex",
- flexDirection: "column",
- rowGap: 3,
- fontSize: 11,
- fontWeight: 500,
- width: "32%",
- },
- documentSummaryItem: {
- display: "flex",
- flexDirection: "row",
- justifyContent: "flex-start",
- marginBottom: 5,
- },
- documentSummaryLabel: {
- color: "#7d7d7d",
- fontWeight: 700,
- width: "30%",
- },
- documentSummaryValue: {
- fontWeight: 500,
- },
- });
+const styles = StyleSheet.create({
+ summary: {
+ display: "flex",
+ flexDirection: "row",
+ justifyContent: "space-between",
+ alignItems: "flex-start",
+ marginBottom: 20,
+ },
+ companyDetails: {
+ display: "flex",
+ flexDirection: "column",
+ rowGap: 3,
+ fontSize: 11,
+ fontWeight: 500,
+ width: "68%",
+ },
+ companyName: {
+ fontSize: 13,
+ color: "#000000",
+ fontWeight: 900,
+ },
+ documentSummary: {
+ display: "flex",
+ flexDirection: "column",
+ rowGap: 3,
+ fontSize: 11,
+ fontWeight: 500,
+ width: "32%",
+ },
+ documentSummaryItem: {
+ display: "flex",
+ flexDirection: "row",
+ justifyContent: "flex-start",
+ marginBottom: 5,
+ },
+ documentSummaryLabel: {
+ color: "#7d7d7d",
+ fontWeight: 700,
+ width: "30%",
+ },
+ documentSummaryValue: {
+ fontWeight: 500,
+ },
+});
+const Summary = ({ company, items }: SummaryProps) => {
return (
<View style={styles.summary}>
<View style={styles.companyDetails}>