feat: removed price categories
This commit is contained in:
@@ -77,8 +77,6 @@ export type { CreatePayRateRequest } from './models/CreatePayRateRequest';
|
|||||||
export type { CreatePayRateResponse } from './models/CreatePayRateResponse';
|
export type { CreatePayRateResponse } from './models/CreatePayRateResponse';
|
||||||
export type { CreatePositionRequest } from './models/CreatePositionRequest';
|
export type { CreatePositionRequest } from './models/CreatePositionRequest';
|
||||||
export type { CreatePositionResponse } from './models/CreatePositionResponse';
|
export type { CreatePositionResponse } from './models/CreatePositionResponse';
|
||||||
export type { CreatePriceCategoryRequest } from './models/CreatePriceCategoryRequest';
|
|
||||||
export type { CreatePriceCategoryResponse } from './models/CreatePriceCategoryResponse';
|
|
||||||
export type { CreateProjectRequest } from './models/CreateProjectRequest';
|
export type { CreateProjectRequest } from './models/CreateProjectRequest';
|
||||||
export type { CreateProjectResponse } from './models/CreateProjectResponse';
|
export type { CreateProjectResponse } from './models/CreateProjectResponse';
|
||||||
export type { CreateResidualBoxRequest } from './models/CreateResidualBoxRequest';
|
export type { CreateResidualBoxRequest } from './models/CreateResidualBoxRequest';
|
||||||
@@ -180,8 +178,6 @@ export type { DeletePayRateRequest } from './models/DeletePayRateRequest';
|
|||||||
export type { DeletePayRateResponse } from './models/DeletePayRateResponse';
|
export type { DeletePayRateResponse } from './models/DeletePayRateResponse';
|
||||||
export type { DeletePositionRequest } from './models/DeletePositionRequest';
|
export type { DeletePositionRequest } from './models/DeletePositionRequest';
|
||||||
export type { DeletePositionResponse } from './models/DeletePositionResponse';
|
export type { DeletePositionResponse } from './models/DeletePositionResponse';
|
||||||
export type { DeletePriceCategoryRequest } from './models/DeletePriceCategoryRequest';
|
|
||||||
export type { DeletePriceCategoryResponse } from './models/DeletePriceCategoryResponse';
|
|
||||||
export type { DeleteProjectResponse } from './models/DeleteProjectResponse';
|
export type { DeleteProjectResponse } from './models/DeleteProjectResponse';
|
||||||
export type { DeleteResidualBoxResponse } from './models/DeleteResidualBoxResponse';
|
export type { DeleteResidualBoxResponse } from './models/DeleteResidualBoxResponse';
|
||||||
export type { DeleteResidualPalletResponse } from './models/DeleteResidualPalletResponse';
|
export type { DeleteResidualPalletResponse } from './models/DeleteResidualPalletResponse';
|
||||||
@@ -211,7 +207,6 @@ export type { GetAllBaseMarketplacesResponse } from './models/GetAllBaseMarketpl
|
|||||||
export type { GetAllPayRatesResponse } from './models/GetAllPayRatesResponse';
|
export type { GetAllPayRatesResponse } from './models/GetAllPayRatesResponse';
|
||||||
export type { GetAllPayrollSchemeResponse } from './models/GetAllPayrollSchemeResponse';
|
export type { GetAllPayrollSchemeResponse } from './models/GetAllPayrollSchemeResponse';
|
||||||
export type { GetAllPositionsResponse } from './models/GetAllPositionsResponse';
|
export type { GetAllPositionsResponse } from './models/GetAllPositionsResponse';
|
||||||
export type { GetAllPriceCategoriesResponse } from './models/GetAllPriceCategoriesResponse';
|
|
||||||
export type { GetAllRolesResponse } from './models/GetAllRolesResponse';
|
export type { GetAllRolesResponse } from './models/GetAllRolesResponse';
|
||||||
export type { GetAllServicesKitsResponse } from './models/GetAllServicesKitsResponse';
|
export type { GetAllServicesKitsResponse } from './models/GetAllServicesKitsResponse';
|
||||||
export type { GetAllShippingWarehousesResponse } from './models/GetAllShippingWarehousesResponse';
|
export type { GetAllShippingWarehousesResponse } from './models/GetAllShippingWarehousesResponse';
|
||||||
@@ -307,7 +302,6 @@ export type { ResidualBoxSchema } from './models/ResidualBoxSchema';
|
|||||||
export type { ResidualPalletSchema } from './models/ResidualPalletSchema';
|
export type { ResidualPalletSchema } from './models/ResidualPalletSchema';
|
||||||
export type { ResidualProductSchema } from './models/ResidualProductSchema';
|
export type { ResidualProductSchema } from './models/ResidualProductSchema';
|
||||||
export type { RoleSchema } from './models/RoleSchema';
|
export type { RoleSchema } from './models/RoleSchema';
|
||||||
export type { ServiceCategoryPriceSchema } from './models/ServiceCategoryPriceSchema';
|
|
||||||
export type { ServiceCategoryReorderRequest } from './models/ServiceCategoryReorderRequest';
|
export type { ServiceCategoryReorderRequest } from './models/ServiceCategoryReorderRequest';
|
||||||
export type { ServiceCategoryReorderResponse } from './models/ServiceCategoryReorderResponse';
|
export type { ServiceCategoryReorderResponse } from './models/ServiceCategoryReorderResponse';
|
||||||
export type { ServiceCategorySchema } from './models/ServiceCategorySchema';
|
export type { ServiceCategorySchema } from './models/ServiceCategorySchema';
|
||||||
@@ -321,7 +315,6 @@ export type { ServiceDeleteRequest } from './models/ServiceDeleteRequest';
|
|||||||
export type { ServiceDeleteResponse } from './models/ServiceDeleteResponse';
|
export type { ServiceDeleteResponse } from './models/ServiceDeleteResponse';
|
||||||
export type { ServiceGetAllCategoriesResponse } from './models/ServiceGetAllCategoriesResponse';
|
export type { ServiceGetAllCategoriesResponse } from './models/ServiceGetAllCategoriesResponse';
|
||||||
export type { ServiceGetAllResponse } from './models/ServiceGetAllResponse';
|
export type { ServiceGetAllResponse } from './models/ServiceGetAllResponse';
|
||||||
export type { ServicePriceCategorySchema } from './models/ServicePriceCategorySchema';
|
|
||||||
export type { ServicePriceRangeSchema } from './models/ServicePriceRangeSchema';
|
export type { ServicePriceRangeSchema } from './models/ServicePriceRangeSchema';
|
||||||
export type { ServiceReorderRequest } from './models/ServiceReorderRequest';
|
export type { ServiceReorderRequest } from './models/ServiceReorderRequest';
|
||||||
export type { ServiceReorderResponse } from './models/ServiceReorderResponse';
|
export type { ServiceReorderResponse } from './models/ServiceReorderResponse';
|
||||||
@@ -359,8 +352,6 @@ export type { UpdatePayRateRequest } from './models/UpdatePayRateRequest';
|
|||||||
export type { UpdatePayRateResponse } from './models/UpdatePayRateResponse';
|
export type { UpdatePayRateResponse } from './models/UpdatePayRateResponse';
|
||||||
export type { UpdatePlanningWorkShiftRequest } from './models/UpdatePlanningWorkShiftRequest';
|
export type { UpdatePlanningWorkShiftRequest } from './models/UpdatePlanningWorkShiftRequest';
|
||||||
export type { UpdatePlanningWorkShiftResponse } from './models/UpdatePlanningWorkShiftResponse';
|
export type { UpdatePlanningWorkShiftResponse } from './models/UpdatePlanningWorkShiftResponse';
|
||||||
export type { UpdatePriceCategoryRequest } from './models/UpdatePriceCategoryRequest';
|
|
||||||
export type { UpdatePriceCategoryResponse } from './models/UpdatePriceCategoryResponse';
|
|
||||||
export type { UpdateProjectRequest } from './models/UpdateProjectRequest';
|
export type { UpdateProjectRequest } from './models/UpdateProjectRequest';
|
||||||
export type { UpdateProjectResponse } from './models/UpdateProjectResponse';
|
export type { UpdateProjectResponse } from './models/UpdateProjectResponse';
|
||||||
export type { UpdateResidualProductRequest } from './models/UpdateResidualProductRequest';
|
export type { UpdateResidualProductRequest } from './models/UpdateResidualProductRequest';
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export type CreatePriceCategoryRequest = {
|
|
||||||
name: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export type CreatePriceCategoryResponse = {
|
|
||||||
ok: boolean;
|
|
||||||
message: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
@@ -3,7 +3,6 @@
|
|||||||
/* tslint:disable */
|
/* tslint:disable */
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import type { BaseMarketplaceSchema } from './BaseMarketplaceSchema';
|
import type { BaseMarketplaceSchema } from './BaseMarketplaceSchema';
|
||||||
import type { ServicePriceCategorySchema } from './ServicePriceCategorySchema';
|
|
||||||
export type DealQuickCreateRequest = {
|
export type DealQuickCreateRequest = {
|
||||||
name: string;
|
name: string;
|
||||||
clientName: string;
|
clientName: string;
|
||||||
@@ -11,7 +10,6 @@ export type DealQuickCreateRequest = {
|
|||||||
acceptanceDate: string;
|
acceptanceDate: string;
|
||||||
shippingWarehouse: string;
|
shippingWarehouse: string;
|
||||||
baseMarketplace: BaseMarketplaceSchema;
|
baseMarketplace: BaseMarketplaceSchema;
|
||||||
category?: (ServicePriceCategorySchema | null);
|
|
||||||
statusId: number;
|
statusId: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import type { DealProductSchema } from './DealProductSchema';
|
|||||||
import type { DealServiceSchema } from './DealServiceSchema';
|
import type { DealServiceSchema } from './DealServiceSchema';
|
||||||
import type { DealStatusHistorySchema } from './DealStatusHistorySchema';
|
import type { DealStatusHistorySchema } from './DealStatusHistorySchema';
|
||||||
import type { PalletSchema } from './PalletSchema';
|
import type { PalletSchema } from './PalletSchema';
|
||||||
import type { ServicePriceCategorySchema } from './ServicePriceCategorySchema';
|
|
||||||
import type { ShippingWarehouseSchema } from './ShippingWarehouseSchema';
|
import type { ShippingWarehouseSchema } from './ShippingWarehouseSchema';
|
||||||
import type { StatusSchema } from './StatusSchema';
|
import type { StatusSchema } from './StatusSchema';
|
||||||
import type { UserSchema } from './UserSchema';
|
import type { UserSchema } from './UserSchema';
|
||||||
@@ -34,7 +33,6 @@ export type DealSchema = {
|
|||||||
comment: string;
|
comment: string;
|
||||||
shippingWarehouse?: (ShippingWarehouseSchema | string | null);
|
shippingWarehouse?: (ShippingWarehouseSchema | string | null);
|
||||||
billRequest?: (DealBillRequestSchema | null);
|
billRequest?: (DealBillRequestSchema | null);
|
||||||
category?: (ServicePriceCategorySchema | null);
|
|
||||||
group?: (DealGroupSchema | null);
|
group?: (DealGroupSchema | null);
|
||||||
manager?: (UserSchema | null);
|
manager?: (UserSchema | null);
|
||||||
pallets?: Array<PalletSchema>;
|
pallets?: Array<PalletSchema>;
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export type DeletePriceCategoryRequest = {
|
|
||||||
id: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export type DeletePriceCategoryResponse = {
|
|
||||||
ok: boolean;
|
|
||||||
message: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
import type { ServicePriceCategorySchema } from './ServicePriceCategorySchema';
|
|
||||||
export type GetAllPriceCategoriesResponse = {
|
|
||||||
priceCategories: Array<ServicePriceCategorySchema>;
|
|
||||||
};
|
|
||||||
|
|
||||||
@@ -2,8 +2,9 @@
|
|||||||
/* istanbul ignore file */
|
/* istanbul ignore file */
|
||||||
/* tslint:disable */
|
/* tslint:disable */
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
export type ServicePriceCategorySchema = {
|
export type ProjectSchemaWithCount = {
|
||||||
id: number;
|
|
||||||
name: string;
|
name: string;
|
||||||
|
id: number;
|
||||||
|
boardsCount: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
import type { ServicePriceCategorySchema } from './ServicePriceCategorySchema';
|
|
||||||
export type ServiceCategoryPriceSchema = {
|
|
||||||
category: ServicePriceCategorySchema;
|
|
||||||
price: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
/* istanbul ignore file */
|
/* istanbul ignore file */
|
||||||
/* tslint:disable */
|
/* tslint:disable */
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import type { ServiceCategoryPriceSchema } from './ServiceCategoryPriceSchema';
|
|
||||||
import type { ServiceCategorySchema } from './ServiceCategorySchema';
|
import type { ServiceCategorySchema } from './ServiceCategorySchema';
|
||||||
import type { ServicePriceRangeSchema } from './ServicePriceRangeSchema';
|
import type { ServicePriceRangeSchema } from './ServicePriceRangeSchema';
|
||||||
export type ServiceSchema = {
|
export type ServiceSchema = {
|
||||||
@@ -12,7 +11,6 @@ export type ServiceSchema = {
|
|||||||
price: number;
|
price: number;
|
||||||
serviceType: number;
|
serviceType: number;
|
||||||
priceRanges: Array<ServicePriceRangeSchema>;
|
priceRanges: Array<ServicePriceRangeSchema>;
|
||||||
categoryPrices: Array<ServiceCategoryPriceSchema>;
|
|
||||||
cost: (number | null);
|
cost: (number | null);
|
||||||
rank: string;
|
rank: string;
|
||||||
isPlaceholder?: (boolean | null);
|
isPlaceholder?: (boolean | null);
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export type UpdatePriceCategoryRequest = {
|
|
||||||
id: number;
|
|
||||||
name: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export type UpdatePriceCategoryResponse = {
|
|
||||||
ok: boolean;
|
|
||||||
message: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
@@ -3,13 +3,8 @@
|
|||||||
/* tslint:disable */
|
/* tslint:disable */
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import type { BaseEnumListSchema } from '../models/BaseEnumListSchema';
|
import type { BaseEnumListSchema } from '../models/BaseEnumListSchema';
|
||||||
import type { CreatePriceCategoryRequest } from '../models/CreatePriceCategoryRequest';
|
|
||||||
import type { CreatePriceCategoryResponse } from '../models/CreatePriceCategoryResponse';
|
|
||||||
import type { CreateServicesKitRequest } from '../models/CreateServicesKitRequest';
|
import type { CreateServicesKitRequest } from '../models/CreateServicesKitRequest';
|
||||||
import type { CreateServicesKitResponse } from '../models/CreateServicesKitResponse';
|
import type { CreateServicesKitResponse } from '../models/CreateServicesKitResponse';
|
||||||
import type { DeletePriceCategoryRequest } from '../models/DeletePriceCategoryRequest';
|
|
||||||
import type { DeletePriceCategoryResponse } from '../models/DeletePriceCategoryResponse';
|
|
||||||
import type { GetAllPriceCategoriesResponse } from '../models/GetAllPriceCategoriesResponse';
|
|
||||||
import type { GetAllServicesKitsResponse } from '../models/GetAllServicesKitsResponse';
|
import type { GetAllServicesKitsResponse } from '../models/GetAllServicesKitsResponse';
|
||||||
import type { ServiceCategoryReorderRequest } from '../models/ServiceCategoryReorderRequest';
|
import type { ServiceCategoryReorderRequest } from '../models/ServiceCategoryReorderRequest';
|
||||||
import type { ServiceCategoryReorderResponse } from '../models/ServiceCategoryReorderResponse';
|
import type { ServiceCategoryReorderResponse } from '../models/ServiceCategoryReorderResponse';
|
||||||
@@ -29,8 +24,6 @@ import type { ServiceUpdateCategoryRequest } from '../models/ServiceUpdateCatego
|
|||||||
import type { ServiceUpdateCategoryResponse } from '../models/ServiceUpdateCategoryResponse';
|
import type { ServiceUpdateCategoryResponse } from '../models/ServiceUpdateCategoryResponse';
|
||||||
import type { ServiceUpdateRequest } from '../models/ServiceUpdateRequest';
|
import type { ServiceUpdateRequest } from '../models/ServiceUpdateRequest';
|
||||||
import type { ServiceUpdateResponse } from '../models/ServiceUpdateResponse';
|
import type { ServiceUpdateResponse } from '../models/ServiceUpdateResponse';
|
||||||
import type { UpdatePriceCategoryRequest } from '../models/UpdatePriceCategoryRequest';
|
|
||||||
import type { UpdatePriceCategoryResponse } from '../models/UpdatePriceCategoryResponse';
|
|
||||||
import type { UpdateServicesKitRequest } from '../models/UpdateServicesKitRequest';
|
import type { UpdateServicesKitRequest } from '../models/UpdateServicesKitRequest';
|
||||||
import type { UpdateServicesKitResponse } from '../models/UpdateServicesKitResponse';
|
import type { UpdateServicesKitResponse } from '../models/UpdateServicesKitResponse';
|
||||||
import type { CancelablePromise } from '../core/CancelablePromise';
|
import type { CancelablePromise } from '../core/CancelablePromise';
|
||||||
@@ -302,77 +295,6 @@ export class ServiceService {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Get All Price Categories
|
|
||||||
* @returns GetAllPriceCategoriesResponse Successful Response
|
|
||||||
* @throws ApiError
|
|
||||||
*/
|
|
||||||
public static getAllPriceCategories(): CancelablePromise<GetAllPriceCategoriesResponse> {
|
|
||||||
return __request(OpenAPI, {
|
|
||||||
method: 'GET',
|
|
||||||
url: '/service/price-categories/get-all',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Create Price Category
|
|
||||||
* @returns CreatePriceCategoryResponse Successful Response
|
|
||||||
* @throws ApiError
|
|
||||||
*/
|
|
||||||
public static createPriceCategory({
|
|
||||||
requestBody,
|
|
||||||
}: {
|
|
||||||
requestBody: CreatePriceCategoryRequest,
|
|
||||||
}): CancelablePromise<CreatePriceCategoryResponse> {
|
|
||||||
return __request(OpenAPI, {
|
|
||||||
method: 'POST',
|
|
||||||
url: '/service/price-categories/create',
|
|
||||||
body: requestBody,
|
|
||||||
mediaType: 'application/json',
|
|
||||||
errors: {
|
|
||||||
422: `Validation Error`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Update Price Category
|
|
||||||
* @returns UpdatePriceCategoryResponse Successful Response
|
|
||||||
* @throws ApiError
|
|
||||||
*/
|
|
||||||
public static updatePriceCategory({
|
|
||||||
requestBody,
|
|
||||||
}: {
|
|
||||||
requestBody: UpdatePriceCategoryRequest,
|
|
||||||
}): CancelablePromise<UpdatePriceCategoryResponse> {
|
|
||||||
return __request(OpenAPI, {
|
|
||||||
method: 'POST',
|
|
||||||
url: '/service/price-categories/update',
|
|
||||||
body: requestBody,
|
|
||||||
mediaType: 'application/json',
|
|
||||||
errors: {
|
|
||||||
422: `Validation Error`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Delete Price Category
|
|
||||||
* @returns DeletePriceCategoryResponse Successful Response
|
|
||||||
* @throws ApiError
|
|
||||||
*/
|
|
||||||
public static deletePriceCategory({
|
|
||||||
requestBody,
|
|
||||||
}: {
|
|
||||||
requestBody: DeletePriceCategoryRequest,
|
|
||||||
}): CancelablePromise<DeletePriceCategoryResponse> {
|
|
||||||
return __request(OpenAPI, {
|
|
||||||
method: 'POST',
|
|
||||||
url: '/service/price-categories/delete',
|
|
||||||
body: requestBody,
|
|
||||||
mediaType: 'application/json',
|
|
||||||
errors: {
|
|
||||||
422: `Validation Error`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Export List Pdf
|
* Export List Pdf
|
||||||
* @returns any Successful Response
|
* @returns any Successful Response
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import { DateTimePicker } from "@mantine/dates";
|
|||||||
import ShippingWarehouseAutocomplete
|
import ShippingWarehouseAutocomplete
|
||||||
from "../../../Selects/ShippingWarehouseAutocomplete/ShippingWarehouseAutocomplete.tsx";
|
from "../../../Selects/ShippingWarehouseAutocomplete/ShippingWarehouseAutocomplete.tsx";
|
||||||
import BaseMarketplaceSelect from "../../../Selects/BaseMarketplaceSelect/BaseMarketplaceSelect.tsx";
|
import BaseMarketplaceSelect from "../../../Selects/BaseMarketplaceSelect/BaseMarketplaceSelect.tsx";
|
||||||
import ServicePriceCategorySelect from "../../../Selects/ServicePriceCategorySelect/ServicePriceCategorySelect.tsx";
|
|
||||||
import { usePrefillDealContext } from "../../../../pages/DealsPage/contexts/PrefillDealContext.tsx";
|
import { usePrefillDealContext } from "../../../../pages/DealsPage/contexts/PrefillDealContext.tsx";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -69,14 +68,6 @@ const CreateDealFrom: FC<Props> = ({ onSubmit, onCancel }) => {
|
|||||||
placeholder={"Склад отгрузки"}
|
placeholder={"Склад отгрузки"}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles["inputs"]}>
|
|
||||||
<ServicePriceCategorySelect
|
|
||||||
rightSection={<></>}
|
|
||||||
placeholder={"Выберите категорию"}
|
|
||||||
{...form.getInputProps("category")}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={styles["inputs"]}>
|
<div className={styles["inputs"]}>
|
||||||
<Textarea
|
<Textarea
|
||||||
autosize
|
autosize
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
import ObjectSelect, {
|
|
||||||
ObjectSelectProps,
|
|
||||||
} from "../../ObjectSelect/ObjectSelect.tsx";
|
|
||||||
import { ServicePriceCategorySchema } from "../../../client";
|
|
||||||
import useServicePriceCategoriesList from "../../../pages/ServicesPage/hooks/useServicePriceCategoriesList.tsx";
|
|
||||||
|
|
||||||
type Props = Omit<ObjectSelectProps<ServicePriceCategorySchema>, "data">;
|
|
||||||
|
|
||||||
const ServicePriceCategorySelect = (props: Props) => {
|
|
||||||
const { objects } = useServicePriceCategoriesList();
|
|
||||||
return (
|
|
||||||
<ObjectSelect
|
|
||||||
{...props}
|
|
||||||
data={objects}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default ServicePriceCategorySelect;
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { ObjectSelectProps } from "../ObjectSelect/ObjectSelect.tsx";
|
import { ObjectSelectProps } from "../ObjectSelect/ObjectSelect.tsx";
|
||||||
import { ServicePriceCategorySchema, ServiceSchema } from "../../client";
|
import { ServiceSchema } from "../../client";
|
||||||
import {
|
import {
|
||||||
Flex,
|
Flex,
|
||||||
FlexProps,
|
FlexProps,
|
||||||
@@ -21,7 +21,6 @@ type Props = {
|
|||||||
containerProps: FlexProps;
|
containerProps: FlexProps;
|
||||||
filterType?: ServiceType;
|
filterType?: ServiceType;
|
||||||
lockOnEdit?: boolean;
|
lockOnEdit?: boolean;
|
||||||
category?: ServicePriceCategorySchema;
|
|
||||||
};
|
};
|
||||||
const ServiceWithPriceInput: FC<Props> = ({
|
const ServiceWithPriceInput: FC<Props> = ({
|
||||||
serviceProps,
|
serviceProps,
|
||||||
@@ -30,7 +29,6 @@ const ServiceWithPriceInput: FC<Props> = ({
|
|||||||
containerProps,
|
containerProps,
|
||||||
filterType = ServiceType.PRODUCT_SERVICE,
|
filterType = ServiceType.PRODUCT_SERVICE,
|
||||||
lockOnEdit = true,
|
lockOnEdit = true,
|
||||||
category,
|
|
||||||
}) => {
|
}) => {
|
||||||
const [price, setPrice] = useState<number | undefined>(
|
const [price, setPrice] = useState<number | undefined>(
|
||||||
typeof priceProps.value === "number" ? priceProps.value : undefined
|
typeof priceProps.value === "number" ? priceProps.value : undefined
|
||||||
@@ -51,19 +49,8 @@ const ServiceWithPriceInput: FC<Props> = ({
|
|||||||
setPrice(range.price);
|
setPrice(range.price);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
const setPriceBasedOnCategory = () => {
|
|
||||||
if (!category || !service) return false;
|
|
||||||
const categoryPrice = service.categoryPrices.find(
|
|
||||||
categoryPrice => categoryPrice.category.id === category.id
|
|
||||||
);
|
|
||||||
if (!categoryPrice) return false;
|
|
||||||
setPrice(categoryPrice.price);
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
const setPriceBasedOnService = () => {
|
const setPriceBasedOnService = () => {
|
||||||
if (!service) return;
|
if (!service) return;
|
||||||
// if category is set, we should not set price based on service
|
|
||||||
if (setPriceBasedOnCategory()) return;
|
|
||||||
if (setPriceBasedOnQuantity()) return;
|
if (setPriceBasedOnQuantity()) return;
|
||||||
setPrice(service.price);
|
setPrice(service.price);
|
||||||
};
|
};
|
||||||
@@ -76,9 +63,6 @@ const ServiceWithPriceInput: FC<Props> = ({
|
|||||||
};
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isFirstRender.current && lockOnEdit) return;
|
if (isFirstRender.current && lockOnEdit) return;
|
||||||
|
|
||||||
// we need to set price based on quantity only if category is not set, because category has higher priority
|
|
||||||
if (category) return;
|
|
||||||
setPriceBasedOnQuantity();
|
setPriceBasedOnQuantity();
|
||||||
}, [quantity]);
|
}, [quantity]);
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import ServicesKitSelectModal from "./ServicesKitSelectModal/ServicesKitSelectMo
|
|||||||
import SelectDealProductsModal from "../pages/DealsPage/modals/SelectDealProductsModal.tsx";
|
import SelectDealProductsModal from "../pages/DealsPage/modals/SelectDealProductsModal.tsx";
|
||||||
import ShippingWarehouseForm from "../pages/ShippingWarehousesPage/modals/ShippingWarehouseForm.tsx";
|
import ShippingWarehouseForm from "../pages/ShippingWarehousesPage/modals/ShippingWarehouseForm.tsx";
|
||||||
import MarketplaceFormModal from "../pages/MarketplacesPage/modals/MarketplaceFormModal/MarketplaceFormModal.tsx";
|
import MarketplaceFormModal from "../pages/MarketplacesPage/modals/MarketplaceFormModal/MarketplaceFormModal.tsx";
|
||||||
import ServicePriceCategoryForm from "../pages/ServicesPage/modals/ServicePriceCategoryForm.tsx";
|
|
||||||
import ScanningModal from "./ScanningModal/ScanningModal.tsx";
|
import ScanningModal from "./ScanningModal/ScanningModal.tsx";
|
||||||
import TransactionFormModal from "../pages/AdminPage/tabs/Transactions/modals/TransactionFormModal.tsx";
|
import TransactionFormModal from "../pages/AdminPage/tabs/Transactions/modals/TransactionFormModal.tsx";
|
||||||
import TransactionTagsModal from "../pages/AdminPage/tabs/Transactions/modals/TransactionTagsModal.tsx";
|
import TransactionTagsModal from "../pages/AdminPage/tabs/Transactions/modals/TransactionTagsModal.tsx";
|
||||||
@@ -61,7 +60,6 @@ export const modals = {
|
|||||||
selectDealProductsModal: SelectDealProductsModal,
|
selectDealProductsModal: SelectDealProductsModal,
|
||||||
shippingWarehouseForm: ShippingWarehouseForm,
|
shippingWarehouseForm: ShippingWarehouseForm,
|
||||||
marketplaceFormModal: MarketplaceFormModal,
|
marketplaceFormModal: MarketplaceFormModal,
|
||||||
servicePriceCategoryForm: ServicePriceCategoryForm,
|
|
||||||
scanningModal: ScanningModal,
|
scanningModal: ScanningModal,
|
||||||
transactionFormModal: TransactionFormModal,
|
transactionFormModal: TransactionFormModal,
|
||||||
transactionTagsModal: TransactionTagsModal,
|
transactionTagsModal: TransactionTagsModal,
|
||||||
|
|||||||
@@ -174,14 +174,6 @@ const Content: FC<Props> = ({ deal }) => {
|
|||||||
{...form.getInputProps("status")}
|
{...form.getInputProps("status")}
|
||||||
label={"Статус"}
|
label={"Статус"}
|
||||||
/>
|
/>
|
||||||
{deal.category && (
|
|
||||||
<TextInput
|
|
||||||
disabled
|
|
||||||
placeholder={"Категория"}
|
|
||||||
label={"Категория"}
|
|
||||||
value={deal.category.name}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<Textarea
|
<Textarea
|
||||||
h={rem(150)}
|
h={rem(150)}
|
||||||
styles={{
|
styles={{
|
||||||
|
|||||||
@@ -1,15 +1,8 @@
|
|||||||
import { ContextModalProps } from "@mantine/modals";
|
import { ContextModalProps } from "@mantine/modals";
|
||||||
import BaseFormModal, {
|
import BaseFormModal, { CreateEditFormProps } from "../../ClientsPage/modals/BaseFormModal/BaseFormModal.tsx";
|
||||||
CreateEditFormProps,
|
import { DealServiceSchema } from "../../../client";
|
||||||
} from "../../ClientsPage/modals/BaseFormModal/BaseFormModal.tsx";
|
|
||||||
import { DealServiceSchema, ServicePriceCategorySchema } from "../../../client";
|
|
||||||
import { useForm } from "@mantine/form";
|
import { useForm } from "@mantine/form";
|
||||||
import {
|
import { ComboboxItem, ComboboxItemGroup, NumberInput, OptionsFilter } from "@mantine/core";
|
||||||
ComboboxItem,
|
|
||||||
ComboboxItemGroup,
|
|
||||||
NumberInput,
|
|
||||||
OptionsFilter,
|
|
||||||
} from "@mantine/core";
|
|
||||||
import ServiceWithPriceInput from "../../../components/ServiceWithPriceInput/ServiceWithPriceInput.tsx";
|
import ServiceWithPriceInput from "../../../components/ServiceWithPriceInput/ServiceWithPriceInput.tsx";
|
||||||
import { ServiceType } from "../../../shared/enums/ServiceType.ts";
|
import { ServiceType } from "../../../shared/enums/ServiceType.ts";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
@@ -17,7 +10,6 @@ import { RootState } from "../../../redux/store.ts";
|
|||||||
|
|
||||||
type RestProps = {
|
type RestProps = {
|
||||||
serviceIds?: number[];
|
serviceIds?: number[];
|
||||||
category?: ServicePriceCategorySchema;
|
|
||||||
};
|
};
|
||||||
type Props = CreateEditFormProps<Partial<DealServiceSchema>> & RestProps;
|
type Props = CreateEditFormProps<Partial<DealServiceSchema>> & RestProps;
|
||||||
const AddDealServiceModal = ({
|
const AddDealServiceModal = ({
|
||||||
@@ -26,7 +18,6 @@ const AddDealServiceModal = ({
|
|||||||
innerProps,
|
innerProps,
|
||||||
}: ContextModalProps<Props>) => {
|
}: ContextModalProps<Props>) => {
|
||||||
const authState = useSelector((state: RootState) => state.auth);
|
const authState = useSelector((state: RootState) => state.auth);
|
||||||
console.log(innerProps.category);
|
|
||||||
const isEditing = "element" in innerProps;
|
const isEditing = "element" in innerProps;
|
||||||
const form = useForm<Partial<DealServiceSchema>>({
|
const form = useForm<Partial<DealServiceSchema>>({
|
||||||
initialValues: isEditing
|
initialValues: isEditing
|
||||||
@@ -77,7 +68,6 @@ const AddDealServiceModal = ({
|
|||||||
<BaseFormModal.Body>
|
<BaseFormModal.Body>
|
||||||
<>
|
<>
|
||||||
<ServiceWithPriceInput
|
<ServiceWithPriceInput
|
||||||
category={innerProps.category}
|
|
||||||
serviceProps={{
|
serviceProps={{
|
||||||
...form.getInputProps("service"),
|
...form.getInputProps("service"),
|
||||||
label: "Услуга",
|
label: "Услуга",
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import BaseFormModal, {
|
|||||||
} from "../../ClientsPage/modals/BaseFormModal/BaseFormModal.tsx";
|
} from "../../ClientsPage/modals/BaseFormModal/BaseFormModal.tsx";
|
||||||
import {
|
import {
|
||||||
DealProductServiceSchema,
|
DealProductServiceSchema,
|
||||||
ServicePriceCategorySchema,
|
|
||||||
ServiceSchema,
|
ServiceSchema,
|
||||||
} from "../../../client";
|
} from "../../../client";
|
||||||
import { ContextModalProps } from "@mantine/modals";
|
import { ContextModalProps } from "@mantine/modals";
|
||||||
@@ -18,7 +17,6 @@ import { RootState } from "../../../redux/store.ts";
|
|||||||
type RestProps = {
|
type RestProps = {
|
||||||
quantity: number;
|
quantity: number;
|
||||||
serviceIds: number[];
|
serviceIds: number[];
|
||||||
category?: ServicePriceCategorySchema;
|
|
||||||
};
|
};
|
||||||
type Props = CreateEditFormProps<DealProductServiceSchema> & RestProps;
|
type Props = CreateEditFormProps<DealProductServiceSchema> & RestProps;
|
||||||
|
|
||||||
@@ -60,7 +58,6 @@ const ProductServiceFormModal = ({
|
|||||||
<>
|
<>
|
||||||
<Flex w={"100%"} direction={"column"} gap={rem(10)}>
|
<Flex w={"100%"} direction={"column"} gap={rem(10)}>
|
||||||
<ServiceWithPriceInput
|
<ServiceWithPriceInput
|
||||||
category={innerProps.category}
|
|
||||||
serviceProps={{
|
serviceProps={{
|
||||||
...form.getInputProps("service"),
|
...form.getInputProps("service"),
|
||||||
label: "Услуга",
|
label: "Услуга",
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ const DealServicesTable: FC<Props> = ({
|
|||||||
innerProps: {
|
innerProps: {
|
||||||
onCreate: onCreate,
|
onCreate: onCreate,
|
||||||
serviceIds,
|
serviceIds,
|
||||||
category: dealState.deal?.category || undefined,
|
|
||||||
},
|
},
|
||||||
withCloseButton: false,
|
withCloseButton: false,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ const ProductServicesTable: FC<Props> = ({
|
|||||||
onCreate: onCreate,
|
onCreate: onCreate,
|
||||||
serviceIds,
|
serviceIds,
|
||||||
quantity,
|
quantity,
|
||||||
category: dealState.deal?.category || undefined,
|
|
||||||
},
|
},
|
||||||
withCloseButton: false,
|
withCloseButton: false,
|
||||||
});
|
});
|
||||||
@@ -63,7 +62,6 @@ const ProductServicesTable: FC<Props> = ({
|
|||||||
onChange,
|
onChange,
|
||||||
serviceIds,
|
serviceIds,
|
||||||
quantity,
|
quantity,
|
||||||
category: dealState.deal?.category || undefined,
|
|
||||||
},
|
},
|
||||||
withCloseButton: false,
|
withCloseButton: false,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,53 +0,0 @@
|
|||||||
import { CRUDTableProps } from "../../../../types/CRUDTable.tsx";
|
|
||||||
import { ServicePriceCategorySchema } from "../../../../client";
|
|
||||||
import { FC } from "react";
|
|
||||||
import { BaseTable } from "../../../../components/BaseTable/BaseTable.tsx";
|
|
||||||
import useServicePriceCategoryTableColumns from "./columns.tsx";
|
|
||||||
import { MRT_TableOptions } from "mantine-react-table";
|
|
||||||
import { ActionIcon, Flex, Tooltip } from "@mantine/core";
|
|
||||||
import { IconEdit, IconTrash } from "@tabler/icons-react";
|
|
||||||
|
|
||||||
type Props = CRUDTableProps<ServicePriceCategorySchema>;
|
|
||||||
|
|
||||||
const ServicePriceCategoryTable: FC<Props> = ({
|
|
||||||
items,
|
|
||||||
onChange,
|
|
||||||
onDelete,
|
|
||||||
}) => {
|
|
||||||
const columns = useServicePriceCategoryTableColumns();
|
|
||||||
return (
|
|
||||||
<BaseTable
|
|
||||||
data={items}
|
|
||||||
columns={columns}
|
|
||||||
restProps={
|
|
||||||
{
|
|
||||||
enableRowActions: true,
|
|
||||||
renderRowActions: ({ row }) => (
|
|
||||||
<Flex gap="md">
|
|
||||||
<Tooltip label="Редактировать">
|
|
||||||
<ActionIcon
|
|
||||||
onClick={() =>
|
|
||||||
onChange && onChange(row.original)
|
|
||||||
}
|
|
||||||
variant={"default"}>
|
|
||||||
<IconEdit />
|
|
||||||
</ActionIcon>
|
|
||||||
</Tooltip>
|
|
||||||
<Tooltip label="Удалить">
|
|
||||||
<ActionIcon
|
|
||||||
onClick={() =>
|
|
||||||
onDelete && onDelete(row.original)
|
|
||||||
}
|
|
||||||
variant={"default"}>
|
|
||||||
<IconTrash />
|
|
||||||
</ActionIcon>
|
|
||||||
</Tooltip>
|
|
||||||
</Flex>
|
|
||||||
),
|
|
||||||
} as MRT_TableOptions<ServicePriceCategorySchema>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default ServicePriceCategoryTable;
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
import { useMemo } from "react";
|
|
||||||
import { MRT_ColumnDef } from "mantine-react-table";
|
|
||||||
import { ServicePriceCategorySchema } from "../../../../client";
|
|
||||||
|
|
||||||
const useServicePriceCategoryTableColumns = () => {
|
|
||||||
return useMemo<MRT_ColumnDef<ServicePriceCategorySchema>[]>(
|
|
||||||
() => [
|
|
||||||
{
|
|
||||||
accessorKey: "name",
|
|
||||||
header: "Название",
|
|
||||||
enableColumnActions: false,
|
|
||||||
enableSorting: false,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[]
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default useServicePriceCategoryTableColumns;
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
import { BaseFormInputProps } from "../../../../types/utils.ts";
|
|
||||||
import type {
|
|
||||||
ServiceCategoryPriceSchema,
|
|
||||||
ServicePriceCategorySchema,
|
|
||||||
} from "../../../../client";
|
|
||||||
import { FC, useEffect, useState } from "react";
|
|
||||||
import { Flex, NumberInput, rem } from "@mantine/core";
|
|
||||||
import ServicePriceCategorySelect from "../../../../components/Selects/ServicePriceCategorySelect/ServicePriceCategorySelect.tsx";
|
|
||||||
|
|
||||||
export type PriceCategoryInputProps = BaseFormInputProps<
|
|
||||||
ServiceCategoryPriceSchema[]
|
|
||||||
>;
|
|
||||||
|
|
||||||
const PriceCategoryInput: FC<PriceCategoryInputProps> = (
|
|
||||||
props: PriceCategoryInputProps
|
|
||||||
) => {
|
|
||||||
const [innerState, setInnerState] = useState<ServiceCategoryPriceSchema[]>(
|
|
||||||
props.value || []
|
|
||||||
);
|
|
||||||
const [category, setCategory] = useState<
|
|
||||||
ServicePriceCategorySchema | undefined
|
|
||||||
>(undefined);
|
|
||||||
|
|
||||||
const getValue = (): number | undefined | string => {
|
|
||||||
if (category === undefined) return undefined;
|
|
||||||
const value = innerState.find(item => item.category.id === category.id);
|
|
||||||
|
|
||||||
return value?.price || "";
|
|
||||||
};
|
|
||||||
const handleChange = (value: number | string) => {
|
|
||||||
// remove value if is string
|
|
||||||
if (typeof value === "string") {
|
|
||||||
setInnerState(
|
|
||||||
innerState.filter(item => item.category.id !== category?.id)
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const newValue = {
|
|
||||||
category: category as ServicePriceCategorySchema,
|
|
||||||
price: value,
|
|
||||||
};
|
|
||||||
const newInnerState = innerState.filter(
|
|
||||||
item => item.category.id !== category?.id
|
|
||||||
);
|
|
||||||
setInnerState([...newInnerState, newValue]);
|
|
||||||
};
|
|
||||||
useEffect(() => {
|
|
||||||
if (props.value === innerState) return;
|
|
||||||
props.onChange(innerState);
|
|
||||||
}, [innerState]);
|
|
||||||
return (
|
|
||||||
<Flex
|
|
||||||
direction={"column"}
|
|
||||||
gap={rem(10)}>
|
|
||||||
<ServicePriceCategorySelect
|
|
||||||
label={"Категория цены"}
|
|
||||||
placeholder={"Выберите категорию цены"}
|
|
||||||
onChange={setCategory}
|
|
||||||
/>
|
|
||||||
<NumberInput
|
|
||||||
label={"Цена"}
|
|
||||||
placeholder={"Введите цену"}
|
|
||||||
value={getValue()}
|
|
||||||
onChange={handleChange}
|
|
||||||
/>
|
|
||||||
</Flex>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default PriceCategoryInput;
|
|
||||||
@@ -5,7 +5,6 @@ import { omit } from "lodash";
|
|||||||
export enum ServicePriceType {
|
export enum ServicePriceType {
|
||||||
DEFAULT,
|
DEFAULT,
|
||||||
BY_RANGE,
|
BY_RANGE,
|
||||||
BY_CATEGORY,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type RestProps = {
|
type RestProps = {
|
||||||
@@ -26,10 +25,6 @@ const ServicePriceTypeSegmentedControl: FC<Props> = props => {
|
|||||||
label: "По диапазону",
|
label: "По диапазону",
|
||||||
value: ServicePriceType.BY_RANGE.toString(),
|
value: ServicePriceType.BY_RANGE.toString(),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: "По категории",
|
|
||||||
value: ServicePriceType.BY_CATEGORY.toString(),
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
const handleChange = (value: string) => {
|
const handleChange = (value: string) => {
|
||||||
onChange(Number(value));
|
onChange(Number(value));
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ export enum ServicesTab {
|
|||||||
DEAL_SERVICE,
|
DEAL_SERVICE,
|
||||||
PRODUCT_SERVICE,
|
PRODUCT_SERVICE,
|
||||||
SERVICES_KITS,
|
SERVICES_KITS,
|
||||||
SERVICES_PRICE_CATEGORIES,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Props = Omit<SegmentedControlProps, "data">;
|
type Props = Omit<SegmentedControlProps, "data">;
|
||||||
@@ -22,10 +21,6 @@ const data = [
|
|||||||
label: "Наборы услуг",
|
label: "Наборы услуг",
|
||||||
value: ServicesTab.SERVICES_KITS.toString(),
|
value: ServicesTab.SERVICES_KITS.toString(),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: "Категории цен",
|
|
||||||
value: ServicesTab.SERVICES_PRICE_CATEGORIES.toString(),
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
const ServiceTypeSegmentedControl: FC<Props> = props => {
|
const ServiceTypeSegmentedControl: FC<Props> = props => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
import ObjectList from "../../../hooks/objectList.tsx";
|
|
||||||
import { ServiceService } from "../../../client";
|
|
||||||
|
|
||||||
const useServicePriceCategoriesList = () =>
|
|
||||||
ObjectList({
|
|
||||||
queryFn: ServiceService.getAllPriceCategories,
|
|
||||||
getObjectsFn: response => response.priceCategories,
|
|
||||||
queryKey: "getAllPriceCategories",
|
|
||||||
});
|
|
||||||
|
|
||||||
export default useServicePriceCategoriesList;
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
import UseObjectState from "../../../types/UseObjectState.ts";
|
|
||||||
import {
|
|
||||||
type ServicePriceCategorySchema,
|
|
||||||
ServiceService,
|
|
||||||
} from "../../../client";
|
|
||||||
import useServicePriceCategoriesList from "./useServicePriceCategoriesList.tsx";
|
|
||||||
import { modals } from "@mantine/modals";
|
|
||||||
import { notifications } from "../../../shared/lib/notifications.ts";
|
|
||||||
|
|
||||||
const useServicePriceCategoryState =
|
|
||||||
(): UseObjectState<ServicePriceCategorySchema> => {
|
|
||||||
const { objects, refetch } = useServicePriceCategoriesList();
|
|
||||||
const onCreateClick = () => {
|
|
||||||
modals.openContextModal({
|
|
||||||
modal: "servicePriceCategoryForm",
|
|
||||||
title: "Создание категории цен",
|
|
||||||
withCloseButton: false,
|
|
||||||
innerProps: {
|
|
||||||
onCreate,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const onCreate = (values: ServicePriceCategorySchema) => {
|
|
||||||
console.log(ServiceService);
|
|
||||||
ServiceService.createPriceCategory({
|
|
||||||
requestBody: {
|
|
||||||
name: values.name,
|
|
||||||
},
|
|
||||||
}).then(async ({ ok, message }) => {
|
|
||||||
notifications.guess(ok, { message: message });
|
|
||||||
if (!ok) return;
|
|
||||||
await refetch();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const onDelete = (item: ServicePriceCategorySchema) => {
|
|
||||||
modals.openConfirmModal({
|
|
||||||
title: "Удаление категории",
|
|
||||||
children: "Вы уверены, что хотите удалить категорию?",
|
|
||||||
onConfirm: () => {
|
|
||||||
ServiceService.deletePriceCategory({
|
|
||||||
requestBody: {
|
|
||||||
id: item.id,
|
|
||||||
},
|
|
||||||
}).then(async ({ ok, message }) => {
|
|
||||||
notifications.guess(ok, { message: message });
|
|
||||||
if (!ok) return;
|
|
||||||
await refetch();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const onChange = (item: ServicePriceCategorySchema) => {
|
|
||||||
modals.openContextModal({
|
|
||||||
modal: "servicePriceCategoryForm",
|
|
||||||
title: "Изменение категории цен",
|
|
||||||
withCloseButton: false,
|
|
||||||
innerProps: {
|
|
||||||
onChange: (values: ServicePriceCategorySchema) => {
|
|
||||||
ServiceService.updatePriceCategory({
|
|
||||||
requestBody: {
|
|
||||||
id: item.id,
|
|
||||||
name: values.name,
|
|
||||||
},
|
|
||||||
}).then(async ({ ok, message }) => {
|
|
||||||
notifications.guess(ok, { message: message });
|
|
||||||
if (!ok) return;
|
|
||||||
await refetch();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
element: item,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
return {
|
|
||||||
onCreateClick,
|
|
||||||
onCreate,
|
|
||||||
onDelete,
|
|
||||||
onChange,
|
|
||||||
objects,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
export default useServicePriceCategoryState;
|
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
import { ServicePriceRangeSchema, ServiceSchema } from "../../../client";
|
import { ServicePriceRangeSchema, ServiceSchema } from "../../../client";
|
||||||
import { useForm } from "@mantine/form";
|
import { useForm } from "@mantine/form";
|
||||||
import { ContextModalProps } from "@mantine/modals";
|
import { ContextModalProps } from "@mantine/modals";
|
||||||
import BaseFormModal, {
|
import BaseFormModal, { CreateEditFormProps } from "../../ClientsPage/modals/BaseFormModal/BaseFormModal.tsx";
|
||||||
CreateEditFormProps,
|
|
||||||
} from "../../ClientsPage/modals/BaseFormModal/BaseFormModal.tsx";
|
|
||||||
import { Fieldset, Flex, rem, TextInput } from "@mantine/core";
|
import { Fieldset, Flex, rem, TextInput } from "@mantine/core";
|
||||||
import ServiceCategorySelect from "../components/ServiceCategorySelect/ServiceCategorySelect.tsx";
|
import ServiceCategorySelect from "../components/ServiceCategorySelect/ServiceCategorySelect.tsx";
|
||||||
import ServiceTypeSelect from "../components/ServiceTypeSelect/ServiceTypeSelect.tsx";
|
import ServiceTypeSelect from "../components/ServiceTypeSelect/ServiceTypeSelect.tsx";
|
||||||
@@ -11,13 +9,8 @@ import ServicePriceTypeSegmentedControl, {
|
|||||||
ServicePriceType,
|
ServicePriceType,
|
||||||
} from "../components/ServicePriceTypeSegmentedControl/ServicePriceTypeSegmentedControl.tsx";
|
} from "../components/ServicePriceTypeSegmentedControl/ServicePriceTypeSegmentedControl.tsx";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import RangePriceInput, {
|
import RangePriceInput, { PriceRangeInputType } from "../components/ServicePriceInput/RangePriceInput.tsx";
|
||||||
PriceRangeInputType,
|
|
||||||
} from "../components/ServicePriceInput/RangePriceInput.tsx";
|
|
||||||
import SinglePriceInput from "../components/ServicePriceInput/SinglePriceInput.tsx";
|
import SinglePriceInput from "../components/ServicePriceInput/SinglePriceInput.tsx";
|
||||||
import PriceCategoryInput, {
|
|
||||||
PriceCategoryInputProps,
|
|
||||||
} from "../components/ServicePriceInput/PriceCategoryInput.tsx";
|
|
||||||
|
|
||||||
type Props = CreateEditFormProps<ServiceSchema>;
|
type Props = CreateEditFormProps<ServiceSchema>;
|
||||||
const CreateServiceModal = ({
|
const CreateServiceModal = ({
|
||||||
@@ -44,7 +37,6 @@ const CreateServiceModal = ({
|
|||||||
serviceType: -1,
|
serviceType: -1,
|
||||||
priceRanges: [] as ServicePriceRangeSchema[],
|
priceRanges: [] as ServicePriceRangeSchema[],
|
||||||
cost: null,
|
cost: null,
|
||||||
categoryPrices: [],
|
|
||||||
rank: "",
|
rank: "",
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -89,14 +81,6 @@ const CreateServiceModal = ({
|
|||||||
) as PriceRangeInputType)}
|
) as PriceRangeInputType)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
case ServicePriceType.BY_CATEGORY:
|
|
||||||
return (
|
|
||||||
<PriceCategoryInput
|
|
||||||
{...(form.getInputProps(
|
|
||||||
"categoryPrices",
|
|
||||||
) as PriceCategoryInputProps)}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const onCancelClick = () => {
|
const onCancelClick = () => {
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
import { ServicePriceCategorySchema } from "../../../client";
|
|
||||||
import BaseFormModal, {
|
|
||||||
CreateEditFormProps,
|
|
||||||
} from "../../ClientsPage/modals/BaseFormModal/BaseFormModal.tsx";
|
|
||||||
import { ContextModalProps } from "@mantine/modals";
|
|
||||||
import { TextInput } from "@mantine/core";
|
|
||||||
import { useForm } from "@mantine/form";
|
|
||||||
|
|
||||||
type Props = CreateEditFormProps<ServicePriceCategorySchema>;
|
|
||||||
|
|
||||||
const ServicePriceCategoryForm = ({
|
|
||||||
context,
|
|
||||||
id,
|
|
||||||
innerProps,
|
|
||||||
}: ContextModalProps<Props>) => {
|
|
||||||
const isEditing = "element" in innerProps;
|
|
||||||
const initialValues: Partial<ServicePriceCategorySchema> = isEditing
|
|
||||||
? innerProps.element
|
|
||||||
: {
|
|
||||||
name: "",
|
|
||||||
};
|
|
||||||
const form = useForm<Partial<ServicePriceCategorySchema>>({
|
|
||||||
initialValues,
|
|
||||||
});
|
|
||||||
return (
|
|
||||||
<BaseFormModal
|
|
||||||
{...innerProps}
|
|
||||||
form={form}
|
|
||||||
closeOnSubmit
|
|
||||||
onClose={() => context.closeContextModal(id)}>
|
|
||||||
<BaseFormModal.Body>
|
|
||||||
<>
|
|
||||||
<TextInput
|
|
||||||
label={"Название"}
|
|
||||||
placeholder={"Введите название категории"}
|
|
||||||
{...form.getInputProps("name")}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
</BaseFormModal.Body>
|
|
||||||
</BaseFormModal>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default ServicePriceCategoryForm;
|
|
||||||
@@ -7,11 +7,8 @@ import ServiceTypeSegmentedControl, {
|
|||||||
ServicesTab,
|
ServicesTab,
|
||||||
} from "../components/ServiceTypeSegmentedControl/ServiceTypeSegmentedControl.tsx";
|
} from "../components/ServiceTypeSegmentedControl/ServiceTypeSegmentedControl.tsx";
|
||||||
import ServicesKitsTable from "../components/ServicesKitsTable/ServicesKitsTable.tsx";
|
import ServicesKitsTable from "../components/ServicesKitsTable/ServicesKitsTable.tsx";
|
||||||
import ServicePriceCategoryTable from "../components/ServicePriceCategoryTable/ServicePriceCategoryTable.tsx";
|
|
||||||
import useServicesState from "../hooks/useServicesState.tsx";
|
import useServicesState from "../hooks/useServicesState.tsx";
|
||||||
import useServicesKitsState from "../hooks/useServicesKitsState.tsx";
|
import useServicesKitsState from "../hooks/useServicesKitsState.tsx";
|
||||||
import useServicePriceCategoryState from "../hooks/useServicePriceCategoryState.tsx";
|
|
||||||
import { ObjectStateToTableProps } from "../../../types/utils.ts";
|
|
||||||
import { IconDownload, IconFileExcel, IconFileTypePdf } from "@tabler/icons-react";
|
import { IconDownload, IconFileExcel, IconFileTypePdf } from "@tabler/icons-react";
|
||||||
import FileSaver from "file-saver";
|
import FileSaver from "file-saver";
|
||||||
import { getCurrentDateTimeForFilename } from "../../../shared/lib/date.ts";
|
import { getCurrentDateTimeForFilename } from "../../../shared/lib/date.ts";
|
||||||
@@ -28,10 +25,6 @@ export const ServicesPage: FC = () => {
|
|||||||
} = useServicesState();
|
} = useServicesState();
|
||||||
const { servicesKits, onKitUpdate, onKitCreateClick } =
|
const { servicesKits, onKitUpdate, onKitCreateClick } =
|
||||||
useServicesKitsState();
|
useServicesKitsState();
|
||||||
const {
|
|
||||||
onCreateClick: onCreatePriceCategoryClick,
|
|
||||||
...priceCategoryRestProps
|
|
||||||
} = useServicePriceCategoryState();
|
|
||||||
const getBody = () => {
|
const getBody = () => {
|
||||||
switch (serviceType) {
|
switch (serviceType) {
|
||||||
case ServicesTab.SERVICES_KITS:
|
case ServicesTab.SERVICES_KITS:
|
||||||
@@ -60,12 +53,6 @@ export const ServicesPage: FC = () => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
case ServicesTab.SERVICES_PRICE_CATEGORIES:
|
|
||||||
return (
|
|
||||||
<ServicePriceCategoryTable
|
|
||||||
{...ObjectStateToTableProps(priceCategoryRestProps)}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const getControls = () => {
|
const getControls = () => {
|
||||||
@@ -141,18 +128,6 @@ export const ServicesPage: FC = () => {
|
|||||||
/>
|
/>
|
||||||
</Flex>
|
</Flex>
|
||||||
);
|
);
|
||||||
case ServicesTab.SERVICES_PRICE_CATEGORIES:
|
|
||||||
return (
|
|
||||||
<Button
|
|
||||||
variant={"default"}
|
|
||||||
onClick={() => {
|
|
||||||
if (onCreatePriceCategoryClick) {
|
|
||||||
onCreatePriceCategoryClick();
|
|
||||||
}
|
|
||||||
}}>
|
|
||||||
Создать категорию
|
|
||||||
</Button>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { BaseMarketplaceSchema, ServicePriceCategorySchema } from "../client";
|
import { BaseMarketplaceSchema } from "../client";
|
||||||
|
|
||||||
export type QuickDeal = {
|
export type QuickDeal = {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -8,5 +8,4 @@ export type QuickDeal = {
|
|||||||
acceptanceDate: Date;
|
acceptanceDate: Date;
|
||||||
shippingWarehouse: string;
|
shippingWarehouse: string;
|
||||||
baseMarketplace: BaseMarketplaceSchema;
|
baseMarketplace: BaseMarketplaceSchema;
|
||||||
category?: ServicePriceCategorySchema;
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user