Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
feat(erp): focus the first field on creation forms (#1804)
Naveen Kashyap1951740aa266
diff --git a/apps/erp/app/modules/inventory/ui/WarehouseTransfers/WarehouseTransferForm.tsx b/apps/erp/app/modules/inventory/ui/WarehouseTransfers/WarehouseTransferForm.tsxindex d7177e86f7..1414b9ff85 100644--- a/apps/erp/app/modules/inventory/ui/WarehouseTransfers/WarehouseTransferForm.tsx+++ b/apps/erp/app/modules/inventory/ui/WarehouseTransfers/WarehouseTransferForm.tsx@@ -359,7 +359,11 @@ const WarehouseTransferForm = ({table="warehouseTransfer"/>)}- <Input name="reference" label={t`Reference`} />+ <Input+ name="reference"+ label={t`Reference`}+ autoFocus={!isEditing}+ /><Location name="fromLocationId" label={t`From Location`} /><Location name="toLocationId" label={t`To Location`} />{isEditing && (diff --git a/apps/erp/app/modules/invoicing/ui/Memo/MemoForm.tsx b/apps/erp/app/modules/invoicing/ui/Memo/MemoForm.tsxindex aa2c8d20e8..a8716738da 100644--- a/apps/erp/app/modules/invoicing/ui/Memo/MemoForm.tsx+++ b/apps/erp/app/modules/invoicing/ui/Memo/MemoForm.tsx@@ -196,9 +196,17 @@ const MemoForm = ({ initialValues, type }: MemoFormProps) => {/>)}{isVendor ? (- <Supplier name="supplierId" label={t`Supplier`} />+ <Supplier+ autoFocus={!isEditing}+ name="supplierId"+ label={t`Supplier`}+ />) : (- <Customer name="customerId" label={t`Customer`} />+ <Customer+ autoFocus={!isEditing}+ name="customerId"+ label={t`Customer`}+ />)}<Selectname="direction"diff --git a/apps/erp/app/modules/invoicing/ui/Payment/PaymentForm.tsx b/apps/erp/app/modules/invoicing/ui/Payment/PaymentForm.tsxindex 2867a01e3c..9ddc3f6ff5 100644--- a/apps/erp/app/modules/invoicing/ui/Payment/PaymentForm.tsx+++ b/apps/erp/app/modules/invoicing/ui/Payment/PaymentForm.tsx@@ -242,6 +242,7 @@ const PaymentForm = ({ initialValues, seedInvoiceIds }: PaymentFormProps) => {/>)}<SelectControlled+ autoFocus={!isEditing}name="paymentKind"label={t`Type`}options={typeOptions}diff --git a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceForm.tsx b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceForm.tsxindex 0922945ff1..ac75aeed60 100644--- a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceForm.tsx+++ b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceForm.tsx@@ -139,6 +139,7 @@ const PurchaseInvoiceForm = ({ initialValues }: PurchaseInvoiceFormProps) => {/>)}<Supplier+ autoFocus={!isEditing}name="supplierId"label={t`Supplier`}defaultCurrencyCode={invoiceSupplier.currencyCode}diff --git a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLineForm.tsx b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLineForm.tsxindex 098000f544..09237df491 100644--- a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLineForm.tsx+++ b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLineForm.tsx@@ -566,6 +566,7 @@ const PurchaseInvoiceLineForm = ({<VStack><div className="grid w-full gap-x-8 gap-y-4 grid-cols-1 lg:grid-cols-3"><Item+ autoFocus={!isEditing}name="itemId"label={lineType}type={lineType}diff --git a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceForm.tsx b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceForm.tsxindex 91efd853a4..beea51d2c0 100644--- a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceForm.tsx+++ b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceForm.tsx@@ -205,6 +205,7 @@ const SalesInvoiceForm = ({ initialValues }: SalesInvoiceFormProps) => {/>)}<Customer+ autoFocus={!isEditing}name="customerId"label={t`Customer`}onChange={onCustomerChange}diff --git a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceLineForm.tsx b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceLineForm.tsxindex e4aec58b66..86cc18906d 100644--- a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceLineForm.tsx+++ b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceLineForm.tsx@@ -536,6 +536,7 @@ const SalesInvoiceLineForm = ({)}<div className="grid w-full gap-x-8 gap-y-4 grid-cols-1 lg:grid-cols-3"><Item+ autoFocus={!isEditing}name="itemId"label={lineType}type={lineType}diff --git a/apps/erp/app/modules/items/ui/ChangeNotice/ChangeNoticeForm.tsx b/apps/erp/app/modules/items/ui/ChangeNotice/ChangeNoticeForm.tsxindex 9df611b037..2c7a4c9d75 100644--- a/apps/erp/app/modules/items/ui/ChangeNotice/ChangeNoticeForm.tsx+++ b/apps/erp/app/modules/items/ui/ChangeNotice/ChangeNoticeForm.tsx@@ -100,7 +100,7 @@ const ChangeNoticeForm = ({isModal ? "" : "md:grid-cols-2"}`}>- <Input name="name" label={t`Name`} />+ <Input name="name" label={t`Name`} autoFocus={!isEditing} /><Comboboxname="changeOrderTypeId"label={t`Category`}diff --git a/apps/erp/app/modules/items/ui/Parts/PartForm.tsx b/apps/erp/app/modules/items/ui/Parts/PartForm.tsxindex 760aa03fd8..6cc3f2bfc5 100644--- a/apps/erp/app/modules/items/ui/Parts/PartForm.tsx+++ b/apps/erp/app/modules/items/ui/Parts/PartForm.tsx@@ -283,6 +283,7 @@ const PartForm = ({ initialValues, type = "card", onClose }: PartFormProps) => {onChange={onIdChange}isDisabled={loading}isUppercase={!allowLowercaseItemIds}+ autoFocus/>)}<Inputdiff --git a/apps/erp/app/modules/production/ui/Jobs/JobForm.tsx b/apps/erp/app/modules/production/ui/Jobs/JobForm.tsxindex b1de8dc9b1..73a1d2092d 100644--- a/apps/erp/app/modules/production/ui/Jobs/JobForm.tsx+++ b/apps/erp/app/modules/production/ui/Jobs/JobForm.tsx@@ -292,6 +292,7 @@ const JobForm = ({ initialValues }: JobFormProps) => {)}<Item+ autoFocus={!isEditing}name="itemId"label={i18n._(itemTypeLabel(type))}type={type}diff --git a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm.tsx b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm.tsxindex 5a5bb22fe4..cee5575520 100644--- a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm.tsx+++ b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm.tsx@@ -609,6 +609,7 @@ const PurchaseOrderLineForm = ({<VStack><div className="grid w-full gap-x-8 gap-y-4 grid-cols-1 lg:grid-cols-3"><Item+ autoFocus={!isEditing}name="itemId"label={i18n._(itemTypeLabel(lineType))}type={lineType}diff --git a/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQForm.tsx b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQForm.tsxindex 18835efa21..301043618d 100644--- a/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQForm.tsx+++ b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQForm.tsx@@ -85,6 +85,7 @@ const PurchasingRFQForm = ({ initialValues }: PurchasingRFQFormProps) => {/>)}<Suppliers+ autoFocus={!isEditing}name="supplierIds"label={t`Suppliers`}termId="purchasing-rfq-suppliers"diff --git a/apps/erp/app/modules/quality/ui/Gauge/GaugeForm.tsx b/apps/erp/app/modules/quality/ui/Gauge/GaugeForm.tsxindex 647e00182b..6869a53efe 100644--- a/apps/erp/app/modules/quality/ui/Gauge/GaugeForm.tsx+++ b/apps/erp/app/modules/quality/ui/Gauge/GaugeForm.tsx@@ -375,7 +375,11 @@ function GaugeFormContent({table="gauge"/>)}- <Input name="description" label={t`Description`} />+ <Input+ name="description"+ label={t`Description`}+ autoFocus={!isEditing}+ /><Selectname="gaugeTypeId"label={t`Gauge Type`}diff --git a/apps/erp/app/modules/quality/ui/Issue/IssueForm.tsx b/apps/erp/app/modules/quality/ui/Issue/IssueForm.tsxindex d4b79f6861..8958fa8b27 100644--- a/apps/erp/app/modules/quality/ui/Issue/IssueForm.tsx+++ b/apps/erp/app/modules/quality/ui/Issue/IssueForm.tsx@@ -133,7 +133,7 @@ const IssueForm = ({<VStack spacing={4}><div className="grid w-full gap-4 grid-cols-1 md:grid-cols-2">- <Input name="name" label={t`Name`} />+ <Input name="name" label={t`Name`} autoFocus={!isEditing} /><Selectname="nonConformanceTypeId"label={t`Issue Type`}diff --git a/apps/erp/app/modules/quality/ui/IssueWorkflows/IssueWorkflowForm.tsx b/apps/erp/app/modules/quality/ui/IssueWorkflows/IssueWorkflowForm.tsxindex 5be9a58c58..35bc461c78 100644--- a/apps/erp/app/modules/quality/ui/IssueWorkflows/IssueWorkflowForm.tsx+++ b/apps/erp/app/modules/quality/ui/IssueWorkflows/IssueWorkflowForm.tsx@@ -171,7 +171,7 @@ const IssueWorkflowForm = ({</p></VStack></HStack>- <Input name="name" label={t`Name`} />+ <Input name="name" label={t`Name`} autoFocus={!isEditing} /><VStack spacing={2}><labelhtmlFor="content"diff --git a/apps/erp/app/modules/resources/ui/Maintenance/MaintenanceDispatchForm.tsx b/apps/erp/app/modules/resources/ui/Maintenance/MaintenanceDispatchForm.tsxindex 06fb954b1b..f9e66e6ab0 100644--- a/apps/erp/app/modules/resources/ui/Maintenance/MaintenanceDispatchForm.tsx+++ b/apps/erp/app/modules/resources/ui/Maintenance/MaintenanceDispatchForm.tsx@@ -134,6 +134,7 @@ const MaintenanceDispatchForm = ({<Trans>Description</Trans></Label><Editor+ autoFocus={!isEditing}initialValue={content}onUpload={onUploadImage}onChange={(value) => {diff --git a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderLineForm.tsx b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderLineForm.tsxindex f65934eddb..c344f795af 100644--- a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderLineForm.tsx+++ b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderLineForm.tsx@@ -629,6 +629,7 @@ const SalesOrderLineForm = ({<VStack><div className="grid w-full gap-x-8 gap-y-4 grid-cols-1 lg:grid-cols-3"><Item+ autoFocus={!isEditing}name="itemId"label={i18n._(itemTypeLabel(lineType as "Part"))}type={lineType as "Part"}diff --git a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderLineJobs.tsx b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderLineJobs.tsxindex 53b6408979..5b1d46c0a9 100644--- a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderLineJobs.tsx+++ b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderLineJobs.tsx@@ -229,7 +229,7 @@ export function SalesOrderLineJobs({label={t`Job ID`}table="job"/>- <Location name="locationId" label={t`Location`} />+ <Location autoFocus name="locationId" label={t`Location`} /><NumberControlledname="quantity"label={t`Quantity`}diff --git a/packages/react/src/Editor/Editor.tsx b/packages/react/src/Editor/Editor.tsxindex ada1369352..45a67760ce 100644--- a/packages/react/src/Editor/Editor.tsx+++ b/packages/react/src/Editor/Editor.tsx@@ -55,6 +55,8 @@ interface MentionConfig {interface EditorProp {className?: string;+ /** Focus the editor when it mounts. */+ autoFocus?: boolean;initialValue?: JSONContent;onChange: (value: JSONContent) => void;onUpload?: (file: File) => Promise<string>;@@ -106,6 +108,7 @@ const defaultOnUpload = async (file: File) => {const Editor = ({className,+ autoFocus,initialValue,onChange,onUpload,@@ -270,6 +273,7 @@ const Editor = ({initialContent: initialContentRef.current})}extensions={extensions}+ autofocus={autoFocus}editorProps={{handleDOMEvents: {keydown: (_view, event) => handleCommandNavigation(event)