Compare commits

..

No commits in common. "e4657cc69222af14f1c061a1298fd9a3bd12927b" and "a2a1c5be5bf00d3769b0fefc11eac9ee3449ad5b" have entirely different histories.

46 changed files with 139 additions and 228 deletions

View File

@ -170,7 +170,7 @@ const InvoiceInfo = () => {
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={invoiceId} _id={invoiceId}
objectType='invoice' objectType='invoice'
showEndingDivider={true} showEndingDivider={true}

View File

@ -163,7 +163,7 @@ const PaymentInfo = () => {
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={paymentId} _id={paymentId}
objectType='payment' objectType='payment'
showEndingDivider={true} showEndingDivider={true}

View File

@ -123,13 +123,11 @@ const TaxRecordInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={taxRecordId} _id={taxRecordId}
objectType='taxRecord' objectType='taxRecord'
showEndingDivider={true} showEndingDivider={true}

View File

@ -127,7 +127,7 @@ const FilamentStockInfo = () => {
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={filamentStockId} _id={filamentStockId}
objectType='filamentStock' objectType='filamentStock'
showEndingDivider={true} showEndingDivider={true}

View File

@ -122,13 +122,11 @@ const OrderItemInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={orderItemId} _id={orderItemId}
objectType='orderItem' objectType='orderItem'
showEndingDivider={true} showEndingDivider={true}

View File

@ -137,7 +137,7 @@ const PartStockInfo = () => {
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={partStockId} _id={partStockId}
objectType='partStock' objectType='partStock'
showEndingDivider={true} showEndingDivider={true}

View File

@ -164,7 +164,7 @@ const ProductStockInfo = () => {
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={productStockId} _id={productStockId}
objectType='productStock' objectType='productStock'
showEndingDivider={true} showEndingDivider={true}

View File

@ -197,7 +197,7 @@ const PurchaseOrderInfo = () => {
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={purchaseOrderId} _id={purchaseOrderId}
objectType='purchaseOrder' objectType='purchaseOrder'
showEndingDivider={true} showEndingDivider={true}

View File

@ -158,13 +158,11 @@ const PurchaseOrderInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={purchaseOrderId} _id={purchaseOrderId}
objectType='purchaseOrder' objectType='purchaseOrder'
showEndingDivider={true} showEndingDivider={true}

View File

@ -147,13 +147,11 @@ const ShipmentInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={shipmentId} _id={shipmentId}
objectType='shipment' objectType='shipment'
showEndingDivider={true} showEndingDivider={true}

View File

@ -125,13 +125,11 @@ const StockAuditInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={stockAuditId} _id={stockAuditId}
objectType='stockAudit' objectType='stockAudit'
showEndingDivider={true} showEndingDivider={true}

View File

@ -126,13 +126,11 @@ const StockLocationInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={stockLocationId} _id={stockLocationId}
objectType='stockLocation' objectType='stockLocation'
showEndingDivider={true} showEndingDivider={true}

View File

@ -152,7 +152,7 @@ const StockTransferInfo = () => {
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={stockTransferId} _id={stockTransferId}
objectType='stockTransfer' objectType='stockTransfer'
showEndingDivider={true} showEndingDivider={true}

View File

@ -134,7 +134,7 @@ const AppPasswordInfo = () => {
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={appPasswordId} _id={appPasswordId}
objectType='appPassword' objectType='appPassword'
showEndingDivider={true} showEndingDivider={true}

View File

@ -125,13 +125,11 @@ const CourierServiceInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={courierServiceId} _id={courierServiceId}
objectType='courierService' objectType='courierService'
showEndingDivider={true} showEndingDivider={true}

View File

@ -121,13 +121,11 @@ const CourierInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={courierId} _id={courierId}
objectType='courier' objectType='courier'
showEndingDivider={true} showEndingDivider={true}

View File

@ -122,13 +122,11 @@ const DocumentJobInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={documentJobId} _id={documentJobId}
objectType='documentJob' objectType='documentJob'
showEndingDivider={true} showEndingDivider={true}

View File

@ -136,7 +136,7 @@ const DocumentPrinterInfo = () => {
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={documentPrinterId} _id={documentPrinterId}
objectType='documentPrinter' objectType='documentPrinter'
showEndingDivider={true} showEndingDivider={true}

View File

@ -128,7 +128,7 @@ const DocumentSizeInfo = () => {
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={documentSizeId} _id={documentSizeId}
objectType='documentSize' objectType='documentSize'
showEndingDivider={true} showEndingDivider={true}

View File

@ -133,7 +133,7 @@ const DocumentTemplateInfo = () => {
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={documentTemplateId} _id={documentTemplateId}
objectType='documentTemplate' objectType='documentTemplate'
showEndingDivider={true} showEndingDivider={true}

View File

@ -120,13 +120,11 @@ const FilamentSkuInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={filamentSkuId} _id={filamentSkuId}
objectType='filamentSku' objectType='filamentSku'
showEndingDivider={true} showEndingDivider={true}

View File

@ -141,13 +141,11 @@ const FilamentInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={filamentId} _id={filamentId}
objectType='filament' objectType='filament'
showEndingDivider={true} showEndingDivider={true}

View File

@ -142,7 +142,7 @@ const FileInfo = () => {
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={fileId} _id={fileId}
objectType='file' objectType='file'
showEndingDivider={true} showEndingDivider={true}

View File

@ -137,13 +137,11 @@ const HostInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={hostId} _id={hostId}
objectType='host' objectType='host'
showEndingDivider={true} showEndingDivider={true}

View File

@ -123,13 +123,11 @@ const MaterialInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={materialId} _id={materialId}
objectType='material' objectType='material'
showEndingDivider={true} showEndingDivider={true}

View File

@ -111,13 +111,11 @@ const NoteTypeInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={noteTypeId} _id={noteTypeId}
objectType='noteType' objectType='noteType'
showEndingDivider={true} showEndingDivider={true}

View File

@ -126,13 +126,11 @@ const NoteInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={noteId} _id={noteId}
objectType='note' objectType='note'
showEndingDivider={true} showEndingDivider={true}

View File

@ -115,13 +115,11 @@ const PartSkuInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={partSkuId} _id={partSkuId}
objectType='partSku' objectType='partSku'
showEndingDivider={true} showEndingDivider={true}

View File

@ -121,13 +121,11 @@ const PartInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={partId} _id={partId}
objectType='part' objectType='part'
showEndingDivider={true} showEndingDivider={true}

View File

@ -120,13 +120,11 @@ const ProductCategoryInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={productCategoryId} _id={productCategoryId}
objectType='productCategory' objectType='productCategory'
showEndingDivider={true} showEndingDivider={true}

View File

@ -123,13 +123,11 @@ const ProductSkuInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={productSkuId} _id={productSkuId}
objectType='productSku' objectType='productSku'
showEndingDivider={true} showEndingDivider={true}

View File

@ -121,13 +121,11 @@ const ProductInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={productId} _id={productId}
objectType='product' objectType='product'
showEndingDivider={true} showEndingDivider={true}

View File

@ -120,13 +120,11 @@ const TaxRateInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={taxRateId} _id={taxRateId}
objectType='taxRate' objectType='taxRate'
showEndingDivider={true} showEndingDivider={true}

View File

@ -126,13 +126,11 @@ const UserInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={userId} _id={userId}
objectType='user' objectType='user'
showEndingDivider={true} showEndingDivider={true}

View File

@ -120,13 +120,11 @@ const VendorInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={vendorId} _id={vendorId}
objectType='vendor' objectType='vendor'
showEndingDivider={true} showEndingDivider={true}

View File

@ -129,13 +129,11 @@ const GCodeFileInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={gcodeFileId} _id={gcodeFileId}
objectType='gcodeFile' objectType='gcodeFile'
showEndingDivider={true} showEndingDivider={true}

View File

@ -147,7 +147,7 @@ const JobInfo = () => {
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={jobId} _id={jobId}
objectType='job' objectType='job'
showEndingDivider={true} showEndingDivider={true}

View File

@ -137,7 +137,7 @@ const PrinterInfo = () => {
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={printerId} _id={printerId}
objectType='printer' objectType='printer'
showEndingDivider={true} showEndingDivider={true}

View File

@ -117,7 +117,7 @@ const SubJobInfo = () => {
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={subJobId} _id={subJobId}
objectType='subJob' objectType='subJob'
showEndingDivider={true} showEndingDivider={true}

View File

@ -120,13 +120,11 @@ const ClientInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={clientId} _id={clientId}
objectType='client' objectType='client'
showEndingDivider={true} showEndingDivider={true}

View File

@ -137,13 +137,11 @@ const ListingVarientInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={listingVarientId} _id={listingVarientId}
objectType='listingVarient' objectType='listingVarient'
showEndingDivider={true} showEndingDivider={true}

View File

@ -142,13 +142,11 @@ const ListingInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={listingId} _id={listingId}
objectType='listing' objectType='listing'
showEndingDivider={true} showEndingDivider={true}

View File

@ -210,13 +210,11 @@ const MarketplaceInfo = () => {
}} }}
editLoading={objectFormState.editLoading} editLoading={objectFormState.editLoading}
formValid={objectFormState.formValid} formValid={objectFormState.formValid}
disabled={ disabled={objectFormState.beingEditedByOther || objectFormState.loading}
objectFormState.beingEditedByOther || objectFormState.loading
}
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={marketplaceId} _id={marketplaceId}
objectType='marketplace' objectType='marketplace'
showEndingDivider={true} showEndingDivider={true}

View File

@ -194,7 +194,7 @@ const SalesOrderInfo = () => {
loading={objectFormState.editLoading} loading={objectFormState.editLoading}
/> />
<ObjectTableNavigationButtons <ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing} disabled={objectFormState.loading}
_id={salesOrderId} _id={salesOrderId}
objectType='salesOrder' objectType='salesOrder'
showEndingDivider={true} showEndingDivider={true}

View File

@ -1,76 +1,62 @@
import { useEffect, useRef, cloneElement, useMemo, useState } from 'react' import { useEffect, useRef, cloneElement, useCallback } from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import { Popover, Typography } from 'antd' import { Popover, Typography } from 'antd'
const MODIFIER_ALIASES = { // Utility to parse shortcut string like 'cmd+shift+p' or 'ctrl+s'
cmd: 'meta',
meta: 'meta',
ctrl: 'control',
control: 'control',
alt: 'alt',
option: 'alt',
shift: 'shift'
}
function parseShortcut(shortcut) { function parseShortcut(shortcut) {
return shortcut const parts = shortcut.toLowerCase().split('+')
.toLowerCase() return {
.split('+') meta: parts.includes('cmd') || parts.includes('meta') || false,
.map((part) => MODIFIER_ALIASES[part] ?? part) ctrl: parts.includes('ctrl') || parts.includes('control') || false,
alt: parts.includes('alt') || parts.includes('option') || false,
shift: parts.includes('shift') || false,
key: parts.find(
(p) =>
!['cmd', 'meta', 'ctrl', 'control', 'alt', 'option', 'shift'].includes(
p
)
)[0]
}
} }
function getPressedKey(event) { const { Text } = Typography
const KeyboardShortcut = ({ shortcut, children, hint, onTrigger }) => {
const childRef = useRef()
const shortcutObj = parseShortcut(shortcut)
// Helper to get the set of keys required for the shortcut
const getShortcutKeySet = useCallback((shortcutObj) => {
const keys = []
if (shortcutObj.meta) keys.push('Meta')
if (shortcutObj.ctrl) keys.push('Control')
if (shortcutObj.alt) keys.push('Alt')
if (shortcutObj.shift) keys.push('Shift')
// shortcutObj.code is like 'keyp', so extract the last char
if (shortcutObj.key) {
keys.push('Key' + shortcutObj.key.toUpperCase())
}
return new Set(keys)
}, [])
const shortcutKeySet = getShortcutKeySet(shortcutObj)
useEffect(() => {
const pressedKeys = new Set()
const handleKeyDown = (event) => {
if ( if (
event.key === 'Meta' || event.key === 'Meta' ||
event.key === 'Control' || event.key === 'Control' ||
event.key === 'Alt' || event.key === 'Alt' ||
event.key === 'Shift' event.key === 'Shift'
) { ) {
return event.key.toLowerCase() pressedKeys.add(event.key)
} else if (event.code && event.code.startsWith('Key')) {
pressedKeys.add(event.code)
} }
if (event.code) {
const code = event.code.toLowerCase()
if (code.startsWith('key')) {
return code.slice(3)
}
return code
}
return null
}
const { Text } = Typography
const KeyboardShortcut = ({
shortcut,
children,
hint,
onTrigger,
log = false
}) => {
const childRef = useRef()
const pressedKeysRef = useRef(new Set())
const shortcutKeys = useMemo(() => parseShortcut(shortcut), [shortcut])
const [pressedKeys, setPressedKeys] = useState([])
useEffect(() => {
const syncPressedKeys = () => {
setPressedKeys([...pressedKeysRef.current])
}
const handleKeyDown = (event) => {
const key = getPressedKey(event)
if (key) {
pressedKeysRef.current.add(key)
syncPressedKeys()
}
if (log) {
console.log('Key Down:', key, 'Pressed Keys:', [...pressedKeysRef.current])
}
if ( if (
shortcutKeys.length && shortcutKeySet.size &&
shortcutKeys.every((k) => pressedKeysRef.current.has(k)) [...shortcutKeySet].every((k) => pressedKeys.has(k))
) { ) {
if (typeof onTrigger === 'function') { if (typeof onTrigger === 'function') {
onTrigger(event) onTrigger(event)
@ -78,24 +64,27 @@ const KeyboardShortcut = ({
event.preventDefault() event.preventDefault()
} }
} }
const handleKeyUp = (event) => { const handleKeyUp = (event) => {
const key = getPressedKey(event) if (
if (key) { event.key === 'Meta' ||
pressedKeysRef.current.delete(key) event.key === 'Control' ||
syncPressedKeys() event.key === 'Alt' ||
event.key === 'Shift'
) {
pressedKeys.delete(event.key)
} else if (event.code && event.code.startsWith('Key')) {
pressedKeys.delete(event.key.toUpperCase())
} }
} }
window.addEventListener('keydown', handleKeyDown) window.addEventListener('keydown', handleKeyDown)
window.addEventListener('keyup', handleKeyUp) window.addEventListener('keyup', handleKeyUp)
return () => { return () => {
window.removeEventListener('keydown', handleKeyDown) window.removeEventListener('keydown', handleKeyDown)
window.removeEventListener('keyup', handleKeyUp) window.removeEventListener('keyup', handleKeyUp)
} }
}, [shortcutKeys, onTrigger, log]) }, [shortcut, shortcutObj, onTrigger, shortcutKeySet])
// Clone the child to attach a ref
const element = cloneElement(children, { ref: childRef }) const element = cloneElement(children, { ref: childRef })
if (hint) { if (hint) {
@ -119,8 +108,7 @@ KeyboardShortcut.propTypes = {
shortcut: PropTypes.string.isRequired, // e.g. 'cmd+shift+p' shortcut: PropTypes.string.isRequired, // e.g. 'cmd+shift+p'
onTrigger: PropTypes.func.isRequired, onTrigger: PropTypes.func.isRequired,
children: PropTypes.element.isRequired, children: PropTypes.element.isRequired,
hint: PropTypes.string, // Optional, e.g. ' P' hint: PropTypes.string // Optional, e.g. ' P'
log: PropTypes.bool // Optional, e.g. true
} }
export default KeyboardShortcut export default KeyboardShortcut

View File

@ -7,7 +7,6 @@ import PropTypes from 'prop-types'
import { ApiServerContext } from '../context/ApiServerContext' import { ApiServerContext } from '../context/ApiServerContext'
import { AuthContext } from '../context/AuthContext' import { AuthContext } from '../context/AuthContext'
import { useTableStatePersistence } from '../context/TableStateContext' import { useTableStatePersistence } from '../context/TableStateContext'
import KeyboardShortcut from './KeyboardShortcut.jsx'
const ObjectTableNavigationButtons = ({ const ObjectTableNavigationButtons = ({
disabled, disabled,
@ -96,36 +95,16 @@ const ObjectTableNavigationButtons = ({
<Divider type='vertical' style={{ margin: '0 4px', height: '18px' }} /> <Divider type='vertical' style={{ margin: '0 4px', height: '18px' }} />
)} )}
<Space size='small'> <Space size='small'>
<KeyboardShortcut
shortcut='alt+arrowleft'
hint='ALT LEFT'
onTrigger={useCallback(() => {
if (!disabled && !loading && neighbors.previous?._id) {
handlePrevious()
}
}, [disabled, loading, neighbors.previous?._id])}
>
<Button <Button
icon={<ArrowLeftIcon />} icon={<ArrowLeftIcon />}
onClick={handlePrevious} onClick={handlePrevious}
disabled={disabled || loading || !neighbors.previous?._id} disabled={disabled || loading || !neighbors.previous?._id}
/> />
</KeyboardShortcut>
<KeyboardShortcut
shortcut='alt+arrowright'
hint='ALT RIGHT'
onTrigger={useCallback(() => {
if (!disabled && !loading && neighbors.next?._id) {
handleNext()
}
}, [disabled, loading, neighbors.next?._id])}
>
<Button <Button
icon={<ArrowRightIcon />} icon={<ArrowRightIcon />}
onClick={handleNext} onClick={handleNext}
disabled={disabled || loading || !neighbors.next?._id} disabled={disabled || loading || !neighbors.next?._id}
/> />
</KeyboardShortcut>
</Space> </Space>
</Flex> </Flex>
) )