feat: adding services kit to deal
This commit is contained in:
@ -9,6 +9,7 @@ import {
|
|||||||
import type { AxiosError } from "axios";
|
import type { AxiosError } from "axios";
|
||||||
import { client as _heyApiClient } from "../client.gen";
|
import { client as _heyApiClient } from "../client.gen";
|
||||||
import {
|
import {
|
||||||
|
addKitToDeal,
|
||||||
addKitToDealProduct,
|
addKitToDealProduct,
|
||||||
createBoard,
|
createBoard,
|
||||||
createDeal,
|
createDeal,
|
||||||
@ -54,9 +55,12 @@ import {
|
|||||||
type Options,
|
type Options,
|
||||||
} from "../sdk.gen";
|
} from "../sdk.gen";
|
||||||
import type {
|
import type {
|
||||||
|
AddKitToDealData,
|
||||||
|
AddKitToDealError,
|
||||||
AddKitToDealProductData,
|
AddKitToDealProductData,
|
||||||
AddKitToDealProductError,
|
AddKitToDealProductError,
|
||||||
AddKitToDealProductResponse,
|
AddKitToDealProductResponse,
|
||||||
|
AddKitToDealResponse,
|
||||||
CreateBoardData,
|
CreateBoardData,
|
||||||
CreateBoardError,
|
CreateBoardError,
|
||||||
CreateBoardResponse2,
|
CreateBoardResponse2,
|
||||||
@ -932,57 +936,6 @@ export const updateDealProductMutation = (
|
|||||||
return mutationOptions;
|
return mutationOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const addKitToDealProductQueryKey = (
|
|
||||||
options: Options<AddKitToDealProductData>
|
|
||||||
) => createQueryKey("addKitToDealProduct", options);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add Kit To Deal Product
|
|
||||||
*/
|
|
||||||
export const addKitToDealProductOptions = (
|
|
||||||
options: Options<AddKitToDealProductData>
|
|
||||||
) => {
|
|
||||||
return queryOptions({
|
|
||||||
queryFn: async ({ queryKey, signal }) => {
|
|
||||||
const { data } = await addKitToDealProduct({
|
|
||||||
...options,
|
|
||||||
...queryKey[0],
|
|
||||||
signal,
|
|
||||||
throwOnError: true,
|
|
||||||
});
|
|
||||||
return data;
|
|
||||||
},
|
|
||||||
queryKey: addKitToDealProductQueryKey(options),
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add Kit To Deal Product
|
|
||||||
*/
|
|
||||||
export const addKitToDealProductMutation = (
|
|
||||||
options?: Partial<Options<AddKitToDealProductData>>
|
|
||||||
): UseMutationOptions<
|
|
||||||
AddKitToDealProductResponse,
|
|
||||||
AxiosError<AddKitToDealProductError>,
|
|
||||||
Options<AddKitToDealProductData>
|
|
||||||
> => {
|
|
||||||
const mutationOptions: UseMutationOptions<
|
|
||||||
AddKitToDealProductResponse,
|
|
||||||
AxiosError<AddKitToDealProductError>,
|
|
||||||
Options<AddKitToDealProductData>
|
|
||||||
> = {
|
|
||||||
mutationFn: async localOptions => {
|
|
||||||
const { data } = await addKitToDealProduct({
|
|
||||||
...options,
|
|
||||||
...localOptions,
|
|
||||||
throwOnError: true,
|
|
||||||
});
|
|
||||||
return data;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
return mutationOptions;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const createDealProductServiceQueryKey = (
|
export const createDealProductServiceQueryKey = (
|
||||||
options: Options<CreateDealProductServiceData>
|
options: Options<CreateDealProductServiceData>
|
||||||
) => createQueryKey("createDealProductService", options);
|
) => createQueryKey("createDealProductService", options);
|
||||||
@ -1139,6 +1092,57 @@ export const duplicateProductServicesMutation = (
|
|||||||
return mutationOptions;
|
return mutationOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const addKitToDealProductQueryKey = (
|
||||||
|
options: Options<AddKitToDealProductData>
|
||||||
|
) => createQueryKey("addKitToDealProduct", options);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add Kit To Deal Product
|
||||||
|
*/
|
||||||
|
export const addKitToDealProductOptions = (
|
||||||
|
options: Options<AddKitToDealProductData>
|
||||||
|
) => {
|
||||||
|
return queryOptions({
|
||||||
|
queryFn: async ({ queryKey, signal }) => {
|
||||||
|
const { data } = await addKitToDealProduct({
|
||||||
|
...options,
|
||||||
|
...queryKey[0],
|
||||||
|
signal,
|
||||||
|
throwOnError: true,
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
queryKey: addKitToDealProductQueryKey(options),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add Kit To Deal Product
|
||||||
|
*/
|
||||||
|
export const addKitToDealProductMutation = (
|
||||||
|
options?: Partial<Options<AddKitToDealProductData>>
|
||||||
|
): UseMutationOptions<
|
||||||
|
AddKitToDealProductResponse,
|
||||||
|
AxiosError<AddKitToDealProductError>,
|
||||||
|
Options<AddKitToDealProductData>
|
||||||
|
> => {
|
||||||
|
const mutationOptions: UseMutationOptions<
|
||||||
|
AddKitToDealProductResponse,
|
||||||
|
AxiosError<AddKitToDealProductError>,
|
||||||
|
Options<AddKitToDealProductData>
|
||||||
|
> = {
|
||||||
|
mutationFn: async localOptions => {
|
||||||
|
const { data } = await addKitToDealProduct({
|
||||||
|
...options,
|
||||||
|
...localOptions,
|
||||||
|
throwOnError: true,
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
return mutationOptions;
|
||||||
|
};
|
||||||
|
|
||||||
export const getDealServicesQueryKey = (
|
export const getDealServicesQueryKey = (
|
||||||
options: Options<GetDealServicesData>
|
options: Options<GetDealServicesData>
|
||||||
) => createQueryKey("getDealServices", options);
|
) => createQueryKey("getDealServices", options);
|
||||||
@ -1268,6 +1272,54 @@ export const updateDealServiceMutation = (
|
|||||||
return mutationOptions;
|
return mutationOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const addKitToDealQueryKey = (options: Options<AddKitToDealData>) =>
|
||||||
|
createQueryKey("addKitToDeal", options);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add Kit To Deal Product
|
||||||
|
*/
|
||||||
|
export const addKitToDealOptions = (options: Options<AddKitToDealData>) => {
|
||||||
|
return queryOptions({
|
||||||
|
queryFn: async ({ queryKey, signal }) => {
|
||||||
|
const { data } = await addKitToDeal({
|
||||||
|
...options,
|
||||||
|
...queryKey[0],
|
||||||
|
signal,
|
||||||
|
throwOnError: true,
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
queryKey: addKitToDealQueryKey(options),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add Kit To Deal Product
|
||||||
|
*/
|
||||||
|
export const addKitToDealMutation = (
|
||||||
|
options?: Partial<Options<AddKitToDealData>>
|
||||||
|
): UseMutationOptions<
|
||||||
|
AddKitToDealResponse,
|
||||||
|
AxiosError<AddKitToDealError>,
|
||||||
|
Options<AddKitToDealData>
|
||||||
|
> => {
|
||||||
|
const mutationOptions: UseMutationOptions<
|
||||||
|
AddKitToDealResponse,
|
||||||
|
AxiosError<AddKitToDealError>,
|
||||||
|
Options<AddKitToDealData>
|
||||||
|
> = {
|
||||||
|
mutationFn: async localOptions => {
|
||||||
|
const { data } = await addKitToDeal({
|
||||||
|
...options,
|
||||||
|
...localOptions,
|
||||||
|
throwOnError: true,
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
return mutationOptions;
|
||||||
|
};
|
||||||
|
|
||||||
export const getProductsQueryKey = (options?: Options<GetProductsData>) =>
|
export const getProductsQueryKey = (options?: Options<GetProductsData>) =>
|
||||||
createQueryKey("getProducts", options);
|
createQueryKey("getProducts", options);
|
||||||
|
|
||||||
|
|||||||
@ -3,9 +3,12 @@
|
|||||||
import type { Client, Options as ClientOptions, TDataShape } from "./client";
|
import type { Client, Options as ClientOptions, TDataShape } from "./client";
|
||||||
import { client as _heyApiClient } from "./client.gen";
|
import { client as _heyApiClient } from "./client.gen";
|
||||||
import type {
|
import type {
|
||||||
|
AddKitToDealData,
|
||||||
|
AddKitToDealErrors,
|
||||||
AddKitToDealProductData,
|
AddKitToDealProductData,
|
||||||
AddKitToDealProductErrors,
|
AddKitToDealProductErrors,
|
||||||
AddKitToDealProductResponses,
|
AddKitToDealProductResponses,
|
||||||
|
AddKitToDealResponses,
|
||||||
CreateBoardData,
|
CreateBoardData,
|
||||||
CreateBoardErrors,
|
CreateBoardErrors,
|
||||||
CreateBoardResponses,
|
CreateBoardResponses,
|
||||||
@ -127,8 +130,10 @@ import type {
|
|||||||
UpdateStatusResponses,
|
UpdateStatusResponses,
|
||||||
} from "./types.gen";
|
} from "./types.gen";
|
||||||
import {
|
import {
|
||||||
|
zAddKitToDealData,
|
||||||
zAddKitToDealProductData,
|
zAddKitToDealProductData,
|
||||||
zAddKitToDealProductResponse,
|
zAddKitToDealProductResponse,
|
||||||
|
zAddKitToDealResponse,
|
||||||
zCreateBoardData,
|
zCreateBoardData,
|
||||||
zCreateBoardResponse2,
|
zCreateBoardResponse2,
|
||||||
zCreateDealData,
|
zCreateDealData,
|
||||||
@ -753,33 +758,6 @@ export const updateDealProduct = <ThrowOnError extends boolean = false>(
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Add Kit To Deal Product
|
|
||||||
*/
|
|
||||||
export const addKitToDealProduct = <ThrowOnError extends boolean = false>(
|
|
||||||
options: Options<AddKitToDealProductData, ThrowOnError>
|
|
||||||
) => {
|
|
||||||
return (options.client ?? _heyApiClient).post<
|
|
||||||
AddKitToDealProductResponses,
|
|
||||||
AddKitToDealProductErrors,
|
|
||||||
ThrowOnError
|
|
||||||
>({
|
|
||||||
requestValidator: async data => {
|
|
||||||
return await zAddKitToDealProductData.parseAsync(data);
|
|
||||||
},
|
|
||||||
responseType: "json",
|
|
||||||
responseValidator: async data => {
|
|
||||||
return await zAddKitToDealProductResponse.parseAsync(data);
|
|
||||||
},
|
|
||||||
url: "/modules/fulfillment-base/deal-product/add-services-kit",
|
|
||||||
...options,
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
...options.headers,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create Deal Product Service
|
* Create Deal Product Service
|
||||||
*/
|
*/
|
||||||
@ -884,6 +862,33 @@ export const duplicateProductServices = <ThrowOnError extends boolean = false>(
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add Kit To Deal Product
|
||||||
|
*/
|
||||||
|
export const addKitToDealProduct = <ThrowOnError extends boolean = false>(
|
||||||
|
options: Options<AddKitToDealProductData, ThrowOnError>
|
||||||
|
) => {
|
||||||
|
return (options.client ?? _heyApiClient).post<
|
||||||
|
AddKitToDealProductResponses,
|
||||||
|
AddKitToDealProductErrors,
|
||||||
|
ThrowOnError
|
||||||
|
>({
|
||||||
|
requestValidator: async data => {
|
||||||
|
return await zAddKitToDealProductData.parseAsync(data);
|
||||||
|
},
|
||||||
|
responseType: "json",
|
||||||
|
responseValidator: async data => {
|
||||||
|
return await zAddKitToDealProductResponse.parseAsync(data);
|
||||||
|
},
|
||||||
|
url: "/modules/fulfillment-base/deal-product/add-services-kit",
|
||||||
|
...options,
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
...options.headers,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Deal Services
|
* Get Deal Services
|
||||||
*/
|
*/
|
||||||
@ -984,6 +989,33 @@ export const updateDealService = <ThrowOnError extends boolean = false>(
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add Kit To Deal Product
|
||||||
|
*/
|
||||||
|
export const addKitToDeal = <ThrowOnError extends boolean = false>(
|
||||||
|
options: Options<AddKitToDealData, ThrowOnError>
|
||||||
|
) => {
|
||||||
|
return (options.client ?? _heyApiClient).post<
|
||||||
|
AddKitToDealResponses,
|
||||||
|
AddKitToDealErrors,
|
||||||
|
ThrowOnError
|
||||||
|
>({
|
||||||
|
requestValidator: async data => {
|
||||||
|
return await zAddKitToDealData.parseAsync(data);
|
||||||
|
},
|
||||||
|
responseType: "json",
|
||||||
|
responseValidator: async data => {
|
||||||
|
return await zAddKitToDealResponse.parseAsync(data);
|
||||||
|
},
|
||||||
|
url: "/modules/fulfillment-base/deal-service/add-services-kit",
|
||||||
|
...options,
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
...options.headers,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Products
|
* Get Products
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -453,6 +453,30 @@ export type CreateStatusSchema = {
|
|||||||
lexorank: string;
|
lexorank: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DealAddKitRequest
|
||||||
|
*/
|
||||||
|
export type DealAddKitRequest = {
|
||||||
|
/**
|
||||||
|
* Dealid
|
||||||
|
*/
|
||||||
|
dealId: number;
|
||||||
|
/**
|
||||||
|
* Kitid
|
||||||
|
*/
|
||||||
|
kitId: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DealAddKitResponse
|
||||||
|
*/
|
||||||
|
export type DealAddKitResponse = {
|
||||||
|
/**
|
||||||
|
* Message
|
||||||
|
*/
|
||||||
|
message: string;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DealProductAddKitRequest
|
* DealProductAddKitRequest
|
||||||
*/
|
*/
|
||||||
@ -2071,33 +2095,6 @@ export type UpdateDealProductResponses = {
|
|||||||
export type UpdateDealProductResponse2 =
|
export type UpdateDealProductResponse2 =
|
||||||
UpdateDealProductResponses[keyof UpdateDealProductResponses];
|
UpdateDealProductResponses[keyof UpdateDealProductResponses];
|
||||||
|
|
||||||
export type AddKitToDealProductData = {
|
|
||||||
body: DealProductAddKitRequest;
|
|
||||||
path?: never;
|
|
||||||
query?: never;
|
|
||||||
url: "/modules/fulfillment-base/deal-product/add-services-kit";
|
|
||||||
};
|
|
||||||
|
|
||||||
export type AddKitToDealProductErrors = {
|
|
||||||
/**
|
|
||||||
* Validation Error
|
|
||||||
*/
|
|
||||||
422: HttpValidationError;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type AddKitToDealProductError =
|
|
||||||
AddKitToDealProductErrors[keyof AddKitToDealProductErrors];
|
|
||||||
|
|
||||||
export type AddKitToDealProductResponses = {
|
|
||||||
/**
|
|
||||||
* Successful Response
|
|
||||||
*/
|
|
||||||
200: DealProductAddKitResponse;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type AddKitToDealProductResponse =
|
|
||||||
AddKitToDealProductResponses[keyof AddKitToDealProductResponses];
|
|
||||||
|
|
||||||
export type CreateDealProductServiceData = {
|
export type CreateDealProductServiceData = {
|
||||||
body: CreateProductServiceRequest;
|
body: CreateProductServiceRequest;
|
||||||
path?: never;
|
path?: never;
|
||||||
@ -2232,6 +2229,33 @@ export type DuplicateProductServicesResponses = {
|
|||||||
export type DuplicateProductServicesResponse =
|
export type DuplicateProductServicesResponse =
|
||||||
DuplicateProductServicesResponses[keyof DuplicateProductServicesResponses];
|
DuplicateProductServicesResponses[keyof DuplicateProductServicesResponses];
|
||||||
|
|
||||||
|
export type AddKitToDealProductData = {
|
||||||
|
body: DealProductAddKitRequest;
|
||||||
|
path?: never;
|
||||||
|
query?: never;
|
||||||
|
url: "/modules/fulfillment-base/deal-product/add-services-kit";
|
||||||
|
};
|
||||||
|
|
||||||
|
export type AddKitToDealProductErrors = {
|
||||||
|
/**
|
||||||
|
* Validation Error
|
||||||
|
*/
|
||||||
|
422: HttpValidationError;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type AddKitToDealProductError =
|
||||||
|
AddKitToDealProductErrors[keyof AddKitToDealProductErrors];
|
||||||
|
|
||||||
|
export type AddKitToDealProductResponses = {
|
||||||
|
/**
|
||||||
|
* Successful Response
|
||||||
|
*/
|
||||||
|
200: DealProductAddKitResponse;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type AddKitToDealProductResponse =
|
||||||
|
AddKitToDealProductResponses[keyof AddKitToDealProductResponses];
|
||||||
|
|
||||||
export type GetDealServicesData = {
|
export type GetDealServicesData = {
|
||||||
body?: never;
|
body?: never;
|
||||||
path: {
|
path: {
|
||||||
@ -2363,6 +2387,32 @@ export type UpdateDealServiceResponses = {
|
|||||||
export type UpdateDealServiceResponse2 =
|
export type UpdateDealServiceResponse2 =
|
||||||
UpdateDealServiceResponses[keyof UpdateDealServiceResponses];
|
UpdateDealServiceResponses[keyof UpdateDealServiceResponses];
|
||||||
|
|
||||||
|
export type AddKitToDealData = {
|
||||||
|
body: DealAddKitRequest;
|
||||||
|
path?: never;
|
||||||
|
query?: never;
|
||||||
|
url: "/modules/fulfillment-base/deal-service/add-services-kit";
|
||||||
|
};
|
||||||
|
|
||||||
|
export type AddKitToDealErrors = {
|
||||||
|
/**
|
||||||
|
* Validation Error
|
||||||
|
*/
|
||||||
|
422: HttpValidationError;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type AddKitToDealError = AddKitToDealErrors[keyof AddKitToDealErrors];
|
||||||
|
|
||||||
|
export type AddKitToDealResponses = {
|
||||||
|
/**
|
||||||
|
* Successful Response
|
||||||
|
*/
|
||||||
|
200: DealAddKitResponse;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type AddKitToDealResponse =
|
||||||
|
AddKitToDealResponses[keyof AddKitToDealResponses];
|
||||||
|
|
||||||
export type GetProductsData = {
|
export type GetProductsData = {
|
||||||
body?: never;
|
body?: never;
|
||||||
path?: never;
|
path?: never;
|
||||||
|
|||||||
@ -402,6 +402,21 @@ export const zCreateStatusResponse = z.object({
|
|||||||
entity: zStatusSchema,
|
entity: zStatusSchema,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DealAddKitRequest
|
||||||
|
*/
|
||||||
|
export const zDealAddKitRequest = z.object({
|
||||||
|
dealId: z.int(),
|
||||||
|
kitId: z.int(),
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DealAddKitResponse
|
||||||
|
*/
|
||||||
|
export const zDealAddKitResponse = z.object({
|
||||||
|
message: z.string(),
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DealProductAddKitRequest
|
* DealProductAddKitRequest
|
||||||
*/
|
*/
|
||||||
@ -1118,17 +1133,6 @@ export const zUpdateDealProductData = z.object({
|
|||||||
*/
|
*/
|
||||||
export const zUpdateDealProductResponse2 = zUpdateDealProductResponse;
|
export const zUpdateDealProductResponse2 = zUpdateDealProductResponse;
|
||||||
|
|
||||||
export const zAddKitToDealProductData = z.object({
|
|
||||||
body: zDealProductAddKitRequest,
|
|
||||||
path: z.optional(z.never()),
|
|
||||||
query: z.optional(z.never()),
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Successful Response
|
|
||||||
*/
|
|
||||||
export const zAddKitToDealProductResponse = zDealProductAddKitResponse;
|
|
||||||
|
|
||||||
export const zCreateDealProductServiceData = z.object({
|
export const zCreateDealProductServiceData = z.object({
|
||||||
body: zCreateProductServiceRequest,
|
body: zCreateProductServiceRequest,
|
||||||
path: z.optional(z.never()),
|
path: z.optional(z.never()),
|
||||||
@ -1182,6 +1186,17 @@ export const zDuplicateProductServicesData = z.object({
|
|||||||
export const zDuplicateProductServicesResponse =
|
export const zDuplicateProductServicesResponse =
|
||||||
zProductServicesDuplicateResponse;
|
zProductServicesDuplicateResponse;
|
||||||
|
|
||||||
|
export const zAddKitToDealProductData = z.object({
|
||||||
|
body: zDealProductAddKitRequest,
|
||||||
|
path: z.optional(z.never()),
|
||||||
|
query: z.optional(z.never()),
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Successful Response
|
||||||
|
*/
|
||||||
|
export const zAddKitToDealProductResponse = zDealProductAddKitResponse;
|
||||||
|
|
||||||
export const zGetDealServicesData = z.object({
|
export const zGetDealServicesData = z.object({
|
||||||
body: z.optional(z.never()),
|
body: z.optional(z.never()),
|
||||||
path: z.object({
|
path: z.object({
|
||||||
@ -1234,6 +1249,17 @@ export const zUpdateDealServiceData = z.object({
|
|||||||
*/
|
*/
|
||||||
export const zUpdateDealServiceResponse2 = zUpdateDealServiceResponse;
|
export const zUpdateDealServiceResponse2 = zUpdateDealServiceResponse;
|
||||||
|
|
||||||
|
export const zAddKitToDealData = z.object({
|
||||||
|
body: zDealAddKitRequest,
|
||||||
|
path: z.optional(z.never()),
|
||||||
|
query: z.optional(z.never()),
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Successful Response
|
||||||
|
*/
|
||||||
|
export const zAddKitToDealResponse = zDealAddKitResponse;
|
||||||
|
|
||||||
export const zGetProductsData = z.object({
|
export const zGetProductsData = z.object({
|
||||||
body: z.optional(z.never()),
|
body: z.optional(z.never()),
|
||||||
path: z.optional(z.never()),
|
path: z.optional(z.never()),
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
import { Button, Flex, rem } from "@mantine/core";
|
import { Button, Flex, rem } from "@mantine/core";
|
||||||
import { modals } from "@mantine/modals";
|
import { modals } from "@mantine/modals";
|
||||||
|
import { addKitToDeal, ServicesKitSchema } from "@/lib/client";
|
||||||
import { useFulfillmentBaseContext } from "@/modules/dealModules/dealEditorTabs/FulfillmentBaseTab/contexts/FulfillmentBaseContext";
|
import { useFulfillmentBaseContext } from "@/modules/dealModules/dealEditorTabs/FulfillmentBaseTab/contexts/FulfillmentBaseContext";
|
||||||
|
import { ServiceType } from "@/modules/dealModules/dealEditorTabs/FulfillmentBaseTab/types/service";
|
||||||
|
|
||||||
const ServicesActions = () => {
|
const ServicesActions = () => {
|
||||||
const { dealServicesList, dealServicesCrud, deal } =
|
const { dealServicesList, dealServicesCrud, deal } =
|
||||||
@ -22,17 +24,27 @@ const ServicesActions = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// const onAddKitClick = () => {
|
const onServicesKitAdd = (servicesKit: ServicesKitSchema) => {
|
||||||
// if (!onKitAdd) return;
|
addKitToDeal({
|
||||||
// modals.openContextModal({
|
body: {
|
||||||
// modal: "servicesKitSelectModal",
|
dealId: deal.id,
|
||||||
// innerProps: {
|
kitId: servicesKit.id,
|
||||||
// onSelect: onKitAdd,
|
},
|
||||||
// serviceType: ServiceType.DEAL_SERVICE,
|
})
|
||||||
// },
|
.then(() => dealServicesList.refetch())
|
||||||
// withCloseButton: false,
|
.catch(err => console.error(err));
|
||||||
// });
|
};
|
||||||
// };
|
|
||||||
|
const onAddKitClick = () => {
|
||||||
|
modals.openContextModal({
|
||||||
|
modal: "servicesKitSelectModal",
|
||||||
|
innerProps: {
|
||||||
|
onSelect: onServicesKitAdd,
|
||||||
|
serviceType: ServiceType.DEAL_SERVICE,
|
||||||
|
},
|
||||||
|
withCloseButton: false,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
@ -45,12 +57,12 @@ const ServicesActions = () => {
|
|||||||
variant={"default"}>
|
variant={"default"}>
|
||||||
Добавить услугу
|
Добавить услугу
|
||||||
</Button>
|
</Button>
|
||||||
{/*<Button*/}
|
<Button
|
||||||
{/* onClick={onAddKitClick}*/}
|
onClick={onAddKitClick}
|
||||||
{/* fullWidth*/}
|
fullWidth
|
||||||
{/* variant={"default"}>*/}
|
variant={"default"}>
|
||||||
{/* Добавить набор услуг*/}
|
Добавить набор услуг
|
||||||
{/*</Button>*/}
|
</Button>
|
||||||
</Flex>
|
</Flex>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user