feat: setting manager for a deal
This commit is contained in:
@@ -161,6 +161,7 @@ export type { GetClientMarketplacesResponse } from './models/GetClientMarketplac
|
||||
export type { GetDealBillById } from './models/GetDealBillById';
|
||||
export type { GetDealProductsBarcodesPdfRequest } from './models/GetDealProductsBarcodesPdfRequest';
|
||||
export type { GetDealProductsBarcodesPdfResponse } from './models/GetDealProductsBarcodesPdfResponse';
|
||||
export type { GetManagersResponse } from './models/GetManagersResponse';
|
||||
export type { GetPaymentRecordsResponse } from './models/GetPaymentRecordsResponse';
|
||||
export type { GetProductBarcodePdfRequest } from './models/GetProductBarcodePdfRequest';
|
||||
export type { GetProductBarcodePdfResponse } from './models/GetProductBarcodePdfResponse';
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
/* istanbul ignore file */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
import type { UserSchema } from './UserSchema';
|
||||
export type DealGeneralInfoSchema = {
|
||||
name: string;
|
||||
isDeleted: boolean;
|
||||
@@ -10,5 +11,6 @@ export type DealGeneralInfoSchema = {
|
||||
shippingWarehouse?: (string | null);
|
||||
deliveryDate?: (string | null);
|
||||
receivingSlotDate?: (string | null);
|
||||
manager?: (UserSchema | null);
|
||||
};
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import type { DealServiceSchema } from './DealServiceSchema';
|
||||
import type { DealStatusHistorySchema } from './DealStatusHistorySchema';
|
||||
import type { ServicePriceCategorySchema } from './ServicePriceCategorySchema';
|
||||
import type { ShippingWarehouseSchema } from './ShippingWarehouseSchema';
|
||||
import type { UserSchema } from './UserSchema';
|
||||
export type DealSchema = {
|
||||
id: number;
|
||||
name: string;
|
||||
@@ -26,6 +27,7 @@ export type DealSchema = {
|
||||
shippingWarehouse?: (ShippingWarehouseSchema | string | null);
|
||||
billRequest?: (DealBillRequestSchema | null);
|
||||
category?: (ServicePriceCategorySchema | null);
|
||||
manager?: (UserSchema | null);
|
||||
deliveryDate?: (string | null);
|
||||
receivingSlotDate?: (string | null);
|
||||
};
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
import type { CreateUserRequest } from '../models/CreateUserRequest';
|
||||
import type { CreateUserResponse } from '../models/CreateUserResponse';
|
||||
import type { GetAllUsersResponse } from '../models/GetAllUsersResponse';
|
||||
import type { GetManagersResponse } from '../models/GetManagersResponse';
|
||||
import type { UpdateUserRequest } from '../models/UpdateUserRequest';
|
||||
import type { UpdateUserResponse } from '../models/UpdateUserResponse';
|
||||
import type { CancelablePromise } from '../core/CancelablePromise';
|
||||
@@ -62,4 +63,15 @@ export class UserService {
|
||||
},
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Get Managers
|
||||
* @returns GetManagersResponse Successful Response
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static getManagers(): CancelablePromise<GetManagersResponse> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'GET',
|
||||
url: '/user/get-managers',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
23
src/components/ManagerSelect/ManagerSelect.tsx
Normal file
23
src/components/ManagerSelect/ManagerSelect.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import { FC } from "react";
|
||||
import ObjectSelect, { ObjectSelectProps } from "../ObjectSelect/ObjectSelect.tsx";
|
||||
import { UserSchema } from "../../client";
|
||||
import useManagersList from "../../pages/LeadsPage/hooks/useManagersList.tsx";
|
||||
|
||||
type Props = Omit<
|
||||
ObjectSelectProps<UserSchema | null>,
|
||||
"data" | "getValueFn" | "getLabelFn"
|
||||
>;
|
||||
const UserSelect: FC<Props> = props => {
|
||||
const { objects: managers } = useManagersList();
|
||||
return (
|
||||
<ObjectSelect
|
||||
data={managers}
|
||||
getLabelFn={(manager: UserSchema) => `${manager.firstName} ${manager.secondName}`}
|
||||
getValueFn={(manager: UserSchema) => manager.id.toString()}
|
||||
clearable
|
||||
{...props}
|
||||
onClear={() => props.onChange(null)}
|
||||
/>
|
||||
);
|
||||
};
|
||||
export default UserSelect;
|
||||
@@ -30,6 +30,7 @@ import { IconBarcode, IconPrinter } from "@tabler/icons-react";
|
||||
import styles from "../../../ui/LeadsPage.module.css";
|
||||
import { base64ToBlob } from "../../../../../shared/lib/utils.ts";
|
||||
import { DatePickerInput } from "@mantine/dates";
|
||||
import ManagerSelect from "../../../../../components/ManagerSelect/ManagerSelect.tsx";
|
||||
|
||||
type Props = {
|
||||
deal: DealSchema;
|
||||
@@ -209,6 +210,11 @@ const Content: FC<Props> = ({ deal }) => {
|
||||
{...form.getInputProps("receivingSlotDate")}
|
||||
|
||||
/>
|
||||
<ManagerSelect
|
||||
placeholder={"Укажите менеджера"}
|
||||
label={"Менеджер"}
|
||||
{...form.getInputProps("manager")}
|
||||
/>
|
||||
</Flex>
|
||||
</Fieldset>
|
||||
<Flex
|
||||
|
||||
11
src/pages/LeadsPage/hooks/useManagersList.tsx
Normal file
11
src/pages/LeadsPage/hooks/useManagersList.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import ObjectList from "../../../hooks/objectList.tsx";
|
||||
import { UserService } from "../../../client";
|
||||
|
||||
const useManagersList = () =>
|
||||
ObjectList({
|
||||
queryFn: UserService.getManagers,
|
||||
getObjectsFn: response => response.managers,
|
||||
queryKey: "getManagers",
|
||||
});
|
||||
|
||||
export default useManagersList;
|
||||
Reference in New Issue
Block a user