mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-16 17:56:30 +00:00
Refactor more UI components out into lib directory (#9994)
* Refactor table column types * Offloading more component type definitions * Remove unused funcs * Move conversion functions * ActionButton * Refactor YesNoButton * ProgressBar * make row actions available * search input * ButtonMenu * Bump UI version * Tweak function defs
This commit is contained in:
@@ -6,7 +6,7 @@ import {
|
|||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
|
|
||||||
import { identifierString } from '../../functions/conversion';
|
import { identifierString } from '../functions/Conversion';
|
||||||
|
|
||||||
export type ActionButtonProps = {
|
export type ActionButtonProps = {
|
||||||
icon?: ReactNode;
|
icon?: ReactNode;
|
@@ -1,6 +1,6 @@
|
|||||||
import { Progress, Stack, Text } from '@mantine/core';
|
import { Progress, Stack, Text } from '@mantine/core';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { formatDecimal } from '../../defaults/formatters';
|
import { formatDecimal } from '../functions/Formatting';
|
||||||
|
|
||||||
export type ProgressBarProps = {
|
export type ProgressBarProps = {
|
||||||
value: number;
|
value: number;
|
@@ -9,31 +9,12 @@ import {
|
|||||||
IconTrash
|
IconTrash
|
||||||
} from '@tabler/icons-react';
|
} from '@tabler/icons-react';
|
||||||
import { type ReactNode, useMemo, useState } from 'react';
|
import { type ReactNode, useMemo, useState } from 'react';
|
||||||
import type { NavigateFunction } from 'react-router-dom';
|
import { cancelEvent } from '../functions/Events';
|
||||||
|
import { getDetailUrl } from '../functions/Navigation';
|
||||||
|
import { navigateToLink } from '../functions/Navigation';
|
||||||
|
import type { RowAction, RowViewProps } from '../types/Tables';
|
||||||
|
|
||||||
import type { ModelType } from '@lib/enums/ModelType';
|
export type { RowAction, RowViewProps } from '../types/Tables';
|
||||||
import { cancelEvent } from '@lib/functions/Events';
|
|
||||||
import { getDetailUrl } from '@lib/functions/Navigation';
|
|
||||||
import { navigateToLink } from '@lib/functions/Navigation';
|
|
||||||
|
|
||||||
// Type definition for a table row action
|
|
||||||
export type RowAction = {
|
|
||||||
title?: string;
|
|
||||||
tooltip?: string;
|
|
||||||
color?: string;
|
|
||||||
icon?: ReactNode;
|
|
||||||
onClick?: (event: any) => void;
|
|
||||||
hidden?: boolean;
|
|
||||||
disabled?: boolean;
|
|
||||||
};
|
|
||||||
|
|
||||||
type RowModelProps = {
|
|
||||||
modelType: ModelType;
|
|
||||||
modelId: number;
|
|
||||||
navigate: NavigateFunction;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type RowViewProps = RowAction & RowModelProps;
|
|
||||||
|
|
||||||
// Component for viewing a row in a table
|
// Component for viewing a row in a table
|
||||||
export function RowViewAction(props: RowViewProps): RowAction {
|
export function RowViewAction(props: RowViewProps): RowAction {
|
@@ -4,15 +4,22 @@ import { useDebouncedValue } from '@mantine/hooks';
|
|||||||
import { IconSearch } from '@tabler/icons-react';
|
import { IconSearch } from '@tabler/icons-react';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
export function TableSearchInput({
|
/**
|
||||||
|
* A search input component that debounces user input
|
||||||
|
*/
|
||||||
|
export function SearchInput({
|
||||||
disabled,
|
disabled,
|
||||||
|
debounce,
|
||||||
|
placeholder,
|
||||||
searchCallback
|
searchCallback
|
||||||
}: Readonly<{
|
}: Readonly<{
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
|
debounce?: number;
|
||||||
|
placeholder?: string;
|
||||||
searchCallback: (searchTerm: string) => void;
|
searchCallback: (searchTerm: string) => void;
|
||||||
}>) {
|
}>) {
|
||||||
const [value, setValue] = useState<string>('');
|
const [value, setValue] = useState<string>('');
|
||||||
const [searchText] = useDebouncedValue(value, 500);
|
const [searchText] = useDebouncedValue(value, debounce ?? 500);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
searchCallback(searchText);
|
searchCallback(searchText);
|
||||||
@@ -24,7 +31,7 @@ export function TableSearchInput({
|
|||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
aria-label='table-search-input'
|
aria-label='table-search-input'
|
||||||
leftSection={<IconSearch />}
|
leftSection={<IconSearch />}
|
||||||
placeholder={t`Search`}
|
placeholder={placeholder ?? t`Search`}
|
||||||
onChange={(event) => setValue(event.target.value)}
|
onChange={(event) => setValue(event.target.value)}
|
||||||
rightSection={
|
rightSection={
|
||||||
value.length > 0 ? (
|
value.length > 0 ? (
|
@@ -1,7 +1,7 @@
|
|||||||
import { t } from '@lingui/core/macro';
|
import { t } from '@lingui/core/macro';
|
||||||
import { Badge, Skeleton } from '@mantine/core';
|
import { Badge, Skeleton } from '@mantine/core';
|
||||||
|
|
||||||
import { isTrue } from '../../functions/conversion';
|
import { isTrue } from '../functions/Conversion';
|
||||||
|
|
||||||
export function PassFailButton({
|
export function PassFailButton({
|
||||||
value,
|
value,
|
88
src/frontend/lib/functions/Formatting.tsx
Normal file
88
src/frontend/lib/functions/Formatting.tsx
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
export interface FormatDecmimalOptionsInterface {
|
||||||
|
digits?: number;
|
||||||
|
minDigits?: number;
|
||||||
|
locale?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FormatCurrencyOptionsInterface {
|
||||||
|
digits?: number;
|
||||||
|
minDigits?: number;
|
||||||
|
currency?: string;
|
||||||
|
locale?: string;
|
||||||
|
multiplier?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function formatDecimal(
|
||||||
|
value: number | null | undefined,
|
||||||
|
options: FormatDecmimalOptionsInterface = {}
|
||||||
|
) {
|
||||||
|
const locale = options.locale || navigator.language || 'en-US';
|
||||||
|
|
||||||
|
if (value === null || value === undefined) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
const formatter = new Intl.NumberFormat(locale, {
|
||||||
|
style: 'decimal',
|
||||||
|
maximumFractionDigits: options.digits ?? 6,
|
||||||
|
minimumFractionDigits: options.minDigits ?? 0
|
||||||
|
});
|
||||||
|
|
||||||
|
return formatter.format(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* format currency (money) value based on current settings
|
||||||
|
*
|
||||||
|
* Options:
|
||||||
|
* - currency: Currency code (uses default value if none provided)
|
||||||
|
* - locale: Locale specified (uses default value if none provided)
|
||||||
|
* - digits: Maximum number of significant digits (default = 10)
|
||||||
|
*/
|
||||||
|
export function formatCurrencyValue(
|
||||||
|
value: number | string | null | undefined,
|
||||||
|
options: FormatCurrencyOptionsInterface = {}
|
||||||
|
) {
|
||||||
|
if (value == null || value == undefined) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
value = Number.parseFloat(value.toString());
|
||||||
|
|
||||||
|
if (Number.isNaN(value) || !Number.isFinite(value)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
value *= options.multiplier ?? 1;
|
||||||
|
|
||||||
|
// Extract locale information
|
||||||
|
const locale = options.locale || navigator.language || 'en-US';
|
||||||
|
|
||||||
|
const minDigits = options.minDigits ?? 0;
|
||||||
|
const maxDigits = options.digits ?? 6;
|
||||||
|
|
||||||
|
const formatter = new Intl.NumberFormat(locale, {
|
||||||
|
style: 'currency',
|
||||||
|
currency: options.currency,
|
||||||
|
maximumFractionDigits: Math.max(minDigits, maxDigits),
|
||||||
|
minimumFractionDigits: Math.min(minDigits, maxDigits)
|
||||||
|
});
|
||||||
|
|
||||||
|
return formatter.format(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Format a file size (in bytes) into a human-readable format
|
||||||
|
*/
|
||||||
|
export function formatFileSize(size: number) {
|
||||||
|
const suffixes: string[] = ['B', 'KB', 'MB', 'GB'];
|
||||||
|
|
||||||
|
let idx = 0;
|
||||||
|
|
||||||
|
while (size > 1024 && idx < suffixes.length) {
|
||||||
|
size /= 1024;
|
||||||
|
idx++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${size.toFixed(2)} ${suffixes[idx]}`;
|
||||||
|
}
|
@@ -13,6 +13,7 @@ export type { ModelDict } from './enums/ModelInformation';
|
|||||||
export { UserRoles, UserPermissions } from './enums/Roles';
|
export { UserRoles, UserPermissions } from './enums/Roles';
|
||||||
|
|
||||||
export type { InvenTreePluginContext } from './types/Plugins';
|
export type { InvenTreePluginContext } from './types/Plugins';
|
||||||
|
export type { RowAction, RowViewProps } from './types/Tables';
|
||||||
|
|
||||||
// Common utility functions
|
// Common utility functions
|
||||||
export { apiUrl } from './functions/Api';
|
export { apiUrl } from './functions/Api';
|
||||||
@@ -22,3 +23,24 @@ export {
|
|||||||
navigateToLink
|
navigateToLink
|
||||||
} from './functions/Navigation';
|
} from './functions/Navigation';
|
||||||
export { checkPluginVersion } from './functions/Plugins';
|
export { checkPluginVersion } from './functions/Plugins';
|
||||||
|
|
||||||
|
export {
|
||||||
|
formatCurrencyValue,
|
||||||
|
formatDecimal,
|
||||||
|
formatFileSize
|
||||||
|
} from './functions/Formatting';
|
||||||
|
|
||||||
|
// Common UI components
|
||||||
|
export { ActionButton } from './components/ActionButton';
|
||||||
|
export { ButtonMenu } from './components/ButtonMenu';
|
||||||
|
export { ProgressBar } from './components/ProgressBar';
|
||||||
|
export { PassFailButton, YesNoButton } from './components/YesNoButton';
|
||||||
|
export { SearchInput } from './components/SearchInput';
|
||||||
|
export {
|
||||||
|
RowViewAction,
|
||||||
|
RowDuplicateAction,
|
||||||
|
RowEditAction,
|
||||||
|
RowDeleteAction,
|
||||||
|
RowCancelAction,
|
||||||
|
RowActions
|
||||||
|
} from './components/RowActions';
|
||||||
|
@@ -1,5 +1,13 @@
|
|||||||
import type { SetURLSearchParams } from 'react-router-dom';
|
import type { MantineStyleProp } from '@mantine/core';
|
||||||
import type { FilterSetState } from './Filters';
|
import type {
|
||||||
|
DataTableCellClickHandler,
|
||||||
|
DataTableRowExpansionProps
|
||||||
|
} from 'mantine-datatable';
|
||||||
|
import type { ReactNode } from 'react';
|
||||||
|
import type { NavigateFunction, SetURLSearchParams } from 'react-router-dom';
|
||||||
|
import type { ModelType } from '../enums/ModelType';
|
||||||
|
import type { FilterSetState, TableFilter } from './Filters';
|
||||||
|
import type { ApiFormFieldType } from './Forms';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Type definition for representing the state of a table:
|
* Type definition for representing the state of a table:
|
||||||
@@ -65,3 +73,140 @@ export type TableState = {
|
|||||||
setHiddenColumns: (columns: string[]) => void;
|
setHiddenColumns: (columns: string[]) => void;
|
||||||
idAccessor?: string;
|
idAccessor?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Table column properties
|
||||||
|
*
|
||||||
|
* @param T - The type of the record
|
||||||
|
* @param accessor - The key in the record to access
|
||||||
|
* @param title - The title of the column - Note: this may be supplied by the API, and is not required, but it can be overridden if required
|
||||||
|
* @param ordering - The key in the record to sort by (defaults to accessor)
|
||||||
|
* @param sortable - Whether the column is sortable
|
||||||
|
* @param switchable - Whether the column is switchable
|
||||||
|
* @param defaultVisible - Whether the column is visible by default (defaults to true)
|
||||||
|
* @param hidden - Whether the column is hidden (forced hidden, cannot be toggled by the user))
|
||||||
|
* @param editable - Whether the value of this column can be edited
|
||||||
|
* @param definition - Optional field definition for the column
|
||||||
|
* @param render - A custom render function
|
||||||
|
* @param filter - A custom filter function
|
||||||
|
* @param filtering - Whether the column is filterable
|
||||||
|
* @param width - The width of the column
|
||||||
|
* @param resizable - Whether the column is resizable (defaults to true)
|
||||||
|
* @param noWrap - Whether the column should wrap
|
||||||
|
* @param ellipsis - Whether the column should be ellipsized
|
||||||
|
* @param textAlign - The text alignment of the column
|
||||||
|
* @param cellsStyle - The style of the cells in the column
|
||||||
|
* @param extra - Extra data to pass to the render function
|
||||||
|
* @param noContext - Disable context menu for this column
|
||||||
|
*/
|
||||||
|
export type TableColumnProps<T = any> = {
|
||||||
|
accessor?: string;
|
||||||
|
title?: string;
|
||||||
|
ordering?: string;
|
||||||
|
sortable?: boolean;
|
||||||
|
switchable?: boolean;
|
||||||
|
hidden?: boolean;
|
||||||
|
defaultVisible?: boolean;
|
||||||
|
editable?: boolean;
|
||||||
|
definition?: ApiFormFieldType;
|
||||||
|
render?: (record: T, index?: number) => any;
|
||||||
|
filter?: any;
|
||||||
|
filtering?: boolean;
|
||||||
|
width?: number;
|
||||||
|
resizable?: boolean;
|
||||||
|
noWrap?: boolean;
|
||||||
|
ellipsis?: boolean;
|
||||||
|
textAlign?: 'left' | 'center' | 'right';
|
||||||
|
cellsStyle?: any;
|
||||||
|
extra?: any;
|
||||||
|
noContext?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for the table column definition
|
||||||
|
*/
|
||||||
|
export type TableColumn<T = any> = {
|
||||||
|
accessor: string; // The key in the record to access
|
||||||
|
} & TableColumnProps<T>;
|
||||||
|
|
||||||
|
// Type definition for a table row action
|
||||||
|
export type RowAction = {
|
||||||
|
title?: string;
|
||||||
|
tooltip?: string;
|
||||||
|
color?: string;
|
||||||
|
icon?: ReactNode;
|
||||||
|
onClick?: (event: any) => void;
|
||||||
|
hidden?: boolean;
|
||||||
|
disabled?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
type RowModelProps = {
|
||||||
|
modelType: ModelType;
|
||||||
|
modelId: number;
|
||||||
|
navigate: NavigateFunction;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type RowViewProps = RowAction & RowModelProps;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set of optional properties which can be passed to an InvenTreeTable component
|
||||||
|
*
|
||||||
|
* @param params : any - Base query parameters
|
||||||
|
* @param tableState : TableState - State manager for the table
|
||||||
|
* @param defaultSortColumn : string - Default column to sort by
|
||||||
|
* @param noRecordsText : string - Text to display when no records are found
|
||||||
|
* @param enableBulkDelete : boolean - Enable bulk deletion of records
|
||||||
|
* @param enableDownload : boolean - Enable download actions
|
||||||
|
* @param enableFilters : boolean - Enable filter actions
|
||||||
|
* @param enableSelection : boolean - Enable row selection
|
||||||
|
* @param enableSearch : boolean - Enable search actions
|
||||||
|
* @param enableLabels : boolean - Enable printing of labels against selected items
|
||||||
|
* @param enableReports : boolean - Enable printing of reports against selected items
|
||||||
|
* @param printingAccessor : string - Accessor for label and report printing (default = 'pk')
|
||||||
|
* @param enablePagination : boolean - Enable pagination
|
||||||
|
* @param enableRefresh : boolean - Enable refresh actions
|
||||||
|
* @param enableColumnSwitching : boolean - Enable column switching
|
||||||
|
* @param enableColumnCaching : boolean - Enable caching of column names via API
|
||||||
|
* @param barcodeActions : any[] - List of barcode actions
|
||||||
|
* @param tableFilters : TableFilter[] - List of custom filters
|
||||||
|
* @param tableActions : any[] - List of custom action groups
|
||||||
|
* @param dataFormatter : (data: any) => any - Callback function to reformat data returned by server (if not in default format)
|
||||||
|
* @param rowActions : (record: any) => RowAction[] - Callback function to generate row actions
|
||||||
|
* @param onRowClick : (record: any, index: number, event: any) => void - Callback function when a row is clicked
|
||||||
|
* @param onCellClick : (event: any, record: any, index: number, column: any, columnIndex: number) => void - Callback function when a cell is clicked
|
||||||
|
* @param modelType: ModelType - The model type for the table
|
||||||
|
* @param minHeight: number - Minimum height of the table (default 300px)
|
||||||
|
* @param noHeader: boolean - Hide the table header
|
||||||
|
*/
|
||||||
|
export type InvenTreeTableProps<T = any> = {
|
||||||
|
params?: any;
|
||||||
|
defaultSortColumn?: string;
|
||||||
|
noRecordsText?: string;
|
||||||
|
enableBulkDelete?: boolean;
|
||||||
|
enableDownload?: boolean;
|
||||||
|
enableFilters?: boolean;
|
||||||
|
enableSelection?: boolean;
|
||||||
|
enableSearch?: boolean;
|
||||||
|
enablePagination?: boolean;
|
||||||
|
enableRefresh?: boolean;
|
||||||
|
enableColumnSwitching?: boolean;
|
||||||
|
enableColumnCaching?: boolean;
|
||||||
|
enableLabels?: boolean;
|
||||||
|
enableReports?: boolean;
|
||||||
|
printingAccessor?: string;
|
||||||
|
afterBulkDelete?: () => void;
|
||||||
|
barcodeActions?: React.ReactNode[];
|
||||||
|
tableFilters?: TableFilter[];
|
||||||
|
tableActions?: React.ReactNode[];
|
||||||
|
rowExpansion?: DataTableRowExpansionProps<T>;
|
||||||
|
dataFormatter?: (data: any) => any;
|
||||||
|
rowActions?: (record: T) => RowAction[];
|
||||||
|
onRowClick?: (record: T, index: number, event: any) => void;
|
||||||
|
onCellClick?: DataTableCellClickHandler<T>;
|
||||||
|
modelType?: ModelType;
|
||||||
|
rowStyle?: (record: T, index: number) => MantineStyleProp | undefined;
|
||||||
|
modelField?: string;
|
||||||
|
onCellContextMenu?: (record: T, event: any) => void;
|
||||||
|
minHeight?: number;
|
||||||
|
noHeader?: boolean;
|
||||||
|
};
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@inventreedb/ui",
|
"name": "@inventreedb/ui",
|
||||||
"description": "UI components for the InvenTree project",
|
"description": "UI components for the InvenTree project",
|
||||||
"version": "0.2.3",
|
"version": "0.3.0",
|
||||||
"private": false,
|
"private": false,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@@ -1,6 +1,9 @@
|
|||||||
import { IconPlus } from '@tabler/icons-react';
|
import { IconPlus } from '@tabler/icons-react';
|
||||||
|
|
||||||
import { ActionButton, type ActionButtonProps } from './ActionButton';
|
import {
|
||||||
|
ActionButton,
|
||||||
|
type ActionButtonProps
|
||||||
|
} from '@lib/components/ActionButton';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A generic icon button which is used to add or create a new item
|
* A generic icon button which is used to add or create a new item
|
||||||
|
@@ -2,13 +2,13 @@ import { t } from '@lingui/core/macro';
|
|||||||
import { IconUserStar } from '@tabler/icons-react';
|
import { IconUserStar } from '@tabler/icons-react';
|
||||||
import { useCallback, useMemo } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
|
|
||||||
|
import { ActionButton } from '@lib/components/ActionButton';
|
||||||
import { ModelInformationDict } from '@lib/enums/ModelInformation';
|
import { ModelInformationDict } from '@lib/enums/ModelInformation';
|
||||||
import type { ModelType } from '@lib/enums/ModelType';
|
import type { ModelType } from '@lib/enums/ModelType';
|
||||||
import { eventModified } from '@lib/functions/Navigation';
|
import { eventModified } from '@lib/functions/Navigation';
|
||||||
import { generateUrl } from '../../functions/urls';
|
import { generateUrl } from '../../functions/urls';
|
||||||
import { useServerApiState } from '../../states/ServerApiState';
|
import { useServerApiState } from '../../states/ServerApiState';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import { ActionButton } from './ActionButton';
|
|
||||||
|
|
||||||
export type AdminButtonProps = {
|
export type AdminButtonProps = {
|
||||||
model: ModelType;
|
model: ModelType;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { t } from '@lingui/core/macro';
|
import { t } from '@lingui/core/macro';
|
||||||
|
|
||||||
|
import { ActionButton } from '@lib/components/ActionButton';
|
||||||
import { InvenTreeIcon } from '../../functions/icons';
|
import { InvenTreeIcon } from '../../functions/icons';
|
||||||
import { ActionButton } from './ActionButton';
|
|
||||||
|
|
||||||
export default function RemoveRowButton({
|
export default function RemoveRowButton({
|
||||||
onClick,
|
onClick,
|
||||||
|
@@ -10,8 +10,8 @@ import {
|
|||||||
import { IconChevronDown } from '@tabler/icons-react';
|
import { IconChevronDown } from '@tabler/icons-react';
|
||||||
import { useEffect, useMemo, useState } from 'react';
|
import { useEffect, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import { identifierString } from '@lib/functions/Conversion';
|
||||||
import type { TablerIconType } from '@lib/types/Icons';
|
import type { TablerIconType } from '@lib/types/Icons';
|
||||||
import { identifierString } from '../../functions/conversion';
|
|
||||||
import * as classes from './SplitButton.css';
|
import * as classes from './SplitButton.css';
|
||||||
|
|
||||||
interface SplitButtonOption {
|
interface SplitButtonOption {
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import { ActionButton } from '@lib/components/ActionButton';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
@@ -6,7 +7,6 @@ import { showNotification } from '@mantine/notifications';
|
|||||||
import { IconBell } from '@tabler/icons-react';
|
import { IconBell } from '@tabler/icons-react';
|
||||||
import type { JSX } from 'react';
|
import type { JSX } from 'react';
|
||||||
import { useApi } from '../../contexts/ApiContext';
|
import { useApi } from '../../contexts/ApiContext';
|
||||||
import { ActionButton } from './ActionButton';
|
|
||||||
|
|
||||||
export default function StarredToggleButton({
|
export default function StarredToggleButton({
|
||||||
instance,
|
instance,
|
||||||
|
@@ -4,6 +4,8 @@ import dayGridPlugin from '@fullcalendar/daygrid';
|
|||||||
import interactionPlugin from '@fullcalendar/interaction';
|
import interactionPlugin from '@fullcalendar/interaction';
|
||||||
import FullCalendar from '@fullcalendar/react';
|
import FullCalendar from '@fullcalendar/react';
|
||||||
|
|
||||||
|
import { ActionButton } from '@lib/components/ActionButton';
|
||||||
|
import { SearchInput } from '@lib/components/SearchInput';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
import { t } from '@lingui/core/macro';
|
import { t } from '@lingui/core/macro';
|
||||||
import {
|
import {
|
||||||
@@ -30,9 +32,7 @@ import { useShallow } from 'zustand/react/shallow';
|
|||||||
import type { CalendarState } from '../../hooks/UseCalendar';
|
import type { CalendarState } from '../../hooks/UseCalendar';
|
||||||
import { useLocalState } from '../../states/LocalState';
|
import { useLocalState } from '../../states/LocalState';
|
||||||
import { FilterSelectDrawer } from '../../tables/FilterSelectDrawer';
|
import { FilterSelectDrawer } from '../../tables/FilterSelectDrawer';
|
||||||
import { TableSearchInput } from '../../tables/Search';
|
|
||||||
import { Boundary } from '../Boundary';
|
import { Boundary } from '../Boundary';
|
||||||
import { ActionButton } from '../buttons/ActionButton';
|
|
||||||
import { StylishText } from '../items/StylishText';
|
import { StylishText } from '../items/StylishText';
|
||||||
|
|
||||||
export interface InvenTreeCalendarProps extends CalendarOptions {
|
export interface InvenTreeCalendarProps extends CalendarOptions {
|
||||||
@@ -147,7 +147,7 @@ export default function Calendar({
|
|||||||
</Group>
|
</Group>
|
||||||
<Group justify='right' gap='xs' wrap='nowrap'>
|
<Group justify='right' gap='xs' wrap='nowrap'>
|
||||||
{enableSearch && (
|
{enableSearch && (
|
||||||
<TableSearchInput searchCallback={state.setSearchTerm} />
|
<SearchInput searchCallback={state.setSearchTerm} />
|
||||||
)}
|
)}
|
||||||
{enableFilters && filters && filters.length > 0 && (
|
{enableFilters && filters && filters.length > 0 && (
|
||||||
<Indicator
|
<Indicator
|
||||||
|
@@ -17,6 +17,8 @@ import { getValueAtPath } from 'mantine-datatable';
|
|||||||
import { useCallback, useMemo } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
import { ProgressBar } from '@lib/components/ProgressBar';
|
||||||
|
import { YesNoButton } from '@lib/components/YesNoButton';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
@@ -28,8 +30,6 @@ import { formatDate, formatDecimal } from '../../defaults/formatters';
|
|||||||
import { InvenTreeIcon } from '../../functions/icons';
|
import { InvenTreeIcon } from '../../functions/icons';
|
||||||
import { useGlobalSettingsState } from '../../states/SettingsStates';
|
import { useGlobalSettingsState } from '../../states/SettingsStates';
|
||||||
import { CopyButton } from '../buttons/CopyButton';
|
import { CopyButton } from '../buttons/CopyButton';
|
||||||
import { YesNoButton } from '../buttons/YesNoButton';
|
|
||||||
import { ProgressBar } from '../items/ProgressBar';
|
|
||||||
import { StylishText } from '../items/StylishText';
|
import { StylishText } from '../items/StylishText';
|
||||||
import { getModelInfo } from '../render/ModelType';
|
import { getModelInfo } from '../render/ModelType';
|
||||||
import { StatusRenderer } from '../render/StatusRenderer';
|
import { StatusRenderer } from '../render/StatusRenderer';
|
||||||
|
@@ -21,6 +21,7 @@ import { useHover } from '@mantine/hooks';
|
|||||||
import { modals } from '@mantine/modals';
|
import { modals } from '@mantine/modals';
|
||||||
import { useMemo, useState } from 'react';
|
import { useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import { ActionButton } from '@lib/components/ActionButton';
|
||||||
import type { UserRoles } from '@lib/enums/Roles';
|
import type { UserRoles } from '@lib/enums/Roles';
|
||||||
import { cancelEvent } from '@lib/functions/Events';
|
import { cancelEvent } from '@lib/functions/Events';
|
||||||
import { showNotification } from '@mantine/notifications';
|
import { showNotification } from '@mantine/notifications';
|
||||||
@@ -32,7 +33,6 @@ import { useGlobalSettingsState } from '../../states/SettingsStates';
|
|||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import { PartThumbTable } from '../../tables/part/PartThumbTable';
|
import { PartThumbTable } from '../../tables/part/PartThumbTable';
|
||||||
import { vars } from '../../theme';
|
import { vars } from '../../theme';
|
||||||
import { ActionButton } from '../buttons/ActionButton';
|
|
||||||
import { ApiImage } from '../images/ApiImage';
|
import { ApiImage } from '../images/ApiImage';
|
||||||
import { StylishText } from '../items/StylishText';
|
import { StylishText } from '../items/StylishText';
|
||||||
|
|
||||||
|
@@ -20,12 +20,12 @@ import {
|
|||||||
IconServerSpark
|
IconServerSpark
|
||||||
} from '@tabler/icons-react';
|
} from '@tabler/icons-react';
|
||||||
|
|
||||||
|
import { ActionButton } from '@lib/components/ActionButton';
|
||||||
import type { HostList } from '@lib/types/Server';
|
import type { HostList } from '@lib/types/Server';
|
||||||
import { useShallow } from 'zustand/react/shallow';
|
import { useShallow } from 'zustand/react/shallow';
|
||||||
import { Wrapper } from '../../pages/Auth/Layout';
|
import { Wrapper } from '../../pages/Auth/Layout';
|
||||||
import { useLocalState } from '../../states/LocalState';
|
import { useLocalState } from '../../states/LocalState';
|
||||||
import { useServerApiState } from '../../states/ServerApiState';
|
import { useServerApiState } from '../../states/ServerApiState';
|
||||||
import { ActionButton } from '../buttons/ActionButton';
|
|
||||||
import { HostOptionsForm } from './HostOptionsForm';
|
import { HostOptionsForm } from './HostOptionsForm';
|
||||||
|
|
||||||
export function InstanceOptions({
|
export function InstanceOptions({
|
||||||
|
@@ -4,8 +4,8 @@ import { useId } from '@mantine/hooks';
|
|||||||
import { useCallback, useEffect, useMemo } from 'react';
|
import { useCallback, useEffect, useMemo } from 'react';
|
||||||
import { type Control, type FieldValues, useController } from 'react-hook-form';
|
import { type Control, type FieldValues, useController } from 'react-hook-form';
|
||||||
|
|
||||||
|
import { isTrue } from '@lib/functions/Conversion';
|
||||||
import type { ApiFormFieldSet, ApiFormFieldType } from '@lib/types/Forms';
|
import type { ApiFormFieldSet, ApiFormFieldType } from '@lib/types/Forms';
|
||||||
import { isTrue } from '../../../functions/conversion';
|
|
||||||
import { ChoiceField } from './ChoiceField';
|
import { ChoiceField } from './ChoiceField';
|
||||||
import DateField from './DateField';
|
import DateField from './DateField';
|
||||||
import { DependentField } from './DependentField';
|
import { DependentField } from './DependentField';
|
||||||
|
@@ -5,8 +5,8 @@ import { IconExclamationCircle } from '@tabler/icons-react';
|
|||||||
import { type ReactNode, useCallback, useEffect, useMemo } from 'react';
|
import { type ReactNode, useCallback, useEffect, useMemo } from 'react';
|
||||||
import type { FieldValues, UseControllerReturn } from 'react-hook-form';
|
import type { FieldValues, UseControllerReturn } from 'react-hook-form';
|
||||||
|
|
||||||
|
import { identifierString } from '@lib/functions/Conversion';
|
||||||
import type { ApiFormFieldType } from '@lib/types/Forms';
|
import type { ApiFormFieldType } from '@lib/types/Forms';
|
||||||
import { identifierString } from '../../../functions/conversion';
|
|
||||||
import { InvenTreeIcon } from '../../../functions/icons';
|
import { InvenTreeIcon } from '../../../functions/icons';
|
||||||
import { AddItemButton } from '../../buttons/AddItemButton';
|
import { AddItemButton } from '../../buttons/AddItemButton';
|
||||||
import { StandaloneField } from '../StandaloneField';
|
import { StandaloneField } from '../StandaloneField';
|
||||||
|
@@ -9,11 +9,20 @@ import {
|
|||||||
} from '@tabler/icons-react';
|
} from '@tabler/icons-react';
|
||||||
import { type ReactNode, useCallback, useMemo, useState } from 'react';
|
import { type ReactNode, useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import { ActionButton } from '@lib/components/ActionButton';
|
||||||
|
import { ProgressBar } from '@lib/components/ProgressBar';
|
||||||
|
import {
|
||||||
|
type RowAction,
|
||||||
|
RowDeleteAction,
|
||||||
|
RowEditAction
|
||||||
|
} from '@lib/components/RowActions';
|
||||||
|
import { YesNoButton } from '@lib/components/YesNoButton';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import { cancelEvent } from '@lib/functions/Events';
|
import { cancelEvent } from '@lib/functions/Events';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { useApi } from '../../contexts/ApiContext';
|
import { useApi } from '../../contexts/ApiContext';
|
||||||
import {
|
import {
|
||||||
useDeleteApiFormModal,
|
useDeleteApiFormModal,
|
||||||
@@ -21,16 +30,7 @@ import {
|
|||||||
} from '../../hooks/UseForm';
|
} from '../../hooks/UseForm';
|
||||||
import type { ImportSessionState } from '../../hooks/UseImportSession';
|
import type { ImportSessionState } from '../../hooks/UseImportSession';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import type { TableColumn } from '../../tables/Column';
|
|
||||||
import { InvenTreeTable } from '../../tables/InvenTreeTable';
|
import { InvenTreeTable } from '../../tables/InvenTreeTable';
|
||||||
import {
|
|
||||||
type RowAction,
|
|
||||||
RowDeleteAction,
|
|
||||||
RowEditAction
|
|
||||||
} from '../../tables/RowActions';
|
|
||||||
import { ActionButton } from '../buttons/ActionButton';
|
|
||||||
import { YesNoButton } from '../buttons/YesNoButton';
|
|
||||||
import { ProgressBar } from '../items/ProgressBar';
|
|
||||||
import { RenderRemoteInstance } from '../render/Instance';
|
import { RenderRemoteInstance } from '../render/Instance';
|
||||||
|
|
||||||
function ImporterDataCell({
|
function ImporterDataCell({
|
||||||
|
@@ -21,7 +21,7 @@ import {
|
|||||||
import { type ReactNode, useMemo } from 'react';
|
import { type ReactNode, useMemo } from 'react';
|
||||||
|
|
||||||
import type { ModelType } from '@lib/enums/ModelType';
|
import type { ModelType } from '@lib/enums/ModelType';
|
||||||
import { identifierString } from '../../functions/conversion';
|
import { identifierString } from '@lib/functions/Conversion';
|
||||||
import { InvenTreeIcon } from '../../functions/icons';
|
import { InvenTreeIcon } from '../../functions/icons';
|
||||||
import { InvenTreeQRCode, QRCodeLink, QRCodeUnlink } from '../barcodes/QRCode';
|
import { InvenTreeQRCode, QRCodeLink, QRCodeUnlink } from '../barcodes/QRCode';
|
||||||
import { StylishText } from './StylishText';
|
import { StylishText } from './StylishText';
|
||||||
|
@@ -2,7 +2,7 @@ import { Trans } from '@lingui/react/macro';
|
|||||||
import { Code, Flex, Group, Text } from '@mantine/core';
|
import { Code, Flex, Group, Text } from '@mantine/core';
|
||||||
import { Link, type To } from 'react-router-dom';
|
import { Link, type To } from 'react-router-dom';
|
||||||
|
|
||||||
import { YesNoButton } from '../buttons/YesNoButton';
|
import { YesNoButton } from '@lib/components/YesNoButton';
|
||||||
import { DetailDrawerLink } from '../nav/DetailDrawer';
|
import { DetailDrawerLink } from '../nav/DetailDrawer';
|
||||||
|
|
||||||
export function InfoItem({
|
export function InfoItem({
|
||||||
|
@@ -10,8 +10,8 @@ import { IconMenu2 } from '@tabler/icons-react';
|
|||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
import { identifierString } from '@lib/functions/Conversion';
|
||||||
import { navigateToLink } from '@lib/functions/Navigation';
|
import { navigateToLink } from '@lib/functions/Navigation';
|
||||||
import { identifierString } from '../../functions/conversion';
|
|
||||||
|
|
||||||
export type Breadcrumb = {
|
export type Breadcrumb = {
|
||||||
icon?: React.ReactNode;
|
icon?: React.ReactNode;
|
||||||
|
@@ -32,12 +32,12 @@ import {
|
|||||||
} from 'react-router-dom';
|
} from 'react-router-dom';
|
||||||
|
|
||||||
import type { ModelType } from '@lib/enums/ModelType';
|
import type { ModelType } from '@lib/enums/ModelType';
|
||||||
|
import { identifierString } from '@lib/functions/Conversion';
|
||||||
import { cancelEvent } from '@lib/functions/Events';
|
import { cancelEvent } from '@lib/functions/Events';
|
||||||
import { eventModified, getBaseUrl } from '@lib/functions/Navigation';
|
import { eventModified, getBaseUrl } from '@lib/functions/Navigation';
|
||||||
import { navigateToLink } from '@lib/functions/Navigation';
|
import { navigateToLink } from '@lib/functions/Navigation';
|
||||||
import { t } from '@lingui/core/macro';
|
import { t } from '@lingui/core/macro';
|
||||||
import { useShallow } from 'zustand/react/shallow';
|
import { useShallow } from 'zustand/react/shallow';
|
||||||
import { identifierString } from '../../functions/conversion';
|
|
||||||
import { generateUrl } from '../../functions/urls';
|
import { generateUrl } from '../../functions/urls';
|
||||||
import { usePluginPanels } from '../../hooks/UsePluginPanels';
|
import { usePluginPanels } from '../../hooks/UsePluginPanels';
|
||||||
import { useLocalState } from '../../states/LocalState';
|
import { useLocalState } from '../../states/LocalState';
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import { ActionButton } from '@lib/components/ActionButton';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
||||||
@@ -6,7 +7,6 @@ import { IconRadar } from '@tabler/icons-react';
|
|||||||
import { useEffect, useMemo, useState } from 'react';
|
import { useEffect, useMemo, useState } from 'react';
|
||||||
import { useCreateApiFormModal } from '../../hooks/UseForm';
|
import { useCreateApiFormModal } from '../../hooks/UseForm';
|
||||||
import { usePluginsWithMixin } from '../../hooks/UsePlugins';
|
import { usePluginsWithMixin } from '../../hooks/UsePlugins';
|
||||||
import { ActionButton } from '../buttons/ActionButton';
|
|
||||||
import type { PluginInterface } from './PluginInterface';
|
import type { PluginInterface } from './PluginInterface';
|
||||||
|
|
||||||
export default function LocateItemButton({
|
export default function LocateItemButton({
|
||||||
|
@@ -3,12 +3,12 @@ import { Alert, MantineProvider, Stack, Text } from '@mantine/core';
|
|||||||
import { IconExclamationCircle } from '@tabler/icons-react';
|
import { IconExclamationCircle } from '@tabler/icons-react';
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
|
|
||||||
|
import { identifierString } from '@lib/functions/Conversion';
|
||||||
import type { InvenTreePluginContext } from '@lib/types/Plugins';
|
import type { InvenTreePluginContext } from '@lib/types/Plugins';
|
||||||
import { type Root, createRoot } from 'react-dom/client';
|
import { type Root, createRoot } from 'react-dom/client';
|
||||||
import { api, queryClient } from '../../App';
|
import { api, queryClient } from '../../App';
|
||||||
import { ApiProvider } from '../../contexts/ApiContext';
|
import { ApiProvider } from '../../contexts/ApiContext';
|
||||||
import { LanguageContext } from '../../contexts/LanguageContext';
|
import { LanguageContext } from '../../contexts/LanguageContext';
|
||||||
import { identifierString } from '../../functions/conversion';
|
|
||||||
import { Boundary } from '../Boundary';
|
import { Boundary } from '../Boundary';
|
||||||
import { findExternalPluginFunction } from './PluginSource';
|
import { findExternalPluginFunction } from './PluginSource';
|
||||||
|
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
import { Badge, Center, type MantineSize } from '@mantine/core';
|
import { Badge, Center, type MantineSize } from '@mantine/core';
|
||||||
|
|
||||||
import type { ModelType } from '@lib/enums/ModelType';
|
import type { ModelType } from '@lib/enums/ModelType';
|
||||||
|
import { resolveItem } from '@lib/functions/Conversion';
|
||||||
import { statusColorMap } from '../../defaults/backendMappings';
|
import { statusColorMap } from '../../defaults/backendMappings';
|
||||||
import { resolveItem } from '../../functions/conversion';
|
|
||||||
import { useGlobalStatusState } from '../../states/GlobalStatusState';
|
import { useGlobalStatusState } from '../../states/GlobalStatusState';
|
||||||
|
|
||||||
export interface StatusCodeInterface {
|
export interface StatusCodeInterface {
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import { ActionButton } from '@lib/components/ActionButton';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
@@ -13,7 +14,6 @@ import { usePurchaseOrderFields } from '../../forms/PurchaseOrderForms';
|
|||||||
import { useCreateApiFormModal } from '../../hooks/UseForm';
|
import { useCreateApiFormModal } from '../../hooks/UseForm';
|
||||||
import useWizard from '../../hooks/UseWizard';
|
import useWizard from '../../hooks/UseWizard';
|
||||||
import { PartColumn } from '../../tables/ColumnRenderers';
|
import { PartColumn } from '../../tables/ColumnRenderers';
|
||||||
import { ActionButton } from '../buttons/ActionButton';
|
|
||||||
import { AddItemButton } from '../buttons/AddItemButton';
|
import { AddItemButton } from '../buttons/AddItemButton';
|
||||||
import RemoveRowButton from '../buttons/RemoveRowButton';
|
import RemoveRowButton from '../buttons/RemoveRowButton';
|
||||||
import { StandaloneField } from '../forms/StandaloneField';
|
import { StandaloneField } from '../forms/StandaloneField';
|
||||||
|
@@ -1,90 +1,42 @@
|
|||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
|
import {
|
||||||
|
type FormatCurrencyOptionsInterface,
|
||||||
|
formatCurrencyValue
|
||||||
|
} from '@lib/functions/Formatting';
|
||||||
import {
|
import {
|
||||||
useGlobalSettingsState,
|
useGlobalSettingsState,
|
||||||
useUserSettingsState
|
useUserSettingsState
|
||||||
} from '../states/SettingsStates';
|
} from '../states/SettingsStates';
|
||||||
|
|
||||||
interface FormatDecmimalOptionsInterface {
|
export { formatDecimal, formatFileSize } from '@lib/functions/Formatting';
|
||||||
digits?: number;
|
|
||||||
minDigits?: number;
|
|
||||||
locale?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface FormatCurrencyOptionsInterface {
|
/**
|
||||||
digits?: number;
|
* Format currency value, automatically localized based on user settings.
|
||||||
minDigits?: number;
|
|
||||||
currency?: string;
|
|
||||||
locale?: string;
|
|
||||||
multiplier?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function formatDecimal(
|
|
||||||
value: number | null | undefined,
|
|
||||||
options: FormatDecmimalOptionsInterface = {}
|
|
||||||
) {
|
|
||||||
const locale = options.locale || navigator.language || 'en-US';
|
|
||||||
|
|
||||||
if (value === null || value === undefined) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
const formatter = new Intl.NumberFormat(locale, {
|
|
||||||
style: 'decimal',
|
|
||||||
maximumFractionDigits: options.digits ?? 6,
|
|
||||||
minimumFractionDigits: options.minDigits ?? 0
|
|
||||||
});
|
|
||||||
|
|
||||||
return formatter.format(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* format currency (money) value based on current settings
|
|
||||||
*
|
|
||||||
* Options:
|
|
||||||
* - currency: Currency code (uses default value if none provided)
|
|
||||||
* - locale: Locale specified (uses default value if none provided)
|
|
||||||
* - digits: Maximum number of significant digits (default = 10)
|
|
||||||
*/
|
*/
|
||||||
export function formatCurrency(
|
export function formatCurrency(
|
||||||
value: number | string | null | undefined,
|
value: number | string | null | undefined,
|
||||||
options: FormatCurrencyOptionsInterface = {}
|
options: FormatCurrencyOptionsInterface = {
|
||||||
|
digits: 6,
|
||||||
|
minDigits: 0,
|
||||||
|
currency: 'USD',
|
||||||
|
multiplier: 1
|
||||||
|
}
|
||||||
) {
|
) {
|
||||||
if (value == null || value == undefined) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
value = Number.parseFloat(value.toString());
|
|
||||||
|
|
||||||
if (Number.isNaN(value) || !Number.isFinite(value)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
value *= options.multiplier ?? 1;
|
|
||||||
|
|
||||||
const global_settings = useGlobalSettingsState.getState().lookup;
|
const global_settings = useGlobalSettingsState.getState().lookup;
|
||||||
|
|
||||||
let maxDigits = options.digits || global_settings.PRICING_DECIMAL_PLACES || 6;
|
// Extract default digit formatting
|
||||||
maxDigits = Number(maxDigits);
|
options.digits =
|
||||||
let minDigits =
|
options?.digits ?? Number(global_settings.PRICING_DECIMAL_PLACES) ?? 6;
|
||||||
options.minDigits || global_settings.PRICING_DECIMAL_PLACES_MIN || 0;
|
options.minDigits =
|
||||||
minDigits = Number(minDigits);
|
options?.minDigits ??
|
||||||
|
Number(global_settings.PRICING_DECIMAL_PLACES_MIN) ??
|
||||||
|
0;
|
||||||
|
|
||||||
// Extract default currency information
|
options.currency =
|
||||||
const currency =
|
options?.currency ?? (global_settings.INVENTREE_DEFAULT_CURRENCY || 'USD');
|
||||||
options.currency || global_settings.INVENTREE_DEFAULT_CURRENCY || 'USD';
|
|
||||||
|
|
||||||
// Extract locale information
|
return formatCurrencyValue(value, options);
|
||||||
const locale = options.locale || navigator.language || 'en-US';
|
|
||||||
|
|
||||||
const formatter = new Intl.NumberFormat(locale, {
|
|
||||||
style: 'currency',
|
|
||||||
currency: currency,
|
|
||||||
maximumFractionDigits: Math.max(minDigits, maxDigits),
|
|
||||||
minimumFractionDigits: Math.min(minDigits, maxDigits)
|
|
||||||
});
|
|
||||||
|
|
||||||
return formatter.format(value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -120,22 +72,6 @@ export function formatPriceRange(
|
|||||||
)}`;
|
)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Format a file size (in bytes) into a human-readable format
|
|
||||||
*/
|
|
||||||
export function formatFileSize(size: number) {
|
|
||||||
const suffixes: string[] = ['B', 'KB', 'MB', 'GB'];
|
|
||||||
|
|
||||||
let idx = 0;
|
|
||||||
|
|
||||||
while (size > 1024 && idx < suffixes.length) {
|
|
||||||
size /= 1024;
|
|
||||||
idx++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return `${size.toFixed(2)} ${suffixes[idx]}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface FormatDateOptionsInterface {
|
interface FormatDateOptionsInterface {
|
||||||
showTime?: boolean;
|
showTime?: boolean;
|
||||||
showSeconds?: boolean;
|
showSeconds?: boolean;
|
||||||
|
@@ -16,13 +16,13 @@ import { ModelType } from '@lib/enums/ModelType';
|
|||||||
import RemoveRowButton from '../components/buttons/RemoveRowButton';
|
import RemoveRowButton from '../components/buttons/RemoveRowButton';
|
||||||
import { StandaloneField } from '../components/forms/StandaloneField';
|
import { StandaloneField } from '../components/forms/StandaloneField';
|
||||||
|
|
||||||
|
import { ProgressBar } from '@lib/components/ProgressBar';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { ApiFormFieldSet, ApiFormFieldType } from '@lib/types/Forms';
|
import type { ApiFormFieldSet, ApiFormFieldType } from '@lib/types/Forms';
|
||||||
import {
|
import {
|
||||||
TableFieldErrorWrapper,
|
TableFieldErrorWrapper,
|
||||||
type TableFieldRowProps
|
type TableFieldRowProps
|
||||||
} from '../components/forms/fields/TableField';
|
} from '../components/forms/fields/TableField';
|
||||||
import { ProgressBar } from '../components/items/ProgressBar';
|
|
||||||
import { StatusRenderer } from '../components/render/StatusRenderer';
|
import { StatusRenderer } from '../components/render/StatusRenderer';
|
||||||
import { useCreateApiFormModal } from '../hooks/UseForm';
|
import { useCreateApiFormModal } from '../hooks/UseForm';
|
||||||
import {
|
import {
|
||||||
|
@@ -24,14 +24,15 @@ import {
|
|||||||
} from '@tabler/icons-react';
|
} from '@tabler/icons-react';
|
||||||
import { useEffect, useMemo, useState } from 'react';
|
import { useEffect, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import { ActionButton } from '@lib/components/ActionButton';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { IconCalendarExclamation } from '@tabler/icons-react';
|
import { IconCalendarExclamation } from '@tabler/icons-react';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { ActionButton } from '../components/buttons/ActionButton';
|
|
||||||
import RemoveRowButton from '../components/buttons/RemoveRowButton';
|
import RemoveRowButton from '../components/buttons/RemoveRowButton';
|
||||||
import { StandaloneField } from '../components/forms/StandaloneField';
|
import { StandaloneField } from '../components/forms/StandaloneField';
|
||||||
|
|
||||||
|
import { ProgressBar } from '@lib/components/ProgressBar';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type {
|
import type {
|
||||||
ApiFormAdjustFilterType,
|
ApiFormAdjustFilterType,
|
||||||
@@ -42,7 +43,6 @@ import {
|
|||||||
type TableFieldRowProps
|
type TableFieldRowProps
|
||||||
} from '../components/forms/fields/TableField';
|
} from '../components/forms/fields/TableField';
|
||||||
import { Thumbnail } from '../components/images/Thumbnail';
|
import { Thumbnail } from '../components/images/Thumbnail';
|
||||||
import { ProgressBar } from '../components/items/ProgressBar';
|
|
||||||
import { StylishText } from '../components/items/StylishText';
|
import { StylishText } from '../components/items/StylishText';
|
||||||
import { getStatusCodeOptions } from '../components/render/StatusRenderer';
|
import { getStatusCodeOptions } from '../components/render/StatusRenderer';
|
||||||
import { InvenTreeIcon } from '../functions/icons';
|
import { InvenTreeIcon } from '../functions/icons';
|
||||||
|
@@ -13,6 +13,7 @@ import { ModelType } from '@lib/enums/ModelType';
|
|||||||
import RemoveRowButton from '../components/buttons/RemoveRowButton';
|
import RemoveRowButton from '../components/buttons/RemoveRowButton';
|
||||||
import { StandaloneField } from '../components/forms/StandaloneField';
|
import { StandaloneField } from '../components/forms/StandaloneField';
|
||||||
|
|
||||||
|
import { ProgressBar } from '@lib/components/ProgressBar';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type {
|
import type {
|
||||||
ApiFormAdjustFilterType,
|
ApiFormAdjustFilterType,
|
||||||
@@ -20,7 +21,6 @@ import type {
|
|||||||
ApiFormFieldType
|
ApiFormFieldType
|
||||||
} from '@lib/types/Forms';
|
} from '@lib/types/Forms';
|
||||||
import type { TableFieldRowProps } from '../components/forms/fields/TableField';
|
import type { TableFieldRowProps } from '../components/forms/fields/TableField';
|
||||||
import { ProgressBar } from '../components/items/ProgressBar';
|
|
||||||
import { useCreateApiFormModal } from '../hooks/UseForm';
|
import { useCreateApiFormModal } from '../hooks/UseForm';
|
||||||
import { useGlobalSettingsState } from '../states/SettingsStates';
|
import { useGlobalSettingsState } from '../states/SettingsStates';
|
||||||
import { PartColumn } from '../tables/ColumnRenderers';
|
import { PartColumn } from '../tables/ColumnRenderers';
|
||||||
|
@@ -22,12 +22,12 @@ import {
|
|||||||
import { useQuery, useSuspenseQuery } from '@tanstack/react-query';
|
import { useQuery, useSuspenseQuery } from '@tanstack/react-query';
|
||||||
import { type JSX, Suspense, useEffect, useMemo, useState } from 'react';
|
import { type JSX, Suspense, useEffect, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import { ActionButton } from '@lib/components/ActionButton';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { api } from '../App';
|
import { api } from '../App';
|
||||||
import { ActionButton } from '../components/buttons/ActionButton';
|
|
||||||
import RemoveRowButton from '../components/buttons/RemoveRowButton';
|
import RemoveRowButton from '../components/buttons/RemoveRowButton';
|
||||||
import { StandaloneField } from '../components/forms/StandaloneField';
|
import { StandaloneField } from '../components/forms/StandaloneField';
|
||||||
|
|
||||||
|
@@ -1,15 +0,0 @@
|
|||||||
// dec2hex :: Integer -> String
|
|
||||||
// i.e. 0-255 -> '00'-'ff'
|
|
||||||
function dec2hex(dec: number) {
|
|
||||||
return dec.toString(16).padStart(2, '0');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate a unique ID string with the specified number of values
|
|
||||||
*/
|
|
||||||
export function generateUniqueId(length = 8): string {
|
|
||||||
const arr = new Uint8Array(length / 2);
|
|
||||||
window.crypto.getRandomValues(arr);
|
|
||||||
|
|
||||||
return Array.from(arr, dec2hex).join('');
|
|
||||||
}
|
|
@@ -3,6 +3,7 @@ import { useMemo } from 'react';
|
|||||||
|
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
|
import { identifierString } from '@lib/functions/Conversion';
|
||||||
import { api } from '../App';
|
import { api } from '../App';
|
||||||
import type { DashboardWidgetProps } from '../components/dashboard/DashboardWidget';
|
import type { DashboardWidgetProps } from '../components/dashboard/DashboardWidget';
|
||||||
import DashboardWidgetLibrary from '../components/dashboard/DashboardWidgetLibrary';
|
import DashboardWidgetLibrary from '../components/dashboard/DashboardWidgetLibrary';
|
||||||
@@ -12,7 +13,6 @@ import {
|
|||||||
PluginUIFeatureType
|
PluginUIFeatureType
|
||||||
} from '../components/plugins/PluginUIFeature';
|
} from '../components/plugins/PluginUIFeature';
|
||||||
import RemoteComponent from '../components/plugins/RemoteComponent';
|
import RemoteComponent from '../components/plugins/RemoteComponent';
|
||||||
import { identifierString } from '../functions/conversion';
|
|
||||||
import { useGlobalSettingsState } from '../states/SettingsStates';
|
import { useGlobalSettingsState } from '../states/SettingsStates';
|
||||||
import { useUserState } from '../states/UserState';
|
import { useUserState } from '../states/UserState';
|
||||||
|
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import { ProgressBar } from '@lib/components/ProgressBar';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import { t } from '@lingui/core/macro';
|
import { t } from '@lingui/core/macro';
|
||||||
@@ -6,7 +7,6 @@ import { notifications, showNotification } from '@mantine/notifications';
|
|||||||
import { IconCircleCheck, IconExclamationCircle } from '@tabler/icons-react';
|
import { IconCircleCheck, IconExclamationCircle } from '@tabler/icons-react';
|
||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { ProgressBar } from '../components/items/ProgressBar';
|
|
||||||
import { useApi } from '../contexts/ApiContext';
|
import { useApi } from '../contexts/ApiContext';
|
||||||
import { generateUrl } from '../functions/urls';
|
import { generateUrl } from '../functions/urls';
|
||||||
|
|
||||||
|
@@ -5,9 +5,9 @@
|
|||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import { useCallback, useMemo } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
|
|
||||||
|
import { resolveItem } from '@lib/functions/Conversion';
|
||||||
import type { TableFilterChoice } from '@lib/types/Filters';
|
import type { TableFilterChoice } from '@lib/types/Filters';
|
||||||
import { useApi } from '../contexts/ApiContext';
|
import { useApi } from '../contexts/ApiContext';
|
||||||
import { resolveItem } from '../functions/conversion';
|
|
||||||
|
|
||||||
type UseFilterProps = {
|
type UseFilterProps = {
|
||||||
url: string;
|
url: string;
|
||||||
|
@@ -4,12 +4,12 @@ import { Badge, Group, Stack, Table } from '@mantine/core';
|
|||||||
import { IconEdit, IconKey, IconUser } from '@tabler/icons-react';
|
import { IconEdit, IconKey, IconUser } from '@tabler/icons-react';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
|
|
||||||
|
import { ActionButton } from '@lib/components/ActionButton';
|
||||||
|
import { YesNoUndefinedButton } from '@lib/components/YesNoButton';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { useShallow } from 'zustand/react/shallow';
|
import { useShallow } from 'zustand/react/shallow';
|
||||||
import { ActionButton } from '../../../../components/buttons/ActionButton';
|
|
||||||
import { YesNoUndefinedButton } from '../../../../components/buttons/YesNoButton';
|
|
||||||
import { ActionDropdown } from '../../../../components/items/ActionDropdown';
|
import { ActionDropdown } from '../../../../components/items/ActionDropdown';
|
||||||
import { StylishText } from '../../../../components/items/StylishText';
|
import { StylishText } from '../../../../components/items/StylishText';
|
||||||
import { useEditApiFormModal } from '../../../../hooks/UseForm';
|
import { useEditApiFormModal } from '../../../../hooks/UseForm';
|
||||||
|
@@ -4,10 +4,10 @@ import { showNotification } from '@mantine/notifications';
|
|||||||
import { IconReload } from '@tabler/icons-react';
|
import { IconReload } from '@tabler/icons-react';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import { ActionButton } from '@lib/components/ActionButton';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import { api } from '../../../../App';
|
import { api } from '../../../../App';
|
||||||
import { ActionButton } from '../../../../components/buttons/ActionButton';
|
|
||||||
import { FactCollection } from '../../../../components/settings/FactCollection';
|
import { FactCollection } from '../../../../components/settings/FactCollection';
|
||||||
import { GlobalSettingList } from '../../../../components/settings/SettingList';
|
import { GlobalSettingList } from '../../../../components/settings/SettingList';
|
||||||
import { showApiErrorMessage } from '../../../../functions/notifications';
|
import { showApiErrorMessage } from '../../../../functions/notifications';
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
|
import { YesNoButton } from '@lib/components/YesNoButton';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { t } from '@lingui/core/macro';
|
import { t } from '@lingui/core/macro';
|
||||||
import { YesNoButton } from '../../../../components/buttons/YesNoButton';
|
|
||||||
import { TemplateTable } from '../../../../tables/settings/TemplateTable';
|
import { TemplateTable } from '../../../../tables/settings/TemplateTable';
|
||||||
|
|
||||||
function ReportTemplateTable() {
|
function ReportTemplateTable() {
|
||||||
|
@@ -10,9 +10,9 @@ import {
|
|||||||
} from '@tabler/icons-react';
|
} from '@tabler/icons-react';
|
||||||
import { useCallback, useMemo } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
|
|
||||||
|
import { ActionButton } from '@lib/components/ActionButton';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import { ActionButton } from '../components/buttons/ActionButton';
|
|
||||||
import { PageDetail } from '../components/nav/PageDetail';
|
import { PageDetail } from '../components/nav/PageDetail';
|
||||||
import { PanelGroup } from '../components/panels/PanelGroup';
|
import { PanelGroup } from '../components/panels/PanelGroup';
|
||||||
import { useApi } from '../contexts/ApiContext';
|
import { useApi } from '../contexts/ApiContext';
|
||||||
|
@@ -10,9 +10,11 @@ import {
|
|||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import { RowDeleteAction, RowEditAction } from '@lib/components/RowActions';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
||||||
import { formatDate, formatPriceRange } from '../../defaults/formatters';
|
import { formatDate, formatPriceRange } from '../../defaults/formatters';
|
||||||
@@ -27,9 +29,7 @@ import {
|
|||||||
} from '../../hooks/UseForm';
|
} from '../../hooks/UseForm';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../../tables/Column';
|
|
||||||
import { InvenTreeTable } from '../../tables/InvenTreeTable';
|
import { InvenTreeTable } from '../../tables/InvenTreeTable';
|
||||||
import { RowDeleteAction, RowEditAction } from '../../tables/RowActions';
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Render a tooltip for the chart, with correct date information
|
* Render a tooltip for the chart, with correct date information
|
||||||
|
@@ -14,6 +14,7 @@ import { type ReactNode, useMemo, useState } from 'react';
|
|||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { CHART_COLORS } from '../../../components/charts/colors';
|
import { CHART_COLORS } from '../../../components/charts/colors';
|
||||||
import { tooltipFormatter } from '../../../components/charts/tooltipFormatter';
|
import { tooltipFormatter } from '../../../components/charts/tooltipFormatter';
|
||||||
import {
|
import {
|
||||||
@@ -22,7 +23,6 @@ import {
|
|||||||
formatPriceRange
|
formatPriceRange
|
||||||
} from '../../../defaults/formatters';
|
} from '../../../defaults/formatters';
|
||||||
import { useTable } from '../../../hooks/UseTable';
|
import { useTable } from '../../../hooks/UseTable';
|
||||||
import type { TableColumn } from '../../../tables/Column';
|
|
||||||
import { DateColumn, PartColumn } from '../../../tables/ColumnRenderers';
|
import { DateColumn, PartColumn } from '../../../tables/ColumnRenderers';
|
||||||
import { InvenTreeTable } from '../../../tables/InvenTreeTable';
|
import { InvenTreeTable } from '../../../tables/InvenTreeTable';
|
||||||
import { LoadingPricingData, NoPricingData } from './PricingPanel';
|
import { LoadingPricingData, NoPricingData } from './PricingPanel';
|
||||||
|
@@ -3,10 +3,16 @@ import { BarChart } from '@mantine/charts';
|
|||||||
import { SimpleGrid } from '@mantine/core';
|
import { SimpleGrid } from '@mantine/core';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import {
|
||||||
|
type RowAction,
|
||||||
|
RowDeleteAction,
|
||||||
|
RowEditAction
|
||||||
|
} from '@lib/components/RowActions';
|
||||||
import type { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import type { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { AddItemButton } from '../../../components/buttons/AddItemButton';
|
import { AddItemButton } from '../../../components/buttons/AddItemButton';
|
||||||
import { tooltipFormatter } from '../../../components/charts/tooltipFormatter';
|
import { tooltipFormatter } from '../../../components/charts/tooltipFormatter';
|
||||||
import { formatCurrency } from '../../../defaults/formatters';
|
import { formatCurrency } from '../../../defaults/formatters';
|
||||||
@@ -17,13 +23,7 @@ import {
|
|||||||
} from '../../../hooks/UseForm';
|
} from '../../../hooks/UseForm';
|
||||||
import { useTable } from '../../../hooks/UseTable';
|
import { useTable } from '../../../hooks/UseTable';
|
||||||
import { useUserState } from '../../../states/UserState';
|
import { useUserState } from '../../../states/UserState';
|
||||||
import type { TableColumn } from '../../../tables/Column';
|
|
||||||
import { InvenTreeTable } from '../../../tables/InvenTreeTable';
|
import { InvenTreeTable } from '../../../tables/InvenTreeTable';
|
||||||
import {
|
|
||||||
type RowAction,
|
|
||||||
RowDeleteAction,
|
|
||||||
RowEditAction
|
|
||||||
} from '../../../tables/RowActions';
|
|
||||||
import { NoPricingData } from './PricingPanel';
|
import { NoPricingData } from './PricingPanel';
|
||||||
|
|
||||||
export default function PriceBreakPanel({
|
export default function PriceBreakPanel({
|
||||||
|
@@ -5,9 +5,9 @@ import { type ReactNode, useCallback, useMemo } from 'react';
|
|||||||
|
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { formatCurrency, formatDate } from '../../../defaults/formatters';
|
import { formatCurrency, formatDate } from '../../../defaults/formatters';
|
||||||
import { useTable } from '../../../hooks/UseTable';
|
import { useTable } from '../../../hooks/UseTable';
|
||||||
import type { TableColumn } from '../../../tables/Column';
|
|
||||||
import { InvenTreeTable } from '../../../tables/InvenTreeTable';
|
import { InvenTreeTable } from '../../../tables/InvenTreeTable';
|
||||||
import { NoPricingData } from './PricingPanel';
|
import { NoPricingData } from './PricingPanel';
|
||||||
|
|
||||||
|
@@ -5,9 +5,9 @@ import { type ReactNode, useMemo } from 'react';
|
|||||||
|
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { formatCurrency } from '../../../defaults/formatters';
|
import { formatCurrency } from '../../../defaults/formatters';
|
||||||
import { useTable } from '../../../hooks/UseTable';
|
import { useTable } from '../../../hooks/UseTable';
|
||||||
import type { TableColumn } from '../../../tables/Column';
|
|
||||||
import { DateColumn } from '../../../tables/ColumnRenderers';
|
import { DateColumn } from '../../../tables/ColumnRenderers';
|
||||||
import { InvenTreeTable } from '../../../tables/InvenTreeTable';
|
import { InvenTreeTable } from '../../../tables/InvenTreeTable';
|
||||||
import { NoPricingData } from './PricingPanel';
|
import { NoPricingData } from './PricingPanel';
|
||||||
|
@@ -5,9 +5,9 @@ import { useMemo } from 'react';
|
|||||||
|
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { tooltipFormatter } from '../../../components/charts/tooltipFormatter';
|
import { tooltipFormatter } from '../../../components/charts/tooltipFormatter';
|
||||||
import { useTable } from '../../../hooks/UseTable';
|
import { useTable } from '../../../hooks/UseTable';
|
||||||
import type { TableColumn } from '../../../tables/Column';
|
|
||||||
import { InvenTreeTable } from '../../../tables/InvenTreeTable';
|
import { InvenTreeTable } from '../../../tables/InvenTreeTable';
|
||||||
import {
|
import {
|
||||||
SupplierPriceBreakColumns,
|
SupplierPriceBreakColumns,
|
||||||
|
@@ -6,10 +6,10 @@ import { type ReactNode, useMemo } from 'react';
|
|||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { tooltipFormatter } from '../../../components/charts/tooltipFormatter';
|
import { tooltipFormatter } from '../../../components/charts/tooltipFormatter';
|
||||||
import { formatCurrency } from '../../../defaults/formatters';
|
import { formatCurrency } from '../../../defaults/formatters';
|
||||||
import { useTable } from '../../../hooks/UseTable';
|
import { useTable } from '../../../hooks/UseTable';
|
||||||
import type { TableColumn } from '../../../tables/Column';
|
|
||||||
import { DateColumn, PartColumn } from '../../../tables/ColumnRenderers';
|
import { DateColumn, PartColumn } from '../../../tables/ColumnRenderers';
|
||||||
import { InvenTreeTable } from '../../../tables/InvenTreeTable';
|
import { InvenTreeTable } from '../../../tables/InvenTreeTable';
|
||||||
import { NoPricingData } from './PricingPanel';
|
import { NoPricingData } from './PricingPanel';
|
||||||
|
@@ -28,6 +28,7 @@ import { useQuery } from '@tanstack/react-query';
|
|||||||
import { type ReactNode, useMemo, useState } from 'react';
|
import { type ReactNode, useMemo, useState } from 'react';
|
||||||
import { useNavigate, useParams } from 'react-router-dom';
|
import { useNavigate, useParams } from 'react-router-dom';
|
||||||
|
|
||||||
|
import { ActionButton } from '@lib/components/ActionButton';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
@@ -35,7 +36,6 @@ import { apiUrl } from '@lib/functions/Api';
|
|||||||
import { getDetailUrl } from '@lib/functions/Navigation';
|
import { getDetailUrl } from '@lib/functions/Navigation';
|
||||||
import { notifications } from '@mantine/notifications';
|
import { notifications } from '@mantine/notifications';
|
||||||
import { useBarcodeScanDialog } from '../../components/barcodes/BarcodeScanDialog';
|
import { useBarcodeScanDialog } from '../../components/barcodes/BarcodeScanDialog';
|
||||||
import { ActionButton } from '../../components/buttons/ActionButton';
|
|
||||||
import AdminButton from '../../components/buttons/AdminButton';
|
import AdminButton from '../../components/buttons/AdminButton';
|
||||||
import { PrintingActions } from '../../components/buttons/PrintingActions';
|
import { PrintingActions } from '../../components/buttons/PrintingActions';
|
||||||
import {
|
import {
|
||||||
|
@@ -5,6 +5,7 @@ import { create, createStore } from 'zustand';
|
|||||||
|
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
|
import { isTrue } from '@lib/functions/Conversion';
|
||||||
import type { PathParams } from '@lib/types/Core';
|
import type { PathParams } from '@lib/types/Core';
|
||||||
import type {
|
import type {
|
||||||
Setting,
|
Setting,
|
||||||
@@ -13,7 +14,6 @@ import type {
|
|||||||
} from '@lib/types/Settings';
|
} from '@lib/types/Settings';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { api } from '../App';
|
import { api } from '../App';
|
||||||
import { isTrue } from '../functions/conversion';
|
|
||||||
import { useUserState } from './UserState';
|
import { useUserState } from './UserState';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,56 +0,0 @@
|
|||||||
import type { ApiFormFieldType } from '@lib/types/Forms';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Table column properties
|
|
||||||
*
|
|
||||||
* @param T - The type of the record
|
|
||||||
* @param accessor - The key in the record to access
|
|
||||||
* @param title - The title of the column - Note: this may be supplied by the API, and is not required, but it can be overridden if required
|
|
||||||
* @param ordering - The key in the record to sort by (defaults to accessor)
|
|
||||||
* @param sortable - Whether the column is sortable
|
|
||||||
* @param switchable - Whether the column is switchable
|
|
||||||
* @param defaultVisible - Whether the column is visible by default (defaults to true)
|
|
||||||
* @param hidden - Whether the column is hidden (forced hidden, cannot be toggled by the user))
|
|
||||||
* @param editable - Whether the value of this column can be edited
|
|
||||||
* @param definition - Optional field definition for the column
|
|
||||||
* @param render - A custom render function
|
|
||||||
* @param filter - A custom filter function
|
|
||||||
* @param filtering - Whether the column is filterable
|
|
||||||
* @param width - The width of the column
|
|
||||||
* @param resizable - Whether the column is resizable (defaults to true)
|
|
||||||
* @param noWrap - Whether the column should wrap
|
|
||||||
* @param ellipsis - Whether the column should be ellipsized
|
|
||||||
* @param textAlign - The text alignment of the column
|
|
||||||
* @param cellsStyle - The style of the cells in the column
|
|
||||||
* @param extra - Extra data to pass to the render function
|
|
||||||
* @param noContext - Disable context menu for this column
|
|
||||||
*/
|
|
||||||
export type TableColumnProps<T = any> = {
|
|
||||||
accessor?: string;
|
|
||||||
title?: string;
|
|
||||||
ordering?: string;
|
|
||||||
sortable?: boolean;
|
|
||||||
switchable?: boolean;
|
|
||||||
hidden?: boolean;
|
|
||||||
defaultVisible?: boolean;
|
|
||||||
editable?: boolean;
|
|
||||||
definition?: ApiFormFieldType;
|
|
||||||
render?: (record: T, index?: number) => any;
|
|
||||||
filter?: any;
|
|
||||||
filtering?: boolean;
|
|
||||||
width?: number;
|
|
||||||
resizable?: boolean;
|
|
||||||
noWrap?: boolean;
|
|
||||||
ellipsis?: boolean;
|
|
||||||
textAlign?: 'left' | 'center' | 'right';
|
|
||||||
cellsStyle?: any;
|
|
||||||
extra?: any;
|
|
||||||
noContext?: boolean;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface for the table column definition
|
|
||||||
*/
|
|
||||||
export type TableColumn<T = any> = {
|
|
||||||
accessor: string; // The key in the record to access
|
|
||||||
} & TableColumnProps<T>;
|
|
@@ -10,20 +10,20 @@ import {
|
|||||||
IconLock
|
IconLock
|
||||||
} from '@tabler/icons-react';
|
} from '@tabler/icons-react';
|
||||||
|
|
||||||
|
import { ProgressBar } from '@lib/components/ProgressBar';
|
||||||
|
import { YesNoButton } from '@lib/components/YesNoButton';
|
||||||
import type { ModelType } from '@lib/enums/ModelType';
|
import type { ModelType } from '@lib/enums/ModelType';
|
||||||
|
import { resolveItem } from '@lib/functions/Conversion';
|
||||||
import { cancelEvent } from '@lib/functions/Events';
|
import { cancelEvent } from '@lib/functions/Events';
|
||||||
import { YesNoButton } from '../components/buttons/YesNoButton';
|
import type { TableColumn, TableColumnProps } from '@lib/types/Tables';
|
||||||
import { Thumbnail } from '../components/images/Thumbnail';
|
import { Thumbnail } from '../components/images/Thumbnail';
|
||||||
import { ProgressBar } from '../components/items/ProgressBar';
|
|
||||||
import { TableStatusRenderer } from '../components/render/StatusRenderer';
|
import { TableStatusRenderer } from '../components/render/StatusRenderer';
|
||||||
import { RenderOwner, RenderUser } from '../components/render/User';
|
import { RenderOwner, RenderUser } from '../components/render/User';
|
||||||
import { formatCurrency, formatDate } from '../defaults/formatters';
|
import { formatCurrency, formatDate } from '../defaults/formatters';
|
||||||
import { resolveItem } from '../functions/conversion';
|
|
||||||
import {
|
import {
|
||||||
useGlobalSettingsState,
|
useGlobalSettingsState,
|
||||||
useUserSettingsState
|
useUserSettingsState
|
||||||
} from '../states/SettingsStates';
|
} from '../states/SettingsStates';
|
||||||
import type { TableColumn, TableColumnProps } from './Column';
|
|
||||||
import { ProjectCodeHoverCard, TableHoverCard } from './TableHoverCard';
|
import { ProjectCodeHoverCard, TableHoverCard } from './TableHoverCard';
|
||||||
|
|
||||||
// Render a Part instance within a table
|
// Render a Part instance within a table
|
||||||
|
@@ -1,5 +1,15 @@
|
|||||||
|
import { RowActions } from '@lib/components/RowActions';
|
||||||
|
import { resolveItem } from '@lib/functions/Conversion';
|
||||||
|
import { cancelEvent } from '@lib/functions/Events';
|
||||||
|
import { getDetailUrl } from '@lib/functions/Navigation';
|
||||||
|
import { navigateToLink } from '@lib/functions/Navigation';
|
||||||
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
|
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
||||||
|
import type { InvenTreeTableProps, TableState } from '@lib/types/Tables';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { t } from '@lingui/core/macro';
|
import { t } from '@lingui/core/macro';
|
||||||
import { Box, type MantineStyleProp, Stack } from '@mantine/core';
|
import { Box, Stack } from '@mantine/core';
|
||||||
|
import { IconArrowRight } from '@tabler/icons-react';
|
||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import {
|
import {
|
||||||
type ContextMenuItemOptions,
|
type ContextMenuItemOptions,
|
||||||
@@ -7,7 +17,6 @@ import {
|
|||||||
} from 'mantine-contextmenu';
|
} from 'mantine-contextmenu';
|
||||||
import {
|
import {
|
||||||
DataTable,
|
DataTable,
|
||||||
type DataTableCellClickHandler,
|
|
||||||
type DataTableRowExpansionProps,
|
type DataTableRowExpansionProps,
|
||||||
type DataTableSortStatus,
|
type DataTableSortStatus,
|
||||||
useDataTableColumns
|
useDataTableColumns
|
||||||
@@ -15,92 +24,17 @@ import {
|
|||||||
import type React from 'react';
|
import type React from 'react';
|
||||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
import type { ModelType } from '@lib/enums/ModelType';
|
|
||||||
import { cancelEvent } from '@lib/functions/Events';
|
|
||||||
import { getDetailUrl } from '@lib/functions/Navigation';
|
|
||||||
import { navigateToLink } from '@lib/functions/Navigation';
|
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
|
||||||
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
|
||||||
import type { TableState } from '@lib/types/Tables';
|
|
||||||
import { IconArrowRight } from '@tabler/icons-react';
|
|
||||||
import { Boundary } from '../components/Boundary';
|
import { Boundary } from '../components/Boundary';
|
||||||
import { useApi } from '../contexts/ApiContext';
|
import { useApi } from '../contexts/ApiContext';
|
||||||
import { resolveItem } from '../functions/conversion';
|
|
||||||
import { extractAvailableFields, mapFields } from '../functions/forms';
|
import { extractAvailableFields, mapFields } from '../functions/forms';
|
||||||
import { showApiErrorMessage } from '../functions/notifications';
|
import { showApiErrorMessage } from '../functions/notifications';
|
||||||
import { useLocalState } from '../states/LocalState';
|
import { useLocalState } from '../states/LocalState';
|
||||||
import { useStoredTableState } from '../states/StoredTableState';
|
import { useStoredTableState } from '../states/StoredTableState';
|
||||||
import type { TableColumn } from './Column';
|
|
||||||
import InvenTreeTableHeader from './InvenTreeTableHeader';
|
import InvenTreeTableHeader from './InvenTreeTableHeader';
|
||||||
import { type RowAction, RowActions } from './RowActions';
|
|
||||||
|
|
||||||
const ACTIONS_COLUMN_ACCESSOR: string = '--actions--';
|
const ACTIONS_COLUMN_ACCESSOR: string = '--actions--';
|
||||||
const PAGE_SIZES = [10, 15, 20, 25, 50, 100, 500];
|
const PAGE_SIZES = [10, 15, 20, 25, 50, 100, 500];
|
||||||
|
|
||||||
/**
|
|
||||||
* Set of optional properties which can be passed to an InvenTreeTable component
|
|
||||||
*
|
|
||||||
* @param params : any - Base query parameters
|
|
||||||
* @param tableState : TableState - State manager for the table
|
|
||||||
* @param defaultSortColumn : string - Default column to sort by
|
|
||||||
* @param noRecordsText : string - Text to display when no records are found
|
|
||||||
* @param enableBulkDelete : boolean - Enable bulk deletion of records
|
|
||||||
* @param enableDownload : boolean - Enable download actions
|
|
||||||
* @param enableFilters : boolean - Enable filter actions
|
|
||||||
* @param enableSelection : boolean - Enable row selection
|
|
||||||
* @param enableSearch : boolean - Enable search actions
|
|
||||||
* @param enableLabels : boolean - Enable printing of labels against selected items
|
|
||||||
* @param enableReports : boolean - Enable printing of reports against selected items
|
|
||||||
* @param printingAccessor : string - Accessor for label and report printing (default = 'pk')
|
|
||||||
* @param enablePagination : boolean - Enable pagination
|
|
||||||
* @param enableRefresh : boolean - Enable refresh actions
|
|
||||||
* @param enableColumnSwitching : boolean - Enable column switching
|
|
||||||
* @param enableColumnCaching : boolean - Enable caching of column names via API
|
|
||||||
* @param barcodeActions : any[] - List of barcode actions
|
|
||||||
* @param tableFilters : TableFilter[] - List of custom filters
|
|
||||||
* @param tableActions : any[] - List of custom action groups
|
|
||||||
* @param dataFormatter : (data: any) => any - Callback function to reformat data returned by server (if not in default format)
|
|
||||||
* @param rowActions : (record: any) => RowAction[] - Callback function to generate row actions
|
|
||||||
* @param onRowClick : (record: any, index: number, event: any) => void - Callback function when a row is clicked
|
|
||||||
* @param onCellClick : (event: any, record: any, index: number, column: any, columnIndex: number) => void - Callback function when a cell is clicked
|
|
||||||
* @param modelType: ModelType - The model type for the table
|
|
||||||
* @param minHeight: number - Minimum height of the table (default 300px)
|
|
||||||
* @param noHeader: boolean - Hide the table header
|
|
||||||
*/
|
|
||||||
export type InvenTreeTableProps<T = any> = {
|
|
||||||
params?: any;
|
|
||||||
defaultSortColumn?: string;
|
|
||||||
noRecordsText?: string;
|
|
||||||
enableBulkDelete?: boolean;
|
|
||||||
enableDownload?: boolean;
|
|
||||||
enableFilters?: boolean;
|
|
||||||
enableSelection?: boolean;
|
|
||||||
enableSearch?: boolean;
|
|
||||||
enablePagination?: boolean;
|
|
||||||
enableRefresh?: boolean;
|
|
||||||
enableColumnSwitching?: boolean;
|
|
||||||
enableColumnCaching?: boolean;
|
|
||||||
enableLabels?: boolean;
|
|
||||||
enableReports?: boolean;
|
|
||||||
printingAccessor?: string;
|
|
||||||
afterBulkDelete?: () => void;
|
|
||||||
barcodeActions?: React.ReactNode[];
|
|
||||||
tableFilters?: TableFilter[];
|
|
||||||
tableActions?: React.ReactNode[];
|
|
||||||
rowExpansion?: DataTableRowExpansionProps<T>;
|
|
||||||
dataFormatter?: (data: any) => any;
|
|
||||||
rowActions?: (record: T) => RowAction[];
|
|
||||||
onRowClick?: (record: T, index: number, event: any) => void;
|
|
||||||
onCellClick?: DataTableCellClickHandler<T>;
|
|
||||||
modelType?: ModelType;
|
|
||||||
rowStyle?: (record: T, index: number) => MantineStyleProp | undefined;
|
|
||||||
modelField?: string;
|
|
||||||
onCellContextMenu?: (record: T, event: any) => void;
|
|
||||||
minHeight?: number;
|
|
||||||
noHeader?: boolean;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default table properties (used if not specified)
|
* Default table properties (used if not specified)
|
||||||
*/
|
*/
|
||||||
|
@@ -18,20 +18,20 @@ import {
|
|||||||
import { useMemo, useState } from 'react';
|
import { useMemo, useState } from 'react';
|
||||||
import { Fragment } from 'react/jsx-runtime';
|
import { Fragment } from 'react/jsx-runtime';
|
||||||
|
|
||||||
|
import { ActionButton } from '@lib/components/ActionButton';
|
||||||
|
import { ButtonMenu } from '@lib/components/ButtonMenu';
|
||||||
|
import { SearchInput } from '@lib/components/SearchInput';
|
||||||
|
import { resolveItem } from '@lib/functions/Conversion';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
import type { TableState } from '@lib/types/Tables';
|
import type { TableState } from '@lib/types/Tables';
|
||||||
|
import type { InvenTreeTableProps } from '@lib/types/Tables';
|
||||||
import { showNotification } from '@mantine/notifications';
|
import { showNotification } from '@mantine/notifications';
|
||||||
import { Boundary } from '../components/Boundary';
|
import { Boundary } from '../components/Boundary';
|
||||||
import { ActionButton } from '../components/buttons/ActionButton';
|
|
||||||
import { ButtonMenu } from '../components/buttons/ButtonMenu';
|
|
||||||
import { PrintingActions } from '../components/buttons/PrintingActions';
|
import { PrintingActions } from '../components/buttons/PrintingActions';
|
||||||
import { resolveItem } from '../functions/conversion';
|
|
||||||
import useDataExport from '../hooks/UseDataExport';
|
import useDataExport from '../hooks/UseDataExport';
|
||||||
import { useDeleteApiFormModal } from '../hooks/UseForm';
|
import { useDeleteApiFormModal } from '../hooks/UseForm';
|
||||||
import { TableColumnSelect } from './ColumnSelect';
|
import { TableColumnSelect } from './ColumnSelect';
|
||||||
import { FilterSelectDrawer } from './FilterSelectDrawer';
|
import { FilterSelectDrawer } from './FilterSelectDrawer';
|
||||||
import type { InvenTreeTableProps } from './InvenTreeTable';
|
|
||||||
import { TableSearchInput } from './Search';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render a composite header for an InvenTree table
|
* Render a composite header for an InvenTree table
|
||||||
@@ -207,7 +207,7 @@ export default function InvenTreeTableHeader({
|
|||||||
<Space />
|
<Space />
|
||||||
<Group justify='right' gap={5} wrap='nowrap'>
|
<Group justify='right' gap={5} wrap='nowrap'>
|
||||||
{tableProps.enableSearch && (
|
{tableProps.enableSearch && (
|
||||||
<TableSearchInput
|
<SearchInput
|
||||||
disabled={hasCustomSearch}
|
disabled={hasCustomSearch}
|
||||||
searchCallback={(term: string) => tableState.setSearchTerm(term)}
|
searchCallback={(term: string) => tableState.setSearchTerm(term)}
|
||||||
/>
|
/>
|
||||||
|
@@ -11,15 +11,21 @@ import {
|
|||||||
import { type ReactNode, useCallback, useMemo, useState } from 'react';
|
import { type ReactNode, useCallback, useMemo, useState } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
import { ActionButton } from '@lib/components/ActionButton';
|
||||||
|
import {
|
||||||
|
type RowAction,
|
||||||
|
RowDeleteAction,
|
||||||
|
RowEditAction
|
||||||
|
} from '@lib/components/RowActions';
|
||||||
|
import { YesNoButton } from '@lib/components/YesNoButton';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import { navigateToLink } from '@lib/functions/Navigation';
|
import { navigateToLink } from '@lib/functions/Navigation';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
import { ActionButton } from '../../components/buttons/ActionButton';
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
||||||
import { YesNoButton } from '../../components/buttons/YesNoButton';
|
|
||||||
import { Thumbnail } from '../../components/images/Thumbnail';
|
import { Thumbnail } from '../../components/images/Thumbnail';
|
||||||
import ImporterDrawer from '../../components/importer/ImporterDrawer';
|
import ImporterDrawer from '../../components/importer/ImporterDrawer';
|
||||||
import { RenderPart } from '../../components/render/Part';
|
import { RenderPart } from '../../components/render/Part';
|
||||||
@@ -35,7 +41,6 @@ import {
|
|||||||
} from '../../hooks/UseForm';
|
} from '../../hooks/UseForm';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import {
|
import {
|
||||||
BooleanColumn,
|
BooleanColumn,
|
||||||
DescriptionColumn,
|
DescriptionColumn,
|
||||||
@@ -44,7 +49,6 @@ import {
|
|||||||
} from '../ColumnRenderers';
|
} from '../ColumnRenderers';
|
||||||
import { PartCategoryFilter } from '../Filter';
|
import { PartCategoryFilter } from '../Filter';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions';
|
|
||||||
import { TableHoverCard } from '../TableHoverCard';
|
import { TableHoverCard } from '../TableHoverCard';
|
||||||
|
|
||||||
// Calculate the total stock quantity available for a given BomItem
|
// Calculate the total stock quantity available for a given BomItem
|
||||||
@@ -89,7 +93,7 @@ export function BomTable({
|
|||||||
accessor: 'sub_part',
|
accessor: 'sub_part',
|
||||||
switchable: false,
|
switchable: false,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
render: (record) => {
|
render: (record: any) => {
|
||||||
const part = record.sub_part_detail;
|
const part = record.sub_part_detail;
|
||||||
const extra = [];
|
const extra = [];
|
||||||
|
|
||||||
@@ -147,7 +151,7 @@ export function BomTable({
|
|||||||
{
|
{
|
||||||
accessor: 'substitutes',
|
accessor: 'substitutes',
|
||||||
defaultVisible: false,
|
defaultVisible: false,
|
||||||
render: (row) => {
|
render: (row: any) => {
|
||||||
const substitutes = row.substitutes ?? [];
|
const substitutes = row.substitutes ?? [];
|
||||||
|
|
||||||
return substitutes.length > 0 ? (
|
return substitutes.length > 0 ? (
|
||||||
@@ -205,7 +209,7 @@ export function BomTable({
|
|||||||
{
|
{
|
||||||
accessor: 'available_stock',
|
accessor: 'available_stock',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
render: (record) => {
|
render: (record: any) => {
|
||||||
const extra: ReactNode[] = [];
|
const extra: ReactNode[] = [];
|
||||||
|
|
||||||
const available_stock: number = availableStockQuantity(record);
|
const available_stock: number = availableStockQuantity(record);
|
||||||
|
@@ -6,9 +6,9 @@ import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
|||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { formatDecimal } from '../../defaults/formatters';
|
import { formatDecimal } from '../../defaults/formatters';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import {
|
import {
|
||||||
DescriptionColumn,
|
DescriptionColumn,
|
||||||
PartColumn,
|
PartColumn,
|
||||||
|
@@ -1,11 +1,17 @@
|
|||||||
import { t } from '@lingui/core/macro';
|
import { t } from '@lingui/core/macro';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import {
|
||||||
|
type RowAction,
|
||||||
|
RowDeleteAction,
|
||||||
|
RowEditAction
|
||||||
|
} from '@lib/components/RowActions';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import type { StockOperationProps } from '../../forms/StockForms';
|
import type { StockOperationProps } from '../../forms/StockForms';
|
||||||
import {
|
import {
|
||||||
useDeleteApiFormModal,
|
useDeleteApiFormModal,
|
||||||
@@ -14,7 +20,6 @@ import {
|
|||||||
import { useStockAdjustActions } from '../../hooks/UseStockAdjustActions';
|
import { useStockAdjustActions } from '../../hooks/UseStockAdjustActions';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import {
|
import {
|
||||||
LocationColumn,
|
LocationColumn,
|
||||||
PartColumn,
|
PartColumn,
|
||||||
@@ -23,7 +28,6 @@ import {
|
|||||||
} from '../ColumnRenderers';
|
} from '../ColumnRenderers';
|
||||||
import { StockLocationFilter } from '../Filter';
|
import { StockLocationFilter } from '../Filter';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render a table of allocated stock for a build.
|
* Render a table of allocated stock for a build.
|
||||||
|
@@ -11,13 +11,21 @@ import { DataTable, type DataTableRowExpansionProps } from 'mantine-datatable';
|
|||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
import { ActionButton } from '@lib/components/ActionButton';
|
||||||
|
import { ProgressBar } from '@lib/components/ProgressBar';
|
||||||
|
import {
|
||||||
|
type RowAction,
|
||||||
|
RowActions,
|
||||||
|
RowDeleteAction,
|
||||||
|
RowEditAction,
|
||||||
|
RowViewAction
|
||||||
|
} from '@lib/components/RowActions';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
import { ActionButton } from '../../components/buttons/ActionButton';
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { ProgressBar } from '../../components/items/ProgressBar';
|
|
||||||
import OrderPartsWizard from '../../components/wizards/OrderPartsWizard';
|
import OrderPartsWizard from '../../components/wizards/OrderPartsWizard';
|
||||||
import {
|
import {
|
||||||
useAllocateStockToBuildForm,
|
useAllocateStockToBuildForm,
|
||||||
@@ -31,7 +39,6 @@ import {
|
|||||||
import useStatusCodes from '../../hooks/UseStatusCodes';
|
import useStatusCodes from '../../hooks/UseStatusCodes';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import {
|
import {
|
||||||
BooleanColumn,
|
BooleanColumn,
|
||||||
DescriptionColumn,
|
DescriptionColumn,
|
||||||
@@ -39,13 +46,6 @@ import {
|
|||||||
PartColumn
|
PartColumn
|
||||||
} from '../ColumnRenderers';
|
} from '../ColumnRenderers';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import {
|
|
||||||
type RowAction,
|
|
||||||
RowActions,
|
|
||||||
RowDeleteAction,
|
|
||||||
RowEditAction,
|
|
||||||
RowViewAction
|
|
||||||
} from '../RowActions';
|
|
||||||
import RowExpansionIcon from '../RowExpansionIcon';
|
import RowExpansionIcon from '../RowExpansionIcon';
|
||||||
import { TableHoverCard } from '../TableHoverCard';
|
import { TableHoverCard } from '../TableHoverCard';
|
||||||
|
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
import { t } from '@lingui/core/macro';
|
import { t } from '@lingui/core/macro';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
|
|
||||||
|
import { ProgressBar } from '@lib/components/ProgressBar';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
||||||
import { ProgressBar } from '../../components/items/ProgressBar';
|
|
||||||
import { RenderUser } from '../../components/render/User';
|
import { RenderUser } from '../../components/render/User';
|
||||||
import { useBuildOrderFields } from '../../forms/BuildForms';
|
import { useBuildOrderFields } from '../../forms/BuildForms';
|
||||||
import { useCreateApiFormModal } from '../../hooks/UseForm';
|
import { useCreateApiFormModal } from '../../hooks/UseForm';
|
||||||
|
@@ -4,20 +4,20 @@ import { IconCirclePlus } from '@tabler/icons-react';
|
|||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import { type ReactNode, useEffect, useMemo, useState } from 'react';
|
import { type ReactNode, useEffect, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import { PassFailButton } from '@lib/components/YesNoButton';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import { cancelEvent } from '@lib/functions/Events';
|
import { cancelEvent } from '@lib/functions/Events';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
||||||
import { PassFailButton } from '../../components/buttons/YesNoButton';
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { RenderUser } from '../../components/render/User';
|
import { RenderUser } from '../../components/render/User';
|
||||||
import { useApi } from '../../contexts/ApiContext';
|
import { useApi } from '../../contexts/ApiContext';
|
||||||
import { formatDate } from '../../defaults/formatters';
|
import { formatDate } from '../../defaults/formatters';
|
||||||
import { useTestResultFields } from '../../forms/StockForms';
|
import { useTestResultFields } from '../../forms/StockForms';
|
||||||
import { useCreateApiFormModal } from '../../hooks/UseForm';
|
import { useCreateApiFormModal } from '../../hooks/UseForm';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import { LocationColumn } from '../ColumnRenderers';
|
import { LocationColumn } from '../ColumnRenderers';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import { TableHoverCard } from '../TableHoverCard';
|
import { TableHoverCard } from '../TableHoverCard';
|
||||||
|
@@ -20,14 +20,20 @@ import { useQuery } from '@tanstack/react-query';
|
|||||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
import { ActionButton } from '@lib/components/ActionButton';
|
||||||
|
import { ProgressBar } from '@lib/components/ProgressBar';
|
||||||
|
import {
|
||||||
|
type RowAction,
|
||||||
|
RowEditAction,
|
||||||
|
RowViewAction
|
||||||
|
} from '@lib/components/RowActions';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
import { ActionButton } from '../../components/buttons/ActionButton';
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
||||||
import { ProgressBar } from '../../components/items/ProgressBar';
|
|
||||||
import { StylishText } from '../../components/items/StylishText';
|
import { StylishText } from '../../components/items/StylishText';
|
||||||
import { useApi } from '../../contexts/ApiContext';
|
import { useApi } from '../../contexts/ApiContext';
|
||||||
import {
|
import {
|
||||||
@@ -50,7 +56,6 @@ import useStatusCodes from '../../hooks/UseStatusCodes';
|
|||||||
import { useStockAdjustActions } from '../../hooks/UseStockAdjustActions';
|
import { useStockAdjustActions } from '../../hooks/UseStockAdjustActions';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import { LocationColumn, PartColumn, StatusColumn } from '../ColumnRenderers';
|
import { LocationColumn, PartColumn, StatusColumn } from '../ColumnRenderers';
|
||||||
import {
|
import {
|
||||||
BatchFilter,
|
BatchFilter,
|
||||||
@@ -63,7 +68,6 @@ import {
|
|||||||
StockLocationFilter
|
StockLocationFilter
|
||||||
} from '../Filter';
|
} from '../Filter';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import { type RowAction, RowEditAction, RowViewAction } from '../RowActions';
|
|
||||||
import { TableHoverCard } from '../TableHoverCard';
|
import { TableHoverCard } from '../TableHoverCard';
|
||||||
import BuildLineTable from './BuildLineTable';
|
import BuildLineTable from './BuildLineTable';
|
||||||
|
|
||||||
|
@@ -1,12 +1,18 @@
|
|||||||
import { t } from '@lingui/core/macro';
|
import { t } from '@lingui/core/macro';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import {
|
||||||
|
type RowAction,
|
||||||
|
RowDeleteAction,
|
||||||
|
RowEditAction
|
||||||
|
} from '@lib/components/RowActions';
|
||||||
|
import { YesNoButton } from '@lib/components/YesNoButton';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
||||||
import { YesNoButton } from '../../components/buttons/YesNoButton';
|
|
||||||
import {
|
import {
|
||||||
useCreateApiFormModal,
|
useCreateApiFormModal,
|
||||||
useDeleteApiFormModal,
|
useDeleteApiFormModal,
|
||||||
@@ -14,10 +20,8 @@ import {
|
|||||||
} from '../../hooks/UseForm';
|
} from '../../hooks/UseForm';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import { LinkColumn } from '../ColumnRenderers';
|
import { LinkColumn } from '../ColumnRenderers';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions';
|
|
||||||
|
|
||||||
export function AddressTable({
|
export function AddressTable({
|
||||||
companyId,
|
companyId,
|
||||||
|
@@ -2,6 +2,7 @@ import { t } from '@lingui/core/macro';
|
|||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
import { type RowAction, RowEditAction } from '@lib/components/RowActions';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
@@ -22,7 +23,6 @@ import {
|
|||||||
DescriptionColumn
|
DescriptionColumn
|
||||||
} from '../ColumnRenderers';
|
} from '../ColumnRenderers';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import { type RowAction, RowEditAction } from '../RowActions';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A table which displays a list of company records,
|
* A table which displays a list of company records,
|
||||||
|
@@ -1,12 +1,18 @@
|
|||||||
import { t } from '@lingui/core/macro';
|
import { t } from '@lingui/core/macro';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import {
|
||||||
|
type RowAction,
|
||||||
|
RowDeleteAction,
|
||||||
|
RowEditAction
|
||||||
|
} from '@lib/components/RowActions';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import { getDetailUrl } from '@lib/functions/Navigation';
|
import { getDetailUrl } from '@lib/functions/Navigation';
|
||||||
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
||||||
import { RenderInlineModel } from '../../components/render/Instance';
|
import { RenderInlineModel } from '../../components/render/Instance';
|
||||||
@@ -17,9 +23,7 @@ import {
|
|||||||
} from '../../hooks/UseForm';
|
} from '../../hooks/UseForm';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions';
|
|
||||||
|
|
||||||
export function ContactTable({
|
export function ContactTable({
|
||||||
companyId,
|
companyId,
|
||||||
|
@@ -12,14 +12,20 @@ import {
|
|||||||
} from '@tabler/icons-react';
|
} from '@tabler/icons-react';
|
||||||
import { type ReactNode, useCallback, useMemo, useState } from 'react';
|
import { type ReactNode, useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import { ActionButton } from '@lib/components/ActionButton';
|
||||||
|
import { ProgressBar } from '@lib/components/ProgressBar';
|
||||||
|
import {
|
||||||
|
type RowAction,
|
||||||
|
RowDeleteAction,
|
||||||
|
RowEditAction
|
||||||
|
} from '@lib/components/RowActions';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import type { ModelType } from '@lib/enums/ModelType';
|
import type { ModelType } from '@lib/enums/ModelType';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
||||||
import { ActionButton } from '../../components/buttons/ActionButton';
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { AttachmentLink } from '../../components/items/AttachmentLink';
|
import { AttachmentLink } from '../../components/items/AttachmentLink';
|
||||||
import { ProgressBar } from '../../components/items/ProgressBar';
|
|
||||||
import { useApi } from '../../contexts/ApiContext';
|
import { useApi } from '../../contexts/ApiContext';
|
||||||
import { formatFileSize } from '../../defaults/formatters';
|
import { formatFileSize } from '../../defaults/formatters';
|
||||||
import {
|
import {
|
||||||
@@ -29,9 +35,7 @@ import {
|
|||||||
} from '../../hooks/UseForm';
|
} from '../../hooks/UseForm';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define set of columns to display for the attachment table
|
* Define set of columns to display for the attachment table
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
|
import { ActionButton } from '@lib/components/ActionButton';
|
||||||
|
import { type RowAction, RowViewAction } from '@lib/components/RowActions';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { t } from '@lingui/core/macro';
|
import { t } from '@lingui/core/macro';
|
||||||
import { IconTrash } from '@tabler/icons-react';
|
import { IconTrash } from '@tabler/icons-react';
|
||||||
import { useCallback, useEffect, useMemo } from 'react';
|
import { useCallback, useEffect, useMemo } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import type { BarcodeScanItem } from '../../components/barcodes/BarcodeScanItem';
|
import type { BarcodeScanItem } from '../../components/barcodes/BarcodeScanItem';
|
||||||
import { ActionButton } from '../../components/buttons/ActionButton';
|
|
||||||
import { RenderInstance } from '../../components/render/Instance';
|
import { RenderInstance } from '../../components/render/Instance';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import { type RowAction, RowViewAction } from '../RowActions';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A table for showing barcode scan history data on the scan index page
|
* A table for showing barcode scan history data on the scan index page
|
||||||
|
@@ -1,9 +1,16 @@
|
|||||||
import { t } from '@lingui/core/macro';
|
import { t } from '@lingui/core/macro';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import {
|
||||||
|
type RowAction,
|
||||||
|
RowDeleteAction,
|
||||||
|
RowDuplicateAction,
|
||||||
|
RowEditAction
|
||||||
|
} from '@lib/components/RowActions';
|
||||||
import type { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import type { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import type { UserRoles } from '@lib/enums/Roles';
|
import type { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
||||||
import { formatCurrency } from '../../defaults/formatters';
|
import { formatCurrency } from '../../defaults/formatters';
|
||||||
import { extraLineItemFields } from '../../forms/CommonForms';
|
import { extraLineItemFields } from '../../forms/CommonForms';
|
||||||
@@ -14,15 +21,8 @@ import {
|
|||||||
} from '../../hooks/UseForm';
|
} from '../../hooks/UseForm';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import { DescriptionColumn, LinkColumn, NoteColumn } from '../ColumnRenderers';
|
import { DescriptionColumn, LinkColumn, NoteColumn } from '../ColumnRenderers';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import {
|
|
||||||
type RowAction,
|
|
||||||
RowDeleteAction,
|
|
||||||
RowDuplicateAction,
|
|
||||||
RowEditAction
|
|
||||||
} from '../RowActions';
|
|
||||||
|
|
||||||
export default function ExtraLineItemTable({
|
export default function ExtraLineItemTable({
|
||||||
endpoint,
|
endpoint,
|
||||||
|
@@ -19,11 +19,13 @@ import { useQuery } from '@tanstack/react-query';
|
|||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
import { YesNoButton } from '@lib/components/YesNoButton';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
|
import type { InvenTreeTableProps } from '@lib/types/Tables';
|
||||||
import { Trans } from '@lingui/react/macro';
|
import { Trans } from '@lingui/react/macro';
|
||||||
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
||||||
import { YesNoButton } from '../../components/buttons/YesNoButton';
|
|
||||||
import {
|
import {
|
||||||
DeleteItemAction,
|
DeleteItemAction,
|
||||||
EditItemAction,
|
EditItemAction,
|
||||||
@@ -48,9 +50,8 @@ import {
|
|||||||
useEditApiFormModal
|
useEditApiFormModal
|
||||||
} from '../../hooks/UseForm';
|
} from '../../hooks/UseForm';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import { BooleanColumn } from '../ColumnRenderers';
|
import { BooleanColumn } from '../ColumnRenderers';
|
||||||
import { InvenTreeTable, type InvenTreeTableProps } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import type { MachineDriverI, MachineTypeI } from './MachineTypeTable';
|
import type { MachineDriverI, MachineTypeI } from './MachineTypeTable';
|
||||||
|
|
||||||
interface MachineI {
|
interface MachineI {
|
||||||
|
@@ -20,13 +20,14 @@ import { useNavigate } from 'react-router-dom';
|
|||||||
|
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
|
import type { InvenTreeTableProps } from '@lib/types/Tables';
|
||||||
import { InfoItem } from '../../components/items/InfoItem';
|
import { InfoItem } from '../../components/items/InfoItem';
|
||||||
import { StylishText } from '../../components/items/StylishText';
|
import { StylishText } from '../../components/items/StylishText';
|
||||||
import { DetailDrawer } from '../../components/nav/DetailDrawer';
|
import { DetailDrawer } from '../../components/nav/DetailDrawer';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import { BooleanColumn, DescriptionColumn } from '../ColumnRenderers';
|
import { BooleanColumn, DescriptionColumn } from '../ColumnRenderers';
|
||||||
import { InvenTreeTable, type InvenTreeTableProps } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import { MachineListTable, useMachineTypeDriver } from './MachineListTable';
|
import { MachineListTable, useMachineTypeDriver } from './MachineListTable';
|
||||||
|
|
||||||
export interface MachineTypeI {
|
export interface MachineTypeI {
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
import { t } from '@lingui/core/macro';
|
import { t } from '@lingui/core/macro';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
|
|
||||||
|
import type { RowAction } from '@lib/components/RowActions';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { TableState } from '@lib/types/Tables';
|
import type { TableState } from '@lib/types/Tables';
|
||||||
import type { TableColumn } from '../Column';
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import type { RowAction } from '../RowActions';
|
|
||||||
|
|
||||||
export function NotificationTable({
|
export function NotificationTable({
|
||||||
params,
|
params,
|
||||||
|
@@ -5,6 +5,7 @@ import { useQuery } from '@tanstack/react-query';
|
|||||||
import { type ReactNode, useCallback, useMemo, useState } from 'react';
|
import { type ReactNode, useCallback, useMemo, useState } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
import { YesNoButton } from '@lib/components/YesNoButton';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
@@ -14,7 +15,7 @@ import { getDetailUrl } from '@lib/functions/Navigation';
|
|||||||
import { navigateToLink } from '@lib/functions/Navigation';
|
import { navigateToLink } from '@lib/functions/Navigation';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
||||||
import { YesNoButton } from '../../components/buttons/YesNoButton';
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { useApi } from '../../contexts/ApiContext';
|
import { useApi } from '../../contexts/ApiContext';
|
||||||
import { formatDecimal } from '../../defaults/formatters';
|
import { formatDecimal } from '../../defaults/formatters';
|
||||||
import { usePartParameterFields } from '../../forms/PartForms';
|
import { usePartParameterFields } from '../../forms/PartForms';
|
||||||
@@ -24,7 +25,6 @@ import {
|
|||||||
} from '../../hooks/UseForm';
|
} from '../../hooks/UseForm';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import { DescriptionColumn, PartColumn } from '../ColumnRenderers';
|
import { DescriptionColumn, PartColumn } from '../ColumnRenderers';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import { TableHoverCard } from '../TableHoverCard';
|
import { TableHoverCard } from '../TableHoverCard';
|
||||||
|
@@ -4,14 +4,15 @@ import type { DataTableRowExpansionProps } from 'mantine-datatable';
|
|||||||
import { useCallback, useMemo } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
import { ProgressBar } from '@lib/components/ProgressBar';
|
||||||
|
import { RowViewAction } from '@lib/components/RowActions';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import { ProgressBar } from '../../components/items/ProgressBar';
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import {
|
import {
|
||||||
DescriptionColumn,
|
DescriptionColumn,
|
||||||
PartColumn,
|
PartColumn,
|
||||||
@@ -19,7 +20,6 @@ import {
|
|||||||
StatusColumn
|
StatusColumn
|
||||||
} from '../ColumnRenderers';
|
} from '../ColumnRenderers';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import { RowViewAction } from '../RowActions';
|
|
||||||
import RowExpansionIcon from '../RowExpansionIcon';
|
import RowExpansionIcon from '../RowExpansionIcon';
|
||||||
import { BuildLineSubTable } from '../build/BuildLineTable';
|
import { BuildLineSubTable } from '../build/BuildLineTable';
|
||||||
|
|
||||||
|
@@ -3,13 +3,15 @@ import { Group, Tooltip } from '@mantine/core';
|
|||||||
import { IconBell } from '@tabler/icons-react';
|
import { IconBell } from '@tabler/icons-react';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import { type RowAction, RowEditAction } from '@lib/components/RowActions';
|
||||||
|
import { YesNoButton } from '@lib/components/YesNoButton';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
||||||
import { YesNoButton } from '../../components/buttons/YesNoButton';
|
|
||||||
import { ActionDropdown } from '../../components/items/ActionDropdown';
|
import { ActionDropdown } from '../../components/items/ActionDropdown';
|
||||||
import { ApiIcon } from '../../components/items/ApiIcon';
|
import { ApiIcon } from '../../components/items/ApiIcon';
|
||||||
import { partCategoryFields } from '../../forms/PartForms';
|
import { partCategoryFields } from '../../forms/PartForms';
|
||||||
@@ -21,10 +23,8 @@ import {
|
|||||||
} from '../../hooks/UseForm';
|
} from '../../hooks/UseForm';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import { DescriptionColumn } from '../ColumnRenderers';
|
import { DescriptionColumn } from '../ColumnRenderers';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import { type RowAction, RowEditAction } from '../RowActions';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PartCategoryTable - Displays a table of part categories
|
* PartCategoryTable - Displays a table of part categories
|
||||||
|
@@ -2,11 +2,17 @@ import { t } from '@lingui/core/macro';
|
|||||||
import { Group, Text } from '@mantine/core';
|
import { Group, Text } from '@mantine/core';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import {
|
||||||
|
type RowAction,
|
||||||
|
RowDeleteAction,
|
||||||
|
RowEditAction
|
||||||
|
} from '@lib/components/RowActions';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
||||||
import {
|
import {
|
||||||
useCreateApiFormModal,
|
useCreateApiFormModal,
|
||||||
@@ -15,9 +21,7 @@ import {
|
|||||||
} from '../../hooks/UseForm';
|
} from '../../hooks/UseForm';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions';
|
|
||||||
|
|
||||||
export default function PartCategoryTemplateTable() {
|
export default function PartCategoryTemplateTable() {
|
||||||
const table = useTable('part-category-parameter-templates');
|
const table = useTable('part-category-parameter-templates');
|
||||||
|
@@ -3,12 +3,18 @@ import { Alert, Stack, Text } from '@mantine/core';
|
|||||||
import { IconLock } from '@tabler/icons-react';
|
import { IconLock } from '@tabler/icons-react';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import {
|
||||||
|
type RowAction,
|
||||||
|
RowDeleteAction,
|
||||||
|
RowEditAction
|
||||||
|
} from '@lib/components/RowActions';
|
||||||
|
import { YesNoButton } from '@lib/components/YesNoButton';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
||||||
import { YesNoButton } from '../../components/buttons/YesNoButton';
|
|
||||||
import { formatDecimal } from '../../defaults/formatters';
|
import { formatDecimal } from '../../defaults/formatters';
|
||||||
import { usePartParameterFields } from '../../forms/PartForms';
|
import { usePartParameterFields } from '../../forms/PartForms';
|
||||||
import {
|
import {
|
||||||
@@ -18,10 +24,8 @@ import {
|
|||||||
} from '../../hooks/UseForm';
|
} from '../../hooks/UseForm';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import { DescriptionColumn, PartColumn } from '../ColumnRenderers';
|
import { DescriptionColumn, PartColumn } from '../ColumnRenderers';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions';
|
|
||||||
import { TableHoverCard } from '../TableHoverCard';
|
import { TableHoverCard } from '../TableHoverCard';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,11 +1,17 @@
|
|||||||
import { t } from '@lingui/core/macro';
|
import { t } from '@lingui/core/macro';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import {
|
||||||
|
type RowAction,
|
||||||
|
RowDeleteAction,
|
||||||
|
RowEditAction
|
||||||
|
} from '@lib/components/RowActions';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
||||||
import {
|
import {
|
||||||
useCreateApiFormModal,
|
useCreateApiFormModal,
|
||||||
@@ -14,10 +20,8 @@ import {
|
|||||||
} from '../../hooks/UseForm';
|
} from '../../hooks/UseForm';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import { BooleanColumn, DescriptionColumn } from '../ColumnRenderers';
|
import { BooleanColumn, DescriptionColumn } from '../ColumnRenderers';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions';
|
|
||||||
|
|
||||||
export default function PartParameterTemplateTable() {
|
export default function PartParameterTemplateTable() {
|
||||||
const table = useTable('part-parameter-templates');
|
const table = useTable('part-parameter-templates');
|
||||||
|
@@ -2,14 +2,14 @@ import { t } from '@lingui/core/macro';
|
|||||||
import { Text } from '@mantine/core';
|
import { Text } from '@mantine/core';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
|
|
||||||
|
import { ProgressBar } from '@lib/components/ProgressBar';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
import { ProgressBar } from '../../components/items/ProgressBar';
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { formatCurrency } from '../../defaults/formatters';
|
import { formatCurrency } from '../../defaults/formatters';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import { DateColumn, ReferenceColumn, StatusColumn } from '../ColumnRenderers';
|
import { DateColumn, ReferenceColumn, StatusColumn } from '../ColumnRenderers';
|
||||||
import { StatusFilterOptions } from '../Filter';
|
import { StatusFilterOptions } from '../Filter';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
|
@@ -4,21 +4,21 @@ import type { DataTableRowExpansionProps } from 'mantine-datatable';
|
|||||||
import { useCallback, useMemo } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
import { ProgressBar } from '@lib/components/ProgressBar';
|
||||||
|
import { RowViewAction } from '@lib/components/RowActions';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import { ProgressBar } from '../../components/items/ProgressBar';
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import {
|
import {
|
||||||
DescriptionColumn,
|
DescriptionColumn,
|
||||||
ProjectCodeColumn,
|
ProjectCodeColumn,
|
||||||
StatusColumn
|
StatusColumn
|
||||||
} from '../ColumnRenderers';
|
} from '../ColumnRenderers';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import { RowViewAction } from '../RowActions';
|
|
||||||
import RowExpansionIcon from '../RowExpansionIcon';
|
import RowExpansionIcon from '../RowExpansionIcon';
|
||||||
import SalesOrderAllocationTable from '../sales/SalesOrderAllocationTable';
|
import SalesOrderAllocationTable from '../sales/SalesOrderAllocationTable';
|
||||||
|
|
||||||
|
@@ -3,11 +3,14 @@ import { Group, Text } from '@mantine/core';
|
|||||||
import { IconShoppingCart } from '@tabler/icons-react';
|
import { IconShoppingCart } from '@tabler/icons-react';
|
||||||
import { type ReactNode, useCallback, useMemo, useState } from 'react';
|
import { type ReactNode, useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import { type RowAction, RowEditAction } from '@lib/components/RowActions';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
|
import type { InvenTreeTableProps } from '@lib/types/Tables';
|
||||||
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
||||||
import { ActionDropdown } from '../../components/items/ActionDropdown';
|
import { ActionDropdown } from '../../components/items/ActionDropdown';
|
||||||
import OrderPartsWizard from '../../components/wizards/OrderPartsWizard';
|
import OrderPartsWizard from '../../components/wizards/OrderPartsWizard';
|
||||||
@@ -21,7 +24,6 @@ import {
|
|||||||
} from '../../hooks/UseForm';
|
} from '../../hooks/UseForm';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import {
|
import {
|
||||||
CategoryColumn,
|
CategoryColumn,
|
||||||
DefaultLocationColumn,
|
DefaultLocationColumn,
|
||||||
@@ -29,8 +31,7 @@ import {
|
|||||||
LinkColumn,
|
LinkColumn,
|
||||||
PartColumn
|
PartColumn
|
||||||
} from '../ColumnRenderers';
|
} from '../ColumnRenderers';
|
||||||
import { InvenTreeTable, type InvenTreeTableProps } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import { type RowAction, RowEditAction } from '../RowActions';
|
|
||||||
import { TableHoverCard } from '../TableHoverCard';
|
import { TableHoverCard } from '../TableHoverCard';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -5,6 +5,12 @@ import { IconLock } from '@tabler/icons-react';
|
|||||||
import { type ReactNode, useCallback, useMemo, useState } from 'react';
|
import { type ReactNode, useCallback, useMemo, useState } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
import {
|
||||||
|
type RowAction,
|
||||||
|
RowDeleteAction,
|
||||||
|
RowEditAction,
|
||||||
|
RowViewAction
|
||||||
|
} from '@lib/components/RowActions';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
@@ -12,6 +18,7 @@ import { apiUrl } from '@lib/functions/Api';
|
|||||||
import { getDetailUrl } from '@lib/functions/Navigation';
|
import { getDetailUrl } from '@lib/functions/Navigation';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
||||||
import {
|
import {
|
||||||
useCreateApiFormModal,
|
useCreateApiFormModal,
|
||||||
@@ -20,15 +27,8 @@ import {
|
|||||||
} from '../../hooks/UseForm';
|
} from '../../hooks/UseForm';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import { BooleanColumn, DescriptionColumn } from '../ColumnRenderers';
|
import { BooleanColumn, DescriptionColumn } from '../ColumnRenderers';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import {
|
|
||||||
type RowAction,
|
|
||||||
RowDeleteAction,
|
|
||||||
RowEditAction,
|
|
||||||
RowViewAction
|
|
||||||
} from '../RowActions';
|
|
||||||
import { TableHoverCard } from '../TableHoverCard';
|
import { TableHoverCard } from '../TableHoverCard';
|
||||||
|
|
||||||
export default function PartTestTemplateTable({
|
export default function PartTestTemplateTable({
|
||||||
|
@@ -3,10 +3,16 @@ import { Group, Text } from '@mantine/core';
|
|||||||
import { type ReactNode, useCallback, useMemo, useState } from 'react';
|
import { type ReactNode, useCallback, useMemo, useState } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
import {
|
||||||
|
type RowAction,
|
||||||
|
RowDeleteAction,
|
||||||
|
RowEditAction
|
||||||
|
} from '@lib/components/RowActions';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
||||||
import { Thumbnail } from '../../components/images/Thumbnail';
|
import { Thumbnail } from '../../components/images/Thumbnail';
|
||||||
import {
|
import {
|
||||||
@@ -16,10 +22,8 @@ import {
|
|||||||
} from '../../hooks/UseForm';
|
} from '../../hooks/UseForm';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import { NoteColumn } from '../ColumnRenderers';
|
import { NoteColumn } from '../ColumnRenderers';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a table listing related parts for a given part
|
* Construct a table listing related parts for a given part
|
||||||
|
@@ -1,9 +1,15 @@
|
|||||||
import { t } from '@lingui/core/macro';
|
import { t } from '@lingui/core/macro';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import {
|
||||||
|
type RowAction,
|
||||||
|
RowDeleteAction,
|
||||||
|
RowEditAction
|
||||||
|
} from '@lib/components/RowActions';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
||||||
import { selectionListFields } from '../../forms/selectionListFields';
|
import { selectionListFields } from '../../forms/selectionListFields';
|
||||||
import {
|
import {
|
||||||
@@ -13,10 +19,8 @@ import {
|
|||||||
} from '../../hooks/UseForm';
|
} from '../../hooks/UseForm';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import { BooleanColumn, DescriptionColumn } from '../ColumnRenderers';
|
import { BooleanColumn, DescriptionColumn } from '../ColumnRenderers';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table for displaying list of selectionlist items
|
* Table for displaying list of selectionlist items
|
||||||
|
@@ -4,8 +4,8 @@ import { useMemo } from 'react';
|
|||||||
|
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
|
|
||||||
export interface PluginRegistryErrorI {
|
export interface PluginRegistryErrorI {
|
||||||
|
@@ -13,9 +13,11 @@ import {
|
|||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
import { ActionButton } from '@lib/components/ActionButton';
|
||||||
|
import type { RowAction } from '@lib/components/RowActions';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import { ActionButton } from '../../components/buttons/ActionButton';
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { DetailDrawer } from '../../components/nav/DetailDrawer';
|
import { DetailDrawer } from '../../components/nav/DetailDrawer';
|
||||||
import PluginDrawer from '../../components/plugins/PluginDrawer';
|
import PluginDrawer from '../../components/plugins/PluginDrawer';
|
||||||
import type { PluginInterface } from '../../components/plugins/PluginInterface';
|
import type { PluginInterface } from '../../components/plugins/PluginInterface';
|
||||||
@@ -28,10 +30,8 @@ import {
|
|||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useServerApiState } from '../../states/ServerApiState';
|
import { useServerApiState } from '../../states/ServerApiState';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import { BooleanColumn } from '../ColumnRenderers';
|
import { BooleanColumn } from '../ColumnRenderers';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import type { RowAction } from '../RowActions';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct an indicator icon for a single plugin
|
* Construct an indicator icon for a single plugin
|
||||||
|
@@ -1,9 +1,15 @@
|
|||||||
import { t } from '@lingui/core/macro';
|
import { t } from '@lingui/core/macro';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import {
|
||||||
|
type RowAction,
|
||||||
|
RowDeleteAction,
|
||||||
|
RowEditAction
|
||||||
|
} from '@lib/components/RowActions';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
||||||
import { useManufacturerPartParameterFields } from '../../forms/CompanyForms';
|
import { useManufacturerPartParameterFields } from '../../forms/CompanyForms';
|
||||||
import {
|
import {
|
||||||
@@ -13,9 +19,7 @@ import {
|
|||||||
} from '../../hooks/UseForm';
|
} from '../../hooks/UseForm';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions';
|
|
||||||
|
|
||||||
export default function ManufacturerPartParameterTable({
|
export default function ManufacturerPartParameterTable({
|
||||||
params
|
params
|
||||||
|
@@ -1,10 +1,16 @@
|
|||||||
import { t } from '@lingui/core/macro';
|
import { t } from '@lingui/core/macro';
|
||||||
import { type ReactNode, useCallback, useMemo, useState } from 'react';
|
import { type ReactNode, useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import {
|
||||||
|
type RowAction,
|
||||||
|
RowDeleteAction,
|
||||||
|
RowEditAction
|
||||||
|
} from '@lib/components/RowActions';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
||||||
import { useManufacturerPartFields } from '../../forms/CompanyForms';
|
import { useManufacturerPartFields } from '../../forms/CompanyForms';
|
||||||
import {
|
import {
|
||||||
@@ -14,7 +20,6 @@ import {
|
|||||||
} from '../../hooks/UseForm';
|
} from '../../hooks/UseForm';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import {
|
import {
|
||||||
CompanyColumn,
|
CompanyColumn,
|
||||||
DescriptionColumn,
|
DescriptionColumn,
|
||||||
@@ -22,7 +27,6 @@ import {
|
|||||||
PartColumn
|
PartColumn
|
||||||
} from '../ColumnRenderers';
|
} from '../ColumnRenderers';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions';
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Construct a table listing manufacturer parts
|
* Construct a table listing manufacturer parts
|
||||||
|
@@ -3,16 +3,24 @@ import { Text } from '@mantine/core';
|
|||||||
import { IconFileArrowLeft, IconSquareArrowRight } from '@tabler/icons-react';
|
import { IconFileArrowLeft, IconSquareArrowRight } from '@tabler/icons-react';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import { ActionButton } from '@lib/components/ActionButton';
|
||||||
|
import { ProgressBar } from '@lib/components/ProgressBar';
|
||||||
|
import {
|
||||||
|
type RowAction,
|
||||||
|
RowDeleteAction,
|
||||||
|
RowDuplicateAction,
|
||||||
|
RowEditAction,
|
||||||
|
RowViewAction
|
||||||
|
} from '@lib/components/RowActions';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { ActionButton } from '../../components/buttons/ActionButton';
|
|
||||||
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
||||||
import ImporterDrawer from '../../components/importer/ImporterDrawer';
|
import ImporterDrawer from '../../components/importer/ImporterDrawer';
|
||||||
import { ProgressBar } from '../../components/items/ProgressBar';
|
|
||||||
import { RenderInstance } from '../../components/render/Instance';
|
import { RenderInstance } from '../../components/render/Instance';
|
||||||
import { RenderStockLocation } from '../../components/render/Stock';
|
import { RenderStockLocation } from '../../components/render/Stock';
|
||||||
import { dataImporterSessionFields } from '../../forms/ImporterForms';
|
import { dataImporterSessionFields } from '../../forms/ImporterForms';
|
||||||
@@ -28,7 +36,6 @@ import {
|
|||||||
import useStatusCodes from '../../hooks/UseStatusCodes';
|
import useStatusCodes from '../../hooks/UseStatusCodes';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import {
|
import {
|
||||||
CurrencyColumn,
|
CurrencyColumn,
|
||||||
DescriptionColumn,
|
DescriptionColumn,
|
||||||
@@ -39,13 +46,6 @@ import {
|
|||||||
TargetDateColumn
|
TargetDateColumn
|
||||||
} from '../ColumnRenderers';
|
} from '../ColumnRenderers';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import {
|
|
||||||
type RowAction,
|
|
||||||
RowDeleteAction,
|
|
||||||
RowDuplicateAction,
|
|
||||||
RowEditAction,
|
|
||||||
RowViewAction
|
|
||||||
} from '../RowActions';
|
|
||||||
import { TableHoverCard } from '../TableHoverCard';
|
import { TableHoverCard } from '../TableHoverCard';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -2,11 +2,17 @@ import { t } from '@lingui/core/macro';
|
|||||||
import { Text } from '@mantine/core';
|
import { Text } from '@mantine/core';
|
||||||
import { type ReactNode, useCallback, useMemo, useState } from 'react';
|
import { type ReactNode, useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import {
|
||||||
|
type RowAction,
|
||||||
|
RowDeleteAction,
|
||||||
|
RowEditAction
|
||||||
|
} from '@lib/components/RowActions';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
||||||
import { useSupplierPartFields } from '../../forms/CompanyForms';
|
import { useSupplierPartFields } from '../../forms/CompanyForms';
|
||||||
import {
|
import {
|
||||||
@@ -16,7 +22,6 @@ import {
|
|||||||
} from '../../hooks/UseForm';
|
} from '../../hooks/UseForm';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import {
|
import {
|
||||||
BooleanColumn,
|
BooleanColumn,
|
||||||
CompanyColumn,
|
CompanyColumn,
|
||||||
@@ -26,7 +31,6 @@ import {
|
|||||||
PartColumn
|
PartColumn
|
||||||
} from '../ColumnRenderers';
|
} from '../ColumnRenderers';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions';
|
|
||||||
import { TableHoverCard } from '../TableHoverCard';
|
import { TableHoverCard } from '../TableHoverCard';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -2,12 +2,18 @@ import { t } from '@lingui/core/macro';
|
|||||||
import { Anchor, Group, Text } from '@mantine/core';
|
import { Anchor, Group, Text } from '@mantine/core';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import {
|
||||||
|
type RowAction,
|
||||||
|
RowDeleteAction,
|
||||||
|
RowEditAction
|
||||||
|
} from '@lib/components/RowActions';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import { getDetailUrl } from '@lib/functions/Navigation';
|
import { getDetailUrl } from '@lib/functions/Navigation';
|
||||||
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
import type { ApiFormFieldSet } from '@lib/types/Forms';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
||||||
import { formatCurrency } from '../../defaults/formatters';
|
import { formatCurrency } from '../../defaults/formatters';
|
||||||
import {
|
import {
|
||||||
@@ -17,10 +23,8 @@ import {
|
|||||||
} from '../../hooks/UseForm';
|
} from '../../hooks/UseForm';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import { CompanyColumn } from '../ColumnRenderers';
|
import { CompanyColumn } from '../ColumnRenderers';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions';
|
|
||||||
|
|
||||||
export function calculateSupplierPartUnitPrice(record: any) {
|
export function calculateSupplierPartUnitPrice(record: any) {
|
||||||
const pack_quantity = record?.part_detail?.pack_quantity_native ?? 1;
|
const pack_quantity = record?.part_detail?.pack_quantity_native ?? 1;
|
||||||
|
@@ -2,12 +2,18 @@ import { t } from '@lingui/core/macro';
|
|||||||
import { IconSquareArrowRight } from '@tabler/icons-react';
|
import { IconSquareArrowRight } from '@tabler/icons-react';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import { ActionButton } from '@lib/components/ActionButton';
|
||||||
|
import {
|
||||||
|
type RowAction,
|
||||||
|
RowDeleteAction,
|
||||||
|
RowEditAction
|
||||||
|
} from '@lib/components/RowActions';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
import { ActionButton } from '../../components/buttons/ActionButton';
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
||||||
import { formatCurrency } from '../../defaults/formatters';
|
import { formatCurrency } from '../../defaults/formatters';
|
||||||
import {
|
import {
|
||||||
@@ -22,7 +28,6 @@ import {
|
|||||||
import useStatusCodes from '../../hooks/UseStatusCodes';
|
import useStatusCodes from '../../hooks/UseStatusCodes';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import {
|
import {
|
||||||
DateColumn,
|
DateColumn,
|
||||||
DescriptionColumn,
|
DescriptionColumn,
|
||||||
@@ -34,7 +39,6 @@ import {
|
|||||||
} from '../ColumnRenderers';
|
} from '../ColumnRenderers';
|
||||||
import { StatusFilterOptions } from '../Filter';
|
import { StatusFilterOptions } from '../Filter';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions';
|
|
||||||
|
|
||||||
export default function ReturnOrderLineItemTable({
|
export default function ReturnOrderLineItemTable({
|
||||||
orderId,
|
orderId,
|
||||||
|
@@ -1,13 +1,19 @@
|
|||||||
import { t } from '@lingui/core/macro';
|
import { t } from '@lingui/core/macro';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import { ActionButton } from '@lib/components/ActionButton';
|
||||||
|
import {
|
||||||
|
type RowAction,
|
||||||
|
RowDeleteAction,
|
||||||
|
RowEditAction
|
||||||
|
} from '@lib/components/RowActions';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { IconTruckDelivery } from '@tabler/icons-react';
|
import { IconTruckDelivery } from '@tabler/icons-react';
|
||||||
import { ActionButton } from '../../components/buttons/ActionButton';
|
|
||||||
import { formatDate } from '../../defaults/formatters';
|
import { formatDate } from '../../defaults/formatters';
|
||||||
import { useSalesOrderAllocationFields } from '../../forms/SalesOrderForms';
|
import { useSalesOrderAllocationFields } from '../../forms/SalesOrderForms';
|
||||||
import type { StockOperationProps } from '../../forms/StockForms';
|
import type { StockOperationProps } from '../../forms/StockForms';
|
||||||
@@ -19,7 +25,6 @@ import {
|
|||||||
import { useStockAdjustActions } from '../../hooks/UseStockAdjustActions';
|
import { useStockAdjustActions } from '../../hooks/UseStockAdjustActions';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import {
|
import {
|
||||||
DescriptionColumn,
|
DescriptionColumn,
|
||||||
LocationColumn,
|
LocationColumn,
|
||||||
@@ -29,7 +34,6 @@ import {
|
|||||||
} from '../ColumnRenderers';
|
} from '../ColumnRenderers';
|
||||||
import { StockLocationFilter } from '../Filter';
|
import { StockLocationFilter } from '../Filter';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions';
|
|
||||||
|
|
||||||
export default function SalesOrderAllocationTable({
|
export default function SalesOrderAllocationTable({
|
||||||
partId,
|
partId,
|
||||||
|
@@ -11,14 +11,22 @@ import type { DataTableRowExpansionProps } from 'mantine-datatable';
|
|||||||
import { type ReactNode, useCallback, useMemo, useState } from 'react';
|
import { type ReactNode, useCallback, useMemo, useState } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
import { ActionButton } from '@lib/components/ActionButton';
|
||||||
|
import { ProgressBar } from '@lib/components/ProgressBar';
|
||||||
|
import {
|
||||||
|
type RowAction,
|
||||||
|
RowDeleteAction,
|
||||||
|
RowDuplicateAction,
|
||||||
|
RowEditAction,
|
||||||
|
RowViewAction
|
||||||
|
} from '@lib/components/RowActions';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
import { ActionButton } from '../../components/buttons/ActionButton';
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
||||||
import { ProgressBar } from '../../components/items/ProgressBar';
|
|
||||||
import { RenderPart } from '../../components/render/Part';
|
import { RenderPart } from '../../components/render/Part';
|
||||||
import OrderPartsWizard from '../../components/wizards/OrderPartsWizard';
|
import OrderPartsWizard from '../../components/wizards/OrderPartsWizard';
|
||||||
import { formatCurrency } from '../../defaults/formatters';
|
import { formatCurrency } from '../../defaults/formatters';
|
||||||
@@ -35,7 +43,6 @@ import {
|
|||||||
} from '../../hooks/UseForm';
|
} from '../../hooks/UseForm';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import {
|
import {
|
||||||
DateColumn,
|
DateColumn,
|
||||||
DescriptionColumn,
|
DescriptionColumn,
|
||||||
@@ -43,13 +50,6 @@ import {
|
|||||||
PartColumn
|
PartColumn
|
||||||
} from '../ColumnRenderers';
|
} from '../ColumnRenderers';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import {
|
|
||||||
type RowAction,
|
|
||||||
RowDeleteAction,
|
|
||||||
RowDuplicateAction,
|
|
||||||
RowEditAction,
|
|
||||||
RowViewAction
|
|
||||||
} from '../RowActions';
|
|
||||||
import RowExpansionIcon from '../RowExpansionIcon';
|
import RowExpansionIcon from '../RowExpansionIcon';
|
||||||
import { TableHoverCard } from '../TableHoverCard';
|
import { TableHoverCard } from '../TableHoverCard';
|
||||||
import SalesOrderAllocationTable from './SalesOrderAllocationTable';
|
import SalesOrderAllocationTable from './SalesOrderAllocationTable';
|
||||||
|
@@ -3,14 +3,21 @@ import { IconTruckDelivery } from '@tabler/icons-react';
|
|||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
import {
|
||||||
|
type RowAction,
|
||||||
|
RowCancelAction,
|
||||||
|
RowEditAction,
|
||||||
|
RowViewAction
|
||||||
|
} from '@lib/components/RowActions';
|
||||||
|
import { YesNoButton } from '@lib/components/YesNoButton';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
||||||
import { YesNoButton } from '../../components/buttons/YesNoButton';
|
|
||||||
import {
|
import {
|
||||||
useSalesOrderShipmentCompleteFields,
|
useSalesOrderShipmentCompleteFields,
|
||||||
useSalesOrderShipmentFields
|
useSalesOrderShipmentFields
|
||||||
@@ -22,15 +29,8 @@ import {
|
|||||||
} from '../../hooks/UseForm';
|
} from '../../hooks/UseForm';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import { DateColumn, LinkColumn } from '../ColumnRenderers';
|
import { DateColumn, LinkColumn } from '../ColumnRenderers';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import {
|
|
||||||
type RowAction,
|
|
||||||
RowCancelAction,
|
|
||||||
RowEditAction,
|
|
||||||
RowViewAction
|
|
||||||
} from '../RowActions';
|
|
||||||
|
|
||||||
export default function SalesOrderShipmentTable({
|
export default function SalesOrderShipmentTable({
|
||||||
orderId
|
orderId
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
import { t } from '@lingui/core/macro';
|
import { t } from '@lingui/core/macro';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
|
|
||||||
|
import { ProgressBar } from '@lib/components/ProgressBar';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { ModelType } from '@lib/enums/ModelType';
|
import { ModelType } from '@lib/enums/ModelType';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
||||||
import { ProgressBar } from '../../components/items/ProgressBar';
|
|
||||||
import { formatCurrency } from '../../defaults/formatters';
|
import { formatCurrency } from '../../defaults/formatters';
|
||||||
import { useSalesOrderFields } from '../../forms/SalesOrderForms';
|
import { useSalesOrderFields } from '../../forms/SalesOrderForms';
|
||||||
import { useCreateApiFormModal } from '../../hooks/UseForm';
|
import { useCreateApiFormModal } from '../../hooks/UseForm';
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import type { RowAction } from '@lib/components/RowActions';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
@@ -15,7 +16,6 @@ import { RenderUser } from '../../components/render/User';
|
|||||||
import { showApiErrorMessage } from '../../functions/notifications';
|
import { showApiErrorMessage } from '../../functions/notifications';
|
||||||
import { useCreateApiFormModal } from '../../hooks/UseForm';
|
import { useCreateApiFormModal } from '../../hooks/UseForm';
|
||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import type { RowAction } from '../../tables/RowActions';
|
|
||||||
import { BooleanColumn } from '../ColumnRenderers';
|
import { BooleanColumn } from '../ColumnRenderers';
|
||||||
import { UserFilter } from '../Filter';
|
import { UserFilter } from '../Filter';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
|
@@ -14,12 +14,14 @@ import { useDisclosure } from '@mantine/hooks';
|
|||||||
import { IconExclamationCircle } from '@tabler/icons-react';
|
import { IconExclamationCircle } from '@tabler/icons-react';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import { RowDeleteAction } from '@lib/components/RowActions';
|
||||||
|
import { PassFailButton } from '@lib/components/YesNoButton';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { CopyButton } from '../../components/buttons/CopyButton';
|
import { CopyButton } from '../../components/buttons/CopyButton';
|
||||||
import { PassFailButton } from '../../components/buttons/YesNoButton';
|
|
||||||
import { StylishText } from '../../components/items/StylishText';
|
import { StylishText } from '../../components/items/StylishText';
|
||||||
import { RenderUser } from '../../components/render/User';
|
import { RenderUser } from '../../components/render/User';
|
||||||
import { shortenString } from '../../functions/tables';
|
import { shortenString } from '../../functions/tables';
|
||||||
@@ -27,10 +29,8 @@ import { useDeleteApiFormModal } from '../../hooks/UseForm';
|
|||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useGlobalSettingsState } from '../../states/SettingsStates';
|
import { useGlobalSettingsState } from '../../states/SettingsStates';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import { UserFilter } from '../Filter';
|
import { UserFilter } from '../Filter';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import { RowDeleteAction } from '../RowActions';
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Render detail information for a particular barcode scan result.
|
* Render detail information for a particular barcode scan result.
|
||||||
|
@@ -2,10 +2,17 @@ import { t } from '@lingui/core/macro';
|
|||||||
import { Badge } from '@mantine/core';
|
import { Badge } from '@mantine/core';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
|
import {
|
||||||
|
type RowAction,
|
||||||
|
RowDeleteAction,
|
||||||
|
RowDuplicateAction,
|
||||||
|
RowEditAction
|
||||||
|
} from '@lib/components/RowActions';
|
||||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import type { TableFilter } from '@lib/types/Filters';
|
import type { TableFilter } from '@lib/types/Filters';
|
||||||
|
import type { TableColumn } from '@lib/types/Tables';
|
||||||
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
import { AddItemButton } from '../../components/buttons/AddItemButton';
|
||||||
import type {
|
import type {
|
||||||
StatusCodeInterface,
|
StatusCodeInterface,
|
||||||
@@ -21,14 +28,7 @@ import {
|
|||||||
import { useTable } from '../../hooks/UseTable';
|
import { useTable } from '../../hooks/UseTable';
|
||||||
import { useGlobalStatusState } from '../../states/GlobalStatusState';
|
import { useGlobalStatusState } from '../../states/GlobalStatusState';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
import type { TableColumn } from '../Column';
|
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
import {
|
|
||||||
type RowAction,
|
|
||||||
RowDeleteAction,
|
|
||||||
RowDuplicateAction,
|
|
||||||
RowEditAction
|
|
||||||
} from '../RowActions';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table for displaying list of custom states
|
* Table for displaying list of custom states
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user