Add special-order product flow for sales opportunities
This commit is contained in:
@@ -6,6 +6,8 @@ import {
|
||||
CWForecast,
|
||||
CWForecastItem,
|
||||
CWForecastItemCreate,
|
||||
CWProcurementProduct,
|
||||
CWProcurementProductCreate,
|
||||
CWOpportunityNote,
|
||||
CWOpportunityNoteCreate,
|
||||
CWOpportunityNoteUpdate,
|
||||
@@ -356,4 +358,27 @@ export const opportunityCw = {
|
||||
);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* Create Procurement Products
|
||||
*
|
||||
* Creates one or more procurement products linked to an opportunity.
|
||||
* This endpoint supports procurement customFields (unlike forecast items).
|
||||
*/
|
||||
createProcurementProducts: async (
|
||||
data: CWProcurementProductCreate | CWProcurementProductCreate[],
|
||||
): Promise<CWProcurementProduct[]> => {
|
||||
const productsToCreate = Array.isArray(data) ? data : [data];
|
||||
const created: CWProcurementProduct[] = [];
|
||||
|
||||
for (const product of productsToCreate) {
|
||||
const response = await connectWiseApi.post(
|
||||
`/procurement/products`,
|
||||
product,
|
||||
);
|
||||
created.push(response.data as CWProcurementProduct);
|
||||
}
|
||||
|
||||
return created;
|
||||
},
|
||||
};
|
||||
|
||||
@@ -113,6 +113,7 @@ export interface CWForecastItem {
|
||||
_info?: Record<string, string>;
|
||||
};
|
||||
productDescription: string;
|
||||
customerDescription?: string;
|
||||
productClass: string;
|
||||
revenue: number;
|
||||
cost: number;
|
||||
@@ -129,6 +130,7 @@ export interface CWForecastItem {
|
||||
sequenceNumber: number;
|
||||
subNumber: number;
|
||||
taxableFlag: boolean;
|
||||
customFields?: CWCustomField[];
|
||||
_info?: Record<string, string>;
|
||||
}
|
||||
|
||||
@@ -210,6 +212,7 @@ export interface CWForecastItemCreate {
|
||||
catalogItem?: { id: number };
|
||||
forecastDescription?: string;
|
||||
productDescription?: string;
|
||||
customerDescription?: string;
|
||||
quantity?: number;
|
||||
status?: { id: number };
|
||||
productClass?: string;
|
||||
@@ -224,6 +227,39 @@ export interface CWForecastItemCreate {
|
||||
recurringCost?: number;
|
||||
cycles?: number;
|
||||
sequenceNumber?: number;
|
||||
customFields?: Array<
|
||||
Partial<Omit<CWCustomField, "connectWiseId" | "rowNum" | "podId">>
|
||||
>;
|
||||
}
|
||||
|
||||
export interface CWProcurementProductCreate {
|
||||
opportunity?: { id: number };
|
||||
catalogItem: { id: number };
|
||||
description: string;
|
||||
customerDescription?: string;
|
||||
quantity?: number;
|
||||
price?: number;
|
||||
cost?: number;
|
||||
taxableFlag?: boolean;
|
||||
dropshipFlag?: boolean;
|
||||
billableOption?: string;
|
||||
customFields?: Array<
|
||||
Partial<Omit<CWCustomField, "connectWiseId" | "rowNum" | "podId">>
|
||||
>;
|
||||
}
|
||||
|
||||
export interface CWProcurementProduct {
|
||||
id: number;
|
||||
forecastDetailId?: number;
|
||||
description?: string;
|
||||
customerDescription?: string;
|
||||
quantity?: number;
|
||||
price?: number;
|
||||
cost?: number;
|
||||
taxableFlag?: boolean;
|
||||
specialOrderFlag?: boolean;
|
||||
customFields?: CWCustomField[];
|
||||
_info?: Record<string, string>;
|
||||
}
|
||||
|
||||
export interface CWOpportunitySummary {
|
||||
|
||||
Reference in New Issue
Block a user