mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-13 08:21:26 +00:00
Model render refactor (#5894)
* Embiggen search drawer * Refactor search drawer queries: - Use proper permission checks * Actually check user settings * Move StatusRenderer * Update renderers - Improve in-line render for different order types * Update stockitem renderere * Remove old renderer functions * Better data handling in UserState * Tweaks for settings pages * "Fix" scanning page - Rendering is a bit broken currently, as the barcode scan does not send back the model data * "Fix" scanning page - Rendering is a bit broken currently, as the barcode scan does not send back the model data - Required refactoring enumerations out into separate files - Some strange race condition / import loop was happening * Fix incorrect imports * Fixing hover card - Use unique key * fixes * Fix urls.md * More udpates * Fix unused import
This commit is contained in:
@ -3,9 +3,10 @@ import { Group, Text } from '@mantine/core';
|
||||
import { ReactNode, useMemo } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
import { ApiPaths } from '../../../enums/ApiEndpoints';
|
||||
import { shortenString } from '../../../functions/tables';
|
||||
import { useTableRefresh } from '../../../hooks/TableRefresh';
|
||||
import { ApiPaths, apiUrl } from '../../../states/ApiState';
|
||||
import { apiUrl } from '../../../states/ApiState';
|
||||
import { Thumbnail } from '../../images/Thumbnail';
|
||||
import { TableColumn } from '../Column';
|
||||
import { DescriptionColumn, LinkColumn } from '../ColumnRenderers';
|
||||
@ -77,23 +78,29 @@ function partTableColumns(): TableColumn[] {
|
||||
|
||||
if (min_stock > stock) {
|
||||
extra.push(
|
||||
<Text color="orange">{t`Minimum stock` + `: ${min_stock}`}</Text>
|
||||
<Text key="min-stock" color="orange">
|
||||
{t`Minimum stock` + `: ${min_stock}`}
|
||||
</Text>
|
||||
);
|
||||
|
||||
color = 'orange';
|
||||
}
|
||||
|
||||
if (record.ordering > 0) {
|
||||
extra.push(<Text>{t`On Order` + `: ${record.ordering}`}</Text>);
|
||||
extra.push(
|
||||
<Text key="on-order">{t`On Order` + `: ${record.ordering}`}</Text>
|
||||
);
|
||||
}
|
||||
|
||||
if (record.building) {
|
||||
extra.push(<Text>{t`Building` + `: ${record.building}`}</Text>);
|
||||
extra.push(
|
||||
<Text key="building">{t`Building` + `: ${record.building}`}</Text>
|
||||
);
|
||||
}
|
||||
|
||||
if (record.allocated_to_build_orders > 0) {
|
||||
extra.push(
|
||||
<Text>
|
||||
<Text key="bo-allocations">
|
||||
{t`Build Order Allocations` +
|
||||
`: ${record.allocated_to_build_orders}`}
|
||||
</Text>
|
||||
@ -102,7 +109,7 @@ function partTableColumns(): TableColumn[] {
|
||||
|
||||
if (record.allocated_to_sales_orders > 0) {
|
||||
extra.push(
|
||||
<Text>
|
||||
<Text key="so-allocations">
|
||||
{t`Sales Order Allocations` +
|
||||
`: ${record.allocated_to_sales_orders}`}
|
||||
</Text>
|
||||
@ -110,7 +117,9 @@ function partTableColumns(): TableColumn[] {
|
||||
}
|
||||
|
||||
if (available != stock) {
|
||||
extra.push(<Text>{t`Available` + `: ${available}`}</Text>);
|
||||
extra.push(
|
||||
<Text key="available">{t`Available` + `: ${available}`}</Text>
|
||||
);
|
||||
}
|
||||
|
||||
// TODO: Add extra information on stock "demand"
|
||||
|
Reference in New Issue
Block a user