Skip to content

Commit

Permalink
patch: Add Processing status for invoices and update related componen…
Browse files Browse the repository at this point in the history
…ts (#104)
  • Loading branch information
acalinica authored Feb 28, 2025
1 parent 9a64be2 commit 1f7abaa
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 55 deletions.
39 changes: 31 additions & 8 deletions public/icons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export * from './Contract';
export * from './BillingCycle';
export * from './InvoicePreview';
export * from './InvoiceStatus';
export * from './Amount';
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export const getFilterTypes = () => {
{ label: 'Scheduled', id: InvoiceStatus.Scheduled },
{ label: 'Void', id: InvoiceStatus.Void },
{ label: 'Overdue', id: InvoiceStatus.Overdue },
{ label: 'Processing', id: InvoiceStatus.PaymentProcessing },
{ label: 'Paid', id: InvoiceStatus.Paid },
],
},
Expand Down
7 changes: 4 additions & 3 deletions src/routes/finder/src/components/Columns/invoices/sortFns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ export const getInvoicesSortFn = (columnId: string) =>
.with(InvoiceStatus.OnHold, () => 2)
.with(InvoiceStatus.Scheduled, () => 3)
.with(InvoiceStatus.Void, () => 4)
.with(InvoiceStatus.Paid, () => 5)
.with(InvoiceStatus.Due, () => 6)
.with(InvoiceStatus.Overdue, () => 7)
.with(InvoiceStatus.PaymentProcessing, () => 5)
.with(InvoiceStatus.Paid, () => 6)
.with(InvoiceStatus.Due, () => 7)
.with(InvoiceStatus.Overdue, () => 8)
.otherwise(() => null),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,16 @@ export const PaymentStatusSelect = observer(
const invoiceStatus = invoice?.value?.status;
const Status = renderStatusNode(invoiceStatus) ?? <>{invoiceStatus}</>;
const isPaid = invoiceStatus === InvoiceStatus.Paid;
const isProcessing = invoiceStatus === InvoiceStatus.PaymentProcessing;

if (!invoice) return;
if (!invoice) return null;

return (
<Menu>
<MenuButton
asChild
onClick={(e) => e.stopPropagation()}
disabled={invoiceStatus === InvoiceStatus.Scheduled}
disabled={invoiceStatus === InvoiceStatus.Scheduled || isProcessing}
>
{cloneElement(Status, {
className: cn(
Expand Down
25 changes: 16 additions & 9 deletions src/routes/src/components/Invoice/Cells/status/StatusCell.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { Clock } from '@ui/media/icons/Clock';
import { Icon } from '@ui/media/Icon';
import { InvoiceStatus } from '@graphql/types';
import { InfoCircle } from '@ui/media/icons/InfoCircle';
import { CheckCircle } from '@ui/media/icons/CheckCircle';
import { SlashCircle01 } from '@ui/media/icons/SlashCircle01';
import { ClockFastForward } from '@ui/media/icons/ClockFastForward';
import { Tag, TagLabel, TagLeftIcon } from '@ui/presentation/Tag/Tag';

Expand All @@ -17,6 +14,7 @@ export function renderStatusNode(type: InvoiceStatus | null | undefined) {
return (
<Tag variant='outline' colorScheme='grayModern'>
<TagLeftIcon>
<Icon name='clock-fast-forward' />
<ClockFastForward />
</TagLeftIcon>
<TagLabel>Draft</TagLabel>
Expand All @@ -26,7 +24,7 @@ export function renderStatusNode(type: InvoiceStatus | null | undefined) {
return (
<Tag variant='outline' colorScheme='success'>
<TagLeftIcon>
<CheckCircle />
<Icon name='check-circle' />
</TagLeftIcon>
<TagLabel>Paid</TagLabel>
</Tag>
Expand All @@ -35,7 +33,7 @@ export function renderStatusNode(type: InvoiceStatus | null | undefined) {
return (
<Tag variant='outline' colorScheme='primary'>
<TagLeftIcon>
<Clock />
<Icon name='clock' />
</TagLeftIcon>
<TagLabel>Due</TagLabel>
</Tag>
Expand All @@ -44,7 +42,7 @@ export function renderStatusNode(type: InvoiceStatus | null | undefined) {
return (
<Tag variant='outline' colorScheme='grayModern'>
<TagLeftIcon>
<SlashCircle01 />
<Icon name='slash-circle-01' />
</TagLeftIcon>
<TagLabel>Voided</TagLabel>
</Tag>
Expand All @@ -53,7 +51,7 @@ export function renderStatusNode(type: InvoiceStatus | null | undefined) {
return (
<Tag variant='outline' colorScheme='grayModern'>
<TagLeftIcon>
<ClockFastForward />
<Icon name='clock-fast-forward' />
</TagLeftIcon>
<TagLabel>Scheduled</TagLabel>
</Tag>
Expand All @@ -62,11 +60,20 @@ export function renderStatusNode(type: InvoiceStatus | null | undefined) {
return (
<Tag variant='outline' colorScheme='warning'>
<TagLeftIcon>
<InfoCircle />
<Icon name='info-circle' />
</TagLeftIcon>
<TagLabel>Overdue</TagLabel>
</Tag>
);
case InvoiceStatus.PaymentProcessing:
return (
<Tag variant='outline' colorScheme='grayModern'>
<TagLeftIcon>
<Icon name='clock-fast-forward' />
</TagLeftIcon>
<TagLabel>Processing</TagLabel>
</Tag>
);
default:
return null;
}
Expand Down
40 changes: 29 additions & 11 deletions src/routes/src/types/__generated__/graphql.types.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions src/ui/media/Icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,11 @@ export type IconName =
| 'x-square'
| 'brackets-plus'
| 'file-plus-02'
| 'filter-lines';

| 'filter-lines'
| 'clock-fast-forward'
| 'slash-circle-01'
| 'info-circle'
| 'refresh-cw-02';
interface IconProps extends SVGAttributes<SVGElement> {
name: IconName;
className?: string;
Expand Down

0 comments on commit 1f7abaa

Please sign in to comment.