feat: billing for groups of deals

This commit is contained in:
2024-11-15 20:29:59 +04:00
parent 90530f0530
commit 70aff26dcd
8 changed files with 29 additions and 9 deletions

View File

@@ -25,6 +25,7 @@ export type { BaseEnumListSchema } from './models/BaseEnumListSchema';
export type { BaseEnumSchema } from './models/BaseEnumSchema'; export type { BaseEnumSchema } from './models/BaseEnumSchema';
export type { BaseMarketplaceSchema } from './models/BaseMarketplaceSchema'; export type { BaseMarketplaceSchema } from './models/BaseMarketplaceSchema';
export type { BaseShippingWarehouseSchema } from './models/BaseShippingWarehouseSchema'; export type { BaseShippingWarehouseSchema } from './models/BaseShippingWarehouseSchema';
export type { BillPaymentInfo } from './models/BillPaymentInfo';
export type { BillPaymentStatus } from './models/BillPaymentStatus'; export type { BillPaymentStatus } from './models/BillPaymentStatus';
export type { BillStatusUpdateRequest } from './models/BillStatusUpdateRequest'; export type { BillStatusUpdateRequest } from './models/BillStatusUpdateRequest';
export type { Body_upload_product_barcode_image } from './models/Body_upload_product_barcode_image'; export type { Body_upload_product_barcode_image } from './models/Body_upload_product_barcode_image';
@@ -169,6 +170,7 @@ export type { GetProductBarcodeResponse } from './models/GetProductBarcodeRespon
export type { GetServiceKitSchema } from './models/GetServiceKitSchema'; export type { GetServiceKitSchema } from './models/GetServiceKitSchema';
export type { GetTimeTrackingRecordsRequest } from './models/GetTimeTrackingRecordsRequest'; export type { GetTimeTrackingRecordsRequest } from './models/GetTimeTrackingRecordsRequest';
export type { GetTimeTrackingRecordsResponse } from './models/GetTimeTrackingRecordsResponse'; export type { GetTimeTrackingRecordsResponse } from './models/GetTimeTrackingRecordsResponse';
export type { GroupBillRequestSchema } from './models/GroupBillRequestSchema';
export type { HTTPValidationError } from './models/HTTPValidationError'; export type { HTTPValidationError } from './models/HTTPValidationError';
export type { MarketplaceCreateSchema } from './models/MarketplaceCreateSchema'; export type { MarketplaceCreateSchema } from './models/MarketplaceCreateSchema';
export type { MarketplaceSchema } from './models/MarketplaceSchema'; export type { MarketplaceSchema } from './models/MarketplaceSchema';

View File

@@ -5,7 +5,7 @@
import type { BillPaymentStatus } from './BillPaymentStatus'; import type { BillPaymentStatus } from './BillPaymentStatus';
import type { NotificationChannel } from './NotificationChannel'; import type { NotificationChannel } from './NotificationChannel';
export type BillStatusUpdateRequest = { export type BillStatusUpdateRequest = {
listenerTransactionId: number; listenerTransactionId: (number | string);
channel: NotificationChannel; channel: NotificationChannel;
info: BillPaymentStatus; info: BillPaymentStatus;
}; };

View File

@@ -2,9 +2,11 @@
/* istanbul ignore file */ /* istanbul ignore file */
/* tslint:disable */ /* tslint:disable */
/* eslint-disable */ /* eslint-disable */
import type { GroupBillRequestSchema } from './GroupBillRequestSchema';
export type DealGroupSchema = { export type DealGroupSchema = {
id: number; id: number;
name?: (string | null); name?: (string | null);
lexorank: string; lexorank: string;
billRequest?: (GroupBillRequestSchema | null);
}; };

View File

@@ -4,6 +4,7 @@
/* eslint-disable */ /* eslint-disable */
import type { ClientSchema } from './ClientSchema'; import type { ClientSchema } from './ClientSchema';
import type { DealBillRequestSchema } from './DealBillRequestSchema'; import type { DealBillRequestSchema } from './DealBillRequestSchema';
import type { DealGroupSchema } from './DealGroupSchema';
import type { DealProductSchema } from './DealProductSchema'; 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';
@@ -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);
group?: (DealGroupSchema | null);
deliveryDate?: (string | null); deliveryDate?: (string | null);
receivingSlotDate?: (string | null); receivingSlotDate?: (string | null);
}; };

View File

@@ -0,0 +1,12 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type GroupBillRequestSchema = {
groupId: number;
createdAt: string;
paid: boolean;
pdfUrl: (string | null);
invoiceNumber: (string | null);
};

View File

@@ -66,6 +66,9 @@ const DealSummaryCard: FC<Props> = ({ dealSummary, color }) => {
} }
return { disabled: true }; return { disabled: true };
}; };
const isPaid = () => {
return dealSummary.billRequest?.paid || dealSummary.group?.billRequest?.paid;
}
return ( return (
<Indicator <Indicator
position={"top-end"} position={"top-end"}
@@ -194,15 +197,12 @@ const DealSummaryCard: FC<Props> = ({ dealSummary, color }) => {
</Popover> </Popover>
)} )}
</CopyButton> </CopyButton>
{dealSummary.billRequest?.paid && ( {isPaid() && (
<Tooltip label={"Оплачен"}> <Tooltip label={"Оплачен"}>
<ThemeIcon variant={"transparent"}> <ThemeIcon variant={"transparent"}>
<IconCheck /> <IconCheck />
</ThemeIcon> </ThemeIcon>
</Tooltip> </Tooltip>
)} )}
</Flex> </Flex>

View File

@@ -121,6 +121,8 @@ const Content: FC<Props> = ({ deal }) => {
clipboard.copy(`${window.location.origin}/${url}`); clipboard.copy(`${window.location.origin}/${url}`);
}); });
}; };
const billRequestPdfUrl = deal?.billRequest?.pdfUrl || deal?.group?.billRequest?.pdfUrl;
return ( return (
<form onSubmit={form.onSubmit(values => handleSubmit(values))}> <form onSubmit={form.onSubmit(values => handleSubmit(values))}>
<Flex <Flex
@@ -270,12 +272,12 @@ const Content: FC<Props> = ({ deal }) => {
</Tooltip> </Tooltip>
<Flex gap={rem(10)}> <Flex gap={rem(10)}>
{deal.billRequest && deal.billRequest.pdfUrl ? ( {billRequestPdfUrl ? (
<ButtonCopy <ButtonCopy
onCopiedLabel={ onCopiedLabel={
"Ссылка скопирована в буфер обмена" "Ссылка скопирована в буфер обмена"
} }
value={deal.billRequest.pdfUrl}> value={billRequestPdfUrl}>
Ссылка на оплату Ссылка на оплату
</ButtonCopy> </ButtonCopy>
) : ( ) : (
@@ -308,7 +310,7 @@ const Content: FC<Props> = ({ deal }) => {
<Flex gap={rem(10)}> <Flex gap={rem(10)}>
<Checkbox <Checkbox
label={"Оплачен"} label={"Оплачен"}
checked={deal.billRequest?.paid || false} checked={deal.billRequest?.paid || deal.group?.billRequest?.paid || false}
disabled disabled
/> />
<Checkbox <Checkbox

View File

@@ -28,7 +28,7 @@ import classNames from "classnames";
const ProductAndServiceTab: FC = () => { const ProductAndServiceTab: FC = () => {
const { dealState, dealServicesState, dealProductsState } = const { dealState, dealServicesState, dealProductsState } =
useDealProductAndServiceTabState(); useDealProductAndServiceTabState();
const isLocked = Boolean(dealState.deal?.billRequest); const isLocked = Boolean(dealState.deal?.billRequest || dealState.deal?.group?.billRequest);
const onAddProductClick = () => { const onAddProductClick = () => {
if (!dealProductsState.onCreate || !dealState.deal) return; if (!dealProductsState.onCreate || !dealState.deal) return;
const productIds = dealState.deal.products.map( const productIds = dealState.deal.products.map(