2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-12 18:15:40 +00:00

[PUI] Child item table (#6334)

* Add child stock item table

* Fix stock item splitting bug

- StockItem tree was not being rebuilt correctly
- Add unit tests

* Annotate StockItem serializer with "child_items" count

* Show or hide "child items" panel

* Account for case where tree_id is zero
This commit is contained in:
Oliver
2024-01-24 23:33:34 +11:00
committed by GitHub
parent 65ecb975c6
commit 0f2675c139
4 changed files with 45 additions and 3 deletions

View File

@ -1,5 +1,5 @@
import { t } from '@lingui/macro';
import { Alert, LoadingOverlay, Stack, Text } from '@mantine/core';
import { Alert, LoadingOverlay, Skeleton, Stack, Text } from '@mantine/core';
import {
IconBookmark,
IconBoxPadding,
@ -34,6 +34,7 @@ import { PageDetail } from '../../components/nav/PageDetail';
import { PanelGroup, PanelType } from '../../components/nav/PanelGroup';
import { StockLocationTree } from '../../components/nav/StockLocationTree';
import { AttachmentTable } from '../../components/tables/general/AttachmentTable';
import { StockItemTable } from '../../components/tables/stock/StockItemTable';
import { NotesEditor } from '../../components/widgets/MarkdownEditor';
import { ApiPaths } from '../../enums/ApiEndpoints';
import { useEditStockItem } from '../../forms/StockForms';
@ -94,14 +95,18 @@ export default function StockDetail() {
name: 'installed_items',
label: t`Installed Items`,
icon: <IconBoxPadding />,
content: <PlaceholderPanel />,
hidden: !stockitem?.part_detail?.assembly
},
{
name: 'child_items',
label: t`Child Items`,
icon: <IconSitemap />,
content: <PlaceholderPanel />
hidden: (stockitem?.child_items ?? 0) == 0,
content: stockitem?.pk ? (
<StockItemTable params={{ ancestor: stockitem.pk }} />
) : (
<Skeleton />
)
},
{
name: 'attachments',