Skip to content

Commit

Permalink
[PUI] Add more barcode actions (inventree#7741)
Browse files Browse the repository at this point in the history
- Add to ReturnOrder
- Add to SalesOrder
- Refactor for BuildOrder
  • Loading branch information
SchrodingersGat authored Jul 26, 2024
1 parent 86fb9f0 commit f92d734
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/frontend/src/pages/build/BuildDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { ItemDetailsGrid } from '../../components/details/ItemDetails';
import NotesEditor from '../../components/editors/NotesEditor';
import {
ActionDropdown,
BarcodeActionDropdown,
CancelItemAction,
DuplicateItemAction,
EditItemAction,
Expand Down Expand Up @@ -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,
Expand Down
20 changes: 19 additions & 1 deletion src/frontend/src/pages/sales/ReturnOrderDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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]}
Expand Down
20 changes: 19 additions & 1 deletion src/frontend/src/pages/sales/SalesOrderDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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]}
Expand Down

0 comments on commit f92d734

Please sign in to comment.