Merge branch 'master' into dependabot/npm_and_yarn/src/frontend/dependencies-ccf123aa14
This commit is contained in:
commit
c9ea1175a4
|
|
@ -455,6 +455,12 @@ export function ApiForm({
|
|||
}
|
||||
})
|
||||
.then((response) => {
|
||||
const followPk = Array.isArray(response.data)
|
||||
? response.data.length === 1
|
||||
? response.data[0]?.pk
|
||||
: undefined
|
||||
: response.data?.pk;
|
||||
|
||||
switch (response.status) {
|
||||
case 200:
|
||||
case 201:
|
||||
|
|
@ -469,12 +475,12 @@ export function ApiForm({
|
|||
if (
|
||||
props.follow &&
|
||||
props.modelType &&
|
||||
response.data?.pk &&
|
||||
followPk &&
|
||||
!keepOpenRef.current
|
||||
) {
|
||||
// If we want to automatically follow the returned data
|
||||
if (!!navigate && !keepOpenRef.current) {
|
||||
navigate(getDetailUrl(props.modelType, response.data?.pk));
|
||||
navigate(getDetailUrl(props.modelType, followPk));
|
||||
}
|
||||
} else if (props.table) {
|
||||
// If we want to automatically update or reload a linked table
|
||||
|
|
|
|||
|
|
@ -431,17 +431,24 @@ export default function StockDetail() {
|
|||
hidden: !stockitem.packaging
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
type: 'date',
|
||||
name: 'creation_date',
|
||||
icon: 'calendar',
|
||||
label: t`Created`,
|
||||
hidden: !stockitem.creation_date
|
||||
},
|
||||
{
|
||||
type: 'date',
|
||||
name: 'updated',
|
||||
icon: 'calendar',
|
||||
label: t`Last Updated`
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
name: 'stocktake',
|
||||
type: 'date',
|
||||
name: 'stocktake_date',
|
||||
icon: 'calendar',
|
||||
label: t`Last Stocktake`,
|
||||
hidden: !stockitem.stocktake
|
||||
hidden: !stockitem.stocktake_date
|
||||
}
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -94,6 +94,13 @@ export function PartColumn(props: PartColumnProps): TableColumn {
|
|||
sortable: true,
|
||||
switchable: false,
|
||||
minWidth: '175px',
|
||||
copyable: (record: any) => {
|
||||
const part = resolveItem(
|
||||
record,
|
||||
props.part ?? props.accessor ?? 'part_detail'
|
||||
);
|
||||
return part?.full_name ?? part?.name ?? '';
|
||||
},
|
||||
render: (record: any) => {
|
||||
const part = resolveItem(
|
||||
record,
|
||||
|
|
|
|||
|
|
@ -304,6 +304,7 @@ export default function BuildLineTable({
|
|||
<Text
|
||||
c='red'
|
||||
style={{ fontStyle: 'italic' }}
|
||||
size='sm'
|
||||
>{t`No stock available`}</Text>
|
||||
)
|
||||
}
|
||||
|
|
@ -447,7 +448,9 @@ export default function BuildLineTable({
|
|||
extra={extra}
|
||||
value={
|
||||
<Group justify='space-between' wrap='nowrap'>
|
||||
<Text>{formatDecimal(record.requiredQuantity)}</Text>
|
||||
<Text size='sm'>
|
||||
{formatDecimal(record.requiredQuantity)}
|
||||
</Text>
|
||||
{record?.part_detail?.units && (
|
||||
<Text size='xs'>[{record.part_detail.units}]</Text>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -181,7 +181,9 @@ function partTableColumns(): TableColumn[] {
|
|||
<TableHoverCard
|
||||
value={
|
||||
<Group gap='xs' justify='left' wrap='nowrap'>
|
||||
<Text c={color}>{text}</Text>
|
||||
<Text c={color} size='sm'>
|
||||
{text}
|
||||
</Text>
|
||||
{record.units && (
|
||||
<Text size='xs' c={color}>
|
||||
[{record.units}]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { t } from '@lingui/core/macro';
|
||||
import { useMemo, useState } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
import { ActionButton } from '@lib/components/ActionButton';
|
||||
import { AddItemButton } from '@lib/components/AddItemButton';
|
||||
|
|
@ -8,7 +7,6 @@ import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
|||
import { ModelType } from '@lib/enums/ModelType';
|
||||
import { UserRoles } from '@lib/enums/Roles';
|
||||
import { apiUrl } from '@lib/functions/Api';
|
||||
import { getDetailUrl } from '@lib/functions/Navigation';
|
||||
import useTable from '@lib/hooks/UseTable';
|
||||
import type { TableFilter } from '@lib/types/Filters';
|
||||
import type { StockOperationProps } from '@lib/types/Forms';
|
||||
|
|
@ -381,8 +379,6 @@ export function StockItemTable({
|
|||
[settings]
|
||||
);
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const tableColumns = useMemo(
|
||||
() =>
|
||||
stockItemTableColumns({
|
||||
|
|
@ -433,11 +429,7 @@ export function StockItemTable({
|
|||
},
|
||||
follow: params.openNewStockItem ?? true,
|
||||
table: table,
|
||||
onFormSuccess: (response: any) => {
|
||||
// Returns a list that may contain multiple serialized stock items
|
||||
// Navigate to the first result
|
||||
navigate(getDetailUrl(ModelType.stockitem, response[0].pk));
|
||||
},
|
||||
modelType: ModelType.stockitem,
|
||||
successMessage: t`Stock item created`,
|
||||
keepOpenOption: true
|
||||
});
|
||||
|
|
|
|||
|
|
@ -90,7 +90,8 @@ export default defineConfig(({ command, mode }) => {
|
|||
}
|
||||
},
|
||||
define: {
|
||||
...__INVENTREE_VERSION_INFO__
|
||||
...__INVENTREE_VERSION_INFO__,
|
||||
'process.env.NODE_ENV': JSON.stringify(mode)
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue