From f66b12fd1d0b83af0d7230d7b1565fbe00afbe3c Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Wed, 22 Feb 2023 11:03:34 +0700 Subject: prettier --- src/lib/invoice/components/Invoice.jsx | 165 +++++++++++++----------------- src/lib/invoice/components/Invoices.jsx | 175 ++++++++++++++++---------------- 2 files changed, 161 insertions(+), 179 deletions(-) (limited to 'src/lib/invoice/components') diff --git a/src/lib/invoice/components/Invoice.jsx b/src/lib/invoice/components/Invoice.jsx index aee4a498..eaf7b7e0 100644 --- a/src/lib/invoice/components/Invoice.jsx +++ b/src/lib/invoice/components/Invoice.jsx @@ -1,17 +1,17 @@ -import Spinner from "@/core/components/elements/Spinner/Spinner" -import useInvoice from "../hooks/useInvoice" -import { downloadInvoice, downloadTaxInvoice } from "../utils/invoices" -import Divider from "@/core/components/elements/Divider/Divider" -import VariantGroupCard from "@/lib/variant/components/VariantGroupCard" -import currencyFormat from "@/core/utils/currencyFormat" +import Spinner from '@/core/components/elements/Spinner/Spinner' +import useInvoice from '../hooks/useInvoice' +import { downloadInvoice, downloadTaxInvoice } from '../utils/invoices' +import Divider from '@/core/components/elements/Divider/Divider' +import VariantGroupCard from '@/lib/variant/components/VariantGroupCard' +import currencyFormat from '@/core/utils/currencyFormat' const Invoice = ({ id }) => { const { invoice } = useInvoice({ id }) if (invoice.isLoading) { return ( -
- +
+
) } @@ -24,103 +24,84 @@ const Invoice = ({ id }) => { if (address?.city?.name) fullAddress.push(address.city.name) fullAddress = fullAddress.join(', ') - return invoice.data?.name && ( - <> -
- - { invoice.data?.name } - - - { invoice.data?.amountResidual > 0 ? ( - Belum Lunas + return ( + invoice.data?.name && ( + <> +
+ {invoice.data?.name} + + {invoice.data?.amountResidual > 0 ? ( + Belum Lunas ) : ( - Lunas - ) } - - - { invoice.data?.purchaseOrderName || '-' } - - - { invoice.data?.paymentTerm } - - { invoice.data?.amountResidual > 0 && invoice.invoiceDate != invoice.invoiceDateDue && ( - - { invoice.data?.invoiceDateDue } + Lunas + )} - ) } - - { invoice.data?.sales } - - - { invoice.data?.invoiceDate } - -
-

Invoice

- -
-
-

Faktur Pajak

- + + {invoice.data?.purchaseOrderName || '-'} + + {invoice.data?.paymentTerm} + {invoice.data?.amountResidual > 0 && invoice.invoiceDate != invoice.invoiceDateDue && ( + + {invoice.data?.invoiceDateDue} + + )} + {invoice.data?.sales} + {invoice.data?.invoiceDate} +
+

Invoice

+ +
+
+

Faktur Pajak

+ +
-
- + -
- Detail Penagihan -
- -
- - { address?.name } - - - { address?.email || '-' } - - - { address?.mobile || '-' } - - - { fullAddress } - -
+
Detail Penagihan
- +
+ {address?.name} + {address?.email || '-'} + {address?.mobile || '-'} + {fullAddress} +
+ + -
Detail Produk
+
Detail Produk
-
- -
-

Total Belanja

-

{ currencyFormat(invoice.data?.amountTotal) }

+
+ +
+

Total Belanja

+

{currencyFormat(invoice.data?.amountTotal)}

+
-
- + + ) ) } const DescriptionRow = ({ children, label }) => ( -
- { label } - { children } +
+ {label} + {children}
) -export default Invoice \ No newline at end of file +export default Invoice diff --git a/src/lib/invoice/components/Invoices.jsx b/src/lib/invoice/components/Invoices.jsx index 37944e33..81521785 100644 --- a/src/lib/invoice/components/Invoices.jsx +++ b/src/lib/invoice/components/Invoices.jsx @@ -1,23 +1,25 @@ -import { CheckIcon, ClockIcon, EllipsisVerticalIcon, MagnifyingGlassIcon } from "@heroicons/react/24/outline" -import { toQuery } from "lodash-contrib" -import _ from "lodash" -import { useRouter } from "next/router" -import { useState } from "react" -import useInvoices from "../hooks/useInvoices" -import Spinner from "@/core/components/elements/Spinner/Spinner" -import Alert from "@/core/components/elements/Alert/Alert" -import Pagination from "@/core/components/elements/Pagination/Pagination" -import Link from "@/core/components/elements/Link/Link" -import currencyFormat from "@/core/utils/currencyFormat" -import BottomPopup from "@/core/components/elements/Popup/BottomPopup" -import { downloadInvoice, downloadTaxInvoice } from "../utils/invoices" +import { + CheckIcon, + ClockIcon, + EllipsisVerticalIcon, + MagnifyingGlassIcon +} from '@heroicons/react/24/outline' +import { toQuery } from 'lodash-contrib' +import _ from 'lodash' +import { useRouter } from 'next/router' +import { useState } from 'react' +import useInvoices from '../hooks/useInvoices' +import Spinner from '@/core/components/elements/Spinner/Spinner' +import Alert from '@/core/components/elements/Alert/Alert' +import Pagination from '@/core/components/elements/Pagination/Pagination' +import Link from '@/core/components/elements/Link/Link' +import currencyFormat from '@/core/utils/currencyFormat' +import BottomPopup from '@/core/components/elements/Popup/BottomPopup' +import { downloadInvoice, downloadTaxInvoice } from '../utils/invoices' const Invoices = () => { const router = useRouter() - const { - q = '', - page = 1 - } = router.query + const { q = '', page = 1 } = router.query const limit = 10 @@ -28,8 +30,8 @@ const Invoices = () => { } const { invoices } = useInvoices({ query }) - const [ inputQuery, setInputQuery ] = useState(q) - const [ toOthers, setToOthers ] = useState(null) + const [inputQuery, setInputQuery] = useState(q) + const [toOthers, setToOthers] = useState(null) const pageCount = Math.ceil(invoices?.data?.saleOrderTotal / limit) let pageQuery = _.omit(query, ['limit', 'offset']) @@ -39,112 +41,111 @@ const Invoices = () => { const handleSubmit = (e) => { e.preventDefault() router.push(`/my/invoices?q=${inputQuery}`) - } + } return ( -
-
- + + setInputQuery(e.target.value)} /> -
- { invoices.isLoading && ( -
- + {invoices.isLoading && ( +
+
- ) } + )} - { !invoices.isLoading && invoices.data?.invoices?.length === 0 && ( - + {!invoices.isLoading && invoices.data?.invoices?.length === 0 && ( + Tidak ada data invoice - ) } + )} - { invoices.data?.invoices?.map((invoice, index) => ( -
-
+ {invoices.data?.invoices?.map((invoice, index) => ( +
+
- No. Invoice -

{ invoice.name }

+ No. Invoice +

{invoice.name}

-
- { invoice.amountResidual > 0 ? ( -
Belum Lunas
- ) : ( -
Lunas
- ) } - setToOthers(invoice)} /> +
+ {invoice.amountResidual > 0 ? ( +
Belum Lunas
+ ) : ( +
Lunas
+ )} + setToOthers(invoice)} />
-
-

- { invoice.invoiceDate } -

-

- { invoice.paymentTerm } -

+
+

{invoice.invoiceDate}

+

{invoice.paymentTerm}

-
-
+
+
- No. Purchase Order -

{ invoice.purchaseOrderName || '-' }

+ No. Purchase Order +

+ {invoice.purchaseOrderName || '-'} +

-
- Total Invoice -

{ currencyFormat(invoice.amountTotal) }

+
+ Total Invoice +

+ {currencyFormat(invoice.amountTotal)} +

- { invoice.efaktur ? ( -
- + {invoice.efaktur ? ( +
+ Faktur Pajak
- ) : ( -
- + ) : ( +
+ Faktur Pajak
- ) } + )}
- )) } + ))} - setToOthers(null)} - > -
- - @@ -154,4 +155,4 @@ const Invoices = () => { ) } -export default Invoices \ No newline at end of file +export default Invoices -- cgit v1.2.3