feat: deal card, deal status, deal new dates, indicator, hide navbar
This commit is contained in:
@@ -25,10 +25,11 @@ import { ButtonCopyControlled } from "../../../../../components/ButtonCopyContro
|
||||
import { useClipboard } from "@mantine/hooks";
|
||||
import ButtonCopy from "../../../../../components/ButtonCopy/ButtonCopy.tsx";
|
||||
import FileSaver from "file-saver";
|
||||
import { getCurrentDateTimeForFilename } from "../../../../../shared/lib/date.ts";
|
||||
import { dateWithoutTimezone, getCurrentDateTimeForFilename } from "../../../../../shared/lib/date.ts";
|
||||
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";
|
||||
|
||||
type Props = {
|
||||
deal: DealSchema;
|
||||
@@ -41,7 +42,17 @@ const Content: FC<Props> = ({ deal }) => {
|
||||
const clipboard = useClipboard();
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const initialValues: FormType = deal;
|
||||
// ignore typescript
|
||||
|
||||
const initialValues: FormType = {
|
||||
...deal,
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-expect-error
|
||||
deliveryDate: deal.deliveryDate ? new Date(deal.deliveryDate) : null,
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-expect-error
|
||||
receivingSlotDate: deal.receivingSlotDate ? new Date(deal.receivingSlotDate) : null,
|
||||
};
|
||||
const form = useForm<FormType>({
|
||||
initialValues: initialValues,
|
||||
validate: {
|
||||
@@ -85,7 +96,14 @@ const Content: FC<Props> = ({ deal }) => {
|
||||
await updateClientInfo(values);
|
||||
}
|
||||
// updating deal info
|
||||
await updateDealInfo(values);
|
||||
// get shimpent warehouse name from object if its object, otherwise just pass it
|
||||
const shippingWarehouse = isShippingWarehouse(values.shippingWarehouse) ? values.shippingWarehouse.name : values.shippingWarehouse;
|
||||
await updateDealInfo({
|
||||
...values,
|
||||
deliveryDate: values.deliveryDate ? dateWithoutTimezone(new Date(values.deliveryDate)) : null,
|
||||
receivingSlotDate: values.receivingSlotDate ? dateWithoutTimezone(new Date(values.receivingSlotDate)) : null,
|
||||
shippingWarehouse: shippingWarehouse,
|
||||
});
|
||||
};
|
||||
const isShippingWarehouse = (
|
||||
value: ShippingWarehouseSchema | string | null | undefined,
|
||||
@@ -171,6 +189,21 @@ const Content: FC<Props> = ({ deal }) => {
|
||||
).onChange(event);
|
||||
}}
|
||||
/>
|
||||
<DatePickerInput
|
||||
minDate={new Date()}
|
||||
placeholder={"Укажите дату передачи в доставку"}
|
||||
label={"Дата передачи в доставку"}
|
||||
{...form.getInputProps("deliveryDate")}
|
||||
|
||||
/>
|
||||
<DatePickerInput
|
||||
minDate={new Date()}
|
||||
|
||||
placeholder={"Укажите слот приемки"}
|
||||
label={"Слот приемки"}
|
||||
{...form.getInputProps("receivingSlotDate")}
|
||||
|
||||
/>
|
||||
</Flex>
|
||||
</Fieldset>
|
||||
<Flex
|
||||
|
||||
Reference in New Issue
Block a user