mirror of
https://github.com/inventree/InvenTree.git
synced 2026-03-24 13:20:55 +00:00
Merge branch 'master' into generic-parameters
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
ActionIcon,
|
||||
Button,
|
||||
type DefaultMantineColor,
|
||||
type FloatingPosition,
|
||||
CopyButton as MantineCopyButton,
|
||||
type MantineSize,
|
||||
Text,
|
||||
@@ -16,12 +17,18 @@ import type { JSX } from 'react';
|
||||
export function CopyButton({
|
||||
value,
|
||||
label,
|
||||
tooltip,
|
||||
disabled,
|
||||
tooltipPosition,
|
||||
content,
|
||||
size,
|
||||
color = 'gray'
|
||||
}: Readonly<{
|
||||
value: any;
|
||||
label?: string;
|
||||
tooltip?: string;
|
||||
disabled?: boolean;
|
||||
tooltipPosition?: FloatingPosition;
|
||||
content?: JSX.Element;
|
||||
size?: MantineSize;
|
||||
color?: DefaultMantineColor;
|
||||
@@ -31,8 +38,13 @@ export function CopyButton({
|
||||
return (
|
||||
<MantineCopyButton value={value}>
|
||||
{({ copied, copy }) => (
|
||||
<Tooltip label={copied ? t`Copied` : t`Copy`} withArrow>
|
||||
<Tooltip
|
||||
label={copied ? t`Copied` : (tooltip ?? t`Copy`)}
|
||||
withArrow
|
||||
position={tooltipPosition}
|
||||
>
|
||||
<ButtonComponent
|
||||
disabled={disabled}
|
||||
color={copied ? 'teal' : color}
|
||||
onClick={copy}
|
||||
variant='transparent'
|
||||
|
||||
@@ -32,6 +32,7 @@ import { useCreateApiFormModal } from '../../hooks/UseForm';
|
||||
import { useInstance } from '../../hooks/UseInstance';
|
||||
import useWizard from '../../hooks/UseWizard';
|
||||
import { RenderPartColumn } from '../../tables/ColumnRenderers';
|
||||
import { CopyButton } from '../buttons/CopyButton';
|
||||
import RemoveRowButton from '../buttons/RemoveRowButton';
|
||||
import { StandaloneField } from '../forms/StandaloneField';
|
||||
import Expand from '../items/Expand';
|
||||
@@ -235,6 +236,8 @@ function SelectPartsStep({
|
||||
quantity: {
|
||||
// TODO: Auto-fill with the desired quantity
|
||||
},
|
||||
purchase_price: {},
|
||||
purchase_price_currency: {},
|
||||
merge_items: {}
|
||||
};
|
||||
}, [selectedRecord]);
|
||||
@@ -299,6 +302,7 @@ function SelectPartsStep({
|
||||
model: ModelType.supplierpart,
|
||||
placeholder: t`Select supplier part`,
|
||||
required: true,
|
||||
autoFill: true,
|
||||
value: record.supplier_part?.pk,
|
||||
onValueChange: (value, instance) => {
|
||||
onSelectSupplierPart(record.part.pk, instance);
|
||||
@@ -312,6 +316,12 @@ function SelectPartsStep({
|
||||
}}
|
||||
/>
|
||||
</Expand>
|
||||
<CopyButton
|
||||
disabled={!record.supplier_part?.pk}
|
||||
value={record.supplier_part?.SKU}
|
||||
tooltipPosition='top-end'
|
||||
tooltip={t`Copy supplier part number`}
|
||||
/>
|
||||
<AddItemButton
|
||||
tooltip={t`New supplier part`}
|
||||
tooltipAlignment='top-end'
|
||||
|
||||
@@ -107,8 +107,8 @@ export function usePurchaseOrderLineItemFields({
|
||||
};
|
||||
}
|
||||
},
|
||||
quantity: {},
|
||||
reference: {},
|
||||
quantity: {},
|
||||
purchase_price: {
|
||||
icon: <IconCurrencyDollar />,
|
||||
value: purchasePrice,
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { BarChart, type ChartTooltipProps, DonutChart } from '@mantine/charts';
|
||||
import { BarChart, DonutChart } from '@mantine/charts';
|
||||
import {
|
||||
Center,
|
||||
Group,
|
||||
Paper,
|
||||
SegmentedControl,
|
||||
SimpleGrid,
|
||||
Stack,
|
||||
@@ -17,40 +16,12 @@ import { apiUrl } from '@lib/functions/Api';
|
||||
import type { TableColumn } from '@lib/types/Tables';
|
||||
import { CHART_COLORS } from '../../../components/charts/colors';
|
||||
import { tooltipFormatter } from '../../../components/charts/tooltipFormatter';
|
||||
import {
|
||||
formatCurrency,
|
||||
formatDecimal,
|
||||
formatPriceRange
|
||||
} from '../../../defaults/formatters';
|
||||
import { formatDecimal, formatPriceRange } from '../../../defaults/formatters';
|
||||
import { useTable } from '../../../hooks/UseTable';
|
||||
import { DateColumn, PartColumn } from '../../../tables/ColumnRenderers';
|
||||
import { InvenTreeTable } from '../../../tables/InvenTreeTable';
|
||||
import { LoadingPricingData, NoPricingData } from './PricingPanel';
|
||||
|
||||
/*
|
||||
* Render a tooltip for the chart, with correct date information
|
||||
*/
|
||||
function ChartTooltip({ label, payload }: ChartTooltipProps) {
|
||||
if (!payload) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const data = payload[0] ?? {};
|
||||
|
||||
return (
|
||||
<Paper px='md' py='sm' withBorder shadow='md' radius='md'>
|
||||
<Group justify='space-between' wrap='nowrap'>
|
||||
<Text key='title' c={data.payload?.color}>
|
||||
{data.name}
|
||||
</Text>
|
||||
<Text key='price' fz='sm'>
|
||||
{formatCurrency(data.payload?.value)}
|
||||
</Text>
|
||||
</Group>
|
||||
</Paper>
|
||||
);
|
||||
}
|
||||
|
||||
// Display BOM data as a pie chart
|
||||
function BomPieChart({
|
||||
data,
|
||||
@@ -86,11 +57,6 @@ function BomPieChart({
|
||||
tooltipDataSource='segment'
|
||||
chartLabel={t`Total Price`}
|
||||
valueFormatter={(value) => tooltipFormatter(value, currency)}
|
||||
tooltipProps={{
|
||||
content: ({ label, payload }) => (
|
||||
<ChartTooltip label={label} payload={payload} />
|
||||
)
|
||||
}}
|
||||
/>
|
||||
</Center>
|
||||
);
|
||||
@@ -116,11 +82,6 @@ function BomBarChart({
|
||||
{ name: 'total_price_max', label: t`Maximum Price`, color: 'teal.6' }
|
||||
]}
|
||||
valueFormatter={(value) => tooltipFormatter(value, currency)}
|
||||
tooltipProps={{
|
||||
content: ({ label, payload }) => (
|
||||
<ChartTooltip label={label} payload={payload} />
|
||||
)
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ export default function BuildLineTable({
|
||||
{
|
||||
name: 'available',
|
||||
label: t`Available`,
|
||||
description: t`Show items with available stock`
|
||||
description: t`Show items with sufficient available stock`
|
||||
},
|
||||
{
|
||||
name: 'consumable',
|
||||
@@ -217,6 +217,11 @@ export default function BuildLineTable({
|
||||
label: t`Tracked`,
|
||||
description: t`Show tracked lines`
|
||||
},
|
||||
{
|
||||
name: 'on_order',
|
||||
label: t`On Order`,
|
||||
description: t`Show items with stock on order`
|
||||
},
|
||||
PartCategoryFilter()
|
||||
];
|
||||
}, []);
|
||||
@@ -455,6 +460,8 @@ export default function BuildLineTable({
|
||||
},
|
||||
{
|
||||
accessor: 'in_production',
|
||||
sortable: true,
|
||||
ordering: 'scheduled_to_build',
|
||||
render: (record: any) => {
|
||||
if (record.scheduled_to_build > 0) {
|
||||
return (
|
||||
@@ -471,7 +478,8 @@ export default function BuildLineTable({
|
||||
},
|
||||
DecimalColumn({
|
||||
accessor: 'on_order',
|
||||
defaultVisible: false
|
||||
defaultVisible: false,
|
||||
sortable: true
|
||||
}),
|
||||
{
|
||||
accessor: 'allocated',
|
||||
|
||||
@@ -263,7 +263,9 @@ test('Purchase Orders - Order Parts', async ({ browser }) => {
|
||||
|
||||
// Select supplier part
|
||||
await page.getByLabel('related-field-supplier_part').click();
|
||||
await page.getByText('WM1731-ND').click();
|
||||
await page
|
||||
.getByRole('option', { name: 'Thumbnail DigiKey WM1731-ND' })
|
||||
.click();
|
||||
|
||||
// Option to create a new supplier part
|
||||
await page.getByLabel('action-button-new-supplier-part').click();
|
||||
|
||||
@@ -134,7 +134,7 @@ test('Spotlight - No Keys', async ({ browser }) => {
|
||||
.click();
|
||||
await page.getByText('License Information').first().waitFor();
|
||||
await page.getByRole('tab', { name: 'backend Packages' }).waitFor();
|
||||
await page.getByRole('button', { name: 'Django BSD License' }).click();
|
||||
await page.getByRole('button', { name: 'Django BSD-3-Clause' }).click();
|
||||
|
||||
await page.keyboard.press('Escape');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user