Skip to content

Commit

Permalink
Update - CRM - Accounts - TaskView
Browse files Browse the repository at this point in the history
- Remove SheetComponent
- Added native shadcn UI Sheet component
- Task closed after new task was added
  • Loading branch information
pdovhomilja committed Dec 12, 2023
1 parent e435e41 commit 6795759
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ import { z } from "zod";

interface NewTaskFormProps {
account: crm_Accounts | null;
onFinish: () => void;
}

const NewTaskForm = ({ account }: NewTaskFormProps) => {
const NewTaskForm = ({ account, onFinish }: NewTaskFormProps) => {
const [isLoading, setIsLoading] = useState(false);
const [isMounted, setIsMounted] = useState(false);
const [date, setDate] = useState<Date>();
Expand Down Expand Up @@ -105,14 +106,7 @@ const NewTaskForm = ({ account }: NewTaskFormProps) => {
});
} finally {
setIsLoading(false);
form.reset({
title: "",
content: "",
user: "",
account: "",
dueDateAt: new Date(),
priority: "",
});
onFinish();
router.refresh();
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@ import {
CardTitle,
} from "@/components/ui/card";
import { Separator } from "@/components/ui/separator";
import SheetComponent from "@/components/sheets/Sheet";

import { columns } from "../tasks-data-table/components/columns";
import { TasksDataTable } from "../tasks-data-table/components/data-table";

import NewTaskForm from "./NewTaskForm";
import {
Sheet,
SheetContent,
SheetHeader,
SheetTitle,
} from "@/components/ui/sheet";
import { Button } from "@/components/ui/button";

//TODO:
interface TasksViewProps {
Expand All @@ -28,6 +34,8 @@ interface TasksViewProps {

const AccountsTasksView = ({ data, account }: TasksViewProps) => {
const router = useRouter();

const [open, setOpen] = useState(false);
const [isMounted, setIsMounted] = useState(false);

useEffect(() => {
Expand All @@ -52,12 +60,25 @@ const AccountsTasksView = ({ data, account }: TasksViewProps) => {
<CardDescription></CardDescription>
</div>
<div className="flex space-x-2">
<SheetComponent
button_label="+"
title={"Create Task for: " + account?.name}
>
<NewTaskForm account={account} />
</SheetComponent>
<Sheet open={open} onOpenChange={() => setOpen(false)}>
<Button
className="m-2 cursor-pointer"
onClick={() => setOpen(true)}
>
+
</Button>
<SheetContent className="min-w-[500px] space-y-2">
<SheetHeader>
<SheetTitle>Create new Task</SheetTitle>
</SheetHeader>
<div className="h-full overflow-y-auto">
<NewTaskForm
account={account}
onFinish={() => setOpen(false)}
/>
</div>
</SheetContent>
</Sheet>
</div>
</div>
<Separator />
Expand Down
41 changes: 0 additions & 41 deletions components/sheets/Sheet.tsx

This file was deleted.

6 comments on commit 6795759

@vercel
Copy link

@vercel vercel bot commented on 6795759 Dec 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nextcrm-demo – ./

nextcrm-demo-git-main-e-osvc.vercel.app
demo.nextcrm.io
nextcrm-demo-e-osvc.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 6795759 Dec 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nextcrm-test – ./

nextcrm-test-e-osvc.vercel.app
nextcrm-test-git-main-e-osvc.vercel.app
test.nextcrm.io

@vercel
Copy link

@vercel vercel bot commented on 6795759 Dec 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 6795759 Dec 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nextcrm-others – ./

nextcrm-others-git-main-e-osvc.vercel.app
others.nextcrm.io
nextcrm-others-e-osvc.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 6795759 Dec 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 6795759 Dec 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.