feat: deal card, deal status, deal new dates, indicator, hide navbar

This commit is contained in:
2024-09-30 22:53:31 +03:00
parent 100af0aa06
commit f202e9b9fa
4 changed files with 52 additions and 44 deletions

View File

@@ -8,5 +8,7 @@ export type DealGeneralInfoSchema = {
isCompleted: boolean;
comment: string;
shippingWarehouse?: (string | null);
deliveryDate?: (string | null);
receivingSlotDate?: (string | null);
};

View File

@@ -3,6 +3,7 @@
/* tslint:disable */
/* eslint-disable */
import type { BaseMarketplaceSchema } from './BaseMarketplaceSchema';
import type { DealBillRequestSchema } from './DealBillRequestSchema';
export type DealSummary = {
id: number;
name: string;
@@ -19,5 +20,6 @@ export type DealSummary = {
shipmentWarehouseName: (string | null);
deliveryDate?: (string | null);
receivingSlotDate?: (string | null);
billRequest?: (DealBillRequestSchema | null);
};

View File

@@ -13,11 +13,13 @@ import {
Popover,
rem,
Text,
Tooltip,
} from "@mantine/core";
import { useDealPageContext } from "../../../pages/LeadsPage/contexts/DealPageContext.tsx";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faCheck } from "@fortawesome/free-solid-svg-icons";
import { DealStatus } from "../../../shared/enums/DealStatus.ts";
import { IconCheck } from "@tabler/icons-react";
type Props = {
dealSummary: DealSummary;
@@ -31,8 +33,6 @@ const DealSummaryCard: FC<Props> = ({ dealSummary }) => {
});
};
const getIndicatorProps = (): IndicatorProps => {
// check if deal status is less then in delivery and delivery_date - current date is less then 3 days, then show indicator
// and if current status is less then in_delivery, then show indicator
if (!dealSummary.deliveryDate)
return { disabled: true };
@@ -42,7 +42,6 @@ const DealSummaryCard: FC<Props> = ({ dealSummary }) => {
const diffDays = Math.ceil(diff / (1000 * 3600 * 24));
if (dealSummary.status < DealStatus.IN_DELIVERY) {
// if less than 2 days left, show yellow, if less than 1 day left, show red
if (diffDays <= 2 && diffDays > 1) {
return {
color: "yellow",
@@ -124,6 +123,7 @@ const DealSummaryCard: FC<Props> = ({ dealSummary }) => {
)}
</Flex>
<Flex align={"center"} justify={"space-between"}>
<Flex align={"center"} gap={rem(5)}>
<CopyButton value={dealSummary.id.toString()}>
{({ copy, copied }) => (
<Popover
@@ -161,6 +161,15 @@ const DealSummaryCard: FC<Props> = ({ dealSummary }) => {
</Popover>
)}
</CopyButton>
{dealSummary.billRequest?.paid && (
<Tooltip label={"Оплачен"}>
<IconCheck />
</Tooltip>
)}
</Flex>
<ActionIcon variant={"transparent"}>
<Image
src={dealSummary.baseMarketplace?.iconUrl || ""}

View File

@@ -12,7 +12,6 @@ const HideNavbarAffix: FC<Props> = (props) => {
const dispatch = useAppDispatch();
return (
<>
{/*{uiState.hideNavbar && (*/}
<Transition
transition={"slide-right"}
mounted={uiState.hideNavbar}
@@ -32,18 +31,14 @@ const HideNavbarAffix: FC<Props> = (props) => {
}}
className={stylesCss["icon"]}
// color={"#2d2d2d"}
radius="xl"
size={45}>
<IconArrowRight
stroke={1.5}
// size={30}
/>
</ActionIcon>
</Affix>)}
</Transition>
{/*)*/}
{/*}*/}
</>
);