Skip to content

Commit

Permalink
Update - Invoice
Browse files Browse the repository at this point in the history
- added url to invoice detail when task from invoice is created

Small updates and fixes
- reset form after new account was added
- change button labels from cancel to close
  • Loading branch information
pdovhomilja committed Sep 29, 2023
1 parent 84e730e commit e942fe8
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 12 deletions.
30 changes: 25 additions & 5 deletions app/[locale]/(routes)/crm/accounts/components/NewAccountForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,6 @@ export function NewAccountForm({ industries, users }: Props) {
title: "Success",
description: "Account created successfully",
});

/* if (response.status === 200) {
router.push("/");
} */
} catch (error: any) {
toast({
variant: "destructive",
Expand All @@ -114,7 +110,31 @@ export function NewAccountForm({ industries, users }: Props) {
} finally {
router.refresh();
setIsLoading(false);
router.push("/crm/accounts");
form.reset({
name: "",
office_phone: "",
website: "",
fax: "",
company_id: "",
vat: "",
email: "",
billing_street: "",
billing_postal_code: "",
billing_city: "",
billing_state: "",
billing_country: "",
shipping_street: "",
shipping_postal_code: "",
shipping_city: "",
shipping_state: "",
shipping_country: "",
description: "",
assigned_to: "",
status: "",
annual_revenue: "",
member_of: "",
industry: "",
});
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function DataTableRowActions<TData>({
const [openRossumView, setOpenRossumView] = useState(false);

//zustand
const { setIsOpen } = useAppStore();
const { setIsOpen, setNotionUrl } = useAppStore();

const router = useRouter();
const { toast } = useToast();
Expand Down Expand Up @@ -224,6 +224,9 @@ export function DataTableRowActions<TData>({
<DropdownMenuItem
onClick={() => {
setIsOpen(true);
setNotionUrl(
`${process.env.NEXT_PUBLIC_APP_URL}/invoice/detail/${invoice.id}`
);
}}
>
<Edit className="mr-2 w-4 h-4" />
Expand Down
6 changes: 5 additions & 1 deletion app/[locale]/(routes)/invoice/dialogs/NewTask.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ const NewTaskDialog = ({ users, boards }: Props) => {

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

const { notionUrl } = useAppStore();

const router = useRouter();
const { toast } = useToast();

Expand All @@ -60,6 +62,7 @@ const NewTaskDialog = ({ users, boards }: Props) => {
board: z.string().min(3).max(255),
priority: z.string().min(3).max(10),
content: z.string().min(3).max(500),
notionUrl: z.string().min(3).max(500),
});

type NewAccountFormValues = z.infer<typeof formSchema>;
Expand All @@ -69,8 +72,9 @@ const NewTaskDialog = ({ users, boards }: Props) => {
});

useEffect(() => {
form.setValue("notionUrl", notionUrl);
setIsMounted(true);
}, [form]);
}, [form, notionUrl]);

if (!isMounted) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion app/[locale]/(routes)/projects/dialogs/UpdateTask.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ const UpdateTaskDialog = ({ users, boards, initialData }: Props) => {
</div>
<div className="flex w-full justify-end space-x-2 pt-2">
<DialogTrigger asChild>
<Button variant={"destructive"}>Cancel</Button>
<Button variant={"destructive"}>Close</Button>
</DialogTrigger>
<Button type="submit" disabled={isLoading}>
{isLoading ? (
Expand Down
15 changes: 14 additions & 1 deletion app/[locale]/(routes)/projects/tasks/viewtask/[taskId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const TaskPage = async ({ params }: TaskPageProps) => {
<div className="flex flex-col md:flex-row w-full px-2 space-x-2 ">
<div className="flex flex-col w-full md:w-2/3">
<div className="w-full border rounded-lg mb-5">
{/* <pre>
{/* <pre>
<code>{JSON.stringify(task, null, 2)}</code>
</pre> */}
<Card>
Expand Down Expand Up @@ -133,6 +133,19 @@ const TaskPage = async ({ params }: TaskPageProps) => {
</p>
</div>
</div>
<div className="-mx-2 flex items-start space-x-4 rounded-md p-2 transition-all hover:bg-accent hover:text-accent-foreground">
<User className="mt-px h-5 w-5" />
<div className="space-y-1">
<p className="text-sm font-medium leading-none">
Created by
</p>
<p className="text-sm text-muted-foreground">
{activeUsers.find(
(user: any) => user.id === task.createdBy
)?.name || "Unknown"}
</p>
</div>
</div>
</div>
</CardContent>
<CardFooter className="space-x-2">
Expand Down
4 changes: 1 addition & 3 deletions app/[locale]/(routes)/secondBrain/dialogs/NewTask.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ type Props = {
boards: any;
open: boolean;
setOpen: (open: boolean) => void;

notionUrl: string;
};

Expand All @@ -52,7 +51,6 @@ const NewTaskDialog = ({
boards,
open,
setOpen,

notionUrl,
}: Props) => {
//const [open, setOpen] = useState(false);
Expand Down Expand Up @@ -80,7 +78,7 @@ const NewTaskDialog = ({
});

useEffect(() => {
form.setValue("notionUrl", notionUrl);
form.setValue("notionUrl", notionUrl);
setIsMounted(true);
}, [notionUrl, form]);

Expand Down
1 change: 1 addition & 0 deletions app/[locale]/(routes)/secondBrain/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { getServerSession } from "next-auth";
import Container from "../components/ui/Container";

import NewTask from "./components/NewTask";

import H4Title from "@/components/typography/h4";

import { columns } from "./table-components/columns";
Expand Down

6 comments on commit e942fe8

@vercel
Copy link

@vercel vercel bot commented on e942fe8 Sep 29, 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 e942fe8 Sep 29, 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 – ./

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

@vercel
Copy link

@vercel vercel bot commented on e942fe8 Sep 29, 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 e942fe8 Sep 29, 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 e942fe8 Sep 29, 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-git-main-e-osvc.vercel.app
nextcrm-test-e-osvc.vercel.app
test.nextcrm.io

@vercel
Copy link

@vercel vercel bot commented on e942fe8 Sep 29, 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 – ./

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

Please sign in to comment.