[PUI] Add more barcode actions (#7741)

- Add to ReturnOrder
- Add to SalesOrder
- Refactor for BuildOrder
This commit is contained in:
Oliver 2024-07-26 15:28:44 +10:00 committed by GitHub
parent 86fb9f0a8c
commit f92d734d80
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 40 additions and 5 deletions

View File

@ -24,6 +24,7 @@ import { ItemDetailsGrid } from '../../components/details/ItemDetails';
import NotesEditor from '../../components/editors/NotesEditor';
import {
ActionDropdown,
BarcodeActionDropdown,
CancelItemAction,
DuplicateItemAction,
EditItemAction,
@ -366,9 +367,7 @@ export default function BuildDetail() {
const buildActions = useMemo(() => {
return [
<AdminButton model={ModelType.build} pk={build.pk} />,
<ActionDropdown
tooltip={t`Barcode Actions`}
icon={<IconQrcode />}
<BarcodeActionDropdown
actions={[
ViewBarcodeAction({
model: ModelType.build,

View File

@ -18,9 +18,13 @@ import { ItemDetailsGrid } from '../../components/details/ItemDetails';
import NotesEditor from '../../components/editors/NotesEditor';
import {
ActionDropdown,
BarcodeActionDropdown,
CancelItemAction,
DuplicateItemAction,
EditItemAction
EditItemAction,
LinkBarcodeAction,
UnlinkBarcodeAction,
ViewBarcodeAction
} from '../../components/items/ActionDropdown';
import { PlaceholderPanel } from '../../components/items/Placeholder';
import InstanceDetail from '../../components/nav/InstanceDetail';
@ -290,6 +294,20 @@ export default function ReturnOrderDetail() {
const orderActions = useMemo(() => {
return [
<AdminButton model={ModelType.returnorder} pk={order.pk} />,
<BarcodeActionDropdown
actions={[
ViewBarcodeAction({
model: ModelType.returnorder,
pk: order.pk
}),
LinkBarcodeAction({
hidden: order?.barcode_hash
}),
UnlinkBarcodeAction({
hidden: !order?.barcode_hash
})
]}
/>,
<PrintingActions
modelType={ModelType.returnorder}
items={[order.pk]}

View File

@ -21,9 +21,13 @@ import { ItemDetailsGrid } from '../../components/details/ItemDetails';
import NotesEditor from '../../components/editors/NotesEditor';
import {
ActionDropdown,
BarcodeActionDropdown,
CancelItemAction,
DuplicateItemAction,
EditItemAction
EditItemAction,
LinkBarcodeAction,
UnlinkBarcodeAction,
ViewBarcodeAction
} from '../../components/items/ActionDropdown';
import { PlaceholderPanel } from '../../components/items/Placeholder';
import InstanceDetail from '../../components/nav/InstanceDetail';
@ -298,6 +302,20 @@ export default function SalesOrderDetail() {
const soActions = useMemo(() => {
return [
<AdminButton model={ModelType.salesorder} pk={order.pk} />,
<BarcodeActionDropdown
actions={[
ViewBarcodeAction({
model: ModelType.salesorder,
pk: order.pk
}),
LinkBarcodeAction({
hidden: order?.barcode_hash
}),
UnlinkBarcodeAction({
hidden: !order?.barcode_hash
})
]}
/>,
<PrintingActions
modelType={ModelType.salesorder}
items={[order.pk]}