From 902e5dabbb1ab0612764983c094af398e5f636ee Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 26 Jan 2023 17:02:02 +0700 Subject: Invoice and invoice detail --- src/pages/my/transactions/index.js | 128 ------------------------------------- 1 file changed, 128 deletions(-) delete mode 100644 src/pages/my/transactions/index.js (limited to 'src/pages/my/transactions/index.js') diff --git a/src/pages/my/transactions/index.js b/src/pages/my/transactions/index.js deleted file mode 100644 index c31336f2..00000000 --- a/src/pages/my/transactions/index.js +++ /dev/null @@ -1,128 +0,0 @@ -import { useRouter } from "next/router"; -import AppBar from "@/components/layouts/AppBar"; -import BottomPopup from "@/components/elements/BottomPopup"; -import Layout from "@/components/layouts/Layout"; -import WithAuth from "@/components/auth/WithAuth"; -import { useEffect, useRef, useState } from "react"; -import { useAuth } from "@/core/utils/auth"; -import apiOdoo from "@/core/utils/apiOdoo"; -import currencyFormat from "@/core/utils/currencyFormat"; -import { EllipsisVerticalIcon, MagnifyingGlassIcon } from "@heroicons/react/24/outline"; -import Link from "@/components/elements/Link"; -import Pagination from "@/components/elements/Pagination"; -import Alert from "@/components/elements/Alert"; - -export default function Transactions() { - const [ auth ] = useAuth(); - const router = useRouter(); - const { - q, - page = 1 - } = router.query; - - const [ transactions, setTransactions ] = useState([]); - const [ activePopupId, setActivePopupId ] = useState(null); - - const [ pageCount, setPageCount ] = useState(0); - const [ isLoading, setIsLoading ] = useState(true); - - const searchQueryRef = useRef(); - - useEffect(() => { - const loadTransactions = async () => { - if (auth) { - const limit = 10; - let offset = (page - 1) * 10; - let queryParams = [`limit=${limit}`, `offset=${offset}`]; - if (q) queryParams.push(`name=${q}`); - queryParams = queryParams.join('&'); - queryParams = queryParams ? '?' + queryParams : ''; - - const dataTransactions = await apiOdoo('GET', `/api/v1/partner/${auth.partner_id}/sale_order${queryParams}`); - setTransactions(dataTransactions); - setPageCount(Math.ceil(dataTransactions.sale_order_total / limit)); - setIsLoading(false); - }; - } - loadTransactions(); - }, [ auth, q, page ]); - - const actionSearch = (e) => { - e.preventDefault(); - let queryParams = []; - if (searchQueryRef.current.value) queryParams.push(`q=${searchQueryRef.current.value}`); - queryParams = queryParams.join('&'); - queryParams = queryParams ? `?${queryParams}` : ''; - router.push(`/my/transactions${queryParams}`); - }; - - return ( - - - - -
- - -
- -
- { transactions?.sale_order_total === 0 && !isLoading && ( - - Transaksi tidak ditemukan - - ) } - { transactions?.sale_orders?.map((transaction, index) => ( -
-
- - No. Transaksi -

{ transaction.name }

- -
-
Pending
- setActivePopupId(transaction.id)} /> -
-
- -
- Dilayani Oleh -

{ transaction.sales }

-
-
- Total Harga -

{ currencyFormat(transaction.amount_total) }

-
- -
- )) } -
- -
- -
- - { transactions?.sale_orders?.length > 0 && ( - setActivePopupId(null)} - > -
-

Download Quotation

-

Batalkan Transaksi

-
-
- ) } -
-
- ); -}; \ No newline at end of file -- cgit v1.2.3