From e54b835341f6762715591255a0541049502f1809 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sat, 2 Nov 2024 11:04:42 +1100 Subject: [PATCH 1/4] Remove reversal as option --- .../common/hooks/useCustomBulkActions.tsx | 26 ++++++------ .../invoices/edit/components/Actions.tsx | 40 +++++++++---------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/pages/invoices/common/hooks/useCustomBulkActions.tsx b/src/pages/invoices/common/hooks/useCustomBulkActions.tsx index 62be84ed52..67f3cd6a2f 100644 --- a/src/pages/invoices/common/hooks/useCustomBulkActions.tsx +++ b/src/pages/invoices/common/hooks/useCustomBulkActions.tsx @@ -223,19 +223,19 @@ export const useCustomBulkActions = () => { {t('documents')} ), - ({ selectedResources, setSelected }) => - showReverseOption(selectedResources) && - hasPermission('create_credit') && ( - { - reverseInvoice(selectedResources[0]); - setSelected([]); - }} - icon={} - > - {t('reverse')} - - ), + // ({ selectedResources, setSelected }) => + // showReverseOption(selectedResources) && + // hasPermission('create_credit') && ( + // { + // reverseInvoice(selectedResources[0]); + // setSelected([]); + // }} + // icon={} + // > + // {t('reverse')} + // + // ), ({ selectedIds, selectedResources, setSelected }) => showCancelOption(selectedResources) && ( ), - (invoice: Invoice) => - (invoice.status_id === InvoiceStatus.Paid || - invoice.status_id === InvoiceStatus.Partial) && - !invoice.is_deleted && - !invoice.archived_at && - hasPermission('create_credit') && ( - reverseInvoice(invoice)} - icon={MdRefresh} - > - {t('reverse')} - - ), + // (invoice: Invoice) => + // (invoice.status_id === InvoiceStatus.Paid || + // invoice.status_id === InvoiceStatus.Partial) && + // !invoice.is_deleted && + // !invoice.archived_at && + // hasPermission('create_credit') && ( + // reverseInvoice(invoice)} + // icon={MdRefresh} + // > + // {t('reverse')} + // + // ), (invoice: Invoice) => ( { From 6eec0710911a90977cc8d85981f52e1ec29504ef Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sat, 2 Nov 2024 11:05:30 +1100 Subject: [PATCH 2/4] lint --- src/pages/invoices/common/hooks/useCustomBulkActions.tsx | 4 ++-- src/pages/invoices/edit/components/Actions.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/invoices/common/hooks/useCustomBulkActions.tsx b/src/pages/invoices/common/hooks/useCustomBulkActions.tsx index 67f3cd6a2f..13e7477ffd 100644 --- a/src/pages/invoices/common/hooks/useCustomBulkActions.tsx +++ b/src/pages/invoices/common/hooks/useCustomBulkActions.tsx @@ -32,7 +32,7 @@ import { toast } from '$app/common/helpers/toast/toast'; import { InvoiceStatus } from '$app/common/enums/invoice-status'; import collect from 'collect.js'; import { isInvoiceAutoBillable } from '../../edit/components/Actions'; -import { useReverseInvoice } from './useReverseInvoice'; +// import { useReverseInvoice } from './useReverseInvoice'; import { useDocumentsBulk } from '$app/common/queries/documents'; import { Dispatch, SetStateAction } from 'react'; import { useHasPermission } from '$app/common/hooks/permissions/useHasPermission'; @@ -52,7 +52,7 @@ export const useCustomBulkActions = () => { const bulk = useBulk(); - const reverseInvoice = useReverseInvoice(); + // const reverseInvoice = useReverseInvoice(); const getDocumentsIds = (invoices: Invoice[]) => { return invoices.flatMap(({ documents }) => documents.map(({ id }) => id)); diff --git a/src/pages/invoices/edit/components/Actions.tsx b/src/pages/invoices/edit/components/Actions.tsx index df5d1cae08..9010fb69d3 100644 --- a/src/pages/invoices/edit/components/Actions.tsx +++ b/src/pages/invoices/edit/components/Actions.tsx @@ -46,7 +46,7 @@ import { EntityState } from '$app/common/enums/entity-state'; import dayjs from 'dayjs'; import { useEntityPageIdentifier } from '$app/common/hooks/useEntityPageIdentifier'; import { useBulk } from '$app/common/queries/invoices'; -import { useReverseInvoice } from '../../common/hooks/useReverseInvoice'; +// import { useReverseInvoice } from '../../common/hooks/useReverseInvoice'; import { EmailInvoiceAction } from '../../common/components/EmailInvoiceAction'; import { useAdmin, @@ -98,7 +98,7 @@ export function useActions(params?: Params) { const bulk = useBulk(); const navigate = useNavigate(); const hasPermission = useHasPermission(); - const reverseInvoice = useReverseInvoice(); + // const reverseInvoice = useReverseInvoice(); const downloadPdf = useDownloadPdf({ resource: 'invoice' }); const downloadEInvoice = useDownloadEInvoice({ resource: 'invoice' }); const printPdf = usePrintPdf({ entity: 'invoice' }); From 19d9935af370e9429068b30704ecdd7ce640a2d8 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sat, 2 Nov 2024 11:06:06 +1100 Subject: [PATCH 3/4] lint --- src/pages/invoices/common/hooks/useCustomBulkActions.tsx | 2 +- src/pages/invoices/edit/components/Actions.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/invoices/common/hooks/useCustomBulkActions.tsx b/src/pages/invoices/common/hooks/useCustomBulkActions.tsx index 13e7477ffd..fa10c4eb17 100644 --- a/src/pages/invoices/common/hooks/useCustomBulkActions.tsx +++ b/src/pages/invoices/common/hooks/useCustomBulkActions.tsx @@ -20,7 +20,7 @@ import { MdMarkEmailRead, MdPaid, MdPrint, - MdRefresh, + // MdRefresh, } from 'react-icons/md'; import { usePrintPdf } from './usePrintPdf'; import { useDownloadPdfs } from './useDownloadPdfs'; diff --git a/src/pages/invoices/edit/components/Actions.tsx b/src/pages/invoices/edit/components/Actions.tsx index 9010fb69d3..cc8c9424c5 100644 --- a/src/pages/invoices/edit/components/Actions.tsx +++ b/src/pages/invoices/edit/components/Actions.tsx @@ -34,7 +34,7 @@ import { MdPaid, MdPictureAsPdf, MdPrint, - MdRefresh, + // MdRefresh, MdRestore, MdSchedule, } from 'react-icons/md'; From 017bc1df42a322a07c2975012edad80e9bb0294c Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sat, 2 Nov 2024 11:06:35 +1100 Subject: [PATCH 4/4] lint --- .../common/hooks/useCustomBulkActions.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/pages/invoices/common/hooks/useCustomBulkActions.tsx b/src/pages/invoices/common/hooks/useCustomBulkActions.tsx index fa10c4eb17..e886d12670 100644 --- a/src/pages/invoices/common/hooks/useCustomBulkActions.tsx +++ b/src/pages/invoices/common/hooks/useCustomBulkActions.tsx @@ -106,15 +106,15 @@ export const useCustomBulkActions = () => { ); }; - const showReverseOption = (invoices: Invoice[]) => { - return !invoices.some( - ({ status_id, is_deleted, archived_at }) => - (status_id !== InvoiceStatus.Paid && - status_id !== InvoiceStatus.Partial) || - is_deleted || - archived_at - ); - }; + // const showReverseOption = (invoices: Invoice[]) => { + // return !invoices.some( + // ({ status_id, is_deleted, archived_at }) => + // (status_id !== InvoiceStatus.Paid && + // status_id !== InvoiceStatus.Partial) || + // is_deleted || + // archived_at + // ); + // }; const handleDownloadDocuments = ( selectedInvoices: Invoice[],