From bc8e76f00eaa74eb0cc51b79662a53ef34a3ed67 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 24 Mar 2023 17:05:47 +0700 Subject: - --- .../elements/Navbar/NavbarUserDropdown.jsx | 18 +- src/core/hooks/useDevice.js | 2 - src/lib/cart/components/Cart.jsx | 15 +- src/lib/product/api/productPriceApi.js | 8 + src/lib/product/components/ProductCard.jsx | 12 + .../components/TransactionStatusBadge.jsx | 2 +- src/lib/transaction/components/Transactions.jsx | 340 ++++++++++++--------- src/pages/my/transactions.jsx | 17 +- src/styles/globals.css | 32 +- 9 files changed, 277 insertions(+), 169 deletions(-) create mode 100644 src/lib/product/api/productPriceApi.js diff --git a/src/core/components/elements/Navbar/NavbarUserDropdown.jsx b/src/core/components/elements/Navbar/NavbarUserDropdown.jsx index b735c13f..c08d81ce 100644 --- a/src/core/components/elements/Navbar/NavbarUserDropdown.jsx +++ b/src/core/components/elements/Navbar/NavbarUserDropdown.jsx @@ -1,17 +1,25 @@ import { deleteAuth } from '@/core/utils/auth' import Link from '../Link/Link' +import { useRouter } from 'next/router' const NavbarUserDropdown = () => { + const router = useRouter() + + const logout = () => { + deleteAuth() + router.push('/login') + } + return (
- Daftar Transaksi - Invoice & Faktur Pajak - Wishlist + Daftar Transaksi + Invoice & Faktur Pajak + Wishlist Pengaturan Akun - +
) diff --git a/src/core/hooks/useDevice.js b/src/core/hooks/useDevice.js index 387330b0..a8584692 100644 --- a/src/core/hooks/useDevice.js +++ b/src/core/hooks/useDevice.js @@ -9,11 +9,9 @@ const useDevice = () => { if (window.innerWidth < 768) { setIsMobile(true) setIsDesktop(false) - console.count('m: true | d: false') } else { setIsMobile(false) setIsDesktop(true) - console.count('m: false | d: true') } } handleResize() diff --git a/src/lib/cart/components/Cart.jsx b/src/lib/cart/components/Cart.jsx index 8bd9e362..8cd6df96 100644 --- a/src/lib/cart/components/Cart.jsx +++ b/src/lib/cart/components/Cart.jsx @@ -128,16 +128,16 @@ const Cart = () => { Apakah anda yakin menghapus barang{' '} {deleteConfirmation?.name} dari keranjang? -
+
- - - {transactions.isLoading && ( -
- -
- )} - - {!transactions.isLoading && transactions.data?.saleOrders?.length === 0 && ( - - Tidak ada data transaksi - - )} - - {transactions.data?.saleOrders?.map((saleOrder, index) => ( -
-
- - No. Transaksi -

{saleOrder.name}

- -
- - setToOthers(saleOrder)} - /> + <> + +
+
+ setInputQuery(e.target.value)} + /> + +
+ + {transactions.isLoading && ( +
+
-
- -
-
- No. Purchase Order -

- {saleOrder.purchaseOrderName || '-'} -

-
-
- Total Invoice -

{saleOrder.invoiceCount} Invoice

+ )} + + {!transactions.isLoading && transactions.data?.saleOrders?.length === 0 && ( + + Tidak ada data transaksi + + )} + + {transactions.data?.saleOrders?.map((saleOrder, index) => ( +
+
+ + No. Transaksi +

{saleOrder.name}

+ +
+ + setToOthers(saleOrder)} + /> +
+ +
+
+ No. Purchase Order +

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

+
+
+ Total Invoice +

+ {saleOrder.invoiceCount} Invoice +

+
+
+
+
+ Sales +

{saleOrder.sales}

+
+
+ Total Harga +

+ {currencyFormat(saleOrder.amountTotal)} +

+
+
+
-
-
- Sales -

{saleOrder.sales}

-
-
- Total Harga -

- {currencyFormat(saleOrder.amountTotal)} -

-
+ ))} + + + + setToOthers(null)}> +
+ + +
- -
- ))} - - - - setToOthers(null)} - > -
- - - -
-
- - setToCancel(null)} - title='Batalkan Transaksi' - > -
- Apakah anda yakin membatalkan transaksi{' '} - {toCancel?.name}? + + + setToCancel(null)} title='Batalkan Transaksi'> +
+ Apakah anda yakin membatalkan transaksi{' '} + {toCancel?.name}? +
+
+ + +
+
-
- - + + + +
+
+
+
+

Daftar Transaksi

+
+ setInputQuery(e.target.value)} + /> + +
+
+ + + + + + + + + + + + {transactions.data?.saleOrders?.map((saleOrder) => ( + + + + + + + + ))} + +
No. TransaksiTanggalSales PersonTotalStatus
+ {saleOrder.name} + -{saleOrder.sales}{currencyFormat(saleOrder.amountTotal)} +
+ +
+
+ + +
- -
+ + ) } diff --git a/src/pages/my/transactions.jsx b/src/pages/my/transactions.jsx index 30b9be07..a8ca78b8 100644 --- a/src/pages/my/transactions.jsx +++ b/src/pages/my/transactions.jsx @@ -1,4 +1,7 @@ import AppLayout from '@/core/components/layouts/AppLayout' +import BasicLayout from '@/core/components/layouts/BasicLayout' +import DesktopView from '@/core/components/views/DesktopView' +import MobileView from '@/core/components/views/MobileView' import IsAuth from '@/lib/auth/components/IsAuth' import dynamic from 'next/dynamic' @@ -7,9 +10,17 @@ const TransactionsComponent = dynamic(() => import('@/lib/transaction/components export default function Transactions() { return ( - - - + + + + + + + + + + + ) } diff --git a/src/styles/globals.css b/src/styles/globals.css index 90761309..7f33abe8 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -394,10 +394,6 @@ button { @apply !border-yellow_r-9; } -nav:has(> div.overlay) { - @apply z-0; -} - .table-specification { @apply max-h-[500px] overflow-y-auto border border-gray_r-6; } @@ -463,6 +459,29 @@ nav:has(> div.overlay) { @apply font-medium; } +.table-data thead tr { + @apply bg-gray_r-3; +} + +.table-data thead th { + @apply font-medium; +} + +.table-data thead th, +.table-data tbody td { + @apply py-3 + text-center; +} + +.table-data tbody td { + @apply text-gray_r-12/90; +} + +.table-data tbody tr { + @apply border-b + border-gray_r-6; +} + .navbar-user-dropdown-button { @apply flex-1 flex @@ -480,8 +499,9 @@ nav:has(> div.overlay) { @apply line-clamp-1; } -.navbar-user-dropdown-wrapper a { - @apply text-gray_r-12/80 hover:bg-gray_r-5 font-medium py-2 px-4; +.navbar-user-dropdown-wrapper a, +.navbar-user-dropdown-wrapper button { + @apply text-gray_r-12/80 hover:bg-gray_r-5 font-medium py-2 px-4 w-full text-left; } .navbar-user-dropdown { -- cgit v1.2.3