mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-08 00:08:49 +00:00
parent
0c1edf101f
commit
dc58198488
@ -14,13 +14,13 @@ export function DashboardItemProxy({
|
|||||||
url,
|
url,
|
||||||
params,
|
params,
|
||||||
autoupdate = true
|
autoupdate = true
|
||||||
}: {
|
}: Readonly<{
|
||||||
id: string;
|
id: string;
|
||||||
text: string;
|
text: string;
|
||||||
url: ApiEndpoints;
|
url: ApiEndpoints;
|
||||||
params: any;
|
params: any;
|
||||||
autoupdate: boolean;
|
autoupdate: boolean;
|
||||||
}) {
|
}>) {
|
||||||
function fetchData() {
|
function fetchData() {
|
||||||
return api
|
return api
|
||||||
.get(`${apiUrl(url)}?search=&offset=0&limit=25`, { params: params })
|
.get(`${apiUrl(url)}?search=&offset=0&limit=25`, { params: params })
|
||||||
|
@ -9,12 +9,12 @@ export function ButtonMenu({
|
|||||||
actions,
|
actions,
|
||||||
tooltip = '',
|
tooltip = '',
|
||||||
label = ''
|
label = ''
|
||||||
}: {
|
}: Readonly<{
|
||||||
icon: any;
|
icon: any;
|
||||||
actions: React.ReactNode[];
|
actions: React.ReactNode[];
|
||||||
label?: string;
|
label?: string;
|
||||||
tooltip?: string;
|
tooltip?: string;
|
||||||
}) {
|
}>) {
|
||||||
return (
|
return (
|
||||||
<Menu shadow="xs">
|
<Menu shadow="xs">
|
||||||
<Menu.Target>
|
<Menu.Target>
|
||||||
|
@ -12,10 +12,10 @@ import { InvenTreeIcon } from '../../functions/icons';
|
|||||||
export function CopyButton({
|
export function CopyButton({
|
||||||
value,
|
value,
|
||||||
label
|
label
|
||||||
}: {
|
}: Readonly<{
|
||||||
value: any;
|
value: any;
|
||||||
label?: JSX.Element;
|
label?: JSX.Element;
|
||||||
}) {
|
}>) {
|
||||||
const ButtonComponent = label ? Button : ActionIcon;
|
const ButtonComponent = label ? Button : ActionIcon;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -6,12 +6,12 @@ export function EditButton({
|
|||||||
editing,
|
editing,
|
||||||
disabled,
|
disabled,
|
||||||
saveIcon
|
saveIcon
|
||||||
}: {
|
}: Readonly<{
|
||||||
setEditing: (value?: React.SetStateAction<boolean> | undefined) => void;
|
setEditing: (value?: React.SetStateAction<boolean> | undefined) => void;
|
||||||
editing: boolean;
|
editing: boolean;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
saveIcon?: JSX.Element;
|
saveIcon?: JSX.Element;
|
||||||
}) {
|
}>) {
|
||||||
saveIcon = saveIcon || <IconDeviceFloppy />;
|
saveIcon = saveIcon || <IconDeviceFloppy />;
|
||||||
return (
|
return (
|
||||||
<ActionIcon
|
<ActionIcon
|
||||||
|
@ -33,7 +33,7 @@ const brandIcons: { [key: string]: JSX.Element } = {
|
|||||||
microsoft: <IconBrandAzure />
|
microsoft: <IconBrandAzure />
|
||||||
};
|
};
|
||||||
|
|
||||||
export function SsoButton({ provider }: { provider: Provider }) {
|
export function SsoButton({ provider }: Readonly<{ provider: Provider }>) {
|
||||||
function login() {
|
function login() {
|
||||||
// set preferred provider
|
// set preferred provider
|
||||||
api
|
api
|
||||||
|
@ -96,7 +96,10 @@ type FieldProps = {
|
|||||||
* Badge shows username, full name, or group name depending on server settings.
|
* Badge shows username, full name, or group name depending on server settings.
|
||||||
* Badge appends icon to describe type of Owner
|
* Badge appends icon to describe type of Owner
|
||||||
*/
|
*/
|
||||||
function NameBadge({ pk, type }: { pk: string | number; type: BadgeType }) {
|
function NameBadge({
|
||||||
|
pk,
|
||||||
|
type
|
||||||
|
}: Readonly<{ pk: string | number; type: BadgeType }>) {
|
||||||
const { data } = useQuery({
|
const { data } = useQuery({
|
||||||
queryKey: ['badge', type, pk],
|
queryKey: ['badge', type, pk],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
@ -331,17 +334,17 @@ function StatusValue(props: Readonly<FieldProps>) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function CopyField({ value }: { value: string }) {
|
function CopyField({ value }: Readonly<{ value: string }>) {
|
||||||
return <CopyButton value={value} />;
|
return <CopyButton value={value} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DetailsTableField({
|
export function DetailsTableField({
|
||||||
item,
|
item,
|
||||||
field
|
field
|
||||||
}: {
|
}: Readonly<{
|
||||||
item: any;
|
item: any;
|
||||||
field: DetailsField;
|
field: DetailsField;
|
||||||
}) {
|
}>) {
|
||||||
function getFieldType(type: string) {
|
function getFieldType(type: string) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'text':
|
case 'text':
|
||||||
@ -394,11 +397,11 @@ export function DetailsTable({
|
|||||||
item,
|
item,
|
||||||
fields,
|
fields,
|
||||||
title
|
title
|
||||||
}: {
|
}: Readonly<{
|
||||||
item: any;
|
item: any;
|
||||||
fields: DetailsField[];
|
fields: DetailsField[];
|
||||||
title?: string;
|
title?: string;
|
||||||
}) {
|
}>) {
|
||||||
return (
|
return (
|
||||||
<Paper p="xs" withBorder radius="xs">
|
<Paper p="xs" withBorder radius="xs">
|
||||||
<Stack gap="xs">
|
<Stack gap="xs">
|
||||||
|
@ -81,10 +81,10 @@ const removeModal = (apiPath: string, setImage: (image: string) => void) =>
|
|||||||
function UploadModal({
|
function UploadModal({
|
||||||
apiPath,
|
apiPath,
|
||||||
setImage
|
setImage
|
||||||
}: {
|
}: Readonly<{
|
||||||
apiPath: string;
|
apiPath: string;
|
||||||
setImage: (image: string) => void;
|
setImage: (image: string) => void;
|
||||||
}) {
|
}>) {
|
||||||
const [currentFile, setCurrentFile] = useState<FileWithPath | null>(null);
|
const [currentFile, setCurrentFile] = useState<FileWithPath | null>(null);
|
||||||
let uploading = false;
|
let uploading = false;
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ function UploadModal({
|
|||||||
<Text size="xl" inline>
|
<Text size="xl" inline>
|
||||||
<Trans>Drag and drop to upload</Trans>
|
<Trans>Drag and drop to upload</Trans>
|
||||||
</Text>
|
</Text>
|
||||||
<Text size="sm" color="dimmed" inline mt={7}>
|
<Text size="sm" c="dimmed" inline mt={7}>
|
||||||
<Trans>Click to select file(s)</Trans>
|
<Trans>Click to select file(s)</Trans>
|
||||||
</Text>
|
</Text>
|
||||||
</div>
|
</div>
|
||||||
@ -131,7 +131,7 @@ function UploadModal({
|
|||||||
<Text size="xl" inline style={{ wordBreak: 'break-all' }}>
|
<Text size="xl" inline style={{ wordBreak: 'break-all' }}>
|
||||||
{file.name}
|
{file.name}
|
||||||
</Text>
|
</Text>
|
||||||
<Text size="sm" color="dimmed" inline mt={7}>
|
<Text size="sm" c="dimmed" inline mt={7}>
|
||||||
{size.toFixed(2)} MB
|
{size.toFixed(2)} MB
|
||||||
</Text>
|
</Text>
|
||||||
</div>
|
</div>
|
||||||
@ -246,14 +246,14 @@ function ImageActionButtons({
|
|||||||
hasImage,
|
hasImage,
|
||||||
pk,
|
pk,
|
||||||
setImage
|
setImage
|
||||||
}: {
|
}: Readonly<{
|
||||||
actions?: DetailImageButtonProps;
|
actions?: DetailImageButtonProps;
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
apiPath: string;
|
apiPath: string;
|
||||||
hasImage: boolean;
|
hasImage: boolean;
|
||||||
pk: string;
|
pk: string;
|
||||||
setImage: (image: string) => void;
|
setImage: (image: string) => void;
|
||||||
}) {
|
}>) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{visible && (
|
{visible && (
|
||||||
|
@ -2,7 +2,7 @@ import { t } from '@lingui/macro';
|
|||||||
|
|
||||||
import GenericErrorPage from './GenericErrorPage';
|
import GenericErrorPage from './GenericErrorPage';
|
||||||
|
|
||||||
export default function ServerError({ status }: { status?: number }) {
|
export default function ServerError({ status }: Readonly<{ status?: number }>) {
|
||||||
return (
|
return (
|
||||||
<GenericErrorPage
|
<GenericErrorPage
|
||||||
title={t`Server Error`}
|
title={t`Server Error`}
|
||||||
|
@ -74,7 +74,7 @@ export interface ApiFormAction {
|
|||||||
*/
|
*/
|
||||||
export interface ApiFormProps {
|
export interface ApiFormProps {
|
||||||
url: ApiEndpoints | string;
|
url: ApiEndpoints | string;
|
||||||
pk?: number | string | undefined;
|
pk?: number | string;
|
||||||
pk_field?: string;
|
pk_field?: string;
|
||||||
pathParams?: PathParams;
|
pathParams?: PathParams;
|
||||||
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
||||||
@ -103,10 +103,10 @@ export interface ApiFormProps {
|
|||||||
export function OptionsApiForm({
|
export function OptionsApiForm({
|
||||||
props: _props,
|
props: _props,
|
||||||
id: pId
|
id: pId
|
||||||
}: {
|
}: Readonly<{
|
||||||
props: ApiFormProps;
|
props: ApiFormProps;
|
||||||
id?: string;
|
id?: string;
|
||||||
}) {
|
}>) {
|
||||||
const props = useMemo(
|
const props = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
..._props,
|
..._props,
|
||||||
@ -197,11 +197,11 @@ export function ApiForm({
|
|||||||
id,
|
id,
|
||||||
props,
|
props,
|
||||||
optionsLoading
|
optionsLoading
|
||||||
}: {
|
}: Readonly<{
|
||||||
id: string;
|
id: string;
|
||||||
props: ApiFormProps;
|
props: ApiFormProps;
|
||||||
optionsLoading: boolean;
|
optionsLoading: boolean;
|
||||||
}) {
|
}>) {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const [fields, setFields] = useState<ApiFormFieldSet>(
|
const [fields, setFields] = useState<ApiFormFieldSet>(
|
||||||
@ -649,10 +649,10 @@ export function ApiForm({
|
|||||||
export function CreateApiForm({
|
export function CreateApiForm({
|
||||||
id,
|
id,
|
||||||
props
|
props
|
||||||
}: {
|
}: Readonly<{
|
||||||
id?: string;
|
id?: string;
|
||||||
props: ApiFormProps;
|
props: ApiFormProps;
|
||||||
}) {
|
}>) {
|
||||||
const createProps = useMemo<ApiFormProps>(
|
const createProps = useMemo<ApiFormProps>(
|
||||||
() => ({
|
() => ({
|
||||||
...props,
|
...props,
|
||||||
@ -667,10 +667,10 @@ export function CreateApiForm({
|
|||||||
export function EditApiForm({
|
export function EditApiForm({
|
||||||
id,
|
id,
|
||||||
props
|
props
|
||||||
}: {
|
}: Readonly<{
|
||||||
id?: string;
|
id?: string;
|
||||||
props: ApiFormProps;
|
props: ApiFormProps;
|
||||||
}) {
|
}>) {
|
||||||
const editProps = useMemo<ApiFormProps>(
|
const editProps = useMemo<ApiFormProps>(
|
||||||
() => ({
|
() => ({
|
||||||
...props,
|
...props,
|
||||||
@ -687,10 +687,10 @@ export function EditApiForm({
|
|||||||
export function DeleteApiForm({
|
export function DeleteApiForm({
|
||||||
id,
|
id,
|
||||||
props
|
props
|
||||||
}: {
|
}: Readonly<{
|
||||||
id?: string;
|
id?: string;
|
||||||
props: ApiFormProps;
|
props: ApiFormProps;
|
||||||
}) {
|
}>) {
|
||||||
const deleteProps = useMemo<ApiFormProps>(
|
const deleteProps = useMemo<ApiFormProps>(
|
||||||
() => ({
|
() => ({
|
||||||
...props,
|
...props,
|
||||||
|
@ -118,7 +118,7 @@ export function AuthenticationForm() {
|
|||||||
<Anchor
|
<Anchor
|
||||||
component="button"
|
component="button"
|
||||||
type="button"
|
type="button"
|
||||||
color="dimmed"
|
c="dimmed"
|
||||||
size="xs"
|
size="xs"
|
||||||
onClick={() => navigate('/reset-password')}
|
onClick={() => navigate('/reset-password')}
|
||||||
>
|
>
|
||||||
@ -143,7 +143,7 @@ export function AuthenticationForm() {
|
|||||||
<Anchor
|
<Anchor
|
||||||
component="button"
|
component="button"
|
||||||
type="button"
|
type="button"
|
||||||
color="dimmed"
|
c="dimmed"
|
||||||
size="xs"
|
size="xs"
|
||||||
onClick={() => setMode.toggle()}
|
onClick={() => setMode.toggle()}
|
||||||
>
|
>
|
||||||
@ -278,10 +278,10 @@ export function RegistrationForm() {
|
|||||||
export function ModeSelector({
|
export function ModeSelector({
|
||||||
loginMode,
|
loginMode,
|
||||||
setMode
|
setMode
|
||||||
}: {
|
}: Readonly<{
|
||||||
loginMode: boolean;
|
loginMode: boolean;
|
||||||
setMode: any;
|
setMode: any;
|
||||||
}) {
|
}>) {
|
||||||
const [auth_settings] = useServerApiState((state) => [state.auth_settings]);
|
const [auth_settings] = useServerApiState((state) => [state.auth_settings]);
|
||||||
const registration_enabled =
|
const registration_enabled =
|
||||||
auth_settings?.registration_enabled ||
|
auth_settings?.registration_enabled ||
|
||||||
@ -297,7 +297,7 @@ export function ModeSelector({
|
|||||||
<Anchor
|
<Anchor
|
||||||
component="button"
|
component="button"
|
||||||
type="button"
|
type="button"
|
||||||
color="dimmed"
|
c="dimmed"
|
||||||
size="xs"
|
size="xs"
|
||||||
onClick={() => setMode.close()}
|
onClick={() => setMode.close()}
|
||||||
>
|
>
|
||||||
@ -308,7 +308,7 @@ export function ModeSelector({
|
|||||||
<Anchor
|
<Anchor
|
||||||
component="button"
|
component="button"
|
||||||
type="button"
|
type="button"
|
||||||
color="dimmed"
|
c="dimmed"
|
||||||
size="xs"
|
size="xs"
|
||||||
onClick={() => setMode.open()}
|
onClick={() => setMode.open()}
|
||||||
>
|
>
|
||||||
|
@ -17,10 +17,10 @@ import { HostList } from '../../states/states';
|
|||||||
export function HostOptionsForm({
|
export function HostOptionsForm({
|
||||||
data,
|
data,
|
||||||
saveOptions
|
saveOptions
|
||||||
}: {
|
}: Readonly<{
|
||||||
data: HostList;
|
data: HostList;
|
||||||
saveOptions: (newData: HostList) => void;
|
saveOptions: (newData: HostList) => void;
|
||||||
}) {
|
}>) {
|
||||||
const form = useForm({ initialValues: data });
|
const form = useForm({ initialValues: data });
|
||||||
function deleteItem(key: string) {
|
function deleteItem(key: string) {
|
||||||
const newData = form.values;
|
const newData = form.values;
|
||||||
|
@ -13,11 +13,11 @@ export function InstanceOptions({
|
|||||||
hostKey,
|
hostKey,
|
||||||
ChangeHost,
|
ChangeHost,
|
||||||
setHostEdit
|
setHostEdit
|
||||||
}: {
|
}: Readonly<{
|
||||||
hostKey: string;
|
hostKey: string;
|
||||||
ChangeHost: (newHost: string | null) => void;
|
ChangeHost: (newHost: string | null) => void;
|
||||||
setHostEdit: () => void;
|
setHostEdit: () => void;
|
||||||
}) {
|
}>) {
|
||||||
const [HostListEdit, setHostListEdit] = useToggle([false, true] as const);
|
const [HostListEdit, setHostListEdit] = useToggle([false, true] as const);
|
||||||
const [setHost, setHostList, hostList] = useLocalState((state) => [
|
const [setHost, setHostList, hostList] = useLocalState((state) => [
|
||||||
state.setHost,
|
state.setHost,
|
||||||
@ -85,10 +85,10 @@ export function InstanceOptions({
|
|||||||
function ServerInfo({
|
function ServerInfo({
|
||||||
hostList,
|
hostList,
|
||||||
hostKey
|
hostKey
|
||||||
}: {
|
}: Readonly<{
|
||||||
hostList: HostList;
|
hostList: HostList;
|
||||||
hostKey: string;
|
hostKey: string;
|
||||||
}) {
|
}>) {
|
||||||
const [server] = useServerApiState((state) => [state.server]);
|
const [server] = useServerApiState((state) => [state.server]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -9,13 +9,13 @@ export function StandaloneField({
|
|||||||
defaultValue,
|
defaultValue,
|
||||||
hideLabels,
|
hideLabels,
|
||||||
error
|
error
|
||||||
}: {
|
}: Readonly<{
|
||||||
fieldDefinition: ApiFormFieldType;
|
fieldDefinition: ApiFormFieldType;
|
||||||
fieldName?: string;
|
fieldName?: string;
|
||||||
defaultValue?: any;
|
defaultValue?: any;
|
||||||
hideLabels?: boolean;
|
hideLabels?: boolean;
|
||||||
error?: string;
|
error?: string;
|
||||||
}) {
|
}>) {
|
||||||
// Field must have a defined name
|
// Field must have a defined name
|
||||||
const name = useMemo(() => fieldName ?? 'field', [fieldName]);
|
const name = useMemo(() => fieldName ?? 'field', [fieldName]);
|
||||||
|
|
||||||
|
@ -105,14 +105,14 @@ export function ApiFormField({
|
|||||||
hideLabels,
|
hideLabels,
|
||||||
url,
|
url,
|
||||||
setFields
|
setFields
|
||||||
}: {
|
}: Readonly<{
|
||||||
fieldName: string;
|
fieldName: string;
|
||||||
definition: ApiFormFieldType;
|
definition: ApiFormFieldType;
|
||||||
control: Control<FieldValues, any>;
|
control: Control<FieldValues, any>;
|
||||||
hideLabels?: boolean;
|
hideLabels?: boolean;
|
||||||
url?: string;
|
url?: string;
|
||||||
setFields?: React.Dispatch<React.SetStateAction<ApiFormFieldSet>>;
|
setFields?: React.Dispatch<React.SetStateAction<ApiFormFieldSet>>;
|
||||||
}) {
|
}>) {
|
||||||
const fieldId = useId();
|
const fieldId = useId();
|
||||||
const controller = useController({
|
const controller = useController({
|
||||||
name: fieldName,
|
name: fieldName,
|
||||||
|
@ -11,10 +11,10 @@ dayjs.extend(customParseFormat);
|
|||||||
export default function DateField({
|
export default function DateField({
|
||||||
controller,
|
controller,
|
||||||
definition
|
definition
|
||||||
}: {
|
}: Readonly<{
|
||||||
controller: UseControllerReturn<FieldValues, any>;
|
controller: UseControllerReturn<FieldValues, any>;
|
||||||
definition: ApiFormFieldType;
|
definition: ApiFormFieldType;
|
||||||
}) {
|
}>) {
|
||||||
const fieldId = useId();
|
const fieldId = useId();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
@ -13,13 +13,13 @@ export function NestedObjectField({
|
|||||||
definition,
|
definition,
|
||||||
url,
|
url,
|
||||||
setFields
|
setFields
|
||||||
}: {
|
}: Readonly<{
|
||||||
control: Control<FieldValues, any>;
|
control: Control<FieldValues, any>;
|
||||||
definition: ApiFormFieldType;
|
definition: ApiFormFieldType;
|
||||||
fieldName: string;
|
fieldName: string;
|
||||||
url?: string;
|
url?: string;
|
||||||
setFields?: React.Dispatch<React.SetStateAction<ApiFormFieldSet>>;
|
setFields?: React.Dispatch<React.SetStateAction<ApiFormFieldSet>>;
|
||||||
}) {
|
}>) {
|
||||||
return (
|
return (
|
||||||
<Accordion defaultValue={'OpenByDefault'} variant="contained">
|
<Accordion defaultValue={'OpenByDefault'} variant="contained">
|
||||||
<Accordion.Item value={'OpenByDefault'}>
|
<Accordion.Item value={'OpenByDefault'}>
|
||||||
|
@ -28,12 +28,12 @@ export function RelatedModelField({
|
|||||||
fieldName,
|
fieldName,
|
||||||
definition,
|
definition,
|
||||||
limit = 10
|
limit = 10
|
||||||
}: {
|
}: Readonly<{
|
||||||
controller: UseControllerReturn<FieldValues, any>;
|
controller: UseControllerReturn<FieldValues, any>;
|
||||||
definition: ApiFormFieldType;
|
definition: ApiFormFieldType;
|
||||||
fieldName: string;
|
fieldName: string;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
}) {
|
}>) {
|
||||||
const fieldId = useId();
|
const fieldId = useId();
|
||||||
const {
|
const {
|
||||||
field,
|
field,
|
||||||
|
@ -55,10 +55,10 @@ export function attachmentIcon(attachment: string): ReactNode {
|
|||||||
export function AttachmentLink({
|
export function AttachmentLink({
|
||||||
attachment,
|
attachment,
|
||||||
external
|
external
|
||||||
}: {
|
}: Readonly<{
|
||||||
attachment: string;
|
attachment: string;
|
||||||
external?: boolean;
|
external?: boolean;
|
||||||
}): ReactNode {
|
}>): ReactNode {
|
||||||
let text = external ? attachment : attachment.split('/').pop();
|
let text = external ? attachment : attachment.split('/').pop();
|
||||||
|
|
||||||
const host = useLocalState((s) => s.host);
|
const host = useLocalState((s) => s.host);
|
||||||
|
@ -11,16 +11,16 @@ export function StatisticItem({
|
|||||||
id,
|
id,
|
||||||
data,
|
data,
|
||||||
isLoading
|
isLoading
|
||||||
}: {
|
}: Readonly<{
|
||||||
id: string;
|
id: string;
|
||||||
data: StatisticItemProps;
|
data: StatisticItemProps;
|
||||||
isLoading: boolean;
|
isLoading: boolean;
|
||||||
}) {
|
}>) {
|
||||||
return (
|
return (
|
||||||
<Paper withBorder p="xs" key={id} pos="relative">
|
<Paper withBorder p="xs" key={id} pos="relative">
|
||||||
<LoadingOverlay visible={isLoading} overlayProps={{ blur: 2 }} />
|
<LoadingOverlay visible={isLoading} overlayProps={{ blur: 2 }} />
|
||||||
<Group justify="space-between">
|
<Group justify="space-between">
|
||||||
<Text size="xs" color="dimmed" className={classes.dashboardItemTitle}>
|
<Text size="xs" c="dimmed" className={classes.dashboardItemTitle}>
|
||||||
{data.title}
|
{data.title}
|
||||||
</Text>
|
</Text>
|
||||||
</Group>
|
</Group>
|
||||||
|
@ -50,12 +50,12 @@ function ConstBody({
|
|||||||
detail,
|
detail,
|
||||||
docchildren,
|
docchildren,
|
||||||
link
|
link
|
||||||
}: {
|
}: Readonly<{
|
||||||
text: string | JSX.Element;
|
text: string | JSX.Element;
|
||||||
detail?: string | JSX.Element;
|
detail?: string | JSX.Element;
|
||||||
docchildren?: React.ReactNode;
|
docchildren?: React.ReactNode;
|
||||||
link?: string;
|
link?: string;
|
||||||
}) {
|
}>) {
|
||||||
const [height, setHeight] = useState(0);
|
const [height, setHeight] = useState(0);
|
||||||
const ref = useRef(null);
|
const ref = useRef(null);
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ function ConstBody({
|
|||||||
<ScrollArea h={height} mah={250}>
|
<ScrollArea h={height} mah={250}>
|
||||||
<div ref={ref}>
|
<div ref={ref}>
|
||||||
{detail && (
|
{detail && (
|
||||||
<Text size="xs" color="dimmed">
|
<Text size="xs" c="dimmed">
|
||||||
{detail}
|
{detail}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
|
@ -26,9 +26,9 @@ export type DocumentationLinkItem =
|
|||||||
|
|
||||||
export function DocumentationLinks({
|
export function DocumentationLinks({
|
||||||
links
|
links
|
||||||
}: {
|
}: Readonly<{
|
||||||
links: DocumentationLinkItem[];
|
links: DocumentationLinkItem[];
|
||||||
}) {
|
}>) {
|
||||||
const DocumentationLinkRenderer = ({
|
const DocumentationLinkRenderer = ({
|
||||||
link
|
link
|
||||||
}: {
|
}: {
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
import { Trans } from '@lingui/macro';
|
import { Trans } from '@lingui/macro';
|
||||||
|
|
||||||
export function ErrorItem({ id, error }: { id: string; error?: any }) {
|
export function ErrorItem({
|
||||||
|
id,
|
||||||
|
error
|
||||||
|
}: Readonly<{ id: string; error?: any }>) {
|
||||||
const error_message = error?.message || error?.toString() || (
|
const error_message = error?.message || error?.toString() || (
|
||||||
<Trans>Unknown error</Trans>
|
<Trans>Unknown error</Trans>
|
||||||
);
|
);
|
||||||
|
@ -33,9 +33,9 @@ function StartedCard({
|
|||||||
|
|
||||||
export function GettingStartedCarousel({
|
export function GettingStartedCarousel({
|
||||||
items
|
items
|
||||||
}: {
|
}: Readonly<{
|
||||||
items: DocumentationLinkItem[];
|
items: DocumentationLinkItem[];
|
||||||
}) {
|
}>) {
|
||||||
const slides = items.map((item) => (
|
const slides = items.map((item) => (
|
||||||
<Carousel.Slide key={item.id}>
|
<Carousel.Slide key={item.id}>
|
||||||
<StartedCard {...item} />
|
<StartedCard {...item} />
|
||||||
|
@ -12,14 +12,14 @@ export function InfoItem({
|
|||||||
value,
|
value,
|
||||||
link,
|
link,
|
||||||
detailDrawerLink
|
detailDrawerLink
|
||||||
}: {
|
}: Readonly<{
|
||||||
name: string;
|
name: string;
|
||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
type?: 'text' | 'boolean' | 'code';
|
type?: 'text' | 'boolean' | 'code';
|
||||||
value?: any;
|
value?: any;
|
||||||
link?: To;
|
link?: To;
|
||||||
detailDrawerLink?: boolean;
|
detailDrawerLink?: boolean;
|
||||||
}) {
|
}>) {
|
||||||
function renderComponent() {
|
function renderComponent() {
|
||||||
if (value === undefined) return null;
|
if (value === undefined) return null;
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import { useEffect, useState } from 'react';
|
|||||||
import { getSupportedLanguages } from '../../contexts/LanguageContext';
|
import { getSupportedLanguages } from '../../contexts/LanguageContext';
|
||||||
import { useLocalState } from '../../states/LocalState';
|
import { useLocalState } from '../../states/LocalState';
|
||||||
|
|
||||||
export function LanguageSelect({ width = 80 }: { width?: number }) {
|
export function LanguageSelect({ width = 80 }: Readonly<{ width?: number }>) {
|
||||||
const [value, setValue] = useState<string | null>(null);
|
const [value, setValue] = useState<string | null>(null);
|
||||||
const [locale, setLanguage] = useLocalState((state) => [
|
const [locale, setLanguage] = useLocalState((state) => [
|
||||||
state.language,
|
state.language,
|
||||||
|
@ -23,10 +23,10 @@ export type menuItemsCollection = {
|
|||||||
function ConditionalDocTooltip({
|
function ConditionalDocTooltip({
|
||||||
item,
|
item,
|
||||||
children
|
children
|
||||||
}: {
|
}: Readonly<{
|
||||||
item: MenuLinkItem;
|
item: MenuLinkItem;
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}) {
|
}>) {
|
||||||
if (item.doctext !== undefined) {
|
if (item.doctext !== undefined) {
|
||||||
return (
|
return (
|
||||||
<DocTooltip
|
<DocTooltip
|
||||||
@ -46,10 +46,10 @@ function ConditionalDocTooltip({
|
|||||||
export function MenuLinks({
|
export function MenuLinks({
|
||||||
links,
|
links,
|
||||||
highlighted = false
|
highlighted = false
|
||||||
}: {
|
}: Readonly<{
|
||||||
links: MenuLinkItem[];
|
links: MenuLinkItem[];
|
||||||
highlighted?: boolean;
|
highlighted?: boolean;
|
||||||
}) {
|
}>) {
|
||||||
const filteredLinks = links.filter(
|
const filteredLinks = links.filter(
|
||||||
(item) => !highlighted || item.highlight === true
|
(item) => !highlighted || item.highlight === true
|
||||||
);
|
);
|
||||||
|
@ -5,10 +5,10 @@ import * as classes from '../../main.css';
|
|||||||
export function StylishText({
|
export function StylishText({
|
||||||
children,
|
children,
|
||||||
size = 'md'
|
size = 'md'
|
||||||
}: {
|
}: Readonly<{
|
||||||
children: JSX.Element | string;
|
children: JSX.Element | string;
|
||||||
size?: string;
|
size?: string;
|
||||||
}) {
|
}>) {
|
||||||
return (
|
return (
|
||||||
<Text size={size} className={classes.signText} variant="gradient">
|
<Text size={size} className={classes.signText} variant="gradient">
|
||||||
{children}
|
{children}
|
||||||
|
@ -16,7 +16,7 @@ import { api } from '../../App';
|
|||||||
import { ApiEndpoints } from '../../enums/ApiEndpoints';
|
import { ApiEndpoints } from '../../enums/ApiEndpoints';
|
||||||
import { apiUrl } from '../../states/ApiState';
|
import { apiUrl } from '../../states/ApiState';
|
||||||
|
|
||||||
export function LicenceView(entries: Readonly<any[]>) {
|
export function LicenceView(entries: any[]) {
|
||||||
return (
|
return (
|
||||||
<Stack gap="xs">
|
<Stack gap="xs">
|
||||||
<Divider />
|
<Divider />
|
||||||
|
@ -25,10 +25,10 @@ export type Breadcrumb = {
|
|||||||
export function BreadcrumbList({
|
export function BreadcrumbList({
|
||||||
breadcrumbs,
|
breadcrumbs,
|
||||||
navCallback
|
navCallback
|
||||||
}: {
|
}: Readonly<{
|
||||||
breadcrumbs: Breadcrumb[];
|
breadcrumbs: Breadcrumb[];
|
||||||
navCallback?: () => void;
|
navCallback?: () => void;
|
||||||
}) {
|
}>) {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const elements = useMemo(() => {
|
const elements = useMemo(() => {
|
||||||
|
@ -88,7 +88,10 @@ export function DetailDrawer(props: Readonly<DrawerProps>) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DetailDrawerLink({ to, text }: { to: To; text: string }) {
|
export function DetailDrawerLink({
|
||||||
|
to,
|
||||||
|
text
|
||||||
|
}: Readonly<{ to: To; text: string }>) {
|
||||||
const addDetailDrawer = useLocalState((state) => state.addDetailDrawer);
|
const addDetailDrawer = useLocalState((state) => state.addDetailDrawer);
|
||||||
|
|
||||||
const onNavigate = useCallback(() => {
|
const onNavigate = useCallback(() => {
|
||||||
|
@ -26,9 +26,9 @@ const onlyItems = Object.values(menuItems);
|
|||||||
|
|
||||||
export function NavHoverMenu({
|
export function NavHoverMenu({
|
||||||
openDrawer: openDrawer
|
openDrawer: openDrawer
|
||||||
}: {
|
}: Readonly<{
|
||||||
openDrawer: () => void;
|
openDrawer: () => void;
|
||||||
}) {
|
}>) {
|
||||||
const [hostKey, hostList] = useLocalState((state) => [
|
const [hostKey, hostList] = useLocalState((state) => [
|
||||||
state.hostKey,
|
state.hostKey,
|
||||||
state.hostList
|
state.hostList
|
||||||
@ -99,7 +99,7 @@ export function NavHoverMenu({
|
|||||||
<Text fw={500} fz="sm">
|
<Text fw={500} fz="sm">
|
||||||
<Trans>Get started</Trans>
|
<Trans>Get started</Trans>
|
||||||
</Text>
|
</Text>
|
||||||
<Text size="xs" color="dimmed">
|
<Text size="xs" c="dimmed">
|
||||||
<Trans>
|
<Trans>
|
||||||
Overview over high-level objects, functions and possible
|
Overview over high-level objects, functions and possible
|
||||||
usecases.
|
usecases.
|
||||||
|
@ -23,10 +23,10 @@ const onlyItems = Object.values(menuItems);
|
|||||||
export function NavigationDrawer({
|
export function NavigationDrawer({
|
||||||
opened,
|
opened,
|
||||||
close
|
close
|
||||||
}: {
|
}: Readonly<{
|
||||||
opened: boolean;
|
opened: boolean;
|
||||||
close: () => void;
|
close: () => void;
|
||||||
}) {
|
}>) {
|
||||||
return (
|
return (
|
||||||
<Drawer
|
<Drawer
|
||||||
opened={opened}
|
opened={opened}
|
||||||
|
@ -30,10 +30,10 @@ import { StylishText } from '../items/StylishText';
|
|||||||
export function NotificationDrawer({
|
export function NotificationDrawer({
|
||||||
opened,
|
opened,
|
||||||
onClose
|
onClose
|
||||||
}: {
|
}: Readonly<{
|
||||||
opened: boolean;
|
opened: boolean;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
}) {
|
}>) {
|
||||||
const { isLoggedIn } = useUserState();
|
const { isLoggedIn } = useUserState();
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
@ -56,11 +56,11 @@ function QueryResultGroup({
|
|||||||
query,
|
query,
|
||||||
onRemove,
|
onRemove,
|
||||||
onResultClick
|
onResultClick
|
||||||
}: {
|
}: Readonly<{
|
||||||
query: SearchQuery;
|
query: SearchQuery;
|
||||||
onRemove: (query: ModelType) => void;
|
onRemove: (query: ModelType) => void;
|
||||||
onResultClick: (query: ModelType, pk: number, event: any) => void;
|
onResultClick: (query: ModelType, pk: number, event: any) => void;
|
||||||
}) {
|
}>) {
|
||||||
if (query.results.count == 0) {
|
if (query.results.count == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -115,10 +115,10 @@ function QueryResultGroup({
|
|||||||
export function SearchDrawer({
|
export function SearchDrawer({
|
||||||
opened,
|
opened,
|
||||||
onClose
|
onClose
|
||||||
}: {
|
}: Readonly<{
|
||||||
opened: boolean;
|
opened: boolean;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
}) {
|
}>) {
|
||||||
const [value, setValue] = useState<string>('');
|
const [value, setValue] = useState<string>('');
|
||||||
const [searchText] = useDebouncedValue(value, 500);
|
const [searchText] = useDebouncedValue(value, 500);
|
||||||
|
|
||||||
|
@ -14,10 +14,10 @@ import { RenderInstance } from './Instance';
|
|||||||
export function InstanceFromUrl({
|
export function InstanceFromUrl({
|
||||||
model,
|
model,
|
||||||
url
|
url
|
||||||
}: {
|
}: Readonly<{
|
||||||
model: ModelType;
|
model: ModelType;
|
||||||
url: string;
|
url: string;
|
||||||
}) {
|
}>) {
|
||||||
const [data, setData] = useState<any>(null);
|
const [data, setData] = useState<any>(null);
|
||||||
useMemo(
|
useMemo(
|
||||||
() =>
|
() =>
|
||||||
|
@ -110,9 +110,9 @@ export function RenderSalesOrder(
|
|||||||
*/
|
*/
|
||||||
export function RenderSalesOrderShipment({
|
export function RenderSalesOrderShipment({
|
||||||
instance
|
instance
|
||||||
}: {
|
}: Readonly<{
|
||||||
instance: any;
|
instance: any;
|
||||||
}): ReactNode {
|
}>): ReactNode {
|
||||||
let order = instance.sales_order_detail || {};
|
let order = instance.sales_order_detail || {};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -83,9 +83,9 @@ export function RenderPartCategory(
|
|||||||
*/
|
*/
|
||||||
export function RenderPartParameterTemplate({
|
export function RenderPartParameterTemplate({
|
||||||
instance
|
instance
|
||||||
}: {
|
}: Readonly<{
|
||||||
instance: any;
|
instance: any;
|
||||||
}): ReactNode {
|
}>): ReactNode {
|
||||||
return (
|
return (
|
||||||
<RenderInlineModel
|
<RenderInlineModel
|
||||||
primary={instance.name}
|
primary={instance.name}
|
||||||
@ -97,9 +97,9 @@ export function RenderPartParameterTemplate({
|
|||||||
|
|
||||||
export function RenderPartTestTemplate({
|
export function RenderPartTestTemplate({
|
||||||
instance
|
instance
|
||||||
}: {
|
}: Readonly<{
|
||||||
instance: any;
|
instance: any;
|
||||||
}): ReactNode {
|
}>): ReactNode {
|
||||||
return (
|
return (
|
||||||
<RenderInlineModel
|
<RenderInlineModel
|
||||||
primary={instance.test_name}
|
primary={instance.test_name}
|
||||||
|
@ -22,11 +22,11 @@ function SettingValue({
|
|||||||
setting,
|
setting,
|
||||||
onEdit,
|
onEdit,
|
||||||
onToggle
|
onToggle
|
||||||
}: {
|
}: Readonly<{
|
||||||
setting: Setting;
|
setting: Setting;
|
||||||
onEdit: (setting: Setting) => void;
|
onEdit: (setting: Setting) => void;
|
||||||
onToggle: (setting: Setting, value: boolean) => void;
|
onToggle: (setting: Setting, value: boolean) => void;
|
||||||
}) {
|
}>) {
|
||||||
// Determine the text to display for the setting value
|
// Determine the text to display for the setting value
|
||||||
const valueText: string = useMemo(() => {
|
const valueText: string = useMemo(() => {
|
||||||
let value = setting.value;
|
let value = setting.value;
|
||||||
@ -81,12 +81,12 @@ export function SettingItem({
|
|||||||
shaded,
|
shaded,
|
||||||
onEdit,
|
onEdit,
|
||||||
onToggle
|
onToggle
|
||||||
}: {
|
}: Readonly<{
|
||||||
setting: Setting;
|
setting: Setting;
|
||||||
shaded: boolean;
|
shaded: boolean;
|
||||||
onEdit: (setting: Setting) => void;
|
onEdit: (setting: Setting) => void;
|
||||||
onToggle: (setting: Setting, value: boolean) => void;
|
onToggle: (setting: Setting, value: boolean) => void;
|
||||||
}) {
|
}>) {
|
||||||
const { colorScheme } = useMantineColorScheme();
|
const { colorScheme } = useMantineColorScheme();
|
||||||
|
|
||||||
const style: Record<string, string> = { paddingLeft: '8px' };
|
const style: Record<string, string> = { paddingLeft: '8px' };
|
||||||
|
@ -31,11 +31,11 @@ export function SettingList({
|
|||||||
settingsState,
|
settingsState,
|
||||||
keys,
|
keys,
|
||||||
onChange
|
onChange
|
||||||
}: {
|
}: Readonly<{
|
||||||
settingsState: SettingsStateProps;
|
settingsState: SettingsStateProps;
|
||||||
keys?: string[];
|
keys?: string[];
|
||||||
onChange?: () => void;
|
onChange?: () => void;
|
||||||
}) {
|
}>) {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
settingsState.fetchSettings();
|
settingsState.fetchSettings();
|
||||||
}, []);
|
}, []);
|
||||||
@ -150,7 +150,7 @@ export function SettingList({
|
|||||||
onToggle={onValueToggle}
|
onToggle={onValueToggle}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<Text size="sm" style={{ fontStyle: 'italic' }} color="red">
|
<Text size="sm" style={{ fontStyle: 'italic' }} c="red">
|
||||||
Setting {key} not found
|
Setting {key} not found
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
@ -167,19 +167,21 @@ export function SettingList({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function UserSettingList({ keys }: { keys: string[] }) {
|
export function UserSettingList({ keys }: Readonly<{ keys: string[] }>) {
|
||||||
const userSettings = useUserSettingsState();
|
const userSettings = useUserSettingsState();
|
||||||
|
|
||||||
return <SettingList settingsState={userSettings} keys={keys} />;
|
return <SettingList settingsState={userSettings} keys={keys} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function GlobalSettingList({ keys }: { keys: string[] }) {
|
export function GlobalSettingList({ keys }: Readonly<{ keys: string[] }>) {
|
||||||
const globalSettings = useGlobalSettingsState();
|
const globalSettings = useGlobalSettingsState();
|
||||||
|
|
||||||
return <SettingList settingsState={globalSettings} keys={keys} />;
|
return <SettingList settingsState={globalSettings} keys={keys} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function PluginSettingList({ pluginKey }: { pluginKey: string }) {
|
export function PluginSettingList({
|
||||||
|
pluginKey
|
||||||
|
}: Readonly<{ pluginKey: string }>) {
|
||||||
const pluginSettingsStore = useRef(
|
const pluginSettingsStore = useRef(
|
||||||
createPluginSettingsState({ plugin: pluginKey })
|
createPluginSettingsState({ plugin: pluginKey })
|
||||||
).current;
|
).current;
|
||||||
@ -192,11 +194,11 @@ export function MachineSettingList({
|
|||||||
machinePk,
|
machinePk,
|
||||||
configType,
|
configType,
|
||||||
onChange
|
onChange
|
||||||
}: {
|
}: Readonly<{
|
||||||
machinePk: string;
|
machinePk: string;
|
||||||
configType: 'M' | 'D';
|
configType: 'M' | 'D';
|
||||||
onChange?: () => void;
|
onChange?: () => void;
|
||||||
}) {
|
}>) {
|
||||||
const machineSettingsStore = useRef(
|
const machineSettingsStore = useRef(
|
||||||
createMachineSettingsState({
|
createMachineSettingsState({
|
||||||
machine: machinePk,
|
machine: machinePk,
|
||||||
|
@ -43,12 +43,12 @@ export function WidgetLayout({
|
|||||||
className = 'layout',
|
className = 'layout',
|
||||||
localstorageName = 'argl',
|
localstorageName = 'argl',
|
||||||
rowHeight = 30
|
rowHeight = 30
|
||||||
}: {
|
}: Readonly<{
|
||||||
items: LayoutItemType[];
|
items: LayoutItemType[];
|
||||||
className?: string;
|
className?: string;
|
||||||
localstorageName?: string;
|
localstorageName?: string;
|
||||||
rowHeight?: number;
|
rowHeight?: number;
|
||||||
}) {
|
}>) {
|
||||||
const [layouts, setLayouts] = useState({});
|
const [layouts, setLayouts] = useState({});
|
||||||
const [editable, setEditable] = useDisclosure(false);
|
const [editable, setEditable] = useDisclosure(false);
|
||||||
const [boxShown, setBoxShown] = useDisclosure(true);
|
const [boxShown, setBoxShown] = useDisclosure(true);
|
||||||
@ -130,13 +130,13 @@ function WidgetControlBar({
|
|||||||
resetLayout,
|
resetLayout,
|
||||||
boxShown,
|
boxShown,
|
||||||
boxFnc
|
boxFnc
|
||||||
}: {
|
}: Readonly<{
|
||||||
editable: boolean;
|
editable: boolean;
|
||||||
editFnc: () => void;
|
editFnc: () => void;
|
||||||
resetLayout: () => void;
|
resetLayout: () => void;
|
||||||
boxShown: boolean;
|
boxShown: boolean;
|
||||||
boxFnc: () => void;
|
boxFnc: () => void;
|
||||||
}) {
|
}>) {
|
||||||
useHotkeys([['mod+E', () => editFnc()]]);
|
useHotkeys([['mod+E', () => editFnc()]]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -177,7 +177,7 @@ function WidgetControlBar({
|
|||||||
}
|
}
|
||||||
onClick={editFnc}
|
onClick={editFnc}
|
||||||
rightSection={
|
rightSection={
|
||||||
<Text size="xs" color="dimmed">
|
<Text size="xs" c="dimmed">
|
||||||
⌘E
|
⌘E
|
||||||
</Text>
|
</Text>
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,9 @@ export const getSupportedLanguages = (): Record<string, string> => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export function LanguageContext({ children }: { children: JSX.Element }) {
|
export function LanguageContext({
|
||||||
|
children
|
||||||
|
}: Readonly<{ children: JSX.Element }>) {
|
||||||
const [language] = useLocalState((state) => [state.language]);
|
const [language] = useLocalState((state) => [state.language]);
|
||||||
const [server] = useServerApiState((state) => [state.server]);
|
const [server] = useServerApiState((state) => [state.server]);
|
||||||
|
|
||||||
|
@ -11,7 +11,9 @@ import { useLocalState } from '../states/LocalState';
|
|||||||
import { LanguageContext } from './LanguageContext';
|
import { LanguageContext } from './LanguageContext';
|
||||||
import { colorSchema } from './colorSchema';
|
import { colorSchema } from './colorSchema';
|
||||||
|
|
||||||
export function ThemeContext({ children }: { children: JSX.Element }) {
|
export function ThemeContext({
|
||||||
|
children
|
||||||
|
}: Readonly<{ children: JSX.Element }>) {
|
||||||
const [primaryColor, whiteColor, blackColor, radius] = useLocalState(
|
const [primaryColor, whiteColor, blackColor, radius] = useLocalState(
|
||||||
(state) => [
|
(state) => [
|
||||||
state.primaryColor,
|
state.primaryColor,
|
||||||
|
@ -190,10 +190,10 @@ export function useCreateStockItem() {
|
|||||||
function StockItemDefaultMove({
|
function StockItemDefaultMove({
|
||||||
stockItem,
|
stockItem,
|
||||||
value
|
value
|
||||||
}: {
|
}: Readonly<{
|
||||||
stockItem: any;
|
stockItem: any;
|
||||||
value: any;
|
value: any;
|
||||||
}) {
|
}>) {
|
||||||
const { data } = useSuspenseQuery({
|
const { data } = useSuspenseQuery({
|
||||||
queryKey: [
|
queryKey: [
|
||||||
'location',
|
'location',
|
||||||
|
@ -23,7 +23,7 @@ export const Loadable = (Component: any) => (props: JSX.IntrinsicAttributes) =>
|
|||||||
</Suspense>
|
</Suspense>
|
||||||
);
|
);
|
||||||
|
|
||||||
export function LoadingItem({ item }: { item: any }): JSX.Element {
|
export function LoadingItem({ item }: Readonly<{ item: any }>): JSX.Element {
|
||||||
const Itm = Loadable(item);
|
const Itm = Loadable(item);
|
||||||
return <Itm />;
|
return <Itm />;
|
||||||
}
|
}
|
||||||
|
@ -195,10 +195,10 @@ function SpotlighPlayground() {
|
|||||||
function PlaygroundArea({
|
function PlaygroundArea({
|
||||||
title,
|
title,
|
||||||
content
|
content
|
||||||
}: {
|
}: Readonly<{
|
||||||
title: string;
|
title: string;
|
||||||
content: ReactNode;
|
content: ReactNode;
|
||||||
}) {
|
}>) {
|
||||||
return (
|
return (
|
||||||
<Accordion.Item value={`accordion-playground-${title}`}>
|
<Accordion.Item value={`accordion-playground-${title}`}>
|
||||||
<Accordion.Control>
|
<Accordion.Control>
|
||||||
|
@ -415,11 +415,11 @@ function HistoryTable({
|
|||||||
data,
|
data,
|
||||||
selection,
|
selection,
|
||||||
setSelection
|
setSelection
|
||||||
}: {
|
}: Readonly<{
|
||||||
data: ScanItem[];
|
data: ScanItem[];
|
||||||
selection: string[];
|
selection: string[];
|
||||||
setSelection: React.Dispatch<React.SetStateAction<string[]>>;
|
setSelection: React.Dispatch<React.SetStateAction<string[]>>;
|
||||||
}) {
|
}>) {
|
||||||
const toggleRow = (id: string) =>
|
const toggleRow = (id: string) =>
|
||||||
setSelection((current) =>
|
setSelection((current) =>
|
||||||
current.includes(id)
|
current.includes(id)
|
||||||
|
@ -209,7 +209,7 @@ function EmailContent() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function SsoContent({ dataProvider }: { dataProvider: any | undefined }) {
|
function SsoContent({ dataProvider }: Readonly<{ dataProvider: any }>) {
|
||||||
const [value, setValue] = useState<string>('');
|
const [value, setValue] = useState<string>('');
|
||||||
const [currentProviders, setCurrentProviders] = useState<[]>();
|
const [currentProviders, setCurrentProviders] = useState<[]>();
|
||||||
const { isLoading, data } = useQuery({
|
const { isLoading, data } = useQuery({
|
||||||
@ -249,7 +249,7 @@ function SsoContent({ dataProvider }: { dataProvider: any | undefined }) {
|
|||||||
/* renderer */
|
/* renderer */
|
||||||
if (isLoading) return <Loader />;
|
if (isLoading) return <Loader />;
|
||||||
|
|
||||||
function ProviderButton({ provider }: { provider: any }) {
|
function ProviderButton({ provider }: Readonly<{ provider: any }>) {
|
||||||
const button = (
|
const button = (
|
||||||
<Button
|
<Button
|
||||||
key={provider.id}
|
key={provider.id}
|
||||||
|
@ -28,7 +28,7 @@ export enum panelOptions {
|
|||||||
overall = 'overall'
|
overall = 'overall'
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function PartPricingPanel({ part }: { part: any }) {
|
export default function PartPricingPanel({ part }: Readonly<{ part: any }>) {
|
||||||
const user = useUserState();
|
const user = useUserState();
|
||||||
|
|
||||||
const { instance: pricing, instanceQuery } = useInstance({
|
const { instance: pricing, instanceQuery } = useInstance({
|
||||||
|
@ -29,10 +29,10 @@ import { NoPricingData } from './PricingPanel';
|
|||||||
export default function PriceBreakPanel({
|
export default function PriceBreakPanel({
|
||||||
part,
|
part,
|
||||||
endpoint
|
endpoint
|
||||||
}: {
|
}: Readonly<{
|
||||||
part: any;
|
part: any;
|
||||||
endpoint: ApiEndpoints;
|
endpoint: ApiEndpoints;
|
||||||
}) {
|
}>) {
|
||||||
const user = useUserState();
|
const user = useUserState();
|
||||||
const table = useTable('pricing-internal');
|
const table = useTable('pricing-internal');
|
||||||
|
|
||||||
@ -107,6 +107,7 @@ export default function PriceBreakPanel({
|
|||||||
const tableActions = useMemo(() => {
|
const tableActions = useMemo(() => {
|
||||||
return [
|
return [
|
||||||
<AddItemButton
|
<AddItemButton
|
||||||
|
key="add-price-break"
|
||||||
tooltip={t`Add Price Break`}
|
tooltip={t`Add Price Break`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
newPriceBreak.open();
|
newPriceBreak.open();
|
||||||
|
@ -39,11 +39,11 @@ export default function PricingOverviewPanel({
|
|||||||
part,
|
part,
|
||||||
pricing,
|
pricing,
|
||||||
doNavigation
|
doNavigation
|
||||||
}: {
|
}: Readonly<{
|
||||||
part: any;
|
part: any;
|
||||||
pricing: any;
|
pricing: any;
|
||||||
doNavigation: (panel: panelOptions) => void;
|
doNavigation: (panel: panelOptions) => void;
|
||||||
}): ReactNode {
|
}>): ReactNode {
|
||||||
const columns: any[] = useMemo(() => {
|
const columns: any[] = useMemo(() => {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,9 @@ import {
|
|||||||
} from '../../../tables/purchasing/SupplierPriceBreakTable';
|
} from '../../../tables/purchasing/SupplierPriceBreakTable';
|
||||||
import { NoPricingData } from './PricingPanel';
|
import { NoPricingData } from './PricingPanel';
|
||||||
|
|
||||||
export default function SupplierPricingPanel({ part }: { part: any }) {
|
export default function SupplierPricingPanel({
|
||||||
|
part
|
||||||
|
}: Readonly<{ part: any }>) {
|
||||||
const table = useTable('pricing-supplier');
|
const table = useTable('pricing-supplier');
|
||||||
|
|
||||||
const columns: TableColumn[] = useMemo(() => {
|
const columns: TableColumn[] = useMemo(() => {
|
||||||
|
@ -17,10 +17,10 @@ import { NoPricingData } from './PricingPanel';
|
|||||||
export default function VariantPricingPanel({
|
export default function VariantPricingPanel({
|
||||||
part,
|
part,
|
||||||
pricing
|
pricing
|
||||||
}: {
|
}: Readonly<{
|
||||||
part: any;
|
part: any;
|
||||||
pricing: any;
|
pricing: any;
|
||||||
}): ReactNode {
|
}>): ReactNode {
|
||||||
const table = useTable('pricing-variants');
|
const table = useTable('pricing-variants');
|
||||||
|
|
||||||
const columns: TableColumn[] = useMemo(() => {
|
const columns: TableColumn[] = useMemo(() => {
|
||||||
|
@ -5,10 +5,10 @@ import { IconAdjustments } from '@tabler/icons-react';
|
|||||||
export function TableColumnSelect({
|
export function TableColumnSelect({
|
||||||
columns,
|
columns,
|
||||||
onToggleColumn
|
onToggleColumn
|
||||||
}: {
|
}: Readonly<{
|
||||||
columns: any[];
|
columns: any[];
|
||||||
onToggleColumn: (columnName: string) => void;
|
onToggleColumn: (columnName: string) => void;
|
||||||
}) {
|
}>) {
|
||||||
return (
|
return (
|
||||||
<Menu shadow="xs" closeOnItemClick={false}>
|
<Menu shadow="xs" closeOnItemClick={false}>
|
||||||
<Menu.Target>
|
<Menu.Target>
|
||||||
|
@ -14,9 +14,9 @@ import {
|
|||||||
|
|
||||||
export function DownloadAction({
|
export function DownloadAction({
|
||||||
downloadCallback
|
downloadCallback
|
||||||
}: {
|
}: Readonly<{
|
||||||
downloadCallback: (fileFormat: string) => void;
|
downloadCallback: (fileFormat: string) => void;
|
||||||
}) {
|
}>) {
|
||||||
const formatOptions = [
|
const formatOptions = [
|
||||||
{ value: 'csv', label: t`CSV`, icon: <IconFileTypeCsv /> },
|
{ value: 'csv', label: t`CSV`, icon: <IconFileTypeCsv /> },
|
||||||
{ value: 'tsv', label: t`TSV`, icon: <IconFileText /> },
|
{ value: 'tsv', label: t`TSV`, icon: <IconFileText /> },
|
||||||
|
@ -28,10 +28,10 @@ import {
|
|||||||
function FilterItem({
|
function FilterItem({
|
||||||
flt,
|
flt,
|
||||||
tableState
|
tableState
|
||||||
}: {
|
}: Readonly<{
|
||||||
flt: TableFilter;
|
flt: TableFilter;
|
||||||
tableState: TableState;
|
tableState: TableState;
|
||||||
}) {
|
}>) {
|
||||||
const removeFilter = useCallback(() => {
|
const removeFilter = useCallback(() => {
|
||||||
let newFilters = tableState.activeFilters.filter(
|
let newFilters = tableState.activeFilters.filter(
|
||||||
(f) => f.name !== flt.name
|
(f) => f.name !== flt.name
|
||||||
@ -60,10 +60,10 @@ function FilterItem({
|
|||||||
function FilterAddGroup({
|
function FilterAddGroup({
|
||||||
tableState,
|
tableState,
|
||||||
availableFilters
|
availableFilters
|
||||||
}: {
|
}: Readonly<{
|
||||||
tableState: TableState;
|
tableState: TableState;
|
||||||
availableFilters: TableFilter[];
|
availableFilters: TableFilter[];
|
||||||
}) {
|
}>) {
|
||||||
const filterOptions: TableFilterChoice[] = useMemo(() => {
|
const filterOptions: TableFilterChoice[] = useMemo(() => {
|
||||||
// List of filter names which are already active on this table
|
// List of filter names which are already active on this table
|
||||||
let activeFilterNames: string[] = [];
|
let activeFilterNames: string[] = [];
|
||||||
@ -156,12 +156,12 @@ export function FilterSelectDrawer({
|
|||||||
tableState,
|
tableState,
|
||||||
opened,
|
opened,
|
||||||
onClose
|
onClose
|
||||||
}: {
|
}: Readonly<{
|
||||||
availableFilters: TableFilter[];
|
availableFilters: TableFilter[];
|
||||||
tableState: TableState;
|
tableState: TableState;
|
||||||
opened: boolean;
|
opened: boolean;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
}) {
|
}>) {
|
||||||
const [addFilter, setAddFilter] = useState<boolean>(false);
|
const [addFilter, setAddFilter] = useState<boolean>(false);
|
||||||
|
|
||||||
// Hide the "add filter" selection whenever the selected filters change
|
// Hide the "add filter" selection whenever the selected filters change
|
||||||
|
@ -143,12 +143,12 @@ export function InvenTreeTable<T extends Record<string, any>>({
|
|||||||
tableState,
|
tableState,
|
||||||
columns,
|
columns,
|
||||||
props
|
props
|
||||||
}: {
|
}: Readonly<{
|
||||||
url: string;
|
url: string;
|
||||||
tableState: TableState;
|
tableState: TableState;
|
||||||
columns: TableColumn<T>[];
|
columns: TableColumn<T>[];
|
||||||
props: InvenTreeTableProps<T>;
|
props: InvenTreeTableProps<T>;
|
||||||
}) {
|
}>) {
|
||||||
const {
|
const {
|
||||||
getTableColumnNames,
|
getTableColumnNames,
|
||||||
setTableColumnNames,
|
setTableColumnNames,
|
||||||
|
@ -6,9 +6,9 @@ import { useEffect, useState } from 'react';
|
|||||||
|
|
||||||
export function TableSearchInput({
|
export function TableSearchInput({
|
||||||
searchCallback
|
searchCallback
|
||||||
}: {
|
}: Readonly<{
|
||||||
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, 500);
|
||||||
|
|
||||||
|
@ -16,13 +16,13 @@ export function TableHoverCard({
|
|||||||
title, // The title of the hovercard
|
title, // The title of the hovercard
|
||||||
icon, // The icon to display
|
icon, // The icon to display
|
||||||
iconColor // The icon color
|
iconColor // The icon color
|
||||||
}: {
|
}: Readonly<{
|
||||||
value: any;
|
value: any;
|
||||||
extra?: ReactNode;
|
extra?: ReactNode;
|
||||||
title?: string;
|
title?: string;
|
||||||
icon?: InvenTreeIconType;
|
icon?: InvenTreeIconType;
|
||||||
iconColor?: string;
|
iconColor?: string;
|
||||||
}) {
|
}>) {
|
||||||
const extraItems: ReactNode = useMemo(() => {
|
const extraItems: ReactNode = useMemo(() => {
|
||||||
if (Array.isArray(extra)) {
|
if (Array.isArray(extra)) {
|
||||||
if (extra.length == 0) {
|
if (extra.length == 0) {
|
||||||
|
@ -65,11 +65,11 @@ export function BomTable({
|
|||||||
partId,
|
partId,
|
||||||
partLocked,
|
partLocked,
|
||||||
params = {}
|
params = {}
|
||||||
}: {
|
}: Readonly<{
|
||||||
partId: number;
|
partId: number;
|
||||||
partLocked?: boolean;
|
partLocked?: boolean;
|
||||||
params?: any;
|
params?: any;
|
||||||
}) {
|
}>) {
|
||||||
const user = useUserState();
|
const user = useUserState();
|
||||||
const table = useTable('bom');
|
const table = useTable('bom');
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@ -507,18 +507,21 @@ export function BomTable({
|
|||||||
const tableActions = useMemo(() => {
|
const tableActions = useMemo(() => {
|
||||||
return [
|
return [
|
||||||
<ActionButton
|
<ActionButton
|
||||||
|
key="import-bom"
|
||||||
hidden={partLocked || !user.hasAddRole(UserRoles.part)}
|
hidden={partLocked || !user.hasAddRole(UserRoles.part)}
|
||||||
tooltip={t`Import BOM Data`}
|
tooltip={t`Import BOM Data`}
|
||||||
icon={<IconFileArrowLeft />}
|
icon={<IconFileArrowLeft />}
|
||||||
onClick={() => importBomItem.open()}
|
onClick={() => importBomItem.open()}
|
||||||
/>,
|
/>,
|
||||||
<ActionButton
|
<ActionButton
|
||||||
|
key="validate-bom"
|
||||||
hidden={partLocked || !user.hasChangeRole(UserRoles.part)}
|
hidden={partLocked || !user.hasChangeRole(UserRoles.part)}
|
||||||
tooltip={t`Validate BOM`}
|
tooltip={t`Validate BOM`}
|
||||||
icon={<IconCircleCheck />}
|
icon={<IconCircleCheck />}
|
||||||
onClick={() => validateBom.open()}
|
onClick={() => validateBom.open()}
|
||||||
/>,
|
/>,
|
||||||
<AddItemButton
|
<AddItemButton
|
||||||
|
key="add-bom-item"
|
||||||
hidden={partLocked || !user.hasAddRole(UserRoles.part)}
|
hidden={partLocked || !user.hasAddRole(UserRoles.part)}
|
||||||
tooltip={t`Add BOM Item`}
|
tooltip={t`Add BOM Item`}
|
||||||
onClick={() => newBomItem.open()}
|
onClick={() => newBomItem.open()}
|
||||||
|
@ -18,10 +18,10 @@ import { InvenTreeTable } from '../InvenTreeTable';
|
|||||||
export function UsedInTable({
|
export function UsedInTable({
|
||||||
partId,
|
partId,
|
||||||
params = {}
|
params = {}
|
||||||
}: {
|
}: Readonly<{
|
||||||
partId: number;
|
partId: number;
|
||||||
params?: any;
|
params?: any;
|
||||||
}) {
|
}>) {
|
||||||
const table = useTable('usedin');
|
const table = useTable('usedin');
|
||||||
|
|
||||||
const tableColumns: TableColumn[] = useMemo(() => {
|
const tableColumns: TableColumn[] = useMemo(() => {
|
||||||
|
@ -33,11 +33,11 @@ export function BuildOrderTable({
|
|||||||
partId,
|
partId,
|
||||||
parentBuildId,
|
parentBuildId,
|
||||||
salesOrderId
|
salesOrderId
|
||||||
}: {
|
}: Readonly<{
|
||||||
partId?: number;
|
partId?: number;
|
||||||
parentBuildId?: number;
|
parentBuildId?: number;
|
||||||
salesOrderId?: number;
|
salesOrderId?: number;
|
||||||
}) {
|
}>) {
|
||||||
const tableColumns = useMemo(() => {
|
const tableColumns = useMemo(() => {
|
||||||
return [
|
return [
|
||||||
ReferenceColumn({}),
|
ReferenceColumn({}),
|
||||||
|
@ -22,10 +22,10 @@ import { RowAction, RowDeleteAction, RowEditAction } from '../RowActions';
|
|||||||
export function AddressTable({
|
export function AddressTable({
|
||||||
companyId,
|
companyId,
|
||||||
params
|
params
|
||||||
}: {
|
}: Readonly<{
|
||||||
companyId: number;
|
companyId: number;
|
||||||
params?: any;
|
params?: any;
|
||||||
}) {
|
}>) {
|
||||||
const user = useUserState();
|
const user = useUserState();
|
||||||
|
|
||||||
const table = useTable('address');
|
const table = useTable('address');
|
||||||
@ -179,6 +179,7 @@ export function AddressTable({
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
<AddItemButton
|
<AddItemButton
|
||||||
|
key="add-address"
|
||||||
tooltip={t`Add Address`}
|
tooltip={t`Add Address`}
|
||||||
onClick={() => newAddress.open()}
|
onClick={() => newAddress.open()}
|
||||||
hidden={!can_add}
|
hidden={!can_add}
|
||||||
|
@ -28,10 +28,10 @@ import { RowAction, RowEditAction } from '../RowActions';
|
|||||||
export function CompanyTable({
|
export function CompanyTable({
|
||||||
params,
|
params,
|
||||||
path
|
path
|
||||||
}: {
|
}: Readonly<{
|
||||||
params?: any;
|
params?: any;
|
||||||
path?: string;
|
path?: string;
|
||||||
}) {
|
}>) {
|
||||||
const table = useTable('company');
|
const table = useTable('company');
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@ -120,6 +120,7 @@ export function CompanyTable({
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
<AddItemButton
|
<AddItemButton
|
||||||
|
key="add-company"
|
||||||
tooltip={t`Add Company`}
|
tooltip={t`Add Company`}
|
||||||
onClick={() => newCompany.open()}
|
onClick={() => newCompany.open()}
|
||||||
hidden={!can_add}
|
hidden={!can_add}
|
||||||
|
@ -20,10 +20,10 @@ import { RowAction, RowDeleteAction, RowEditAction } from '../RowActions';
|
|||||||
export function ContactTable({
|
export function ContactTable({
|
||||||
companyId,
|
companyId,
|
||||||
params
|
params
|
||||||
}: {
|
}: Readonly<{
|
||||||
companyId: number;
|
companyId: number;
|
||||||
params?: any;
|
params?: any;
|
||||||
}) {
|
}>) {
|
||||||
const user = useUserState();
|
const user = useUserState();
|
||||||
|
|
||||||
const table = useTable('contact');
|
const table = useTable('contact');
|
||||||
@ -126,6 +126,7 @@ export function ContactTable({
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
<AddItemButton
|
<AddItemButton
|
||||||
|
key="add-contact"
|
||||||
tooltip={t`Add contact`}
|
tooltip={t`Add contact`}
|
||||||
onClick={() => newContact.open()}
|
onClick={() => newContact.open()}
|
||||||
hidden={!can_add}
|
hidden={!can_add}
|
||||||
|
@ -94,10 +94,10 @@ function attachmentTableColumns(): TableColumn[] {
|
|||||||
export function AttachmentTable({
|
export function AttachmentTable({
|
||||||
model_type,
|
model_type,
|
||||||
model_id
|
model_id
|
||||||
}: {
|
}: Readonly<{
|
||||||
model_type: ModelType;
|
model_type: ModelType;
|
||||||
model_id: number;
|
model_id: number;
|
||||||
}): ReactNode {
|
}>): ReactNode {
|
||||||
const user = useUserState();
|
const user = useUserState();
|
||||||
const table = useTable(`${model_type}-attachments`);
|
const table = useTable(`${model_type}-attachments`);
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ interface MachineI {
|
|||||||
restart_required: boolean;
|
restart_required: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
function MachineStatusIndicator({ machine }: { machine: MachineI }) {
|
function MachineStatusIndicator({ machine }: Readonly<{ machine: MachineI }>) {
|
||||||
const style = { marginLeft: '4px' };
|
const style = { marginLeft: '4px' };
|
||||||
|
|
||||||
// machine is not active, show a gray dot
|
// machine is not active, show a gray dot
|
||||||
@ -142,10 +142,10 @@ export function useMachineTypeDriver({
|
|||||||
function MachineDrawer({
|
function MachineDrawer({
|
||||||
machinePk,
|
machinePk,
|
||||||
refreshTable
|
refreshTable
|
||||||
}: {
|
}: Readonly<{
|
||||||
machinePk: string;
|
machinePk: string;
|
||||||
refreshTable: () => void;
|
refreshTable: () => void;
|
||||||
}) {
|
}>) {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const {
|
const {
|
||||||
data: machine,
|
data: machine,
|
||||||
@ -406,11 +406,11 @@ export function MachineListTable({
|
|||||||
props,
|
props,
|
||||||
renderMachineDrawer = true,
|
renderMachineDrawer = true,
|
||||||
createProps
|
createProps
|
||||||
}: {
|
}: Readonly<{
|
||||||
props: InvenTreeTableProps;
|
props: InvenTreeTableProps;
|
||||||
renderMachineDrawer?: boolean;
|
renderMachineDrawer?: boolean;
|
||||||
createProps?: { machine_type?: string; driver?: string };
|
createProps?: { machine_type?: string; driver?: string };
|
||||||
}) {
|
}>) {
|
||||||
const { machineTypes, machineDrivers } = useMachineTypeDriver();
|
const { machineTypes, machineDrivers } = useMachineTypeDriver();
|
||||||
|
|
||||||
const table = useTable('machine');
|
const table = useTable('machine');
|
||||||
@ -543,6 +543,7 @@ export function MachineListTable({
|
|||||||
const tableActions = useMemo(() => {
|
const tableActions = useMemo(() => {
|
||||||
return [
|
return [
|
||||||
<AddItemButton
|
<AddItemButton
|
||||||
|
key="outline"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setCreateFormMachineType(null);
|
setCreateFormMachineType(null);
|
||||||
|
@ -45,7 +45,9 @@ export interface MachineDriverI {
|
|||||||
driver_errors: string[];
|
driver_errors: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
function MachineTypeDrawer({ machineTypeSlug }: { machineTypeSlug: string }) {
|
function MachineTypeDrawer({
|
||||||
|
machineTypeSlug
|
||||||
|
}: Readonly<{ machineTypeSlug: string }>) {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const { machineTypes, refresh, isFetching } = useMachineTypeDriver({
|
const { machineTypes, refresh, isFetching } = useMachineTypeDriver({
|
||||||
@ -169,9 +171,9 @@ function MachineTypeDrawer({ machineTypeSlug }: { machineTypeSlug: string }) {
|
|||||||
|
|
||||||
function MachineDriverDrawer({
|
function MachineDriverDrawer({
|
||||||
machineDriverSlug
|
machineDriverSlug
|
||||||
}: {
|
}: Readonly<{
|
||||||
machineDriverSlug: string;
|
machineDriverSlug: string;
|
||||||
}) {
|
}>) {
|
||||||
const { machineDrivers, machineTypes, refresh, isFetching } =
|
const { machineDrivers, machineTypes, refresh, isFetching } =
|
||||||
useMachineTypeDriver();
|
useMachineTypeDriver();
|
||||||
const machineDriver = useMemo(
|
const machineDriver = useMemo(
|
||||||
@ -306,9 +308,9 @@ function MachineDriverDrawer({
|
|||||||
*/
|
*/
|
||||||
export function MachineTypeListTable({
|
export function MachineTypeListTable({
|
||||||
props
|
props
|
||||||
}: {
|
}: Readonly<{
|
||||||
props: InvenTreeTableProps;
|
props: InvenTreeTableProps;
|
||||||
}) {
|
}>) {
|
||||||
const table = useTable('machineTypes');
|
const table = useTable('machineTypes');
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
@ -13,12 +13,12 @@ export function NotificationTable({
|
|||||||
tableState,
|
tableState,
|
||||||
tableActions,
|
tableActions,
|
||||||
actions
|
actions
|
||||||
}: {
|
}: Readonly<{
|
||||||
params: any;
|
params: any;
|
||||||
tableState: TableState;
|
tableState: TableState;
|
||||||
tableActions: any[];
|
tableActions: any[];
|
||||||
actions: (record: any) => RowAction[];
|
actions: (record: any) => RowAction[];
|
||||||
}) {
|
}>) {
|
||||||
const columns: TableColumn[] = useMemo(() => {
|
const columns: TableColumn[] = useMemo(() => {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
@ -34,11 +34,11 @@ function ParameterCell({
|
|||||||
record,
|
record,
|
||||||
template,
|
template,
|
||||||
canEdit
|
canEdit
|
||||||
}: {
|
}: Readonly<{
|
||||||
record: any;
|
record: any;
|
||||||
template: any;
|
template: any;
|
||||||
canEdit: boolean;
|
canEdit: boolean;
|
||||||
}) {
|
}>) {
|
||||||
const { hovered, ref } = useHover();
|
const { hovered, ref } = useHover();
|
||||||
|
|
||||||
// Find matching template parameter
|
// Find matching template parameter
|
||||||
@ -92,9 +92,9 @@ function ParameterCell({
|
|||||||
|
|
||||||
export default function ParametricPartTable({
|
export default function ParametricPartTable({
|
||||||
categoryId
|
categoryId
|
||||||
}: {
|
}: Readonly<{
|
||||||
categoryId?: any;
|
categoryId?: any;
|
||||||
}) {
|
}>) {
|
||||||
const table = useTable('parametric-parts');
|
const table = useTable('parametric-parts');
|
||||||
const user = useUserState();
|
const user = useUserState();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
@ -25,7 +25,7 @@ import { RowAction, RowEditAction } from '../RowActions';
|
|||||||
/**
|
/**
|
||||||
* PartCategoryTable - Displays a table of part categories
|
* PartCategoryTable - Displays a table of part categories
|
||||||
*/
|
*/
|
||||||
export function PartCategoryTable({ parentId }: { parentId?: any }) {
|
export function PartCategoryTable({ parentId }: Readonly<{ parentId?: any }>) {
|
||||||
const table = useTable('partcategory');
|
const table = useTable('partcategory');
|
||||||
const user = useUserState();
|
const user = useUserState();
|
||||||
|
|
||||||
@ -109,6 +109,7 @@ export function PartCategoryTable({ parentId }: { parentId?: any }) {
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
<AddItemButton
|
<AddItemButton
|
||||||
|
key="add-part-category"
|
||||||
tooltip={t`Add Part Category`}
|
tooltip={t`Add Part Category`}
|
||||||
onClick={() => newCategory.open()}
|
onClick={() => newCategory.open()}
|
||||||
hidden={!can_add}
|
hidden={!can_add}
|
||||||
|
@ -73,7 +73,7 @@ function partTableColumns(): TableColumn[] {
|
|||||||
|
|
||||||
if (min_stock > stock) {
|
if (min_stock > stock) {
|
||||||
extra.push(
|
extra.push(
|
||||||
<Text key="min-stock" color="orange">
|
<Text key="min-stock" c="orange">
|
||||||
{t`Minimum stock` + `: ${min_stock}`}
|
{t`Minimum stock` + `: ${min_stock}`}
|
||||||
</Text>
|
</Text>
|
||||||
);
|
);
|
||||||
@ -144,7 +144,7 @@ function partTableColumns(): TableColumn[] {
|
|||||||
<Group gap="xs" justify="left" wrap="nowrap">
|
<Group gap="xs" justify="left" wrap="nowrap">
|
||||||
<Text c={color}>{text}</Text>
|
<Text c={color}>{text}</Text>
|
||||||
{record.units && (
|
{record.units && (
|
||||||
<Text size="xs" color={color}>
|
<Text size="xs" c={color}>
|
||||||
[{record.units}]
|
[{record.units}]
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
@ -312,10 +312,10 @@ function partTableFilters(): TableFilter[] {
|
|||||||
export function PartListTable({
|
export function PartListTable({
|
||||||
props,
|
props,
|
||||||
defaultPartData
|
defaultPartData
|
||||||
}: {
|
}: Readonly<{
|
||||||
props: InvenTreeTableProps;
|
props: InvenTreeTableProps;
|
||||||
defaultPartData?: any;
|
defaultPartData?: any;
|
||||||
}) {
|
}>) {
|
||||||
const tableColumns = useMemo(() => partTableColumns(), []);
|
const tableColumns = useMemo(() => partTableColumns(), []);
|
||||||
const tableFilters = useMemo(() => partTableFilters(), []);
|
const tableFilters = useMemo(() => partTableFilters(), []);
|
||||||
|
|
||||||
@ -338,6 +338,7 @@ export function PartListTable({
|
|||||||
const tableActions = useMemo(() => {
|
const tableActions = useMemo(() => {
|
||||||
return [
|
return [
|
||||||
<AddItemButton
|
<AddItemButton
|
||||||
|
key="add-part"
|
||||||
hidden={!user.hasAddRole(UserRoles.part)}
|
hidden={!user.hasAddRole(UserRoles.part)}
|
||||||
tooltip={t`Add Part`}
|
tooltip={t`Add Part`}
|
||||||
onClick={() => newPart.open()}
|
onClick={() => newPart.open()}
|
||||||
|
@ -127,7 +127,7 @@ export function PartThumbTable({
|
|||||||
search = '',
|
search = '',
|
||||||
pk,
|
pk,
|
||||||
setImage
|
setImage
|
||||||
}: ThumbTableProps) {
|
}: Readonly<ThumbTableProps>) {
|
||||||
const [thumbImage, setThumbImage] = useState<string | null>(null);
|
const [thumbImage, setThumbImage] = useState<string | null>(null);
|
||||||
const [filterInput, setFilterInput] = useState<string>('');
|
const [filterInput, setFilterInput] = useState<string>('');
|
||||||
const [filterQuery, setFilterQuery] = useState<string>(search);
|
const [filterQuery, setFilterQuery] = useState<string>(search);
|
||||||
|
@ -7,7 +7,7 @@ import { PartListTable } from './PartTable';
|
|||||||
/**
|
/**
|
||||||
* Display variant parts for the specified parent part
|
* Display variant parts for the specified parent part
|
||||||
*/
|
*/
|
||||||
export function PartVariantTable({ part }: { part: any }) {
|
export function PartVariantTable({ part }: Readonly<{ part: any }>) {
|
||||||
const tableFilters: TableFilter[] = useMemo(() => {
|
const tableFilters: TableFilter[] = useMemo(() => {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
@ -22,7 +22,9 @@ import { RowAction, RowDeleteAction } from '../RowActions';
|
|||||||
/**
|
/**
|
||||||
* Construct a table listing related parts for a given part
|
* Construct a table listing related parts for a given part
|
||||||
*/
|
*/
|
||||||
export function RelatedPartTable({ partId }: { partId: number }): ReactNode {
|
export function RelatedPartTable({
|
||||||
|
partId
|
||||||
|
}: Readonly<{ partId: number }>): ReactNode {
|
||||||
const table = useTable('relatedparts');
|
const table = useTable('relatedparts');
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@ -103,6 +105,7 @@ export function RelatedPartTable({ partId }: { partId: number }): ReactNode {
|
|||||||
const tableActions: ReactNode[] = useMemo(() => {
|
const tableActions: ReactNode[] = useMemo(() => {
|
||||||
return [
|
return [
|
||||||
<AddItemButton
|
<AddItemButton
|
||||||
|
key="add-related-part"
|
||||||
tooltip={t`Add related part`}
|
tooltip={t`Add related part`}
|
||||||
hidden={!user.hasAddRole(UserRoles.part)}
|
hidden={!user.hasAddRole(UserRoles.part)}
|
||||||
onClick={() => newRelatedPart.open()}
|
onClick={() => newRelatedPart.open()}
|
||||||
|
@ -19,9 +19,9 @@ import { RowAction, RowDeleteAction, RowEditAction } from '../RowActions';
|
|||||||
|
|
||||||
export default function ManufacturerPartParameterTable({
|
export default function ManufacturerPartParameterTable({
|
||||||
params
|
params
|
||||||
}: {
|
}: Readonly<{
|
||||||
params: any;
|
params: any;
|
||||||
}) {
|
}>) {
|
||||||
const table = useTable('manufacturer-part-parameter');
|
const table = useTable('manufacturer-part-parameter');
|
||||||
const user = useUserState();
|
const user = useUserState();
|
||||||
|
|
||||||
|
@ -23,7 +23,9 @@ import { RowAction, RowDeleteAction, RowEditAction } from '../RowActions';
|
|||||||
/*
|
/*
|
||||||
* Construct a table listing manufacturer parts
|
* Construct a table listing manufacturer parts
|
||||||
*/
|
*/
|
||||||
export function ManufacturerPartTable({ params }: { params: any }): ReactNode {
|
export function ManufacturerPartTable({
|
||||||
|
params
|
||||||
|
}: Readonly<{ params: any }>): ReactNode {
|
||||||
const table = useTable('manufacturerparts');
|
const table = useTable('manufacturerparts');
|
||||||
|
|
||||||
const user = useUserState();
|
const user = useUserState();
|
||||||
@ -100,6 +102,7 @@ export function ManufacturerPartTable({ params }: { params: any }): ReactNode {
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
<AddItemButton
|
<AddItemButton
|
||||||
|
key="add-manufacturer-part"
|
||||||
tooltip={t`Add Manufacturer Part`}
|
tooltip={t`Add Manufacturer Part`}
|
||||||
onClick={() => createManufacturerPart.open()}
|
onClick={() => createManufacturerPart.open()}
|
||||||
hidden={!can_add}
|
hidden={!can_add}
|
||||||
|
@ -53,13 +53,13 @@ export function PurchaseOrderLineItemTable({
|
|||||||
currency,
|
currency,
|
||||||
supplierId,
|
supplierId,
|
||||||
params
|
params
|
||||||
}: {
|
}: Readonly<{
|
||||||
order: any;
|
order: any;
|
||||||
orderId: number;
|
orderId: number;
|
||||||
currency: string;
|
currency: string;
|
||||||
supplierId?: number;
|
supplierId?: number;
|
||||||
params?: any;
|
params?: any;
|
||||||
}) {
|
}>) {
|
||||||
const table = useTable('purchase-order-line-item');
|
const table = useTable('purchase-order-line-item');
|
||||||
|
|
||||||
const user = useUserState();
|
const user = useUserState();
|
||||||
@ -333,12 +333,14 @@ export function PurchaseOrderLineItemTable({
|
|||||||
const tableActions = useMemo(() => {
|
const tableActions = useMemo(() => {
|
||||||
return [
|
return [
|
||||||
<ActionButton
|
<ActionButton
|
||||||
|
key="import-line-items"
|
||||||
hidden={!orderOpen || !user.hasAddRole(UserRoles.purchase_order)}
|
hidden={!orderOpen || !user.hasAddRole(UserRoles.purchase_order)}
|
||||||
tooltip={t`Import Line Items`}
|
tooltip={t`Import Line Items`}
|
||||||
icon={<IconFileArrowLeft />}
|
icon={<IconFileArrowLeft />}
|
||||||
onClick={() => importLineItems.open()}
|
onClick={() => importLineItems.open()}
|
||||||
/>,
|
/>,
|
||||||
<AddItemButton
|
<AddItemButton
|
||||||
|
key="add-line-item"
|
||||||
tooltip={t`Add line item`}
|
tooltip={t`Add line item`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setInitialData({
|
setInitialData({
|
||||||
@ -349,6 +351,7 @@ export function PurchaseOrderLineItemTable({
|
|||||||
hidden={!orderOpen || !user?.hasAddRole(UserRoles.purchase_order)}
|
hidden={!orderOpen || !user?.hasAddRole(UserRoles.purchase_order)}
|
||||||
/>,
|
/>,
|
||||||
<ActionButton
|
<ActionButton
|
||||||
|
key="receive-items"
|
||||||
text={t`Receive items`}
|
text={t`Receive items`}
|
||||||
icon={<IconSquareArrowRight />}
|
icon={<IconSquareArrowRight />}
|
||||||
onClick={() => receiveLineItems.open()}
|
onClick={() => receiveLineItems.open()}
|
||||||
|
@ -38,10 +38,10 @@ import { InvenTreeTable } from '../InvenTreeTable';
|
|||||||
export function PurchaseOrderTable({
|
export function PurchaseOrderTable({
|
||||||
supplierId,
|
supplierId,
|
||||||
supplierPartId
|
supplierPartId
|
||||||
}: {
|
}: Readonly<{
|
||||||
supplierId?: number;
|
supplierId?: number;
|
||||||
supplierPartId?: number;
|
supplierPartId?: number;
|
||||||
}) {
|
}>) {
|
||||||
const table = useTable('purchase-order');
|
const table = useTable('purchase-order');
|
||||||
const user = useUserState();
|
const user = useUserState();
|
||||||
|
|
||||||
@ -137,6 +137,7 @@ export function PurchaseOrderTable({
|
|||||||
const tableActions = useMemo(() => {
|
const tableActions = useMemo(() => {
|
||||||
return [
|
return [
|
||||||
<AddItemButton
|
<AddItemButton
|
||||||
|
key="add-purchase-order"
|
||||||
tooltip={t`Add Purchase Order`}
|
tooltip={t`Add Purchase Order`}
|
||||||
onClick={() => newPurchaseOrder.open()}
|
onClick={() => newPurchaseOrder.open()}
|
||||||
hidden={!user.hasAddRole(UserRoles.purchase_order)}
|
hidden={!user.hasAddRole(UserRoles.purchase_order)}
|
||||||
|
@ -33,7 +33,9 @@ import { TableHoverCard } from '../TableHoverCard';
|
|||||||
* Construct a table listing supplier parts
|
* Construct a table listing supplier parts
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export function SupplierPartTable({ params }: { params: any }): ReactNode {
|
export function SupplierPartTable({
|
||||||
|
params
|
||||||
|
}: Readonly<{ params: any }>): ReactNode {
|
||||||
const table = useTable('supplierparts');
|
const table = useTable('supplierparts');
|
||||||
|
|
||||||
const user = useUserState();
|
const user = useUserState();
|
||||||
@ -173,6 +175,7 @@ export function SupplierPartTable({ params }: { params: any }): ReactNode {
|
|||||||
const tableActions = useMemo(() => {
|
const tableActions = useMemo(() => {
|
||||||
return [
|
return [
|
||||||
<AddItemButton
|
<AddItemButton
|
||||||
|
key="add-supplier-part"
|
||||||
tooltip={t`Add supplier part`}
|
tooltip={t`Add supplier part`}
|
||||||
onClick={() => addSupplierPart.open()}
|
onClick={() => addSupplierPart.open()}
|
||||||
hidden={!user.hasAddRole(UserRoles.purchase_order)}
|
hidden={!user.hasAddRole(UserRoles.purchase_order)}
|
||||||
|
@ -112,9 +112,9 @@ export function SupplierPriceBreakColumns(): TableColumn[] {
|
|||||||
|
|
||||||
export default function SupplierPriceBreakTable({
|
export default function SupplierPriceBreakTable({
|
||||||
supplierPartId
|
supplierPartId
|
||||||
}: {
|
}: Readonly<{
|
||||||
supplierPartId: number;
|
supplierPartId: number;
|
||||||
}) {
|
}>) {
|
||||||
const table = useTable('supplierpricebreaks');
|
const table = useTable('supplierpricebreaks');
|
||||||
|
|
||||||
const user = useUserState();
|
const user = useUserState();
|
||||||
@ -165,6 +165,7 @@ export default function SupplierPriceBreakTable({
|
|||||||
const tableActions = useMemo(() => {
|
const tableActions = useMemo(() => {
|
||||||
return [
|
return [
|
||||||
<AddItemButton
|
<AddItemButton
|
||||||
|
key="add-price-break"
|
||||||
tooltip={t`Add Price Break`}
|
tooltip={t`Add Price Break`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
newPriceBreak.open();
|
newPriceBreak.open();
|
||||||
|
@ -32,7 +32,7 @@ import {
|
|||||||
} from '../Filter';
|
} from '../Filter';
|
||||||
import { InvenTreeTable } from '../InvenTreeTable';
|
import { InvenTreeTable } from '../InvenTreeTable';
|
||||||
|
|
||||||
export function ReturnOrderTable({ params }: { params?: any }) {
|
export function ReturnOrderTable({ params }: Readonly<{ params?: any }>) {
|
||||||
const table = useTable('return-orders');
|
const table = useTable('return-orders');
|
||||||
const user = useUserState();
|
const user = useUserState();
|
||||||
|
|
||||||
@ -125,6 +125,7 @@ export function ReturnOrderTable({ params }: { params?: any }) {
|
|||||||
const tableActions = useMemo(() => {
|
const tableActions = useMemo(() => {
|
||||||
return [
|
return [
|
||||||
<AddItemButton
|
<AddItemButton
|
||||||
|
key="add-return-order"
|
||||||
tooltip={t`Add Return Order`}
|
tooltip={t`Add Return Order`}
|
||||||
onClick={() => newReturnOrder.open()}
|
onClick={() => newReturnOrder.open()}
|
||||||
hidden={!user.hasAddRole(UserRoles.return_order)}
|
hidden={!user.hasAddRole(UserRoles.return_order)}
|
||||||
|
@ -36,10 +36,10 @@ import { InvenTreeTable } from '../InvenTreeTable';
|
|||||||
export function SalesOrderTable({
|
export function SalesOrderTable({
|
||||||
partId,
|
partId,
|
||||||
customerId
|
customerId
|
||||||
}: {
|
}: Readonly<{
|
||||||
partId?: number;
|
partId?: number;
|
||||||
customerId?: number;
|
customerId?: number;
|
||||||
}) {
|
}>) {
|
||||||
const table = useTable('sales-order');
|
const table = useTable('sales-order');
|
||||||
const user = useUserState();
|
const user = useUserState();
|
||||||
|
|
||||||
@ -93,6 +93,7 @@ export function SalesOrderTable({
|
|||||||
const tableActions = useMemo(() => {
|
const tableActions = useMemo(() => {
|
||||||
return [
|
return [
|
||||||
<AddItemButton
|
<AddItemButton
|
||||||
|
key="add-sales-order"
|
||||||
tooltip={t`Add Sales Order`}
|
tooltip={t`Add Sales Order`}
|
||||||
onClick={() => newSalesOrder.open()}
|
onClick={() => newSalesOrder.open()}
|
||||||
hidden={!user.hasAddRole(UserRoles.sales_order)}
|
hidden={!user.hasAddRole(UserRoles.sales_order)}
|
||||||
|
@ -38,10 +38,10 @@ export interface GroupDetailI {
|
|||||||
export function GroupDrawer({
|
export function GroupDrawer({
|
||||||
id,
|
id,
|
||||||
refreshTable
|
refreshTable
|
||||||
}: {
|
}: Readonly<{
|
||||||
id: string;
|
id: string;
|
||||||
refreshTable: () => void;
|
refreshTable: () => void;
|
||||||
}) {
|
}>) {
|
||||||
const {
|
const {
|
||||||
instance,
|
instance,
|
||||||
refreshInstance,
|
refreshInstance,
|
||||||
|
@ -58,10 +58,10 @@ export interface TemplateProps {
|
|||||||
export function TemplateDrawer({
|
export function TemplateDrawer({
|
||||||
id,
|
id,
|
||||||
templateProps
|
templateProps
|
||||||
}: {
|
}: Readonly<{
|
||||||
id: string | number;
|
id: string | number;
|
||||||
templateProps: TemplateProps;
|
templateProps: TemplateProps;
|
||||||
}) {
|
}>) {
|
||||||
const { templateEndpoint, printingEndpoint } = templateProps;
|
const { templateEndpoint, printingEndpoint } = templateProps;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@ -109,9 +109,9 @@ export function TemplateDrawer({
|
|||||||
|
|
||||||
export function TemplateTable({
|
export function TemplateTable({
|
||||||
templateProps
|
templateProps
|
||||||
}: {
|
}: Readonly<{
|
||||||
templateProps: TemplateProps;
|
templateProps: TemplateProps;
|
||||||
}) {
|
}>) {
|
||||||
const { templateEndpoint, additionalFormFields } = templateProps;
|
const { templateEndpoint, additionalFormFields } = templateProps;
|
||||||
|
|
||||||
const table = useTable(`${templateEndpoint}-template`);
|
const table = useTable(`${templateEndpoint}-template`);
|
||||||
|
@ -11,9 +11,9 @@ import { InvenTreeTable } from '../InvenTreeTable';
|
|||||||
|
|
||||||
export default function InstalledItemsTable({
|
export default function InstalledItemsTable({
|
||||||
parentId
|
parentId
|
||||||
}: {
|
}: Readonly<{
|
||||||
parentId?: number | string;
|
parentId?: number | string;
|
||||||
}) {
|
}>) {
|
||||||
const table = useTable('stock_item_install');
|
const table = useTable('stock_item_install');
|
||||||
const user = useUserState();
|
const user = useUserState();
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ function stockItemTableColumns(): TableColumn[] {
|
|||||||
if (available != quantity) {
|
if (available != quantity) {
|
||||||
if (available > 0) {
|
if (available > 0) {
|
||||||
extra.push(
|
extra.push(
|
||||||
<Text key="available" size="sm" color="orange">
|
<Text key="available" size="sm" c="orange">
|
||||||
{t`Available` + `: ${available}`}
|
{t`Available` + `: ${available}`}
|
||||||
</Text>
|
</Text>
|
||||||
);
|
);
|
||||||
@ -182,7 +182,7 @@ function stockItemTableColumns(): TableColumn[] {
|
|||||||
<Text
|
<Text
|
||||||
key="no-stock"
|
key="no-stock"
|
||||||
size="sm"
|
size="sm"
|
||||||
color="red"
|
c="red"
|
||||||
>{t`No stock available`}</Text>
|
>{t`No stock available`}</Text>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -207,7 +207,7 @@ function stockItemTableColumns(): TableColumn[] {
|
|||||||
<Group gap="xs" justify="left" wrap="nowrap">
|
<Group gap="xs" justify="left" wrap="nowrap">
|
||||||
<Text c={color}>{text}</Text>
|
<Text c={color}>{text}</Text>
|
||||||
{part.units && (
|
{part.units && (
|
||||||
<Text size="xs" color={color}>
|
<Text size="xs" c={color}>
|
||||||
[{part.units}]
|
[{part.units}]
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
@ -388,11 +388,11 @@ export function StockItemTable({
|
|||||||
params = {},
|
params = {},
|
||||||
allowAdd = false,
|
allowAdd = false,
|
||||||
tableName = 'stockitems'
|
tableName = 'stockitems'
|
||||||
}: {
|
}: Readonly<{
|
||||||
params?: any;
|
params?: any;
|
||||||
allowAdd?: boolean;
|
allowAdd?: boolean;
|
||||||
tableName: string;
|
tableName: string;
|
||||||
}) {
|
}>) {
|
||||||
let tableColumns = useMemo(() => stockItemTableColumns(), []);
|
let tableColumns = useMemo(() => stockItemTableColumns(), []);
|
||||||
let tableFilters = useMemo(() => stockItemTableFilters(), []);
|
let tableFilters = useMemo(() => stockItemTableFilters(), []);
|
||||||
|
|
||||||
@ -441,6 +441,7 @@ export function StockItemTable({
|
|||||||
let can_change_order = user.hasChangeRole(UserRoles.purchase_order);
|
let can_change_order = user.hasChangeRole(UserRoles.purchase_order);
|
||||||
return [
|
return [
|
||||||
<ActionDropdown
|
<ActionDropdown
|
||||||
|
key="stock-actions"
|
||||||
tooltip={t`Stock Actions`}
|
tooltip={t`Stock Actions`}
|
||||||
icon={<InvenTreeIcon icon="stock" />}
|
icon={<InvenTreeIcon icon="stock" />}
|
||||||
disabled={table.selectedRecords.length === 0}
|
disabled={table.selectedRecords.length === 0}
|
||||||
@ -531,6 +532,7 @@ export function StockItemTable({
|
|||||||
]}
|
]}
|
||||||
/>,
|
/>,
|
||||||
<AddItemButton
|
<AddItemButton
|
||||||
|
key="add-stock-item"
|
||||||
hidden={!allowAdd || !user.hasAddRole(UserRoles.stock)}
|
hidden={!allowAdd || !user.hasAddRole(UserRoles.stock)}
|
||||||
tooltip={t`Add Stock Item`}
|
tooltip={t`Add Stock Item`}
|
||||||
onClick={() => newStockItem.open()}
|
onClick={() => newStockItem.open()}
|
||||||
|
@ -43,10 +43,10 @@ import {
|
|||||||
export default function StockItemTestResultTable({
|
export default function StockItemTestResultTable({
|
||||||
partId,
|
partId,
|
||||||
itemId
|
itemId
|
||||||
}: {
|
}: Readonly<{
|
||||||
partId: number;
|
partId: number;
|
||||||
itemId: number;
|
itemId: number;
|
||||||
}) {
|
}>) {
|
||||||
const user = useUserState();
|
const user = useUserState();
|
||||||
const table = useTable('stocktests');
|
const table = useTable('stocktests');
|
||||||
|
|
||||||
@ -399,6 +399,7 @@ export default function StockItemTestResultTable({
|
|||||||
const tableActions = useMemo(() => {
|
const tableActions = useMemo(() => {
|
||||||
return [
|
return [
|
||||||
<AddItemButton
|
<AddItemButton
|
||||||
|
key="add-test-result"
|
||||||
tooltip={t`Add Test Result`}
|
tooltip={t`Add Test Result`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setSelectedTemplate(undefined);
|
setSelectedTemplate(undefined);
|
||||||
|
@ -25,7 +25,7 @@ import { RowAction, RowEditAction } from '../RowActions';
|
|||||||
/**
|
/**
|
||||||
* Stock location table
|
* Stock location table
|
||||||
*/
|
*/
|
||||||
export function StockLocationTable({ parentId }: { parentId?: any }) {
|
export function StockLocationTable({ parentId }: Readonly<{ parentId?: any }>) {
|
||||||
const table = useTable('stocklocation');
|
const table = useTable('stocklocation');
|
||||||
const user = useUserState();
|
const user = useUserState();
|
||||||
|
|
||||||
@ -130,6 +130,7 @@ export function StockLocationTable({ parentId }: { parentId?: any }) {
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
<AddItemButton
|
<AddItemButton
|
||||||
|
key="add-stock-location"
|
||||||
tooltip={t`Add Stock Location`}
|
tooltip={t`Add Stock Location`}
|
||||||
onClick={() => newLocation.open()}
|
onClick={() => newLocation.open()}
|
||||||
hidden={!can_add}
|
hidden={!can_add}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user