From e561175d7167da3f6ac25200ad3cce63ea38e20b Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Mon, 6 Feb 2023 16:15:14 +0700 Subject: no message --- src/pages/my/invoices.js | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'src/pages/my/invoices.js') diff --git a/src/pages/my/invoices.js b/src/pages/my/invoices.js index a86ddffc..ed9ba660 100644 --- a/src/pages/my/invoices.js +++ b/src/pages/my/invoices.js @@ -6,6 +6,7 @@ import Layout from "@/components/layouts/Layout"; import apiOdoo from "@/core/utils/apiOdoo"; import { useAuth } from "@/core/utils/auth"; import currencyFormat from "@/core/utils/currencyFormat"; +import useBottomPopup from "@/lib/elements/hooks/useBottomPopup"; import { CheckIcon, ClockIcon, EllipsisVerticalIcon, MagnifyingGlassIcon } from "@heroicons/react/24/outline"; import { useRouter } from "next/router"; import { useEffect, useRef, useState } from "react"; @@ -54,6 +55,45 @@ export default function Invoices() { router.push(`/my/invoices${queryParams}`); }; + const downloadInvoice = (data) => { + const url = `${process.env.ODOO_HOST}/api/v1/download/invoice/${data.id}/${data.token}`; + window.open(url, 'download'); + closePopup(); + }; + + const downloadTaxInvoice = (data) => { + const url = `${process.env.ODOO_HOST}/api/v1/download/tax-invoice/${data.id}/${data.token}`; + window.open(url, 'download'); + closePopup(); + }; + + const childrenPopup = (data) => ( +
+ + +
+ ); + + const { + closePopup, + openPopup, + BottomPopup + } = useBottomPopup({ + title: 'Lainnya', + children: childrenPopup + }); + return ( @@ -91,7 +131,7 @@ export default function Invoices() { ) : (
Lunas
) } - {}} /> + openPopup(invoice)} /> @@ -129,6 +169,7 @@ export default function Invoices() { )) } + { BottomPopup }
); -- cgit v1.2.3