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
Posting groups (#37)
Brad Barbin1d5df742c6ce
diff --git a/SCHEMA.md b/SCHEMA.mdindex 5826fa6bf6..d4eb8820a1 100644--- a/SCHEMA.md+++ b/SCHEMA.md@@ -285,9 +285,6 @@ CREATE TABLE "user" (CONSTRAINT "user_pkey" PRIMARY KEY ("id"));-INSERT INTO "user" ("id", "email", "firstName", "lastName")-VALUES ('system', '[email protected]', 'System', 'Operation');-CREATE UNIQUE INDEX "index_user_email_key" ON "user"("email");CREATE INDEX "index_user_fullName" ON "user"("fullName");@@ -515,16 +512,6 @@ CREATE TABLE "attributeDataType" ());-INSERT INTO "attributeDataType" ("label", "isBoolean", "isDate", "isList", "isNumeric", "isText", "isUser")-VALUES- ('Yes/No', true, false, false, false, false, false),- ('Date', false, true, false, false, false, false),- ('List', false, false, true, false, false, false),- ('Numeric', false, false, false, true, false, false),- ('Text', false, false, false, false, true, false),- ('User', false, false, false, false, false, true);---- ALTER TABLE "attributeDataType" ENABLE ROW LEVEL SECURITY;CREATE TABLE "userAttribute" (@@ -716,21 +703,25 @@ CREATE TABLE "supplierStatus" ("createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"updatedAt" TIMESTAMP WITH TIME ZONE,- CONSTRAINT "supplierStatus_pkey" PRIMARY KEY ("id")+ CONSTRAINT "supplierStatus_pkey" PRIMARY KEY ("id"),+ CONSTRAINT "supplierStatus_name_unique" UNIQUE ("name"));-INSERT INTO "supplierStatus" ("name") VALUES ('Active'), ('Inactive'), ('Pending'), ('Rejected');-CREATE TABLE "supplierType" ("id" TEXT NOT NULL DEFAULT uuid_generate_v4(),"name" TEXT NOT NULL,"color" TEXT DEFAULT '#000000',"protected" BOOLEAN NOT NULL DEFAULT false,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),+ "createdBy" TEXT NOT NULL,+ "updatedBy" TEXT,"updatedAt" TIMESTAMP WITH TIME ZONE,CONSTRAINT "supplierType_pkey" PRIMARY KEY ("id"),- CONSTRAINT "supplierType_colorCheck" CHECK ("color" is null or "color" ~* '^#[a-f0-9]{6}$')+ CONSTRAINT "supplierType_name_unique" UNIQUE ("name"),+ CONSTRAINT "supplierType_colorCheck" CHECK ("color" is null or "color" ~* '^#[a-f0-9]{6}$'),+ CONSTRAINT "supplierType_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "user"("id") ON UPDATE CASCADE ON DELETE RESTRICT,+ CONSTRAINT "supplierType_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user"("id") ON UPDATE CASCADE ON DELETE SET NULL);CREATE TABLE "supplier" (@@ -798,21 +789,25 @@ CREATE TABLE "customerStatus" ("createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"updatedAt" TIMESTAMP WITH TIME ZONE,- CONSTRAINT "customerStatus_pkey" PRIMARY KEY ("id")+ CONSTRAINT "customerStatus_pkey" PRIMARY KEY ("id"),+ CONSTRAINT "customerStatus_name_unique" UNIQUE ("name"));-INSERT INTO "customerStatus" ("name") VALUES ('Active'), ('Inactive'), ('Prospect'), ('Lead'), ('On Hold'), ('Cancelled'), ('Archived');-CREATE TABLE "customerType" ("id" TEXT NOT NULL DEFAULT uuid_generate_v4(),"name" TEXT NOT NULL,"color" TEXT DEFAULT '#000000',"protected" BOOLEAN NOT NULL DEFAULT false,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),+ "createdBy" TEXT NOT NULL,+ "updatedBy" TEXT,"updatedAt" TIMESTAMP WITH TIME ZONE,CONSTRAINT "customerType_pkey" PRIMARY KEY ("id"),- CONSTRAINT "customerType_colorCheck" CHECK ("color" is null or "color" ~* '^#[a-f0-9]{6}$')+ CONSTRAINT "customerType_name_unique" UNIQUE ("name"),+ CONSTRAINT "customerType_colorCheck" CHECK ("color" is null or "color" ~* '^#[a-f0-9]{6}$'),+ CONSTRAINT "customerType_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "user"("id") ON UPDATE CASCADE ON DELETE RESTRICT,+ CONSTRAINT "customerType_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user"("id") ON UPDATE CASCADE ON DELETE SET NULL);CREATE TABLE "customer" (@@ -2954,9 +2949,6 @@ CREATE TABLE "currency" (CONSTRAINT "currency_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user"("id"));-INSERT INTO "currency" ("name", "code", "symbol", "exchangeRate", "isBaseCurrency", "createdBy")-VALUES ('US Dollar', 'USD', '$', 1.0000, true, 'system');-CREATE INDEX "currency_code_index" ON "currency" ("code");ALTER TABLE "currency" ENABLE ROW LEVEL SECURITY;@@ -3044,27 +3036,6 @@ CREATE TABLE "accountCategory" (CONSTRAINT "accountCategory_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user"("id"));-INSERT INTO "accountCategory" ("category", "incomeBalance", "normalBalance", "createdBy")-VALUES- ('Bank', 'Balance Sheet', 'Credit', 'system'),- ('Accounts Receivable', 'Balance Sheet', 'Credit', 'system'),- ('Inventory', 'Balance Sheet', 'Debit', 'system'),- ('Other Current Asset', 'Balance Sheet', 'Debit', 'system'),- ('Fixed Asset', 'Balance Sheet', 'Debit', 'system'),- ('Accumulated Depreciation', 'Balance Sheet', 'Credit', 'system'),- ('Other Asset', 'Balance Sheet', 'Debit', 'system'),- ('Accounts Payable', 'Balance Sheet', 'Debit', 'system'),- ('Other Current Liability', 'Balance Sheet', 'Debit', 'system'),- ('Long Term Liability', 'Balance Sheet', 'Debit', 'system'),- ('Equity - No Close', 'Balance Sheet', 'Credit', 'system'),- ('Equity - Close', 'Balance Sheet', 'Credit', 'system'),- ('Retained Earnings', 'Balance Sheet', 'Credit', 'system'),- ('Income', 'Income Statement', 'Credit', 'system'),- ('Cost of Goods Sold', 'Income Statement', 'Debit', 'system'),- ('Expense', 'Income Statement', 'Debit', 'system'),- ('Other Income', 'Income Statement', 'Credit', 'system'),- ('Other Expense', 'Income Statement', 'Debit', 'system');-ALTER TABLE "accountCategory" ENABLE ROW LEVEL SECURITY;CREATE POLICY "Employees with accounting_view can view account categories" ON "accountCategory"@@ -3267,13 +3238,6 @@ CREATE TABLE "partGroup" ("id" TEXT NOT NULL DEFAULT xid(),"name" TEXT NOT NULL,"description" TEXT,- "salesAccountId" TEXT,- "discountAccountId" TEXT,- "inventoryAccountId" TEXT,- "costOfGoodsSoldLaborAccountId" TEXT,- "costOfGoodsSoldMaterialAccountId" TEXT,- "costOfGoodsSoldOverheadAccountId" TEXT,- "costOfGoodsSoldSubcontractorAccountId" TEXT,"active" BOOLEAN NOT NULL DEFAULT true,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),@@ -3282,13 +3246,6 @@ CREATE TABLE "partGroup" (CONSTRAINT "partGroup_pkey" PRIMARY KEY ("id"),CONSTRAINT "partGroup_name_key" UNIQUE ("name"),- CONSTRAINT "partGroup_salesAccountId_fkey" FOREIGN KEY ("salesAccountId") REFERENCES "account"("number") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "partGroup_discountAccountId_fkey" FOREIGN KEY ("discountAccountId") REFERENCES "account"("number") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "partGroup_inventoryAccountId_fkey" FOREIGN KEY ("inventoryAccountId") REFERENCES "account"("number") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "partGroup_costOfGoodsSoldLaborAccountId_fkey" FOREIGN KEY ("costOfGoodsSoldLaborAccountId") REFERENCES "account"("number") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "partGroup_costOfGoodsSoldMaterialAccountId_fkey" FOREIGN KEY ("costOfGoodsSoldMaterialAccountId") REFERENCES "account"("number") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "partGroup_costOfGoodsSoldOverheadAccountId_fkey" FOREIGN KEY ("costOfGoodsSoldOverheadAccountId") REFERENCES "account"("number") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "partGroup_costOfGoodsSoldSubcontractorAccountId_fkey" FOREIGN KEY ("costOfGoodsSoldSubcontractorAccountId") REFERENCES "account"("number") ON DELETE CASCADE ON UPDATE CASCADE,CONSTRAINT "partGroup_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "user"("id"),CONSTRAINT "partGroup_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user"("id"));@@ -3375,11 +3332,6 @@ CREATE TABLE "unitOfMeasure" (CREATE INDEX "unitOfMeasure_code_index" ON "unitOfMeasure"("code");-INSERT INTO "unitOfMeasure" ("code", "name", "createdBy")-VALUES-( 'EA', 'Each', 'system'),-( 'PCS', 'Pieces', 'system');-ALTER TABLE "unitOfMeasure" ENABLE ROW LEVEL SECURITY;CREATE POLICY "Authenticated users can view units of measure" ON "unitOfMeasure"@@ -3529,9 +3481,6 @@ CREATE TABLE "partCost" ("costingMethod" "partCostingMethod" NOT NULL,"standardCost" NUMERIC(15,5) NOT NULL DEFAULT 0,"unitCost" NUMERIC(15,5) NOT NULL DEFAULT 0,- "salesAccountId" TEXT,- "discountAccountId" TEXT,- "inventoryAccountId" TEXT,"costIsAdjusted" BOOLEAN NOT NULL DEFAULT false,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),@@ -3539,9 +3488,6 @@ CREATE TABLE "partCost" ("updatedAt" TIMESTAMP WITH TIME ZONE,CONSTRAINT "partCost_partId_fkey" FOREIGN KEY ("partId") REFERENCES "part"("id") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "partGroup_salesAccountId_fkey" FOREIGN KEY ("salesAccountId") REFERENCES "account"("number") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "partGroup_discountAccountId_fkey" FOREIGN KEY ("discountAccountId") REFERENCES "account"("number") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "partGroup_inventoryAccountId_fkey" FOREIGN KEY ("inventoryAccountId") REFERENCES "account"("number") ON DELETE CASCADE ON UPDATE CASCADE,CONSTRAINT "partGroup_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "user"("id"),CONSTRAINT "partGroup_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user"("id"));@@ -3950,7 +3896,7 @@ CREATE TABLE "partPlanning" (CREATE INDEX "partPlanning_partId_locationId_index" ON "partPlanning" ("partId", "locationId");ALTER TABLE "partPlanning" ENABLE ROW LEVEL SECURITY;-CREATE POLICY "Employees with part_view can view part planning" ON "partPlanning"+CREATE POLICY "Employees with parts_view can view part planning" ON "partPlanning"FOR SELECTUSING (coalesce(get_my_claim('parts_view')::boolean,false)@@ -3958,7 +3904,7 @@ CREATE POLICY "Employees with part_view can view part planning" ON "partPlanning);-- these are records are created lazily when a user attempts to view them-CREATE POLICY "Employees with part_view can insert part planning" ON "partPlanning"+CREATE POLICY "Employees with parts_view can insert part planning" ON "partPlanning"FOR INSERTWITH CHECK (coalesce(get_my_claim('parts_view')::boolean,false)@@ -4328,18 +4274,6 @@ CREATE TABLE "paymentTerm" (CONSTRAINT "paymentTerm_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE CASCADE);-INSERT INTO "paymentTerm" ("name", "daysDue", "calculationMethod", "daysDiscount", "discountPercentage", "createdBy")-VALUES- ('Net 15', 15, 'Net', 0, 0, 'system'),- ('Net 30', 30, 'Net', 0, 0, 'system'),- ('Net 50', 50, 'Net', 0, 0, 'system'),- ('Net 60', 60, 'Net', 0, 0, 'system'),- ('Net 90', 90, 'Net', 0, 0, 'system'),- ('1% 10 Net 30', 30, 'Net', 10, 1, 'system'),- ('2% 10 Net 30', 30, 'Net', 10, 2, 'system'),- ('Due on Receipt', 0, 'Net', 0, 0, 'system'),- ('Net EOM 10', 10, 'End of Month', 0, 0, 'system');-ALTER TABLE "paymentTerm" ENABLE ROW LEVEL SECURITY;CREATE POLICY "Certain employees can view payment terms" ON "paymentTerm"@@ -4769,9 +4703,6 @@ CREATE TABLE "sequence" (CONSTRAINT "sequence_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE CASCADE);-INSERT INTO "sequence" ("table", "name", "prefix", "suffix", "next", "size", "step")-VALUES ('purchaseOrder', 'Purchase Order', 'PO', NULL, 0, 6, 1);-```@@ -5516,8 +5447,36 @@ CREATE INDEX "receipt_locationId_idx" ON "receipt" ("locationId");CREATE INDEX "receipt_sourceDocumentId_idx" ON "receipt" ("sourceDocumentId");CREATE INDEX "receipt_supplierId_idx" ON "receipt" ("supplierId");-INSERT INTO "sequence" ("table", "name", "prefix", "suffix", "next", "size", "step")-VALUES ('receipt', 'Receipt', 'RE', NULL, 0, 6, 1);+ALTER TABLE "receipt" ENABLE ROW LEVEL SECURITY;++CREATE POLICY "Employees with inventory_view can view receipts" ON "receipt"+ FOR SELECT+ USING (+ coalesce(get_my_claim('inventory_view')::boolean, false) = true+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );+++CREATE POLICY "Employees with inventory_create can insert receipts" ON "receipt"+ FOR INSERT+ WITH CHECK (+ coalesce(get_my_claim('inventory_create')::boolean,false)+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+);++CREATE POLICY "Employees with inventory_update can update receipts" ON "receipt"+ FOR UPDATE+ USING (+ coalesce(get_my_claim('inventory_update')::boolean, false) = true+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );++CREATE POLICY "Employees with inventory_delete can delete receipts" ON "receipt"+ FOR DELETE+ USING (+ coalesce(get_my_claim('inventory_delete')::boolean, false) = true+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );CREATE TABLE "receiptLine" ("id" TEXT NOT NULL DEFAULT xid(),@@ -5549,6 +5508,37 @@ CREATE INDEX "receiptLine_receiptId_idx" ON "receiptLine" ("receiptId");CREATE INDEX "receiptLine_lineId_idx" ON "receiptLine" ("lineId");CREATE INDEX "receiptLine_receiptId_lineId_idx" ON "receiptLine" ("receiptId", "lineId");+ALTER TABLE "receiptLine" ENABLE ROW LEVEL SECURITY;++CREATE POLICY "Employees with inventory_view can view receipt lines" ON "receiptLine"+ FOR SELECT+ USING (+ coalesce(get_my_claim('inventory_view')::boolean, false) = true+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );+++CREATE POLICY "Employees with inventory_create can insert receipt lines" ON "receiptLine"+ FOR INSERT+ WITH CHECK (+ coalesce(get_my_claim('inventory_create')::boolean,false)+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+);++CREATE POLICY "Employees with inventory_update can update receipt lines" ON "receiptLine"+ FOR UPDATE+ USING (+ coalesce(get_my_claim('inventory_update')::boolean, false) = true+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );++CREATE POLICY "Employees with inventory_delete can delete receipt lines" ON "receiptLine"+ FOR DELETE+ USING (+ coalesce(get_my_claim('inventory_delete')::boolean, false) = true+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );+CREATE VIEW "receipt_quantity_received_by_line" ASSELECTr."sourceDocumentId",@@ -5574,3 +5564,671 @@ CREATE VIEW "user_default_view" ASLEFT JOIN "employeeJob" ej ON ej.id = u.id;```+++## `posting-groups`++```sql+CREATE TABLE "accountDefault" (+ "id" BOOLEAN NOT NULL DEFAULT TRUE,+ -- income statement+ -- revenue+ "salesAccount" TEXT NOT NULL,+ "salesDiscountAccount" TEXT NOT NULL,++ -- part cost+ "costOfGoodsSoldAccount" TEXT NOT NULL,+ "purchaseAccount" TEXT NOT NULL,+ "directCostAppliedAccount" TEXT NOT NULL,+ "overheadCostAppliedAccount" TEXT NOT NULL,+ "purchaseVarianceAccount" TEXT NOT NULL,+ "inventoryAdjustmentVarianceAccount" TEXT NOT NULL,++ -- direct costs+ "materialVarianceAccount" TEXT NOT NULL,+ "capacityVarianceAccount" TEXT NOT NULL,+ "overheadAccount" TEXT NOT NULL,+ "maintenanceAccount" TEXT NOT NULL,++ -- depreciaition of fixed assets+ "assetDepreciationExpenseAccount" TEXT NOT NULL,+ "assetGainsAndLossesAccount" TEXT NOT NULL,+ "serviceChargeAccount" TEXT NOT NULL,++ -- interest+ "interestAccount" TEXT NOT NULL,+ "supplierPaymentDiscountAccount" TEXT NOT NULL,+ "customerPaymentDiscountAccount" TEXT NOT NULL,+ "roundingAccount" TEXT NOT NULL,++ -- balance sheet+ -- assets+ "assetAquisitionCostAccount" TEXT NOT NULL,+ "assetAquisitionCostOnDisposalAccount" TEXT NOT NULL,+ "accumulatedDepreciationAccount" TEXT NOT NULL,+ "accumulatedDepreciationOnDisposalAccount" TEXT NOT NULL,++ -- current assets+ "inventoryAccount" TEXT NOT NULL,+ "inventoryInterimAccrualAccount" TEXT NOT NULL,+ "workInProgressAccount" TEXT NOT NULL,+ "receivablesAccount" TEXT NOT NULL,+ "inventoryShippedNotInvoicedAccount" TEXT NOT NULL,+ "bankCashAccount" TEXT NOT NULL,+ "bankLocalCurrencyAccount" TEXT NOT NULL,+ "bankForeignCurrencyAccount" TEXT NOT NULL,++ -- liabilities+ "prepaymentAccount" TEXT NOT NULL,+ "payablesAccount" TEXT NOT NULL,+ "inventoryReceivedNotInvoicedAccount" TEXT NOT NULL,+ "salesTaxPayableAccount" TEXT NOT NULL,+ "purchaseTaxPayableAccount" TEXT NOT NULL,+ "reverseChargeSalesTaxPayableAccount" TEXT NOT NULL,++ -- retained earnings+ "retainedEarningsAccount" TEXT NOT NULL,++ "updatedBy" TEXT,++++ CONSTRAINT "accountDefault_pkey" PRIMARY KEY ("id"),+ -- this is a hack to make sure that this table only ever has one row+ CONSTRAINT "accountDefault_id_check" CHECK ("id" = TRUE),+ CONSTRAINT "accountDefault_id_unique" UNIQUE ("id"),+ CONSTRAINT "accountDefault_salesAccount_fkey" FOREIGN KEY ("salesAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_salesDiscountAccount_fkey" FOREIGN KEY ("salesDiscountAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_costOfGoodsSoldAccount_fkey" FOREIGN KEY ("costOfGoodsSoldAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_purchaseAccount_fkey" FOREIGN KEY ("purchaseAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_directCostAppliedAccount_fkey" FOREIGN KEY ("directCostAppliedAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_overheadCostAppliedAccount_fkey" FOREIGN KEY ("overheadCostAppliedAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_purchaseVarianceAccount_fkey" FOREIGN KEY ("purchaseVarianceAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_inventoryAdjustmentVarianceAccount_fkey" FOREIGN KEY ("inventoryAdjustmentVarianceAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_materialVarianceAccount_fkey" FOREIGN KEY ("materialVarianceAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_capacityVarianceAccount_fkey" FOREIGN KEY ("capacityVarianceAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_overheadAccount_fkey" FOREIGN KEY ("overheadAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_maintenanceAccount_fkey" FOREIGN KEY ("maintenanceAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_assetDepreciationExpenseAccount_fkey" FOREIGN KEY ("assetDepreciationExpenseAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_assetGainsAndLossesAccount_fkey" FOREIGN KEY ("assetGainsAndLossesAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_serviceChargeAccount_fkey" FOREIGN KEY ("serviceChargeAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_interestAccount_fkey" FOREIGN KEY ("interestAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_supplierPaymentDiscountAccount_fkey" FOREIGN KEY ("supplierPaymentDiscountAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_customerPaymentDiscountAccount_fkey" FOREIGN KEY ("customerPaymentDiscountAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_roundingAccount_fkey" FOREIGN KEY ("roundingAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_aquisitionCostAccount_fkey" FOREIGN KEY ("assetAquisitionCostAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_aquisitionCostOnDisposalAccount_fkey" FOREIGN KEY ("assetAquisitionCostOnDisposalAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_accumulatedDepreciationAccount_fkey" FOREIGN KEY ("accumulatedDepreciationAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_accumulatedDepreciationOnDisposalAccount_fkey" FOREIGN KEY ("accumulatedDepreciationOnDisposalAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_inventoryAccount_fkey" FOREIGN KEY ("inventoryAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_inventoryInterimAccrualAccount_fkey" FOREIGN KEY ("inventoryInterimAccrualAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_workInProgressAccount_fkey" FOREIGN KEY ("workInProgressAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_receivablesAccount_fkey" FOREIGN KEY ("receivablesAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_inventoryShippedNotInvoicedAccount_fkey" FOREIGN KEY ("inventoryShippedNotInvoicedAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_bankCashAccount_fkey" FOREIGN KEY ("bankCashAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_bankLocalCurrencyAccount_fkey" FOREIGN KEY ("bankLocalCurrencyAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_bankForeignCurrencyAccount_fkey" FOREIGN KEY ("bankForeignCurrencyAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_prepaymentAccount_fkey" FOREIGN KEY ("prepaymentAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_payablesAccount_fkey" FOREIGN KEY ("payablesAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_inventoryReceivedNotInvoicedAccount_fkey" FOREIGN KEY ("inventoryReceivedNotInvoicedAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_salesTaxPayableAccount_fkey" FOREIGN KEY ("salesTaxPayableAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_reverseChargeSalesTaxPayableAccount_fkey" FOREIGN KEY ("reverseChargeSalesTaxPayableAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_purchaseTaxPayableAccount_fkey" FOREIGN KEY ("purchaseTaxPayableAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_retainedEarningsAccount_fkey" FOREIGN KEY ("retainedEarningsAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE RESTRICT ON UPDATE CASCADE+);++ALTER TABLE "accountDefault" ENABLE ROW LEVEL SECURITY;+++CREATE POLICY "Employees with accounting_view can view account defaults" ON "accountDefault"+ FOR SELECT+ USING (+ coalesce(get_my_claim('accounting_view')::boolean,false)+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );++CREATE POLICY "Employees with accounting_update can update account defaults" ON "accountDefault"+ FOR UPDATE+ USING (+ coalesce(get_my_claim('accounting_update')::boolean, false) = true+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );++++CREATE TABLE "postingGroupInventory" (+ "id" TEXT NOT NULL DEFAULT xid(),+ "partGroupId" TEXT,+ "locationId" TEXT,+ "costOfGoodsSoldAccount" TEXT NOT NULL,+ "inventoryAccount" TEXT NOT NULL,+ "inventoryInterimAccrualAccount" TEXT NOT NULL,+ "inventoryReceivedNotInvoicedAccount" TEXT NOT NULL,+ "inventoryShippedNotInvoicedAccount" TEXT NOT NULL,+ "workInProgressAccount" TEXT NOT NULL,+ "directCostAppliedAccount" TEXT NOT NULL,+ "overheadCostAppliedAccount" TEXT NOT NULL,+ "purchaseVarianceAccount" TEXT NOT NULL,+ "inventoryAdjustmentVarianceAccount" TEXT NOT NULL,+ "materialVarianceAccount" TEXT NOT NULL,+ "capacityVarianceAccount" TEXT NOT NULL,+ "overheadAccount" TEXT NOT NULL,+ "updatedBy" TEXT,++ CONSTRAINT "postingGroupInventory_pkey" PRIMARY KEY ("id"),+ CONSTRAINT "postingGroupInventory_id_partGroupId_locationId_key" UNIQUE ("partGroupId", "locationId"),+ CONSTRAINT "postingGroupInventory_partGroupId_fkey" FOREIGN KEY ("partGroupId") REFERENCES "partGroup" ("id") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_locationId_fkey" FOREIGN KEY ("locationId") REFERENCES "location" ("id") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_costOfGoodsSoldAccount_fkey" FOREIGN KEY ("costOfGoodsSoldAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_inventoryAccount_fkey" FOREIGN KEY ("inventoryAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_inventoryInterimAccrualAccount_fkey" FOREIGN KEY ("inventoryInterimAccrualAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_inventoryReceivedNotInvoicedAccount_fkey" FOREIGN KEY ("inventoryReceivedNotInvoicedAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_inventoryShippedNotInvoicedAccount_fkey" FOREIGN KEY ("inventoryShippedNotInvoicedAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_workInProgressAccount_fkey" FOREIGN KEY ("workInProgressAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_directCostAppliedAccount_fkey" FOREIGN KEY ("directCostAppliedAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_overheadCostAppliedAccount_fkey" FOREIGN KEY ("overheadCostAppliedAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_purchaseVarianceAccount_fkey" FOREIGN KEY ("purchaseVarianceAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_inventoryAdjustmentVarianceAccount_fkey" FOREIGN KEY ("inventoryAdjustmentVarianceAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_materialVarianceAccount_fkey" FOREIGN KEY ("materialVarianceAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_capacityVarianceAccount_fkey" FOREIGN KEY ("capacityVarianceAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_overheadAccount_fkey" FOREIGN KEY ("overheadAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE CASCADE+);++CREATE INDEX "postingGroupInventory_partGroupId_locationId_idx" ON "postingGroupInventory" ("partGroupId", "locationId");++ALTER TABLE "postingGroupInventory" ENABLE ROW LEVEL SECURITY;++CREATE POLICY "Employees with accounting_view can view inventory posting groups" ON "postingGroupInventory"+ FOR SELECT+ USING (+ coalesce(get_my_claim('accounting_view')::boolean,false)+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );++CREATE POLICY "Employees with accounting_update can update inventory posting groups" ON "postingGroupInventory"+ FOR UPDATE+ USING (+ coalesce(get_my_claim('accounting_update')::boolean, false) = true+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );+++CREATE TABLE "postingGroupPurchasing" (+ "id" TEXT NOT NULL DEFAULT xid(),+ "supplierTypeId" TEXT,+ "partGroupId" TEXT,+ "purchaseAccount" TEXT NOT NULL,+ "purchaseDiscountAccount" TEXT NOT NULL,+ "purchaseCreditAccount" TEXT NOT NULL,+ "purchasePrepaymentAccount" TEXT NOT NULL,+ "purchaseTaxPayableAccount" TEXT NOT NULL,+ "updatedBy" TEXT,++ CONSTRAINT "postingGroupPurchasing_pkey" PRIMARY KEY ("id"),+ CONSTRAINT "postingGroupPurchasing_id_supplierTypeId_partGroupId_key" UNIQUE ("supplierTypeId", "partGroupId"),+ CONSTRAINT "postingGroupPurchasing_partGroupId_fkey" FOREIGN KEY ("partGroupId") REFERENCES "partGroup" ("id") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "postingGroupPurchasing_supplierTypeId_fkey" FOREIGN KEY ("supplierTypeId") REFERENCES "supplierType" ("id") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "postingGroupPurchasing_purchaseAccount_fkey" FOREIGN KEY ("purchaseAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupPurchasing_purchaseDiscountAccount_fkey" FOREIGN KEY ("purchaseDiscountAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupPurchasing_purchaseCreditAccount_fkey" FOREIGN KEY ("purchaseCreditAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupPurchasing_purchasePrepaymentAccount_fkey" FOREIGN KEY ("purchasePrepaymentAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupPurchasing_purchaseTaxPayableAccount_fkey" FOREIGN KEY ("purchaseTaxPayableAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupPurchasing_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE CASCADE+);++CREATE INDEX "postingGroupPurchasing_partGroupId_supplierTypeId_idx" ON "postingGroupPurchasing" ("partGroupId", "supplierTypeId");++ALTER TABLE "postingGroupPurchasing" ENABLE ROW LEVEL SECURITY;++CREATE POLICY "Employees with accounting_view can view purchasing posting groups" ON "postingGroupPurchasing"+ FOR SELECT+ USING (+ coalesce(get_my_claim('accounting_view')::boolean,false)+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );++CREATE POLICY "Employees with accounting_update can update purchasing posting groups" ON "postingGroupPurchasing"+ FOR UPDATE+ USING (+ coalesce(get_my_claim('accounting_update')::boolean, false) = true+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );++CREATE TABLE "postingGroupSales" (+ "id" TEXT NOT NULL DEFAULT xid(),+ "customerTypeId" TEXT,+ "partGroupId" TEXT,+ "salesAccount" TEXT NOT NULL,+ "salesDiscountAccount" TEXT NOT NULL,+ "salesCreditAccount" TEXT NOT NULL,+ "salesPrepaymentAccount" TEXT NOT NULL,+ "salesTaxPayableAccount" TEXT NOT NULL,+ "updatedBy" TEXT,++ CONSTRAINT "postingGroupSales_pkey" PRIMARY KEY ("id"),+ CONSTRAINT "postingGroupSales_id_customerTypeId_partGroupId_key" UNIQUE ("customerTypeId", "partGroupId"),+ CONSTRAINT "postingGroupSales_partGroupId_fkey" FOREIGN KEY ("partGroupId") REFERENCES "partGroup" ("id") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "postingGroupSales_customerTypeId_fkey" FOREIGN KEY ("customerTypeId") REFERENCES "customerType" ("id") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "postingGroupSales_salesAccount_fkey" FOREIGN KEY ("salesAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupSales_salesDiscountAccount_fkey" FOREIGN KEY ("salesDiscountAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupSales_salesCreditAccount_fkey" FOREIGN KEY ("salesCreditAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupSales_salesPrepaymentAccount_fkey" FOREIGN KEY ("salesPrepaymentAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupSales_salesTaxPayableAccount_fkey" FOREIGN KEY ("salesTaxPayableAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupSales_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE CASCADE+);++CREATE INDEX "postingGroupSales_partGroupId_customerTypeId_idx" ON "postingGroupSales" ("partGroupId", "customerTypeId");++CREATE POLICY "Employees with accounting_view can view sales posting groups" ON "postingGroupSales"+ FOR SELECT+ USING (+ coalesce(get_my_claim('accounting_view')::boolean,false)+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );++CREATE POLICY "Employees with accounting_update can update sales posting groups" ON "postingGroupSales"+ FOR UPDATE+ USING (+ coalesce(get_my_claim('accounting_update')::boolean, false) = true+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );++CREATE FUNCTION public.create_posting_groups_for_location()+RETURNS TRIGGER AS $$+DECLARE+ part_group RECORD;+ account_defaults RECORD;+BEGIN+ SELECT * INTO account_defaults FROM "accountDefault" WHERE "id" = TRUE;++ FOR part_group IN SELECT "id" FROM "partGroup"+ LOOP+ INSERT INTO "postingGroupInventory" (+ "partGroupId",+ "locationId",+ "costOfGoodsSoldAccount",+ "inventoryAccount",+ "inventoryInterimAccrualAccount",+ "inventoryReceivedNotInvoicedAccount",+ "inventoryShippedNotInvoicedAccount",+ "workInProgressAccount",+ "directCostAppliedAccount",+ "overheadCostAppliedAccount",+ "purchaseVarianceAccount",+ "inventoryAdjustmentVarianceAccount",+ "materialVarianceAccount",+ "capacityVarianceAccount",+ "overheadAccount",+ "updatedBy"+ ) VALUES (+ part_group."id",+ new."id",+ account_defaults."costOfGoodsSoldAccount",+ account_defaults."inventoryAccount",+ account_defaults."inventoryInterimAccrualAccount",+ account_defaults."inventoryReceivedNotInvoicedAccount",+ account_defaults."inventoryShippedNotInvoicedAccount",+ account_defaults."workInProgressAccount",+ account_defaults."directCostAppliedAccount",+ account_defaults."overheadCostAppliedAccount",+ account_defaults."purchaseVarianceAccount",+ account_defaults."inventoryAdjustmentVarianceAccount",+ account_defaults."materialVarianceAccount",+ account_defaults."capacityVarianceAccount",+ account_defaults."overheadAccount",+ new."createdBy"+ );+ END LOOP;++ -- insert the null part group+ INSERT INTO "postingGroupInventory" (+ "partGroupId",+ "locationId",+ "costOfGoodsSoldAccount",+ "inventoryAccount",+ "inventoryInterimAccrualAccount",+ "inventoryReceivedNotInvoicedAccount",+ "inventoryShippedNotInvoicedAccount",+ "workInProgressAccount",+ "directCostAppliedAccount",+ "overheadCostAppliedAccount",+ "purchaseVarianceAccount",+ "inventoryAdjustmentVarianceAccount",+ "materialVarianceAccount",+ "capacityVarianceAccount",+ "overheadAccount",+ "updatedBy"+ ) VALUES (+ NULL,+ new."id",+ account_defaults."costOfGoodsSoldAccount",+ account_defaults."inventoryAccount",+ account_defaults."inventoryInterimAccrualAccount",+ account_defaults."inventoryReceivedNotInvoicedAccount",+ account_defaults."inventoryShippedNotInvoicedAccount",+ account_defaults."workInProgressAccount",+ account_defaults."directCostAppliedAccount",+ account_defaults."overheadCostAppliedAccount",+ account_defaults."purchaseVarianceAccount",+ account_defaults."inventoryAdjustmentVarianceAccount",+ account_defaults."materialVarianceAccount",+ account_defaults."capacityVarianceAccount",+ account_defaults."overheadAccount",+ new."createdBy"+ );++ RETURN new;+END;+$$ LANGUAGE plpgsql SECURITY DEFINER;++CREATE TRIGGER create_location+ AFTER INSERT on public."location"+ FOR EACH ROW EXECUTE PROCEDURE public.create_posting_groups_for_location();+++CREATE FUNCTION public.create_posting_groups_for_part_group()+RETURNS TRIGGER AS $$+DECLARE+ rec RECORD;+ account_defaults RECORD;+BEGIN+ SELECT * INTO account_defaults FROM "accountDefault" WHERE "id" = TRUE;++ FOR rec IN SELECT "id" FROM "customerType"+ LOOP+ INSERT INTO "postingGroupSales" (+ "partGroupId",+ "customerTypeId",+ "salesAccount",+ "salesDiscountAccount",+ "salesCreditAccount",+ "salesPrepaymentAccount",+ "salesTaxPayableAccount",+ "updatedBy"+ ) VALUES (+ new."id",+ rec."id",+ account_defaults."salesAccount",+ account_defaults."salesDiscountAccount",+ account_defaults."receivablesAccount",+ account_defaults."prepaymentAccount",+ account_defaults."salesTaxPayableAccount",+ new."createdBy"+ );+ END LOOP;++ -- insert the null customer type+ INSERT INTO "postingGroupSales" (+ "partGroupId",+ "customerTypeId",+ "salesAccount",+ "salesDiscountAccount",+ "salesCreditAccount",+ "salesPrepaymentAccount",+ "salesTaxPayableAccount",+ "updatedBy"+ ) VALUES (+ new."id",+ NULL,+ account_defaults."salesAccount",+ account_defaults."salesDiscountAccount",+ account_defaults."receivablesAccount",+ account_defaults."prepaymentAccount",+ account_defaults."salesTaxPayableAccount",+ new."createdBy"+ );++ FOR rec IN SELECT "id" FROM "supplierType"+ LOOP+ INSERT INTO "postingGroupPurchasing" (+ "partGroupId",+ "supplierTypeId",+ "purchaseAccount",+ "purchaseDiscountAccount",+ "purchaseCreditAccount",+ "purchasePrepaymentAccount",+ "purchaseTaxPayableAccount",+ "updatedBy"+ ) VALUES (+ new."id",+ rec."id",+ account_defaults."purchaseAccount",+ account_defaults."purchaseAccount",+ account_defaults."payablesAccount",+ account_defaults."prepaymentAccount",+ account_defaults."purchaseTaxPayableAccount",+ new."createdBy"+ );+ END LOOP;++ -- insert the null supplier type+ INSERT INTO "postingGroupPurchasing" (+ "partGroupId",+ "supplierTypeId",+ "purchaseAccount",+ "purchaseDiscountAccount",+ "purchaseCreditAccount",+ "purchasePrepaymentAccount",+ "purchaseTaxPayableAccount",+ "updatedBy"+ ) VALUES (+ new."id",+ NULL,+ account_defaults."purchaseAccount",+ account_defaults."purchaseAccount",+ account_defaults."payablesAccount",+ account_defaults."prepaymentAccount",+ account_defaults."purchaseTaxPayableAccount",+ new."createdBy"+ );++ FOR rec IN SELECT "id" FROM "location"+ LOOP+ INSERT INTO "postingGroupInventory" (+ "partGroupId",+ "locationId",+ "costOfGoodsSoldAccount",+ "inventoryAccount",+ "inventoryInterimAccrualAccount",+ "inventoryReceivedNotInvoicedAccount",+ "inventoryShippedNotInvoicedAccount",+ "workInProgressAccount",+ "directCostAppliedAccount",+ "overheadCostAppliedAccount",+ "purchaseVarianceAccount",+ "inventoryAdjustmentVarianceAccount",+ "materialVarianceAccount",+ "capacityVarianceAccount",+ "overheadAccount",+ "updatedBy"+ ) VALUES (+ new."id",+ rec."id",+ account_defaults."costOfGoodsSoldAccount",+ account_defaults."inventoryAccount",+ account_defaults."inventoryInterimAccrualAccount",+ account_defaults."inventoryReceivedNotInvoicedAccount",+ account_defaults."inventoryShippedNotInvoicedAccount",+ account_defaults."workInProgressAccount",+ account_defaults."directCostAppliedAccount",+ account_defaults."overheadCostAppliedAccount",+ account_defaults."purchaseVarianceAccount",+ account_defaults."inventoryAdjustmentVarianceAccount",+ account_defaults."materialVarianceAccount",+ account_defaults."capacityVarianceAccount",+ account_defaults."overheadAccount",+ new."createdBy"+ );+ END LOOP;++ -- insert the null location+ INSERT INTO "postingGroupInventory" (+ "partGroupId",+ "locationId",+ "costOfGoodsSoldAccount",+ "inventoryAccount",+ "inventoryInterimAccrualAccount",+ "inventoryReceivedNotInvoicedAccount",+ "inventoryShippedNotInvoicedAccount",+ "workInProgressAccount",+ "directCostAppliedAccount",+ "overheadCostAppliedAccount",+ "purchaseVarianceAccount",+ "inventoryAdjustmentVarianceAccount",+ "materialVarianceAccount",+ "capacityVarianceAccount",+ "overheadAccount",+ "updatedBy"+ ) VALUES (+ new."id",+ NULL,+ account_defaults."costOfGoodsSoldAccount",+ account_defaults."inventoryAccount",+ account_defaults."inventoryInterimAccrualAccount",+ account_defaults."inventoryReceivedNotInvoicedAccount",+ account_defaults."inventoryShippedNotInvoicedAccount",+ account_defaults."workInProgressAccount",+ account_defaults."directCostAppliedAccount",+ account_defaults."overheadCostAppliedAccount",+ account_defaults."purchaseVarianceAccount",+ account_defaults."inventoryAdjustmentVarianceAccount",+ account_defaults."materialVarianceAccount",+ account_defaults."capacityVarianceAccount",+ account_defaults."overheadAccount",+ new."createdBy"+ );++ RETURN new;+END;+$$ LANGUAGE plpgsql SECURITY DEFINER;+++CREATE TRIGGER create_part_group+ AFTER INSERT on public."partGroup"+ FOR EACH ROW EXECUTE PROCEDURE public.create_posting_groups_for_part_group();++CREATE FUNCTION public.create_posting_groups_for_customer_type()+RETURNS TRIGGER AS $$+DECLARE+ rec RECORD;+ account_defaults RECORD;+BEGIN+ SELECT * INTO account_defaults FROM "accountDefault" WHERE "id" = TRUE;++ FOR rec IN SELECT "id" FROM "partGroup"+ LOOP+ INSERT INTO "postingGroupSales" (+ "customerTypeId",+ "partGroupId",+ "salesAccount",+ "salesDiscountAccount",+ "salesCreditAccount",+ "salesPrepaymentAccount",+ "salesTaxPayableAccount",+ "updatedBy"+ ) VALUES (+ new."id",+ rec."id",+ account_defaults."salesAccount",+ account_defaults."salesDiscountAccount",+ account_defaults."salesAccount",+ account_defaults."prepaymentAccount",+ account_defaults."salesTaxPayableAccount",+ new."createdBy"+ );+ END LOOP;++ -- insert the null part group+ INSERT INTO "postingGroupSales" (+ "customerTypeId",+ "partGroupId",+ "salesAccount",+ "salesDiscountAccount",+ "salesCreditAccount",+ "salesPrepaymentAccount",+ "salesTaxPayableAccount",+ "updatedBy"+ ) VALUES (+ new."id",+ NULL,+ account_defaults."salesAccount",+ account_defaults."salesDiscountAccount",+ account_defaults."salesAccount",+ account_defaults."prepaymentAccount",+ account_defaults."salesTaxPayableAccount",+ new."createdBy"+ );++ RETURN new;+END;+$$ LANGUAGE plpgsql SECURITY DEFINER;++CREATE TRIGGER create_posting_groups_for_customer_type+ AFTER INSERT on public."customerType"+ FOR EACH ROW EXECUTE PROCEDURE public.create_posting_groups_for_customer_type();+++CREATE FUNCTION public.create_posting_groups_for_supplier_type()+RETURNS TRIGGER AS $$+DECLARE+ rec RECORD;+ account_defaults RECORD;+BEGIN+ SELECT * INTO account_defaults FROM "accountDefault" WHERE "id" = TRUE;++ FOR rec IN SELECT "id" FROM "partGroup"+ LOOP+ INSERT INTO "postingGroupPurchasing" (+ "supplierTypeId",+ "partGroupId",+ "purchaseAccount",+ "purchaseDiscountAccount",+ "purchaseCreditAccount",+ "purchasePrepaymentAccount",+ "purchaseTaxPayableAccount",+ "updatedBy"+ ) VALUES (+ new."id",+ rec."id",+ account_defaults."purchaseAccount",+ account_defaults."purchaseAccount",+ account_defaults."purchaseAccount",+ account_defaults."prepaymentAccount",+ account_defaults."purchaseTaxPayableAccount",+ new."createdBy"+ );+ END LOOP;++ -- insert the null part group+ INSERT INTO "postingGroupPurchasing" (+ "supplierTypeId",+ "partGroupId",+ "purchaseAccount",+ "purchaseDiscountAccount",+ "purchaseCreditAccount",+ "purchasePrepaymentAccount",+ "purchaseTaxPayableAccount",+ "updatedBy"+ ) VALUES (+ new."id",+ NULL,+ account_defaults."purchaseAccount",+ account_defaults."purchaseAccount",+ account_defaults."purchaseAccount",+ account_defaults."prepaymentAccount",+ account_defaults."purchaseTaxPayableAccount",+ new."createdBy"+ );++ RETURN new;+END;+$$ LANGUAGE plpgsql SECURITY DEFINER;++CREATE TRIGGER create_posting_groups_for_supplier_type+ AFTER INSERT on public."supplierType"+ FOR EACH ROW EXECUTE PROCEDURE public.create_posting_groups_for_supplier_type();++```+diff --git a/apps/carbon/app/components/Editable/EditableList.tsx b/apps/carbon/app/components/Editable/EditableList.tsxindex d4b301c983..4094275755 100644--- a/apps/carbon/app/components/Editable/EditableList.tsx+++ b/apps/carbon/app/components/Editable/EditableList.tsx@@ -41,6 +41,7 @@ const EditableList =<SelectautoFocusborderRadius="none"+ defaultValue={options.find((option) => option.value === value)}options={options}// @ts-ignoreonChange={onChange}diff --git a/apps/carbon/app/components/Form/AccountCategory.tsx b/apps/carbon/app/components/Form/AccountCategory.tsxindex d2158e4e33..e91a352cfc 100644--- a/apps/carbon/app/components/Form/AccountCategory.tsx+++ b/apps/carbon/app/components/Form/AccountCategory.tsx@@ -8,8 +8,10 @@ import {import { useFetcher } from "@remix-run/react";import { useEffect, useMemo } from "react";import { useControlField, useField } from "remix-validated-form";-import type { AccountCategory as AccountCategoryType } from "~/modules/accounting";-import type { getAccountCategoriesList } from "~/modules/accounting";+import type {+ AccountCategory as AccountCategoryType,+ getAccountCategoriesList,+} from "~/modules/accounting";import { mapRowsToOptions } from "~/utils/form";import type { SelectProps } from "./Select";@@ -100,6 +102,7 @@ const AccountCategory = ({placeholder={placeholder}// @ts-ignorew="full"+ isClearableisReadOnly={isReadOnly}onChange={handleChange}/>diff --git a/apps/carbon/app/components/Layout/Sidebar/CollapsibleSidebar.tsx b/apps/carbon/app/components/Layout/Sidebar/CollapsibleSidebar.tsxindex db44390e00..557f86d409 100644--- a/apps/carbon/app/components/Layout/Sidebar/CollapsibleSidebar.tsx+++ b/apps/carbon/app/components/Layout/Sidebar/CollapsibleSidebar.tsx@@ -29,8 +29,9 @@ export const CollapsibleSidebar = ({ children }: PropsWithChildren<{}>) => {borderRight={1}borderRightColor={useColor("gray.300")}borderRightStyle="solid"- position="relative"h="calc(100vh - 50px)"+ position="sticky"+ top={50}><Tooltip label={sidebar.isOpen ? "Collapse" : "Expand"} placement="right"><IconButtondiff --git a/apps/carbon/app/components/Layout/Sidebar/useSidebar.tsx b/apps/carbon/app/components/Layout/Sidebar/useSidebar.tsxindex 858ed844ac..52ea55f4d3 100644--- a/apps/carbon/app/components/Layout/Sidebar/useSidebar.tsx+++ b/apps/carbon/app/components/Layout/Sidebar/useSidebar.tsx@@ -1,18 +1,18 @@-import type { Authenticated, NavItem } from "~/types";-import { AiOutlinePartition, AiOutlineFieldTime } from "react-icons/ai";+import { AiOutlineFieldTime, AiOutlinePartition } from "react-icons/ai";import { BiListCheck, BiMessage } from "react-icons/bi";import {BsCalendar2Week,BsCartDash,BsCartPlus,+ BsCreditCard,BsPeopleFill,BsShieldLock,} from "react-icons/bs";import { CgProfile } from "react-icons/cg";import { HiOutlineCube, HiOutlineDocumentDuplicate } from "react-icons/hi";import { LuSettings2 } from "react-icons/lu";-import { TbPigMoney } from "react-icons/tb";import { usePermissions } from "~/hooks";+import type { Authenticated, NavItem } from "~/types";export function useSidebar() {const permissions = usePermissions();@@ -76,7 +76,7 @@ export function useSidebar() {permission: "accounting",name: "Accounting",to: "/x/accounting",- icon: <TbPigMoney />,+ icon: <BsCreditCard />,},{permission: "resources",diff --git a/apps/carbon/app/components/Layout/Topbar/useBreadcrumbs.tsx b/apps/carbon/app/components/Layout/Topbar/useBreadcrumbs.tsxindex 401ce9cdcd..3eeb7ec111 100644--- a/apps/carbon/app/components/Layout/Topbar/useBreadcrumbs.tsx+++ b/apps/carbon/app/components/Layout/Topbar/useBreadcrumbs.tsx@@ -62,6 +62,21 @@ export default function useBreadcrumbs(): Route[] {name: "Currencies",to: match.pathname,});+ case "routes/x+/accounting+/groups.inventory":+ return acc.concat({+ name: "Inventory Groups",+ to: match.pathname,+ });+ case "routes/x+/accounting+/groups.purchasing":+ return acc.concat({+ name: "Purchasing Groups",+ to: match.pathname,+ });+ case "routes/x+/accounting+/groups.sales":+ return acc.concat({+ name: "Sales Groups",+ to: match.pathname,+ });case "routes/x+/accounting+/payment-terms":return acc.concat({name: "Payment Terms",diff --git a/apps/carbon/app/components/Table/components/TableHeader/TableHeader.tsx b/apps/carbon/app/components/Table/components/TableHeader/TableHeader.tsxindex 16d896fba0..d66a2992dd 100644--- a/apps/carbon/app/components/Table/components/TableHeader/TableHeader.tsx+++ b/apps/carbon/app/components/Table/components/TableHeader/TableHeader.tsx@@ -77,7 +77,7 @@ const TableHeader = <T extends object>({variant="ghost"onClick={() => setEditMode(true)}>- Edit Mode+ Edit</Button>))}</HStack>diff --git a/apps/carbon/app/modules/account/index.ts b/apps/carbon/app/modules/account/index.tsindex 684aed031a..83b8af135e 100644--- a/apps/carbon/app/modules/account/index.ts+++ b/apps/carbon/app/modules/account/index.ts@@ -1,3 +1,3 @@export * from "./services";-export * from "./interfaces";export * from "./types";+export * from "./ui";diff --git a/apps/carbon/app/modules/account/interfaces/Password/PasswordForm/PasswordForm.tsx b/apps/carbon/app/modules/account/ui/Password/PasswordForm/PasswordForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/account/interfaces/Password/PasswordForm/PasswordForm.tsxrename to apps/carbon/app/modules/account/ui/Password/PasswordForm/PasswordForm.tsxdiff --git a/apps/carbon/app/modules/account/interfaces/Password/PasswordForm/index.ts b/apps/carbon/app/modules/account/ui/Password/PasswordForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/account/interfaces/Password/PasswordForm/index.tsrename to apps/carbon/app/modules/account/ui/Password/PasswordForm/index.tsdiff --git a/apps/carbon/app/modules/account/interfaces/Password/index.ts b/apps/carbon/app/modules/account/ui/Password/index.tssimilarity index 100%rename from apps/carbon/app/modules/account/interfaces/Password/index.tsrename to apps/carbon/app/modules/account/ui/Password/index.tsdiff --git a/apps/carbon/app/modules/account/interfaces/Personal/PersonalDataForm/PersonalDataForm.tsx b/apps/carbon/app/modules/account/ui/Personal/PersonalDataForm/PersonalDataForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/account/interfaces/Personal/PersonalDataForm/PersonalDataForm.tsxrename to apps/carbon/app/modules/account/ui/Personal/PersonalDataForm/PersonalDataForm.tsxdiff --git a/apps/carbon/app/modules/account/interfaces/Personal/PersonalDataForm/index.ts b/apps/carbon/app/modules/account/ui/Personal/PersonalDataForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/account/interfaces/Personal/PersonalDataForm/index.tsrename to apps/carbon/app/modules/account/ui/Personal/PersonalDataForm/index.tsdiff --git a/apps/carbon/app/modules/account/interfaces/Personal/index.ts b/apps/carbon/app/modules/account/ui/Personal/index.tssimilarity index 100%rename from apps/carbon/app/modules/account/interfaces/Personal/index.tsrename to apps/carbon/app/modules/account/ui/Personal/index.tsdiff --git a/apps/carbon/app/modules/account/interfaces/Profile/ProfileForm/ProfileForm.tsx b/apps/carbon/app/modules/account/ui/Profile/ProfileForm/ProfileForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/account/interfaces/Profile/ProfileForm/ProfileForm.tsxrename to apps/carbon/app/modules/account/ui/Profile/ProfileForm/ProfileForm.tsxdiff --git a/apps/carbon/app/modules/account/interfaces/Profile/ProfileForm/index.ts b/apps/carbon/app/modules/account/ui/Profile/ProfileForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/account/interfaces/Profile/ProfileForm/index.tsrename to apps/carbon/app/modules/account/ui/Profile/ProfileForm/index.tsdiff --git a/apps/carbon/app/modules/account/interfaces/Profile/ProfilePhotoForm/ProfilePhotoForm.tsx b/apps/carbon/app/modules/account/ui/Profile/ProfilePhotoForm/ProfilePhotoForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/account/interfaces/Profile/ProfilePhotoForm/ProfilePhotoForm.tsxrename to apps/carbon/app/modules/account/ui/Profile/ProfilePhotoForm/ProfilePhotoForm.tsxdiff --git a/apps/carbon/app/modules/account/interfaces/Profile/ProfilePhotoForm/index.ts b/apps/carbon/app/modules/account/ui/Profile/ProfilePhotoForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/account/interfaces/Profile/ProfilePhotoForm/index.tsrename to apps/carbon/app/modules/account/ui/Profile/ProfilePhotoForm/index.tsdiff --git a/apps/carbon/app/modules/account/interfaces/Profile/index.ts b/apps/carbon/app/modules/account/ui/Profile/index.tssimilarity index 100%rename from apps/carbon/app/modules/account/interfaces/Profile/index.tsrename to apps/carbon/app/modules/account/ui/Profile/index.tsdiff --git a/apps/carbon/app/modules/account/interfaces/UserAttributes/UserAttributesForm.tsx b/apps/carbon/app/modules/account/ui/UserAttributes/UserAttributesForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/account/interfaces/UserAttributes/UserAttributesForm.tsxrename to apps/carbon/app/modules/account/ui/UserAttributes/UserAttributesForm.tsxdiff --git a/apps/carbon/app/modules/account/interfaces/UserAttributes/index.ts b/apps/carbon/app/modules/account/ui/UserAttributes/index.tssimilarity index 100%rename from apps/carbon/app/modules/account/interfaces/UserAttributes/index.tsrename to apps/carbon/app/modules/account/ui/UserAttributes/index.tsdiff --git a/apps/carbon/app/modules/account/interfaces/index.ts b/apps/carbon/app/modules/account/ui/index.tssimilarity index 100%rename from apps/carbon/app/modules/account/interfaces/index.tsrename to apps/carbon/app/modules/account/ui/index.tsdiff --git a/apps/carbon/app/modules/account/interfaces/useAccountSidebar.tsx b/apps/carbon/app/modules/account/ui/useAccountSidebar.tsxsimilarity index 100%rename from apps/carbon/app/modules/account/interfaces/useAccountSidebar.tsxrename to apps/carbon/app/modules/account/ui/useAccountSidebar.tsxdiff --git a/apps/carbon/app/modules/accounting/index.ts b/apps/carbon/app/modules/accounting/index.tsindex 490fd762ea..83b8af135e 100644--- a/apps/carbon/app/modules/accounting/index.ts+++ b/apps/carbon/app/modules/accounting/index.ts@@ -1,3 +1,3 @@-export * from "./interfaces";export * from "./services";export * from "./types";+export * from "./ui";diff --git a/apps/carbon/app/modules/accounting/services/accounting.form.ts b/apps/carbon/app/modules/accounting/services/accounting.form.tsindex 645b1e6bc6..e5881aa24e 100644--- a/apps/carbon/app/modules/accounting/services/accounting.form.ts+++ b/apps/carbon/app/modules/accounting/services/accounting.form.ts@@ -100,7 +100,7 @@ export const accountValidator = withZod(}).refine((data) => {- if (data.type !== "Heading") {+ if (!["Heading", "Begin Total", "End Total"].includes(data.type)) {return !!data.accountCategoryId;}return true;@@ -162,6 +162,123 @@ export const currencyValidator = withZod(}));+export const defaultAcountValidator = withZod(+ z.object({+ salesAccount: z.string().min(1, { message: "Sales account is required" }),+ salesDiscountAccount: z.string().min(1, {+ message: "Sales discount account is required",+ }),+ costOfGoodsSoldAccount: z.string().min(1, {+ message: "Cost of goods sold account is required",+ }),+ purchaseAccount: z.string().min(1, {+ message: "Purchase account is required",+ }),+ directCostAppliedAccount: z.string().min(1, {+ message: "Direct cost applied account is required",+ }),+ overheadCostAppliedAccount: z.string().min(1, {+ message: "Overhead cost applied account is required",+ }),+ purchaseVarianceAccount: z.string().min(1, {+ message: "Purchase variance account is required",+ }),+ inventoryAdjustmentVarianceAccount: z.string().min(1, {+ message: "Inventory adjustment variance account is required",+ }),+ materialVarianceAccount: z.string().min(1, {+ message: "Material variance account is required",+ }),+ capacityVarianceAccount: z.string().min(1, {+ message: "Capacity variance account is required",+ }),+ overheadAccount: z.string().min(1, {+ message: "Overhead account is required",+ }),+ maintenanceAccount: z.string().min(1, {+ message: "Maintenance account is required",+ }),+ assetDepreciationExpenseAccount: z.string().min(1, {+ message: "Depreciation expense account is required",+ }),+ assetGainsAndLossesAccount: z.string().min(1, {+ message: "Gains and losses account is required",+ }),+ serviceChargeAccount: z.string().min(1, {+ message: "Service charge account is required",+ }),+ interestAccount: z.string().min(1, {+ message: "Interest account is required",+ }),+ supplierPaymentDiscountAccount: z.string().min(1, {+ message: "Supplier payment discount account is required",+ }),+ customerPaymentDiscountAccount: z.string().min(1, {+ message: "Customer payment discount account is required",+ }),+ roundingAccount: z.string().min(1, {+ message: "Rounding account is required",+ }),+ assetAquisitionCostAccount: z.string().min(1, {+ message: "Aquisition cost account is required",+ }),+ assetAquisitionCostOnDisposalAccount: z.string().min(1, {+ message: "Aquisition cost on disposal account is required",+ }),+ accumulatedDepreciationAccount: z.string().min(1, {+ message: "Accumulated depreciation account is required",+ }),+ accumulatedDepreciationOnDisposalAccount: z.string().min(1, {+ message: "Accumulated depreciation on disposal account is required",+ }),+ inventoryAccount: z.string().min(1, {+ message: "Inventory account is required",+ }),+ inventoryInterimAccrualAccount: z.string().min(1, {+ message: "Inventory interim accrual account is required",+ }),+ inventoryReceivedNotInvoicedAccount: z.string().min(1, {+ message: "Inventory received not invoiced account is required",+ }),+ inventoryShippedNotInvoicedAccount: z.string().min(1, {+ message: "Inventory shipped not invoiced account is required",+ }),+ workInProgressAccount: z.string().min(1, {+ message: "Work in progress account is required",+ }),+ receivablesAccount: z.string().min(1, {+ message: "Receivables account is required",+ }),+ bankCashAccount: z.string().min(1, {+ message: "Bank cash account is required",+ }),+ bankLocalCurrencyAccount: z.string().min(1, {+ message: "Bank local currency account is required",+ }),+ bankForeignCurrencyAccount: z.string().min(1, {+ message: "Bank foreign currency account is required",+ }),+ prepaymentAccount: z.string().min(1, {+ message: "Prepayment account is required",+ }),+ payablesAccount: z.string().min(1, {+ message: "Payables account is required",+ }),+ salesTaxPayableAccount: z.string().min(1, {+ message: "Sales tax payable account is required",+ }),+ purchaseTaxPayableAccount: z.string().min(1, {+ message: "Purchase tax payable account is required",+ }),+ reverseChargeSalesTaxPayableAccount: z.string().min(1, {+ message: "Reverse charge sales tax payable account is required",+ }),+ retainedEarningsAccount: z.string().min(1, {+ message: "Retained earnings account is required",+ }),+ })+);+export const partLedgerValidator = withZod(z.object({postingDate: z.string().min(1, { message: "Posting date is required" }),diff --git a/apps/carbon/app/modules/accounting/services/accounting.server.ts b/apps/carbon/app/modules/accounting/services/accounting.server.tsindex 53f9cc8ade..c39e06b2fb 100644--- a/apps/carbon/app/modules/accounting/services/accounting.server.ts+++ b/apps/carbon/app/modules/accounting/services/accounting.server.ts@@ -1,6 +1,8 @@import type { Database } from "@carbon/database";import { getDateNYearsAgo } from "@carbon/utils";import type { SupabaseClient } from "@supabase/supabase-js";+import { getSupabaseServiceRole } from "~/lib/supabase";+import type { ReceiptLine } from "~/modules/inventory";import type { TypeOfValidator } from "~/types/validators";import type { GenericQueryFilters } from "~/utils/query";import { setGenericQueryFilters } from "~/utils/query";@@ -12,6 +14,7 @@ import type {accountSubcategoryValidator,accountValidator,currencyValidator,+ defaultAcountValidator,partLedgerValidator,paymentTermValidator,valueLedgerValidator,@@ -136,14 +139,23 @@ export async function getAccounts(export async function getAccountsList(client: SupabaseClient<Database>,- type = "Posting"+ args?: {+ type?: string | null;+ incomeBalance?: string | null;+ }) {- return client- .from("account")- .select("number, name")- .eq("active", true)- .eq("type", type)- .order("name", { ascending: true });+ let query = client.from("account").select("number, name").eq("active", true);++ if (args?.type) {+ query = query.eq("type", args.type);+ }++ if (args?.incomeBalance) {+ query = query.eq("incomeBalance", args.incomeBalance);+ }++ query = query.order("number", { ascending: true });+ return query;}export async function getAccountCategories(@@ -373,6 +385,33 @@ export async function getCurrenciesList(client: SupabaseClient<Database>) {.order("name", { ascending: true });}+export async function getDefaultAccounts(client: SupabaseClient<Database>) {+ return client.from("accountDefault").select("*").eq("id", true).single();+}++export async function getInventoryPostingGroups(+ client: SupabaseClient<Database>,+ args: GenericQueryFilters & {+ partGroup: string | null;+ location: string | null;+ }+) {+ let query = client.from("postingGroupInventory").select("*", {+ count: "exact",+ });++ if (args.partGroup) {+ query = query.eq("partGroupId", args.partGroup);+ }++ if (args.location) {+ query = query.eq("locationId", args.location);+ }++ query = setGenericQueryFilters(query, args, "partGroupId", false);+ return query;+}+export async function getPaymentTerm(client: SupabaseClient<Database>,paymentTermId: string@@ -413,6 +452,52 @@ export async function getPaymentTermsList(client: SupabaseClient<Database>) {.order("name", { ascending: true });}+export async function getPurchasingPostingGroups(+ client: SupabaseClient<Database>,+ args: GenericQueryFilters & {+ partGroup: string | null;+ supplierType: string | null;+ }+) {+ let query = client.from("postingGroupPurchasing").select("*", {+ count: "exact",+ });++ if (args.partGroup) {+ query = query.eq("partGroupId", args.partGroup);+ }++ if (args.supplierType) {+ query = query.eq("supplierTypeId", args.supplierType);+ }++ query = setGenericQueryFilters(query, args, "partGroupId", false);+ return query;+}++export async function getSalesPostingGroups(+ client: SupabaseClient<Database>,+ args: GenericQueryFilters & {+ partGroup: string | null;+ customerType: string | null;+ }+) {+ let query = client.from("postingGroupSales").select("*", {+ count: "exact",+ });++ if (args.partGroup) {+ query = query.eq("partGroupId", args.partGroup);+ }++ if (args.customerType) {+ query = query.eq("customerTypeId", args.customerType);+ }++ query = setGenericQueryFilters(query, args, "partGroupId", false);+ return query;+}+export async function insertAccountEntries(client: SupabaseClient<Database>,accountEntries: TypeOfValidator<typeof accountLedgerValidator>[]@@ -463,6 +548,90 @@ export async function insertValueLedger(return client.from("valueLedger").insert([valueEntry]).select("id").single();}+export async function updateDefaultAccounts(+ client: SupabaseClient<Database>,+ defaultAccounts: TypeOfValidator<typeof defaultAcountValidator> & {+ updatedBy: string;+ }+) {+ return client.from("accountDefault").update(defaultAccounts).eq("id", true);+}++export async function postReceiptWithExpectedCost(receiptId: string) {+ const client = getSupabaseServiceRole();+ const [receipt, receiptLines] = await Promise.all([+ client.from("receipt").select("*").eq("id", receiptId).single(),+ client.from("receiptLine").select("*").eq("receiptId", receiptId),+ ]);++ if (receipt.error) return receipt;+ if (receiptLines.error) return receiptLines;++ switch (receipt.data?.sourceDocument) {+ case "Purchase Order":+ // TODO: this should all be done as a transaction+ const purchaseOrderLines = await client+ .from("purchaseOrderLine")+ .select("*")+ .eq("purchaseOrderId", receipt.data.sourceDocumentId);+ if (purchaseOrderLines.error) return purchaseOrderLines;++ const receiptLinesByLineId = receiptLines.data.reduce<+ Record<string, ReceiptLine>+ >((acc, receiptLine) => {+ if (receiptLine.lineId) {+ acc[receiptLine.lineId] = receiptLine;+ }+ return acc;+ }, {});++ // First, update the quantity received on the purchase order lines+ purchaseOrderLines.data.forEach(async (purchaseOrderLine) => {+ const receiptLine = receiptLinesByLineId[purchaseOrderLine.id];+ if (!receiptLine) return;++ if (!purchaseOrderLine.purchaseQuantity) return;++ const newQuantityReceived =+ (purchaseOrderLine.quantityReceived ?? 0) ++ receiptLine.receivedQuantity;++ const newQuantityToReceive =+ (purchaseOrderLine.quantityToReceive ??+ purchaseOrderLine.purchaseQuantity) - receiptLine.receivedQuantity;++ const receivedComplete =+ receiptLine.receivedQuantity >=+ (purchaseOrderLine.quantityToReceive ??+ purchaseOrderLine.purchaseQuantity);++ let purchaseOrderLineUpdate = await client+ .from("purchaseOrderLine")+ .update({+ quantityReceived: newQuantityReceived,+ quantityToReceive: newQuantityToReceive,+ receivedComplete,+ })+ .eq("id", purchaseOrderLine.id);++ if (purchaseOrderLineUpdate.error) return purchaseOrderLineUpdate;+ });++ // Next, make the following entries for each line on the receipt:+ // - a value ledger entry for the value of the receipt+ // - a part ledger entry for the quantity received+ // - a G/L entry to debit interim inventory accrual+ // - a G/L entry to credit inventory received not invoiced+ receiptLines.data.forEach(async (receiptLine) => {+ // TODO:+ });++ break;+ default:+ break;+ }+}+export async function upsertAccount(client: SupabaseClient<Database>,account:diff --git a/apps/carbon/app/modules/accounting/types.ts b/apps/carbon/app/modules/accounting/types.tsindex 0777c33b17..e487677bf0 100644--- a/apps/carbon/app/modules/accounting/types.ts+++ b/apps/carbon/app/modules/accounting/types.ts@@ -2,9 +2,13 @@ import type { Database } from "@carbon/database";import type {getAccount,getAccountCategories,+ getAccountsList,getAccountSubcategories,getCurrencies,+ getInventoryPostingGroups,getPaymentTerms,+ getPurchasingPostingGroups,+ getSalesPostingGroups,} from "./services";export type Account = NonNullable<@@ -18,6 +22,10 @@ export type AccountCategory = NonNullable<export type AccountConsolidatedRate =Database["public"]["Enums"]["glConsolidatedRate"];+export type AccountListItem = NonNullable<+ NonNullable<Awaited<ReturnType<typeof getAccountsList>>>["data"]+>[number];+export type AccountSubcategory = NonNullable<Awaited<ReturnType<typeof getAccountSubcategories>>["data"]>[number];@@ -40,6 +48,10 @@ export type Currency = NonNullable<Awaited<ReturnType<typeof getCurrencies>>["data"]>[number];+export type InventoryPostingGroup = NonNullable<+ Awaited<ReturnType<typeof getInventoryPostingGroups>>["data"]+>[number];+export type PaymentTermCalculationMethod =Database["public"]["Enums"]["paymentTermCalculationMethod"];@@ -47,9 +59,17 @@ export type PaymentTerm = NonNullable<Awaited<ReturnType<typeof getPaymentTerms>>["data"]>[number];+export type PurchasingPostingGroup = NonNullable<+ Awaited<ReturnType<typeof getPurchasingPostingGroups>>["data"]+>[number];+export type Transaction = {number: string;netChange: number;balanceAtDate: number;balance: number;};++export type SalesPostingGroup = NonNullable<+ Awaited<ReturnType<typeof getSalesPostingGroups>>["data"]+>[number];diff --git a/apps/carbon/app/modules/accounting/interfaces/AccountCategories/AccountCategoriesTable/AccountCategoriesTable.tsx b/apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoriesTable/AccountCategoriesTable.tsxsimilarity index 98%rename from apps/carbon/app/modules/accounting/interfaces/AccountCategories/AccountCategoriesTable/AccountCategoriesTable.tsxrename to apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoriesTable/AccountCategoriesTable.tsxindex ea6c0195fe..bfd01744c6 100644--- a/apps/carbon/app/modules/accounting/interfaces/AccountCategories/AccountCategoriesTable/AccountCategoriesTable.tsx+++ b/apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoriesTable/AccountCategoriesTable.tsx@@ -11,7 +11,7 @@ import { useNavigate } from "@remix-run/react";import type { ColumnDef } from "@tanstack/react-table";import { memo, useCallback, useMemo, useState } from "react";import { BiAddToQueue } from "react-icons/bi";-import { BsPencilSquare, BsListUl, BsPlus } from "react-icons/bs";+import { BsListUl, BsPencilSquare, BsPlus } from "react-icons/bs";import { IoMdTrash } from "react-icons/io";import { Table } from "~/components";import { ConfirmDelete } from "~/components/Modals";@@ -68,7 +68,6 @@ const AccountCategoriesTable = memo(return (<Badgesize="sm"- variant="outline"colorScheme={isDebit ? "green" : isCredit ? "red" : "gray"}>{item.getValue<string>()}diff --git a/apps/carbon/app/modules/accounting/interfaces/AccountCategories/AccountCategoriesTable/index.ts b/apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoriesTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/AccountCategories/AccountCategoriesTable/index.tsrename to apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoriesTable/index.tsdiff --git a/apps/carbon/app/modules/accounting/interfaces/AccountCategories/AccountCategoriesTableFilters/AccountCategoriesTableFilters.tsx b/apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoriesTableFilters/AccountCategoriesTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/AccountCategories/AccountCategoriesTableFilters/AccountCategoriesTableFilters.tsxrename to apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoriesTableFilters/AccountCategoriesTableFilters.tsxdiff --git a/apps/carbon/app/modules/accounting/interfaces/AccountCategories/AccountCategoriesTableFilters/index.ts b/apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoriesTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/AccountCategories/AccountCategoriesTableFilters/index.tsrename to apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoriesTableFilters/index.tsdiff --git a/apps/carbon/app/modules/accounting/interfaces/AccountCategories/AccountCategoryDetail/AccountCategoryDetail.tsx b/apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoryDetail/AccountCategoryDetail.tsxsimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/AccountCategories/AccountCategoryDetail/AccountCategoryDetail.tsxrename to apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoryDetail/AccountCategoryDetail.tsxdiff --git a/apps/carbon/app/modules/accounting/interfaces/AccountCategories/AccountCategoryDetail/index.ts b/apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoryDetail/index.tssimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/AccountCategories/AccountCategoryDetail/index.tsrename to apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoryDetail/index.tsdiff --git a/apps/carbon/app/modules/accounting/interfaces/AccountCategories/AccountCategoryForm/AccountCategoryForm.tsx b/apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoryForm/AccountCategoryForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/AccountCategories/AccountCategoryForm/AccountCategoryForm.tsxrename to apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoryForm/AccountCategoryForm.tsxdiff --git a/apps/carbon/app/modules/accounting/interfaces/AccountCategories/AccountCategoryForm/index.ts b/apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoryForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/AccountCategories/AccountCategoryForm/index.tsrename to apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoryForm/index.tsdiff --git a/apps/carbon/app/modules/accounting/interfaces/AccountCategories/AccountSubcategoryForm/AccountSubcategoryForm.tsx b/apps/carbon/app/modules/accounting/ui/AccountCategories/AccountSubcategoryForm/AccountSubcategoryForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/AccountCategories/AccountSubcategoryForm/AccountSubcategoryForm.tsxrename to apps/carbon/app/modules/accounting/ui/AccountCategories/AccountSubcategoryForm/AccountSubcategoryForm.tsxdiff --git a/apps/carbon/app/modules/accounting/interfaces/AccountCategories/AccountSubcategoryForm/index.ts b/apps/carbon/app/modules/accounting/ui/AccountCategories/AccountSubcategoryForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/AccountCategories/AccountSubcategoryForm/index.tsrename to apps/carbon/app/modules/accounting/ui/AccountCategories/AccountSubcategoryForm/index.tsdiff --git a/apps/carbon/app/modules/accounting/interfaces/AccountCategories/index.ts b/apps/carbon/app/modules/accounting/ui/AccountCategories/index.tssimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/AccountCategories/index.tsrename to apps/carbon/app/modules/accounting/ui/AccountCategories/index.tsdiff --git a/apps/carbon/app/modules/accounting/ui/AccountDefaults/AccountDefaultsForm.tsx b/apps/carbon/app/modules/accounting/ui/AccountDefaults/AccountDefaultsForm.tsxnew file mode 100644index 0000000000..0bac9a3a29--- /dev/null+++ b/apps/carbon/app/modules/accounting/ui/AccountDefaults/AccountDefaultsForm.tsx@@ -0,0 +1,399 @@+import {+ Button,+ Grid,+ Heading,+ HStack,+ Tab,+ TabList,+ TabPanel,+ TabPanels,+ Tabs,+ VStack,+} from "@chakra-ui/react";+import { useNavigate } from "@remix-run/react";+import { ValidatedForm } from "remix-validated-form";+import { Select, Submit } from "~/components/Form";+import { usePermissions } from "~/hooks";+import type { AccountListItem } from "~/modules/accounting";+import { defaultAcountValidator } from "~/modules/accounting";+import type { TypeOfValidator } from "~/types/validators";++type AccountDefaultsFormProps = {+ balanceSheetAccounts: AccountListItem[];+ incomeStatementAccounts: AccountListItem[];+ initialValues: TypeOfValidator<typeof defaultAcountValidator>;+};++const AccountDefaultsForm = ({+ balanceSheetAccounts,+ incomeStatementAccounts,+ initialValues,+}: AccountDefaultsFormProps) => {+ const permissions = usePermissions();+ const navigate = useNavigate();+ const onClose = () => navigate(-1);++ const isDisabled = !permissions.can("update", "accounting");++ const incomeStatementAccountOptions = incomeStatementAccounts.map((c) => ({+ value: c.number,+ label: `${c.number} - ${c.name}`,+ }));++ const balanceSheetAccountOptions = balanceSheetAccounts.map((c) => ({+ value: c.number,+ label: `${c.number} - ${c.name}`,+ }));++ return (+ <VStack w="full" h="full" spacing={0}>+ <ValidatedForm+ validator={defaultAcountValidator}+ method="post"+ action="/x/accounting/defaults"+ defaultValues={initialValues}+ style={{+ width: "100%",+ }}+ >+ <Tabs colorScheme="gray">+ <TabList>+ <Tab>Income Statement</Tab>+ <Tab>Balance Sheet</Tab>+ </TabList>++ <TabPanels>+ <TabPanel>+ <VStack w="full" alignItems="start" spacing={8}>+ <VStack w="full" alignItems="start" spacing={4}>+ <Heading size="xs" color="gray.400" textTransform="uppercase">+ Revenue+ </Heading>+ <Grid+ gridTemplateColumns={["1fr", "1fr 1fr", "1fr 1fr"]}+ gridColumnGap={8}+ gridRowGap={4}+ mb={4}+ w="full"+ >+ <Select+ name="salesAccount"+ label="Sales"+ options={incomeStatementAccountOptions}+ />+ <Select+ name="salesDiscountAccount"+ label="Sales Discounts"+ options={incomeStatementAccountOptions}+ />+ </Grid>+ </VStack>+ <VStack w="full" alignItems="start" spacing={4}>+ <Heading size="xs" color="gray.400" textTransform="uppercase">+ Cost of Goods Sold+ </Heading>+ <Grid+ gridTemplateColumns={["1fr", "1fr 1fr", "1fr 1fr"]}+ gridColumnGap={8}+ gridRowGap={4}+ mb={4}+ w="full"+ >+ <Select+ name="costOfGoodsSoldAccount"+ label="Cost of Goods Sold"+ options={incomeStatementAccountOptions}+ />+ <Select+ name="purchaseAccount"+ label="Purchases"+ options={incomeStatementAccountOptions}+ />+ <Select+ name="directCostAppliedAccount"+ label="Direct Cost Applied"+ options={incomeStatementAccountOptions}+ />+ <Select+ name="overheadCostAppliedAccount"+ label="Overhead Cost Applied"+ options={incomeStatementAccountOptions}+ />+ <Select+ name="purchaseVarianceAccount"+ label="Purchase Variance"+ options={incomeStatementAccountOptions}+ />+ <Select+ name="inventoryAdjustmentVarianceAccount"+ label="Inventory Adjustment"+ options={incomeStatementAccountOptions}+ />+ </Grid>+ </VStack>+ <VStack w="full" alignItems="start" spacing={4}>+ <Heading size="xs" color="gray.400" textTransform="uppercase">+ Direct Costs+ </Heading>+ <Grid+ gridTemplateColumns={["1fr", "1fr 1fr", "1fr 1fr"]}+ gridColumnGap={8}+ gridRowGap={4}+ mb={4}+ w="full"+ >+ <Select+ name="materialVarianceAccount"+ label="Material Variance"+ options={incomeStatementAccountOptions}+ />+ <Select+ name="capacityVarianceAccount"+ label="Capacity Variance"+ options={incomeStatementAccountOptions}+ />+ <Select+ name="overheadAccount"+ label="Overhead"+ options={incomeStatementAccountOptions}+ />+ <Select+ name="maintenanceAccount"+ label="Maintenance Expense"+ options={incomeStatementAccountOptions}+ />+ </Grid>+ </VStack>+ <VStack w="full" alignItems="start" spacing={4}>+ <Heading size="xs" color="gray.400" textTransform="uppercase">+ Depreciation of Fixed Assets+ </Heading>+ <Grid+ gridTemplateColumns={["1fr", "1fr 1fr", "1fr 1fr"]}+ gridColumnGap={8}+ gridRowGap={4}+ mb={4}+ w="full"+ >+ <Select+ name="assetDepreciationExpenseAccount"+ label="Depreciation Expense"+ options={incomeStatementAccountOptions}+ />+ <Select+ name="assetGainsAndLossesAccount"+ label="Gains and Losses"+ options={incomeStatementAccountOptions}+ />+ <Select+ name="serviceChargeAccount"+ label="Service Charges"+ options={incomeStatementAccountOptions}+ />+ </Grid>+ </VStack>+ <VStack w="full" alignItems="start" spacing={4}>+ <Heading size="xs" color="gray.400" textTransform="uppercase">+ Interest+ </Heading>+ <Grid+ gridTemplateColumns={["1fr", "1fr 1fr", "1fr 1fr"]}+ gridColumnGap={8}+ gridRowGap={4}+ mb={4}+ w="full"+ >+ <Select+ name="interestAccount"+ label="Interest"+ options={incomeStatementAccountOptions}+ />+ <Select+ name="supplierPaymentDiscountAccount"+ label="Supplier Payment Discounts"+ options={incomeStatementAccountOptions}+ />+ <Select+ name="customerPaymentDiscountAccount"+ label="Customer Payment Discounts"+ options={incomeStatementAccountOptions}+ />+ <Select+ name="roundingAccount"+ label="Rounding Account"+ options={incomeStatementAccountOptions}+ />+ </Grid>+ </VStack>+ </VStack>+ </TabPanel>+ <TabPanel>+ <VStack w="full" alignItems="start" spacing={8}>+ <VStack w="full" alignItems="start" spacing={4}>+ <Heading size="xs" color="gray.400" textTransform="uppercase">+ Current Assets+ </Heading>+ <Grid+ gridTemplateColumns={["1fr", "1fr 1fr", "1fr 1fr"]}+ gridColumnGap={8}+ gridRowGap={4}+ mb={4}+ w="full"+ >+ <Select+ name="inventoryAccount"+ label="Inventory"+ options={balanceSheetAccountOptions}+ />+ <Select+ name="inventoryInterimAccrualAccount"+ label="Inventory Interim Accrual"+ options={balanceSheetAccountOptions}+ />+ <Select+ name="workInProgressAccount"+ label="Work in Progress (WIP)"+ options={balanceSheetAccountOptions}+ />+ <Select+ name="receivablesAccount"+ label="Receivables"+ options={balanceSheetAccountOptions}+ />+ <Select+ name="inventoryShippedNotInvoicedAccount"+ label="Inventory Shipped Not Invoiced"+ options={balanceSheetAccountOptions}+ />+ <Select+ name="bankCashAccount"+ label="Bank - Cash"+ options={balanceSheetAccountOptions}+ />+ <Select+ name="bankLocalCurrencyAccount"+ label="Bank - Local Currency"+ options={balanceSheetAccountOptions}+ />+ <Select+ name="bankForeignCurrencyAccount"+ label="Bank - Foreign Currency"+ options={balanceSheetAccountOptions}+ />+ </Grid>+ </VStack>+ <VStack w="full" alignItems="start" spacing={4}>+ <Heading size="xs" color="gray.400" textTransform="uppercase">+ Fixed Assets+ </Heading>+ <Grid+ gridTemplateColumns={["1fr", "1fr 1fr", "1fr 1fr"]}+ gridColumnGap={8}+ gridRowGap={4}+ mb={4}+ w="full"+ >+ <Select+ name="assetAquisitionCostAccount"+ label="Asset Aquisition Cost"+ options={balanceSheetAccountOptions}+ />+ <Select+ name="assetAquisitionCostOnDisposalAccount"+ label="Asset Cost on Disposal"+ options={balanceSheetAccountOptions}+ />+ <Select+ name="accumulatedDepreciationAccount"+ label="Accumulated Depreciation"+ options={balanceSheetAccountOptions}+ />+ <Select+ name="accumulatedDepreciationOnDisposalAccount"+ label="Accumulated Depreciation on Disposal"+ options={balanceSheetAccountOptions}+ />+ </Grid>+ </VStack>+ <VStack w="full" alignItems="start" spacing={4}>+ <Heading size="xs" color="gray.400" textTransform="uppercase">+ Liabilities+ </Heading>+ <Grid+ gridTemplateColumns={["1fr", "1fr 1fr", "1fr 1fr"]}+ gridColumnGap={8}+ gridRowGap={4}+ mb={4}+ w="full"+ >+ <Select+ name="prepaymentAccount"+ label="Prepayments"+ options={balanceSheetAccountOptions}+ />+ <Select+ name="payablesAccount"+ label="Payables"+ options={balanceSheetAccountOptions}+ />+ <Select+ name="inventoryReceivedNotInvoicedAccount"+ label="Inventory Received Not Invoiced"+ options={balanceSheetAccountOptions}+ />+ <Select+ name="salesTaxPayableAccount"+ label="Sales Tax Payable"+ options={balanceSheetAccountOptions}+ />+ <Select+ name="purchaseTaxPayableAccount"+ label="Purchase Tax Payable"+ options={balanceSheetAccountOptions}+ />+ <Select+ name="reverseChargeSalesTaxPayableAccount"+ label="Reverse Charge Sales Tax"+ options={balanceSheetAccountOptions}+ />+ </Grid>+ </VStack>+ <VStack w="full" alignItems="start" spacing={4}>+ <Heading size="xs" color="gray.400" textTransform="uppercase">+ Equity+ </Heading>+ <Grid+ gridTemplateColumns={["1fr", "1fr 1fr", "1fr 1fr"]}+ gridColumnGap={8}+ gridRowGap={4}+ w="full"+ >+ <Select+ name="retainedEarningsAccount"+ label="Retained Earnings"+ options={balanceSheetAccountOptions}+ />+ </Grid>+ </VStack>+ </VStack>+ </TabPanel>+ </TabPanels>+ </Tabs>++ <HStack spacing={2}>+ <Submit isDisabled={isDisabled}>Save</Submit>+ <Button+ size="md"+ colorScheme="gray"+ variant="solid"+ onClick={onClose}+ >+ Cancel+ </Button>+ </HStack>+ </ValidatedForm>+ </VStack>+ );+};++export default AccountDefaultsForm;diff --git a/apps/carbon/app/modules/accounting/ui/AccountDefaults/index.ts b/apps/carbon/app/modules/accounting/ui/AccountDefaults/index.tsnew file mode 100644index 0000000000..056bc1e5c4--- /dev/null+++ b/apps/carbon/app/modules/accounting/ui/AccountDefaults/index.ts@@ -0,0 +1,3 @@+import AccountDefaultsForm from "./AccountDefaultsForm";++export { AccountDefaultsForm };diff --git a/apps/carbon/app/modules/accounting/interfaces/ChartOfAccounts/ChartOfAccountForm/ChartOfAccountForm.tsx b/apps/carbon/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountForm/ChartOfAccountForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/ChartOfAccounts/ChartOfAccountForm/ChartOfAccountForm.tsxrename to apps/carbon/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountForm/ChartOfAccountForm.tsxdiff --git a/apps/carbon/app/modules/accounting/interfaces/ChartOfAccounts/ChartOfAccountForm/index.ts b/apps/carbon/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/ChartOfAccounts/ChartOfAccountForm/index.tsrename to apps/carbon/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountForm/index.tsdiff --git a/apps/carbon/app/modules/accounting/interfaces/ChartOfAccounts/ChartOfAccountsTable/ChartOfAccountsTable.tsx b/apps/carbon/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTable/ChartOfAccountsTable.tsxsimilarity index 80%rename from apps/carbon/app/modules/accounting/interfaces/ChartOfAccounts/ChartOfAccountsTable/ChartOfAccountsTable.tsxrename to apps/carbon/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTable/ChartOfAccountsTable.tsxindex 4ee6c7ffcb..7af65ebe72 100644--- a/apps/carbon/app/modules/accounting/interfaces/ChartOfAccounts/ChartOfAccountsTable/ChartOfAccountsTable.tsx+++ b/apps/carbon/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTable/ChartOfAccountsTable.tsx@@ -1,4 +1,3 @@-import { DataTable, DataTableColumnHeader } from "@carbon/react";import {Box,Checkbox,@@ -11,6 +10,7 @@ import { Link as RemixLink, useNavigate } from "@remix-run/react";import type { ColumnDef } from "@tanstack/react-table";import { memo, useMemo } from "react";import { MdMoreHoriz } from "react-icons/md";+import Grid from "~/components/Grid";import type { Chart } from "~/modules/accounting";type ChartOfAccountsTableProps = {@@ -23,9 +23,7 @@ const ChartOfAccountsTable = memo(({ data }: ChartOfAccountsTableProps) => {return [{accessorKey: "number",- header: ({ column }) => (- <DataTableColumnHeader column={column} title="No." />- ),+ header: "Number",cell: ({ row }) => {const isPosting = row.original.type === "Posting";@@ -74,17 +72,26 @@ const ChartOfAccountsTable = memo(({ data }: ChartOfAccountsTableProps) => {{accessorKey: "netChange",header: "Net Change",- cell: ({ row }) => (row.original.netChange ?? 0).toFixed(2),+ cell: ({ row }) => {+ const hasValue = ["Posting", "End Total"].includes(row.original.type);+ return hasValue ? (row.original.netChange ?? 0).toFixed(2) : null;+ },},{accessorKey: "balanceAtDate",header: "Balance at Date",- cell: ({ row }) => (row.original.balanceAtDate ?? 0).toFixed(2),+ cell: ({ row }) => {+ const hasValue = ["Posting", "End Total"].includes(row.original.type);+ return hasValue ? (row.original.balanceAtDate ?? 0).toFixed(2) : null;+ },},{accessorKey: "balance",header: "Balance",- cell: ({ row }) => (row.original.balance ?? 0).toFixed(2),+ cell: ({ row }) => {+ const hasValue = ["Posting", "End Total"].includes(row.original.type);+ return hasValue ? (row.original.balance ?? 0).toFixed(2) : null;+ },},{accessorKey: "incomeBalance",@@ -119,7 +126,7 @@ const ChartOfAccountsTable = memo(({ data }: ChartOfAccountsTableProps) => {];}, [navigate]);- return <DataTable data={data} columns={columns} />;+ return <Grid<Chart> data={data} columns={columns} withSimpleSorting />;});ChartOfAccountsTable.displayName = "ChartOfAccountsTable";diff --git a/apps/carbon/app/modules/accounting/interfaces/ChartOfAccounts/ChartOfAccountsTable/index.ts b/apps/carbon/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/ChartOfAccounts/ChartOfAccountsTable/index.tsrename to apps/carbon/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTable/index.tsdiff --git a/apps/carbon/app/modules/accounting/interfaces/ChartOfAccounts/ChartOfAccountsTableFilters/ChartOfAccountsTableFilters.tsx b/apps/carbon/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTableFilters/ChartOfAccountsTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/ChartOfAccounts/ChartOfAccountsTableFilters/ChartOfAccountsTableFilters.tsxrename to apps/carbon/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTableFilters/ChartOfAccountsTableFilters.tsxdiff --git a/apps/carbon/app/modules/accounting/interfaces/ChartOfAccounts/ChartOfAccountsTableFilters/index.ts b/apps/carbon/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/ChartOfAccounts/ChartOfAccountsTableFilters/index.tsrename to apps/carbon/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTableFilters/index.tsdiff --git a/apps/carbon/app/modules/accounting/interfaces/ChartOfAccounts/index.ts b/apps/carbon/app/modules/accounting/ui/ChartOfAccounts/index.tssimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/ChartOfAccounts/index.tsrename to apps/carbon/app/modules/accounting/ui/ChartOfAccounts/index.tsdiff --git a/apps/carbon/app/modules/accounting/interfaces/Currencies/CurrenciesTable/CurrenciesTable.tsx b/apps/carbon/app/modules/accounting/ui/Currencies/CurrenciesTable/CurrenciesTable.tsxsimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/Currencies/CurrenciesTable/CurrenciesTable.tsxrename to apps/carbon/app/modules/accounting/ui/Currencies/CurrenciesTable/CurrenciesTable.tsxdiff --git a/apps/carbon/app/modules/accounting/interfaces/Currencies/CurrenciesTable/index.ts b/apps/carbon/app/modules/accounting/ui/Currencies/CurrenciesTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/Currencies/CurrenciesTable/index.tsrename to apps/carbon/app/modules/accounting/ui/Currencies/CurrenciesTable/index.tsdiff --git a/apps/carbon/app/modules/accounting/interfaces/Currencies/CurrenciesTableFilters/CurrenciesTableFilters.tsx b/apps/carbon/app/modules/accounting/ui/Currencies/CurrenciesTableFilters/CurrenciesTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/Currencies/CurrenciesTableFilters/CurrenciesTableFilters.tsxrename to apps/carbon/app/modules/accounting/ui/Currencies/CurrenciesTableFilters/CurrenciesTableFilters.tsxdiff --git a/apps/carbon/app/modules/accounting/interfaces/Currencies/CurrenciesTableFilters/index.ts b/apps/carbon/app/modules/accounting/ui/Currencies/CurrenciesTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/Currencies/CurrenciesTableFilters/index.tsrename to apps/carbon/app/modules/accounting/ui/Currencies/CurrenciesTableFilters/index.tsdiff --git a/apps/carbon/app/modules/accounting/interfaces/Currencies/CurrencyForm/CurrencyForm.tsx b/apps/carbon/app/modules/accounting/ui/Currencies/CurrencyForm/CurrencyForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/Currencies/CurrencyForm/CurrencyForm.tsxrename to apps/carbon/app/modules/accounting/ui/Currencies/CurrencyForm/CurrencyForm.tsxdiff --git a/apps/carbon/app/modules/accounting/interfaces/Currencies/CurrencyForm/index.ts b/apps/carbon/app/modules/accounting/ui/Currencies/CurrencyForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/Currencies/CurrencyForm/index.tsrename to apps/carbon/app/modules/accounting/ui/Currencies/CurrencyForm/index.tsdiff --git a/apps/carbon/app/modules/accounting/interfaces/Currencies/index.ts b/apps/carbon/app/modules/accounting/ui/Currencies/index.tssimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/Currencies/index.tsrename to apps/carbon/app/modules/accounting/ui/Currencies/index.tsdiff --git a/apps/carbon/app/modules/accounting/interfaces/PaymentTerms/PaymentTermForm/PaymentTermForm.tsx b/apps/carbon/app/modules/accounting/ui/PaymentTerms/PaymentTermForm/PaymentTermForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/PaymentTerms/PaymentTermForm/PaymentTermForm.tsxrename to apps/carbon/app/modules/accounting/ui/PaymentTerms/PaymentTermForm/PaymentTermForm.tsxdiff --git a/apps/carbon/app/modules/accounting/interfaces/PaymentTerms/PaymentTermForm/index.ts b/apps/carbon/app/modules/accounting/ui/PaymentTerms/PaymentTermForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/PaymentTerms/PaymentTermForm/index.tsrename to apps/carbon/app/modules/accounting/ui/PaymentTerms/PaymentTermForm/index.tsdiff --git a/apps/carbon/app/modules/accounting/interfaces/PaymentTerms/PaymentTermsTable/PaymentTermsTable.tsx b/apps/carbon/app/modules/accounting/ui/PaymentTerms/PaymentTermsTable/PaymentTermsTable.tsxsimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/PaymentTerms/PaymentTermsTable/PaymentTermsTable.tsxrename to apps/carbon/app/modules/accounting/ui/PaymentTerms/PaymentTermsTable/PaymentTermsTable.tsxdiff --git a/apps/carbon/app/modules/accounting/interfaces/PaymentTerms/PaymentTermsTable/index.ts b/apps/carbon/app/modules/accounting/ui/PaymentTerms/PaymentTermsTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/PaymentTerms/PaymentTermsTable/index.tsrename to apps/carbon/app/modules/accounting/ui/PaymentTerms/PaymentTermsTable/index.tsdiff --git a/apps/carbon/app/modules/accounting/interfaces/PaymentTerms/PaymentTermsTableFilters/PaymentTermsTableFilters.tsx b/apps/carbon/app/modules/accounting/ui/PaymentTerms/PaymentTermsTableFilters/PaymentTermsTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/PaymentTerms/PaymentTermsTableFilters/PaymentTermsTableFilters.tsxrename to apps/carbon/app/modules/accounting/ui/PaymentTerms/PaymentTermsTableFilters/PaymentTermsTableFilters.tsxdiff --git a/apps/carbon/app/modules/accounting/interfaces/PaymentTerms/PaymentTermsTableFilters/index.ts b/apps/carbon/app/modules/accounting/ui/PaymentTerms/PaymentTermsTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/PaymentTerms/PaymentTermsTableFilters/index.tsrename to apps/carbon/app/modules/accounting/ui/PaymentTerms/PaymentTermsTableFilters/index.tsdiff --git a/apps/carbon/app/modules/accounting/interfaces/PaymentTerms/index.ts b/apps/carbon/app/modules/accounting/ui/PaymentTerms/index.tssimilarity index 100%rename from apps/carbon/app/modules/accounting/interfaces/PaymentTerms/index.tsrename to apps/carbon/app/modules/accounting/ui/PaymentTerms/index.tsdiff --git a/apps/carbon/app/modules/accounting/ui/PostingGroups/InventoryPostingGroupsFilters.tsx b/apps/carbon/app/modules/accounting/ui/PostingGroups/InventoryPostingGroupsFilters.tsxnew file mode 100644index 0000000000..86607e821b--- /dev/null+++ b/apps/carbon/app/modules/accounting/ui/PostingGroups/InventoryPostingGroupsFilters.tsx@@ -0,0 +1,73 @@+import { Select, useColor } from "@carbon/react";+import { HStack } from "@chakra-ui/react";+import { useUrlParams } from "~/hooks";+import type { ListItem } from "~/types";++type InventoryPostingGroupsFiltersProps = {+ partGroups: ListItem[];+ locations: ListItem[];+};++const InventoryPostingGroupsFilters = ({+ partGroups,+ locations,+}: InventoryPostingGroupsFiltersProps) => {+ const [params, setParams] = useUrlParams();+ const borderColor = useColor("gray.200");++ const partGroupOptions = partGroups.map((partGroup) => ({+ label: partGroup.name,+ value: partGroup.id,+ }));++ const locationOptions = locations.map((location) => ({+ label: location.name,+ value: location.id,+ }));++ return (+ <HStack+ borderBottomColor={borderColor}+ borderBottomStyle="solid"+ borderBottomWidth={1}+ justifyContent="flex-start"+ px={4}+ py={3}+ spacing={4}+ w="full"+ >+ <Select+ // @ts-ignore+ size="sm"+ isClearable+ value={partGroupOptions.find(+ (partGroup) => partGroup.value === params.get("partGroup")+ )}+ options={partGroupOptions}+ onChange={(selected) => {+ setParams({ partGroup: selected?.value });+ }}+ aria-label="Part Group"+ minW={180}+ placeholder="Part Group"+ />+ <Select+ // @ts-ignore+ size="sm"+ isClearable+ value={locationOptions.find(+ (location) => location.value === params.get("location")+ )}+ options={locationOptions}+ onChange={(selected) => {+ setParams({ location: selected?.value });+ }}+ aria-label="Location"+ minW={180}+ placeholder="Location"+ />+ </HStack>+ );+};++export default InventoryPostingGroupsFilters;diff --git a/apps/carbon/app/modules/accounting/ui/PostingGroups/InventoryPostingGroupsTable.tsx b/apps/carbon/app/modules/accounting/ui/PostingGroups/InventoryPostingGroupsTable.tsxnew file mode 100644index 0000000000..604006d057--- /dev/null+++ b/apps/carbon/app/modules/accounting/ui/PostingGroups/InventoryPostingGroupsTable.tsx@@ -0,0 +1,197 @@+import type { ColumnDef } from "@tanstack/react-table";+import { useMemo } from "react";+import { Table } from "~/components";+import { EditableList } from "~/components/Editable";+import type {+ AccountListItem,+ InventoryPostingGroup,+} from "~/modules/accounting";+import type { ListItem } from "~/types";+import usePostingGroups from "./usePostingGroups";++type InventoryPostingGroupsTableProps = {+ data: InventoryPostingGroup[];+ count: number;+ partGroups: ListItem[];+ locations: ListItem[];+ balanceSheetAccounts: AccountListItem[];+ incomeStatementAccounts: AccountListItem[];+};++const InventoryPostingGroupsTable = ({+ data,+ count,+ partGroups,+ locations,+ balanceSheetAccounts,+ incomeStatementAccounts,+}: InventoryPostingGroupsTableProps) => {+ const { canEdit, handleCellEdit } = usePostingGroups("postingGroupInventory");++ const balanceSheetAccountOptions = useMemo(() => {+ return balanceSheetAccounts.map((account) => ({+ label: account.number,+ value: account.number,+ }));+ }, [balanceSheetAccounts]);++ const incomeStatementAccountOptions = useMemo(() => {+ return incomeStatementAccounts.map((account) => ({+ label: account.number,+ value: account.number,+ }));+ }, [incomeStatementAccounts]);++ const columns = useMemo<ColumnDef<InventoryPostingGroup>[]>(() => {+ return [+ {+ id: "partGroup",+ header: "Part Group",+ cell: ({ row }) =>+ partGroups.find((group) => group.id === row.original.partGroupId)+ ?.name,+ },+ {+ id: "location",+ header: "Location",+ cell: ({ row }) =>+ locations.find((type) => type.id === row.original.locationId)?.name,+ },+ {+ accessorKey: "costOfGoodsSoldAccount",+ header: "COGS",+ cell: (item) => item.getValue(),+ },+ {+ accessorKey: "inventoryAccount",+ header: "Inventory",+ cell: (item) => item.getValue(),+ },+ {+ accessorKey: "inventoryInterimAccrualAccount",+ header: "Inv. Interim Accrual",+ cell: (item) => item.getValue(),+ },+ {+ accessorKey: "inventoryReceivedNotInvoicedAccount",+ header: "Received Not Invoiced",+ cell: (item) => item.getValue(),+ },+ {+ accessorKey: "inventoryShippedNotInvoicedAccount",+ header: "Shipped Not Invoiced",+ cell: (item) => item.getValue(),+ },+ {+ accessorKey: "workInProgressAccount",+ header: "WIP",+ cell: (item) => item.getValue(),+ },+ {+ accessorKey: "directCostAppliedAccount",+ header: "Direct Cost Applied",+ cell: (item) => item.getValue(),+ },+ {+ accessorKey: "overheadCostAppliedAccount",+ header: "Overhead Cost Applied",+ cell: (item) => item.getValue(),+ },+ {+ accessorKey: "purchaseVarianceAccount",+ header: "Purchase Variance",+ cell: (item) => item.getValue(),+ },+ {+ accessorKey: "inventoryAdjustmentVarianceAccount",+ header: "Inv. Adjustment Variance",+ cell: (item) => item.getValue(),+ },+ {+ accessorKey: "materialVarianceAccount",+ header: "Material Variance",+ cell: (item) => item.getValue(),+ },+ {+ accessorKey: "capacityVarianceAccount",+ header: "Capacity Variance",+ cell: (item) => item.getValue(),+ },+ {+ accessorKey: "overheadAccount",+ header: "Overhead",+ cell: (item) => item.getValue(),+ },+ ];+ }, [locations, partGroups]);++ const editableComponents = useMemo(+ () => ({+ costOfGoodsSoldAccount: EditableList(+ handleCellEdit,+ incomeStatementAccountOptions+ ),+ inventoryAccount: EditableList(+ handleCellEdit,+ balanceSheetAccountOptions+ ),+ inventoryInterimAccrualAccount: EditableList(+ handleCellEdit,+ balanceSheetAccountOptions+ ),+ inventoryReceivedNotInvoicedAccount: EditableList(+ handleCellEdit,+ balanceSheetAccountOptions+ ),+ inventoryShippedNotInvoicedAccount: EditableList(+ handleCellEdit,+ balanceSheetAccountOptions+ ),+ workInProgressAccount: EditableList(+ handleCellEdit,+ balanceSheetAccountOptions+ ),+ directCostAppliedAccount: EditableList(+ handleCellEdit,+ incomeStatementAccountOptions+ ),+ overheadCostAppliedAccount: EditableList(+ handleCellEdit,+ incomeStatementAccountOptions+ ),+ purchaseVarianceAccount: EditableList(+ handleCellEdit,+ incomeStatementAccountOptions+ ),+ inventoryAdjustmentVarianceAccount: EditableList(+ handleCellEdit,+ incomeStatementAccountOptions+ ),+ materialVarianceAccount: EditableList(+ handleCellEdit,+ incomeStatementAccountOptions+ ),+ capacityVarianceAccount: EditableList(+ handleCellEdit,+ incomeStatementAccountOptions+ ),+ overheadAccount: EditableList(+ handleCellEdit,+ incomeStatementAccountOptions+ ),+ }),+ [handleCellEdit, balanceSheetAccountOptions, incomeStatementAccountOptions]+ );++ return (+ <Table<InventoryPostingGroup>+ data={data}+ columns={columns}+ count={count}+ editableComponents={editableComponents}+ withInlineEditing={canEdit}+ />+ );+};++export default InventoryPostingGroupsTable;diff --git a/apps/carbon/app/modules/accounting/ui/PostingGroups/PurchasingPostingGroupsFilters.tsx b/apps/carbon/app/modules/accounting/ui/PostingGroups/PurchasingPostingGroupsFilters.tsxnew file mode 100644index 0000000000..76b93ffa7d--- /dev/null+++ b/apps/carbon/app/modules/accounting/ui/PostingGroups/PurchasingPostingGroupsFilters.tsx@@ -0,0 +1,73 @@+import { Select, useColor } from "@carbon/react";+import { HStack } from "@chakra-ui/react";+import { useUrlParams } from "~/hooks";+import type { ListItem } from "~/types";++type PurchasingPostingGroupsFiltersProps = {+ partGroups: ListItem[];+ supplierTypes: ListItem[];+};++const PurchasingPostingGroupsFilters = ({+ partGroups,+ supplierTypes,+}: PurchasingPostingGroupsFiltersProps) => {+ const [params, setParams] = useUrlParams();+ const borderColor = useColor("gray.200");++ const partGroupOptions = partGroups.map((partGroup) => ({+ label: partGroup.name,+ value: partGroup.id,+ }));++ const supplierTypeOptions = supplierTypes.map((supplierType) => ({+ label: supplierType.name,+ value: supplierType.id,+ }));++ return (+ <HStack+ borderBottomColor={borderColor}+ borderBottomStyle="solid"+ borderBottomWidth={1}+ justifyContent="flex-start"+ px={4}+ py={3}+ spacing={4}+ w="full"+ >+ <Select+ // @ts-ignore+ size="sm"+ isClearable+ value={partGroupOptions.find(+ (partGroup) => partGroup.value === params.get("partGroup")+ )}+ options={partGroupOptions}+ onChange={(selected) => {+ setParams({ partGroup: selected?.value });+ }}+ aria-label="Part Group"+ minW={180}+ placeholder="Part Group"+ />+ <Select+ // @ts-ignore+ size="sm"+ isClearable+ value={supplierTypeOptions.find(+ (supplierType) => supplierType.value === params.get("supplierType")+ )}+ options={supplierTypeOptions}+ onChange={(selected) => {+ setParams({ supplierType: selected?.value });+ }}+ aria-label="Supplier Type"+ minW={180}+ placeholder="Supplier Type"+ />+ </HStack>+ );+};++export default PurchasingPostingGroupsFilters;diff --git a/apps/carbon/app/modules/accounting/ui/PostingGroups/PurchasingPostingGroupsTable.tsx b/apps/carbon/app/modules/accounting/ui/PostingGroups/PurchasingPostingGroupsTable.tsxnew file mode 100644index 0000000000..d18aea76e5--- /dev/null+++ b/apps/carbon/app/modules/accounting/ui/PostingGroups/PurchasingPostingGroupsTable.tsx@@ -0,0 +1,128 @@+import type { ColumnDef } from "@tanstack/react-table";+import { useMemo } from "react";+import { Table } from "~/components";+import { EditableList } from "~/components/Editable";+import type {+ AccountListItem,+ PurchasingPostingGroup,+} from "~/modules/accounting";+import type { ListItem } from "~/types";+import usePostingGroups from "./usePostingGroups";++type PurchasingPostingGroupsTableProps = {+ data: PurchasingPostingGroup[];+ count: number;+ partGroups: ListItem[];+ supplierTypes: ListItem[];+ balanceSheetAccounts: AccountListItem[];+ incomeStatementAccounts: AccountListItem[];+};++const PurchasingPostingGroupsTable = ({+ data,+ count,+ partGroups,+ supplierTypes,+ balanceSheetAccounts,+ incomeStatementAccounts,+}: PurchasingPostingGroupsTableProps) => {+ const { canEdit, handleCellEdit } = usePostingGroups(+ "postingGroupPurchasing"+ );++ const balanceSheetAccountOptions = useMemo(() => {+ return balanceSheetAccounts.map((account) => ({+ label: account.number,+ value: account.number,+ }));+ }, [balanceSheetAccounts]);++ const incomeStatementAccountOptions = useMemo(() => {+ return incomeStatementAccounts.map((account) => ({+ label: account.number,+ value: account.number,+ }));+ }, [incomeStatementAccounts]);++ const columns = useMemo<ColumnDef<PurchasingPostingGroup>[]>(() => {+ return [+ {+ id: "partGroup",+ header: "Part Group",+ cell: ({ row }) =>+ partGroups.find((group) => group.id === row.original.partGroupId)+ ?.name,+ },+ {+ id: "supplierType",+ header: "Supplier Type",+ cell: ({ row }) =>+ supplierTypes.find((type) => type.id === row.original.supplierTypeId)+ ?.name,+ },+ {+ accessorKey: "purchaseAccount",+ header: "Purchase",+ cell: (item) => item.getValue(),+ },+ {+ accessorKey: "purchaseDiscountAccount",+ header: "Purchase Discount",+ cell: (item) => item.getValue(),+ },+ {+ accessorKey: "purchaseCreditAccount",+ header: "Purchase Credit",+ cell: (item) => item.getValue(),+ },+ {+ accessorKey: "purchasePrepaymentAccount",+ header: "Purchase Prepayment",+ cell: (item) => item.getValue(),+ },+ {+ accessorKey: "purchaseTaxPayableAccount",+ header: "Purchase Tax Payable",+ cell: (item) => item.getValue(),+ },+ ];+ }, [supplierTypes, partGroups]);++ const editableComponents = useMemo(+ () => ({+ purchaseAccount: EditableList(+ handleCellEdit,+ incomeStatementAccountOptions+ ),+ purchaseDiscountAccount: EditableList(+ handleCellEdit,+ incomeStatementAccountOptions+ ),+ purchaseCreditAccount: EditableList(+ handleCellEdit,+ balanceSheetAccountOptions+ ),+ purchasePrepaymentAccount: EditableList(+ handleCellEdit,+ balanceSheetAccountOptions+ ),+ purchaseTaxPayableAccount: EditableList(+ handleCellEdit,+ balanceSheetAccountOptions+ ),+ }),+ [handleCellEdit, balanceSheetAccountOptions, incomeStatementAccountOptions]+ );++ return (+ <Table<PurchasingPostingGroup>+ data={data}+ columns={columns}+ count={count}+ editableComponents={editableComponents}+ withInlineEditing={canEdit}+ />+ );+};++export default PurchasingPostingGroupsTable;diff --git a/apps/carbon/app/modules/accounting/ui/PostingGroups/SalesPostingGroupsFilters.tsx b/apps/carbon/app/modules/accounting/ui/PostingGroups/SalesPostingGroupsFilters.tsxnew file mode 100644index 0000000000..da196903d6--- /dev/null+++ b/apps/carbon/app/modules/accounting/ui/PostingGroups/SalesPostingGroupsFilters.tsx@@ -0,0 +1,73 @@+import { Select, useColor } from "@carbon/react";+import { HStack } from "@chakra-ui/react";+import { useUrlParams } from "~/hooks";+import type { ListItem } from "~/types";++type SalesPostingGroupsFiltersProps = {+ partGroups: ListItem[];+ customerTypes: ListItem[];+};++const SalesPostingGroupsFilters = ({+ partGroups,+ customerTypes,+}: SalesPostingGroupsFiltersProps) => {+ const [params, setParams] = useUrlParams();+ const borderColor = useColor("gray.200");++ const partGroupOptions = partGroups.map((partGroup) => ({+ label: partGroup.name,+ value: partGroup.id,+ }));++ const customerTypeOptions = customerTypes.map((customerType) => ({+ label: customerType.name,+ value: customerType.id,+ }));++ return (+ <HStack+ borderBottomColor={borderColor}+ borderBottomStyle="solid"+ borderBottomWidth={1}+ justifyContent="flex-start"+ px={4}+ py={3}+ spacing={4}+ w="full"+ >+ <Select+ // @ts-ignore+ size="sm"+ isClearable+ value={partGroupOptions.find(+ (partGroup) => partGroup.value === params.get("partGroup")+ )}+ options={partGroupOptions}+ onChange={(selected) => {+ setParams({ partGroup: selected?.value });+ }}+ aria-label="Part Group"+ minW={180}+ placeholder="Part Group"+ />+ <Select+ // @ts-ignore+ size="sm"+ isClearable+ value={customerTypeOptions.find(+ (customerType) => customerType.value === params.get("customerType")+ )}+ options={customerTypeOptions}+ onChange={(selected) => {+ setParams({ customerType: selected?.value });+ }}+ aria-label="Customer Type"+ minW={180}+ placeholder="Customer Type"+ />+ </HStack>+ );+};++export default SalesPostingGroupsFilters;diff --git a/apps/carbon/app/modules/accounting/ui/PostingGroups/SalesPostingGroupsTable.tsx b/apps/carbon/app/modules/accounting/ui/PostingGroups/SalesPostingGroupsTable.tsxnew file mode 100644index 0000000000..3fcef171ff--- /dev/null+++ b/apps/carbon/app/modules/accounting/ui/PostingGroups/SalesPostingGroupsTable.tsx@@ -0,0 +1,120 @@+import type { ColumnDef } from "@tanstack/react-table";+import { useMemo } from "react";+import { Table } from "~/components";+import { EditableList } from "~/components/Editable";+import type { AccountListItem, SalesPostingGroup } from "~/modules/accounting";+import type { ListItem } from "~/types";+import usePostingGroups from "./usePostingGroups";++type SalesPostingGroupsTableProps = {+ data: SalesPostingGroup[];+ count: number;+ partGroups: ListItem[];+ customerTypes: ListItem[];+ balanceSheetAccounts: AccountListItem[];+ incomeStatementAccounts: AccountListItem[];+};++const SalesPostingGroupsTable = ({+ data,+ count,+ partGroups,+ customerTypes,+ balanceSheetAccounts,+ incomeStatementAccounts,+}: SalesPostingGroupsTableProps) => {+ const { canEdit, handleCellEdit } = usePostingGroups("postingGroupSales");++ const balanceSheetAccountOptions = useMemo(() => {+ return balanceSheetAccounts.map((account) => ({+ label: account.number,+ value: account.number,+ }));+ }, [balanceSheetAccounts]);++ const incomeStatementAccountOptions = useMemo(() => {+ return incomeStatementAccounts.map((account) => ({+ label: account.number,+ value: account.number,+ }));+ }, [incomeStatementAccounts]);++ const columns = useMemo<ColumnDef<SalesPostingGroup>[]>(() => {+ return [+ {+ id: "partGroup",+ header: "Part Group",+ cell: ({ row }) =>+ partGroups.find((group) => group.id === row.original.partGroupId)+ ?.name,+ },+ {+ id: "customerType",+ header: "Customer Type",+ cell: ({ row }) =>+ customerTypes.find((type) => type.id === row.original.customerTypeId)+ ?.name,+ },+ {+ accessorKey: "salesAccount",+ header: "Sales",+ cell: (item) => item.getValue(),+ },+ {+ accessorKey: "salesDiscountAccount",+ header: "Sales Discount",+ cell: (item) => item.getValue(),+ },+ {+ accessorKey: "salesCreditAccount",+ header: "Sales Credit",+ cell: (item) => item.getValue(),+ },+ {+ accessorKey: "salesPrepaymentAccount",+ header: "Sales Prepayment",+ cell: (item) => item.getValue(),+ },+ {+ accessorKey: "salesTaxPayableAccount",+ header: "Sales Tax Payable",+ cell: (item) => item.getValue(),+ },+ ];+ }, [customerTypes, partGroups]);++ const editableComponents = useMemo(+ () => ({+ salesAccount: EditableList(handleCellEdit, incomeStatementAccountOptions),+ salesDiscountAccount: EditableList(+ handleCellEdit,+ incomeStatementAccountOptions+ ),+ salesCreditAccount: EditableList(+ handleCellEdit,+ balanceSheetAccountOptions+ ),+ salesPrepaymentAccount: EditableList(+ handleCellEdit,+ balanceSheetAccountOptions+ ),+ salesTaxPayableAccount: EditableList(+ handleCellEdit,+ balanceSheetAccountOptions+ ),+ }),+ [handleCellEdit, balanceSheetAccountOptions, incomeStatementAccountOptions]+ );++ return (+ <Table<SalesPostingGroup>+ data={data}+ columns={columns}+ count={count}+ editableComponents={editableComponents}+ withInlineEditing={canEdit}+ />+ );+};++export default SalesPostingGroupsTable;diff --git a/apps/carbon/app/modules/accounting/ui/PostingGroups/index.ts b/apps/carbon/app/modules/accounting/ui/PostingGroups/index.tsnew file mode 100644index 0000000000..4cd473cd05--- /dev/null+++ b/apps/carbon/app/modules/accounting/ui/PostingGroups/index.ts@@ -0,0 +1,15 @@+import InventoryPostingGroupsFilters from "./InventoryPostingGroupsFilters";+import InventoryPostingGroupsTable from "./InventoryPostingGroupsTable";+import PurchasingPostingGroupsFilters from "./PurchasingPostingGroupsFilters";+import PurchasingPostingGroupsTable from "./PurchasingPostingGroupsTable";+import SalesPostingGroupsFilters from "./SalesPostingGroupsFilters";+import SalesPostingGroupsTable from "./SalesPostingGroupsTable";++export {+ InventoryPostingGroupsFilters,+ InventoryPostingGroupsTable,+ PurchasingPostingGroupsFilters,+ PurchasingPostingGroupsTable,+ SalesPostingGroupsFilters,+ SalesPostingGroupsTable,+};diff --git a/apps/carbon/app/modules/accounting/ui/PostingGroups/usePostingGroups.tsx b/apps/carbon/app/modules/accounting/ui/PostingGroups/usePostingGroups.tsxnew file mode 100644index 0000000000..b48d7fc0fe--- /dev/null+++ b/apps/carbon/app/modules/accounting/ui/PostingGroups/usePostingGroups.tsx@@ -0,0 +1,40 @@+import { useCallback } from "react";+import { usePermissions } from "~/hooks";+import { useSupabase } from "~/lib/supabase";+import type {+ InventoryPostingGroup,+ PurchasingPostingGroup,+ SalesPostingGroup,+} from "~/modules/accounting";++export default function usePostingGroups(table: string) {+ const { supabase } = useSupabase();+ const permissions = usePermissions();++ const canEdit = permissions.can("update", "accounting");+ const canDelete = permissions.can("delete", "accounting");++ const handleCellEdit = useCallback(+ async (+ id: string,+ value: unknown,+ row: PurchasingPostingGroup | SalesPostingGroup | InventoryPostingGroup+ ) => {+ if (!supabase) throw new Error("Supabase client not found");+ return await supabase+ .from(table)+ .update({+ [id]: value,+ })+ .eq("id", row.id);+ },+ [supabase, table]+ );++ return {+ canDelete,+ canEdit,+ supabase,+ handleCellEdit,+ };+}diff --git a/apps/carbon/app/modules/accounting/interfaces/index.ts b/apps/carbon/app/modules/accounting/ui/index.tssimilarity index 76%rename from apps/carbon/app/modules/accounting/interfaces/index.tsrename to apps/carbon/app/modules/accounting/ui/index.tsindex 389a6af6ca..5403376c36 100644--- a/apps/carbon/app/modules/accounting/interfaces/index.ts+++ b/apps/carbon/app/modules/accounting/ui/index.ts@@ -1,7 +1,9 @@import useAccountingSidebar from "./useAccountingSidebar";-export { useAccountingSidebar };export * from "./AccountCategories";+export * from "./AccountDefaults";export * from "./ChartOfAccounts";export * from "./Currencies";export * from "./PaymentTerms";+export * from "./PostingGroups";+export { useAccountingSidebar };diff --git a/apps/carbon/app/modules/accounting/interfaces/useAccountingSidebar.tsx b/apps/carbon/app/modules/accounting/ui/useAccountingSidebar.tsxsimilarity index 65%rename from apps/carbon/app/modules/accounting/interfaces/useAccountingSidebar.tsxrename to apps/carbon/app/modules/accounting/ui/useAccountingSidebar.tsxindex ad1539063c..53fdfc981b 100644--- a/apps/carbon/app/modules/accounting/interfaces/useAccountingSidebar.tsx+++ b/apps/carbon/app/modules/accounting/ui/useAccountingSidebar.tsx@@ -10,21 +10,51 @@ const accountingRoutes: AuthenticatedRouteGroup[] = [to: "/x/accounting/charts",role: "employee",},+ // {+ // name: "Journal Entries",+ // to: "/x/accounting/journals",+ // role: "employee",+ // },],},{- name: "Configure",+ name: "Posting Groups",routes: [{- name: "Currencies",- to: "/x/accounting/currencies",+ name: "Inventory Groups",+ to: "/x/accounting/groups/inventory",+ role: "employee",+ },+ {+ name: "Purchasing Groups",+ to: "/x/accounting/groups/purchasing",role: "employee",},{- name: "G/L Categories",+ name: "Sales Groups",+ to: "/x/accounting/groups/sales",+ role: "employee",+ },+ ],+ },+ {+ name: "Configure",+ routes: [+ {+ name: "Account Categories",to: "/x/accounting/categories",role: "employee",},+ {+ name: "Account Defaults",+ to: "/x/accounting/defaults",+ role: "employee",+ },+ {+ name: "Currencies",+ to: "/x/accounting/currencies",+ role: "employee",+ },{name: "Payment Terms",to: "/x/accounting/payment-terms",diff --git a/apps/carbon/app/modules/documents/index.ts b/apps/carbon/app/modules/documents/index.tsindex 684aed031a..83b8af135e 100644--- a/apps/carbon/app/modules/documents/index.ts+++ b/apps/carbon/app/modules/documents/index.ts@@ -1,3 +1,3 @@export * from "./services";-export * from "./interfaces";export * from "./types";+export * from "./ui";diff --git a/apps/carbon/app/modules/documents/interfaces/Documents/DocumentCreateForm/DocumentCreateForm.tsx b/apps/carbon/app/modules/documents/ui/Documents/DocumentCreateForm/DocumentCreateForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/documents/interfaces/Documents/DocumentCreateForm/DocumentCreateForm.tsxrename to apps/carbon/app/modules/documents/ui/Documents/DocumentCreateForm/DocumentCreateForm.tsxdiff --git a/apps/carbon/app/modules/documents/interfaces/Documents/DocumentCreateForm/index.ts b/apps/carbon/app/modules/documents/ui/Documents/DocumentCreateForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/documents/interfaces/Documents/DocumentCreateForm/index.tsrename to apps/carbon/app/modules/documents/ui/Documents/DocumentCreateForm/index.tsdiff --git a/apps/carbon/app/modules/documents/interfaces/Documents/DocumentForm/DocumentForm.tsx b/apps/carbon/app/modules/documents/ui/Documents/DocumentForm/DocumentForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/documents/interfaces/Documents/DocumentForm/DocumentForm.tsxrename to apps/carbon/app/modules/documents/ui/Documents/DocumentForm/DocumentForm.tsxdiff --git a/apps/carbon/app/modules/documents/interfaces/Documents/DocumentForm/index.ts b/apps/carbon/app/modules/documents/ui/Documents/DocumentForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/documents/interfaces/Documents/DocumentForm/index.tsrename to apps/carbon/app/modules/documents/ui/Documents/DocumentForm/index.tsdiff --git a/apps/carbon/app/modules/documents/interfaces/Documents/DocumentIcon/DocumentIcon.tsx b/apps/carbon/app/modules/documents/ui/Documents/DocumentIcon/DocumentIcon.tsxsimilarity index 100%rename from apps/carbon/app/modules/documents/interfaces/Documents/DocumentIcon/DocumentIcon.tsxrename to apps/carbon/app/modules/documents/ui/Documents/DocumentIcon/DocumentIcon.tsxdiff --git a/apps/carbon/app/modules/documents/interfaces/Documents/DocumentIcon/index.ts b/apps/carbon/app/modules/documents/ui/Documents/DocumentIcon/index.tssimilarity index 100%rename from apps/carbon/app/modules/documents/interfaces/Documents/DocumentIcon/index.tsrename to apps/carbon/app/modules/documents/ui/Documents/DocumentIcon/index.tsdiff --git a/apps/carbon/app/modules/documents/interfaces/Documents/DocumentsTable/DocumentsTable.tsx b/apps/carbon/app/modules/documents/ui/Documents/DocumentsTable/DocumentsTable.tsxsimilarity index 100%rename from apps/carbon/app/modules/documents/interfaces/Documents/DocumentsTable/DocumentsTable.tsxrename to apps/carbon/app/modules/documents/ui/Documents/DocumentsTable/DocumentsTable.tsxdiff --git a/apps/carbon/app/modules/documents/interfaces/Documents/DocumentsTable/index.ts b/apps/carbon/app/modules/documents/ui/Documents/DocumentsTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/documents/interfaces/Documents/DocumentsTable/index.tsrename to apps/carbon/app/modules/documents/ui/Documents/DocumentsTable/index.tsdiff --git a/apps/carbon/app/modules/documents/interfaces/Documents/DocumentsTableFilters/DocumentsTableFilters.tsx b/apps/carbon/app/modules/documents/ui/Documents/DocumentsTableFilters/DocumentsTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/documents/interfaces/Documents/DocumentsTableFilters/DocumentsTableFilters.tsxrename to apps/carbon/app/modules/documents/ui/Documents/DocumentsTableFilters/DocumentsTableFilters.tsxdiff --git a/apps/carbon/app/modules/documents/interfaces/Documents/DocumentsTableFilters/index.ts b/apps/carbon/app/modules/documents/ui/Documents/DocumentsTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/documents/interfaces/Documents/DocumentsTableFilters/index.tsrename to apps/carbon/app/modules/documents/ui/Documents/DocumentsTableFilters/index.tsdiff --git a/apps/carbon/app/modules/documents/interfaces/Documents/index.ts b/apps/carbon/app/modules/documents/ui/Documents/index.tssimilarity index 100%rename from apps/carbon/app/modules/documents/interfaces/Documents/index.tsrename to apps/carbon/app/modules/documents/ui/Documents/index.tsdiff --git a/apps/carbon/app/modules/documents/interfaces/Documents/useDocument.ts b/apps/carbon/app/modules/documents/ui/Documents/useDocument.tssimilarity index 100%rename from apps/carbon/app/modules/documents/interfaces/Documents/useDocument.tsrename to apps/carbon/app/modules/documents/ui/Documents/useDocument.tsdiff --git a/apps/carbon/app/modules/documents/interfaces/index.ts b/apps/carbon/app/modules/documents/ui/index.tssimilarity index 100%rename from apps/carbon/app/modules/documents/interfaces/index.tsrename to apps/carbon/app/modules/documents/ui/index.tsdiff --git a/apps/carbon/app/modules/documents/interfaces/useDocumentsSidebar.tsx b/apps/carbon/app/modules/documents/ui/useDocumentsSidebar.tsxsimilarity index 100%rename from apps/carbon/app/modules/documents/interfaces/useDocumentsSidebar.tsxrename to apps/carbon/app/modules/documents/ui/useDocumentsSidebar.tsxdiff --git a/apps/carbon/app/modules/inventory/index.ts b/apps/carbon/app/modules/inventory/index.tsindex 490fd762ea..83b8af135e 100644--- a/apps/carbon/app/modules/inventory/index.ts+++ b/apps/carbon/app/modules/inventory/index.ts@@ -1,3 +1,3 @@-export * from "./interfaces";export * from "./services";export * from "./types";+export * from "./ui";diff --git a/apps/carbon/app/modules/inventory/interfaces/Receipts/ReceiptForm/ReceiptForm.tsx b/apps/carbon/app/modules/inventory/ui/Receipts/ReceiptForm/ReceiptForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/inventory/interfaces/Receipts/ReceiptForm/ReceiptForm.tsxrename to apps/carbon/app/modules/inventory/ui/Receipts/ReceiptForm/ReceiptForm.tsxdiff --git a/apps/carbon/app/modules/inventory/interfaces/Receipts/ReceiptForm/index.ts b/apps/carbon/app/modules/inventory/ui/Receipts/ReceiptForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/inventory/interfaces/Receipts/ReceiptForm/index.tsrename to apps/carbon/app/modules/inventory/ui/Receipts/ReceiptForm/index.tsdiff --git a/apps/carbon/app/modules/inventory/interfaces/Receipts/ReceiptForm/useReceiptForm.tsx b/apps/carbon/app/modules/inventory/ui/Receipts/ReceiptForm/useReceiptForm.tsxsimilarity index 99%rename from apps/carbon/app/modules/inventory/interfaces/Receipts/ReceiptForm/useReceiptForm.tsxrename to apps/carbon/app/modules/inventory/ui/Receipts/ReceiptForm/useReceiptForm.tsxindex 77927b8f61..5074939a0f 100644--- a/apps/carbon/app/modules/inventory/interfaces/Receipts/ReceiptForm/useReceiptForm.tsx+++ b/apps/carbon/app/modules/inventory/ui/Receipts/ReceiptForm/useReceiptForm.tsx@@ -350,7 +350,6 @@ export default function useReceiptForm({const receiptLineEditableComponents = useMemo(() => ({receivedQuantity: EditableNumber(handleCellEdit),- unitPrice: EditableNumber(handleCellEdit),}),[handleCellEdit]);diff --git a/apps/carbon/app/modules/inventory/interfaces/Receipts/ReceiptsTable/ReceiptsTable.tsx b/apps/carbon/app/modules/inventory/ui/Receipts/ReceiptsTable/ReceiptsTable.tsxsimilarity index 100%rename from apps/carbon/app/modules/inventory/interfaces/Receipts/ReceiptsTable/ReceiptsTable.tsxrename to apps/carbon/app/modules/inventory/ui/Receipts/ReceiptsTable/ReceiptsTable.tsxdiff --git a/apps/carbon/app/modules/inventory/interfaces/Receipts/ReceiptsTable/index.ts b/apps/carbon/app/modules/inventory/ui/Receipts/ReceiptsTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/inventory/interfaces/Receipts/ReceiptsTable/index.tsrename to apps/carbon/app/modules/inventory/ui/Receipts/ReceiptsTable/index.tsdiff --git a/apps/carbon/app/modules/inventory/interfaces/Receipts/ReceiptsTableFilters/ReceiptsTableFilters.tsx b/apps/carbon/app/modules/inventory/ui/Receipts/ReceiptsTableFilters/ReceiptsTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/inventory/interfaces/Receipts/ReceiptsTableFilters/ReceiptsTableFilters.tsxrename to apps/carbon/app/modules/inventory/ui/Receipts/ReceiptsTableFilters/ReceiptsTableFilters.tsxdiff --git a/apps/carbon/app/modules/inventory/interfaces/Receipts/ReceiptsTableFilters/index.ts b/apps/carbon/app/modules/inventory/ui/Receipts/ReceiptsTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/inventory/interfaces/Receipts/ReceiptsTableFilters/index.tsrename to apps/carbon/app/modules/inventory/ui/Receipts/ReceiptsTableFilters/index.tsdiff --git a/apps/carbon/app/modules/inventory/interfaces/Receipts/index.ts b/apps/carbon/app/modules/inventory/ui/Receipts/index.tssimilarity index 100%rename from apps/carbon/app/modules/inventory/interfaces/Receipts/index.tsrename to apps/carbon/app/modules/inventory/ui/Receipts/index.tsdiff --git a/apps/carbon/app/modules/inventory/interfaces/ShippingMethods/ShippingMethodForm/ShippingMethodForm.tsx b/apps/carbon/app/modules/inventory/ui/ShippingMethods/ShippingMethodForm/ShippingMethodForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/inventory/interfaces/ShippingMethods/ShippingMethodForm/ShippingMethodForm.tsxrename to apps/carbon/app/modules/inventory/ui/ShippingMethods/ShippingMethodForm/ShippingMethodForm.tsxdiff --git a/apps/carbon/app/modules/inventory/interfaces/ShippingMethods/ShippingMethodForm/index.ts b/apps/carbon/app/modules/inventory/ui/ShippingMethods/ShippingMethodForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/inventory/interfaces/ShippingMethods/ShippingMethodForm/index.tsrename to apps/carbon/app/modules/inventory/ui/ShippingMethods/ShippingMethodForm/index.tsdiff --git a/apps/carbon/app/modules/inventory/interfaces/ShippingMethods/ShippingMethodsTable/ShippingMethodsTable.tsx b/apps/carbon/app/modules/inventory/ui/ShippingMethods/ShippingMethodsTable/ShippingMethodsTable.tsxsimilarity index 100%rename from apps/carbon/app/modules/inventory/interfaces/ShippingMethods/ShippingMethodsTable/ShippingMethodsTable.tsxrename to apps/carbon/app/modules/inventory/ui/ShippingMethods/ShippingMethodsTable/ShippingMethodsTable.tsxdiff --git a/apps/carbon/app/modules/inventory/interfaces/ShippingMethods/ShippingMethodsTable/index.ts b/apps/carbon/app/modules/inventory/ui/ShippingMethods/ShippingMethodsTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/inventory/interfaces/ShippingMethods/ShippingMethodsTable/index.tsrename to apps/carbon/app/modules/inventory/ui/ShippingMethods/ShippingMethodsTable/index.tsdiff --git a/apps/carbon/app/modules/inventory/interfaces/ShippingMethods/ShippingMethodsTableFilters/ShippingMethodsTableFilters.tsx b/apps/carbon/app/modules/inventory/ui/ShippingMethods/ShippingMethodsTableFilters/ShippingMethodsTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/inventory/interfaces/ShippingMethods/ShippingMethodsTableFilters/ShippingMethodsTableFilters.tsxrename to apps/carbon/app/modules/inventory/ui/ShippingMethods/ShippingMethodsTableFilters/ShippingMethodsTableFilters.tsxdiff --git a/apps/carbon/app/modules/inventory/interfaces/ShippingMethods/ShippingMethodsTableFilters/index.ts b/apps/carbon/app/modules/inventory/ui/ShippingMethods/ShippingMethodsTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/inventory/interfaces/ShippingMethods/ShippingMethodsTableFilters/index.tsrename to apps/carbon/app/modules/inventory/ui/ShippingMethods/ShippingMethodsTableFilters/index.tsdiff --git a/apps/carbon/app/modules/inventory/interfaces/ShippingMethods/index.ts b/apps/carbon/app/modules/inventory/ui/ShippingMethods/index.tssimilarity index 100%rename from apps/carbon/app/modules/inventory/interfaces/ShippingMethods/index.tsrename to apps/carbon/app/modules/inventory/ui/ShippingMethods/index.tsdiff --git a/apps/carbon/app/modules/inventory/interfaces/index.ts b/apps/carbon/app/modules/inventory/ui/index.tssimilarity index 100%rename from apps/carbon/app/modules/inventory/interfaces/index.tsrename to apps/carbon/app/modules/inventory/ui/index.tsdiff --git a/apps/carbon/app/modules/inventory/interfaces/useInventorySidebar.tsx b/apps/carbon/app/modules/inventory/ui/useInventorySidebar.tsxsimilarity index 100%rename from apps/carbon/app/modules/inventory/interfaces/useInventorySidebar.tsxrename to apps/carbon/app/modules/inventory/ui/useInventorySidebar.tsxdiff --git a/apps/carbon/app/modules/parts/index.ts b/apps/carbon/app/modules/parts/index.tsindex 684aed031a..83b8af135e 100644--- a/apps/carbon/app/modules/parts/index.ts+++ b/apps/carbon/app/modules/parts/index.ts@@ -1,3 +1,3 @@export * from "./services";-export * from "./interfaces";export * from "./types";+export * from "./ui";diff --git a/apps/carbon/app/modules/parts/services/parts.form.ts b/apps/carbon/app/modules/parts/services/parts.form.tsindex 0fd26148d6..ea1b2bb245 100644--- a/apps/carbon/app/modules/parts/services/parts.form.ts+++ b/apps/carbon/app/modules/parts/services/parts.form.ts@@ -45,13 +45,6 @@ export const partGroupValidator = withZod(id: zfd.text(z.string().optional()),name: z.string().min(1, { message: "Name is required" }).max(255),description: z.string().optional(),- salesAccountId: zfd.text(z.string().optional()),- discountAccountId: zfd.text(z.string().optional()),- inventoryAccountId: zfd.text(z.string().optional()),- // costOfGoodsSoldLaborAccountId: zfd.text(z.string().optional()),- // costOfGoodsSoldMaterialAccountId: zfd.text(z.string().optional()),- // costOfGoodsSoldOverheadAccountId: zfd.text(z.string().optional()),- // costOfGoodsSoldSubcontractAccountId: zfd.text(z.string().optional()),}));diff --git a/apps/carbon/app/modules/parts/services/parts.server.ts b/apps/carbon/app/modules/parts/services/parts.server.tsindex 283b002dd3..1a5c26ca75 100644--- a/apps/carbon/app/modules/parts/services/parts.server.ts+++ b/apps/carbon/app/modules/parts/services/parts.server.ts@@ -7,6 +7,7 @@ import { sanitize } from "~/utils/supabase";import type { PartReplenishmentSystem } from "../types";import type {partCostValidator,+ partGroupValidator,partInventoryValidator,partManufacturingValidator,partPlanningValidator,@@ -20,7 +21,7 @@ export async function deletePartGroup(client: SupabaseClient<Database>,id: string) {- return client.from("partGroup").update({ active: false }).eq("id", id);+ return client.from("partGroup").delete().eq("id", id);}export async function deleteUnitOfMeasure(@@ -34,40 +35,23 @@ export async function getPartCost(client: SupabaseClient<Database>,id: string) {- return client- .from("partCost")- .select(- "partId, costingMethod, standardCost, unitCost, salesAccountId, discountAccountId, inventoryAccountId, costIsAdjusted"- )- .eq("partId", id)- .single();+ return client.from("partCost").select("*").eq("partId", id).single();}export async function getPartGroup(client: SupabaseClient<Database>,id: string) {- return client- .from("partGroup")- .select(- "id, name, description, salesAccountId, discountAccountId, inventoryAccountId"- )- .eq("id", id)- .single();+ return client.from("partGroup").select("*").eq("id", id).single();}export async function getPartGroups(client: SupabaseClient<Database>,args?: GenericQueryFilters & { name: string | null }) {- let query = client- .from("partGroup")- .select(- "id, name, description, salesAccountId, discountAccountId, inventoryAccountId",- {- count: "exact",- }- );+ let query = client.from("partGroup").select("*", {+ count: "exact",+ });if (args?.name) {query = query.ilike("name", `%${args.name}%`);@@ -416,23 +400,13 @@ export async function upsertPartPurchasing(export async function upsertPartGroup(client: SupabaseClient<Database>,partGroup:- | {- name: string;- description?: string;- salesAccountId?: string | null;- inventoryAccountId?: string | null;- discountAccountId?: string | null;+ | (Omit<TypeOfValidator<typeof partGroupValidator>, "id"> & {createdBy: string;- }- | {+ })+ | (Omit<TypeOfValidator<typeof partGroupValidator>, "id"> & {id: string;- name: string;- description?: string;- salesAccountId?: string | null;- inventoryAccountId?: string | null;- discountAccountId?: string | null;updatedBy: string;- }+ })) {if ("createdBy" in partGroup) {return client.from("partGroup").insert([partGroup]).select("id").single();diff --git a/apps/carbon/app/modules/parts/interfaces/Part/PartCostingForm/PartCostingForm.tsx b/apps/carbon/app/modules/parts/ui/Part/PartCostingForm/PartCostingForm.tsxsimilarity index 74%rename from apps/carbon/app/modules/parts/interfaces/Part/PartCostingForm/PartCostingForm.tsxrename to apps/carbon/app/modules/parts/ui/Part/PartCostingForm/PartCostingForm.tsxindex f9fd6dd4e6..7f2b34ddfb 100644--- a/apps/carbon/app/modules/parts/interfaces/Part/PartCostingForm/PartCostingForm.tsx+++ b/apps/carbon/app/modules/parts/ui/Part/PartCostingForm/PartCostingForm.tsx@@ -13,27 +13,18 @@ import { usePermissions } from "~/hooks";import type { PartCostingMethod } from "~/modules/parts";import { partCostValidator } from "~/modules/parts";import type { TypeOfValidator } from "~/types/validators";-import { mapRowsToOptions } from "~/utils/form";type PartCostingFormProps = {initialValues: TypeOfValidator<typeof partCostValidator>;- accounts: { number: string; name: string }[];partCostingMethods: PartCostingMethod[];};const PartCostingForm = ({initialValues,- accounts,partCostingMethods,}: PartCostingFormProps) => {const permissions = usePermissions();- const accountOptions = mapRowsToOptions({- data: accounts,- value: "number",- label: "name",- });-const partCostingMethodOptions = partCostingMethods.map((partCostingMethod) => ({label: partCostingMethod,@@ -68,25 +59,6 @@ const PartCostingForm = ({<Number name="standardCost" label="Standard Cost" precision={2} /><Number name="unitCost" label="Unit Cost" precision={2} /></VStack>- {permissions.has("accounting") && (- <VStack alignItems="start" spacing={2} w="full">- <Select- name="salesAccountId"- label="Sales Account"- options={accountOptions}- />- <Select- name="inventoryAccountId"- label="Inventory Account"- options={accountOptions}- />- <Select- name="discountAccountId"- label="Discount Account"- options={accountOptions}- />- </VStack>- )}<VStack alignItems="start" spacing={2} w="full"><Numbername="salesHistory"diff --git a/apps/carbon/app/modules/parts/interfaces/Part/PartCostingForm/index.ts b/apps/carbon/app/modules/parts/ui/Part/PartCostingForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Part/PartCostingForm/index.tsrename to apps/carbon/app/modules/parts/ui/Part/PartCostingForm/index.tsdiff --git a/apps/carbon/app/modules/parts/interfaces/Part/PartForm/PartForm.tsx b/apps/carbon/app/modules/parts/ui/Part/PartForm/PartForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Part/PartForm/PartForm.tsxrename to apps/carbon/app/modules/parts/ui/Part/PartForm/PartForm.tsxdiff --git a/apps/carbon/app/modules/parts/interfaces/Part/PartForm/index.ts b/apps/carbon/app/modules/parts/ui/Part/PartForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Part/PartForm/index.tsrename to apps/carbon/app/modules/parts/ui/Part/PartForm/index.tsdiff --git a/apps/carbon/app/modules/parts/interfaces/Part/PartInventoryForm/PartInventoryForm.tsx b/apps/carbon/app/modules/parts/ui/Part/PartInventoryForm/PartInventoryForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Part/PartInventoryForm/PartInventoryForm.tsxrename to apps/carbon/app/modules/parts/ui/Part/PartInventoryForm/PartInventoryForm.tsxdiff --git a/apps/carbon/app/modules/parts/interfaces/Part/PartInventoryForm/index.ts b/apps/carbon/app/modules/parts/ui/Part/PartInventoryForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Part/PartInventoryForm/index.tsrename to apps/carbon/app/modules/parts/ui/Part/PartInventoryForm/index.tsdiff --git a/apps/carbon/app/modules/parts/interfaces/Part/PartManufacturingForm/PartManufacturingForm.tsx b/apps/carbon/app/modules/parts/ui/Part/PartManufacturingForm/PartManufacturingForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Part/PartManufacturingForm/PartManufacturingForm.tsxrename to apps/carbon/app/modules/parts/ui/Part/PartManufacturingForm/PartManufacturingForm.tsxdiff --git a/apps/carbon/app/modules/parts/interfaces/Part/PartManufacturingForm/index.ts b/apps/carbon/app/modules/parts/ui/Part/PartManufacturingForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Part/PartManufacturingForm/index.tsrename to apps/carbon/app/modules/parts/ui/Part/PartManufacturingForm/index.tsdiff --git a/apps/carbon/app/modules/parts/interfaces/Part/PartPlanningForm/PartPlanningForm.tsx b/apps/carbon/app/modules/parts/ui/Part/PartPlanningForm/PartPlanningForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Part/PartPlanningForm/PartPlanningForm.tsxrename to apps/carbon/app/modules/parts/ui/Part/PartPlanningForm/PartPlanningForm.tsxdiff --git a/apps/carbon/app/modules/parts/interfaces/Part/PartPlanningForm/index.ts b/apps/carbon/app/modules/parts/ui/Part/PartPlanningForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Part/PartPlanningForm/index.tsrename to apps/carbon/app/modules/parts/ui/Part/PartPlanningForm/index.tsdiff --git a/apps/carbon/app/modules/parts/interfaces/Part/PartPreview/PartPreview.tsx b/apps/carbon/app/modules/parts/ui/Part/PartPreview/PartPreview.tsxsimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Part/PartPreview/PartPreview.tsxrename to apps/carbon/app/modules/parts/ui/Part/PartPreview/PartPreview.tsxdiff --git a/apps/carbon/app/modules/parts/interfaces/Part/PartPreview/index.ts b/apps/carbon/app/modules/parts/ui/Part/PartPreview/index.tssimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Part/PartPreview/index.tsrename to apps/carbon/app/modules/parts/ui/Part/PartPreview/index.tsdiff --git a/apps/carbon/app/modules/parts/interfaces/Part/PartPurchasingForm/PartPurchasingForm.tsx b/apps/carbon/app/modules/parts/ui/Part/PartPurchasingForm/PartPurchasingForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Part/PartPurchasingForm/PartPurchasingForm.tsxrename to apps/carbon/app/modules/parts/ui/Part/PartPurchasingForm/PartPurchasingForm.tsxdiff --git a/apps/carbon/app/modules/parts/interfaces/Part/PartPurchasingForm/index.ts b/apps/carbon/app/modules/parts/ui/Part/PartPurchasingForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Part/PartPurchasingForm/index.tsrename to apps/carbon/app/modules/parts/ui/Part/PartPurchasingForm/index.tsdiff --git a/apps/carbon/app/modules/parts/interfaces/Part/PartSalePriceForm/PartSalePriceForm.tsx b/apps/carbon/app/modules/parts/ui/Part/PartSalePriceForm/PartSalePriceForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Part/PartSalePriceForm/PartSalePriceForm.tsxrename to apps/carbon/app/modules/parts/ui/Part/PartSalePriceForm/PartSalePriceForm.tsxdiff --git a/apps/carbon/app/modules/parts/interfaces/Part/PartSalePriceForm/index.ts b/apps/carbon/app/modules/parts/ui/Part/PartSalePriceForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Part/PartSalePriceForm/index.tsrename to apps/carbon/app/modules/parts/ui/Part/PartSalePriceForm/index.tsdiff --git a/apps/carbon/app/modules/parts/interfaces/Part/PartSidebar/PartSidebar.tsx b/apps/carbon/app/modules/parts/ui/Part/PartSidebar/PartSidebar.tsxsimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Part/PartSidebar/PartSidebar.tsxrename to apps/carbon/app/modules/parts/ui/Part/PartSidebar/PartSidebar.tsxdiff --git a/apps/carbon/app/modules/parts/interfaces/Part/PartSidebar/index.ts b/apps/carbon/app/modules/parts/ui/Part/PartSidebar/index.tssimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Part/PartSidebar/index.tsrename to apps/carbon/app/modules/parts/ui/Part/PartSidebar/index.tsdiff --git a/apps/carbon/app/modules/parts/interfaces/Part/PartSidebar/usePartSidebar.tsx b/apps/carbon/app/modules/parts/ui/Part/PartSidebar/usePartSidebar.tsxsimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Part/PartSidebar/usePartSidebar.tsxrename to apps/carbon/app/modules/parts/ui/Part/PartSidebar/usePartSidebar.tsxdiff --git a/apps/carbon/app/modules/parts/interfaces/Part/PartSupplierForm/PartSupplierForm.tsx b/apps/carbon/app/modules/parts/ui/Part/PartSupplierForm/PartSupplierForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Part/PartSupplierForm/PartSupplierForm.tsxrename to apps/carbon/app/modules/parts/ui/Part/PartSupplierForm/PartSupplierForm.tsxdiff --git a/apps/carbon/app/modules/parts/interfaces/Part/PartSupplierForm/index.ts b/apps/carbon/app/modules/parts/ui/Part/PartSupplierForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Part/PartSupplierForm/index.tsrename to apps/carbon/app/modules/parts/ui/Part/PartSupplierForm/index.tsdiff --git a/apps/carbon/app/modules/parts/interfaces/Part/PartSuppliers/PartSuppliers.tsx b/apps/carbon/app/modules/parts/ui/Part/PartSuppliers/PartSuppliers.tsxsimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Part/PartSuppliers/PartSuppliers.tsxrename to apps/carbon/app/modules/parts/ui/Part/PartSuppliers/PartSuppliers.tsxdiff --git a/apps/carbon/app/modules/parts/interfaces/Part/PartSuppliers/index.ts b/apps/carbon/app/modules/parts/ui/Part/PartSuppliers/index.tssimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Part/PartSuppliers/index.tsrename to apps/carbon/app/modules/parts/ui/Part/PartSuppliers/index.tsdiff --git a/apps/carbon/app/modules/parts/interfaces/Part/PartSuppliers/usePartSuppliers.tsx b/apps/carbon/app/modules/parts/ui/Part/PartSuppliers/usePartSuppliers.tsxsimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Part/PartSuppliers/usePartSuppliers.tsxrename to apps/carbon/app/modules/parts/ui/Part/PartSuppliers/usePartSuppliers.tsxdiff --git a/apps/carbon/app/modules/parts/interfaces/Part/index.ts b/apps/carbon/app/modules/parts/ui/Part/index.tssimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Part/index.tsrename to apps/carbon/app/modules/parts/ui/Part/index.tsdiff --git a/apps/carbon/app/modules/parts/interfaces/PartGroups/PartGroupForm/PartGroupForm.tsx b/apps/carbon/app/modules/parts/ui/PartGroups/PartGroupForm/PartGroupForm.tsxsimilarity index 71%rename from apps/carbon/app/modules/parts/interfaces/PartGroups/PartGroupForm/PartGroupForm.tsxrename to apps/carbon/app/modules/parts/ui/PartGroups/PartGroupForm/PartGroupForm.tsxindex ab5d743566..bc56b2f0d5 100644--- a/apps/carbon/app/modules/parts/interfaces/PartGroups/PartGroupForm/PartGroupForm.tsx+++ b/apps/carbon/app/modules/parts/ui/PartGroups/PartGroupForm/PartGroupForm.tsx@@ -12,11 +12,10 @@ import {} from "@chakra-ui/react";import { useNavigate } from "@remix-run/react";import { ValidatedForm } from "remix-validated-form";-import { Hidden, Input, Select, Submit, TextArea } from "~/components/Form";+import { Hidden, Input, Submit, TextArea } from "~/components/Form";import { usePermissions } from "~/hooks";import { partGroupValidator } from "~/modules/parts";import type { TypeOfValidator } from "~/types/validators";-import { mapRowsToOptions } from "~/utils/form";type PartGroupFormProps = {initialValues: TypeOfValidator<typeof partGroupValidator>;@@ -36,12 +35,6 @@ const PartGroupForm = ({ accounts, initialValues }: PartGroupFormProps) => {? !permissions.can("update", "parts"): !permissions.can("create", "parts");- const accountOptions = mapRowsToOptions({- data: accounts,- value: "number",- label: "name",- });-return (<Drawer onClose={onClose} isOpen={true} size="sm"><ValidatedForm@@ -63,25 +56,6 @@ const PartGroupForm = ({ accounts, initialValues }: PartGroupFormProps) => {<VStack spacing={4} alignItems="start"><Input name="name" label="Part Group" /><TextArea name="description" label="Description" />- {permissions.has("accounting") && (- <>- <Select- name="salesAccountId"- label="Sales Account"- options={accountOptions}- />- <Select- name="discountAccountId"- label="Discount Account"- options={accountOptions}- />- <Select- name="inventoryAccountId"- label="Inventory Account"- options={accountOptions}- />- </>- )}</VStack></DrawerBody><DrawerFooter>diff --git a/apps/carbon/app/modules/parts/interfaces/PartGroups/PartGroupForm/index.ts b/apps/carbon/app/modules/parts/ui/PartGroups/PartGroupForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/PartGroups/PartGroupForm/index.tsrename to apps/carbon/app/modules/parts/ui/PartGroups/PartGroupForm/index.tsdiff --git a/apps/carbon/app/modules/parts/interfaces/PartGroups/PartGroupsTable/PartGroupsTable.tsx b/apps/carbon/app/modules/parts/ui/PartGroups/PartGroupsTable/PartGroupsTable.tsxsimilarity index 72%rename from apps/carbon/app/modules/parts/interfaces/PartGroups/PartGroupsTable/PartGroupsTable.tsxrename to apps/carbon/app/modules/parts/ui/PartGroups/PartGroupsTable/PartGroupsTable.tsxindex 13cf1508cd..fe686dbe83 100644--- a/apps/carbon/app/modules/parts/interfaces/PartGroups/PartGroupsTable/PartGroupsTable.tsx+++ b/apps/carbon/app/modules/parts/ui/PartGroups/PartGroupsTable/PartGroupsTable.tsx@@ -17,13 +17,13 @@ const PartGroupsTable = memo(({ data, count }: PartGroupsTableProps) => {const [params] = useUrlParams();const navigate = useNavigate();const permissions = usePermissions();- const hasAccounting =- permissions.has("accounting") && permissions.can("view", "accounting");+ // const hasAccounting =+ // permissions.has("accounting") && permissions.can("view", "accounting");const rows = useMemo(() => data, [data]);- const columns = useMemo<ColumnDef<(typeof rows)[number]>[]>(() => {- const result: ColumnDef<(typeof rows)[number]>[] = [+ const columns = useMemo<ColumnDef<(typeof rows)[number]>[]>(+ () => [{accessorKey: "name",header: "Name",@@ -38,28 +38,9 @@ const PartGroupsTable = memo(({ data, count }: PartGroupsTableProps) => {header: "Description",cell: (item) => item.getValue(),},- ];-- return hasAccounting- ? result.concat([- {- accessorKey: "salesAccountId",- header: "Sales Account",- cell: (item) => item.getValue(),- },- {- accessorKey: "inventoryAccountId",- header: "Inventory Account",- cell: (item) => item.getValue(),- },- {- accessorKey: "discountAccountId",- header: "Discount Account",- cell: (item) => item.getValue(),- },- ])- : result;- }, [hasAccounting, navigate]);+ ],+ [navigate]+ );const renderContextMenu = useCallback((row: (typeof rows)[number]) => {diff --git a/apps/carbon/app/modules/parts/interfaces/PartGroups/PartGroupsTable/index.ts b/apps/carbon/app/modules/parts/ui/PartGroups/PartGroupsTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/PartGroups/PartGroupsTable/index.tsrename to apps/carbon/app/modules/parts/ui/PartGroups/PartGroupsTable/index.tsdiff --git a/apps/carbon/app/modules/parts/interfaces/PartGroups/PartGroupsTableFilters/PartGroupsTableFilters.tsx b/apps/carbon/app/modules/parts/ui/PartGroups/PartGroupsTableFilters/PartGroupsTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/PartGroups/PartGroupsTableFilters/PartGroupsTableFilters.tsxrename to apps/carbon/app/modules/parts/ui/PartGroups/PartGroupsTableFilters/PartGroupsTableFilters.tsxdiff --git a/apps/carbon/app/modules/parts/interfaces/PartGroups/PartGroupsTableFilters/index.ts b/apps/carbon/app/modules/parts/ui/PartGroups/PartGroupsTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/PartGroups/PartGroupsTableFilters/index.tsrename to apps/carbon/app/modules/parts/ui/PartGroups/PartGroupsTableFilters/index.tsdiff --git a/apps/carbon/app/modules/parts/interfaces/PartGroups/index.ts b/apps/carbon/app/modules/parts/ui/PartGroups/index.tssimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/PartGroups/index.tsrename to apps/carbon/app/modules/parts/ui/PartGroups/index.tsdiff --git a/apps/carbon/app/modules/parts/interfaces/Parts/PartsTable/PartsTable.tsx b/apps/carbon/app/modules/parts/ui/Parts/PartsTable/PartsTable.tsxsimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Parts/PartsTable/PartsTable.tsxrename to apps/carbon/app/modules/parts/ui/Parts/PartsTable/PartsTable.tsxdiff --git a/apps/carbon/app/modules/parts/interfaces/Parts/PartsTable/index.ts b/apps/carbon/app/modules/parts/ui/Parts/PartsTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Parts/PartsTable/index.tsrename to apps/carbon/app/modules/parts/ui/Parts/PartsTable/index.tsdiff --git a/apps/carbon/app/modules/parts/interfaces/Parts/PartsTableFilters/PartsTableFilters.tsx b/apps/carbon/app/modules/parts/ui/Parts/PartsTableFilters/PartsTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Parts/PartsTableFilters/PartsTableFilters.tsxrename to apps/carbon/app/modules/parts/ui/Parts/PartsTableFilters/PartsTableFilters.tsxdiff --git a/apps/carbon/app/modules/parts/interfaces/Parts/PartsTableFilters/index.ts b/apps/carbon/app/modules/parts/ui/Parts/PartsTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Parts/PartsTableFilters/index.tsrename to apps/carbon/app/modules/parts/ui/Parts/PartsTableFilters/index.tsdiff --git a/apps/carbon/app/modules/parts/interfaces/Parts/index.ts b/apps/carbon/app/modules/parts/ui/Parts/index.tssimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Parts/index.tsrename to apps/carbon/app/modules/parts/ui/Parts/index.tsdiff --git a/apps/carbon/app/modules/parts/interfaces/Routing/PartsTree/PartsTree.tsx b/apps/carbon/app/modules/parts/ui/Routing/PartsTree/PartsTree.tsxsimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Routing/PartsTree/PartsTree.tsxrename to apps/carbon/app/modules/parts/ui/Routing/PartsTree/PartsTree.tsxdiff --git a/apps/carbon/app/modules/parts/interfaces/Routing/PartsTree/index.ts b/apps/carbon/app/modules/parts/ui/Routing/PartsTree/index.tssimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Routing/PartsTree/index.tsrename to apps/carbon/app/modules/parts/ui/Routing/PartsTree/index.tsdiff --git a/apps/carbon/app/modules/parts/interfaces/Routing/index.ts b/apps/carbon/app/modules/parts/ui/Routing/index.tssimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/Routing/index.tsrename to apps/carbon/app/modules/parts/ui/Routing/index.tsdiff --git a/apps/carbon/app/modules/parts/interfaces/UnitOfMeasure/UnitOfMeasureForm/UnitOfMeasureForm.tsx b/apps/carbon/app/modules/parts/ui/UnitOfMeasure/UnitOfMeasureForm/UnitOfMeasureForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/UnitOfMeasure/UnitOfMeasureForm/UnitOfMeasureForm.tsxrename to apps/carbon/app/modules/parts/ui/UnitOfMeasure/UnitOfMeasureForm/UnitOfMeasureForm.tsxdiff --git a/apps/carbon/app/modules/parts/interfaces/UnitOfMeasure/UnitOfMeasureForm/index.ts b/apps/carbon/app/modules/parts/ui/UnitOfMeasure/UnitOfMeasureForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/UnitOfMeasure/UnitOfMeasureForm/index.tsrename to apps/carbon/app/modules/parts/ui/UnitOfMeasure/UnitOfMeasureForm/index.tsdiff --git a/apps/carbon/app/modules/parts/interfaces/UnitOfMeasure/UnitOfMeasuresTable/UnitOfMeasuresTable.tsx b/apps/carbon/app/modules/parts/ui/UnitOfMeasure/UnitOfMeasuresTable/UnitOfMeasuresTable.tsxsimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/UnitOfMeasure/UnitOfMeasuresTable/UnitOfMeasuresTable.tsxrename to apps/carbon/app/modules/parts/ui/UnitOfMeasure/UnitOfMeasuresTable/UnitOfMeasuresTable.tsxdiff --git a/apps/carbon/app/modules/parts/interfaces/UnitOfMeasure/UnitOfMeasuresTable/index.ts b/apps/carbon/app/modules/parts/ui/UnitOfMeasure/UnitOfMeasuresTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/UnitOfMeasure/UnitOfMeasuresTable/index.tsrename to apps/carbon/app/modules/parts/ui/UnitOfMeasure/UnitOfMeasuresTable/index.tsdiff --git a/apps/carbon/app/modules/parts/interfaces/UnitOfMeasure/UnitOfMeasuresTableFilters/UnitOfMeasuresTableFilters.tsx b/apps/carbon/app/modules/parts/ui/UnitOfMeasure/UnitOfMeasuresTableFilters/UnitOfMeasuresTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/UnitOfMeasure/UnitOfMeasuresTableFilters/UnitOfMeasuresTableFilters.tsxrename to apps/carbon/app/modules/parts/ui/UnitOfMeasure/UnitOfMeasuresTableFilters/UnitOfMeasuresTableFilters.tsxdiff --git a/apps/carbon/app/modules/parts/interfaces/UnitOfMeasure/UnitOfMeasuresTableFilters/index.ts b/apps/carbon/app/modules/parts/ui/UnitOfMeasure/UnitOfMeasuresTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/UnitOfMeasure/UnitOfMeasuresTableFilters/index.tsrename to apps/carbon/app/modules/parts/ui/UnitOfMeasure/UnitOfMeasuresTableFilters/index.tsdiff --git a/apps/carbon/app/modules/parts/interfaces/UnitOfMeasure/index.ts b/apps/carbon/app/modules/parts/ui/UnitOfMeasure/index.tssimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/UnitOfMeasure/index.tsrename to apps/carbon/app/modules/parts/ui/UnitOfMeasure/index.tsdiff --git a/apps/carbon/app/modules/parts/interfaces/index.ts b/apps/carbon/app/modules/parts/ui/index.tssimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/index.tsrename to apps/carbon/app/modules/parts/ui/index.tsdiff --git a/apps/carbon/app/modules/parts/interfaces/usePartsSidebar.tsx b/apps/carbon/app/modules/parts/ui/usePartsSidebar.tsxsimilarity index 100%rename from apps/carbon/app/modules/parts/interfaces/usePartsSidebar.tsxrename to apps/carbon/app/modules/parts/ui/usePartsSidebar.tsxdiff --git a/apps/carbon/app/modules/purchasing/index.ts b/apps/carbon/app/modules/purchasing/index.tsindex 684aed031a..83b8af135e 100644--- a/apps/carbon/app/modules/purchasing/index.ts+++ b/apps/carbon/app/modules/purchasing/index.ts@@ -1,3 +1,3 @@export * from "./services";-export * from "./interfaces";export * from "./types";+export * from "./ui";diff --git a/apps/carbon/app/modules/purchasing/services/purchasing.server.ts b/apps/carbon/app/modules/purchasing/services/purchasing.server.tsindex d95e648f67..8046695da2 100644--- a/apps/carbon/app/modules/purchasing/services/purchasing.server.ts+++ b/apps/carbon/app/modules/purchasing/services/purchasing.server.ts@@ -11,6 +11,7 @@ import type {purchaseOrderLineValidator,purchaseOrderPaymentValidator,purchaseOrderValidator,+ supplierTypeValidator,supplierValidator,} from "./purchasing.form";@@ -314,6 +315,10 @@ export async function getSupplierTypes(return query;}+export async function getSupplierTypesList(client: SupabaseClient<Database>) {+ return client.from("supplierType").select("id, name");+}+export async function insertSupplier(client: SupabaseClient<Database>,supplier:@@ -611,14 +616,26 @@ export async function upsertPurchaseOrderLine(if ("id" in purchaseOrderLine) {return client.from("purchaseOrderLine")- .update(sanitize(purchaseOrderLine))+ .update(+ sanitize({+ ...purchaseOrderLine,+ quantityToReceive: purchaseOrderLine.purchaseQuantity,+ quantityToInvoice: purchaseOrderLine.purchaseQuantity,+ })+ ).eq("id", purchaseOrderLine.id).select("id").single();}return client.from("purchaseOrderLine")- .insert([purchaseOrderLine])+ .insert([+ {+ ...purchaseOrderLine,+ quantityToReceive: purchaseOrderLine.purchaseQuantity,+ quantityToInvoice: purchaseOrderLine.purchaseQuantity,+ },+ ]).select("id").single();}@@ -651,11 +668,21 @@ export async function upsertPurchaseOrderPayment(export async function upsertSupplierType(client: SupabaseClient<Database>,- supplierType: { id?: string; name: string; color: string | null }+ supplierType:+ | (Omit<TypeOfValidator<typeof supplierTypeValidator>, "id"> & {+ createdBy: string;+ })+ | (Omit<TypeOfValidator<typeof supplierTypeValidator>, "id"> & {+ id: string;+ updatedBy: string;+ })) {- return client- .from("supplierType")- .upsert([supplierType])- .select("id")- .single();+ if ("createdBy" in supplierType) {+ return client.from("supplierType").insert([supplierType]);+ } else {+ return client+ .from("supplierType")+ .update(sanitize(supplierType))+ .eq("id", supplierType.id);+ }}diff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderDeliveryForm/PurchaseOrderDeliveryForm.tsx b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderDeliveryForm/PurchaseOrderDeliveryForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderDeliveryForm/PurchaseOrderDeliveryForm.tsxrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderDeliveryForm/PurchaseOrderDeliveryForm.tsxdiff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderDeliveryForm/index.ts b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderDeliveryForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderDeliveryForm/index.tsrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderDeliveryForm/index.tsdiff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderDocumentForm/PurchaseOrderDocumentForm.tsx b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderDocumentForm/PurchaseOrderDocumentForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderDocumentForm/PurchaseOrderDocumentForm.tsxrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderDocumentForm/PurchaseOrderDocumentForm.tsxdiff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderDocumentForm/index.ts b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderDocumentForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderDocumentForm/index.tsrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderDocumentForm/index.tsdiff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderForm/PurchaseOrderForm.tsx b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderForm/PurchaseOrderForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderForm/PurchaseOrderForm.tsxrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderForm/PurchaseOrderForm.tsxdiff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderForm/index.ts b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderForm/index.tsrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderForm/index.tsdiff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderHeader/PurchaseOrderHeader.tsx b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderHeader/PurchaseOrderHeader.tsxsimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderHeader/PurchaseOrderHeader.tsxrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderHeader/PurchaseOrderHeader.tsxdiff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderHeader/index.ts b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderHeader/index.tssimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderHeader/index.tsrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderHeader/index.tsdiff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderInternalDocuments/PurchaseOrderDocuments.tsx b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderInternalDocuments/PurchaseOrderDocuments.tsxsimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderInternalDocuments/PurchaseOrderDocuments.tsxrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderInternalDocuments/PurchaseOrderDocuments.tsxdiff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderInternalDocuments/index.ts b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderInternalDocuments/index.tssimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderInternalDocuments/index.tsrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderInternalDocuments/index.tsdiff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderInternalDocuments/usePurchaseOrderDocuments.ts b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderInternalDocuments/usePurchaseOrderDocuments.tssimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderInternalDocuments/usePurchaseOrderDocuments.tsrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderInternalDocuments/usePurchaseOrderDocuments.tsdiff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderLineForm/PurchaseOrderLineForm.tsx b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm/PurchaseOrderLineForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderLineForm/PurchaseOrderLineForm.tsxrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm/PurchaseOrderLineForm.tsxdiff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderLineForm/index.ts b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderLineForm/index.tsrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm/index.tsdiff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderLines/PurchaseOrderLines.tsx b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLines/PurchaseOrderLines.tsxsimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderLines/PurchaseOrderLines.tsxrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLines/PurchaseOrderLines.tsxdiff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderLines/index.ts b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLines/index.tssimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderLines/index.tsrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLines/index.tsdiff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderLines/usePurchaseOrderLines.tsx b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLines/usePurchaseOrderLines.tsxsimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderLines/usePurchaseOrderLines.tsxrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLines/usePurchaseOrderLines.tsxdiff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderPaymentForm/PurchaseOrderPaymentForm.tsx b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderPaymentForm/PurchaseOrderPaymentForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderPaymentForm/PurchaseOrderPaymentForm.tsxrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderPaymentForm/PurchaseOrderPaymentForm.tsxdiff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderPaymentForm/index.ts b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderPaymentForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderPaymentForm/index.tsrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderPaymentForm/index.tsdiff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderSidebar/PurchaseOrderSidebar.tsx b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderSidebar/PurchaseOrderSidebar.tsxsimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderSidebar/PurchaseOrderSidebar.tsxrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderSidebar/PurchaseOrderSidebar.tsxdiff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderSidebar/index.ts b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderSidebar/index.tssimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderSidebar/index.tsrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderSidebar/index.tsdiff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderSidebar/usePurchaseOrderSidebar.tsx b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderSidebar/usePurchaseOrderSidebar.tsxsimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/PurchaseOrderSidebar/usePurchaseOrderSidebar.tsxrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderSidebar/usePurchaseOrderSidebar.tsxdiff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/index.ts b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/index.tssimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrder/index.tsrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrder/index.tsdiff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrders/PurchaseOrdersTable/PurchaseOrdersTable.tsx b/apps/carbon/app/modules/purchasing/ui/PurchaseOrders/PurchaseOrdersTable/PurchaseOrdersTable.tsxsimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrders/PurchaseOrdersTable/PurchaseOrdersTable.tsxrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrders/PurchaseOrdersTable/PurchaseOrdersTable.tsxdiff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrders/PurchaseOrdersTable/index.ts b/apps/carbon/app/modules/purchasing/ui/PurchaseOrders/PurchaseOrdersTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrders/PurchaseOrdersTable/index.tsrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrders/PurchaseOrdersTable/index.tsdiff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrders/PurchaseOrdersTableFilters/PurchaseOrdersTableFilters.tsx b/apps/carbon/app/modules/purchasing/ui/PurchaseOrders/PurchaseOrdersTableFilters/PurchaseOrdersTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrders/PurchaseOrdersTableFilters/PurchaseOrdersTableFilters.tsxrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrders/PurchaseOrdersTableFilters/PurchaseOrdersTableFilters.tsxdiff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrders/PurchaseOrdersTableFilters/index.ts b/apps/carbon/app/modules/purchasing/ui/PurchaseOrders/PurchaseOrdersTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrders/PurchaseOrdersTableFilters/index.tsrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrders/PurchaseOrdersTableFilters/index.tsdiff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrders/index.ts b/apps/carbon/app/modules/purchasing/ui/PurchaseOrders/index.tssimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrders/index.tsrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrders/index.tsdiff --git a/apps/carbon/app/modules/purchasing/interfaces/PurchaseOrders/usePurchaseOrder.ts b/apps/carbon/app/modules/purchasing/ui/PurchaseOrders/usePurchaseOrder.tssimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/PurchaseOrders/usePurchaseOrder.tsrename to apps/carbon/app/modules/purchasing/ui/PurchaseOrders/usePurchaseOrder.tsdiff --git a/apps/carbon/app/modules/purchasing/interfaces/SupplierTypes/SupplierTypeForm/SupplierTypeForm.tsx b/apps/carbon/app/modules/purchasing/ui/SupplierTypes/SupplierTypeForm/SupplierTypeForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/SupplierTypes/SupplierTypeForm/SupplierTypeForm.tsxrename to apps/carbon/app/modules/purchasing/ui/SupplierTypes/SupplierTypeForm/SupplierTypeForm.tsxdiff --git a/apps/carbon/app/modules/purchasing/interfaces/SupplierTypes/SupplierTypeForm/index.ts b/apps/carbon/app/modules/purchasing/ui/SupplierTypes/SupplierTypeForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/SupplierTypes/SupplierTypeForm/index.tsrename to apps/carbon/app/modules/purchasing/ui/SupplierTypes/SupplierTypeForm/index.tsdiff --git a/apps/carbon/app/modules/purchasing/interfaces/SupplierTypes/SupplierTypesTable/SupplierTypesTable.tsx b/apps/carbon/app/modules/purchasing/ui/SupplierTypes/SupplierTypesTable/SupplierTypesTable.tsxsimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/SupplierTypes/SupplierTypesTable/SupplierTypesTable.tsxrename to apps/carbon/app/modules/purchasing/ui/SupplierTypes/SupplierTypesTable/SupplierTypesTable.tsxdiff --git a/apps/carbon/app/modules/purchasing/interfaces/SupplierTypes/SupplierTypesTable/index.ts b/apps/carbon/app/modules/purchasing/ui/SupplierTypes/SupplierTypesTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/SupplierTypes/SupplierTypesTable/index.tsrename to apps/carbon/app/modules/purchasing/ui/SupplierTypes/SupplierTypesTable/index.tsdiff --git a/apps/carbon/app/modules/purchasing/interfaces/SupplierTypes/SupplierTypesTableFilters/SupplierTypesTableFilters.tsx b/apps/carbon/app/modules/purchasing/ui/SupplierTypes/SupplierTypesTableFilters/SupplierTypesTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/SupplierTypes/SupplierTypesTableFilters/SupplierTypesTableFilters.tsxrename to apps/carbon/app/modules/purchasing/ui/SupplierTypes/SupplierTypesTableFilters/SupplierTypesTableFilters.tsxdiff --git a/apps/carbon/app/modules/purchasing/interfaces/SupplierTypes/SupplierTypesTableFilters/index.ts b/apps/carbon/app/modules/purchasing/ui/SupplierTypes/SupplierTypesTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/SupplierTypes/SupplierTypesTableFilters/index.tsrename to apps/carbon/app/modules/purchasing/ui/SupplierTypes/SupplierTypesTableFilters/index.tsdiff --git a/apps/carbon/app/modules/purchasing/interfaces/SupplierTypes/index.ts b/apps/carbon/app/modules/purchasing/ui/SupplierTypes/index.tssimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/SupplierTypes/index.tsrename to apps/carbon/app/modules/purchasing/ui/SupplierTypes/index.tsdiff --git a/apps/carbon/app/modules/purchasing/interfaces/Suppliers/SupplierForm/SupplierForm.tsx b/apps/carbon/app/modules/purchasing/ui/Suppliers/SupplierForm/SupplierForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/Suppliers/SupplierForm/SupplierForm.tsxrename to apps/carbon/app/modules/purchasing/ui/Suppliers/SupplierForm/SupplierForm.tsxdiff --git a/apps/carbon/app/modules/purchasing/interfaces/Suppliers/SupplierForm/components/SupplierContacts.tsx b/apps/carbon/app/modules/purchasing/ui/Suppliers/SupplierForm/components/SupplierContacts.tsxsimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/Suppliers/SupplierForm/components/SupplierContacts.tsxrename to apps/carbon/app/modules/purchasing/ui/Suppliers/SupplierForm/components/SupplierContacts.tsxdiff --git a/apps/carbon/app/modules/purchasing/interfaces/Suppliers/SupplierForm/components/SupplierContactsForm.tsx b/apps/carbon/app/modules/purchasing/ui/Suppliers/SupplierForm/components/SupplierContactsForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/Suppliers/SupplierForm/components/SupplierContactsForm.tsxrename to apps/carbon/app/modules/purchasing/ui/Suppliers/SupplierForm/components/SupplierContactsForm.tsxdiff --git a/apps/carbon/app/modules/purchasing/interfaces/Suppliers/SupplierForm/components/SupplierLocationForm.tsx b/apps/carbon/app/modules/purchasing/ui/Suppliers/SupplierForm/components/SupplierLocationForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/Suppliers/SupplierForm/components/SupplierLocationForm.tsxrename to apps/carbon/app/modules/purchasing/ui/Suppliers/SupplierForm/components/SupplierLocationForm.tsxdiff --git a/apps/carbon/app/modules/purchasing/interfaces/Suppliers/SupplierForm/components/SupplierLocations.tsx b/apps/carbon/app/modules/purchasing/ui/Suppliers/SupplierForm/components/SupplierLocations.tsxsimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/Suppliers/SupplierForm/components/SupplierLocations.tsxrename to apps/carbon/app/modules/purchasing/ui/Suppliers/SupplierForm/components/SupplierLocations.tsxdiff --git a/apps/carbon/app/modules/purchasing/interfaces/Suppliers/SupplierForm/components/index.ts b/apps/carbon/app/modules/purchasing/ui/Suppliers/SupplierForm/components/index.tssimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/Suppliers/SupplierForm/components/index.tsrename to apps/carbon/app/modules/purchasing/ui/Suppliers/SupplierForm/components/index.tsdiff --git a/apps/carbon/app/modules/purchasing/interfaces/Suppliers/SupplierForm/index.ts b/apps/carbon/app/modules/purchasing/ui/Suppliers/SupplierForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/Suppliers/SupplierForm/index.tsrename to apps/carbon/app/modules/purchasing/ui/Suppliers/SupplierForm/index.tsdiff --git a/apps/carbon/app/modules/purchasing/interfaces/Suppliers/SuppliersTable/SuppliersTable.tsx b/apps/carbon/app/modules/purchasing/ui/Suppliers/SuppliersTable/SuppliersTable.tsxsimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/Suppliers/SuppliersTable/SuppliersTable.tsxrename to apps/carbon/app/modules/purchasing/ui/Suppliers/SuppliersTable/SuppliersTable.tsxdiff --git a/apps/carbon/app/modules/purchasing/interfaces/Suppliers/SuppliersTable/index.ts b/apps/carbon/app/modules/purchasing/ui/Suppliers/SuppliersTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/Suppliers/SuppliersTable/index.tsrename to apps/carbon/app/modules/purchasing/ui/Suppliers/SuppliersTable/index.tsdiff --git a/apps/carbon/app/modules/purchasing/interfaces/Suppliers/SuppliersTableFilters/SuppliersTableFilters.tsx b/apps/carbon/app/modules/purchasing/ui/Suppliers/SuppliersTableFilters/SuppliersTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/Suppliers/SuppliersTableFilters/SuppliersTableFilters.tsxrename to apps/carbon/app/modules/purchasing/ui/Suppliers/SuppliersTableFilters/SuppliersTableFilters.tsxdiff --git a/apps/carbon/app/modules/purchasing/interfaces/Suppliers/SuppliersTableFilters/index.ts b/apps/carbon/app/modules/purchasing/ui/Suppliers/SuppliersTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/Suppliers/SuppliersTableFilters/index.tsrename to apps/carbon/app/modules/purchasing/ui/Suppliers/SuppliersTableFilters/index.tsdiff --git a/apps/carbon/app/modules/purchasing/interfaces/Suppliers/index.ts b/apps/carbon/app/modules/purchasing/ui/Suppliers/index.tssimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/Suppliers/index.tsrename to apps/carbon/app/modules/purchasing/ui/Suppliers/index.tsdiff --git a/apps/carbon/app/modules/purchasing/interfaces/index.ts b/apps/carbon/app/modules/purchasing/ui/index.tssimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/index.tsrename to apps/carbon/app/modules/purchasing/ui/index.tsdiff --git a/apps/carbon/app/modules/purchasing/interfaces/usePurchasingSidebar.tsx b/apps/carbon/app/modules/purchasing/ui/usePurchasingSidebar.tsxsimilarity index 100%rename from apps/carbon/app/modules/purchasing/interfaces/usePurchasingSidebar.tsxrename to apps/carbon/app/modules/purchasing/ui/usePurchasingSidebar.tsxdiff --git a/apps/carbon/app/modules/resources/index.ts b/apps/carbon/app/modules/resources/index.tsindex 684aed031a..83b8af135e 100644--- a/apps/carbon/app/modules/resources/index.ts+++ b/apps/carbon/app/modules/resources/index.ts@@ -1,3 +1,3 @@export * from "./services";-export * from "./interfaces";export * from "./types";+export * from "./ui";diff --git a/apps/carbon/app/modules/resources/interfaces/Abilities/AbilitiesTable/AbilitiesTable.tsx b/apps/carbon/app/modules/resources/ui/Abilities/AbilitiesTable/AbilitiesTable.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Abilities/AbilitiesTable/AbilitiesTable.tsxrename to apps/carbon/app/modules/resources/ui/Abilities/AbilitiesTable/AbilitiesTable.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Abilities/AbilitiesTable/index.ts b/apps/carbon/app/modules/resources/ui/Abilities/AbilitiesTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Abilities/AbilitiesTable/index.tsrename to apps/carbon/app/modules/resources/ui/Abilities/AbilitiesTable/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Abilities/AbilitiesTableFilters/AbilitiesTableFilters.tsx b/apps/carbon/app/modules/resources/ui/Abilities/AbilitiesTableFilters/AbilitiesTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Abilities/AbilitiesTableFilters/AbilitiesTableFilters.tsxrename to apps/carbon/app/modules/resources/ui/Abilities/AbilitiesTableFilters/AbilitiesTableFilters.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Abilities/AbilitiesTableFilters/index.ts b/apps/carbon/app/modules/resources/ui/Abilities/AbilitiesTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Abilities/AbilitiesTableFilters/index.tsrename to apps/carbon/app/modules/resources/ui/Abilities/AbilitiesTableFilters/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Abilities/AbilityChart/AbilityChart.tsx b/apps/carbon/app/modules/resources/ui/Abilities/AbilityChart/AbilityChart.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Abilities/AbilityChart/AbilityChart.tsxrename to apps/carbon/app/modules/resources/ui/Abilities/AbilityChart/AbilityChart.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Abilities/AbilityChart/index.ts b/apps/carbon/app/modules/resources/ui/Abilities/AbilityChart/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Abilities/AbilityChart/index.tsrename to apps/carbon/app/modules/resources/ui/Abilities/AbilityChart/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Abilities/AbilityEmployeesTable/AbilityEmployeesTable.tsx b/apps/carbon/app/modules/resources/ui/Abilities/AbilityEmployeesTable/AbilityEmployeesTable.tsxsimilarity index 96%rename from apps/carbon/app/modules/resources/interfaces/Abilities/AbilityEmployeesTable/AbilityEmployeesTable.tsxrename to apps/carbon/app/modules/resources/ui/Abilities/AbilityEmployeesTable/AbilityEmployeesTable.tsxindex 38629e31cb..5b9429c41e 100644--- a/apps/carbon/app/modules/resources/interfaces/Abilities/AbilityEmployeesTable/AbilityEmployeesTable.tsx+++ b/apps/carbon/app/modules/resources/ui/Abilities/AbilityEmployeesTable/AbilityEmployeesTable.tsx@@ -52,7 +52,7 @@ const AbilityEmployeesTable = ({[employees, weeks]);- const columns = useMemo<ColumnDef<typeof rows[number]>[]>(() => {+ const columns = useMemo<ColumnDef<(typeof rows)[number]>[]>(() => {return [{// accessorKey: "name",@@ -120,7 +120,7 @@ const AbilityEmployeesTable = ({}, []);const renderContextMenu = useCallback(- (row: typeof rows[number]) => {+ (row: (typeof rows)[number]) => {return (<><MenuItem@@ -151,7 +151,7 @@ const AbilityEmployeesTable = ({if (!abilityId) return null;return (- <Table<typeof rows[number]>+ <Table<(typeof rows)[number]>data={rows}count={rows.length}columns={columns}diff --git a/apps/carbon/app/modules/resources/interfaces/Abilities/AbilityEmployeesTable/index.ts b/apps/carbon/app/modules/resources/ui/Abilities/AbilityEmployeesTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Abilities/AbilityEmployeesTable/index.tsrename to apps/carbon/app/modules/resources/ui/Abilities/AbilityEmployeesTable/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Abilities/AbilityForm/AbilityForm.tsx b/apps/carbon/app/modules/resources/ui/Abilities/AbilityForm/AbilityForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Abilities/AbilityForm/AbilityForm.tsxrename to apps/carbon/app/modules/resources/ui/Abilities/AbilityForm/AbilityForm.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Abilities/AbilityForm/index.ts b/apps/carbon/app/modules/resources/ui/Abilities/AbilityForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Abilities/AbilityForm/index.tsrename to apps/carbon/app/modules/resources/ui/Abilities/AbilityForm/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Abilities/EmployeeAbilityForm/EmployeeAbilityForm.tsx b/apps/carbon/app/modules/resources/ui/Abilities/EmployeeAbilityForm/EmployeeAbilityForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Abilities/EmployeeAbilityForm/EmployeeAbilityForm.tsxrename to apps/carbon/app/modules/resources/ui/Abilities/EmployeeAbilityForm/EmployeeAbilityForm.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Abilities/EmployeeAbilityForm/index.ts b/apps/carbon/app/modules/resources/ui/Abilities/EmployeeAbilityForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Abilities/EmployeeAbilityForm/index.tsrename to apps/carbon/app/modules/resources/ui/Abilities/EmployeeAbilityForm/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Abilities/index.ts b/apps/carbon/app/modules/resources/ui/Abilities/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Abilities/index.tsrename to apps/carbon/app/modules/resources/ui/Abilities/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Attributes/AttributeCategoriesTable/AttributesCategoriesTable.tsx b/apps/carbon/app/modules/resources/ui/Attributes/AttributeCategoriesTable/AttributesCategoriesTable.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Attributes/AttributeCategoriesTable/AttributesCategoriesTable.tsxrename to apps/carbon/app/modules/resources/ui/Attributes/AttributeCategoriesTable/AttributesCategoriesTable.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Attributes/AttributeCategoriesTable/index.ts b/apps/carbon/app/modules/resources/ui/Attributes/AttributeCategoriesTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Attributes/AttributeCategoriesTable/index.tsrename to apps/carbon/app/modules/resources/ui/Attributes/AttributeCategoriesTable/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Attributes/AttributeCategoriesTableFilters/AttributeCategoriesTableFilters.tsx b/apps/carbon/app/modules/resources/ui/Attributes/AttributeCategoriesTableFilters/AttributeCategoriesTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Attributes/AttributeCategoriesTableFilters/AttributeCategoriesTableFilters.tsxrename to apps/carbon/app/modules/resources/ui/Attributes/AttributeCategoriesTableFilters/AttributeCategoriesTableFilters.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Attributes/AttributeCategoriesTableFilters/index.ts b/apps/carbon/app/modules/resources/ui/Attributes/AttributeCategoriesTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Attributes/AttributeCategoriesTableFilters/index.tsrename to apps/carbon/app/modules/resources/ui/Attributes/AttributeCategoriesTableFilters/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Attributes/AttributeCategoryDetail/AttributeCategoryDetail.tsx b/apps/carbon/app/modules/resources/ui/Attributes/AttributeCategoryDetail/AttributeCategoryDetail.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Attributes/AttributeCategoryDetail/AttributeCategoryDetail.tsxrename to apps/carbon/app/modules/resources/ui/Attributes/AttributeCategoryDetail/AttributeCategoryDetail.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Attributes/AttributeCategoryDetail/index.ts b/apps/carbon/app/modules/resources/ui/Attributes/AttributeCategoryDetail/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Attributes/AttributeCategoryDetail/index.tsrename to apps/carbon/app/modules/resources/ui/Attributes/AttributeCategoryDetail/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Attributes/AttributeCategoryForm/AttributeCategoryForm.tsx b/apps/carbon/app/modules/resources/ui/Attributes/AttributeCategoryForm/AttributeCategoryForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Attributes/AttributeCategoryForm/AttributeCategoryForm.tsxrename to apps/carbon/app/modules/resources/ui/Attributes/AttributeCategoryForm/AttributeCategoryForm.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Attributes/AttributeCategoryForm/index.ts b/apps/carbon/app/modules/resources/ui/Attributes/AttributeCategoryForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Attributes/AttributeCategoryForm/index.tsrename to apps/carbon/app/modules/resources/ui/Attributes/AttributeCategoryForm/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Attributes/AttributeForm/AttributeForm.tsx b/apps/carbon/app/modules/resources/ui/Attributes/AttributeForm/AttributeForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Attributes/AttributeForm/AttributeForm.tsxrename to apps/carbon/app/modules/resources/ui/Attributes/AttributeForm/AttributeForm.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Attributes/AttributeForm/index.ts b/apps/carbon/app/modules/resources/ui/Attributes/AttributeForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Attributes/AttributeForm/index.tsrename to apps/carbon/app/modules/resources/ui/Attributes/AttributeForm/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Attributes/index.ts b/apps/carbon/app/modules/resources/ui/Attributes/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Attributes/index.tsrename to apps/carbon/app/modules/resources/ui/Attributes/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Contractors/ContractorForm/ContractorForm.tsx b/apps/carbon/app/modules/resources/ui/Contractors/ContractorForm/ContractorForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Contractors/ContractorForm/ContractorForm.tsxrename to apps/carbon/app/modules/resources/ui/Contractors/ContractorForm/ContractorForm.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Contractors/ContractorForm/index.ts b/apps/carbon/app/modules/resources/ui/Contractors/ContractorForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Contractors/ContractorForm/index.tsrename to apps/carbon/app/modules/resources/ui/Contractors/ContractorForm/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Contractors/ContractorsTable/ContractorsTable.tsx b/apps/carbon/app/modules/resources/ui/Contractors/ContractorsTable/ContractorsTable.tsxsimilarity index 94%rename from apps/carbon/app/modules/resources/interfaces/Contractors/ContractorsTable/ContractorsTable.tsxrename to apps/carbon/app/modules/resources/ui/Contractors/ContractorsTable/ContractorsTable.tsxindex 3b5420ead1..2295e72133 100644--- a/apps/carbon/app/modules/resources/interfaces/Contractors/ContractorsTable/ContractorsTable.tsx+++ b/apps/carbon/app/modules/resources/ui/Contractors/ContractorsTable/ContractorsTable.tsx@@ -22,7 +22,7 @@ const ContractorsTable = memo(({ data, count }: ContractorsTableProps) => {...row,}));- const columns = useMemo<ColumnDef<typeof rows[number]>[]>(() => {+ const columns = useMemo<ColumnDef<(typeof rows)[number]>[]>(() => {return [{accessorKey: "supplier",@@ -56,7 +56,7 @@ const ContractorsTable = memo(({ data, count }: ContractorsTableProps) => {}, [navigate]);const renderContextMenu = useCallback(- (row: typeof rows[number]) => {+ (row: (typeof rows)[number]) => {return (<><MenuItem@@ -91,7 +91,7 @@ const ContractorsTable = memo(({ data, count }: ContractorsTableProps) => {);return (- <Table<typeof rows[number]>+ <Table<(typeof rows)[number]>data={rows}count={count}columns={columns}diff --git a/apps/carbon/app/modules/resources/interfaces/Contractors/ContractorsTable/index.ts b/apps/carbon/app/modules/resources/ui/Contractors/ContractorsTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Contractors/ContractorsTable/index.tsrename to apps/carbon/app/modules/resources/ui/Contractors/ContractorsTable/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Contractors/ContractorsTableFilters/ContractorsTableFilters.tsx b/apps/carbon/app/modules/resources/ui/Contractors/ContractorsTableFilters/ContractorsTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Contractors/ContractorsTableFilters/ContractorsTableFilters.tsxrename to apps/carbon/app/modules/resources/ui/Contractors/ContractorsTableFilters/ContractorsTableFilters.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Contractors/ContractorsTableFilters/index.ts b/apps/carbon/app/modules/resources/ui/Contractors/ContractorsTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Contractors/ContractorsTableFilters/index.tsrename to apps/carbon/app/modules/resources/ui/Contractors/ContractorsTableFilters/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Contractors/index.ts b/apps/carbon/app/modules/resources/ui/Contractors/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Contractors/index.tsrename to apps/carbon/app/modules/resources/ui/Contractors/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Departments/DepartmentForm/DepartmentForm.tsx b/apps/carbon/app/modules/resources/ui/Departments/DepartmentForm/DepartmentForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Departments/DepartmentForm/DepartmentForm.tsxrename to apps/carbon/app/modules/resources/ui/Departments/DepartmentForm/DepartmentForm.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Departments/DepartmentForm/index.ts b/apps/carbon/app/modules/resources/ui/Departments/DepartmentForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Departments/DepartmentForm/index.tsrename to apps/carbon/app/modules/resources/ui/Departments/DepartmentForm/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Departments/DepartmentsTable/DepartmentsTable.tsx b/apps/carbon/app/modules/resources/ui/Departments/DepartmentsTable/DepartmentsTable.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Departments/DepartmentsTable/DepartmentsTable.tsxrename to apps/carbon/app/modules/resources/ui/Departments/DepartmentsTable/DepartmentsTable.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Departments/DepartmentsTable/index.ts b/apps/carbon/app/modules/resources/ui/Departments/DepartmentsTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Departments/DepartmentsTable/index.tsrename to apps/carbon/app/modules/resources/ui/Departments/DepartmentsTable/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Departments/DepartmentsTableFilters/DepartmentsTableFilters.tsx b/apps/carbon/app/modules/resources/ui/Departments/DepartmentsTableFilters/DepartmentsTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Departments/DepartmentsTableFilters/DepartmentsTableFilters.tsxrename to apps/carbon/app/modules/resources/ui/Departments/DepartmentsTableFilters/DepartmentsTableFilters.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Departments/DepartmentsTableFilters/index.ts b/apps/carbon/app/modules/resources/ui/Departments/DepartmentsTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Departments/DepartmentsTableFilters/index.tsrename to apps/carbon/app/modules/resources/ui/Departments/DepartmentsTableFilters/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Departments/index.ts b/apps/carbon/app/modules/resources/ui/Departments/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Departments/index.tsrename to apps/carbon/app/modules/resources/ui/Departments/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Equipment/EquipmentForm/EquipmentForm.tsx b/apps/carbon/app/modules/resources/ui/Equipment/EquipmentForm/EquipmentForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Equipment/EquipmentForm/EquipmentForm.tsxrename to apps/carbon/app/modules/resources/ui/Equipment/EquipmentForm/EquipmentForm.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Equipment/EquipmentForm/index.ts b/apps/carbon/app/modules/resources/ui/Equipment/EquipmentForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Equipment/EquipmentForm/index.tsrename to apps/carbon/app/modules/resources/ui/Equipment/EquipmentForm/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Equipment/EquipmentTypeDetail/EquipmentTypeDetail.tsx b/apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypeDetail/EquipmentTypeDetail.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Equipment/EquipmentTypeDetail/EquipmentTypeDetail.tsxrename to apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypeDetail/EquipmentTypeDetail.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Equipment/EquipmentTypeDetail/index.ts b/apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypeDetail/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Equipment/EquipmentTypeDetail/index.tsrename to apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypeDetail/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Equipment/EquipmentTypeForm/EquipmentTypeForm.tsx b/apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypeForm/EquipmentTypeForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Equipment/EquipmentTypeForm/EquipmentTypeForm.tsxrename to apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypeForm/EquipmentTypeForm.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Equipment/EquipmentTypeForm/index.ts b/apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypeForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Equipment/EquipmentTypeForm/index.tsrename to apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypeForm/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Equipment/EquipmentTypesTable/EquipmentTypesTable.tsx b/apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypesTable/EquipmentTypesTable.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Equipment/EquipmentTypesTable/EquipmentTypesTable.tsxrename to apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypesTable/EquipmentTypesTable.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Equipment/EquipmentTypesTable/index.ts b/apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypesTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Equipment/EquipmentTypesTable/index.tsrename to apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypesTable/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Equipment/EquipmentTypesTableFilters/EquipmentTypesTableFilters.tsx b/apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypesTableFilters/EquipmentTypesTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Equipment/EquipmentTypesTableFilters/EquipmentTypesTableFilters.tsxrename to apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypesTableFilters/EquipmentTypesTableFilters.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Equipment/EquipmentTypesTableFilters/index.ts b/apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypesTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Equipment/EquipmentTypesTableFilters/index.tsrename to apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypesTableFilters/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Equipment/index.ts b/apps/carbon/app/modules/resources/ui/Equipment/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Equipment/index.tsrename to apps/carbon/app/modules/resources/ui/Equipment/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Holidays/HolidayForm/HolidayForm.tsx b/apps/carbon/app/modules/resources/ui/Holidays/HolidayForm/HolidayForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Holidays/HolidayForm/HolidayForm.tsxrename to apps/carbon/app/modules/resources/ui/Holidays/HolidayForm/HolidayForm.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Holidays/HolidayForm/index.ts b/apps/carbon/app/modules/resources/ui/Holidays/HolidayForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Holidays/HolidayForm/index.tsrename to apps/carbon/app/modules/resources/ui/Holidays/HolidayForm/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Holidays/HolidaysTable/HolidaysTable.tsx b/apps/carbon/app/modules/resources/ui/Holidays/HolidaysTable/HolidaysTable.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Holidays/HolidaysTable/HolidaysTable.tsxrename to apps/carbon/app/modules/resources/ui/Holidays/HolidaysTable/HolidaysTable.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Holidays/HolidaysTable/index.ts b/apps/carbon/app/modules/resources/ui/Holidays/HolidaysTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Holidays/HolidaysTable/index.tsrename to apps/carbon/app/modules/resources/ui/Holidays/HolidaysTable/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Holidays/HolidaysTableFilters/HolidaysTableFilters.tsx b/apps/carbon/app/modules/resources/ui/Holidays/HolidaysTableFilters/HolidaysTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Holidays/HolidaysTableFilters/HolidaysTableFilters.tsxrename to apps/carbon/app/modules/resources/ui/Holidays/HolidaysTableFilters/HolidaysTableFilters.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Holidays/HolidaysTableFilters/index.ts b/apps/carbon/app/modules/resources/ui/Holidays/HolidaysTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Holidays/HolidaysTableFilters/index.tsrename to apps/carbon/app/modules/resources/ui/Holidays/HolidaysTableFilters/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Holidays/index.ts b/apps/carbon/app/modules/resources/ui/Holidays/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Holidays/index.tsrename to apps/carbon/app/modules/resources/ui/Holidays/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Locations/LocationForm/LocationForm.tsx b/apps/carbon/app/modules/resources/ui/Locations/LocationForm/LocationForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Locations/LocationForm/LocationForm.tsxrename to apps/carbon/app/modules/resources/ui/Locations/LocationForm/LocationForm.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Locations/LocationForm/index.ts b/apps/carbon/app/modules/resources/ui/Locations/LocationForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Locations/LocationForm/index.tsrename to apps/carbon/app/modules/resources/ui/Locations/LocationForm/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Locations/LocationsTable/LocationsTable.tsx b/apps/carbon/app/modules/resources/ui/Locations/LocationsTable/LocationsTable.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Locations/LocationsTable/LocationsTable.tsxrename to apps/carbon/app/modules/resources/ui/Locations/LocationsTable/LocationsTable.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Locations/LocationsTable/index.ts b/apps/carbon/app/modules/resources/ui/Locations/LocationsTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Locations/LocationsTable/index.tsrename to apps/carbon/app/modules/resources/ui/Locations/LocationsTable/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Locations/LocationsTableFilters/LocationsTableFilters.tsx b/apps/carbon/app/modules/resources/ui/Locations/LocationsTableFilters/LocationsTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Locations/LocationsTableFilters/LocationsTableFilters.tsxrename to apps/carbon/app/modules/resources/ui/Locations/LocationsTableFilters/LocationsTableFilters.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Locations/LocationsTableFilters/index.ts b/apps/carbon/app/modules/resources/ui/Locations/LocationsTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Locations/LocationsTableFilters/index.tsrename to apps/carbon/app/modules/resources/ui/Locations/LocationsTableFilters/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Locations/index.ts b/apps/carbon/app/modules/resources/ui/Locations/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Locations/index.tsrename to apps/carbon/app/modules/resources/ui/Locations/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Partners/PartnerForm/PartnerForm.tsx b/apps/carbon/app/modules/resources/ui/Partners/PartnerForm/PartnerForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Partners/PartnerForm/PartnerForm.tsxrename to apps/carbon/app/modules/resources/ui/Partners/PartnerForm/PartnerForm.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Partners/PartnerForm/index.ts b/apps/carbon/app/modules/resources/ui/Partners/PartnerForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Partners/PartnerForm/index.tsrename to apps/carbon/app/modules/resources/ui/Partners/PartnerForm/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Partners/PartnersTable/PartnersTable.tsx b/apps/carbon/app/modules/resources/ui/Partners/PartnersTable/PartnersTable.tsxsimilarity index 94%rename from apps/carbon/app/modules/resources/interfaces/Partners/PartnersTable/PartnersTable.tsxrename to apps/carbon/app/modules/resources/ui/Partners/PartnersTable/PartnersTable.tsxindex f4e57715f8..7fecb2667e 100644--- a/apps/carbon/app/modules/resources/interfaces/Partners/PartnersTable/PartnersTable.tsx+++ b/apps/carbon/app/modules/resources/ui/Partners/PartnersTable/PartnersTable.tsx@@ -22,7 +22,7 @@ const PartnersTable = memo(({ data, count }: PartnersTableProps) => {...row,}));- const columns = useMemo<ColumnDef<typeof rows[number]>[]>(() => {+ const columns = useMemo<ColumnDef<(typeof rows)[number]>[]>(() => {return [{accessorKey: "supplier",@@ -58,7 +58,7 @@ const PartnersTable = memo(({ data, count }: PartnersTableProps) => {}, [navigate]);const renderContextMenu = useCallback(- (row: typeof rows[number]) => {+ (row: (typeof rows)[number]) => {return (<><MenuItem@@ -93,7 +93,7 @@ const PartnersTable = memo(({ data, count }: PartnersTableProps) => {);return (- <Table<typeof rows[number]>+ <Table<(typeof rows)[number]>data={rows}count={count}columns={columns}diff --git a/apps/carbon/app/modules/resources/interfaces/Partners/PartnersTable/index.ts b/apps/carbon/app/modules/resources/ui/Partners/PartnersTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Partners/PartnersTable/index.tsrename to apps/carbon/app/modules/resources/ui/Partners/PartnersTable/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Partners/PartnersTableFilters/PartnersTableFilters.tsx b/apps/carbon/app/modules/resources/ui/Partners/PartnersTableFilters/PartnersTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Partners/PartnersTableFilters/PartnersTableFilters.tsxrename to apps/carbon/app/modules/resources/ui/Partners/PartnersTableFilters/PartnersTableFilters.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Partners/PartnersTableFilters/index.ts b/apps/carbon/app/modules/resources/ui/Partners/PartnersTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Partners/PartnersTableFilters/index.tsrename to apps/carbon/app/modules/resources/ui/Partners/PartnersTableFilters/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Partners/index.ts b/apps/carbon/app/modules/resources/ui/Partners/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Partners/index.tsrename to apps/carbon/app/modules/resources/ui/Partners/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/People/PeopleTable/PeopleTable.tsx b/apps/carbon/app/modules/resources/ui/People/PeopleTable/PeopleTable.tsxsimilarity index 95%rename from apps/carbon/app/modules/resources/interfaces/People/PeopleTable/PeopleTable.tsxrename to apps/carbon/app/modules/resources/ui/People/PeopleTable/PeopleTable.tsxindex 21a6ffbac3..83e7c842e1 100644--- a/apps/carbon/app/modules/resources/interfaces/People/PeopleTable/PeopleTable.tsx+++ b/apps/carbon/app/modules/resources/ui/People/PeopleTable/PeopleTable.tsx@@ -91,8 +91,8 @@ const PeopleTable = memo([data]);- const columns = useMemo<ColumnDef<typeof rows[number]>[]>(() => {- const defaultColumns: ColumnDef<typeof rows[number]>[] = [+ const columns = useMemo<ColumnDef<(typeof rows)[number]>[]>(() => {+ const defaultColumns: ColumnDef<(typeof rows)[number]>[] = [{header: "User",cell: ({ row }) => (@@ -144,7 +144,7 @@ const PeopleTable = memo(},];- const additionalColumns: ColumnDef<typeof rows[number]>[] = [];+ const additionalColumns: ColumnDef<(typeof rows)[number]>[] = [];attributeCategories.forEach((category) => {if (category.userAttribute && Array.isArray(category.userAttribute)) {@@ -182,7 +182,7 @@ const PeopleTable = memo(const renderContextMenu = useMemo(() => {return permissions.can("update", "resources")- ? (row: typeof rows[number]) => {+ ? (row: (typeof rows)[number]) => {return (<MenuItemicon={<BsPencilSquare />}@@ -202,7 +202,7 @@ const PeopleTable = memo(return (<>- <Table<typeof rows[number]>+ <Table<(typeof rows)[number]>// actions={actions}count={count}columns={columns}diff --git a/apps/carbon/app/modules/resources/interfaces/People/PeopleTable/index.ts b/apps/carbon/app/modules/resources/ui/People/PeopleTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/People/PeopleTable/index.tsrename to apps/carbon/app/modules/resources/ui/People/PeopleTable/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/People/PeopleTableFilters/PeopleTableFilters.tsx b/apps/carbon/app/modules/resources/ui/People/PeopleTableFilters/PeopleTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/People/PeopleTableFilters/PeopleTableFilters.tsxrename to apps/carbon/app/modules/resources/ui/People/PeopleTableFilters/PeopleTableFilters.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/People/PeopleTableFilters/index.ts b/apps/carbon/app/modules/resources/ui/People/PeopleTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/People/PeopleTableFilters/index.tsrename to apps/carbon/app/modules/resources/ui/People/PeopleTableFilters/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/People/index.ts b/apps/carbon/app/modules/resources/ui/People/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/People/index.tsrename to apps/carbon/app/modules/resources/ui/People/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Person/PersonAbilities/PersonAbilities.tsx b/apps/carbon/app/modules/resources/ui/Person/PersonAbilities/PersonAbilities.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Person/PersonAbilities/PersonAbilities.tsxrename to apps/carbon/app/modules/resources/ui/Person/PersonAbilities/PersonAbilities.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Person/PersonAbilities/index.ts b/apps/carbon/app/modules/resources/ui/Person/PersonAbilities/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Person/PersonAbilities/index.tsrename to apps/carbon/app/modules/resources/ui/Person/PersonAbilities/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Person/PersonDaysOff/PersonDaysOff.tsx b/apps/carbon/app/modules/resources/ui/Person/PersonDaysOff/PersonDaysOff.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Person/PersonDaysOff/PersonDaysOff.tsxrename to apps/carbon/app/modules/resources/ui/Person/PersonDaysOff/PersonDaysOff.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Person/PersonDaysOff/index.ts b/apps/carbon/app/modules/resources/ui/Person/PersonDaysOff/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Person/PersonDaysOff/index.tsrename to apps/carbon/app/modules/resources/ui/Person/PersonDaysOff/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Person/PersonHeader/PersonHeader.tsx b/apps/carbon/app/modules/resources/ui/Person/PersonHeader/PersonHeader.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Person/PersonHeader/PersonHeader.tsxrename to apps/carbon/app/modules/resources/ui/Person/PersonHeader/PersonHeader.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Person/PersonHeader/index.ts b/apps/carbon/app/modules/resources/ui/Person/PersonHeader/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Person/PersonHeader/index.tsrename to apps/carbon/app/modules/resources/ui/Person/PersonHeader/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Person/PersonJob/PersonJob.tsx b/apps/carbon/app/modules/resources/ui/Person/PersonJob/PersonJob.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Person/PersonJob/PersonJob.tsxrename to apps/carbon/app/modules/resources/ui/Person/PersonJob/PersonJob.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Person/PersonJob/index.ts b/apps/carbon/app/modules/resources/ui/Person/PersonJob/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Person/PersonJob/index.tsrename to apps/carbon/app/modules/resources/ui/Person/PersonJob/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Person/PersonNotes/PersonNotes.tsx b/apps/carbon/app/modules/resources/ui/Person/PersonNotes/PersonNotes.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Person/PersonNotes/PersonNotes.tsxrename to apps/carbon/app/modules/resources/ui/Person/PersonNotes/PersonNotes.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Person/PersonNotes/index.ts b/apps/carbon/app/modules/resources/ui/Person/PersonNotes/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Person/PersonNotes/index.tsrename to apps/carbon/app/modules/resources/ui/Person/PersonNotes/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Person/PersonOvertime/PersonOvertime.tsx b/apps/carbon/app/modules/resources/ui/Person/PersonOvertime/PersonOvertime.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Person/PersonOvertime/PersonOvertime.tsxrename to apps/carbon/app/modules/resources/ui/Person/PersonOvertime/PersonOvertime.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Person/PersonOvertime/index.ts b/apps/carbon/app/modules/resources/ui/Person/PersonOvertime/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Person/PersonOvertime/index.tsrename to apps/carbon/app/modules/resources/ui/Person/PersonOvertime/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Person/PersonTabs/PersonTabs.tsx b/apps/carbon/app/modules/resources/ui/Person/PersonTabs/PersonTabs.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Person/PersonTabs/PersonTabs.tsxrename to apps/carbon/app/modules/resources/ui/Person/PersonTabs/PersonTabs.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Person/PersonTabs/index.ts b/apps/carbon/app/modules/resources/ui/Person/PersonTabs/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Person/PersonTabs/index.tsrename to apps/carbon/app/modules/resources/ui/Person/PersonTabs/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Person/index.ts b/apps/carbon/app/modules/resources/ui/Person/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Person/index.tsrename to apps/carbon/app/modules/resources/ui/Person/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Shifts/ShiftForm/ShiftForm.tsx b/apps/carbon/app/modules/resources/ui/Shifts/ShiftForm/ShiftForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Shifts/ShiftForm/ShiftForm.tsxrename to apps/carbon/app/modules/resources/ui/Shifts/ShiftForm/ShiftForm.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Shifts/ShiftForm/index.ts b/apps/carbon/app/modules/resources/ui/Shifts/ShiftForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Shifts/ShiftForm/index.tsrename to apps/carbon/app/modules/resources/ui/Shifts/ShiftForm/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Shifts/ShiftsTable/ShiftsTable.tsx b/apps/carbon/app/modules/resources/ui/Shifts/ShiftsTable/ShiftsTable.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Shifts/ShiftsTable/ShiftsTable.tsxrename to apps/carbon/app/modules/resources/ui/Shifts/ShiftsTable/ShiftsTable.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Shifts/ShiftsTable/index.ts b/apps/carbon/app/modules/resources/ui/Shifts/ShiftsTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Shifts/ShiftsTable/index.tsrename to apps/carbon/app/modules/resources/ui/Shifts/ShiftsTable/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Shifts/ShiftsTableFilters/ShiftsTableFilters.tsx b/apps/carbon/app/modules/resources/ui/Shifts/ShiftsTableFilters/ShiftsTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Shifts/ShiftsTableFilters/ShiftsTableFilters.tsxrename to apps/carbon/app/modules/resources/ui/Shifts/ShiftsTableFilters/ShiftsTableFilters.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/Shifts/ShiftsTableFilters/index.ts b/apps/carbon/app/modules/resources/ui/Shifts/ShiftsTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Shifts/ShiftsTableFilters/index.tsrename to apps/carbon/app/modules/resources/ui/Shifts/ShiftsTableFilters/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/Shifts/index.ts b/apps/carbon/app/modules/resources/ui/Shifts/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/Shifts/index.tsrename to apps/carbon/app/modules/resources/ui/Shifts/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/WorkCells/WorkCellForm/WorkCellForm.tsx b/apps/carbon/app/modules/resources/ui/WorkCells/WorkCellForm/WorkCellForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/WorkCells/WorkCellForm/WorkCellForm.tsxrename to apps/carbon/app/modules/resources/ui/WorkCells/WorkCellForm/WorkCellForm.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/WorkCells/WorkCellForm/index.ts b/apps/carbon/app/modules/resources/ui/WorkCells/WorkCellForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/WorkCells/WorkCellForm/index.tsrename to apps/carbon/app/modules/resources/ui/WorkCells/WorkCellForm/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/WorkCells/WorkCellTypeDetail/WorkCellTypeDetail.tsx b/apps/carbon/app/modules/resources/ui/WorkCells/WorkCellTypeDetail/WorkCellTypeDetail.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/WorkCells/WorkCellTypeDetail/WorkCellTypeDetail.tsxrename to apps/carbon/app/modules/resources/ui/WorkCells/WorkCellTypeDetail/WorkCellTypeDetail.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/WorkCells/WorkCellTypeDetail/index.ts b/apps/carbon/app/modules/resources/ui/WorkCells/WorkCellTypeDetail/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/WorkCells/WorkCellTypeDetail/index.tsrename to apps/carbon/app/modules/resources/ui/WorkCells/WorkCellTypeDetail/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/WorkCells/WorkCellTypeForm/WorkCellTypeForm.tsx b/apps/carbon/app/modules/resources/ui/WorkCells/WorkCellTypeForm/WorkCellTypeForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/WorkCells/WorkCellTypeForm/WorkCellTypeForm.tsxrename to apps/carbon/app/modules/resources/ui/WorkCells/WorkCellTypeForm/WorkCellTypeForm.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/WorkCells/WorkCellTypeForm/index.ts b/apps/carbon/app/modules/resources/ui/WorkCells/WorkCellTypeForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/WorkCells/WorkCellTypeForm/index.tsrename to apps/carbon/app/modules/resources/ui/WorkCells/WorkCellTypeForm/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/WorkCells/WorkCellTypesTable/WorkCellTypesTable.tsx b/apps/carbon/app/modules/resources/ui/WorkCells/WorkCellTypesTable/WorkCellTypesTable.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/WorkCells/WorkCellTypesTable/WorkCellTypesTable.tsxrename to apps/carbon/app/modules/resources/ui/WorkCells/WorkCellTypesTable/WorkCellTypesTable.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/WorkCells/WorkCellTypesTable/index.ts b/apps/carbon/app/modules/resources/ui/WorkCells/WorkCellTypesTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/WorkCells/WorkCellTypesTable/index.tsrename to apps/carbon/app/modules/resources/ui/WorkCells/WorkCellTypesTable/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/WorkCells/WorkCellTypesTableFilters/WorkCellTypesTableFilters.tsx b/apps/carbon/app/modules/resources/ui/WorkCells/WorkCellTypesTableFilters/WorkCellTypesTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/WorkCells/WorkCellTypesTableFilters/WorkCellTypesTableFilters.tsxrename to apps/carbon/app/modules/resources/ui/WorkCells/WorkCellTypesTableFilters/WorkCellTypesTableFilters.tsxdiff --git a/apps/carbon/app/modules/resources/interfaces/WorkCells/WorkCellTypesTableFilters/index.ts b/apps/carbon/app/modules/resources/ui/WorkCells/WorkCellTypesTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/WorkCells/WorkCellTypesTableFilters/index.tsrename to apps/carbon/app/modules/resources/ui/WorkCells/WorkCellTypesTableFilters/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/WorkCells/index.ts b/apps/carbon/app/modules/resources/ui/WorkCells/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/WorkCells/index.tsrename to apps/carbon/app/modules/resources/ui/WorkCells/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/index.ts b/apps/carbon/app/modules/resources/ui/index.tssimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/index.tsrename to apps/carbon/app/modules/resources/ui/index.tsdiff --git a/apps/carbon/app/modules/resources/interfaces/useResourcesSidebar.tsx b/apps/carbon/app/modules/resources/ui/useResourcesSidebar.tsxsimilarity index 100%rename from apps/carbon/app/modules/resources/interfaces/useResourcesSidebar.tsxrename to apps/carbon/app/modules/resources/ui/useResourcesSidebar.tsxdiff --git a/apps/carbon/app/modules/sales/index.ts b/apps/carbon/app/modules/sales/index.tsindex 684aed031a..83b8af135e 100644--- a/apps/carbon/app/modules/sales/index.ts+++ b/apps/carbon/app/modules/sales/index.ts@@ -1,3 +1,3 @@export * from "./services";-export * from "./interfaces";export * from "./types";+export * from "./ui";diff --git a/apps/carbon/app/modules/sales/services/sales.server.ts b/apps/carbon/app/modules/sales/services/sales.server.tsindex f34201930c..8a4a04fb42 100644--- a/apps/carbon/app/modules/sales/services/sales.server.ts+++ b/apps/carbon/app/modules/sales/services/sales.server.ts@@ -5,7 +5,7 @@ import type { TypeOfValidator } from "~/types/validators";import type { GenericQueryFilters } from "~/utils/query";import { setGenericQueryFilters } from "~/utils/query";import { sanitize } from "~/utils/supabase";-import type { customerValidator } from "./sales.form";+import type { customerTypeValidator, customerValidator } from "./sales.form";export async function deleteCustomerContact(client: SupabaseClient<Database>,@@ -171,6 +171,10 @@ export async function getCustomerTypes(return query;}+export async function getCustomerTypesList(client: SupabaseClient<Database>) {+ return client.from("customerType").select("id, name");+}+export async function insertCustomer(client: SupabaseClient<Database>,customer: TypeOfValidator<typeof customerValidator> & {@@ -343,11 +347,21 @@ export async function updateCustomerLocation(export async function upsertCustomerType(client: SupabaseClient<Database>,- customerType: { id?: string; name: string; color: string | null }+ customerType:+ | (Omit<TypeOfValidator<typeof customerTypeValidator>, "id"> & {+ createdBy: string;+ })+ | (Omit<TypeOfValidator<typeof customerTypeValidator>, "id"> & {+ id: string;+ updatedBy: string;+ })) {- return client- .from("customerType")- .upsert([customerType])- .select("id")- .single();+ if ("createdBy" in customerType) {+ return client.from("customerType").insert([customerType]);+ } else {+ return client+ .from("customerType")+ .update(sanitize(customerType))+ .eq("id", customerType.id);+ }}diff --git a/apps/carbon/app/modules/sales/interfaces/CustomerTypes/CustomerTypeForm/CustomerTypeForm.tsx b/apps/carbon/app/modules/sales/ui/CustomerTypes/CustomerTypeForm/CustomerTypeForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/sales/interfaces/CustomerTypes/CustomerTypeForm/CustomerTypeForm.tsxrename to apps/carbon/app/modules/sales/ui/CustomerTypes/CustomerTypeForm/CustomerTypeForm.tsxdiff --git a/apps/carbon/app/modules/sales/interfaces/CustomerTypes/CustomerTypeForm/index.ts b/apps/carbon/app/modules/sales/ui/CustomerTypes/CustomerTypeForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/sales/interfaces/CustomerTypes/CustomerTypeForm/index.tsrename to apps/carbon/app/modules/sales/ui/CustomerTypes/CustomerTypeForm/index.tsdiff --git a/apps/carbon/app/modules/sales/interfaces/CustomerTypes/CustomerTypesTable/CustomerTypesTable.tsx b/apps/carbon/app/modules/sales/ui/CustomerTypes/CustomerTypesTable/CustomerTypesTable.tsxsimilarity index 100%rename from apps/carbon/app/modules/sales/interfaces/CustomerTypes/CustomerTypesTable/CustomerTypesTable.tsxrename to apps/carbon/app/modules/sales/ui/CustomerTypes/CustomerTypesTable/CustomerTypesTable.tsxdiff --git a/apps/carbon/app/modules/sales/interfaces/CustomerTypes/CustomerTypesTable/index.ts b/apps/carbon/app/modules/sales/ui/CustomerTypes/CustomerTypesTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/sales/interfaces/CustomerTypes/CustomerTypesTable/index.tsrename to apps/carbon/app/modules/sales/ui/CustomerTypes/CustomerTypesTable/index.tsdiff --git a/apps/carbon/app/modules/sales/interfaces/CustomerTypes/CustomerTypesTableFilters/CustomerTypesTableFilters.tsx b/apps/carbon/app/modules/sales/ui/CustomerTypes/CustomerTypesTableFilters/CustomerTypesTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/sales/interfaces/CustomerTypes/CustomerTypesTableFilters/CustomerTypesTableFilters.tsxrename to apps/carbon/app/modules/sales/ui/CustomerTypes/CustomerTypesTableFilters/CustomerTypesTableFilters.tsxdiff --git a/apps/carbon/app/modules/sales/interfaces/CustomerTypes/CustomerTypesTableFilters/index.ts b/apps/carbon/app/modules/sales/ui/CustomerTypes/CustomerTypesTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/sales/interfaces/CustomerTypes/CustomerTypesTableFilters/index.tsrename to apps/carbon/app/modules/sales/ui/CustomerTypes/CustomerTypesTableFilters/index.tsdiff --git a/apps/carbon/app/modules/sales/interfaces/CustomerTypes/index.ts b/apps/carbon/app/modules/sales/ui/CustomerTypes/index.tssimilarity index 100%rename from apps/carbon/app/modules/sales/interfaces/CustomerTypes/index.tsrename to apps/carbon/app/modules/sales/ui/CustomerTypes/index.tsdiff --git a/apps/carbon/app/modules/sales/interfaces/Customers/CustomerForm/CustomerForm.tsx b/apps/carbon/app/modules/sales/ui/Customers/CustomerForm/CustomerForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/sales/interfaces/Customers/CustomerForm/CustomerForm.tsxrename to apps/carbon/app/modules/sales/ui/Customers/CustomerForm/CustomerForm.tsxdiff --git a/apps/carbon/app/modules/sales/interfaces/Customers/CustomerForm/components/CustomerContacts.tsx b/apps/carbon/app/modules/sales/ui/Customers/CustomerForm/components/CustomerContacts.tsxsimilarity index 100%rename from apps/carbon/app/modules/sales/interfaces/Customers/CustomerForm/components/CustomerContacts.tsxrename to apps/carbon/app/modules/sales/ui/Customers/CustomerForm/components/CustomerContacts.tsxdiff --git a/apps/carbon/app/modules/sales/interfaces/Customers/CustomerForm/components/CustomerContactsForm.tsx b/apps/carbon/app/modules/sales/ui/Customers/CustomerForm/components/CustomerContactsForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/sales/interfaces/Customers/CustomerForm/components/CustomerContactsForm.tsxrename to apps/carbon/app/modules/sales/ui/Customers/CustomerForm/components/CustomerContactsForm.tsxdiff --git a/apps/carbon/app/modules/sales/interfaces/Customers/CustomerForm/components/CustomerLocationForm.tsx b/apps/carbon/app/modules/sales/ui/Customers/CustomerForm/components/CustomerLocationForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/sales/interfaces/Customers/CustomerForm/components/CustomerLocationForm.tsxrename to apps/carbon/app/modules/sales/ui/Customers/CustomerForm/components/CustomerLocationForm.tsxdiff --git a/apps/carbon/app/modules/sales/interfaces/Customers/CustomerForm/components/CustomerLocations.tsx b/apps/carbon/app/modules/sales/ui/Customers/CustomerForm/components/CustomerLocations.tsxsimilarity index 100%rename from apps/carbon/app/modules/sales/interfaces/Customers/CustomerForm/components/CustomerLocations.tsxrename to apps/carbon/app/modules/sales/ui/Customers/CustomerForm/components/CustomerLocations.tsxdiff --git a/apps/carbon/app/modules/sales/interfaces/Customers/CustomerForm/components/index.ts b/apps/carbon/app/modules/sales/ui/Customers/CustomerForm/components/index.tssimilarity index 100%rename from apps/carbon/app/modules/sales/interfaces/Customers/CustomerForm/components/index.tsrename to apps/carbon/app/modules/sales/ui/Customers/CustomerForm/components/index.tsdiff --git a/apps/carbon/app/modules/sales/interfaces/Customers/CustomerForm/index.ts b/apps/carbon/app/modules/sales/ui/Customers/CustomerForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/sales/interfaces/Customers/CustomerForm/index.tsrename to apps/carbon/app/modules/sales/ui/Customers/CustomerForm/index.tsdiff --git a/apps/carbon/app/modules/sales/interfaces/Customers/CustomersTable/CustomersTable.tsx b/apps/carbon/app/modules/sales/ui/Customers/CustomersTable/CustomersTable.tsxsimilarity index 100%rename from apps/carbon/app/modules/sales/interfaces/Customers/CustomersTable/CustomersTable.tsxrename to apps/carbon/app/modules/sales/ui/Customers/CustomersTable/CustomersTable.tsxdiff --git a/apps/carbon/app/modules/sales/interfaces/Customers/CustomersTable/index.ts b/apps/carbon/app/modules/sales/ui/Customers/CustomersTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/sales/interfaces/Customers/CustomersTable/index.tsrename to apps/carbon/app/modules/sales/ui/Customers/CustomersTable/index.tsdiff --git a/apps/carbon/app/modules/sales/interfaces/Customers/CustomersTableFilters/CustomersTableFilters.tsx b/apps/carbon/app/modules/sales/ui/Customers/CustomersTableFilters/CustomersTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/sales/interfaces/Customers/CustomersTableFilters/CustomersTableFilters.tsxrename to apps/carbon/app/modules/sales/ui/Customers/CustomersTableFilters/CustomersTableFilters.tsxdiff --git a/apps/carbon/app/modules/sales/interfaces/Customers/CustomersTableFilters/index.ts b/apps/carbon/app/modules/sales/ui/Customers/CustomersTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/sales/interfaces/Customers/CustomersTableFilters/index.tsrename to apps/carbon/app/modules/sales/ui/Customers/CustomersTableFilters/index.tsdiff --git a/apps/carbon/app/modules/sales/interfaces/Customers/index.ts b/apps/carbon/app/modules/sales/ui/Customers/index.tssimilarity index 100%rename from apps/carbon/app/modules/sales/interfaces/Customers/index.tsrename to apps/carbon/app/modules/sales/ui/Customers/index.tsdiff --git a/apps/carbon/app/modules/sales/interfaces/index.ts b/apps/carbon/app/modules/sales/ui/index.tssimilarity index 100%rename from apps/carbon/app/modules/sales/interfaces/index.tsrename to apps/carbon/app/modules/sales/ui/index.tsdiff --git a/apps/carbon/app/modules/sales/interfaces/useSalesSidebar.tsx b/apps/carbon/app/modules/sales/ui/useSalesSidebar.tsxsimilarity index 100%rename from apps/carbon/app/modules/sales/interfaces/useSalesSidebar.tsxrename to apps/carbon/app/modules/sales/ui/useSalesSidebar.tsxdiff --git a/apps/carbon/app/modules/settings/index.ts b/apps/carbon/app/modules/settings/index.tsindex 684aed031a..83b8af135e 100644--- a/apps/carbon/app/modules/settings/index.ts+++ b/apps/carbon/app/modules/settings/index.ts@@ -1,3 +1,3 @@export * from "./services";-export * from "./interfaces";export * from "./types";+export * from "./ui";diff --git a/apps/carbon/app/modules/settings/interfaces/Sequences/SequenceForm/SequenceForm.tsx b/apps/carbon/app/modules/settings/ui/Sequences/SequenceForm/SequenceForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/settings/interfaces/Sequences/SequenceForm/SequenceForm.tsxrename to apps/carbon/app/modules/settings/ui/Sequences/SequenceForm/SequenceForm.tsxdiff --git a/apps/carbon/app/modules/settings/interfaces/Sequences/SequenceForm/index.ts b/apps/carbon/app/modules/settings/ui/Sequences/SequenceForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/settings/interfaces/Sequences/SequenceForm/index.tsrename to apps/carbon/app/modules/settings/ui/Sequences/SequenceForm/index.tsdiff --git a/apps/carbon/app/modules/settings/interfaces/Sequences/SequencesTable/SequencesTable.tsx b/apps/carbon/app/modules/settings/ui/Sequences/SequencesTable/SequencesTable.tsxsimilarity index 100%rename from apps/carbon/app/modules/settings/interfaces/Sequences/SequencesTable/SequencesTable.tsxrename to apps/carbon/app/modules/settings/ui/Sequences/SequencesTable/SequencesTable.tsxdiff --git a/apps/carbon/app/modules/settings/interfaces/Sequences/SequencesTable/index.ts b/apps/carbon/app/modules/settings/ui/Sequences/SequencesTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/settings/interfaces/Sequences/SequencesTable/index.tsrename to apps/carbon/app/modules/settings/ui/Sequences/SequencesTable/index.tsdiff --git a/apps/carbon/app/modules/settings/interfaces/Sequences/SequencesTableFilters/SequencesTableFilters.tsx b/apps/carbon/app/modules/settings/ui/Sequences/SequencesTableFilters/SequencesTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/settings/interfaces/Sequences/SequencesTableFilters/SequencesTableFilters.tsxrename to apps/carbon/app/modules/settings/ui/Sequences/SequencesTableFilters/SequencesTableFilters.tsxdiff --git a/apps/carbon/app/modules/settings/interfaces/Sequences/SequencesTableFilters/index.ts b/apps/carbon/app/modules/settings/ui/Sequences/SequencesTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/settings/interfaces/Sequences/SequencesTableFilters/index.tsrename to apps/carbon/app/modules/settings/ui/Sequences/SequencesTableFilters/index.tsdiff --git a/apps/carbon/app/modules/settings/interfaces/Sequences/index.ts b/apps/carbon/app/modules/settings/ui/Sequences/index.tssimilarity index 100%rename from apps/carbon/app/modules/settings/interfaces/Sequences/index.tsrename to apps/carbon/app/modules/settings/ui/Sequences/index.tsdiff --git a/apps/carbon/app/modules/settings/interfaces/index.ts b/apps/carbon/app/modules/settings/ui/index.tssimilarity index 100%rename from apps/carbon/app/modules/settings/interfaces/index.tsrename to apps/carbon/app/modules/settings/ui/index.tsdiff --git a/apps/carbon/app/modules/settings/interfaces/useSettingsSidebar.tsx b/apps/carbon/app/modules/settings/ui/useSettingsSidebar.tsxsimilarity index 100%rename from apps/carbon/app/modules/settings/interfaces/useSettingsSidebar.tsxrename to apps/carbon/app/modules/settings/ui/useSettingsSidebar.tsxdiff --git a/apps/carbon/app/modules/users/index.ts b/apps/carbon/app/modules/users/index.tsindex 684aed031a..83b8af135e 100644--- a/apps/carbon/app/modules/users/index.ts+++ b/apps/carbon/app/modules/users/index.ts@@ -1,3 +1,3 @@export * from "./services";-export * from "./interfaces";export * from "./types";+export * from "./ui";diff --git a/apps/carbon/app/modules/users/interfaces/Customers/CreateCustomerModal/CreateCustomerModal.tsx b/apps/carbon/app/modules/users/ui/Customers/CreateCustomerModal/CreateCustomerModal.tsxsimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Customers/CreateCustomerModal/CreateCustomerModal.tsxrename to apps/carbon/app/modules/users/ui/Customers/CreateCustomerModal/CreateCustomerModal.tsxdiff --git a/apps/carbon/app/modules/users/interfaces/Customers/CreateCustomerModal/index.ts b/apps/carbon/app/modules/users/ui/Customers/CreateCustomerModal/index.tssimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Customers/CreateCustomerModal/index.tsrename to apps/carbon/app/modules/users/ui/Customers/CreateCustomerModal/index.tsdiff --git a/apps/carbon/app/modules/users/interfaces/Customers/CustomerAccountsTable/CustomerAccountsTable.tsx b/apps/carbon/app/modules/users/ui/Customers/CustomerAccountsTable/CustomerAccountsTable.tsxsimilarity index 97%rename from apps/carbon/app/modules/users/interfaces/Customers/CustomerAccountsTable/CustomerAccountsTable.tsxrename to apps/carbon/app/modules/users/ui/Customers/CustomerAccountsTable/CustomerAccountsTable.tsxindex e536a7667a..f7da18afb4 100644--- a/apps/carbon/app/modules/users/interfaces/Customers/CustomerAccountsTable/CustomerAccountsTable.tsx+++ b/apps/carbon/app/modules/users/ui/Customers/CustomerAccountsTable/CustomerAccountsTable.tsx@@ -47,7 +47,7 @@ const CustomerAccountsTable = memo([data]);- const columns = useMemo<ColumnDef<typeof rows[number]>[]>(() => {+ const columns = useMemo<ColumnDef<(typeof rows)[number]>[]>(() => {return [{header: "User",@@ -149,7 +149,7 @@ const CustomerAccountsTable = memo(// );const renderContextMenu = useCallback(- (row: typeof data[number]) => {+ (row: (typeof data)[number]) => {if (Array.isArray(row.user) || !row.user) {return null;}@@ -184,7 +184,7 @@ const CustomerAccountsTable = memo(return (<>- <Table<typeof rows[number]>+ <Table<(typeof rows)[number]>actions={actions}count={count}columns={columns}diff --git a/apps/carbon/app/modules/users/interfaces/Customers/CustomerAccountsTable/index.ts b/apps/carbon/app/modules/users/ui/Customers/CustomerAccountsTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Customers/CustomerAccountsTable/index.tsrename to apps/carbon/app/modules/users/ui/Customers/CustomerAccountsTable/index.tsdiff --git a/apps/carbon/app/modules/users/interfaces/Customers/CustomerAccountsTableFilters/CustomerAccountsTableFilters.tsx b/apps/carbon/app/modules/users/ui/Customers/CustomerAccountsTableFilters/CustomerAccountsTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Customers/CustomerAccountsTableFilters/CustomerAccountsTableFilters.tsxrename to apps/carbon/app/modules/users/ui/Customers/CustomerAccountsTableFilters/CustomerAccountsTableFilters.tsxdiff --git a/apps/carbon/app/modules/users/interfaces/Customers/CustomerAccountsTableFilters/index.ts b/apps/carbon/app/modules/users/ui/Customers/CustomerAccountsTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Customers/CustomerAccountsTableFilters/index.tsrename to apps/carbon/app/modules/users/ui/Customers/CustomerAccountsTableFilters/index.tsdiff --git a/apps/carbon/app/modules/users/interfaces/Customers/index.ts b/apps/carbon/app/modules/users/ui/Customers/index.tssimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Customers/index.tsrename to apps/carbon/app/modules/users/ui/Customers/index.tsdiff --git a/apps/carbon/app/modules/users/interfaces/DeactivateUsersModal/DeactivateUsersModal.tsx b/apps/carbon/app/modules/users/ui/DeactivateUsersModal/DeactivateUsersModal.tsxsimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/DeactivateUsersModal/DeactivateUsersModal.tsxrename to apps/carbon/app/modules/users/ui/DeactivateUsersModal/DeactivateUsersModal.tsxdiff --git a/apps/carbon/app/modules/users/interfaces/DeactivateUsersModal/index.ts b/apps/carbon/app/modules/users/ui/DeactivateUsersModal/index.tssimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/DeactivateUsersModal/index.tsrename to apps/carbon/app/modules/users/ui/DeactivateUsersModal/index.tsdiff --git a/apps/carbon/app/modules/users/interfaces/EmployeeTypes/EmployeeTypeForm/EmployeeTypeForm.tsx b/apps/carbon/app/modules/users/ui/EmployeeTypes/EmployeeTypeForm/EmployeeTypeForm.tsxsimilarity index 97%rename from apps/carbon/app/modules/users/interfaces/EmployeeTypes/EmployeeTypeForm/EmployeeTypeForm.tsxrename to apps/carbon/app/modules/users/ui/EmployeeTypes/EmployeeTypeForm/EmployeeTypeForm.tsxindex e3aba25643..6ddf5d5757 100644--- a/apps/carbon/app/modules/users/interfaces/EmployeeTypes/EmployeeTypeForm/EmployeeTypeForm.tsx+++ b/apps/carbon/app/modules/users/ui/EmployeeTypes/EmployeeTypeForm/EmployeeTypeForm.tsx@@ -17,9 +17,9 @@ import { useState } from "react";import { ValidatedForm } from "remix-validated-form";import { Color, Hidden, Input, Submit } from "~/components/Form";import { usePermissions } from "~/hooks";-import PermissionCheckboxes from "~/modules/users/interfaces/components/Permission";import type { Permission } from "~/modules/users";import { employeeTypeValidator } from "~/modules/users";+import PermissionCheckboxes from "~/modules/users/ui/components/Permission";import type { TypeOfValidator } from "~/types/validators";type EmployeeTypeFormProps = {diff --git a/apps/carbon/app/modules/users/interfaces/EmployeeTypes/EmployeeTypeForm/index.ts b/apps/carbon/app/modules/users/ui/EmployeeTypes/EmployeeTypeForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/EmployeeTypes/EmployeeTypeForm/index.tsrename to apps/carbon/app/modules/users/ui/EmployeeTypes/EmployeeTypeForm/index.tsdiff --git a/apps/carbon/app/modules/users/interfaces/EmployeeTypes/EmployeeTypesTable/EmployeeTypesTable.tsx b/apps/carbon/app/modules/users/ui/EmployeeTypes/EmployeeTypesTable/EmployeeTypesTable.tsxsimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/EmployeeTypes/EmployeeTypesTable/EmployeeTypesTable.tsxrename to apps/carbon/app/modules/users/ui/EmployeeTypes/EmployeeTypesTable/EmployeeTypesTable.tsxdiff --git a/apps/carbon/app/modules/users/interfaces/EmployeeTypes/EmployeeTypesTable/index.ts b/apps/carbon/app/modules/users/ui/EmployeeTypes/EmployeeTypesTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/EmployeeTypes/EmployeeTypesTable/index.tsrename to apps/carbon/app/modules/users/ui/EmployeeTypes/EmployeeTypesTable/index.tsdiff --git a/apps/carbon/app/modules/users/interfaces/EmployeeTypes/EmployeeTypesTableFilters/EmployeeTypesTableFilters.tsx b/apps/carbon/app/modules/users/ui/EmployeeTypes/EmployeeTypesTableFilters/EmployeeTypesTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/EmployeeTypes/EmployeeTypesTableFilters/EmployeeTypesTableFilters.tsxrename to apps/carbon/app/modules/users/ui/EmployeeTypes/EmployeeTypesTableFilters/EmployeeTypesTableFilters.tsxdiff --git a/apps/carbon/app/modules/users/interfaces/EmployeeTypes/EmployeeTypesTableFilters/index.ts b/apps/carbon/app/modules/users/ui/EmployeeTypes/EmployeeTypesTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/EmployeeTypes/EmployeeTypesTableFilters/index.tsrename to apps/carbon/app/modules/users/ui/EmployeeTypes/EmployeeTypesTableFilters/index.tsdiff --git a/apps/carbon/app/modules/users/interfaces/EmployeeTypes/index.ts b/apps/carbon/app/modules/users/ui/EmployeeTypes/index.tssimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/EmployeeTypes/index.tsrename to apps/carbon/app/modules/users/ui/EmployeeTypes/index.tsdiff --git a/apps/carbon/app/modules/users/interfaces/Employees/BulkEditPermissionsForm/BulkEditPermissionsForm.tsx b/apps/carbon/app/modules/users/ui/Employees/BulkEditPermissionsForm/BulkEditPermissionsForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Employees/BulkEditPermissionsForm/BulkEditPermissionsForm.tsxrename to apps/carbon/app/modules/users/ui/Employees/BulkEditPermissionsForm/BulkEditPermissionsForm.tsxdiff --git a/apps/carbon/app/modules/users/interfaces/Employees/BulkEditPermissionsForm/index.ts b/apps/carbon/app/modules/users/ui/Employees/BulkEditPermissionsForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Employees/BulkEditPermissionsForm/index.tsrename to apps/carbon/app/modules/users/ui/Employees/BulkEditPermissionsForm/index.tsdiff --git a/apps/carbon/app/modules/users/interfaces/Employees/CreateEmployeeModal/CreateEmployeeModal.tsx b/apps/carbon/app/modules/users/ui/Employees/CreateEmployeeModal/CreateEmployeeModal.tsxsimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Employees/CreateEmployeeModal/CreateEmployeeModal.tsxrename to apps/carbon/app/modules/users/ui/Employees/CreateEmployeeModal/CreateEmployeeModal.tsxdiff --git a/apps/carbon/app/modules/users/interfaces/Employees/CreateEmployeeModal/index.ts b/apps/carbon/app/modules/users/ui/Employees/CreateEmployeeModal/index.tssimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Employees/CreateEmployeeModal/index.tsrename to apps/carbon/app/modules/users/ui/Employees/CreateEmployeeModal/index.tsdiff --git a/apps/carbon/app/modules/users/interfaces/Employees/EmployeePermissionsForm/EmployeePermissionsForm.tsx b/apps/carbon/app/modules/users/ui/Employees/EmployeePermissionsForm/EmployeePermissionsForm.tsxsimilarity index 97%rename from apps/carbon/app/modules/users/interfaces/Employees/EmployeePermissionsForm/EmployeePermissionsForm.tsxrename to apps/carbon/app/modules/users/ui/Employees/EmployeePermissionsForm/EmployeePermissionsForm.tsxindex 221e1b2bf1..acb8491ff3 100644--- a/apps/carbon/app/modules/users/interfaces/Employees/EmployeePermissionsForm/EmployeePermissionsForm.tsx+++ b/apps/carbon/app/modules/users/ui/Employees/EmployeePermissionsForm/EmployeePermissionsForm.tsx@@ -17,9 +17,9 @@ import type { PostgrestResponse } from "@supabase/supabase-js";import { useEffect, useState } from "react";import { ValidatedForm } from "remix-validated-form";import { Hidden, Select, Submit } from "~/components/Form";-import PermissionCheckboxes from "~/modules/users/interfaces/components/Permission";import type { EmployeeType, Permission } from "~/modules/users";import { employeeValidator } from "~/modules/users";+import PermissionCheckboxes from "~/modules/users/ui/components/Permission";import type { TypeOfValidator } from "~/types/validators";import { mapRowsToOptions } from "~/utils/form";diff --git a/apps/carbon/app/modules/users/interfaces/Employees/EmployeePermissionsForm/index.ts b/apps/carbon/app/modules/users/ui/Employees/EmployeePermissionsForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Employees/EmployeePermissionsForm/index.tsrename to apps/carbon/app/modules/users/ui/Employees/EmployeePermissionsForm/index.tsdiff --git a/apps/carbon/app/modules/users/interfaces/Employees/EmployeesTable/EmployeesTable.tsx b/apps/carbon/app/modules/users/ui/Employees/EmployeesTable/EmployeesTable.tsxsimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Employees/EmployeesTable/EmployeesTable.tsxrename to apps/carbon/app/modules/users/ui/Employees/EmployeesTable/EmployeesTable.tsxdiff --git a/apps/carbon/app/modules/users/interfaces/Employees/EmployeesTable/index.ts b/apps/carbon/app/modules/users/ui/Employees/EmployeesTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Employees/EmployeesTable/index.tsrename to apps/carbon/app/modules/users/ui/Employees/EmployeesTable/index.tsdiff --git a/apps/carbon/app/modules/users/interfaces/Employees/EmployeesTableFilters/EmployeesTableFilters.tsx b/apps/carbon/app/modules/users/ui/Employees/EmployeesTableFilters/EmployeesTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Employees/EmployeesTableFilters/EmployeesTableFilters.tsxrename to apps/carbon/app/modules/users/ui/Employees/EmployeesTableFilters/EmployeesTableFilters.tsxdiff --git a/apps/carbon/app/modules/users/interfaces/Employees/EmployeesTableFilters/index.ts b/apps/carbon/app/modules/users/ui/Employees/EmployeesTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Employees/EmployeesTableFilters/index.tsrename to apps/carbon/app/modules/users/ui/Employees/EmployeesTableFilters/index.tsdiff --git a/apps/carbon/app/modules/users/interfaces/Employees/index.ts b/apps/carbon/app/modules/users/ui/Employees/index.tssimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Employees/index.tsrename to apps/carbon/app/modules/users/ui/Employees/index.tsdiff --git a/apps/carbon/app/modules/users/interfaces/Groups/GroupsForm/GroupsForm.tsx b/apps/carbon/app/modules/users/ui/Groups/GroupsForm/GroupsForm.tsxsimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Groups/GroupsForm/GroupsForm.tsxrename to apps/carbon/app/modules/users/ui/Groups/GroupsForm/GroupsForm.tsxdiff --git a/apps/carbon/app/modules/users/interfaces/Groups/GroupsForm/index.ts b/apps/carbon/app/modules/users/ui/Groups/GroupsForm/index.tssimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Groups/GroupsForm/index.tsrename to apps/carbon/app/modules/users/ui/Groups/GroupsForm/index.tsdiff --git a/apps/carbon/app/modules/users/interfaces/Groups/GroupsTable/GroupsTable.tsx b/apps/carbon/app/modules/users/ui/Groups/GroupsTable/GroupsTable.tsxsimilarity index 95%rename from apps/carbon/app/modules/users/interfaces/Groups/GroupsTable/GroupsTable.tsxrename to apps/carbon/app/modules/users/ui/Groups/GroupsTable/GroupsTable.tsxindex e5620a4f68..384f1ee4b0 100644--- a/apps/carbon/app/modules/users/interfaces/Groups/GroupsTable/GroupsTable.tsx+++ b/apps/carbon/app/modules/users/ui/Groups/GroupsTable/GroupsTable.tsx@@ -34,7 +34,7 @@ const GroupsTable = memo(({ data, count }: GroupsTableProps) => {),}));- const columns = useMemo<ColumnDef<typeof rows[number]>[]>(() => {+ const columns = useMemo<ColumnDef<(typeof rows)[number]>[]>(() => {return [{accessorKey: "name",@@ -66,7 +66,7 @@ const GroupsTable = memo(({ data, count }: GroupsTableProps) => {}, []);const renderContextMenu = useCallback(- (row: typeof rows[number]) => {+ (row: (typeof rows)[number]) => {return (<><MenuItem@@ -104,7 +104,7 @@ const GroupsTable = memo(({ data, count }: GroupsTableProps) => {);return (- <Table<typeof rows[number]>+ <Table<(typeof rows)[number]>data={rows}count={count}columns={columns}diff --git a/apps/carbon/app/modules/users/interfaces/Groups/GroupsTable/index.ts b/apps/carbon/app/modules/users/ui/Groups/GroupsTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Groups/GroupsTable/index.tsrename to apps/carbon/app/modules/users/ui/Groups/GroupsTable/index.tsdiff --git a/apps/carbon/app/modules/users/interfaces/Groups/GroupsTableFilters/GroupsTableFilters.tsx b/apps/carbon/app/modules/users/ui/Groups/GroupsTableFilters/GroupsTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Groups/GroupsTableFilters/GroupsTableFilters.tsxrename to apps/carbon/app/modules/users/ui/Groups/GroupsTableFilters/GroupsTableFilters.tsxdiff --git a/apps/carbon/app/modules/users/interfaces/Groups/GroupsTableFilters/index.ts b/apps/carbon/app/modules/users/ui/Groups/GroupsTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Groups/GroupsTableFilters/index.tsrename to apps/carbon/app/modules/users/ui/Groups/GroupsTableFilters/index.tsdiff --git a/apps/carbon/app/modules/users/interfaces/Groups/index.ts b/apps/carbon/app/modules/users/ui/Groups/index.tssimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Groups/index.tsrename to apps/carbon/app/modules/users/ui/Groups/index.tsdiff --git a/apps/carbon/app/modules/users/interfaces/ResendInviteModal/ResendInviteModal.tsx b/apps/carbon/app/modules/users/ui/ResendInviteModal/ResendInviteModal.tsxsimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/ResendInviteModal/ResendInviteModal.tsxrename to apps/carbon/app/modules/users/ui/ResendInviteModal/ResendInviteModal.tsxdiff --git a/apps/carbon/app/modules/users/interfaces/ResendInviteModal/index.ts b/apps/carbon/app/modules/users/ui/ResendInviteModal/index.tssimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/ResendInviteModal/index.tsrename to apps/carbon/app/modules/users/ui/ResendInviteModal/index.tsdiff --git a/apps/carbon/app/modules/users/interfaces/Suppliers/CreateSupplierModal/CreateSupplierModal.tsx b/apps/carbon/app/modules/users/ui/Suppliers/CreateSupplierModal/CreateSupplierModal.tsxsimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Suppliers/CreateSupplierModal/CreateSupplierModal.tsxrename to apps/carbon/app/modules/users/ui/Suppliers/CreateSupplierModal/CreateSupplierModal.tsxdiff --git a/apps/carbon/app/modules/users/interfaces/Suppliers/CreateSupplierModal/index.ts b/apps/carbon/app/modules/users/ui/Suppliers/CreateSupplierModal/index.tssimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Suppliers/CreateSupplierModal/index.tsrename to apps/carbon/app/modules/users/ui/Suppliers/CreateSupplierModal/index.tsdiff --git a/apps/carbon/app/modules/users/interfaces/Suppliers/SupplierAccountsTable/SuppliersAccountsTable.tsx b/apps/carbon/app/modules/users/ui/Suppliers/SupplierAccountsTable/SuppliersAccountsTable.tsxsimilarity index 97%rename from apps/carbon/app/modules/users/interfaces/Suppliers/SupplierAccountsTable/SuppliersAccountsTable.tsxrename to apps/carbon/app/modules/users/ui/Suppliers/SupplierAccountsTable/SuppliersAccountsTable.tsxindex 397ec14c6f..c5cc529b7a 100644--- a/apps/carbon/app/modules/users/interfaces/Suppliers/SupplierAccountsTable/SuppliersAccountsTable.tsx+++ b/apps/carbon/app/modules/users/ui/Suppliers/SupplierAccountsTable/SuppliersAccountsTable.tsx@@ -47,7 +47,7 @@ const SupplierAccountsTable = memo([data]);- const columns = useMemo<ColumnDef<typeof rows[number]>[]>(() => {+ const columns = useMemo<ColumnDef<(typeof rows)[number]>[]>(() => {return [{header: "User",@@ -140,7 +140,7 @@ const SupplierAccountsTable = memo(}, [deactivateSupplierModal, permissions, resendInviteModal]);const renderContextMenu = useCallback(- (row: typeof data[number]) => {+ (row: (typeof data)[number]) => {if (Array.isArray(row.user) || !row.user) {return null;}@@ -175,7 +175,7 @@ const SupplierAccountsTable = memo(return (<>- <Table<typeof rows[number]>+ <Table<(typeof rows)[number]>actions={actions}count={count}columns={columns}diff --git a/apps/carbon/app/modules/users/interfaces/Suppliers/SupplierAccountsTable/index.ts b/apps/carbon/app/modules/users/ui/Suppliers/SupplierAccountsTable/index.tssimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Suppliers/SupplierAccountsTable/index.tsrename to apps/carbon/app/modules/users/ui/Suppliers/SupplierAccountsTable/index.tsdiff --git a/apps/carbon/app/modules/users/interfaces/Suppliers/SupplierAccountsTableFilters/SupplierAccountsTableFilters.tsx b/apps/carbon/app/modules/users/ui/Suppliers/SupplierAccountsTableFilters/SupplierAccountsTableFilters.tsxsimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Suppliers/SupplierAccountsTableFilters/SupplierAccountsTableFilters.tsxrename to apps/carbon/app/modules/users/ui/Suppliers/SupplierAccountsTableFilters/SupplierAccountsTableFilters.tsxdiff --git a/apps/carbon/app/modules/users/interfaces/Suppliers/SupplierAccountsTableFilters/index.ts b/apps/carbon/app/modules/users/ui/Suppliers/SupplierAccountsTableFilters/index.tssimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Suppliers/SupplierAccountsTableFilters/index.tsrename to apps/carbon/app/modules/users/ui/Suppliers/SupplierAccountsTableFilters/index.tsdiff --git a/apps/carbon/app/modules/users/interfaces/Suppliers/index.ts b/apps/carbon/app/modules/users/ui/Suppliers/index.tssimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/Suppliers/index.tsrename to apps/carbon/app/modules/users/ui/Suppliers/index.tsdiff --git a/apps/carbon/app/modules/users/interfaces/components/Permission/Permission.tsx b/apps/carbon/app/modules/users/ui/components/Permission/Permission.tsxsimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/components/Permission/Permission.tsxrename to apps/carbon/app/modules/users/ui/components/Permission/Permission.tsxdiff --git a/apps/carbon/app/modules/users/interfaces/components/Permission/index.ts b/apps/carbon/app/modules/users/ui/components/Permission/index.tssimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/components/Permission/index.tsrename to apps/carbon/app/modules/users/ui/components/Permission/index.tsdiff --git a/apps/carbon/app/modules/users/interfaces/index.ts b/apps/carbon/app/modules/users/ui/index.tssimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/index.tsrename to apps/carbon/app/modules/users/ui/index.tsdiff --git a/apps/carbon/app/modules/users/interfaces/useUsersSidebar.tsx b/apps/carbon/app/modules/users/ui/useUsersSidebar.tsxsimilarity index 100%rename from apps/carbon/app/modules/users/interfaces/useUsersSidebar.tsxrename to apps/carbon/app/modules/users/ui/useUsersSidebar.tsxdiff --git a/apps/carbon/app/routes/api+/accounting.accounts.tsx b/apps/carbon/app/routes/api+/accounting.accounts.tsxindex d6ff461d49..90cdc8a365 100644--- a/apps/carbon/app/routes/api+/accounting.accounts.tsx+++ b/apps/carbon/app/routes/api+/accounting.accounts.tsx@@ -9,6 +9,12 @@ export async function loader({ request }: LoaderArgs) {const url = new URL(request.url);const searchParams = new URLSearchParams(url.search);const type = searchParams.get("type");+ const incomeBalance = searchParams.get("incomeBalance");- return json(await getAccountsList(authorized.client, type));+ return json(+ await getAccountsList(authorized.client, {+ type,+ incomeBalance,+ })+ );}diff --git a/apps/carbon/app/routes/x+/accounting+/_layout.tsx b/apps/carbon/app/routes/x+/accounting+/_layout.tsxindex c01b663751..988f14d8cf 100644--- a/apps/carbon/app/routes/x+/accounting+/_layout.tsx+++ b/apps/carbon/app/routes/x+/accounting+/_layout.tsx@@ -1,10 +1,16 @@import { Grid, VStack } from "@chakra-ui/react";import type { LoaderArgs, MetaFunction } from "@remix-run/node";-import { json } from "@remix-run/node";+import { json, redirect } from "@remix-run/node";import { Outlet } from "@remix-run/react";import { GroupedContentSidebar } from "~/components/Layout/Sidebar";-import { getBaseCurrency, useAccountingSidebar } from "~/modules/accounting";+import {+ getAccountsList,+ getBaseCurrency,+ useAccountingSidebar,+} from "~/modules/accounting";import { requirePermissions } from "~/services/auth";+import { flash } from "~/services/session";+import { error } from "~/utils/result";export const meta: MetaFunction = () => ({title: "Carbon | Accounting",@@ -15,10 +21,49 @@ export async function loader({ request }: LoaderArgs) {view: "accounting",});- const [baseCurrency] = await Promise.all([getBaseCurrency(client)]);+ const [baseCurrency, balanceSheetAccounts, incomeStatementAccounts] =+ await Promise.all([+ getBaseCurrency(client),+ getAccountsList(client, {+ type: "Posting",+ incomeBalance: "Balance Sheet",+ }),+ getAccountsList(client, {+ type: "Posting",+ incomeBalance: "Income Statement",+ }),+ ]);++ if (balanceSheetAccounts.error) {+ return redirect(+ "/x",+ await flash(+ request,+ error(+ balanceSheetAccounts.error,+ "Failed to fetch balance sheet accounts"+ )+ )+ );+ }++ if (incomeStatementAccounts.error) {+ return redirect(+ "/x",+ await flash(+ request,+ error(+ incomeStatementAccounts.error,+ "Failed to fetch income statement accounts"+ )+ )+ );+ }return json({baseCurrency: baseCurrency.data,+ balanceSheetAccounts: balanceSheetAccounts.data ?? [],+ incomeStatementAccounts: incomeStatementAccounts.data ?? [],});}@@ -26,7 +71,7 @@ export default function UsersRoute() {const { groups } = useAccountingSidebar();return (- <Grid w="full" h="full" templateColumns="auto 1fr" overflow="auto">+ <Grid w="full" h="full" templateColumns="auto 1fr"><GroupedContentSidebar groups={groups} /><VStack w="full" h="full" spacing={0}><Outlet />diff --git a/apps/carbon/app/routes/x+/accounting+/charts.tsx b/apps/carbon/app/routes/x+/accounting+/charts.tsxindex af10592e8a..7c5541db97 100644--- a/apps/carbon/app/routes/x+/accounting+/charts.tsx+++ b/apps/carbon/app/routes/x+/accounting+/charts.tsx@@ -1,10 +1,9 @@import { VStack } from "@chakra-ui/react";import type { LoaderArgs } from "@remix-run/node";-import { redirect } from "@remix-run/node";-import { json } from "@remix-run/node";+import { json, redirect } from "@remix-run/node";import { Outlet, useLoaderData } from "@remix-run/react";import { ChartOfAccountsTable, getChartOfAccounts } from "~/modules/accounting";-import ChartOfAccountsTableFilters from "~/modules/accounting/interfaces/ChartOfAccounts/ChartOfAccountsTableFilters";+import ChartOfAccountsTableFilters from "~/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTableFilters";import { requirePermissions } from "~/services/auth";import { flash } from "~/services/session";import { error } from "~/utils/result";diff --git a/apps/carbon/app/routes/x+/accounting+/defaults.tsx b/apps/carbon/app/routes/x+/accounting+/defaults.tsxnew file mode 100644index 0000000000..a446561743--- /dev/null+++ b/apps/carbon/app/routes/x+/accounting+/defaults.tsx@@ -0,0 +1,98 @@+import { useColor } from "@carbon/react";+import { VStack } from "@chakra-ui/react";+import type { ActionArgs, LoaderArgs } from "@remix-run/node";+import { json, redirect } from "@remix-run/node";+import { useLoaderData } from "@remix-run/react";+import { validationError } from "remix-validated-form";+import { PageTitle } from "~/components/Layout";+import { useRouteData } from "~/hooks";+import type { AccountListItem } from "~/modules/accounting";+import {+ AccountDefaultsForm,+ defaultAcountValidator,+ getDefaultAccounts,+ updateDefaultAccounts,+} from "~/modules/accounting";+import { requirePermissions } from "~/services/auth";+import { flash } from "~/services/session";+import { assertIsPost } from "~/utils/http";+import { error, success } from "~/utils/result";++export async function loader({ request }: LoaderArgs) {+ const { client } = await requirePermissions(request, {+ view: "accounting",+ });++ const [defaultAccounts] = await Promise.all([getDefaultAccounts(client)]);++ if (defaultAccounts.error || !defaultAccounts.data) {+ return redirect(+ "/x/accounting",+ await flash(+ request,+ error(defaultAccounts.error, "Failed to load default accounts")+ )+ );+ }++ return json({+ defaultAccounts: defaultAccounts.data,+ });+}++export async function action({ request }: ActionArgs) {+ assertIsPost(request);+ const { client, userId } = await requirePermissions(request, {+ create: "accounting",+ });++ const validation = await defaultAcountValidator.validate(+ await request.formData()+ );++ if (validation.error) {+ return validationError(validation.error);+ }++ const updateDefaults = await updateDefaultAccounts(client, {+ ...validation.data,+ updatedBy: userId,+ });+ if (updateDefaults.error) {+ return json(+ {},+ await flash(+ request,+ error(updateDefaults.error, "Failed to update default accounts")+ )+ );+ }++ return redirect(+ "/x/accounting/defaults",+ await flash(request, success("Updated default accounts"))+ );+}++export default function AccountDefaultsRoute() {+ const { defaultAccounts } = useLoaderData<typeof loader>();+ const routeData = useRouteData<{+ balanceSheetAccounts: AccountListItem[];+ incomeStatementAccounts: AccountListItem[];+ }>("/x/accounting");++ return (+ <VStack bg={useColor("white")} w="full" h="full" p={8} overflowY="auto">+ <PageTitle+ title="Account Defaults"+ subtitle="These accounts will be used to prepopulate posting grous when a new customer type, supplier type, part group, or location is created."+ />++ <AccountDefaultsForm+ balanceSheetAccounts={routeData?.balanceSheetAccounts ?? []}+ incomeStatementAccounts={routeData?.incomeStatementAccounts ?? []}+ initialValues={defaultAccounts}+ />+ </VStack>+ );+}diff --git a/apps/carbon/app/routes/x+/accounting+/groups.inventory.tsx b/apps/carbon/app/routes/x+/accounting+/groups.inventory.tsxnew file mode 100644index 0000000000..e11685ed42--- /dev/null+++ b/apps/carbon/app/routes/x+/accounting+/groups.inventory.tsx@@ -0,0 +1,84 @@+import { VStack } from "@chakra-ui/react";+import type { LoaderArgs } from "@remix-run/node";+import { json, redirect } from "@remix-run/node";+import { Outlet, useLoaderData } from "@remix-run/react";+import { useRouteData } from "~/hooks";+import type { AccountListItem } from "~/modules/accounting";+import {+ getInventoryPostingGroups,+ InventoryPostingGroupsFilters,+ InventoryPostingGroupsTable,+} from "~/modules/accounting";+import { getPartGroupsList } from "~/modules/parts";+import { getLocationsList } from "~/modules/resources";+import { requirePermissions } from "~/services/auth";+import { flash } from "~/services/session";+import { getGenericQueryFilters } from "~/utils/query";+import { error } from "~/utils/result";++export async function loader({ request }: LoaderArgs) {+ const { client } = await requirePermissions(request, {+ view: ["accounting", "inventory"],+ });++ const url = new URL(request.url);+ const searchParams = new URLSearchParams(url.search);+ const partGroup = searchParams.get("partGroup");+ const location = searchParams.get("location");+ const { limit, offset, sorts } = getGenericQueryFilters(searchParams);++ const [inventoryGroups, partGroups, locations] = await Promise.all([+ getInventoryPostingGroups(client, {+ partGroup,+ location,+ limit,+ offset,+ sorts,+ }),+ getPartGroupsList(client),+ getLocationsList(client),+ ]);+ if (inventoryGroups.error) {+ return redirect(+ "/x/accounting",+ await flash(+ request,+ error(inventoryGroups.error, "Failed to fetch inventory posting groups")+ )+ );+ }++ return json({+ data: inventoryGroups.data ?? [],+ partGroups: partGroups.data ?? [],+ locations: locations.data ?? [],+ count: inventoryGroups.count ?? 0,+ });+}++export default function InventoryPostingGroupsRoute() {+ const { data, partGroups, locations, count } = useLoaderData<typeof loader>();++ const routeData = useRouteData<{+ balanceSheetAccounts: AccountListItem[];+ incomeStatementAccounts: AccountListItem[];+ }>("/x/accounting");++ return (+ <VStack w="full" h="full" spacing={0}>+ <InventoryPostingGroupsFilters+ partGroups={partGroups}+ locations={locations}+ />+ <InventoryPostingGroupsTable+ data={data}+ count={count}+ partGroups={partGroups}+ locations={locations}+ balanceSheetAccounts={routeData?.balanceSheetAccounts ?? []}+ incomeStatementAccounts={routeData?.incomeStatementAccounts ?? []}+ />+ <Outlet />+ </VStack>+ );+}diff --git a/apps/carbon/app/routes/x+/accounting+/groups.purchasing.tsx b/apps/carbon/app/routes/x+/accounting+/groups.purchasing.tsxnew file mode 100644index 0000000000..64c7fd4aba--- /dev/null+++ b/apps/carbon/app/routes/x+/accounting+/groups.purchasing.tsx@@ -0,0 +1,88 @@+import { VStack } from "@chakra-ui/react";+import type { LoaderArgs } from "@remix-run/node";+import { json, redirect } from "@remix-run/node";+import { Outlet, useLoaderData } from "@remix-run/react";+import { useRouteData } from "~/hooks";+import type { AccountListItem } from "~/modules/accounting";+import {+ getPurchasingPostingGroups,+ PurchasingPostingGroupsFilters,+ PurchasingPostingGroupsTable,+} from "~/modules/accounting";+import { getPartGroupsList } from "~/modules/parts";+import { getSupplierTypesList } from "~/modules/purchasing";+import { requirePermissions } from "~/services/auth";+import { flash } from "~/services/session";+import { getGenericQueryFilters } from "~/utils/query";+import { error } from "~/utils/result";++export async function loader({ request }: LoaderArgs) {+ const { client } = await requirePermissions(request, {+ view: ["accounting", "purchasing"],+ });++ const url = new URL(request.url);+ const searchParams = new URLSearchParams(url.search);+ const partGroup = searchParams.get("partGroup");+ const supplierType = searchParams.get("supplierType");+ const { limit, offset, sorts } = getGenericQueryFilters(searchParams);++ const [purchasingGroups, partGroups, supplierTypes] = await Promise.all([+ getPurchasingPostingGroups(client, {+ partGroup,+ supplierType,+ limit,+ offset,+ sorts,+ }),+ getPartGroupsList(client),+ getSupplierTypesList(client),+ ]);+ if (purchasingGroups.error) {+ return redirect(+ "/x/accounting",+ await flash(+ request,+ error(+ purchasingGroups.error,+ "Failed to fetch purchasing posting groups"+ )+ )+ );+ }++ return json({+ data: purchasingGroups.data ?? [],+ partGroups: partGroups.data ?? [],+ supplierTypes: supplierTypes.data ?? [],+ count: purchasingGroups.count ?? 0,+ });+}++export default function PurchasingPostingGroupsRoute() {+ const { data, partGroups, supplierTypes, count } =+ useLoaderData<typeof loader>();++ const routeData = useRouteData<{+ balanceSheetAccounts: AccountListItem[];+ incomeStatementAccounts: AccountListItem[];+ }>("/x/accounting");++ return (+ <VStack w="full" h="full" spacing={0}>+ <PurchasingPostingGroupsFilters+ partGroups={partGroups}+ supplierTypes={supplierTypes}+ />+ <PurchasingPostingGroupsTable+ data={data}+ count={count}+ partGroups={partGroups}+ supplierTypes={supplierTypes}+ balanceSheetAccounts={routeData?.balanceSheetAccounts ?? []}+ incomeStatementAccounts={routeData?.incomeStatementAccounts ?? []}+ />+ <Outlet />+ </VStack>+ );+}diff --git a/apps/carbon/app/routes/x+/accounting+/groups.sales.tsx b/apps/carbon/app/routes/x+/accounting+/groups.sales.tsxnew file mode 100644index 0000000000..e0e8b747eb--- /dev/null+++ b/apps/carbon/app/routes/x+/accounting+/groups.sales.tsx@@ -0,0 +1,85 @@+import { VStack } from "@chakra-ui/react";+import type { LoaderArgs } from "@remix-run/node";+import { json, redirect } from "@remix-run/node";+import { Outlet, useLoaderData } from "@remix-run/react";+import { useRouteData } from "~/hooks";+import type { AccountListItem } from "~/modules/accounting";+import {+ getSalesPostingGroups,+ SalesPostingGroupsFilters,+ SalesPostingGroupsTable,+} from "~/modules/accounting";+import { getPartGroupsList } from "~/modules/parts";+import { getCustomerTypesList } from "~/modules/sales";+import { requirePermissions } from "~/services/auth";+import { flash } from "~/services/session";+import { getGenericQueryFilters } from "~/utils/query";+import { error } from "~/utils/result";++export async function loader({ request }: LoaderArgs) {+ const { client } = await requirePermissions(request, {+ view: ["accounting", "sales"],+ });++ const url = new URL(request.url);+ const searchParams = new URLSearchParams(url.search);+ const partGroup = searchParams.get("partGroup");+ const customerType = searchParams.get("customerType");+ const { limit, offset, sorts } = getGenericQueryFilters(searchParams);++ const [salesGroups, partGroups, customerTypes] = await Promise.all([+ getSalesPostingGroups(client, {+ partGroup,+ customerType,+ limit,+ offset,+ sorts,+ }),+ getPartGroupsList(client),+ getCustomerTypesList(client),+ ]);+ if (salesGroups.error) {+ return redirect(+ "/x/accounting",+ await flash(+ request,+ error(salesGroups.error, "Failed to fetch sales posting groups")+ )+ );+ }++ return json({+ data: salesGroups.data ?? [],+ count: salesGroups.count ?? 0,+ partGroups: partGroups.data ?? [],+ customerTypes: customerTypes.data ?? [],+ });+}++export default function SalesPostingGroupsRoute() {+ const { data, count, partGroups, customerTypes } =+ useLoaderData<typeof loader>();++ const routeData = useRouteData<{+ balanceSheetAccounts: AccountListItem[];+ incomeStatementAccounts: AccountListItem[];+ }>("/x/accounting");++ return (+ <VStack w="full" h="full" spacing={0}>+ <SalesPostingGroupsFilters+ partGroups={partGroups}+ customerTypes={customerTypes}+ />+ <SalesPostingGroupsTable+ data={data}+ count={count}+ partGroups={partGroups}+ customerTypes={customerTypes}+ balanceSheetAccounts={routeData?.balanceSheetAccounts ?? []}+ incomeStatementAccounts={routeData?.incomeStatementAccounts ?? []}+ />+ <Outlet />+ </VStack>+ );+}diff --git a/apps/carbon/app/routes/x+/documents+/_layout.tsx b/apps/carbon/app/routes/x+/documents+/_layout.tsxindex 2dd09fe8af..ea37e33c43 100644--- a/apps/carbon/app/routes/x+/documents+/_layout.tsx+++ b/apps/carbon/app/routes/x+/documents+/_layout.tsx@@ -12,7 +12,7 @@ export default function DocumentsRoute() {const { links } = useDocumentsSidebar();return (- <Grid w="full" h="full" templateColumns="auto 1fr" overflow="auto">+ <Grid w="full" h="full" templateColumns="auto 1fr"><ContentSidebar links={links} /><VStack w="full" h="full"><Outlet />diff --git a/apps/carbon/app/routes/x+/inventory+/_layout.tsx b/apps/carbon/app/routes/x+/inventory+/_layout.tsxindex 15e15337f4..4c2be69135 100644--- a/apps/carbon/app/routes/x+/inventory+/_layout.tsx+++ b/apps/carbon/app/routes/x+/inventory+/_layout.tsx@@ -12,7 +12,7 @@ export default function UsersRoute() {const { groups } = useInventorySidebar();return (- <Grid w="full" h="full" templateColumns="auto 1fr" overflow="auto">+ <Grid w="full" h="full" templateColumns="auto 1fr"><GroupedContentSidebar groups={groups} /><VStack w="full" h="full" spacing={0}><Outlet />diff --git a/apps/carbon/app/routes/x+/part+/$partId.costing.tsx b/apps/carbon/app/routes/x+/part+/$partId.costing.tsxindex 4f36a26fa0..0d1b8ad029 100644--- a/apps/carbon/app/routes/x+/part+/$partId.costing.tsx+++ b/apps/carbon/app/routes/x+/part+/$partId.costing.tsx@@ -6,8 +6,8 @@ import { useRouteData } from "~/hooks";import { getAccountsList } from "~/modules/accounting";import type { PartCostingMethod } from "~/modules/parts";import {- PartCostingForm,getPartCost,+ PartCostingForm,partCostValidator,upsertPartCost,} from "~/modules/parts";@@ -90,11 +90,10 @@ export default function PartCostingRoute() {partCostingMethods: PartCostingMethod[];}>("/x/part");- const { partCost, accounts } = useLoaderData<typeof loader>();+ const { partCost } = useLoaderData<typeof loader>();return (<PartCostingForminitialValues={partCost}- accounts={accounts}partCostingMethods={sharedPartsData?.partCostingMethods ?? []}/>);diff --git a/apps/carbon/app/routes/x+/parts+/_layout.tsx b/apps/carbon/app/routes/x+/parts+/_layout.tsxindex b41fa0d29d..599b310f65 100644--- a/apps/carbon/app/routes/x+/parts+/_layout.tsx+++ b/apps/carbon/app/routes/x+/parts+/_layout.tsx@@ -12,7 +12,7 @@ export default function PartsRoute() {const { groups } = usePartsSidebar();return (- <Grid w="full" h="full" templateColumns="auto 1fr" overflow="auto">+ <Grid w="full" h="full" templateColumns="auto 1fr"><GroupedContentSidebar groups={groups} /><VStack w="full" h="full" spacing={0}><Outlet />diff --git a/apps/carbon/app/routes/x+/parts+/groups.$groupId.tsx b/apps/carbon/app/routes/x+/parts+/groups.$groupId.tsxindex 17cb750a17..2b4a45d33a 100644--- a/apps/carbon/app/routes/x+/parts+/groups.$groupId.tsx+++ b/apps/carbon/app/routes/x+/parts+/groups.$groupId.tsx@@ -1,13 +1,12 @@import type { ActionArgs, LoaderArgs } from "@remix-run/node";-import { redirect } from "@remix-run/node";-import { json } from "@remix-run/node";+import { json, redirect } from "@remix-run/node";import { useLoaderData } from "@remix-run/react";import { validationError } from "remix-validated-form";import { useRouteData } from "~/hooks";-import { PartGroupForm } from "~/modules/parts";import {- partGroupValidator,getPartGroup,+ PartGroupForm,+ partGroupValidator,upsertPartGroup,} from "~/modules/parts";import { requirePermissions } from "~/services/auth";@@ -48,21 +47,9 @@ export async function action({ request, params }: ActionArgs) {return validationError(validation.error);}- const {- name,- description,- salesAccountId,- discountAccountId,- inventoryAccountId,- } = validation.data;-const updatePartGroup = await upsertPartGroup(client, {id: groupId,- name,- description,- salesAccountId: salesAccountId ?? null,- discountAccountId: discountAccountId ?? null,- inventoryAccountId: inventoryAccountId ?? null,+ ...validation.data,updatedBy: userId,});@@ -92,9 +79,6 @@ export default function EditPartGroupsRoute() {id: partGroup?.id ?? undefined,name: partGroup?.name ?? "",description: partGroup?.description ?? "",- salesAccountId: partGroup?.salesAccountId ?? "",- discountAccountId: partGroup?.discountAccountId ?? "",- inventoryAccountId: partGroup?.inventoryAccountId ?? "",};return (diff --git a/apps/carbon/app/routes/x+/parts+/groups.new.tsx b/apps/carbon/app/routes/x+/parts+/groups.new.tsxindex 9430e7e3da..dadcf1b9d5 100644--- a/apps/carbon/app/routes/x+/parts+/groups.new.tsx+++ b/apps/carbon/app/routes/x+/parts+/groups.new.tsx@@ -34,20 +34,10 @@ export async function action({ request }: ActionArgs) {return validationError(validation.error);}- const {- name,- description,- salesAccountId,- discountAccountId,- inventoryAccountId,- } = validation.data;+ const { id, ...data } = validation.data;const insertPartGroup = await upsertPartGroup(client, {- name,- description,- salesAccountId,- discountAccountId,- inventoryAccountId,+ ...data,createdBy: userId,});if (insertPartGroup.error) {@@ -85,9 +75,6 @@ export default function NewPartGroupsRoute() {const initialValues = {name: "",description: "",- salesAccountId: "",- discountAccountId: "",- inventoryAccountId: "",};return (diff --git a/apps/carbon/app/routes/x+/purchasing+/_layout.tsx b/apps/carbon/app/routes/x+/purchasing+/_layout.tsxindex b1a7320495..7dd97bcb25 100644--- a/apps/carbon/app/routes/x+/purchasing+/_layout.tsx+++ b/apps/carbon/app/routes/x+/purchasing+/_layout.tsx@@ -12,7 +12,7 @@ export default function UsersRoute() {const { groups } = usePurchasingSidebar();return (- <Grid w="full" h="full" templateColumns="auto 1fr" overflow="auto">+ <Grid w="full" h="full" templateColumns="auto 1fr"><GroupedContentSidebar groups={groups} /><VStack w="full" h="full" spacing={0}><Outlet />diff --git a/apps/carbon/app/routes/x+/purchasing+/supplier-types.$supplierTypeId.tsx b/apps/carbon/app/routes/x+/purchasing+/supplier-types.$supplierTypeId.tsxindex b2f94b9ca0..6dca461716 100644--- a/apps/carbon/app/routes/x+/purchasing+/supplier-types.$supplierTypeId.tsx+++ b/apps/carbon/app/routes/x+/purchasing+/supplier-types.$supplierTypeId.tsx@@ -1,11 +1,10 @@import type { ActionArgs, LoaderArgs } from "@remix-run/node";-import { redirect } from "@remix-run/node";-import { json } from "@remix-run/node";+import { json, redirect } from "@remix-run/node";import { useLoaderData } from "@remix-run/react";import { validationError } from "remix-validated-form";import {- SupplierTypeForm,getSupplierType,+ SupplierTypeForm,supplierTypeValidator,upsertSupplierType,} from "~/modules/purchasing";@@ -48,7 +47,7 @@ export async function loader({ request, params }: LoaderArgs) {export async function action({ request }: ActionArgs) {assertIsPost(request);- const { client } = await requirePermissions(request, {+ const { client, userId } = await requirePermissions(request, {update: "purchasing",});@@ -60,12 +59,13 @@ export async function action({ request }: ActionArgs) {return validationError(validation.error);}- const { id, name, color } = validation.data;+ const { id, ...data } = validation.data;+ if (!id) throw new Error("id is required");const updateSupplierType = await upsertSupplierType(client, {id,- name,- color: color || null,+ ...data,+ updatedBy: userId,});if (updateSupplierType.error) {diff --git a/apps/carbon/app/routes/x+/purchasing+/supplier-types.new.tsx b/apps/carbon/app/routes/x+/purchasing+/supplier-types.new.tsxindex 03471edae5..9b43c486e1 100644--- a/apps/carbon/app/routes/x+/purchasing+/supplier-types.new.tsx+++ b/apps/carbon/app/routes/x+/purchasing+/supplier-types.new.tsx@@ -1,6 +1,5 @@import type { ActionArgs, LoaderArgs } from "@remix-run/node";-import { redirect } from "@remix-run/node";-import { json } from "@remix-run/node";+import { json, redirect } from "@remix-run/node";import { validationError } from "remix-validated-form";import {SupplierTypeForm,@@ -22,7 +21,7 @@ export async function loader({ request }: LoaderArgs) {export async function action({ request }: ActionArgs) {assertIsPost(request);- const { client } = await requirePermissions(request, {+ const { client, userId } = await requirePermissions(request, {create: "purchasing",});@@ -34,11 +33,11 @@ export async function action({ request }: ActionArgs) {return validationError(validation.error);}- const { name, color } = validation.data;+ const { id, ...data } = validation.data;const insertSupplierType = await upsertSupplierType(client, {- name,- color: color || null,+ ...data,+ createdBy: userId,});if (insertSupplierType.error) {return json(@@ -50,17 +49,6 @@ export async function action({ request }: ActionArgs) {);}- const supplierTypeId = insertSupplierType.data?.id;- if (!supplierTypeId) {- return json(- {},- await flash(- request,- error(insertSupplierType, "Failed to insert supplier type")- )- );- }-return redirect("/x/purchasing/supplier-types",await flash(request, success("Supplier type created"))diff --git a/apps/carbon/app/routes/x+/resources+/_layout.tsx b/apps/carbon/app/routes/x+/resources+/_layout.tsxindex b55fb47529..243ed5b12b 100644--- a/apps/carbon/app/routes/x+/resources+/_layout.tsx+++ b/apps/carbon/app/routes/x+/resources+/_layout.tsx@@ -12,7 +12,7 @@ export default function ResourcesRoute() {const { groups } = useResourcesSidebar();return (- <Grid w="full" h="full" templateColumns="auto 1fr" overflow="auto">+ <Grid w="full" h="full" templateColumns="auto 1fr"><GroupedContentSidebar groups={groups} /><VStack w="full" h="full" spacing={0}><Outlet />diff --git a/apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.$id.tsx b/apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.$id.tsxindex 138f1353f4..d5be2c7129 100644--- a/apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.$id.tsx+++ b/apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.$id.tsx@@ -3,7 +3,6 @@ import { redirect } from "@remix-run/node";import { useLoaderData, useNavigate, useParams } from "@remix-run/react";import { validationError } from "remix-validated-form";import { useRouteData } from "~/hooks";-import { EmployeeAbilityForm } from "~/modules/resources/interfaces/Abilities";import type { Ability } from "~/modules/resources";import {AbilityEmployeeStatus,@@ -12,6 +11,7 @@ import {getTrainingStatus,upsertEmployeeAbility,} from "~/modules/resources";+import { EmployeeAbilityForm } from "~/modules/resources/ui/Abilities";import { requirePermissions } from "~/services/auth";import { flash } from "~/services/session";import { error, success } from "~/utils/result";diff --git a/apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.new.tsx b/apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.new.tsxindex 023b4638f7..8a05d7da68 100644--- a/apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.new.tsx+++ b/apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.new.tsx@@ -3,14 +3,14 @@ import { redirect } from "@remix-run/node";import { useNavigate, useParams } from "@remix-run/react";import { validationError } from "remix-validated-form";import { useRouteData } from "~/hooks";-import { EmployeeAbilityForm } from "~/modules/resources/interfaces/Abilities";import type { Ability } from "~/modules/resources";-import { AbilityEmployeeStatus } from "~/modules/resources";-import { requirePermissions } from "~/services/auth";import {+ AbilityEmployeeStatus,employeeAbilityValidator,upsertEmployeeAbility,} from "~/modules/resources";+import { EmployeeAbilityForm } from "~/modules/resources/ui/Abilities";+import { requirePermissions } from "~/services/auth";import { flash } from "~/services/session";import { error, success } from "~/utils/result";diff --git a/apps/carbon/app/routes/x+/sales+/_layout.tsx b/apps/carbon/app/routes/x+/sales+/_layout.tsxindex 3c4eff24ff..91a86cc3a6 100644--- a/apps/carbon/app/routes/x+/sales+/_layout.tsx+++ b/apps/carbon/app/routes/x+/sales+/_layout.tsx@@ -12,7 +12,7 @@ export default function UsersRoute() {const { groups } = useSalesSidebar();return (- <Grid w="full" h="full" templateColumns="auto 1fr" overflow="auto">+ <Grid w="full" h="full" templateColumns="auto 1fr"><GroupedContentSidebar groups={groups} /><VStack w="full" h="full" spacing={0}><Outlet />diff --git a/apps/carbon/app/routes/x+/sales+/customer-types.$customerTypeId.tsx b/apps/carbon/app/routes/x+/sales+/customer-types.$customerTypeId.tsxindex 5c79495922..d923ca8bb4 100644--- a/apps/carbon/app/routes/x+/sales+/customer-types.$customerTypeId.tsx+++ b/apps/carbon/app/routes/x+/sales+/customer-types.$customerTypeId.tsx@@ -1,15 +1,14 @@import type { ActionArgs, LoaderArgs } from "@remix-run/node";-import { redirect } from "@remix-run/node";-import { json } from "@remix-run/node";+import { json, redirect } from "@remix-run/node";import { useLoaderData } from "@remix-run/react";import { validationError } from "remix-validated-form";-import { CustomerTypeForm } from "~/modules/sales";-import { requirePermissions } from "~/services/auth";import {+ CustomerTypeForm,customerTypeValidator,getCustomerType,upsertCustomerType,} from "~/modules/sales";+import { requirePermissions } from "~/services/auth";import { flash } from "~/services/session";import { assertIsPost, notFound } from "~/utils/http";import { error, success } from "~/utils/result";@@ -39,7 +38,7 @@ export async function loader({ request, params }: LoaderArgs) {export async function action({ request }: ActionArgs) {assertIsPost(request);- const { client } = await requirePermissions(request, {+ const { client, userId } = await requirePermissions(request, {update: "sales",});@@ -51,12 +50,13 @@ export async function action({ request }: ActionArgs) {return validationError(validation.error);}- const { id, name, color } = validation.data;+ const { id, ...data } = validation.data;+ if (!id) throw new Error("id is required");const updateCustomerType = await upsertCustomerType(client, {id,- name,- color: color || null,+ ...data,+ updatedBy: userId,});if (updateCustomerType.error) {diff --git a/apps/carbon/app/routes/x+/sales+/customer-types.new.tsx b/apps/carbon/app/routes/x+/sales+/customer-types.new.tsxindex fc5b4c4d0a..58d9b3d3e6 100644--- a/apps/carbon/app/routes/x+/sales+/customer-types.new.tsx+++ b/apps/carbon/app/routes/x+/sales+/customer-types.new.tsx@@ -1,6 +1,5 @@import type { ActionArgs, LoaderArgs } from "@remix-run/node";-import { redirect } from "@remix-run/node";-import { json } from "@remix-run/node";+import { json, redirect } from "@remix-run/node";import { validationError } from "remix-validated-form";import {CustomerTypeForm,@@ -22,7 +21,7 @@ export async function loader({ request }: LoaderArgs) {export async function action({ request }: ActionArgs) {assertIsPost(request);- const { client } = await requirePermissions(request, {+ const { client, userId } = await requirePermissions(request, {create: "sales",});@@ -34,11 +33,11 @@ export async function action({ request }: ActionArgs) {return validationError(validation.error);}- const { name, color } = validation.data;+ const { id, ...data } = validation.data;const insertCustomerType = await upsertCustomerType(client, {- name,- color: color || null,+ ...data,+ createdBy: userId,});if (insertCustomerType.error) {return json(@@ -50,17 +49,6 @@ export async function action({ request }: ActionArgs) {);}- const customerTypeId = insertCustomerType.data?.id;- if (!customerTypeId) {- return json(- {},- await flash(- request,- error(insertCustomerType, "Failed to insert customer type")- )- );- }-return redirect("/x/sales/customer-types",await flash(request, success("Customer type created"))diff --git a/apps/carbon/app/routes/x+/settings+/_layout.tsx b/apps/carbon/app/routes/x+/settings+/_layout.tsxindex a84132e373..514711e6c0 100644--- a/apps/carbon/app/routes/x+/settings+/_layout.tsx+++ b/apps/carbon/app/routes/x+/settings+/_layout.tsx@@ -12,7 +12,7 @@ export default function SettingsRoute() {const { groups } = useSettingsSidebar();return (- <Grid w="full" h="full" templateColumns="auto 1fr" overflow="auto">+ <Grid w="full" h="full" templateColumns="auto 1fr"><GroupedContentSidebar groups={groups} /><VStack w="full" h="full" spacing={0}><Outlet />diff --git a/apps/carbon/app/routes/x+/users+/_layout.tsx b/apps/carbon/app/routes/x+/users+/_layout.tsxindex cf0b145b73..b6612bcda7 100644--- a/apps/carbon/app/routes/x+/users+/_layout.tsx+++ b/apps/carbon/app/routes/x+/users+/_layout.tsx@@ -12,7 +12,7 @@ export default function UsersRoute() {const { groups } = useUsersSidebar();return (- <Grid w="full" h="full" templateColumns="auto 1fr" overflow="auto">+ <Grid w="full" h="full" templateColumns="auto 1fr"><GroupedContentSidebar groups={groups} /><VStack w="full" h="full" spacing={0}><Outlet />diff --git a/apps/carbon/app/utils/form.ts b/apps/carbon/app/utils/form.tsindex 0e85cfc2d8..5047f27a3f 100644--- a/apps/carbon/app/utils/form.ts+++ b/apps/carbon/app/utils/form.ts@@ -4,6 +4,9 @@ export const isValidEmail = (email: string) => {return emailRegex.test(email);};+/**+ * @deprecated Use regular map instead+ */export const mapRowsToOptions = <T extends Record<string, any>>({data,value,diff --git a/packages/carbon-database/src/types.ts b/packages/carbon-database/src/types.tsindex db9aaa7910..5d62898775 100644--- a/packages/carbon-database/src/types.ts+++ b/packages/carbon-database/src/types.ts@@ -250,6 +250,604 @@ export interface Database {}];};+ accountDefault: {+ Row: {+ accumulatedDepreciationAccount: string;+ accumulatedDepreciationOnDisposalAccount: string;+ assetAquisitionCostAccount: string;+ assetAquisitionCostOnDisposalAccount: string;+ assetDepreciationExpenseAccount: string;+ assetGainsAndLossesAccount: string;+ bankCashAccount: string;+ bankForeignCurrencyAccount: string;+ bankLocalCurrencyAccount: string;+ capacityVarianceAccount: string;+ costOfGoodsSoldAccount: string;+ customerPaymentDiscountAccount: string;+ directCostAppliedAccount: string;+ id: boolean;+ interestAccount: string;+ inventoryAccount: string;+ inventoryAdjustmentVarianceAccount: string;+ inventoryInterimAccrualAccount: string;+ inventoryReceivedNotInvoicedAccount: string;+ inventoryShippedNotInvoicedAccount: string;+ maintenanceAccount: string;+ materialVarianceAccount: string;+ overheadAccount: string;+ overheadCostAppliedAccount: string;+ payablesAccount: string;+ prepaymentAccount: string;+ purchaseAccount: string;+ purchaseTaxPayableAccount: string;+ purchaseVarianceAccount: string;+ receivablesAccount: string;+ retainedEarningsAccount: string;+ reverseChargeSalesTaxPayableAccount: string;+ roundingAccount: string;+ salesAccount: string;+ salesDiscountAccount: string;+ salesTaxPayableAccount: string;+ serviceChargeAccount: string;+ supplierPaymentDiscountAccount: string;+ updatedBy: string | null;+ workInProgressAccount: string;+ };+ Insert: {+ accumulatedDepreciationAccount: string;+ accumulatedDepreciationOnDisposalAccount: string;+ assetAquisitionCostAccount: string;+ assetAquisitionCostOnDisposalAccount: string;+ assetDepreciationExpenseAccount: string;+ assetGainsAndLossesAccount: string;+ bankCashAccount: string;+ bankForeignCurrencyAccount: string;+ bankLocalCurrencyAccount: string;+ capacityVarianceAccount: string;+ costOfGoodsSoldAccount: string;+ customerPaymentDiscountAccount: string;+ directCostAppliedAccount: string;+ id?: boolean;+ interestAccount: string;+ inventoryAccount: string;+ inventoryAdjustmentVarianceAccount: string;+ inventoryInterimAccrualAccount: string;+ inventoryReceivedNotInvoicedAccount: string;+ inventoryShippedNotInvoicedAccount: string;+ maintenanceAccount: string;+ materialVarianceAccount: string;+ overheadAccount: string;+ overheadCostAppliedAccount: string;+ payablesAccount: string;+ prepaymentAccount: string;+ purchaseAccount: string;+ purchaseTaxPayableAccount: string;+ purchaseVarianceAccount: string;+ receivablesAccount: string;+ retainedEarningsAccount: string;+ reverseChargeSalesTaxPayableAccount: string;+ roundingAccount: string;+ salesAccount: string;+ salesDiscountAccount: string;+ salesTaxPayableAccount: string;+ serviceChargeAccount: string;+ supplierPaymentDiscountAccount: string;+ updatedBy?: string | null;+ workInProgressAccount: string;+ };+ Update: {+ accumulatedDepreciationAccount?: string;+ accumulatedDepreciationOnDisposalAccount?: string;+ assetAquisitionCostAccount?: string;+ assetAquisitionCostOnDisposalAccount?: string;+ assetDepreciationExpenseAccount?: string;+ assetGainsAndLossesAccount?: string;+ bankCashAccount?: string;+ bankForeignCurrencyAccount?: string;+ bankLocalCurrencyAccount?: string;+ capacityVarianceAccount?: string;+ costOfGoodsSoldAccount?: string;+ customerPaymentDiscountAccount?: string;+ directCostAppliedAccount?: string;+ id?: boolean;+ interestAccount?: string;+ inventoryAccount?: string;+ inventoryAdjustmentVarianceAccount?: string;+ inventoryInterimAccrualAccount?: string;+ inventoryReceivedNotInvoicedAccount?: string;+ inventoryShippedNotInvoicedAccount?: string;+ maintenanceAccount?: string;+ materialVarianceAccount?: string;+ overheadAccount?: string;+ overheadCostAppliedAccount?: string;+ payablesAccount?: string;+ prepaymentAccount?: string;+ purchaseAccount?: string;+ purchaseTaxPayableAccount?: string;+ purchaseVarianceAccount?: string;+ receivablesAccount?: string;+ retainedEarningsAccount?: string;+ reverseChargeSalesTaxPayableAccount?: string;+ roundingAccount?: string;+ salesAccount?: string;+ salesDiscountAccount?: string;+ salesTaxPayableAccount?: string;+ serviceChargeAccount?: string;+ supplierPaymentDiscountAccount?: string;+ updatedBy?: string | null;+ workInProgressAccount?: string;+ };+ Relationships: [+ {+ foreignKeyName: "accountDefault_accumulatedDepreciationAccount_fkey";+ columns: ["accumulatedDepreciationAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_accumulatedDepreciationAccount_fkey";+ columns: ["accumulatedDepreciationAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_accumulatedDepreciationOnDisposalAccount_fkey";+ columns: ["accumulatedDepreciationOnDisposalAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_accumulatedDepreciationOnDisposalAccount_fkey";+ columns: ["accumulatedDepreciationOnDisposalAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_aquisitionCostAccount_fkey";+ columns: ["assetAquisitionCostAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_aquisitionCostAccount_fkey";+ columns: ["assetAquisitionCostAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_aquisitionCostOnDisposalAccount_fkey";+ columns: ["assetAquisitionCostOnDisposalAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_aquisitionCostOnDisposalAccount_fkey";+ columns: ["assetAquisitionCostOnDisposalAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_assetDepreciationExpenseAccount_fkey";+ columns: ["assetDepreciationExpenseAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_assetDepreciationExpenseAccount_fkey";+ columns: ["assetDepreciationExpenseAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_assetGainsAndLossesAccount_fkey";+ columns: ["assetGainsAndLossesAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_assetGainsAndLossesAccount_fkey";+ columns: ["assetGainsAndLossesAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_bankCashAccount_fkey";+ columns: ["bankCashAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_bankCashAccount_fkey";+ columns: ["bankCashAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_bankForeignCurrencyAccount_fkey";+ columns: ["bankForeignCurrencyAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_bankForeignCurrencyAccount_fkey";+ columns: ["bankForeignCurrencyAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_bankLocalCurrencyAccount_fkey";+ columns: ["bankLocalCurrencyAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_bankLocalCurrencyAccount_fkey";+ columns: ["bankLocalCurrencyAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_capacityVarianceAccount_fkey";+ columns: ["capacityVarianceAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_capacityVarianceAccount_fkey";+ columns: ["capacityVarianceAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_costOfGoodsSoldAccount_fkey";+ columns: ["costOfGoodsSoldAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_costOfGoodsSoldAccount_fkey";+ columns: ["costOfGoodsSoldAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_customerPaymentDiscountAccount_fkey";+ columns: ["customerPaymentDiscountAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_customerPaymentDiscountAccount_fkey";+ columns: ["customerPaymentDiscountAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_directCostAppliedAccount_fkey";+ columns: ["directCostAppliedAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_directCostAppliedAccount_fkey";+ columns: ["directCostAppliedAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_interestAccount_fkey";+ columns: ["interestAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_interestAccount_fkey";+ columns: ["interestAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_inventoryAccount_fkey";+ columns: ["inventoryAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_inventoryAccount_fkey";+ columns: ["inventoryAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_inventoryAdjustmentVarianceAccount_fkey";+ columns: ["inventoryAdjustmentVarianceAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_inventoryAdjustmentVarianceAccount_fkey";+ columns: ["inventoryAdjustmentVarianceAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_inventoryInterimAccrualAccount_fkey";+ columns: ["inventoryInterimAccrualAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_inventoryInterimAccrualAccount_fkey";+ columns: ["inventoryInterimAccrualAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_inventoryReceivedNotInvoicedAccount_fkey";+ columns: ["inventoryReceivedNotInvoicedAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_inventoryReceivedNotInvoicedAccount_fkey";+ columns: ["inventoryReceivedNotInvoicedAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_inventoryShippedNotInvoicedAccount_fkey";+ columns: ["inventoryShippedNotInvoicedAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_inventoryShippedNotInvoicedAccount_fkey";+ columns: ["inventoryShippedNotInvoicedAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_maintenanceAccount_fkey";+ columns: ["maintenanceAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_maintenanceAccount_fkey";+ columns: ["maintenanceAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_materialVarianceAccount_fkey";+ columns: ["materialVarianceAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_materialVarianceAccount_fkey";+ columns: ["materialVarianceAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_overheadAccount_fkey";+ columns: ["overheadAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_overheadAccount_fkey";+ columns: ["overheadAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_overheadCostAppliedAccount_fkey";+ columns: ["overheadCostAppliedAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_overheadCostAppliedAccount_fkey";+ columns: ["overheadCostAppliedAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_payablesAccount_fkey";+ columns: ["payablesAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_payablesAccount_fkey";+ columns: ["payablesAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_prepaymentAccount_fkey";+ columns: ["prepaymentAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_prepaymentAccount_fkey";+ columns: ["prepaymentAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_purchaseAccount_fkey";+ columns: ["purchaseAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_purchaseAccount_fkey";+ columns: ["purchaseAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_purchaseTaxPayableAccount_fkey";+ columns: ["purchaseTaxPayableAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_purchaseTaxPayableAccount_fkey";+ columns: ["purchaseTaxPayableAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_purchaseVarianceAccount_fkey";+ columns: ["purchaseVarianceAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_purchaseVarianceAccount_fkey";+ columns: ["purchaseVarianceAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_receivablesAccount_fkey";+ columns: ["receivablesAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_receivablesAccount_fkey";+ columns: ["receivablesAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_retainedEarningsAccount_fkey";+ columns: ["retainedEarningsAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_retainedEarningsAccount_fkey";+ columns: ["retainedEarningsAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_reverseChargeSalesTaxPayableAccount_fkey";+ columns: ["reverseChargeSalesTaxPayableAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_reverseChargeSalesTaxPayableAccount_fkey";+ columns: ["reverseChargeSalesTaxPayableAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_roundingAccount_fkey";+ columns: ["roundingAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_roundingAccount_fkey";+ columns: ["roundingAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_salesAccount_fkey";+ columns: ["salesAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_salesAccount_fkey";+ columns: ["salesAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_salesDiscountAccount_fkey";+ columns: ["salesDiscountAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_salesDiscountAccount_fkey";+ columns: ["salesDiscountAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_salesTaxPayableAccount_fkey";+ columns: ["salesTaxPayableAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_salesTaxPayableAccount_fkey";+ columns: ["salesTaxPayableAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_serviceChargeAccount_fkey";+ columns: ["serviceChargeAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_serviceChargeAccount_fkey";+ columns: ["serviceChargeAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_supplierPaymentDiscountAccount_fkey";+ columns: ["supplierPaymentDiscountAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_supplierPaymentDiscountAccount_fkey";+ columns: ["supplierPaymentDiscountAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_updatedBy_fkey";+ columns: ["updatedBy"];+ referencedRelation: "user";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "accountDefault_updatedBy_fkey";+ columns: ["updatedBy"];+ referencedRelation: "user_default_view";+ referencedColumns: ["userId"];+ },+ {+ foreignKeyName: "accountDefault_workInProgressAccount_fkey";+ columns: ["workInProgressAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "accountDefault_workInProgressAccount_fkey";+ columns: ["workInProgressAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ }+ ];+ };accountSubcategory: {Row: {accountCategoryId: string;@@ -983,28 +1581,59 @@ export interface Database {Row: {color: string | null;createdAt: string;+ createdBy: string;id: string;name: string;protected: boolean;updatedAt: string | null;+ updatedBy: string | null;};Insert: {color?: string | null;createdAt?: string;+ createdBy: string;id?: string;name: string;protected?: boolean;updatedAt?: string | null;+ updatedBy?: string | null;};Update: {color?: string | null;createdAt?: string;+ createdBy?: string;id?: string;name?: string;protected?: boolean;updatedAt?: string | null;+ updatedBy?: string | null;};- Relationships: [];+ Relationships: [+ {+ foreignKeyName: "customerType_createdBy_fkey";+ columns: ["createdBy"];+ referencedRelation: "user";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "customerType_createdBy_fkey";+ columns: ["createdBy"];+ referencedRelation: "user_default_view";+ referencedColumns: ["userId"];+ },+ {+ foreignKeyName: "customerType_updatedBy_fkey";+ columns: ["updatedBy"];+ referencedRelation: "user";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "customerType_updatedBy_fkey";+ columns: ["updatedBy"];+ referencedRelation: "user_default_view";+ referencedColumns: ["userId"];+ }+ ];};department: {Row: {@@ -2096,10 +2725,7 @@ export interface Database {costIsAdjusted: boolean;createdAt: string;createdBy: string;- discountAccountId: string | null;- inventoryAccountId: string | null;partId: string;- salesAccountId: string | null;standardCost: number;unitCost: number;updatedAt: string | null;@@ -2110,10 +2736,7 @@ export interface Database {costIsAdjusted?: boolean;createdAt?: string;createdBy: string;- discountAccountId?: string | null;- inventoryAccountId?: string | null;partId: string;- salesAccountId?: string | null;standardCost?: number;unitCost?: number;updatedAt?: string | null;@@ -2124,10 +2747,7 @@ export interface Database {costIsAdjusted?: boolean;createdAt?: string;createdBy?: string;- discountAccountId?: string | null;- inventoryAccountId?: string | null;partId?: string;- salesAccountId?: string | null;standardCost?: number;unitCost?: number;updatedAt?: string | null;@@ -2158,42 +2778,6 @@ export interface Database {referencedRelation: "user_default_view";referencedColumns: ["userId"];},- {- foreignKeyName: "partGroup_discountAccountId_fkey";- columns: ["discountAccountId"];- referencedRelation: "account";- referencedColumns: ["number"];- },- {- foreignKeyName: "partGroup_discountAccountId_fkey";- columns: ["discountAccountId"];- referencedRelation: "accounts_view";- referencedColumns: ["number"];- },- {- foreignKeyName: "partGroup_inventoryAccountId_fkey";- columns: ["inventoryAccountId"];- referencedRelation: "account";- referencedColumns: ["number"];- },- {- foreignKeyName: "partGroup_inventoryAccountId_fkey";- columns: ["inventoryAccountId"];- referencedRelation: "accounts_view";- referencedColumns: ["number"];- },- {- foreignKeyName: "partGroup_salesAccountId_fkey";- columns: ["salesAccountId"];- referencedRelation: "account";- referencedColumns: ["number"];- },- {- foreignKeyName: "partGroup_salesAccountId_fkey";- columns: ["salesAccountId"];- referencedRelation: "accounts_view";- referencedColumns: ["number"];- },{foreignKeyName: "partGroup_updatedBy_fkey";columns: ["updatedBy"];@@ -2211,104 +2795,35 @@ export interface Database {partGroup: {Row: {active: boolean;- costOfGoodsSoldLaborAccountId: string | null;- costOfGoodsSoldMaterialAccountId: string | null;- costOfGoodsSoldOverheadAccountId: string | null;- costOfGoodsSoldSubcontractorAccountId: string | null;createdAt: string;createdBy: string;description: string | null;- discountAccountId: string | null;id: string;- inventoryAccountId: string | null;name: string;- salesAccountId: string | null;updatedAt: string | null;updatedBy: string | null;};Insert: {active?: boolean;- costOfGoodsSoldLaborAccountId?: string | null;- costOfGoodsSoldMaterialAccountId?: string | null;- costOfGoodsSoldOverheadAccountId?: string | null;- costOfGoodsSoldSubcontractorAccountId?: string | null;createdAt?: string;createdBy: string;description?: string | null;- discountAccountId?: string | null;id?: string;- inventoryAccountId?: string | null;name: string;- salesAccountId?: string | null;updatedAt?: string | null;updatedBy?: string | null;};Update: {active?: boolean;- costOfGoodsSoldLaborAccountId?: string | null;- costOfGoodsSoldMaterialAccountId?: string | null;- costOfGoodsSoldOverheadAccountId?: string | null;- costOfGoodsSoldSubcontractorAccountId?: string | null;createdAt?: string;createdBy?: string;description?: string | null;- discountAccountId?: string | null;id?: string;- inventoryAccountId?: string | null;name?: string;- salesAccountId?: string | null;updatedAt?: string | null;updatedBy?: string | null;};- Relationships: [- {- foreignKeyName: "partGroup_costOfGoodsSoldLaborAccountId_fkey";- columns: ["costOfGoodsSoldLaborAccountId"];- referencedRelation: "account";- referencedColumns: ["number"];- },- {- foreignKeyName: "partGroup_costOfGoodsSoldLaborAccountId_fkey";- columns: ["costOfGoodsSoldLaborAccountId"];- referencedRelation: "accounts_view";- referencedColumns: ["number"];- },- {- foreignKeyName: "partGroup_costOfGoodsSoldMaterialAccountId_fkey";- columns: ["costOfGoodsSoldMaterialAccountId"];- referencedRelation: "account";- referencedColumns: ["number"];- },- {- foreignKeyName: "partGroup_costOfGoodsSoldMaterialAccountId_fkey";- columns: ["costOfGoodsSoldMaterialAccountId"];- referencedRelation: "accounts_view";- referencedColumns: ["number"];- },- {- foreignKeyName: "partGroup_costOfGoodsSoldOverheadAccountId_fkey";- columns: ["costOfGoodsSoldOverheadAccountId"];- referencedRelation: "account";- referencedColumns: ["number"];- },- {- foreignKeyName: "partGroup_costOfGoodsSoldOverheadAccountId_fkey";- columns: ["costOfGoodsSoldOverheadAccountId"];- referencedRelation: "accounts_view";- referencedColumns: ["number"];- },- {- foreignKeyName: "partGroup_costOfGoodsSoldSubcontractorAccountId_fkey";- columns: ["costOfGoodsSoldSubcontractorAccountId"];- referencedRelation: "account";- referencedColumns: ["number"];- },- {- foreignKeyName: "partGroup_costOfGoodsSoldSubcontractorAccountId_fkey";- columns: ["costOfGoodsSoldSubcontractorAccountId"];- referencedRelation: "accounts_view";- referencedColumns: ["number"];- },+ Relationships: [{foreignKeyName: "partGroup_createdBy_fkey";columns: ["createdBy"];@@ -2321,42 +2836,6 @@ export interface Database {referencedRelation: "user_default_view";referencedColumns: ["userId"];},- {- foreignKeyName: "partGroup_discountAccountId_fkey";- columns: ["discountAccountId"];- referencedRelation: "account";- referencedColumns: ["number"];- },- {- foreignKeyName: "partGroup_discountAccountId_fkey";- columns: ["discountAccountId"];- referencedRelation: "accounts_view";- referencedColumns: ["number"];- },- {- foreignKeyName: "partGroup_inventoryAccountId_fkey";- columns: ["inventoryAccountId"];- referencedRelation: "account";- referencedColumns: ["number"];- },- {- foreignKeyName: "partGroup_inventoryAccountId_fkey";- columns: ["inventoryAccountId"];- referencedRelation: "accounts_view";- referencedColumns: ["number"];- },- {- foreignKeyName: "partGroup_salesAccountId_fkey";- columns: ["salesAccountId"];- referencedRelation: "account";- referencedColumns: ["number"];- },- {- foreignKeyName: "partGroup_salesAccountId_fkey";- columns: ["salesAccountId"];- referencedRelation: "accounts_view";- referencedColumns: ["number"];- },{foreignKeyName: "partGroup_updatedBy_fkey";columns: ["updatedBy"];@@ -2798,380 +3277,869 @@ export interface Database {updatedBy: string | null;};Insert: {- conversionFactor?: number;+ conversionFactor?: number;+ createdAt?: string;+ createdBy: string;+ lotSize?: number | null;+ manufacturingBlocked?: boolean;+ manufacturingLeadTime?: number;+ manufacturingPolicy?: Database["public"]["Enums"]["partManufacturingPolicy"];+ partId: string;+ preferredSupplierId?: string | null;+ purchasingBlocked?: boolean;+ purchasingLeadTime?: number;+ purchasingUnitOfMeasureCode?: string | null;+ requiresConfiguration?: boolean;+ scrapPercentage?: number;+ updatedAt?: string | null;+ updatedBy?: string | null;+ };+ Update: {+ conversionFactor?: number;+ createdAt?: string;+ createdBy?: string;+ lotSize?: number | null;+ manufacturingBlocked?: boolean;+ manufacturingLeadTime?: number;+ manufacturingPolicy?: Database["public"]["Enums"]["partManufacturingPolicy"];+ partId?: string;+ preferredSupplierId?: string | null;+ purchasingBlocked?: boolean;+ purchasingLeadTime?: number;+ purchasingUnitOfMeasureCode?: string | null;+ requiresConfiguration?: boolean;+ scrapPercentage?: number;+ updatedAt?: string | null;+ updatedBy?: string | null;+ };+ Relationships: [+ {+ foreignKeyName: "partReplenishment_createdBy_fkey";+ columns: ["createdBy"];+ referencedRelation: "user";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "partReplenishment_createdBy_fkey";+ columns: ["createdBy"];+ referencedRelation: "user_default_view";+ referencedColumns: ["userId"];+ },+ {+ foreignKeyName: "partReplenishment_partId_fkey";+ columns: ["partId"];+ referencedRelation: "part";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "partReplenishment_partId_fkey";+ columns: ["partId"];+ referencedRelation: "parts_view";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "partReplenishment_preferredSupplierId_fkey";+ columns: ["preferredSupplierId"];+ referencedRelation: "supplier";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "partReplenishment_preferredSupplierId_fkey";+ columns: ["preferredSupplierId"];+ referencedRelation: "contractors_view";+ referencedColumns: ["supplierId"];+ },+ {+ foreignKeyName: "partReplenishment_preferredSupplierId_fkey";+ columns: ["preferredSupplierId"];+ referencedRelation: "partners_view";+ referencedColumns: ["supplierId"];+ },+ {+ foreignKeyName: "partReplenishment_preferredSupplierId_fkey";+ columns: ["preferredSupplierId"];+ referencedRelation: "purchase_order_suppliers_view";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "partReplenishment_preferredSupplierId_fkey";+ columns: ["preferredSupplierId"];+ referencedRelation: "suppliers_view";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "partReplenishment_purchaseUnitOfMeasureCode_fkey";+ columns: ["purchasingUnitOfMeasureCode"];+ referencedRelation: "unitOfMeasure";+ referencedColumns: ["code"];+ },+ {+ foreignKeyName: "partReplenishment_updatedBy_fkey";+ columns: ["updatedBy"];+ referencedRelation: "user";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "partReplenishment_updatedBy_fkey";+ columns: ["updatedBy"];+ referencedRelation: "user_default_view";+ referencedColumns: ["userId"];+ }+ ];+ };+ partSupplier: {+ Row: {+ active: boolean;+ conversionFactor: number;+ createdAt: string;+ createdBy: string;+ id: string;+ minimumOrderQuantity: number | null;+ partId: string;+ supplierId: string;+ supplierPartId: string | null;+ supplierUnitOfMeasureCode: string | null;+ updatedAt: string | null;+ updatedBy: string | null;+ };+ Insert: {+ active?: boolean;+ conversionFactor?: number;+ createdAt?: string;+ createdBy: string;+ id?: string;+ minimumOrderQuantity?: number | null;+ partId: string;+ supplierId: string;+ supplierPartId?: string | null;+ supplierUnitOfMeasureCode?: string | null;+ updatedAt?: string | null;+ updatedBy?: string | null;+ };+ Update: {+ active?: boolean;+ conversionFactor?: number;+ createdAt?: string;+ createdBy?: string;+ id?: string;+ minimumOrderQuantity?: number | null;+ partId?: string;+ supplierId?: string;+ supplierPartId?: string | null;+ supplierUnitOfMeasureCode?: string | null;+ updatedAt?: string | null;+ updatedBy?: string | null;+ };+ Relationships: [+ {+ foreignKeyName: "partSupplier_createdBy_fkey";+ columns: ["createdBy"];+ referencedRelation: "user";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "partSupplier_createdBy_fkey";+ columns: ["createdBy"];+ referencedRelation: "user_default_view";+ referencedColumns: ["userId"];+ },+ {+ foreignKeyName: "partSupplier_partId_fkey";+ columns: ["partId"];+ referencedRelation: "part";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "partSupplier_partId_fkey";+ columns: ["partId"];+ referencedRelation: "parts_view";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "partSupplier_supplierId_fkey";+ columns: ["supplierId"];+ referencedRelation: "supplier";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "partSupplier_supplierId_fkey";+ columns: ["supplierId"];+ referencedRelation: "contractors_view";+ referencedColumns: ["supplierId"];+ },+ {+ foreignKeyName: "partSupplier_supplierId_fkey";+ columns: ["supplierId"];+ referencedRelation: "partners_view";+ referencedColumns: ["supplierId"];+ },+ {+ foreignKeyName: "partSupplier_supplierId_fkey";+ columns: ["supplierId"];+ referencedRelation: "purchase_order_suppliers_view";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "partSupplier_supplierId_fkey";+ columns: ["supplierId"];+ referencedRelation: "suppliers_view";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "partSupplier_updatedBy_fkey";+ columns: ["updatedBy"];+ referencedRelation: "user";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "partSupplier_updatedBy_fkey";+ columns: ["updatedBy"];+ referencedRelation: "user_default_view";+ referencedColumns: ["userId"];+ }+ ];+ };+ partUnitSalePrice: {+ Row: {+ allowInvoiceDiscount: boolean;+ createdAt: string;+ createdBy: string;+ currencyCode: string;+ partId: string;+ priceIncludesTax: boolean;+ salesBlocked: boolean;+ salesUnitOfMeasureCode: string | null;+ unitSalePrice: number;+ updatedAt: string | null;+ updatedBy: string | null;+ };+ Insert: {+ allowInvoiceDiscount?: boolean;createdAt?: string;createdBy: string;- lotSize?: number | null;- manufacturingBlocked?: boolean;- manufacturingLeadTime?: number;- manufacturingPolicy?: Database["public"]["Enums"]["partManufacturingPolicy"];+ currencyCode: string;partId: string;- preferredSupplierId?: string | null;- purchasingBlocked?: boolean;- purchasingLeadTime?: number;- purchasingUnitOfMeasureCode?: string | null;- requiresConfiguration?: boolean;- scrapPercentage?: number;+ priceIncludesTax?: boolean;+ salesBlocked?: boolean;+ salesUnitOfMeasureCode?: string | null;+ unitSalePrice?: number;updatedAt?: string | null;updatedBy?: string | null;};Update: {- conversionFactor?: number;+ allowInvoiceDiscount?: boolean;createdAt?: string;createdBy?: string;- lotSize?: number | null;- manufacturingBlocked?: boolean;- manufacturingLeadTime?: number;- manufacturingPolicy?: Database["public"]["Enums"]["partManufacturingPolicy"];+ currencyCode?: string;partId?: string;- preferredSupplierId?: string | null;- purchasingBlocked?: boolean;- purchasingLeadTime?: number;- purchasingUnitOfMeasureCode?: string | null;- requiresConfiguration?: boolean;- scrapPercentage?: number;+ priceIncludesTax?: boolean;+ salesBlocked?: boolean;+ salesUnitOfMeasureCode?: string | null;+ unitSalePrice?: number;updatedAt?: string | null;updatedBy?: string | null;};Relationships: [{- foreignKeyName: "partReplenishment_createdBy_fkey";+ foreignKeyName: "partUnitSalePrice_createdBy_fkey";columns: ["createdBy"];referencedRelation: "user";referencedColumns: ["id"];},{- foreignKeyName: "partReplenishment_createdBy_fkey";+ foreignKeyName: "partUnitSalePrice_createdBy_fkey";columns: ["createdBy"];referencedRelation: "user_default_view";referencedColumns: ["userId"];},{- foreignKeyName: "partReplenishment_partId_fkey";+ foreignKeyName: "partUnitSalePrice_currencyCode_fkey";+ columns: ["currencyCode"];+ referencedRelation: "currency";+ referencedColumns: ["code"];+ },+ {+ foreignKeyName: "partUnitSalePrice_partId_fkey";columns: ["partId"];referencedRelation: "part";referencedColumns: ["id"];},{- foreignKeyName: "partReplenishment_partId_fkey";+ foreignKeyName: "partUnitSalePrice_partId_fkey";columns: ["partId"];referencedRelation: "parts_view";referencedColumns: ["id"];},{- foreignKeyName: "partReplenishment_preferredSupplierId_fkey";- columns: ["preferredSupplierId"];- referencedRelation: "supplier";- referencedColumns: ["id"];- },- {- foreignKeyName: "partReplenishment_preferredSupplierId_fkey";- columns: ["preferredSupplierId"];- referencedRelation: "contractors_view";- referencedColumns: ["supplierId"];- },- {- foreignKeyName: "partReplenishment_preferredSupplierId_fkey";- columns: ["preferredSupplierId"];- referencedRelation: "partners_view";- referencedColumns: ["supplierId"];- },- {- foreignKeyName: "partReplenishment_preferredSupplierId_fkey";- columns: ["preferredSupplierId"];- referencedRelation: "purchase_order_suppliers_view";- referencedColumns: ["id"];- },- {- foreignKeyName: "partReplenishment_preferredSupplierId_fkey";- columns: ["preferredSupplierId"];- referencedRelation: "suppliers_view";- referencedColumns: ["id"];- },- {- foreignKeyName: "partReplenishment_purchaseUnitOfMeasureCode_fkey";- columns: ["purchasingUnitOfMeasureCode"];+ foreignKeyName: "partUnitSalePrice_salesUnitOfMeasureId_fkey";+ columns: ["salesUnitOfMeasureCode"];referencedRelation: "unitOfMeasure";referencedColumns: ["code"];},{- foreignKeyName: "partReplenishment_updatedBy_fkey";+ foreignKeyName: "partUnitSalePrice_updatedBy_fkey";columns: ["updatedBy"];referencedRelation: "user";referencedColumns: ["id"];},{- foreignKeyName: "partReplenishment_updatedBy_fkey";+ foreignKeyName: "partUnitSalePrice_updatedBy_fkey";columns: ["updatedBy"];referencedRelation: "user_default_view";referencedColumns: ["userId"];}];};- partSupplier: {+ paymentTerm: {Row: {active: boolean;- conversionFactor: number;+ calculationMethod: Database["public"]["Enums"]["paymentTermCalculationMethod"];createdAt: string;createdBy: string;+ daysDiscount: number;+ daysDue: number;+ discountPercentage: number;id: string;- minimumOrderQuantity: number | null;- partId: string;- supplierId: string;- supplierPartId: string | null;- supplierUnitOfMeasureCode: string | null;+ name: string;updatedAt: string | null;updatedBy: string | null;};Insert: {active?: boolean;- conversionFactor?: number;+ calculationMethod?: Database["public"]["Enums"]["paymentTermCalculationMethod"];createdAt?: string;createdBy: string;+ daysDiscount?: number;+ daysDue?: number;+ discountPercentage?: number;id?: string;- minimumOrderQuantity?: number | null;- partId: string;- supplierId: string;- supplierPartId?: string | null;- supplierUnitOfMeasureCode?: string | null;+ name: string;updatedAt?: string | null;updatedBy?: string | null;};Update: {active?: boolean;- conversionFactor?: number;+ calculationMethod?: Database["public"]["Enums"]["paymentTermCalculationMethod"];createdAt?: string;createdBy?: string;+ daysDiscount?: number;+ daysDue?: number;+ discountPercentage?: number;id?: string;- minimumOrderQuantity?: number | null;- partId?: string;- supplierId?: string;- supplierPartId?: string | null;- supplierUnitOfMeasureCode?: string | null;+ name?: string;updatedAt?: string | null;updatedBy?: string | null;};Relationships: [{- foreignKeyName: "partSupplier_createdBy_fkey";+ foreignKeyName: "paymentTerm_createdBy_fkey";columns: ["createdBy"];referencedRelation: "user";referencedColumns: ["id"];},{- foreignKeyName: "partSupplier_createdBy_fkey";+ foreignKeyName: "paymentTerm_createdBy_fkey";columns: ["createdBy"];referencedRelation: "user_default_view";referencedColumns: ["userId"];},{- foreignKeyName: "partSupplier_partId_fkey";- columns: ["partId"];- referencedRelation: "part";+ foreignKeyName: "paymentTerm_updatedBy_fkey";+ columns: ["updatedBy"];+ referencedRelation: "user";referencedColumns: ["id"];},{- foreignKeyName: "partSupplier_partId_fkey";- columns: ["partId"];- referencedRelation: "parts_view";- referencedColumns: ["id"];+ foreignKeyName: "paymentTerm_updatedBy_fkey";+ columns: ["updatedBy"];+ referencedRelation: "user_default_view";+ referencedColumns: ["userId"];+ }+ ];+ };+ postingGroupInventory: {+ Row: {+ capacityVarianceAccount: string;+ costOfGoodsSoldAccount: string;+ directCostAppliedAccount: string;+ id: string;+ inventoryAccount: string;+ inventoryAdjustmentVarianceAccount: string;+ inventoryInterimAccrualAccount: string;+ inventoryReceivedNotInvoicedAccount: string;+ inventoryShippedNotInvoicedAccount: string;+ locationId: string | null;+ materialVarianceAccount: string;+ overheadAccount: string;+ overheadCostAppliedAccount: string;+ partGroupId: string | null;+ purchaseVarianceAccount: string;+ updatedBy: string | null;+ workInProgressAccount: string;+ };+ Insert: {+ capacityVarianceAccount: string;+ costOfGoodsSoldAccount: string;+ directCostAppliedAccount: string;+ id?: string;+ inventoryAccount: string;+ inventoryAdjustmentVarianceAccount: string;+ inventoryInterimAccrualAccount: string;+ inventoryReceivedNotInvoicedAccount: string;+ inventoryShippedNotInvoicedAccount: string;+ locationId?: string | null;+ materialVarianceAccount: string;+ overheadAccount: string;+ overheadCostAppliedAccount: string;+ partGroupId?: string | null;+ purchaseVarianceAccount: string;+ updatedBy?: string | null;+ workInProgressAccount: string;+ };+ Update: {+ capacityVarianceAccount?: string;+ costOfGoodsSoldAccount?: string;+ directCostAppliedAccount?: string;+ id?: string;+ inventoryAccount?: string;+ inventoryAdjustmentVarianceAccount?: string;+ inventoryInterimAccrualAccount?: string;+ inventoryReceivedNotInvoicedAccount?: string;+ inventoryShippedNotInvoicedAccount?: string;+ locationId?: string | null;+ materialVarianceAccount?: string;+ overheadAccount?: string;+ overheadCostAppliedAccount?: string;+ partGroupId?: string | null;+ purchaseVarianceAccount?: string;+ updatedBy?: string | null;+ workInProgressAccount?: string;+ };+ Relationships: [+ {+ foreignKeyName: "postingGroupInventory_capacityVarianceAccount_fkey";+ columns: ["capacityVarianceAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];},{- foreignKeyName: "partSupplier_supplierId_fkey";- columns: ["supplierId"];- referencedRelation: "supplier";+ foreignKeyName: "postingGroupInventory_capacityVarianceAccount_fkey";+ columns: ["capacityVarianceAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupInventory_costOfGoodsSoldAccount_fkey";+ columns: ["costOfGoodsSoldAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupInventory_costOfGoodsSoldAccount_fkey";+ columns: ["costOfGoodsSoldAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupInventory_directCostAppliedAccount_fkey";+ columns: ["directCostAppliedAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupInventory_directCostAppliedAccount_fkey";+ columns: ["directCostAppliedAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupInventory_inventoryAccount_fkey";+ columns: ["inventoryAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupInventory_inventoryAccount_fkey";+ columns: ["inventoryAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupInventory_inventoryAdjustmentVarianceAccount_fkey";+ columns: ["inventoryAdjustmentVarianceAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupInventory_inventoryAdjustmentVarianceAccount_fkey";+ columns: ["inventoryAdjustmentVarianceAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupInventory_inventoryInterimAccrualAccount_fkey";+ columns: ["inventoryInterimAccrualAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupInventory_inventoryInterimAccrualAccount_fkey";+ columns: ["inventoryInterimAccrualAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupInventory_inventoryReceivedNotInvoicedAccount_fkey";+ columns: ["inventoryReceivedNotInvoicedAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupInventory_inventoryReceivedNotInvoicedAccount_fkey";+ columns: ["inventoryReceivedNotInvoicedAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupInventory_inventoryShippedNotInvoicedAccount_fkey";+ columns: ["inventoryShippedNotInvoicedAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupInventory_inventoryShippedNotInvoicedAccount_fkey";+ columns: ["inventoryShippedNotInvoicedAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupInventory_locationId_fkey";+ columns: ["locationId"];+ referencedRelation: "location";referencedColumns: ["id"];},{- foreignKeyName: "partSupplier_supplierId_fkey";- columns: ["supplierId"];- referencedRelation: "contractors_view";- referencedColumns: ["supplierId"];+ foreignKeyName: "postingGroupInventory_locationId_fkey";+ columns: ["locationId"];+ referencedRelation: "purchase_order_view";+ referencedColumns: ["locationId"];+ },+ {+ foreignKeyName: "postingGroupInventory_materialVarianceAccount_fkey";+ columns: ["materialVarianceAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupInventory_materialVarianceAccount_fkey";+ columns: ["materialVarianceAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupInventory_overheadAccount_fkey";+ columns: ["overheadAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupInventory_overheadAccount_fkey";+ columns: ["overheadAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupInventory_overheadCostAppliedAccount_fkey";+ columns: ["overheadCostAppliedAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];},{- foreignKeyName: "partSupplier_supplierId_fkey";- columns: ["supplierId"];- referencedRelation: "partners_view";- referencedColumns: ["supplierId"];+ foreignKeyName: "postingGroupInventory_overheadCostAppliedAccount_fkey";+ columns: ["overheadCostAppliedAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];},{- foreignKeyName: "partSupplier_supplierId_fkey";- columns: ["supplierId"];- referencedRelation: "purchase_order_suppliers_view";+ foreignKeyName: "postingGroupInventory_partGroupId_fkey";+ columns: ["partGroupId"];+ referencedRelation: "partGroup";referencedColumns: ["id"];},{- foreignKeyName: "partSupplier_supplierId_fkey";- columns: ["supplierId"];- referencedRelation: "suppliers_view";- referencedColumns: ["id"];+ foreignKeyName: "postingGroupInventory_purchaseVarianceAccount_fkey";+ columns: ["purchaseVarianceAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];},{- foreignKeyName: "partSupplier_updatedBy_fkey";+ foreignKeyName: "postingGroupInventory_purchaseVarianceAccount_fkey";+ columns: ["purchaseVarianceAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupInventory_updatedBy_fkey";columns: ["updatedBy"];referencedRelation: "user";referencedColumns: ["id"];},{- foreignKeyName: "partSupplier_updatedBy_fkey";+ foreignKeyName: "postingGroupInventory_updatedBy_fkey";columns: ["updatedBy"];referencedRelation: "user_default_view";referencedColumns: ["userId"];+ },+ {+ foreignKeyName: "postingGroupInventory_workInProgressAccount_fkey";+ columns: ["workInProgressAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupInventory_workInProgressAccount_fkey";+ columns: ["workInProgressAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];}];};- partUnitSalePrice: {+ postingGroupPurchasing: {Row: {- allowInvoiceDiscount: boolean;- createdAt: string;- createdBy: string;- currencyCode: string;- partId: string;- priceIncludesTax: boolean;- salesBlocked: boolean;- salesUnitOfMeasureCode: string | null;- unitSalePrice: number;- updatedAt: string | null;+ id: string;+ partGroupId: string | null;+ purchaseAccount: string;+ purchaseCreditAccount: string;+ purchaseDiscountAccount: string;+ purchasePrepaymentAccount: string;+ purchaseTaxPayableAccount: string;+ supplierTypeId: string | null;updatedBy: string | null;};Insert: {- allowInvoiceDiscount?: boolean;- createdAt?: string;- createdBy: string;- currencyCode: string;- partId: string;- priceIncludesTax?: boolean;- salesBlocked?: boolean;- salesUnitOfMeasureCode?: string | null;- unitSalePrice?: number;- updatedAt?: string | null;+ id?: string;+ partGroupId?: string | null;+ purchaseAccount: string;+ purchaseCreditAccount: string;+ purchaseDiscountAccount: string;+ purchasePrepaymentAccount: string;+ purchaseTaxPayableAccount: string;+ supplierTypeId?: string | null;updatedBy?: string | null;};Update: {- allowInvoiceDiscount?: boolean;- createdAt?: string;- createdBy?: string;- currencyCode?: string;- partId?: string;- priceIncludesTax?: boolean;- salesBlocked?: boolean;- salesUnitOfMeasureCode?: string | null;- unitSalePrice?: number;- updatedAt?: string | null;+ id?: string;+ partGroupId?: string | null;+ purchaseAccount?: string;+ purchaseCreditAccount?: string;+ purchaseDiscountAccount?: string;+ purchasePrepaymentAccount?: string;+ purchaseTaxPayableAccount?: string;+ supplierTypeId?: string | null;updatedBy?: string | null;};Relationships: [{- foreignKeyName: "partUnitSalePrice_createdBy_fkey";- columns: ["createdBy"];- referencedRelation: "user";+ foreignKeyName: "postingGroupPurchasing_partGroupId_fkey";+ columns: ["partGroupId"];+ referencedRelation: "partGroup";referencedColumns: ["id"];},{- foreignKeyName: "partUnitSalePrice_createdBy_fkey";- columns: ["createdBy"];- referencedRelation: "user_default_view";- referencedColumns: ["userId"];+ foreignKeyName: "postingGroupPurchasing_purchaseAccount_fkey";+ columns: ["purchaseAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];},{- foreignKeyName: "partUnitSalePrice_currencyCode_fkey";- columns: ["currencyCode"];- referencedRelation: "currency";- referencedColumns: ["code"];+ foreignKeyName: "postingGroupPurchasing_purchaseAccount_fkey";+ columns: ["purchaseAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];},{- foreignKeyName: "partUnitSalePrice_partId_fkey";- columns: ["partId"];- referencedRelation: "part";- referencedColumns: ["id"];+ foreignKeyName: "postingGroupPurchasing_purchaseCreditAccount_fkey";+ columns: ["purchaseCreditAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];},{- foreignKeyName: "partUnitSalePrice_partId_fkey";- columns: ["partId"];- referencedRelation: "parts_view";- referencedColumns: ["id"];+ foreignKeyName: "postingGroupPurchasing_purchaseCreditAccount_fkey";+ columns: ["purchaseCreditAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];},{- foreignKeyName: "partUnitSalePrice_salesUnitOfMeasureId_fkey";- columns: ["salesUnitOfMeasureCode"];- referencedRelation: "unitOfMeasure";- referencedColumns: ["code"];+ foreignKeyName: "postingGroupPurchasing_purchaseDiscountAccount_fkey";+ columns: ["purchaseDiscountAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];},{- foreignKeyName: "partUnitSalePrice_updatedBy_fkey";+ foreignKeyName: "postingGroupPurchasing_purchaseDiscountAccount_fkey";+ columns: ["purchaseDiscountAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupPurchasing_purchasePrepaymentAccount_fkey";+ columns: ["purchasePrepaymentAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupPurchasing_purchasePrepaymentAccount_fkey";+ columns: ["purchasePrepaymentAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupPurchasing_purchaseTaxPayableAccount_fkey";+ columns: ["purchaseTaxPayableAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupPurchasing_purchaseTaxPayableAccount_fkey";+ columns: ["purchaseTaxPayableAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupPurchasing_supplierTypeId_fkey";+ columns: ["supplierTypeId"];+ referencedRelation: "supplierType";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "postingGroupPurchasing_updatedBy_fkey";columns: ["updatedBy"];referencedRelation: "user";referencedColumns: ["id"];},{- foreignKeyName: "partUnitSalePrice_updatedBy_fkey";+ foreignKeyName: "postingGroupPurchasing_updatedBy_fkey";columns: ["updatedBy"];referencedRelation: "user_default_view";referencedColumns: ["userId"];}];};- paymentTerm: {+ postingGroupSales: {Row: {- active: boolean;- calculationMethod: Database["public"]["Enums"]["paymentTermCalculationMethod"];- createdAt: string;- createdBy: string;- daysDiscount: number;- daysDue: number;- discountPercentage: number;+ customerTypeId: string | null;id: string;- name: string;- updatedAt: string | null;+ partGroupId: string | null;+ salesAccount: string;+ salesCreditAccount: string;+ salesDiscountAccount: string;+ salesPrepaymentAccount: string;+ salesTaxPayableAccount: string;updatedBy: string | null;};Insert: {- active?: boolean;- calculationMethod?: Database["public"]["Enums"]["paymentTermCalculationMethod"];- createdAt?: string;- createdBy: string;- daysDiscount?: number;- daysDue?: number;- discountPercentage?: number;+ customerTypeId?: string | null;id?: string;- name: string;- updatedAt?: string | null;+ partGroupId?: string | null;+ salesAccount: string;+ salesCreditAccount: string;+ salesDiscountAccount: string;+ salesPrepaymentAccount: string;+ salesTaxPayableAccount: string;updatedBy?: string | null;};Update: {- active?: boolean;- calculationMethod?: Database["public"]["Enums"]["paymentTermCalculationMethod"];- createdAt?: string;- createdBy?: string;- daysDiscount?: number;- daysDue?: number;- discountPercentage?: number;+ customerTypeId?: string | null;id?: string;- name?: string;- updatedAt?: string | null;+ partGroupId?: string | null;+ salesAccount?: string;+ salesCreditAccount?: string;+ salesDiscountAccount?: string;+ salesPrepaymentAccount?: string;+ salesTaxPayableAccount?: string;updatedBy?: string | null;};Relationships: [{- foreignKeyName: "paymentTerm_createdBy_fkey";- columns: ["createdBy"];- referencedRelation: "user";+ foreignKeyName: "postingGroupSales_customerTypeId_fkey";+ columns: ["customerTypeId"];+ referencedRelation: "customerType";referencedColumns: ["id"];},{- foreignKeyName: "paymentTerm_createdBy_fkey";- columns: ["createdBy"];- referencedRelation: "user_default_view";- referencedColumns: ["userId"];+ foreignKeyName: "postingGroupSales_partGroupId_fkey";+ columns: ["partGroupId"];+ referencedRelation: "partGroup";+ referencedColumns: ["id"];},{- foreignKeyName: "paymentTerm_updatedBy_fkey";+ foreignKeyName: "postingGroupSales_salesAccount_fkey";+ columns: ["salesAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupSales_salesAccount_fkey";+ columns: ["salesAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupSales_salesCreditAccount_fkey";+ columns: ["salesCreditAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupSales_salesCreditAccount_fkey";+ columns: ["salesCreditAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupSales_salesDiscountAccount_fkey";+ columns: ["salesDiscountAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupSales_salesDiscountAccount_fkey";+ columns: ["salesDiscountAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupSales_salesPrepaymentAccount_fkey";+ columns: ["salesPrepaymentAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupSales_salesPrepaymentAccount_fkey";+ columns: ["salesPrepaymentAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupSales_salesTaxPayableAccount_fkey";+ columns: ["salesTaxPayableAccount"];+ referencedRelation: "account";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupSales_salesTaxPayableAccount_fkey";+ columns: ["salesTaxPayableAccount"];+ referencedRelation: "accounts_view";+ referencedColumns: ["number"];+ },+ {+ foreignKeyName: "postingGroupSales_updatedBy_fkey";columns: ["updatedBy"];referencedRelation: "user";referencedColumns: ["id"];},{- foreignKeyName: "paymentTerm_updatedBy_fkey";+ foreignKeyName: "postingGroupSales_updatedBy_fkey";columns: ["updatedBy"];referencedRelation: "user_default_view";referencedColumns: ["userId"];@@ -4681,28 +5649,59 @@ export interface Database {Row: {color: string | null;createdAt: string;+ createdBy: string;id: string;name: string;protected: boolean;updatedAt: string | null;+ updatedBy: string | null;};Insert: {color?: string | null;createdAt?: string;+ createdBy: string;id?: string;name: string;protected?: boolean;updatedAt?: string | null;+ updatedBy?: string | null;};Update: {color?: string | null;createdAt?: string;+ createdBy?: string;id?: string;name?: string;protected?: boolean;updatedAt?: string | null;+ updatedBy?: string | null;};- Relationships: [];+ Relationships: [+ {+ foreignKeyName: "supplierType_createdBy_fkey";+ columns: ["createdBy"];+ referencedRelation: "user";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierType_createdBy_fkey";+ columns: ["createdBy"];+ referencedRelation: "user_default_view";+ referencedColumns: ["userId"];+ },+ {+ foreignKeyName: "supplierType_updatedBy_fkey";+ columns: ["updatedBy"];+ referencedRelation: "user";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierType_updatedBy_fkey";+ columns: ["updatedBy"];+ referencedRelation: "user_default_view";+ referencedColumns: ["userId"];+ }+ ];};unitOfMeasure: {Row: {diff --git a/packages/carbon-database/supabase/migrations/20230123004316_users.sql b/packages/carbon-database/supabase/migrations/20230123004316_users.sqlindex 36773ad706..4c2b26b75e 100644--- a/packages/carbon-database/supabase/migrations/20230123004316_users.sql+++ b/packages/carbon-database/supabase/migrations/20230123004316_users.sql@@ -14,9 +14,6 @@ CREATE TABLE "user" (CONSTRAINT "user_pkey" PRIMARY KEY ("id"));-INSERT INTO "user" ("id", "email", "firstName", "lastName")-VALUES ('system', '[email protected]', 'System', 'Operation');-CREATE UNIQUE INDEX "index_user_email_key" ON "user"("email");CREATE INDEX "index_user_fullName" ON "user"("fullName");diff --git a/packages/carbon-database/supabase/migrations/20230123004536_attributes.sql b/packages/carbon-database/supabase/migrations/20230123004536_attributes.sqlindex 917c3975a0..2c093d8fb0 100644--- a/packages/carbon-database/supabase/migrations/20230123004536_attributes.sql+++ b/packages/carbon-database/supabase/migrations/20230123004536_attributes.sql@@ -80,16 +80,6 @@ CREATE TABLE "attributeDataType" ());-INSERT INTO "attributeDataType" ("label", "isBoolean", "isDate", "isList", "isNumeric", "isText", "isUser")-VALUES- ('Yes/No', true, false, false, false, false, false),- ('Date', false, true, false, false, false, false),- ('List', false, false, true, false, false, false),- ('Numeric', false, false, false, true, false, false),- ('Text', false, false, false, false, true, false),- ('User', false, false, false, false, false, true);---- ALTER TABLE "attributeDataType" ENABLE ROW LEVEL SECURITY;CREATE TABLE "userAttribute" (diff --git a/packages/carbon-database/supabase/migrations/20230123004612_suppliers-and-customers.sql b/packages/carbon-database/supabase/migrations/20230123004612_suppliers-and-customers.sqlindex 122b497812..f09509a6d0 100644--- a/packages/carbon-database/supabase/migrations/20230123004612_suppliers-and-customers.sql+++ b/packages/carbon-database/supabase/migrations/20230123004612_suppliers-and-customers.sql@@ -49,21 +49,25 @@ CREATE TABLE "supplierStatus" ("createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"updatedAt" TIMESTAMP WITH TIME ZONE,- CONSTRAINT "supplierStatus_pkey" PRIMARY KEY ("id")+ CONSTRAINT "supplierStatus_pkey" PRIMARY KEY ("id"),+ CONSTRAINT "supplierStatus_name_unique" UNIQUE ("name"));-INSERT INTO "supplierStatus" ("name") VALUES ('Active'), ('Inactive'), ('Pending'), ('Rejected');-CREATE TABLE "supplierType" ("id" TEXT NOT NULL DEFAULT uuid_generate_v4(),"name" TEXT NOT NULL,"color" TEXT DEFAULT '#000000',"protected" BOOLEAN NOT NULL DEFAULT false,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),+ "createdBy" TEXT NOT NULL,+ "updatedBy" TEXT,"updatedAt" TIMESTAMP WITH TIME ZONE,CONSTRAINT "supplierType_pkey" PRIMARY KEY ("id"),- CONSTRAINT "supplierType_colorCheck" CHECK ("color" is null or "color" ~* '^#[a-f0-9]{6}$')+ CONSTRAINT "supplierType_name_unique" UNIQUE ("name"),+ CONSTRAINT "supplierType_colorCheck" CHECK ("color" is null or "color" ~* '^#[a-f0-9]{6}$'),+ CONSTRAINT "supplierType_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "user"("id") ON UPDATE CASCADE ON DELETE RESTRICT,+ CONSTRAINT "supplierType_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user"("id") ON UPDATE CASCADE ON DELETE SET NULL);CREATE TABLE "supplier" (@@ -131,21 +135,25 @@ CREATE TABLE "customerStatus" ("createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"updatedAt" TIMESTAMP WITH TIME ZONE,- CONSTRAINT "customerStatus_pkey" PRIMARY KEY ("id")+ CONSTRAINT "customerStatus_pkey" PRIMARY KEY ("id"),+ CONSTRAINT "customerStatus_name_unique" UNIQUE ("name"));-INSERT INTO "customerStatus" ("name") VALUES ('Active'), ('Inactive'), ('Prospect'), ('Lead'), ('On Hold'), ('Cancelled'), ('Archived');-CREATE TABLE "customerType" ("id" TEXT NOT NULL DEFAULT uuid_generate_v4(),"name" TEXT NOT NULL,"color" TEXT DEFAULT '#000000',"protected" BOOLEAN NOT NULL DEFAULT false,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),+ "createdBy" TEXT NOT NULL,+ "updatedBy" TEXT,"updatedAt" TIMESTAMP WITH TIME ZONE,CONSTRAINT "customerType_pkey" PRIMARY KEY ("id"),- CONSTRAINT "customerType_colorCheck" CHECK ("color" is null or "color" ~* '^#[a-f0-9]{6}$')+ CONSTRAINT "customerType_name_unique" UNIQUE ("name"),+ CONSTRAINT "customerType_colorCheck" CHECK ("color" is null or "color" ~* '^#[a-f0-9]{6}$'),+ CONSTRAINT "customerType_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "user"("id") ON UPDATE CASCADE ON DELETE RESTRICT,+ CONSTRAINT "customerType_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user"("id") ON UPDATE CASCADE ON DELETE SET NULL);CREATE TABLE "customer" (diff --git a/packages/carbon-database/supabase/migrations/20230330024715_accounts.sql b/packages/carbon-database/supabase/migrations/20230330024715_accounts.sqlindex 42ac4f239e..20120238d8 100644--- a/packages/carbon-database/supabase/migrations/20230330024715_accounts.sql+++ b/packages/carbon-database/supabase/migrations/20230330024715_accounts.sql@@ -18,9 +18,6 @@ CREATE TABLE "currency" (CONSTRAINT "currency_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user"("id"));-INSERT INTO "currency" ("name", "code", "symbol", "exchangeRate", "isBaseCurrency", "createdBy")-VALUES ('US Dollar', 'USD', '$', 1.0000, true, 'system');-CREATE INDEX "currency_code_index" ON "currency" ("code");ALTER TABLE "currency" ENABLE ROW LEVEL SECURITY;@@ -108,27 +105,6 @@ CREATE TABLE "accountCategory" (CONSTRAINT "accountCategory_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user"("id"));-INSERT INTO "accountCategory" ("category", "incomeBalance", "normalBalance", "createdBy")-VALUES- ('Bank', 'Balance Sheet', 'Credit', 'system'),- ('Accounts Receivable', 'Balance Sheet', 'Credit', 'system'),- ('Inventory', 'Balance Sheet', 'Debit', 'system'),- ('Other Current Asset', 'Balance Sheet', 'Debit', 'system'),- ('Fixed Asset', 'Balance Sheet', 'Debit', 'system'),- ('Accumulated Depreciation', 'Balance Sheet', 'Credit', 'system'),- ('Other Asset', 'Balance Sheet', 'Debit', 'system'),- ('Accounts Payable', 'Balance Sheet', 'Debit', 'system'),- ('Other Current Liability', 'Balance Sheet', 'Debit', 'system'),- ('Long Term Liability', 'Balance Sheet', 'Debit', 'system'),- ('Equity - No Close', 'Balance Sheet', 'Credit', 'system'),- ('Equity - Close', 'Balance Sheet', 'Credit', 'system'),- ('Retained Earnings', 'Balance Sheet', 'Credit', 'system'),- ('Income', 'Income Statement', 'Credit', 'system'),- ('Cost of Goods Sold', 'Income Statement', 'Debit', 'system'),- ('Expense', 'Income Statement', 'Debit', 'system'),- ('Other Income', 'Income Statement', 'Credit', 'system'),- ('Other Expense', 'Income Statement', 'Debit', 'system');-ALTER TABLE "accountCategory" ENABLE ROW LEVEL SECURITY;CREATE POLICY "Employees with accounting_view can view account categories" ON "accountCategory"diff --git a/packages/carbon-database/supabase/migrations/20230330024716_parts.sql b/packages/carbon-database/supabase/migrations/20230330024716_parts.sqlindex 0b4d735438..4b63714d5d 100644--- a/packages/carbon-database/supabase/migrations/20230330024716_parts.sql+++ b/packages/carbon-database/supabase/migrations/20230330024716_parts.sql@@ -2,13 +2,6 @@ CREATE TABLE "partGroup" ("id" TEXT NOT NULL DEFAULT xid(),"name" TEXT NOT NULL,"description" TEXT,- "salesAccountId" TEXT,- "discountAccountId" TEXT,- "inventoryAccountId" TEXT,- "costOfGoodsSoldLaborAccountId" TEXT,- "costOfGoodsSoldMaterialAccountId" TEXT,- "costOfGoodsSoldOverheadAccountId" TEXT,- "costOfGoodsSoldSubcontractorAccountId" TEXT,"active" BOOLEAN NOT NULL DEFAULT true,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),@@ -17,13 +10,6 @@ CREATE TABLE "partGroup" (CONSTRAINT "partGroup_pkey" PRIMARY KEY ("id"),CONSTRAINT "partGroup_name_key" UNIQUE ("name"),- CONSTRAINT "partGroup_salesAccountId_fkey" FOREIGN KEY ("salesAccountId") REFERENCES "account"("number") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "partGroup_discountAccountId_fkey" FOREIGN KEY ("discountAccountId") REFERENCES "account"("number") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "partGroup_inventoryAccountId_fkey" FOREIGN KEY ("inventoryAccountId") REFERENCES "account"("number") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "partGroup_costOfGoodsSoldLaborAccountId_fkey" FOREIGN KEY ("costOfGoodsSoldLaborAccountId") REFERENCES "account"("number") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "partGroup_costOfGoodsSoldMaterialAccountId_fkey" FOREIGN KEY ("costOfGoodsSoldMaterialAccountId") REFERENCES "account"("number") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "partGroup_costOfGoodsSoldOverheadAccountId_fkey" FOREIGN KEY ("costOfGoodsSoldOverheadAccountId") REFERENCES "account"("number") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "partGroup_costOfGoodsSoldSubcontractorAccountId_fkey" FOREIGN KEY ("costOfGoodsSoldSubcontractorAccountId") REFERENCES "account"("number") ON DELETE CASCADE ON UPDATE CASCADE,CONSTRAINT "partGroup_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "user"("id"),CONSTRAINT "partGroup_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user"("id"));@@ -110,11 +96,6 @@ CREATE TABLE "unitOfMeasure" (CREATE INDEX "unitOfMeasure_code_index" ON "unitOfMeasure"("code");-INSERT INTO "unitOfMeasure" ("code", "name", "createdBy")-VALUES-( 'EA', 'Each', 'system'),-( 'PCS', 'Pieces', 'system');-ALTER TABLE "unitOfMeasure" ENABLE ROW LEVEL SECURITY;CREATE POLICY "Authenticated users can view units of measure" ON "unitOfMeasure"@@ -264,9 +245,6 @@ CREATE TABLE "partCost" ("costingMethod" "partCostingMethod" NOT NULL,"standardCost" NUMERIC(15,5) NOT NULL DEFAULT 0,"unitCost" NUMERIC(15,5) NOT NULL DEFAULT 0,- "salesAccountId" TEXT,- "discountAccountId" TEXT,- "inventoryAccountId" TEXT,"costIsAdjusted" BOOLEAN NOT NULL DEFAULT false,"createdBy" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),@@ -274,9 +252,6 @@ CREATE TABLE "partCost" ("updatedAt" TIMESTAMP WITH TIME ZONE,CONSTRAINT "partCost_partId_fkey" FOREIGN KEY ("partId") REFERENCES "part"("id") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "partGroup_salesAccountId_fkey" FOREIGN KEY ("salesAccountId") REFERENCES "account"("number") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "partGroup_discountAccountId_fkey" FOREIGN KEY ("discountAccountId") REFERENCES "account"("number") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "partGroup_inventoryAccountId_fkey" FOREIGN KEY ("inventoryAccountId") REFERENCES "account"("number") ON DELETE CASCADE ON UPDATE CASCADE,CONSTRAINT "partGroup_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "user"("id"),CONSTRAINT "partGroup_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user"("id"));@@ -685,7 +660,7 @@ CREATE TABLE "partPlanning" (CREATE INDEX "partPlanning_partId_locationId_index" ON "partPlanning" ("partId", "locationId");ALTER TABLE "partPlanning" ENABLE ROW LEVEL SECURITY;-CREATE POLICY "Employees with part_view can view part planning" ON "partPlanning"+CREATE POLICY "Employees with parts_view can view part planning" ON "partPlanning"FOR SELECTUSING (coalesce(get_my_claim('parts_view')::boolean,false)@@ -693,7 +668,7 @@ CREATE POLICY "Employees with part_view can view part planning" ON "partPlanning);-- these are records are created lazily when a user attempts to view them-CREATE POLICY "Employees with part_view can insert part planning" ON "partPlanning"+CREATE POLICY "Employees with parts_view can insert part planning" ON "partPlanning"FOR INSERTWITH CHECK (coalesce(get_my_claim('parts_view')::boolean,false)diff --git a/packages/carbon-database/supabase/migrations/20230510035345_purchasing.sql b/packages/carbon-database/supabase/migrations/20230510035345_purchasing.sqlindex 546378e71d..b04b1bfdef 100644--- a/packages/carbon-database/supabase/migrations/20230510035345_purchasing.sql+++ b/packages/carbon-database/supabase/migrations/20230510035345_purchasing.sql@@ -23,18 +23,6 @@ CREATE TABLE "paymentTerm" (CONSTRAINT "paymentTerm_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE CASCADE);-INSERT INTO "paymentTerm" ("name", "daysDue", "calculationMethod", "daysDiscount", "discountPercentage", "createdBy")-VALUES- ('Net 15', 15, 'Net', 0, 0, 'system'),- ('Net 30', 30, 'Net', 0, 0, 'system'),- ('Net 50', 50, 'Net', 0, 0, 'system'),- ('Net 60', 60, 'Net', 0, 0, 'system'),- ('Net 90', 90, 'Net', 0, 0, 'system'),- ('1% 10 Net 30', 30, 'Net', 10, 1, 'system'),- ('2% 10 Net 30', 30, 'Net', 10, 2, 'system'),- ('Due on Receipt', 0, 'Net', 0, 0, 'system'),- ('Net EOM 10', 10, 'End of Month', 0, 0, 'system');-ALTER TABLE "paymentTerm" ENABLE ROW LEVEL SECURITY;CREATE POLICY "Certain employees can view payment terms" ON "paymentTerm"diff --git a/packages/carbon-database/supabase/migrations/20230525025310_sequences.sql b/packages/carbon-database/supabase/migrations/20230525025310_sequences.sqlindex 189dcc4407..886565ed37 100644--- a/packages/carbon-database/supabase/migrations/20230525025310_sequences.sql+++ b/packages/carbon-database/supabase/migrations/20230525025310_sequences.sql@@ -16,6 +16,3 @@ CREATE TABLE "sequence" (CONSTRAINT "sequence_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE CASCADE);-INSERT INTO "sequence" ("table", "name", "prefix", "suffix", "next", "size", "step")-VALUES ('purchaseOrder', 'Purchase Order', 'PO', NULL, 0, 6, 1);-diff --git a/packages/carbon-database/supabase/migrations/20230728025201_receipts.sql b/packages/carbon-database/supabase/migrations/20230728025201_receipts.sqlindex d95b9df03c..5c1511cd88 100644--- a/packages/carbon-database/supabase/migrations/20230728025201_receipts.sql+++ b/packages/carbon-database/supabase/migrations/20230728025201_receipts.sql@@ -36,8 +36,36 @@ CREATE INDEX "receipt_locationId_idx" ON "receipt" ("locationId");CREATE INDEX "receipt_sourceDocumentId_idx" ON "receipt" ("sourceDocumentId");CREATE INDEX "receipt_supplierId_idx" ON "receipt" ("supplierId");-INSERT INTO "sequence" ("table", "name", "prefix", "suffix", "next", "size", "step")-VALUES ('receipt', 'Receipt', 'RE', NULL, 0, 6, 1);+ALTER TABLE "receipt" ENABLE ROW LEVEL SECURITY;++CREATE POLICY "Employees with inventory_view can view receipts" ON "receipt"+ FOR SELECT+ USING (+ coalesce(get_my_claim('inventory_view')::boolean, false) = true+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );+++CREATE POLICY "Employees with inventory_create can insert receipts" ON "receipt"+ FOR INSERT+ WITH CHECK (+ coalesce(get_my_claim('inventory_create')::boolean,false)+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+);++CREATE POLICY "Employees with inventory_update can update receipts" ON "receipt"+ FOR UPDATE+ USING (+ coalesce(get_my_claim('inventory_update')::boolean, false) = true+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );++CREATE POLICY "Employees with inventory_delete can delete receipts" ON "receipt"+ FOR DELETE+ USING (+ coalesce(get_my_claim('inventory_delete')::boolean, false) = true+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );CREATE TABLE "receiptLine" ("id" TEXT NOT NULL DEFAULT xid(),@@ -69,6 +97,37 @@ CREATE INDEX "receiptLine_receiptId_idx" ON "receiptLine" ("receiptId");CREATE INDEX "receiptLine_lineId_idx" ON "receiptLine" ("lineId");CREATE INDEX "receiptLine_receiptId_lineId_idx" ON "receiptLine" ("receiptId", "lineId");+ALTER TABLE "receiptLine" ENABLE ROW LEVEL SECURITY;++CREATE POLICY "Employees with inventory_view can view receipt lines" ON "receiptLine"+ FOR SELECT+ USING (+ coalesce(get_my_claim('inventory_view')::boolean, false) = true+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );+++CREATE POLICY "Employees with inventory_create can insert receipt lines" ON "receiptLine"+ FOR INSERT+ WITH CHECK (+ coalesce(get_my_claim('inventory_create')::boolean,false)+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+);++CREATE POLICY "Employees with inventory_update can update receipt lines" ON "receiptLine"+ FOR UPDATE+ USING (+ coalesce(get_my_claim('inventory_update')::boolean, false) = true+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );++CREATE POLICY "Employees with inventory_delete can delete receipt lines" ON "receiptLine"+ FOR DELETE+ USING (+ coalesce(get_my_claim('inventory_delete')::boolean, false) = true+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );+CREATE VIEW "receipt_quantity_received_by_line" ASSELECTr."sourceDocumentId",diff --git a/packages/carbon-database/supabase/migrations/20230820020844_posting-groups.sql b/packages/carbon-database/supabase/migrations/20230820020844_posting-groups.sqlnew file mode 100644index 0000000000..3ca83d6298--- /dev/null+++ b/packages/carbon-database/supabase/migrations/20230820020844_posting-groups.sql@@ -0,0 +1,660 @@+CREATE TABLE "accountDefault" (+ "id" BOOLEAN NOT NULL DEFAULT TRUE,+ -- income statement+ -- revenue+ "salesAccount" TEXT NOT NULL,+ "salesDiscountAccount" TEXT NOT NULL,++ -- part cost+ "costOfGoodsSoldAccount" TEXT NOT NULL,+ "purchaseAccount" TEXT NOT NULL,+ "directCostAppliedAccount" TEXT NOT NULL,+ "overheadCostAppliedAccount" TEXT NOT NULL,+ "purchaseVarianceAccount" TEXT NOT NULL,+ "inventoryAdjustmentVarianceAccount" TEXT NOT NULL,++ -- direct costs+ "materialVarianceAccount" TEXT NOT NULL,+ "capacityVarianceAccount" TEXT NOT NULL,+ "overheadAccount" TEXT NOT NULL,+ "maintenanceAccount" TEXT NOT NULL,++ -- depreciaition of fixed assets+ "assetDepreciationExpenseAccount" TEXT NOT NULL,+ "assetGainsAndLossesAccount" TEXT NOT NULL,+ "serviceChargeAccount" TEXT NOT NULL,++ -- interest+ "interestAccount" TEXT NOT NULL,+ "supplierPaymentDiscountAccount" TEXT NOT NULL,+ "customerPaymentDiscountAccount" TEXT NOT NULL,+ "roundingAccount" TEXT NOT NULL,++ -- balance sheet+ -- assets+ "assetAquisitionCostAccount" TEXT NOT NULL,+ "assetAquisitionCostOnDisposalAccount" TEXT NOT NULL,+ "accumulatedDepreciationAccount" TEXT NOT NULL,+ "accumulatedDepreciationOnDisposalAccount" TEXT NOT NULL,++ -- current assets+ "inventoryAccount" TEXT NOT NULL,+ "inventoryInterimAccrualAccount" TEXT NOT NULL,+ "workInProgressAccount" TEXT NOT NULL,+ "receivablesAccount" TEXT NOT NULL,+ "inventoryShippedNotInvoicedAccount" TEXT NOT NULL,+ "bankCashAccount" TEXT NOT NULL,+ "bankLocalCurrencyAccount" TEXT NOT NULL,+ "bankForeignCurrencyAccount" TEXT NOT NULL,++ -- liabilities+ "prepaymentAccount" TEXT NOT NULL,+ "payablesAccount" TEXT NOT NULL,+ "inventoryReceivedNotInvoicedAccount" TEXT NOT NULL,+ "salesTaxPayableAccount" TEXT NOT NULL,+ "purchaseTaxPayableAccount" TEXT NOT NULL,+ "reverseChargeSalesTaxPayableAccount" TEXT NOT NULL,++ -- retained earnings+ "retainedEarningsAccount" TEXT NOT NULL,++ "updatedBy" TEXT,++++ CONSTRAINT "accountDefault_pkey" PRIMARY KEY ("id"),+ -- this is a hack to make sure that this table only ever has one row+ CONSTRAINT "accountDefault_id_check" CHECK ("id" = TRUE),+ CONSTRAINT "accountDefault_id_unique" UNIQUE ("id"),+ CONSTRAINT "accountDefault_salesAccount_fkey" FOREIGN KEY ("salesAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_salesDiscountAccount_fkey" FOREIGN KEY ("salesDiscountAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_costOfGoodsSoldAccount_fkey" FOREIGN KEY ("costOfGoodsSoldAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_purchaseAccount_fkey" FOREIGN KEY ("purchaseAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_directCostAppliedAccount_fkey" FOREIGN KEY ("directCostAppliedAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_overheadCostAppliedAccount_fkey" FOREIGN KEY ("overheadCostAppliedAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_purchaseVarianceAccount_fkey" FOREIGN KEY ("purchaseVarianceAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_inventoryAdjustmentVarianceAccount_fkey" FOREIGN KEY ("inventoryAdjustmentVarianceAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_materialVarianceAccount_fkey" FOREIGN KEY ("materialVarianceAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_capacityVarianceAccount_fkey" FOREIGN KEY ("capacityVarianceAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_overheadAccount_fkey" FOREIGN KEY ("overheadAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_maintenanceAccount_fkey" FOREIGN KEY ("maintenanceAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_assetDepreciationExpenseAccount_fkey" FOREIGN KEY ("assetDepreciationExpenseAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_assetGainsAndLossesAccount_fkey" FOREIGN KEY ("assetGainsAndLossesAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_serviceChargeAccount_fkey" FOREIGN KEY ("serviceChargeAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_interestAccount_fkey" FOREIGN KEY ("interestAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_supplierPaymentDiscountAccount_fkey" FOREIGN KEY ("supplierPaymentDiscountAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_customerPaymentDiscountAccount_fkey" FOREIGN KEY ("customerPaymentDiscountAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_roundingAccount_fkey" FOREIGN KEY ("roundingAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_aquisitionCostAccount_fkey" FOREIGN KEY ("assetAquisitionCostAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_aquisitionCostOnDisposalAccount_fkey" FOREIGN KEY ("assetAquisitionCostOnDisposalAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_accumulatedDepreciationAccount_fkey" FOREIGN KEY ("accumulatedDepreciationAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_accumulatedDepreciationOnDisposalAccount_fkey" FOREIGN KEY ("accumulatedDepreciationOnDisposalAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_inventoryAccount_fkey" FOREIGN KEY ("inventoryAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_inventoryInterimAccrualAccount_fkey" FOREIGN KEY ("inventoryInterimAccrualAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_workInProgressAccount_fkey" FOREIGN KEY ("workInProgressAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_receivablesAccount_fkey" FOREIGN KEY ("receivablesAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_inventoryShippedNotInvoicedAccount_fkey" FOREIGN KEY ("inventoryShippedNotInvoicedAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_bankCashAccount_fkey" FOREIGN KEY ("bankCashAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_bankLocalCurrencyAccount_fkey" FOREIGN KEY ("bankLocalCurrencyAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_bankForeignCurrencyAccount_fkey" FOREIGN KEY ("bankForeignCurrencyAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_prepaymentAccount_fkey" FOREIGN KEY ("prepaymentAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_payablesAccount_fkey" FOREIGN KEY ("payablesAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_inventoryReceivedNotInvoicedAccount_fkey" FOREIGN KEY ("inventoryReceivedNotInvoicedAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_salesTaxPayableAccount_fkey" FOREIGN KEY ("salesTaxPayableAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_reverseChargeSalesTaxPayableAccount_fkey" FOREIGN KEY ("reverseChargeSalesTaxPayableAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_purchaseTaxPayableAccount_fkey" FOREIGN KEY ("purchaseTaxPayableAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_retainedEarningsAccount_fkey" FOREIGN KEY ("retainedEarningsAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE RESTRICT ON UPDATE CASCADE+);++ALTER TABLE "accountDefault" ENABLE ROW LEVEL SECURITY;+++CREATE POLICY "Employees with accounting_view can view account defaults" ON "accountDefault"+ FOR SELECT+ USING (+ coalesce(get_my_claim('accounting_view')::boolean,false)+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );++CREATE POLICY "Employees with accounting_update can update account defaults" ON "accountDefault"+ FOR UPDATE+ USING (+ coalesce(get_my_claim('accounting_update')::boolean, false) = true+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );++++CREATE TABLE "postingGroupInventory" (+ "id" TEXT NOT NULL DEFAULT xid(),+ "partGroupId" TEXT,+ "locationId" TEXT,+ "costOfGoodsSoldAccount" TEXT NOT NULL,+ "inventoryAccount" TEXT NOT NULL,+ "inventoryInterimAccrualAccount" TEXT NOT NULL,+ "inventoryReceivedNotInvoicedAccount" TEXT NOT NULL,+ "inventoryShippedNotInvoicedAccount" TEXT NOT NULL,+ "workInProgressAccount" TEXT NOT NULL,+ "directCostAppliedAccount" TEXT NOT NULL,+ "overheadCostAppliedAccount" TEXT NOT NULL,+ "purchaseVarianceAccount" TEXT NOT NULL,+ "inventoryAdjustmentVarianceAccount" TEXT NOT NULL,+ "materialVarianceAccount" TEXT NOT NULL,+ "capacityVarianceAccount" TEXT NOT NULL,+ "overheadAccount" TEXT NOT NULL,+ "updatedBy" TEXT,++ CONSTRAINT "postingGroupInventory_pkey" PRIMARY KEY ("id"),+ CONSTRAINT "postingGroupInventory_id_partGroupId_locationId_key" UNIQUE ("partGroupId", "locationId"),+ CONSTRAINT "postingGroupInventory_partGroupId_fkey" FOREIGN KEY ("partGroupId") REFERENCES "partGroup" ("id") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_locationId_fkey" FOREIGN KEY ("locationId") REFERENCES "location" ("id") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_costOfGoodsSoldAccount_fkey" FOREIGN KEY ("costOfGoodsSoldAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_inventoryAccount_fkey" FOREIGN KEY ("inventoryAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_inventoryInterimAccrualAccount_fkey" FOREIGN KEY ("inventoryInterimAccrualAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_inventoryReceivedNotInvoicedAccount_fkey" FOREIGN KEY ("inventoryReceivedNotInvoicedAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_inventoryShippedNotInvoicedAccount_fkey" FOREIGN KEY ("inventoryShippedNotInvoicedAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_workInProgressAccount_fkey" FOREIGN KEY ("workInProgressAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_directCostAppliedAccount_fkey" FOREIGN KEY ("directCostAppliedAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_overheadCostAppliedAccount_fkey" FOREIGN KEY ("overheadCostAppliedAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_purchaseVarianceAccount_fkey" FOREIGN KEY ("purchaseVarianceAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_inventoryAdjustmentVarianceAccount_fkey" FOREIGN KEY ("inventoryAdjustmentVarianceAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_materialVarianceAccount_fkey" FOREIGN KEY ("materialVarianceAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_capacityVarianceAccount_fkey" FOREIGN KEY ("capacityVarianceAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_overheadAccount_fkey" FOREIGN KEY ("overheadAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE CASCADE+);++CREATE INDEX "postingGroupInventory_partGroupId_locationId_idx" ON "postingGroupInventory" ("partGroupId", "locationId");++ALTER TABLE "postingGroupInventory" ENABLE ROW LEVEL SECURITY;++CREATE POLICY "Employees with accounting_view can view inventory posting groups" ON "postingGroupInventory"+ FOR SELECT+ USING (+ coalesce(get_my_claim('accounting_view')::boolean,false)+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );++CREATE POLICY "Employees with accounting_update can update inventory posting groups" ON "postingGroupInventory"+ FOR UPDATE+ USING (+ coalesce(get_my_claim('accounting_update')::boolean, false) = true+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );+++CREATE TABLE "postingGroupPurchasing" (+ "id" TEXT NOT NULL DEFAULT xid(),+ "supplierTypeId" TEXT,+ "partGroupId" TEXT,+ "purchaseAccount" TEXT NOT NULL,+ "purchaseDiscountAccount" TEXT NOT NULL,+ "purchaseCreditAccount" TEXT NOT NULL,+ "purchasePrepaymentAccount" TEXT NOT NULL,+ "purchaseTaxPayableAccount" TEXT NOT NULL,+ "updatedBy" TEXT,++ CONSTRAINT "postingGroupPurchasing_pkey" PRIMARY KEY ("id"),+ CONSTRAINT "postingGroupPurchasing_id_supplierTypeId_partGroupId_key" UNIQUE ("supplierTypeId", "partGroupId"),+ CONSTRAINT "postingGroupPurchasing_partGroupId_fkey" FOREIGN KEY ("partGroupId") REFERENCES "partGroup" ("id") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "postingGroupPurchasing_supplierTypeId_fkey" FOREIGN KEY ("supplierTypeId") REFERENCES "supplierType" ("id") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "postingGroupPurchasing_purchaseAccount_fkey" FOREIGN KEY ("purchaseAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupPurchasing_purchaseDiscountAccount_fkey" FOREIGN KEY ("purchaseDiscountAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupPurchasing_purchaseCreditAccount_fkey" FOREIGN KEY ("purchaseCreditAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupPurchasing_purchasePrepaymentAccount_fkey" FOREIGN KEY ("purchasePrepaymentAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupPurchasing_purchaseTaxPayableAccount_fkey" FOREIGN KEY ("purchaseTaxPayableAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupPurchasing_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE CASCADE+);++CREATE INDEX "postingGroupPurchasing_partGroupId_supplierTypeId_idx" ON "postingGroupPurchasing" ("partGroupId", "supplierTypeId");++ALTER TABLE "postingGroupPurchasing" ENABLE ROW LEVEL SECURITY;++CREATE POLICY "Employees with accounting_view can view purchasing posting groups" ON "postingGroupPurchasing"+ FOR SELECT+ USING (+ coalesce(get_my_claim('accounting_view')::boolean,false)+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );++CREATE POLICY "Employees with accounting_update can update purchasing posting groups" ON "postingGroupPurchasing"+ FOR UPDATE+ USING (+ coalesce(get_my_claim('accounting_update')::boolean, false) = true+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );++CREATE TABLE "postingGroupSales" (+ "id" TEXT NOT NULL DEFAULT xid(),+ "customerTypeId" TEXT,+ "partGroupId" TEXT,+ "salesAccount" TEXT NOT NULL,+ "salesDiscountAccount" TEXT NOT NULL,+ "salesCreditAccount" TEXT NOT NULL,+ "salesPrepaymentAccount" TEXT NOT NULL,+ "salesTaxPayableAccount" TEXT NOT NULL,+ "updatedBy" TEXT,++ CONSTRAINT "postingGroupSales_pkey" PRIMARY KEY ("id"),+ CONSTRAINT "postingGroupSales_id_customerTypeId_partGroupId_key" UNIQUE ("customerTypeId", "partGroupId"),+ CONSTRAINT "postingGroupSales_partGroupId_fkey" FOREIGN KEY ("partGroupId") REFERENCES "partGroup" ("id") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "postingGroupSales_customerTypeId_fkey" FOREIGN KEY ("customerTypeId") REFERENCES "customerType" ("id") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "postingGroupSales_salesAccount_fkey" FOREIGN KEY ("salesAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupSales_salesDiscountAccount_fkey" FOREIGN KEY ("salesDiscountAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupSales_salesCreditAccount_fkey" FOREIGN KEY ("salesCreditAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupSales_salesPrepaymentAccount_fkey" FOREIGN KEY ("salesPrepaymentAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupSales_salesTaxPayableAccount_fkey" FOREIGN KEY ("salesTaxPayableAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupSales_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE CASCADE+);++CREATE INDEX "postingGroupSales_partGroupId_customerTypeId_idx" ON "postingGroupSales" ("partGroupId", "customerTypeId");++CREATE POLICY "Employees with accounting_view can view sales posting groups" ON "postingGroupSales"+ FOR SELECT+ USING (+ coalesce(get_my_claim('accounting_view')::boolean,false)+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );++CREATE POLICY "Employees with accounting_update can update sales posting groups" ON "postingGroupSales"+ FOR UPDATE+ USING (+ coalesce(get_my_claim('accounting_update')::boolean, false) = true+ AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ );++CREATE FUNCTION public.create_posting_groups_for_location()+RETURNS TRIGGER AS $$+DECLARE+ part_group RECORD;+ account_defaults RECORD;+BEGIN+ SELECT * INTO account_defaults FROM "accountDefault" WHERE "id" = TRUE;++ FOR part_group IN SELECT "id" FROM "partGroup"+ LOOP+ INSERT INTO "postingGroupInventory" (+ "partGroupId",+ "locationId",+ "costOfGoodsSoldAccount",+ "inventoryAccount",+ "inventoryInterimAccrualAccount",+ "inventoryReceivedNotInvoicedAccount",+ "inventoryShippedNotInvoicedAccount",+ "workInProgressAccount",+ "directCostAppliedAccount",+ "overheadCostAppliedAccount",+ "purchaseVarianceAccount",+ "inventoryAdjustmentVarianceAccount",+ "materialVarianceAccount",+ "capacityVarianceAccount",+ "overheadAccount",+ "updatedBy"+ ) VALUES (+ part_group."id",+ new."id",+ account_defaults."costOfGoodsSoldAccount",+ account_defaults."inventoryAccount",+ account_defaults."inventoryInterimAccrualAccount",+ account_defaults."inventoryReceivedNotInvoicedAccount",+ account_defaults."inventoryShippedNotInvoicedAccount",+ account_defaults."workInProgressAccount",+ account_defaults."directCostAppliedAccount",+ account_defaults."overheadCostAppliedAccount",+ account_defaults."purchaseVarianceAccount",+ account_defaults."inventoryAdjustmentVarianceAccount",+ account_defaults."materialVarianceAccount",+ account_defaults."capacityVarianceAccount",+ account_defaults."overheadAccount",+ new."createdBy"+ );+ END LOOP;++ -- insert the null part group+ INSERT INTO "postingGroupInventory" (+ "partGroupId",+ "locationId",+ "costOfGoodsSoldAccount",+ "inventoryAccount",+ "inventoryInterimAccrualAccount",+ "inventoryReceivedNotInvoicedAccount",+ "inventoryShippedNotInvoicedAccount",+ "workInProgressAccount",+ "directCostAppliedAccount",+ "overheadCostAppliedAccount",+ "purchaseVarianceAccount",+ "inventoryAdjustmentVarianceAccount",+ "materialVarianceAccount",+ "capacityVarianceAccount",+ "overheadAccount",+ "updatedBy"+ ) VALUES (+ NULL,+ new."id",+ account_defaults."costOfGoodsSoldAccount",+ account_defaults."inventoryAccount",+ account_defaults."inventoryInterimAccrualAccount",+ account_defaults."inventoryReceivedNotInvoicedAccount",+ account_defaults."inventoryShippedNotInvoicedAccount",+ account_defaults."workInProgressAccount",+ account_defaults."directCostAppliedAccount",+ account_defaults."overheadCostAppliedAccount",+ account_defaults."purchaseVarianceAccount",+ account_defaults."inventoryAdjustmentVarianceAccount",+ account_defaults."materialVarianceAccount",+ account_defaults."capacityVarianceAccount",+ account_defaults."overheadAccount",+ new."createdBy"+ );++ RETURN new;+END;+$$ LANGUAGE plpgsql SECURITY DEFINER;++CREATE TRIGGER create_location+ AFTER INSERT on public."location"+ FOR EACH ROW EXECUTE PROCEDURE public.create_posting_groups_for_location();+++CREATE FUNCTION public.create_posting_groups_for_part_group()+RETURNS TRIGGER AS $$+DECLARE+ rec RECORD;+ account_defaults RECORD;+BEGIN+ SELECT * INTO account_defaults FROM "accountDefault" WHERE "id" = TRUE;++ FOR rec IN SELECT "id" FROM "customerType"+ LOOP+ INSERT INTO "postingGroupSales" (+ "partGroupId",+ "customerTypeId",+ "salesAccount",+ "salesDiscountAccount",+ "salesCreditAccount",+ "salesPrepaymentAccount",+ "salesTaxPayableAccount",+ "updatedBy"+ ) VALUES (+ new."id",+ rec."id",+ account_defaults."salesAccount",+ account_defaults."salesDiscountAccount",+ account_defaults."receivablesAccount",+ account_defaults."prepaymentAccount",+ account_defaults."salesTaxPayableAccount",+ new."createdBy"+ );+ END LOOP;++ -- insert the null customer type+ INSERT INTO "postingGroupSales" (+ "partGroupId",+ "customerTypeId",+ "salesAccount",+ "salesDiscountAccount",+ "salesCreditAccount",+ "salesPrepaymentAccount",+ "salesTaxPayableAccount",+ "updatedBy"+ ) VALUES (+ new."id",+ NULL,+ account_defaults."salesAccount",+ account_defaults."salesDiscountAccount",+ account_defaults."receivablesAccount",+ account_defaults."prepaymentAccount",+ account_defaults."salesTaxPayableAccount",+ new."createdBy"+ );++ FOR rec IN SELECT "id" FROM "supplierType"+ LOOP+ INSERT INTO "postingGroupPurchasing" (+ "partGroupId",+ "supplierTypeId",+ "purchaseAccount",+ "purchaseDiscountAccount",+ "purchaseCreditAccount",+ "purchasePrepaymentAccount",+ "purchaseTaxPayableAccount",+ "updatedBy"+ ) VALUES (+ new."id",+ rec."id",+ account_defaults."purchaseAccount",+ account_defaults."purchaseAccount",+ account_defaults."payablesAccount",+ account_defaults."prepaymentAccount",+ account_defaults."purchaseTaxPayableAccount",+ new."createdBy"+ );+ END LOOP;++ -- insert the null supplier type+ INSERT INTO "postingGroupPurchasing" (+ "partGroupId",+ "supplierTypeId",+ "purchaseAccount",+ "purchaseDiscountAccount",+ "purchaseCreditAccount",+ "purchasePrepaymentAccount",+ "purchaseTaxPayableAccount",+ "updatedBy"+ ) VALUES (+ new."id",+ NULL,+ account_defaults."purchaseAccount",+ account_defaults."purchaseAccount",+ account_defaults."payablesAccount",+ account_defaults."prepaymentAccount",+ account_defaults."purchaseTaxPayableAccount",+ new."createdBy"+ );++ FOR rec IN SELECT "id" FROM "location"+ LOOP+ INSERT INTO "postingGroupInventory" (+ "partGroupId",+ "locationId",+ "costOfGoodsSoldAccount",+ "inventoryAccount",+ "inventoryInterimAccrualAccount",+ "inventoryReceivedNotInvoicedAccount",+ "inventoryShippedNotInvoicedAccount",+ "workInProgressAccount",+ "directCostAppliedAccount",+ "overheadCostAppliedAccount",+ "purchaseVarianceAccount",+ "inventoryAdjustmentVarianceAccount",+ "materialVarianceAccount",+ "capacityVarianceAccount",+ "overheadAccount",+ "updatedBy"+ ) VALUES (+ new."id",+ rec."id",+ account_defaults."costOfGoodsSoldAccount",+ account_defaults."inventoryAccount",+ account_defaults."inventoryInterimAccrualAccount",+ account_defaults."inventoryReceivedNotInvoicedAccount",+ account_defaults."inventoryShippedNotInvoicedAccount",+ account_defaults."workInProgressAccount",+ account_defaults."directCostAppliedAccount",+ account_defaults."overheadCostAppliedAccount",+ account_defaults."purchaseVarianceAccount",+ account_defaults."inventoryAdjustmentVarianceAccount",+ account_defaults."materialVarianceAccount",+ account_defaults."capacityVarianceAccount",+ account_defaults."overheadAccount",+ new."createdBy"+ );+ END LOOP;++ -- insert the null location+ INSERT INTO "postingGroupInventory" (+ "partGroupId",+ "locationId",+ "costOfGoodsSoldAccount",+ "inventoryAccount",+ "inventoryInterimAccrualAccount",+ "inventoryReceivedNotInvoicedAccount",+ "inventoryShippedNotInvoicedAccount",+ "workInProgressAccount",+ "directCostAppliedAccount",+ "overheadCostAppliedAccount",+ "purchaseVarianceAccount",+ "inventoryAdjustmentVarianceAccount",+ "materialVarianceAccount",+ "capacityVarianceAccount",+ "overheadAccount",+ "updatedBy"+ ) VALUES (+ new."id",+ NULL,+ account_defaults."costOfGoodsSoldAccount",+ account_defaults."inventoryAccount",+ account_defaults."inventoryInterimAccrualAccount",+ account_defaults."inventoryReceivedNotInvoicedAccount",+ account_defaults."inventoryShippedNotInvoicedAccount",+ account_defaults."workInProgressAccount",+ account_defaults."directCostAppliedAccount",+ account_defaults."overheadCostAppliedAccount",+ account_defaults."purchaseVarianceAccount",+ account_defaults."inventoryAdjustmentVarianceAccount",+ account_defaults."materialVarianceAccount",+ account_defaults."capacityVarianceAccount",+ account_defaults."overheadAccount",+ new."createdBy"+ );++ RETURN new;+END;+$$ LANGUAGE plpgsql SECURITY DEFINER;+++CREATE TRIGGER create_part_group+ AFTER INSERT on public."partGroup"+ FOR EACH ROW EXECUTE PROCEDURE public.create_posting_groups_for_part_group();++CREATE FUNCTION public.create_posting_groups_for_customer_type()+RETURNS TRIGGER AS $$+DECLARE+ rec RECORD;+ account_defaults RECORD;+BEGIN+ SELECT * INTO account_defaults FROM "accountDefault" WHERE "id" = TRUE;++ FOR rec IN SELECT "id" FROM "partGroup"+ LOOP+ INSERT INTO "postingGroupSales" (+ "customerTypeId",+ "partGroupId",+ "salesAccount",+ "salesDiscountAccount",+ "salesCreditAccount",+ "salesPrepaymentAccount",+ "salesTaxPayableAccount",+ "updatedBy"+ ) VALUES (+ new."id",+ rec."id",+ account_defaults."salesAccount",+ account_defaults."salesDiscountAccount",+ account_defaults."salesAccount",+ account_defaults."prepaymentAccount",+ account_defaults."salesTaxPayableAccount",+ new."createdBy"+ );+ END LOOP;++ -- insert the null part group+ INSERT INTO "postingGroupSales" (+ "customerTypeId",+ "partGroupId",+ "salesAccount",+ "salesDiscountAccount",+ "salesCreditAccount",+ "salesPrepaymentAccount",+ "salesTaxPayableAccount",+ "updatedBy"+ ) VALUES (+ new."id",+ NULL,+ account_defaults."salesAccount",+ account_defaults."salesDiscountAccount",+ account_defaults."salesAccount",+ account_defaults."prepaymentAccount",+ account_defaults."salesTaxPayableAccount",+ new."createdBy"+ );++ RETURN new;+END;+$$ LANGUAGE plpgsql SECURITY DEFINER;++CREATE TRIGGER create_posting_groups_for_customer_type+ AFTER INSERT on public."customerType"+ FOR EACH ROW EXECUTE PROCEDURE public.create_posting_groups_for_customer_type();+++CREATE FUNCTION public.create_posting_groups_for_supplier_type()+RETURNS TRIGGER AS $$+DECLARE+ rec RECORD;+ account_defaults RECORD;+BEGIN+ SELECT * INTO account_defaults FROM "accountDefault" WHERE "id" = TRUE;++ FOR rec IN SELECT "id" FROM "partGroup"+ LOOP+ INSERT INTO "postingGroupPurchasing" (+ "supplierTypeId",+ "partGroupId",+ "purchaseAccount",+ "purchaseDiscountAccount",+ "purchaseCreditAccount",+ "purchasePrepaymentAccount",+ "purchaseTaxPayableAccount",+ "updatedBy"+ ) VALUES (+ new."id",+ rec."id",+ account_defaults."purchaseAccount",+ account_defaults."purchaseAccount",+ account_defaults."purchaseAccount",+ account_defaults."prepaymentAccount",+ account_defaults."purchaseTaxPayableAccount",+ new."createdBy"+ );+ END LOOP;++ -- insert the null part group+ INSERT INTO "postingGroupPurchasing" (+ "supplierTypeId",+ "partGroupId",+ "purchaseAccount",+ "purchaseDiscountAccount",+ "purchaseCreditAccount",+ "purchasePrepaymentAccount",+ "purchaseTaxPayableAccount",+ "updatedBy"+ ) VALUES (+ new."id",+ NULL,+ account_defaults."purchaseAccount",+ account_defaults."purchaseAccount",+ account_defaults."purchaseAccount",+ account_defaults."prepaymentAccount",+ account_defaults."purchaseTaxPayableAccount",+ new."createdBy"+ );++ RETURN new;+END;+$$ LANGUAGE plpgsql SECURITY DEFINER;++CREATE TRIGGER create_posting_groups_for_supplier_type+ AFTER INSERT on public."supplierType"+ FOR EACH ROW EXECUTE PROCEDURE public.create_posting_groups_for_supplier_type();diff --git a/packages/carbon-database/supabase/seed.sql b/packages/carbon-database/supabase/seed.sqlindex e69de29bb2..3afeb91b58 100644--- a/packages/carbon-database/supabase/seed.sql+++ b/packages/carbon-database/supabase/seed.sql@@ -0,0 +1,307 @@+-- users++INSERT INTO "user" ("id", "email", "firstName", "lastName")+VALUES ('system', '[email protected]', 'System', 'Operation');++-- currencies++INSERT INTO "currency" ("name", "code", "symbol", "exchangeRate", "isBaseCurrency", "createdBy")+VALUES ('US Dollar', 'USD', '$', 1.0000, true, 'system');++-- attribute types+++INSERT INTO "attributeDataType" ("label", "isBoolean", "isDate", "isList", "isNumeric", "isText", "isUser")+VALUES+ ('Yes/No', true, false, false, false, false, false),+ ('Date', false, true, false, false, false, false),+ ('List', false, false, true, false, false, false),+ ('Numeric', false, false, false, true, false, false),+ ('Text', false, false, false, false, true, false),+ ('User', false, false, false, false, false, true);+++-- supplier status++INSERT INTO "supplierStatus" ("name") VALUES ('Active'), ('Inactive'), ('Pending'), ('Rejected');++-- customer status++INSERT INTO "customerStatus" ("name") VALUES ('Active'), ('Inactive'), ('Prospect'), ('Lead'), ('On Hold'), ('Cancelled'), ('Archived');++-- unit of measure++INSERT INTO "unitOfMeasure" ("code", "name", "createdBy")+VALUES+( 'EA', 'Each', 'system'),+( 'PCS', 'Pieces', 'system');++-- payment terms++INSERT INTO "paymentTerm" ("name", "daysDue", "calculationMethod", "daysDiscount", "discountPercentage", "createdBy")+VALUES+ ('Net 15', 15, 'Net', 0, 0, 'system'),+ ('Net 30', 30, 'Net', 0, 0, 'system'),+ ('Net 50', 50, 'Net', 0, 0, 'system'),+ ('Net 60', 60, 'Net', 0, 0, 'system'),+ ('Net 90', 90, 'Net', 0, 0, 'system'),+ ('1% 10 Net 30', 30, 'Net', 10, 1, 'system'),+ ('2% 10 Net 30', 30, 'Net', 10, 2, 'system'),+ ('Due on Receipt', 0, 'Net', 0, 0, 'system'),+ ('Net EOM 10', 10, 'End of Month', 0, 0, 'system');++-- sequences++INSERT INTO "sequence" ("table", "name", "prefix", "suffix", "next", "size", "step")+VALUES+ ('purchaseOrder', 'Purchase Order', 'PO', NULL, 0, 6, 1),+ ('receipt', 'Receipt', 'RE', NULL, 0, 6, 1);++-- account categories++INSERT INTO public."accountCategory" (id, category, "incomeBalance", "normalBalance", "createdBy")+VALUES+ ('cjgo71si60lg1aoj5p40', 'Bank', 'Balance Sheet', 'Credit', 'system'),+ ('cjgo71si60lg1aoj5p4g', 'Accounts Receivable', 'Balance Sheet', 'Credit', 'system'),+ ('cjgo71si60lg1aoj5p50', 'Inventory', 'Balance Sheet', 'Debit', 'system'),+ ('cjgo71si60lg1aoj5p5g', 'Other Current Asset', 'Balance Sheet', 'Debit', 'system'),+ ('cjgo71si60lg1aoj5p60', 'Fixed Asset', 'Balance Sheet', 'Debit', 'system'),+ ('cjgo71si60lg1aoj5p6g', 'Accumulated Depreciation', 'Balance Sheet', 'Credit', 'system'),+ ('cjgo71si60lg1aoj5p70', 'Other Asset', 'Balance Sheet', 'Debit', 'system'),+ ('cjgo71si60lg1aoj5p7g', 'Accounts Payable', 'Balance Sheet', 'Debit', 'system'),+ ('cjgo71si60lg1aoj5p80', 'Other Current Liability', 'Balance Sheet', 'Debit', 'system'),+ ('cjgo71si60lg1aoj5p8g', 'Long Term Liability', 'Balance Sheet', 'Debit', 'system'),+ ('cjgo71si60lg1aoj5p90', 'Equity - No Close', 'Balance Sheet', 'Credit', 'system'),+ ('cjgo71si60lg1aoj5p9g', 'Equity - Close', 'Balance Sheet', 'Credit', 'system'),+ ('cjgo71si60lg1aoj5pa0', 'Retained Earnings', 'Balance Sheet', 'Credit', 'system'),+ ('cjgo71si60lg1aoj5pag', 'Income', 'Income Statement', 'Credit', 'system'),+ ('cjgo71si60lg1aoj5pb0', 'Cost of Goods Sold', 'Income Statement', 'Debit', 'system'),+ ('cjgo71si60lg1aoj5pbg', 'Expense', 'Income Statement', 'Debit', 'system'),+ ('cjgo71si60lg1aoj5pc0', 'Other Income', 'Income Statement', 'Credit', 'system'),+ ('cjgo71si60lg1aoj5pcg', 'Other Expense', 'Income Statement', 'Debit', 'system');++-- accounts++INSERT INTO public.account+ (number, name, type, "accountCategoryId", "accountSubcategoryId", "incomeBalance", "normalBalance", "consolidatedRate", "directPosting", active, "createdBy")+VALUES+ ('10000', 'Income Statement', 'Begin Total', 'cjgo71si60lg1aoj5pag', NULL, 'Income Statement', 'Both', 'Average', false, true, 'system'),+ ('11000', 'Revenue', 'Begin Total', 'cjgo71si60lg1aoj5pag', NULL, 'Income Statement', 'Credit', 'Average', false, true, 'system'),+ ('11210', 'Sales', 'Posting', 'cjgo71si60lg1aoj5pag', NULL, 'Income Statement', 'Credit', 'Average', true, true, 'system'),+ ('11600', 'Sales Discounts', 'Posting', 'cjgo71si60lg1aoj5pag', NULL, 'Income Statement', 'Debit', 'Average', true, true, 'system'),+ ('19999', 'Revenue, Total', 'End Total', 'cjgo71si60lg1aoj5pag', NULL, 'Income Statement', 'Credit', 'Average', false, true, 'system'),+ ('20000', 'Costs of Goods Sold', 'Begin Total', 'cjgo71si60lg1aoj5pb0', NULL, 'Income Statement', 'Debit', 'Average', false, true, 'system'),+ ('21210', 'Cost of Goods Sold', 'Posting', 'cjgo71si60lg1aoj5pb0', NULL, 'Income Statement', 'Debit', 'Average', true, true, 'system'),+ ('21410', 'Purchases', 'Posting', 'cjgo71si60lg1aoj5pb0', NULL, 'Income Statement', 'Debit', 'Average', true, true, 'system'),+ ('21590', 'Direct Cost Applied', 'Posting', 'cjgo71si60lg1aoj5pb0', NULL, 'Income Statement', 'Debit', 'Average', true, true, 'system'),+ ('21600', 'Overhead Applied', 'Posting', 'cjgo71si60lg1aoj5pb0', NULL, 'Income Statement', 'Debit', 'Average', true, true, 'system'),+ ('21610', 'Purchase Variance', 'Posting', 'cjgo71si60lg1aoj5pb0', NULL, 'Income Statement', 'Debit', 'Average', true, true, 'system'),+ ('21700', 'Inventory Adjustment', 'Posting', 'cjgo71si60lg1aoj5pb0', NULL, 'Income Statement', 'Debit', 'Average', true, true, 'system'),+ ('24999', 'Costs of Goods Sold, Total', 'End Total', 'cjgo71si60lg1aoj5pbg', NULL, 'Income Statement', 'Debit', 'Average', false, true, 'system'),+ ('25000', 'Direct Capacity Cost', 'Begin Total', 'cjgo71si60lg1aoj5pbg', NULL, 'Income Statement', 'Debit', 'Average', false, true, 'system'),+ ('25705', 'Material Variance', 'Posting', 'cjgo71si60lg1aoj5pbg', NULL, 'Income Statement', 'Debit', 'Average', true, true, 'system'),+ ('25710', 'Capacity Variance', 'Posting', 'cjgo71si60lg1aoj5pbg', NULL, 'Income Statement', 'Debit', 'Average', true, true, 'system'),+ ('25720', 'Overhead Accounts', 'Posting', 'cjgo71si60lg1aoj5pbg', NULL, 'Income Statement', 'Debit', 'Average', true, true, 'system'),+ ('47045', 'Maintenance Expense', 'Posting', 'cjgo71si60lg1aoj5pbg', NULL, 'Income Statement', 'Debit', 'Average', true, true, 'system'),+ ('49999', 'Direct Capacity Cost, Total', 'End Total', 'cjgo71si60lg1aoj5pbg', NULL, 'Income Statement', 'Debit', 'Average', true, true, 'system'),+ ('50000', 'Depreciation of Fixed Assets', 'Begin Total', 'cjgo71si60lg1aoj5pcg', NULL, 'Income Statement', 'Debit', 'Average', false, true, 'system'),+ ('50015', 'Depreciation Expense', 'Posting', 'cjgo71si60lg1aoj5pcg', NULL, 'Income Statement', 'Debit', 'Average', true, true, 'system'),+ ('50040', 'Gains and Losses on Disposal', 'Posting', 'cjgo71si60lg1aoj5pcg', NULL, 'Income Statement', 'Debit', 'Average', true, true, 'system'),+ ('50045', 'Service Charge Account', 'Posting', 'cjgo71si60lg1aoj5pcg', NULL, 'Income Statement', 'Debit', 'Average', true, true, 'system'),+ ('50999', 'Depreciation of Fixed Assets, Total', 'End Total', 'cjgo71si60lg1aoj5pcg', NULL, 'Income Statement', 'Debit', 'Average', false, true, 'system'),+ ('51000', 'Interest', 'Begin Total', 'cjgo71si60lg1aoj5pcg', NULL, 'Income Statement', 'Debit', 'Average', false, true, 'system'),+ ('51110', 'Interest Account', 'Posting', 'cjgo71si60lg1aoj5pcg', NULL, 'Income Statement', 'Debit', 'Average', true, true, 'system'),+ ('51115', 'Supplier Payment Discounts', 'Posting', 'cjgo71si60lg1aoj5pcg', NULL, 'Income Statement', 'Debit', 'Average', true, true, 'system'),+ ('51120', 'Customer Payment Discounts', 'Posting', 'cjgo71si60lg1aoj5pcg', NULL, 'Income Statement', 'Debit', 'Average', true, true, 'system'),+ ('51235', 'Rounding Account', 'Posting', 'cjgo71si60lg1aoj5pcg', NULL, 'Income Statement', 'Debit', 'Average', true, true, 'system'),+ ('51999', 'Interest, Total', 'End Total', 'cjgo71si60lg1aoj5pcg', NULL, 'Income Statement', 'Debit', 'Average', false, true, 'system'),+ ('79999', 'Income Statement, Total', 'End Total', 'cjgo71si60lg1aoj5pag', NULL, 'Income Statement', 'Both', 'Average', true, true, 'system'),+ ('80000', 'Balance Sheet', 'Begin Total', NULL, NULL, 'Balance Sheet', 'Both', 'Average', false, true, 'system'),+ ('80001', 'Assets', 'Begin Total', NULL, NULL, 'Balance Sheet', 'Debit', 'Average', false, true, 'system'),+ ('81000', 'Fixed Assets', 'Begin Total', NULL, NULL, 'Balance Sheet', 'Debit', 'Average', false, true, 'system'),+ ('81010', 'Fixed Asset Acquisition Cost', 'Posting', 'cjgo71si60lg1aoj5p60', NULL, 'Balance Sheet', 'Debit', 'Average', true, true, 'system'),+ ('81015', 'Fixed Asset Acquisition Cost on Disposal', 'Posting', 'cjgo71si60lg1aoj5p60', NULL, 'Balance Sheet', 'Debit', 'Average', true, true, 'system'),+ ('81020', 'Accumulated Depreciation', 'Posting', 'cjgo71si60lg1aoj5p6g', NULL, 'Balance Sheet', 'Credit', 'Average', true, true, 'system'),+ ('81030', 'Fixed Asset Acquisition Depreciation on Disposal', 'Posting', 'cjgo71si60lg1aoj5p6g', NULL, 'Balance Sheet', 'Credit', 'Average', true, true, 'system'),+ ('81999', 'Fixed Assets, Total', 'End Total', NULL, NULL, 'Balance Sheet', 'Debit', 'Average', false, true, 'system'),+ ('83000', 'Current Assets', 'Begin Total', NULL, NULL, 'Balance Sheet', 'Both', 'Average', false, true, 'system'),+ ('83105', 'Inventory', 'Posting', 'cjgo71si60lg1aoj5p50', NULL, 'Balance Sheet', 'Debit', 'Average', true, true, 'system'),+ ('83120', 'Inventory Interim', 'Posting', 'cjgo71si60lg1aoj5p50', NULL, 'Balance Sheet', 'Debit', 'Average', true, true, 'system'),+ ('83125', 'Work In Progress (WIP)', 'Posting', 'cjgo71si60lg1aoj5p50', NULL, 'Balance Sheet', 'Debit', 'Average', true, true, 'system'),+ ('85005', 'Receivables', 'Posting', 'cjgo71si60lg1aoj5p4g', NULL, 'Balance Sheet', 'Credit', 'Average', true, true, 'system'),+ ('85010', 'Inventory Shipped Not Invoiced', 'Posting', 'cjgo71si60lg1aoj5p4g', NULL, 'Balance Sheet', 'Credit', 'Average', true, true, 'system'),+ ('86005', 'Bank - Cash', 'Posting', 'cjgo71si60lg1aoj5p40', NULL, 'Balance Sheet', 'Credit', 'Average', true, true, 'system'),+ ('86010', 'Bank - Local Currency', 'Posting', 'cjgo71si60lg1aoj5p40', NULL, 'Balance Sheet', 'Credit', 'Average', false, true, 'system'),+ ('86015', 'Bank - Foreign Currency', 'Posting', 'cjgo71si60lg1aoj5p40', NULL, 'Balance Sheet', 'Credit', 'Average', false, true, 'system'),+ ('87999', 'Current Assets, Total', 'End Total', NULL, NULL, 'Balance Sheet', 'Both', 'Average', false, true, 'system'),+ ('89999', 'Assets, Total', 'End Total', NULL, NULL, 'Balance Sheet', 'Debit', 'Average', false, true, 'system'),+ ('90000', 'Liabilities', 'Begin Total', NULL, NULL, 'Balance Sheet', 'Debit', 'Average', false, true, 'system'),+ ('92210', 'Prepayments', 'Posting', 'cjgo71si60lg1aoj5p80', NULL, 'Balance Sheet', 'Debit', 'Average', true, true, 'system'),+ ('93005', 'Payables', 'Posting', 'cjgo71si60lg1aoj5p7g', NULL, 'Balance Sheet', 'Debit', 'Average', true, true, 'system'),+ ('93010', 'Inventory Received Not Invoiced', 'Posting', 'cjgo71si60lg1aoj5p7g', NULL, 'Balance Sheet', 'Debit', 'Average', true, true, 'system'),+ ('94100', 'Sales Tax Payable', 'Posting', 'cjgo71si60lg1aoj5p80', NULL, 'Balance Sheet', 'Debit', 'Average', true, true, 'system'),+ ('94110', 'Purchase Tax Payable', 'Posting', 'cjgo71si60lg1aoj5p80', NULL, 'Balance Sheet', 'Debit', 'Average', true, true, 'system'),+ ('94115', 'Reverse Charge Tax Payable', 'Posting', 'cjgo71si60lg1aoj5p80', NULL, 'Balance Sheet', 'Debit', 'Average', true, true, 'system'),+ ('94999', 'Liabilities, Total', 'End Total', NULL, NULL, 'Balance Sheet', 'Debit', 'Average', false, true, 'system'),+ ('95000', 'Equity', 'Begin Total', NULL, NULL, 'Balance Sheet', 'Debit', 'Average', false, true, 'system'),+ ('95010', 'Retained Earnings', 'Posting', 'cjgo71si60lg1aoj5pa0', NULL, 'Balance Sheet', 'Credit', 'Average', false, true, 'system'),+ ('96010', 'Owner Equity', 'Posting', 'cjgo71si60lg1aoj5p90', NULL, 'Balance Sheet', 'Both', 'Average', true, true, 'system'),+ ('96999', 'Equity, Total', 'End Total', NULL, NULL, 'Balance Sheet', 'Debit', 'Average', false, true, 'system'),+ ('99999', 'Balance Sheet, Total', 'End Total', NULL, NULL, 'Balance Sheet', 'Both', 'Average', false, true, 'system');++ INSERT INTO public."accountDefault" (+ "id",+ "salesAccount",+ "salesDiscountAccount",+ "costOfGoodsSoldAccount",+ "purchaseAccount",+ "directCostAppliedAccount",+ "overheadCostAppliedAccount",+ "purchaseVarianceAccount",+ "inventoryAdjustmentVarianceAccount",+ "materialVarianceAccount",+ "capacityVarianceAccount",+ "overheadAccount",+ "maintenanceAccount",+ "assetDepreciationExpenseAccount",+ "assetGainsAndLossesAccount",+ "serviceChargeAccount",+ "interestAccount",+ "supplierPaymentDiscountAccount",+ "customerPaymentDiscountAccount",+ "roundingAccount",+ "assetAquisitionCostAccount",+ "assetAquisitionCostOnDisposalAccount",+ "accumulatedDepreciationAccount",+ "accumulatedDepreciationOnDisposalAccount",+ "inventoryAccount",+ "inventoryInterimAccrualAccount",+ "workInProgressAccount",+ "receivablesAccount",+ "inventoryShippedNotInvoicedAccount",+ "bankCashAccount",+ "bankLocalCurrencyAccount",+ "bankForeignCurrencyAccount",+ "prepaymentAccount",+ "payablesAccount",+ "inventoryReceivedNotInvoicedAccount",+ "salesTaxPayableAccount",+ "purchaseTaxPayableAccount",+ "reverseChargeSalesTaxPayableAccount",+ "retainedEarningsAccount",+ "updatedBy"+ ) VALUES (+ true,+ '11210',+ '11600',+ '21210',+ '21410',+ '21590',+ '21600',+ '21610',+ '21700',+ '25705',+ '25710',+ '25720',+ '47045',+ '50015',+ '50040',+ '50045',+ '51110',+ '51115',+ '51120',+ '51235',+ '81010',+ '81015',+ '81020',+ '81030',+ '83105',+ '83120',+ '83125',+ '85005',+ '85010',+ '86005',+ '86010',+ '86015',+ '92210',+ '93005',+ '93010',+ '94100',+ '94110',+ '94115',+ '95010',+ 'system'+ );+++INSERT INTO "postingGroupInventory" (+ "partGroupId",+ "costOfGoodsSoldAccount",+ "inventoryAccount",+ "inventoryInterimAccrualAccount",+ "inventoryReceivedNotInvoicedAccount",+ "inventoryShippedNotInvoicedAccount",+ "workInProgressAccount",+ "directCostAppliedAccount",+ "overheadCostAppliedAccount",+ "purchaseVarianceAccount",+ "inventoryAdjustmentVarianceAccount",+ "materialVarianceAccount",+ "capacityVarianceAccount",+ "overheadAccount"+) SELECT+ NULL,+ "costOfGoodsSoldAccount",+ "inventoryAccount",+ "inventoryInterimAccrualAccount",+ "inventoryReceivedNotInvoicedAccount",+ "inventoryShippedNotInvoicedAccount",+ "workInProgressAccount",+ "directCostAppliedAccount",+ "overheadCostAppliedAccount",+ "purchaseVarianceAccount",+ "inventoryAdjustmentVarianceAccount",+ "materialVarianceAccount",+ "capacityVarianceAccount",+ "overheadAccount"+FROM "accountDefault" WHERE "id" = true;++INSERT INTO "postingGroupPurchasing" (+ "partGroupId",+ "supplierTypeId",+ "purchaseAccount",+ "purchaseDiscountAccount",+ "purchaseCreditAccount",+ "purchasePrepaymentAccount",+ "purchaseTaxPayableAccount",+ "updatedBy"+) SELECT+ NULL,+ NULL,+ "purchaseAccount",+ "purchaseAccount",+ "purchaseAccount",+ "prepaymentAccount",+ "purchaseTaxPayableAccount",+ 'system'+FROM "accountDefault" WHERE "id" = true;++INSERT INTO "postingGroupSales" (+ "partGroupId",+ "customerTypeId",+ "salesAccount",+ "salesDiscountAccount",+ "salesCreditAccount",+ "salesPrepaymentAccount",+ "salesTaxPayableAccount",+ "updatedBy"+) SELECT+ NULL,+ NULL,+ "salesAccount",+ "salesDiscountAccount",+ "salesAccount",+ "prepaymentAccount",+ "salesTaxPayableAccount",+ 'system'+FROM "accountDefault" WHERE "id" = true;\ No newline at end of filediff --git a/packages/carbon-react/src/DataTable/DataTable.tsx b/packages/carbon-react/src/DataTable/DataTable.tsxindex 899bd66b49..edfa694128 100644--- a/packages/carbon-react/src/DataTable/DataTable.tsx+++ b/packages/carbon-react/src/DataTable/DataTable.tsx@@ -33,11 +33,13 @@ import { DataTablePagination } from "./DataTablePagination";interface DataTableProps<TData, TValue> {columns: ColumnDef<TData, TValue>[];data: TData[];+ defaultPageSize?: number;}const DataTable = <TData, TValue>({columns,data,+ defaultPageSize = 25,}: DataTableProps<TData, TValue>) => {const [rowSelection, setRowSelection] = useState({});const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({});@@ -55,7 +57,7 @@ const DataTable = <TData, TValue>({},initialState: {pagination: {- pageSize: 25,+ pageSize: defaultPageSize,},},enableRowSelection: true,