feat: board and status selects in deal editor
This commit is contained in:
@ -3,21 +3,25 @@ import { IconEdit } from "@tabler/icons-react";
|
||||
import { DataTableColumn } from "mantine-datatable";
|
||||
import { ActionIcon, Tooltip } from "@mantine/core";
|
||||
import { useDealsContext } from "@/app/deals/contexts/DealsContext";
|
||||
import { useProjectsContext } from "@/app/deals/contexts/ProjectsContext";
|
||||
import { useDrawersContext } from "@/drawers/DrawersContext";
|
||||
import { DealSchema } from "@/lib/client";
|
||||
import { utcDateTimeToLocalString } from "@/utils/datetime";
|
||||
|
||||
const useDealsTableColumns = () => {
|
||||
const { selectedProject } = useProjectsContext();
|
||||
const { dealsCrud } = useDealsContext();
|
||||
const { openDrawer } = useDrawersContext();
|
||||
|
||||
const onEditDeal = useCallback(
|
||||
(deal: DealSchema) => {
|
||||
if (!selectedProject) return;
|
||||
openDrawer({
|
||||
key: "dealEditorDrawer",
|
||||
props: {
|
||||
deal,
|
||||
dealsCrud,
|
||||
project: selectedProject,
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { Box, Card, Group, Pill, Stack, Text } from "@mantine/core";
|
||||
import { useDealsContext } from "@/app/deals/contexts/DealsContext";
|
||||
import { useProjectsContext } from "@/app/deals/contexts/ProjectsContext";
|
||||
import { useDrawersContext } from "@/drawers/DrawersContext";
|
||||
import { DealSchema } from "@/lib/client";
|
||||
import styles from "./DealCard.module.css";
|
||||
@ -9,11 +10,16 @@ type Props = {
|
||||
};
|
||||
|
||||
const DealCard = ({ deal }: Props) => {
|
||||
const { selectedProject } = useProjectsContext();
|
||||
const { dealsCrud } = useDealsContext();
|
||||
const { openDrawer } = useDrawersContext();
|
||||
|
||||
const onClick = () => {
|
||||
openDrawer({ key: "dealEditorDrawer", props: { deal, dealsCrud } });
|
||||
if (!selectedProject) return;
|
||||
openDrawer({
|
||||
key: "dealEditorDrawer",
|
||||
props: { project: selectedProject, deal, dealsCrud },
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
@ -22,7 +28,9 @@ const DealCard = ({ deal }: Props) => {
|
||||
className={styles.container}>
|
||||
<Group
|
||||
justify={"space-between"}
|
||||
ml={"xs"}
|
||||
wrap={"nowrap"}
|
||||
pl={"xs"}
|
||||
gap={"xs"}
|
||||
align={"start"}>
|
||||
<Text
|
||||
c={"dodgerblue"}
|
||||
@ -30,7 +38,7 @@ const DealCard = ({ deal }: Props) => {
|
||||
{deal.name}
|
||||
</Text>
|
||||
<Box className={styles["deal-id"]}>
|
||||
<Text>ID: {deal.id}</Text>
|
||||
<Text style={{ textWrap: "nowrap" }}>ID: {deal.id}</Text>
|
||||
</Box>
|
||||
</Group>
|
||||
<Stack className={styles["deal-data"]}>
|
||||
|
||||
@ -39,7 +39,7 @@ const Funnel: FC = () => {
|
||||
getContainerId={(status: StatusSchema) => `${status.id}-status`}
|
||||
getItemsByContainer={(status: StatusSchema, items: DealSchema[]) =>
|
||||
sortByLexorank(
|
||||
items.filter(deal => deal.statusId === status.id)
|
||||
items.filter(deal => deal.status.id === status.id)
|
||||
)
|
||||
}
|
||||
renderContainer={(
|
||||
|
||||
Reference in New Issue
Block a user