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 { GetDealBillById } from './models/GetDealBillById';
|
||||||
export type { GetDealProductsBarcodesPdfRequest } from './models/GetDealProductsBarcodesPdfRequest';
|
export type { GetDealProductsBarcodesPdfRequest } from './models/GetDealProductsBarcodesPdfRequest';
|
||||||
export type { GetDealProductsBarcodesPdfResponse } from './models/GetDealProductsBarcodesPdfResponse';
|
export type { GetDealProductsBarcodesPdfResponse } from './models/GetDealProductsBarcodesPdfResponse';
|
||||||
|
export type { GetManagersResponse } from './models/GetManagersResponse';
|
||||||
export type { GetPaymentRecordsResponse } from './models/GetPaymentRecordsResponse';
|
export type { GetPaymentRecordsResponse } from './models/GetPaymentRecordsResponse';
|
||||||
export type { GetProductBarcodePdfRequest } from './models/GetProductBarcodePdfRequest';
|
export type { GetProductBarcodePdfRequest } from './models/GetProductBarcodePdfRequest';
|
||||||
export type { GetProductBarcodePdfResponse } from './models/GetProductBarcodePdfResponse';
|
export type { GetProductBarcodePdfResponse } from './models/GetProductBarcodePdfResponse';
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
/* istanbul ignore file */
|
/* istanbul ignore file */
|
||||||
/* tslint:disable */
|
/* tslint:disable */
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
|
import type { UserSchema } from './UserSchema';
|
||||||
export type DealGeneralInfoSchema = {
|
export type DealGeneralInfoSchema = {
|
||||||
name: string;
|
name: string;
|
||||||
isDeleted: boolean;
|
isDeleted: boolean;
|
||||||
@@ -10,5 +11,6 @@ export type DealGeneralInfoSchema = {
|
|||||||
shippingWarehouse?: (string | null);
|
shippingWarehouse?: (string | null);
|
||||||
deliveryDate?: (string | null);
|
deliveryDate?: (string | null);
|
||||||
receivingSlotDate?: (string | null);
|
receivingSlotDate?: (string | null);
|
||||||
|
manager?: (UserSchema | null);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import type { DealServiceSchema } from './DealServiceSchema';
|
|||||||
import type { DealStatusHistorySchema } from './DealStatusHistorySchema';
|
import type { DealStatusHistorySchema } from './DealStatusHistorySchema';
|
||||||
import type { ServicePriceCategorySchema } from './ServicePriceCategorySchema';
|
import type { ServicePriceCategorySchema } from './ServicePriceCategorySchema';
|
||||||
import type { ShippingWarehouseSchema } from './ShippingWarehouseSchema';
|
import type { ShippingWarehouseSchema } from './ShippingWarehouseSchema';
|
||||||
|
import type { UserSchema } from './UserSchema';
|
||||||
export type DealSchema = {
|
export type DealSchema = {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
@@ -26,6 +27,7 @@ export type DealSchema = {
|
|||||||
shippingWarehouse?: (ShippingWarehouseSchema | string | null);
|
shippingWarehouse?: (ShippingWarehouseSchema | string | null);
|
||||||
billRequest?: (DealBillRequestSchema | null);
|
billRequest?: (DealBillRequestSchema | null);
|
||||||
category?: (ServicePriceCategorySchema | null);
|
category?: (ServicePriceCategorySchema | null);
|
||||||
|
manager?: (UserSchema | null);
|
||||||
deliveryDate?: (string | null);
|
deliveryDate?: (string | null);
|
||||||
receivingSlotDate?: (string | null);
|
receivingSlotDate?: (string | null);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
import type { CreateUserRequest } from '../models/CreateUserRequest';
|
import type { CreateUserRequest } from '../models/CreateUserRequest';
|
||||||
import type { CreateUserResponse } from '../models/CreateUserResponse';
|
import type { CreateUserResponse } from '../models/CreateUserResponse';
|
||||||
import type { GetAllUsersResponse } from '../models/GetAllUsersResponse';
|
import type { GetAllUsersResponse } from '../models/GetAllUsersResponse';
|
||||||
|
import type { GetManagersResponse } from '../models/GetManagersResponse';
|
||||||
import type { UpdateUserRequest } from '../models/UpdateUserRequest';
|
import type { UpdateUserRequest } from '../models/UpdateUserRequest';
|
||||||
import type { UpdateUserResponse } from '../models/UpdateUserResponse';
|
import type { UpdateUserResponse } from '../models/UpdateUserResponse';
|
||||||
import type { CancelablePromise } from '../core/CancelablePromise';
|
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 styles from "../../../ui/LeadsPage.module.css";
|
||||||
import { base64ToBlob } from "../../../../../shared/lib/utils.ts";
|
import { base64ToBlob } from "../../../../../shared/lib/utils.ts";
|
||||||
import { DatePickerInput } from "@mantine/dates";
|
import { DatePickerInput } from "@mantine/dates";
|
||||||
|
import ManagerSelect from "../../../../../components/ManagerSelect/ManagerSelect.tsx";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
deal: DealSchema;
|
deal: DealSchema;
|
||||||
@@ -209,6 +210,11 @@ const Content: FC<Props> = ({ deal }) => {
|
|||||||
{...form.getInputProps("receivingSlotDate")}
|
{...form.getInputProps("receivingSlotDate")}
|
||||||
|
|
||||||
/>
|
/>
|
||||||
|
<ManagerSelect
|
||||||
|
placeholder={"Укажите менеджера"}
|
||||||
|
label={"Менеджер"}
|
||||||
|
{...form.getInputProps("manager")}
|
||||||
|
/>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Fieldset>
|
</Fieldset>
|
||||||
<Flex
|
<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