mirror of
https://github.com/inventree/InvenTree.git
synced 2026-11-18 06:04:44 +00:00
Show location description in the Stock Item/Stock Details Location field (#13297)
* Show location description in the Stock Item/Stock Details Location field * Display full stock location path as a hover tooltip in the Stock Item/Stock Details/Location view * Display category description next to the category name if set: - Part category details view parent category - Part details view category Display location description next to the location name if set: - Part category details view Default location and Parent default location - Part details view Default and Category default location - Build orders Source and Destination location - Purchaseorder Destination location - Stock location parent location
This commit is contained in:
1 parent
8f8502d0d9
commit
2a1e0cf0a4
7 files changed
+54
-3
No files matched your search
@@ -10,7 +10,8 @@ import {
|
||||
Skeleton,
|
||||
Stack,
|
||||
Table,
|
||||
Text
|
||||
Text,
|
||||
Tooltip
|
||||
} from '@mantine/core';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { getValueAtPath } from 'mantine-datatable';
|
||||
@@ -39,6 +40,7 @@ export type DetailsField = {
|
||||
icon?: keyof InvenTreeIconType;
|
||||
name: string;
|
||||
label?: string;
|
||||
tooltip?: string;
|
||||
badge?: BadgeType;
|
||||
copy?: boolean;
|
||||
value_formatter?: () => ValueFormatterReturn;
|
||||
@@ -441,7 +443,11 @@ function TableAnchorValue(props: Readonly<FieldProps>) {
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Tooltip
|
||||
label={props.field_data.tooltip}
|
||||
disabled={!props.field_data.tooltip}
|
||||
withArrow
|
||||
>
|
||||
{make_link ? (
|
||||
<Anchor href={absoluteUrl} onClick={handleLinkClick}>
|
||||
<Text>{value}</Text>
|
||||
@@ -449,7 +455,7 @@ function TableAnchorValue(props: Readonly<FieldProps>) {
|
||||
) : (
|
||||
<Text c={color}>{value}</Text>
|
||||
)}
|
||||
</>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -178,6 +178,10 @@ export function BuildOrderDetailsPanel({
|
||||
icon: 'location',
|
||||
hidden: !instance?.take_from,
|
||||
model: ModelType.stocklocation,
|
||||
model_formatter: (location: any) =>
|
||||
location?.description
|
||||
? `${location.name} - ${location.description}`
|
||||
: location?.name,
|
||||
label: t`Source Location`,
|
||||
backup_value: t`Any location`
|
||||
},
|
||||
@@ -186,6 +190,10 @@ export function BuildOrderDetailsPanel({
|
||||
name: 'destination',
|
||||
icon: 'location',
|
||||
model: ModelType.stocklocation,
|
||||
model_formatter: (location: any) =>
|
||||
location?.description
|
||||
? `${location.name} - ${location.description}`
|
||||
: location?.name,
|
||||
label: t`Destination Location`,
|
||||
hidden: !instance?.destination
|
||||
},
|
||||
|
||||
@@ -49,6 +49,10 @@ export function PartCategoryDetailsPanel({
|
||||
icon: 'location',
|
||||
label: t`Parent Category`,
|
||||
model: ModelType.partcategory,
|
||||
model_formatter: (category: any) =>
|
||||
category?.description
|
||||
? `${category.name} - ${category.description}`
|
||||
: category?.name,
|
||||
hidden: !instance?.parent
|
||||
},
|
||||
{
|
||||
@@ -88,6 +92,10 @@ export function PartCategoryDetailsPanel({
|
||||
name: 'parent_default_location',
|
||||
label: t`Parent default location`,
|
||||
model: ModelType.stocklocation,
|
||||
model_formatter: (location: any) =>
|
||||
location?.description
|
||||
? `${location.name} - ${location.description}`
|
||||
: location?.name,
|
||||
hidden:
|
||||
!instance?.parent_default_location || !!instance?.default_location
|
||||
},
|
||||
@@ -96,6 +104,10 @@ export function PartCategoryDetailsPanel({
|
||||
name: 'default_location',
|
||||
label: t`Default location`,
|
||||
model: ModelType.stocklocation,
|
||||
model_formatter: (location: any) =>
|
||||
location?.description
|
||||
? `${location.name} - ${location.description}`
|
||||
: location?.name,
|
||||
hidden: !instance?.default_location
|
||||
}
|
||||
],
|
||||
|
||||
@@ -112,6 +112,10 @@ export function PartDetailsPanel({
|
||||
type: 'link',
|
||||
name: 'category',
|
||||
label: t`Category`,
|
||||
model_formatter: (category: any) =>
|
||||
category?.description
|
||||
? `${category.name} - ${category.description}`
|
||||
: category?.name,
|
||||
model: ModelType.partcategory
|
||||
},
|
||||
{
|
||||
@@ -119,6 +123,10 @@ export function PartDetailsPanel({
|
||||
name: 'default_location',
|
||||
label: t`Default Location`,
|
||||
model: ModelType.stocklocation,
|
||||
model_formatter: (default_location: any) =>
|
||||
default_location?.description
|
||||
? `${default_location.name} - ${default_location.description}`
|
||||
: default_location?.name,
|
||||
hidden: !instance?.default_location
|
||||
},
|
||||
{
|
||||
@@ -126,6 +134,10 @@ export function PartDetailsPanel({
|
||||
name: 'category_default_location',
|
||||
label: t`Category Default Location`,
|
||||
model: ModelType.stocklocation,
|
||||
model_formatter: (location: any) =>
|
||||
location?.description
|
||||
? `${location.name} - ${location.description}`
|
||||
: location?.name,
|
||||
hidden: instance?.default_location || !instance?.category_default_location
|
||||
},
|
||||
{
|
||||
|
||||
@@ -100,6 +100,10 @@ export function PurchaseOrderDetailsPanel({
|
||||
link: true,
|
||||
name: 'destination',
|
||||
label: t`Destination`,
|
||||
model_formatter: (location: any) =>
|
||||
location?.description
|
||||
? `${location.name} - ${location.description}`
|
||||
: location?.name,
|
||||
hidden: !instance?.destination
|
||||
},
|
||||
{
|
||||
|
||||
@@ -236,6 +236,11 @@ export function StockDetailsPanel({
|
||||
name: 'location',
|
||||
label: t`Location`,
|
||||
model: ModelType.stocklocation,
|
||||
tooltip: instance?.location_detail?.pathstring,
|
||||
model_formatter: (location: any) =>
|
||||
location?.description
|
||||
? `${location.name} - ${location.description}`
|
||||
: location?.name,
|
||||
hidden: !instance?.location
|
||||
},
|
||||
{
|
||||
|
||||
@@ -48,6 +48,10 @@ export function StockLocationDetailsPanel({
|
||||
icon: 'location',
|
||||
label: t`Parent Location`,
|
||||
model: ModelType.stocklocation,
|
||||
model_formatter: (location: any) =>
|
||||
location?.description
|
||||
? `${location.name} - ${location.description}`
|
||||
: location?.name,
|
||||
hidden: !instance?.parent
|
||||
}
|
||||
];
|
||||
|
||||
Reference in new issue
Block a user