mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-01 13:06:45 +00:00
[React] Build improvements (#5859)
* Add filters for BuildTable * Add inline renderer for ProjectCode * Pass form response data to onFormSuccess callback * Create new build from build index * Edit existing build order * Add projectcode to list * Bug fixess
This commit is contained in:
parent
1640f605a0
commit
fb7020a85a
@ -49,7 +49,7 @@ export interface ApiFormProps {
|
|||||||
postFormContent?: JSX.Element | (() => JSX.Element);
|
postFormContent?: JSX.Element | (() => JSX.Element);
|
||||||
successMessage?: string;
|
successMessage?: string;
|
||||||
onClose?: () => void;
|
onClose?: () => void;
|
||||||
onFormSuccess?: () => void;
|
onFormSuccess?: (data: any) => void;
|
||||||
onFormError?: () => void;
|
onFormError?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ export function ApiForm({
|
|||||||
|
|
||||||
// Optionally call the onFormSuccess callback
|
// Optionally call the onFormSuccess callback
|
||||||
if (props.onFormSuccess) {
|
if (props.onFormSuccess) {
|
||||||
props.onFormSuccess();
|
props.onFormSuccess(response.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Optionally show a success message
|
// Optionally show a success message
|
||||||
|
@ -92,16 +92,16 @@ export function BarcodeActionDropdown({
|
|||||||
// Common action button for viewing a barcode
|
// Common action button for viewing a barcode
|
||||||
export function ViewBarcodeAction({
|
export function ViewBarcodeAction({
|
||||||
disabled = false,
|
disabled = false,
|
||||||
callback
|
onClick
|
||||||
}: {
|
}: {
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
callback?: () => void;
|
onClick?: () => void;
|
||||||
}): ActionDropdownItem {
|
}): ActionDropdownItem {
|
||||||
return {
|
return {
|
||||||
icon: <IconQrcode />,
|
icon: <IconQrcode />,
|
||||||
name: t`View`,
|
name: t`View`,
|
||||||
tooltip: t`View barcode`,
|
tooltip: t`View barcode`,
|
||||||
onClick: callback,
|
onClick: onClick,
|
||||||
disabled: disabled
|
disabled: disabled
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -109,16 +109,16 @@ export function ViewBarcodeAction({
|
|||||||
// Common action button for linking a custom barcode
|
// Common action button for linking a custom barcode
|
||||||
export function LinkBarcodeAction({
|
export function LinkBarcodeAction({
|
||||||
disabled = false,
|
disabled = false,
|
||||||
callback
|
onClick
|
||||||
}: {
|
}: {
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
callback?: () => void;
|
onClick?: () => void;
|
||||||
}): ActionDropdownItem {
|
}): ActionDropdownItem {
|
||||||
return {
|
return {
|
||||||
icon: <IconLink />,
|
icon: <IconLink />,
|
||||||
name: t`Link Barcode`,
|
name: t`Link Barcode`,
|
||||||
tooltip: t`Link custom barcode`,
|
tooltip: t`Link custom barcode`,
|
||||||
onClick: callback,
|
onClick: onClick,
|
||||||
disabled: disabled
|
disabled: disabled
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -126,16 +126,16 @@ export function LinkBarcodeAction({
|
|||||||
// Common action button for un-linking a custom barcode
|
// Common action button for un-linking a custom barcode
|
||||||
export function UnlinkBarcodeAction({
|
export function UnlinkBarcodeAction({
|
||||||
disabled = false,
|
disabled = false,
|
||||||
callback
|
onClick
|
||||||
}: {
|
}: {
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
callback?: () => void;
|
onClick?: () => void;
|
||||||
}): ActionDropdownItem {
|
}): ActionDropdownItem {
|
||||||
return {
|
return {
|
||||||
icon: <IconUnlink />,
|
icon: <IconUnlink />,
|
||||||
name: t`Unlink Barcode`,
|
name: t`Unlink Barcode`,
|
||||||
tooltip: t`Unlink custom barcode`,
|
tooltip: t`Unlink custom barcode`,
|
||||||
onClick: callback,
|
onClick: onClick,
|
||||||
disabled: disabled
|
disabled: disabled
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -144,17 +144,17 @@ export function UnlinkBarcodeAction({
|
|||||||
export function EditItemAction({
|
export function EditItemAction({
|
||||||
disabled = false,
|
disabled = false,
|
||||||
tooltip,
|
tooltip,
|
||||||
callback
|
onClick
|
||||||
}: {
|
}: {
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
tooltip?: string;
|
tooltip?: string;
|
||||||
callback?: () => void;
|
onClick?: () => void;
|
||||||
}): ActionDropdownItem {
|
}): ActionDropdownItem {
|
||||||
return {
|
return {
|
||||||
icon: <IconEdit color="blue" />,
|
icon: <IconEdit color="blue" />,
|
||||||
name: t`Edit`,
|
name: t`Edit`,
|
||||||
tooltip: tooltip ?? `Edit item`,
|
tooltip: tooltip ?? `Edit item`,
|
||||||
onClick: callback,
|
onClick: onClick,
|
||||||
disabled: disabled
|
disabled: disabled
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -163,17 +163,17 @@ export function EditItemAction({
|
|||||||
export function DeleteItemAction({
|
export function DeleteItemAction({
|
||||||
disabled = false,
|
disabled = false,
|
||||||
tooltip,
|
tooltip,
|
||||||
callback
|
onClick
|
||||||
}: {
|
}: {
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
tooltip?: string;
|
tooltip?: string;
|
||||||
callback?: () => void;
|
onClick?: () => void;
|
||||||
}): ActionDropdownItem {
|
}): ActionDropdownItem {
|
||||||
return {
|
return {
|
||||||
icon: <IconTrash color="red" />,
|
icon: <IconTrash color="red" />,
|
||||||
name: t`Delete`,
|
name: t`Delete`,
|
||||||
tooltip: tooltip ?? t`Delete item`,
|
tooltip: tooltip ?? t`Delete item`,
|
||||||
onClick: callback,
|
onClick: onClick,
|
||||||
disabled: disabled
|
disabled: disabled
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -182,17 +182,17 @@ export function DeleteItemAction({
|
|||||||
export function DuplicateItemAction({
|
export function DuplicateItemAction({
|
||||||
disabled = false,
|
disabled = false,
|
||||||
tooltip,
|
tooltip,
|
||||||
callback
|
onClick
|
||||||
}: {
|
}: {
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
tooltip?: string;
|
tooltip?: string;
|
||||||
callback?: () => void;
|
onClick?: () => void;
|
||||||
}): ActionDropdownItem {
|
}): ActionDropdownItem {
|
||||||
return {
|
return {
|
||||||
icon: <IconCopy color="green" />,
|
icon: <IconCopy color="green" />,
|
||||||
name: t`Duplicate`,
|
name: t`Duplicate`,
|
||||||
tooltip: tooltip ?? t`Duplicate item`,
|
tooltip: tooltip ?? t`Duplicate item`,
|
||||||
onClick: callback,
|
onClick: onClick,
|
||||||
disabled: disabled
|
disabled: disabled
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
14
src/frontend/src/components/render/Generic.tsx
Normal file
14
src/frontend/src/components/render/Generic.tsx
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { ReactNode } from 'react';
|
||||||
|
|
||||||
|
import { RenderInlineModel } from './Instance';
|
||||||
|
|
||||||
|
export function RenderProjectCode({ instance }: { instance: any }): ReactNode {
|
||||||
|
return (
|
||||||
|
instance && (
|
||||||
|
<RenderInlineModel
|
||||||
|
primary={instance.code}
|
||||||
|
secondary={instance.description}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
@ -12,6 +12,7 @@ import {
|
|||||||
RenderManufacturerPart,
|
RenderManufacturerPart,
|
||||||
RenderSupplierPart
|
RenderSupplierPart
|
||||||
} from './Company';
|
} from './Company';
|
||||||
|
import { RenderProjectCode } from './Generic';
|
||||||
import { ModelType } from './ModelType';
|
import { ModelType } from './ModelType';
|
||||||
import {
|
import {
|
||||||
RenderPurchaseOrder,
|
RenderPurchaseOrder,
|
||||||
@ -47,6 +48,7 @@ const RendererLookup: EnumDictionary<
|
|||||||
[ModelType.part]: RenderPart,
|
[ModelType.part]: RenderPart,
|
||||||
[ModelType.partcategory]: RenderPartCategory,
|
[ModelType.partcategory]: RenderPartCategory,
|
||||||
[ModelType.partparametertemplate]: RenderPartParameterTemplate,
|
[ModelType.partparametertemplate]: RenderPartParameterTemplate,
|
||||||
|
[ModelType.projectcode]: RenderProjectCode,
|
||||||
[ModelType.purchaseorder]: RenderPurchaseOrder,
|
[ModelType.purchaseorder]: RenderPurchaseOrder,
|
||||||
[ModelType.purchaseorderline]: RenderPurchaseOrder,
|
[ModelType.purchaseorderline]: RenderPurchaseOrder,
|
||||||
[ModelType.returnorder]: RenderReturnOrder,
|
[ModelType.returnorder]: RenderReturnOrder,
|
||||||
|
@ -6,6 +6,7 @@ export enum ModelType {
|
|||||||
manufacturerpart = 'manufacturerpart',
|
manufacturerpart = 'manufacturerpart',
|
||||||
partcategory = 'partcategory',
|
partcategory = 'partcategory',
|
||||||
partparametertemplate = 'partparametertemplate',
|
partparametertemplate = 'partparametertemplate',
|
||||||
|
projectcode = 'projectcode',
|
||||||
stockitem = 'stockitem',
|
stockitem = 'stockitem',
|
||||||
stocklocation = 'stocklocation',
|
stocklocation = 'stocklocation',
|
||||||
stockhistory = 'stockhistory',
|
stockhistory = 'stockhistory',
|
||||||
@ -92,6 +93,12 @@ export const ModelInformationDict: ModelDictory = {
|
|||||||
url_overview: '/company',
|
url_overview: '/company',
|
||||||
url_detail: '/company/:pk/'
|
url_detail: '/company/:pk/'
|
||||||
},
|
},
|
||||||
|
projectcode: {
|
||||||
|
label: t`Project Code`,
|
||||||
|
label_multiple: t`Project Codes`,
|
||||||
|
url_overview: '/project-code',
|
||||||
|
url_detail: '/project-code/:pk/'
|
||||||
|
},
|
||||||
purchaseorder: {
|
purchaseorder: {
|
||||||
label: t`Purchase Order`,
|
label: t`Purchase Order`,
|
||||||
label_multiple: t`Purchase Orders`,
|
label_multiple: t`Purchase Orders`,
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
import { Text } from '@mantine/core';
|
import { Text } from '@mantine/core';
|
||||||
import { useMemo } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
import { buildOrderFields } from '../../../forms/BuildForms';
|
||||||
|
import { openCreateApiForm } from '../../../functions/forms';
|
||||||
import { useTableRefresh } from '../../../hooks/TableRefresh';
|
import { useTableRefresh } from '../../../hooks/TableRefresh';
|
||||||
import { ApiPaths, apiUrl } from '../../../states/ApiState';
|
import { ApiPaths, apiUrl } from '../../../states/ApiState';
|
||||||
|
import { AddItemButton } from '../../buttons/AddItemButton';
|
||||||
import { ThumbnailHoverCard } from '../../images/Thumbnail';
|
import { ThumbnailHoverCard } from '../../images/Thumbnail';
|
||||||
import { ProgressBar } from '../../items/ProgressBar';
|
import { ProgressBar } from '../../items/ProgressBar';
|
||||||
import { ModelType } from '../../render/ModelType';
|
import { ModelType } from '../../render/ModelType';
|
||||||
@ -50,16 +53,11 @@ function buildOrderTableColumns(): TableColumn[] {
|
|||||||
sortable: false,
|
sortable: false,
|
||||||
title: t`Description`
|
title: t`Description`
|
||||||
},
|
},
|
||||||
{
|
|
||||||
accessor: 'quantity',
|
|
||||||
sortable: true,
|
|
||||||
title: t`Quantity`,
|
|
||||||
switchable: false
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
accessor: 'completed',
|
accessor: 'completed',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
title: t`Completed`,
|
switchable: false,
|
||||||
|
title: t`Progress`,
|
||||||
render: (record: any) => (
|
render: (record: any) => (
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
progressLabel={true}
|
progressLabel={true}
|
||||||
@ -133,16 +131,36 @@ function buildOrderTableColumns(): TableColumn[] {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildOrderTableFilters(): TableFilter[] {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Construct a table of build orders, according to the provided parameters
|
* Construct a table of build orders, according to the provided parameters
|
||||||
*/
|
*/
|
||||||
export function BuildOrderTable({ params = {} }: { params?: any }) {
|
export function BuildOrderTable({ params = {} }: { params?: any }) {
|
||||||
const tableColumns = useMemo(() => buildOrderTableColumns(), []);
|
const tableColumns = useMemo(() => buildOrderTableColumns(), []);
|
||||||
const tableFilters = useMemo(() => buildOrderTableFilters(), []);
|
|
||||||
|
const tableFilters = useMemo(() => {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
// TODO: Filter by status code
|
||||||
|
name: 'active',
|
||||||
|
type: 'boolean',
|
||||||
|
label: t`Active`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'overdue',
|
||||||
|
type: 'boolean',
|
||||||
|
label: t`Overdue`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'assigned_to_me',
|
||||||
|
type: 'boolean',
|
||||||
|
label: t`Assigned to me`
|
||||||
|
}
|
||||||
|
// TODO: 'assigned to' filter
|
||||||
|
// TODO: 'issued by' filter
|
||||||
|
// TODO: 'has project code' filter (see table_filters.js)
|
||||||
|
// TODO: 'project code' filter (see table_filters.js)
|
||||||
|
];
|
||||||
|
}, []);
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
60
src/frontend/src/forms/BuildForms.tsx
Normal file
60
src/frontend/src/forms/BuildForms.tsx
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
import {
|
||||||
|
IconCalendar,
|
||||||
|
IconLink,
|
||||||
|
IconList,
|
||||||
|
IconSitemap,
|
||||||
|
IconTruckDelivery,
|
||||||
|
IconUser,
|
||||||
|
IconUsersGroup
|
||||||
|
} from '@tabler/icons-react';
|
||||||
|
|
||||||
|
import { ApiFormFieldSet } from '../components/forms/fields/ApiFormField';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Field set for BuildOrder forms
|
||||||
|
*/
|
||||||
|
export function buildOrderFields(): ApiFormFieldSet {
|
||||||
|
return {
|
||||||
|
reference: {},
|
||||||
|
part: {
|
||||||
|
filters: {
|
||||||
|
assembly: true,
|
||||||
|
virtual: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
title: {},
|
||||||
|
quantity: {},
|
||||||
|
project_code: {
|
||||||
|
icon: <IconList />
|
||||||
|
},
|
||||||
|
priority: {},
|
||||||
|
parent: {
|
||||||
|
icon: <IconSitemap />,
|
||||||
|
filters: {
|
||||||
|
part_detail: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sales_order: {
|
||||||
|
icon: <IconTruckDelivery />
|
||||||
|
},
|
||||||
|
batch: {},
|
||||||
|
target_date: {
|
||||||
|
icon: <IconCalendar />
|
||||||
|
},
|
||||||
|
take_from: {},
|
||||||
|
destination: {
|
||||||
|
filters: {
|
||||||
|
structural: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
link: {
|
||||||
|
icon: <IconLink />
|
||||||
|
},
|
||||||
|
issued_by: {
|
||||||
|
icon: <IconUser />
|
||||||
|
},
|
||||||
|
responsible: {
|
||||||
|
icon: <IconUsersGroup />
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
@ -17,7 +17,7 @@ import {
|
|||||||
IconSitemap,
|
IconSitemap,
|
||||||
IconTrash
|
IconTrash
|
||||||
} from '@tabler/icons-react';
|
} from '@tabler/icons-react';
|
||||||
import { useMemo } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -37,6 +37,8 @@ import { BuildOrderTable } from '../../components/tables/build/BuildOrderTable';
|
|||||||
import { AttachmentTable } from '../../components/tables/general/AttachmentTable';
|
import { AttachmentTable } from '../../components/tables/general/AttachmentTable';
|
||||||
import { StockItemTable } from '../../components/tables/stock/StockItemTable';
|
import { StockItemTable } from '../../components/tables/stock/StockItemTable';
|
||||||
import { NotesEditor } from '../../components/widgets/MarkdownEditor';
|
import { NotesEditor } from '../../components/widgets/MarkdownEditor';
|
||||||
|
import { buildOrderFields } from '../../forms/BuildForms';
|
||||||
|
import { openEditApiForm } from '../../functions/forms';
|
||||||
import { useInstance } from '../../hooks/UseInstance';
|
import { useInstance } from '../../hooks/UseInstance';
|
||||||
import { ApiPaths, apiUrl } from '../../states/ApiState';
|
import { ApiPaths, apiUrl } from '../../states/ApiState';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
@ -177,6 +179,25 @@ export default function BuildDetail() {
|
|||||||
];
|
];
|
||||||
}, [build]);
|
}, [build]);
|
||||||
|
|
||||||
|
const editBuildOrder = useCallback(() => {
|
||||||
|
let fields = buildOrderFields();
|
||||||
|
|
||||||
|
// Cannot edit part field after creation
|
||||||
|
fields['part'].hidden = true;
|
||||||
|
|
||||||
|
build.pk &&
|
||||||
|
openEditApiForm({
|
||||||
|
url: ApiPaths.build_order_list,
|
||||||
|
pk: build.pk,
|
||||||
|
title: t`Edit Build Order`,
|
||||||
|
fields: fields,
|
||||||
|
successMessage: t`Build Order updated`,
|
||||||
|
onFormSuccess: () => {
|
||||||
|
refreshInstance();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, [build]);
|
||||||
|
|
||||||
const buildActions = useMemo(() => {
|
const buildActions = useMemo(() => {
|
||||||
// TODO: Disable certain actions based on user permissions
|
// TODO: Disable certain actions based on user permissions
|
||||||
return [
|
return [
|
||||||
@ -211,7 +232,9 @@ export default function BuildDetail() {
|
|||||||
tooltip={t`Build Order Actions`}
|
tooltip={t`Build Order Actions`}
|
||||||
icon={<IconDots />}
|
icon={<IconDots />}
|
||||||
actions={[
|
actions={[
|
||||||
EditItemAction({}),
|
EditItemAction({
|
||||||
|
onClick: editBuildOrder
|
||||||
|
}),
|
||||||
DuplicateItemAction({}),
|
DuplicateItemAction({}),
|
||||||
DeleteItemAction({})
|
DeleteItemAction({})
|
||||||
]}
|
]}
|
||||||
|
@ -1,26 +1,42 @@
|
|||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
import { Button, Stack, Text } from '@mantine/core';
|
import { Button, Stack, Text } from '@mantine/core';
|
||||||
|
import { useCallback } from 'react';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
import { PageDetail } from '../../components/nav/PageDetail';
|
import { PageDetail } from '../../components/nav/PageDetail';
|
||||||
import { BuildOrderTable } from '../../components/tables/build/BuildOrderTable';
|
import { BuildOrderTable } from '../../components/tables/build/BuildOrderTable';
|
||||||
import { notYetImplemented } from '../../functions/notifications';
|
import { buildOrderFields } from '../../forms/BuildForms';
|
||||||
|
import { openCreateApiForm } from '../../functions/forms';
|
||||||
|
import { ApiPaths } from '../../states/ApiState';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build Order index page
|
* Build Order index page
|
||||||
*/
|
*/
|
||||||
export default function BuildIndex() {
|
export default function BuildIndex() {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const newBuildOrder = useCallback(() => {
|
||||||
|
openCreateApiForm({
|
||||||
|
url: ApiPaths.build_order_list,
|
||||||
|
title: t`Add Build Order`,
|
||||||
|
fields: buildOrderFields(),
|
||||||
|
successMessage: t`Build order created`,
|
||||||
|
onFormSuccess: (data: any) => {
|
||||||
|
if (data.pk) {
|
||||||
|
navigate(`/build/${data.pk}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack>
|
<Stack>
|
||||||
<PageDetail
|
<PageDetail
|
||||||
title={t`Build Orders`}
|
title={t`Build Orders`}
|
||||||
actions={[
|
actions={[
|
||||||
<Button
|
<Button key="new-build" color="green" onClick={newBuildOrder}>
|
||||||
key="new-build"
|
{t`New Build Order`}
|
||||||
color="green"
|
|
||||||
onClick={() => notYetImplemented()}
|
|
||||||
>
|
|
||||||
<Text>{t`New Build Order`}</Text>
|
|
||||||
</Button>
|
</Button>
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
@ -173,7 +173,7 @@ export default function CompanyDetail(props: CompanyDetailProps) {
|
|||||||
actions={[
|
actions={[
|
||||||
EditItemAction({
|
EditItemAction({
|
||||||
disabled: !canEdit,
|
disabled: !canEdit,
|
||||||
callback: () => {
|
onClick: () => {
|
||||||
if (company?.pk) {
|
if (company?.pk) {
|
||||||
editCompany({
|
editCompany({
|
||||||
pk: company?.pk,
|
pk: company?.pk,
|
||||||
|
@ -296,7 +296,7 @@ export default function PartDetail() {
|
|||||||
actions={[
|
actions={[
|
||||||
DuplicateItemAction({}),
|
DuplicateItemAction({}),
|
||||||
EditItemAction({
|
EditItemAction({
|
||||||
callback: () => {
|
onClick: () => {
|
||||||
part.pk &&
|
part.pk &&
|
||||||
editPart({
|
editPart({
|
||||||
part_id: part.pk,
|
part_id: part.pk,
|
||||||
|
@ -191,7 +191,7 @@ export default function StockDetail() {
|
|||||||
icon: <IconCopy />
|
icon: <IconCopy />
|
||||||
},
|
},
|
||||||
EditItemAction({
|
EditItemAction({
|
||||||
callback: () => {
|
onClick: () => {
|
||||||
stockitem.pk &&
|
stockitem.pk &&
|
||||||
editStockItem({
|
editStockItem({
|
||||||
item_id: stockitem.pk,
|
item_id: stockitem.pk,
|
||||||
|
@ -100,9 +100,11 @@ export enum ApiPaths {
|
|||||||
company_list = 'api-company-list',
|
company_list = 'api-company-list',
|
||||||
company_attachment_list = 'api-company-attachment-list',
|
company_attachment_list = 'api-company-attachment-list',
|
||||||
supplier_part_list = 'api-supplier-part-list',
|
supplier_part_list = 'api-supplier-part-list',
|
||||||
|
manufacturer_part_list = 'api-manufacturer-part-list',
|
||||||
|
|
||||||
// Stock Item URLs
|
// Stock Item URLs
|
||||||
stock_item_list = 'api-stock-item-list',
|
stock_item_list = 'api-stock-item-list',
|
||||||
|
stock_tracking_list = 'api-stock-tracking-list',
|
||||||
stock_location_list = 'api-stock-location-list',
|
stock_location_list = 'api-stock-location-list',
|
||||||
stock_location_tree = 'api-stock-location-tree',
|
stock_location_tree = 'api-stock-location-tree',
|
||||||
stock_attachment_list = 'api-stock-attachment-list',
|
stock_attachment_list = 'api-stock-attachment-list',
|
||||||
@ -216,8 +218,12 @@ export function apiEndpoint(path: ApiPaths): string {
|
|||||||
return 'company/attachment/';
|
return 'company/attachment/';
|
||||||
case ApiPaths.supplier_part_list:
|
case ApiPaths.supplier_part_list:
|
||||||
return 'company/part/';
|
return 'company/part/';
|
||||||
|
case ApiPaths.manufacturer_part_list:
|
||||||
|
return 'company/part/manufacturer/';
|
||||||
case ApiPaths.stock_item_list:
|
case ApiPaths.stock_item_list:
|
||||||
return 'stock/';
|
return 'stock/';
|
||||||
|
case ApiPaths.stock_tracking_list:
|
||||||
|
return 'stock/track/';
|
||||||
case ApiPaths.stock_location_list:
|
case ApiPaths.stock_location_list:
|
||||||
return 'stock/location/';
|
return 'stock/location/';
|
||||||
case ApiPaths.stock_location_tree:
|
case ApiPaths.stock_location_tree:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user