2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-02 03:30:54 +00:00

[PUI] Details Panel components (#6040)

* Add default_location to part filters

* Add Detail components

* Add Detail Image V1

* Remove piggyback change from different branch

* Remove unused code

* Add remove image modal

* Basic part image selection form

* Add Part Image selector Modal and fix PartThumb API pagination

* imports

* Add Image Upload modal

* Typescript and translation cleanup

* .

* Revert temporary workaround for existing_image

* Start adding fields

* .

* Modre fields and Icon manager

* Add most part detail fields

* .

* Final draft

* Remove unused TS

* More cleanup

* .

* Bump API version

* .

* Docstring oopsie
This commit is contained in:
Lavissa
2024-01-31 00:37:42 +01:00
committed by GitHub
parent 3bfde82394
commit fb71e847bb
18 changed files with 1716 additions and 9 deletions

View File

@ -0,0 +1,140 @@
import {
Icon123,
IconBinaryTree2,
IconBookmarks,
IconBuilding,
IconBuildingFactory2,
IconCalendarStats,
IconCheck,
IconClipboardList,
IconCopy,
IconCornerUpRightDouble,
IconCurrencyDollar,
IconExternalLink,
IconFileUpload,
IconGitBranch,
IconGridDots,
IconLayersLinked,
IconLink,
IconList,
IconListTree,
IconMapPinHeart,
IconNotes,
IconPackage,
IconPackages,
IconPaperclip,
IconPhoto,
IconQuestionMark,
IconRulerMeasure,
IconShoppingCart,
IconShoppingCartHeart,
IconStack2,
IconStatusChange,
IconTag,
IconTestPipe,
IconTool,
IconTools,
IconTrash,
IconTruck,
IconTruckDelivery,
IconUser,
IconUserStar,
IconUsersGroup,
IconVersions,
IconWorldCode,
IconX
} from '@tabler/icons-react';
import { IconFlag } from '@tabler/icons-react';
import { IconInfoCircle } from '@tabler/icons-react';
import { IconCalendarTime } from '@tabler/icons-react';
import { TablerIconsProps } from '@tabler/icons-react';
import React from 'react';
const icons: { [key: string]: (props: TablerIconsProps) => React.JSX.Element } =
{
description: IconInfoCircle,
variant_of: IconStatusChange,
unallocated_stock: IconPackage,
total_in_stock: IconPackages,
minimum_stock: IconFlag,
allocated_to_build_orders: IconTool,
allocated_to_sales_orders: IconTruck,
can_build: IconTools,
ordering: IconShoppingCart,
building: IconTool,
category: IconBinaryTree2,
IPN: Icon123,
revision: IconGitBranch,
units: IconRulerMeasure,
keywords: IconTag,
details: IconInfoCircle,
parameters: IconList,
stock: IconPackages,
variants: IconVersions,
allocations: IconBookmarks,
bom: IconListTree,
builds: IconTools,
used_in: IconStack2,
manufacturers: IconBuildingFactory2,
suppliers: IconBuilding,
purchase_orders: IconShoppingCart,
sales_orders: IconTruckDelivery,
scheduling: IconCalendarStats,
test_templates: IconTestPipe,
related_parts: IconLayersLinked,
attachments: IconPaperclip,
notes: IconNotes,
photo: IconPhoto,
upload: IconFileUpload,
reject: IconX,
select_image: IconGridDots,
delete: IconTrash,
// Part Icons
template: IconCopy,
assembly: IconTool,
component: IconGridDots,
trackable: IconCornerUpRightDouble,
purchaseable: IconShoppingCart,
saleable: IconCurrencyDollar,
virtual: IconWorldCode,
inactive: IconX,
external: IconExternalLink,
creation_date: IconCalendarTime,
default_location: IconMapPinHeart,
default_supplier: IconShoppingCartHeart,
link: IconLink,
responsible: IconUserStar,
pricing: IconCurrencyDollar,
stocktake: IconClipboardList,
user: IconUser,
group: IconUsersGroup,
check: IconCheck,
copy: IconCopy
};
/**
* Returns a Tabler Icon for the model field name supplied
* @param field string defining field name
*/
export function GetIcon(field: keyof typeof icons) {
return icons[field];
}
type IconProps = {
icon: string;
iconProps?: TablerIconsProps;
};
export function InvenTreeIcon(props: IconProps) {
let Icon: (props: TablerIconsProps) => React.JSX.Element;
if (props.icon in icons) {
Icon = GetIcon(props.icon);
} else {
Icon = IconQuestionMark;
}
return <Icon {...props.iconProps} />;
}