diff --git a/src/frontend/src/pages/build/BuildDetail.tsx b/src/frontend/src/pages/build/BuildDetail.tsx
index 6ae38b7d56..8a10bb38dd 100644
--- a/src/frontend/src/pages/build/BuildDetail.tsx
+++ b/src/frontend/src/pages/build/BuildDetail.tsx
@@ -102,6 +102,15 @@ export default function BuildDetail() {
name: 'title',
label: t`Description`,
icon: 'description'
+ },
+ {
+ type: 'link',
+ name: 'parent',
+ icon: 'builds',
+ label: t`Parent Build`,
+ model_field: 'reference',
+ model: ModelType.build,
+ hidden: !build.parent
}
];
@@ -127,13 +136,6 @@ export default function BuildDetail() {
model: ModelType.salesorder,
model_field: 'reference',
hidden: !build.sales_order
- },
- {
- type: 'text',
- name: 'issued_by',
- label: t`Issued By`,
- badge: 'user',
- icon: 'user'
}
];
@@ -141,12 +143,34 @@ export default function BuildDetail() {
{
type: 'text',
name: 'issued_by',
- label: t`Issued By`
+ label: t`Issued By`,
+ badge: 'user'
},
{
type: 'text',
name: 'responsible',
- label: t`Responsible`
+ label: t`Responsible`,
+ badge: 'owner',
+ hidden: !build.responsible
+ }
+ ];
+
+ let br: DetailsField[] = [
+ {
+ type: 'link',
+ name: 'take_from',
+ icon: 'location',
+ model: ModelType.stocklocation,
+ label: t`Source Location`,
+ backup_value: t`Any location`
+ },
+ {
+ type: 'link',
+ name: 'destination',
+ icon: 'location',
+ model: ModelType.stocklocation,
+ label: t`Destination Location`,
+ hidden: !build.destination
}
];
@@ -167,6 +191,7 @@ export default function BuildDetail() {
+
);
}, [build, instanceQuery]);
diff --git a/src/frontend/src/tables/Details.tsx b/src/frontend/src/tables/Details.tsx
index 2717f87eb9..05780c8c18 100644
--- a/src/frontend/src/tables/Details.tsx
+++ b/src/frontend/src/tables/Details.tsx
@@ -75,6 +75,7 @@ type InternalLinkField = {
model: ModelType;
model_field?: string;
model_formatter?: (value: any) => string;
+ backup_value?: string;
};
type ExternalLinkField = {
@@ -351,19 +352,27 @@ function TableAnchorValue(props: FieldProps) {
return getDetailUrl(props.field_data.model, props.field_value);
}, [props.field_data.model, props.field_value]);
+ let make_link = props.field_data?.link ?? true;
+
// Construct the "return value" for the fetched data
- // Basic fallback value
- let value = data?.name ?? 'No name defined';
+ let value = undefined;
if (props.field_data.model_formatter) {
value = props.field_data.model_formatter(data) ?? value;
} else if (props.field_data.model_field) {
value = data?.[props.field_data.model_field] ?? value;
+ } else {
+ value = data?.name;
+ }
+
+ if (value === undefined) {
+ value = data?.name ?? props.field_data?.backup_value ?? 'No name defined';
+ make_link = false;
}
return (
}>
- {props.field_data.link ?? true ? (
+ {make_link ? (