mirror of
https://github.com/inventree/InvenTree.git
synced 2025-12-18 18:28:18 +00:00
Plugin stock forms (#10584)
* Expose stock adjustment forms to plugins * Update changelog * Expand type exports * Update CHANGELOG.md
This commit is contained in:
@@ -12,7 +12,12 @@ export { ModelType } from './enums/ModelType';
|
||||
export type { ModelDict } from './enums/ModelInformation';
|
||||
export { UserRoles, UserPermissions } from './enums/Roles';
|
||||
|
||||
export type { InvenTreePluginContext } from './types/Plugins';
|
||||
export type {
|
||||
InvenTreePluginContext,
|
||||
InvenTreeFormsContext,
|
||||
PluginVersion,
|
||||
StockAdjustmentFormsContext
|
||||
} from './types/Plugins';
|
||||
export type { RowAction, RowViewProps } from './types/Tables';
|
||||
|
||||
export type {
|
||||
@@ -25,6 +30,11 @@ export type {
|
||||
BulkEditApiFormModalProps
|
||||
} from './types/Forms';
|
||||
|
||||
export type {
|
||||
UseModalProps,
|
||||
UseModalReturn
|
||||
} from './types/Modals';
|
||||
|
||||
// Common utility functions
|
||||
export { apiUrl } from './functions/Api';
|
||||
export {
|
||||
|
||||
@@ -191,3 +191,11 @@ export interface ApiFormModalProps extends ApiFormProps {
|
||||
export interface BulkEditApiFormModalProps extends ApiFormModalProps {
|
||||
items: number[];
|
||||
}
|
||||
|
||||
export type StockOperationProps = {
|
||||
items?: any[];
|
||||
pk?: number;
|
||||
filters?: any;
|
||||
model: ModelType.stockitem | 'location' | ModelType.part;
|
||||
refresh: () => void;
|
||||
};
|
||||
|
||||
@@ -5,7 +5,11 @@ import type { AxiosInstance } from 'axios';
|
||||
import type { NavigateFunction } from 'react-router-dom';
|
||||
import type { ModelDict } from '../enums/ModelInformation';
|
||||
import type { ModelType } from '../enums/ModelType';
|
||||
import type { ApiFormModalProps, BulkEditApiFormModalProps } from './Forms';
|
||||
import type {
|
||||
ApiFormModalProps,
|
||||
BulkEditApiFormModalProps,
|
||||
StockOperationProps
|
||||
} from './Forms';
|
||||
import type { UseModalReturn } from './Modals';
|
||||
import type { RenderInstanceProps } from './Rendering';
|
||||
import type { SettingsStateProps } from './Settings';
|
||||
@@ -24,11 +28,24 @@ export interface PluginVersion {
|
||||
mantine: string;
|
||||
}
|
||||
|
||||
export type StockAdjustmentFormsContext = {
|
||||
addStock: (props: StockOperationProps) => UseModalReturn;
|
||||
assignStock: (props: StockOperationProps) => UseModalReturn;
|
||||
changeStatus: (props: StockOperationProps) => UseModalReturn;
|
||||
countStock: (props: StockOperationProps) => UseModalReturn;
|
||||
deleteStock: (props: StockOperationProps) => UseModalReturn;
|
||||
mergeStock: (props: StockOperationProps) => UseModalReturn;
|
||||
removeStock: (props: StockOperationProps) => UseModalReturn;
|
||||
transferStock: (props: StockOperationProps) => UseModalReturn;
|
||||
returnStock: (props: StockOperationProps) => UseModalReturn;
|
||||
};
|
||||
|
||||
export type InvenTreeFormsContext = {
|
||||
bulkEdit: (props: BulkEditApiFormModalProps) => UseModalReturn;
|
||||
create: (props: ApiFormModalProps) => UseModalReturn;
|
||||
delete: (props: ApiFormModalProps) => UseModalReturn;
|
||||
edit: (props: ApiFormModalProps) => UseModalReturn;
|
||||
stockActions: StockAdjustmentFormsContext;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user