From 981ca734c03374bb4281a83ef038a472af9baed5 Mon Sep 17 00:00:00 2001 From: Aji Kamaludin Date: Wed, 28 Jun 2023 13:45:28 +0700 Subject: [PATCH] fix filter --- resources/js/Customer/Deposit/Detail.jsx | 15 ++++++++--- .../DetailPartials/FormUploadCashDeposit.jsx | 2 +- .../DetailPartials/FormUploadManual.jsx | 2 +- resources/js/Customer/Poin/Detail.jsx | 25 +++++++++++-------- resources/js/Customer/Poin/Index.jsx | 3 ++- resources/js/Customer/Trx/Detail.jsx | 18 ++++++++++--- resources/js/Customer/Trx/Index.jsx | 1 + resources/js/Customer/utils.jsx | 5 ++++ 8 files changed, 51 insertions(+), 20 deletions(-) diff --git a/resources/js/Customer/Deposit/Detail.jsx b/resources/js/Customer/Deposit/Detail.jsx index e6c734d..a6a0f3e 100644 --- a/resources/js/Customer/Deposit/Detail.jsx +++ b/resources/js/Customer/Deposit/Detail.jsx @@ -1,6 +1,6 @@ import React from 'react' import { Head, router } from '@inertiajs/react' -import { HiChevronLeft } from 'react-icons/hi2' +import { HiChevronLeft, HiClipboardDocumentList } from 'react-icons/hi2' import CustomerLayout from '@/Layouts/CustomerLayout' import { PayButton } from './DetailPartials/PayButton' @@ -13,6 +13,7 @@ import { STATUS_REJECT, STATUS_EXPIRED, } from '@/constant' +import { handleCopyToClipboard } from '../utils' const ActionSection = ({ deposit }) => { if (deposit.is_valid === STATUS_EXPIRED) { @@ -67,8 +68,16 @@ export default function Detail({ deposit }) { {/* detail */}
-
- {deposit.description} +
+ handleCopyToClipboard(deposit.description) + } + > +
{deposit.description}
+
+ +
{deposit.amount} diff --git a/resources/js/Customer/Deposit/DetailPartials/FormUploadCashDeposit.jsx b/resources/js/Customer/Deposit/DetailPartials/FormUploadCashDeposit.jsx index c9e3246..ec4636e 100644 --- a/resources/js/Customer/Deposit/DetailPartials/FormUploadCashDeposit.jsx +++ b/resources/js/Customer/Deposit/DetailPartials/FormUploadCashDeposit.jsx @@ -47,7 +47,7 @@ export const FormUploadCashDeposit = () => { onSuccess: () => setTimeout( () => router.get(route(route().current(), deposit)), - 3000 + 500 ), }) } diff --git a/resources/js/Customer/Deposit/DetailPartials/FormUploadManual.jsx b/resources/js/Customer/Deposit/DetailPartials/FormUploadManual.jsx index 6f202f3..0678b1a 100644 --- a/resources/js/Customer/Deposit/DetailPartials/FormUploadManual.jsx +++ b/resources/js/Customer/Deposit/DetailPartials/FormUploadManual.jsx @@ -47,7 +47,7 @@ export const FormUploadManual = () => { onSuccess: () => setTimeout( () => router.get(route(route().current(), deposit)), - 3000 + 500 ), }) } diff --git a/resources/js/Customer/Poin/Detail.jsx b/resources/js/Customer/Poin/Detail.jsx index 26253e6..6be8cce 100644 --- a/resources/js/Customer/Poin/Detail.jsx +++ b/resources/js/Customer/Poin/Detail.jsx @@ -1,13 +1,14 @@ import React from 'react' import { Head, router } from '@inertiajs/react' -import { HiChevronLeft } from 'react-icons/hi2' +import { HiChevronLeft, HiClipboardDocumentList } from 'react-icons/hi2' import CustomerLayout from '@/Layouts/CustomerLayout' +import { handleCopyToClipboard } from '@/Customer/utils' export default function Detail({ poin }) { return ( - +
{/* detail */} -
-
-
- {poin.description} -
-
{poin.amount}
-
- {poin.format_created_at} +
+
handleCopyToClipboard(poin.description)} + > +
{poin.description}
+
+
+
{poin.amount} poin
+
+ {poin.format_created_at} +
diff --git a/resources/js/Customer/Poin/Index.jsx b/resources/js/Customer/Poin/Index.jsx index 669d572..3bb81f9 100644 --- a/resources/js/Customer/Poin/Index.jsx +++ b/resources/js/Customer/Poin/Index.jsx @@ -5,6 +5,7 @@ import { usePrevious } from 'react-use' import { formatIDDate } from '@/utils' import CustomerLayout from '@/Layouts/CustomerLayout' import HeaderTrx from '../Components/HeaderTrx' +import { isEmpty } from 'lodash' const EmptyHere = () => { return ( @@ -104,7 +105,7 @@ export default function Index(props) {
- {poin.amount} + {poin.amount} poin
diff --git a/resources/js/Customer/Trx/Detail.jsx b/resources/js/Customer/Trx/Detail.jsx index f15939f..1c6cd1e 100644 --- a/resources/js/Customer/Trx/Detail.jsx +++ b/resources/js/Customer/Trx/Detail.jsx @@ -2,8 +2,8 @@ import React from 'react' import { Head, router } from '@inertiajs/react' import CustomerLayout from '@/Layouts/CustomerLayout' import VoucherCard from './VoucherCard' -import { HiChevronLeft } from 'react-icons/hi2' -import { convertPayedWith } from '../utils' +import { HiChevronLeft, HiClipboardDocumentList } from 'react-icons/hi2' +import { convertPayedWith, handleCopyToClipboard } from '../utils' export default function Detail({ sale }) { return ( @@ -18,8 +18,18 @@ export default function Detail({ sale }) { >
-
{sale.code}
-
{sale.format_created_at}
+
handleCopyToClipboard(sale.code)} + > +
{sale.code}
+
+ +
+
+
+ {sale.format_created_at} +
diff --git a/resources/js/Customer/Trx/Index.jsx b/resources/js/Customer/Trx/Index.jsx index 721b7fd..9064c7b 100644 --- a/resources/js/Customer/Trx/Index.jsx +++ b/resources/js/Customer/Trx/Index.jsx @@ -5,6 +5,7 @@ import { Head, router } from '@inertiajs/react' import { formatIDDate } from '@/utils' import CustomerLayout from '@/Layouts/CustomerLayout' import HeaderTrx from '../Components/HeaderTrx' +import { isEmpty } from 'lodash' const EmptyHere = () => { return ( diff --git a/resources/js/Customer/utils.jsx b/resources/js/Customer/utils.jsx index 581de67..29e5e1b 100644 --- a/resources/js/Customer/utils.jsx +++ b/resources/js/Customer/utils.jsx @@ -17,6 +17,11 @@ export const toastError = (message) => { }) } +export const handleCopyToClipboard = (text) => { + toastSuccess('copied to clipboard') + navigator.clipboard.writeText(text) +} + export const convertPayedWith = (payed_with) => { const payedWith = [ {