diff --git a/src/routes/console/organization-[organization]/billing/paymentHistory.svelte b/src/routes/console/organization-[organization]/billing/paymentHistory.svelte index 8339ac60b..08fa1d05c 100644 --- a/src/routes/console/organization-[organization]/billing/paymentHistory.svelte +++ b/src/routes/console/organization-[organization]/billing/paymentHistory.svelte @@ -29,6 +29,7 @@ import { onMount } from 'svelte'; import { trackEvent } from '$lib/actions/analytics'; import { selectedInvoice, showRetryModal } from './store'; + import { organization } from '$lib/stores/organization'; let showDropdown = []; let showFailedError = false; @@ -48,6 +49,7 @@ invoiceList = await sdk.forConsole.billing.listInvoices($page.params.organization, [ Query.limit(limit), Query.offset(offset), + Query.notEqual('from', $organization.billingCurrentInvoiceDate), Query.orderDesc('$createdAt') ]); } @@ -70,7 +72,7 @@ payments.

- {#if invoiceList.total - 1 > 0} + {#if invoiceList.total > 0} Due Date @@ -81,115 +83,109 @@ {#each invoiceList?.invoices as invoice, i} {@const status = invoice.status} - {#if i !== 0} - - - {toLocaleDate(invoice.dueAt)} - + + + {toLocaleDate(invoice.dueAt)} + - - {#if invoice?.lastError} - - (showFailedError = true)} - button> - {status === 'requires_authentication' - ? 'failed' - : status} - - -
  • - The scheduled payment has failed. . -
  • -
    -
    - {:else} + + {#if invoice?.lastError} + + warning={status === 'pending'} + on:click={() => (showFailedError = true)} + button> {status === 'requires_authentication' ? 'failed' : status} - {/if} - - - {formatCurrency(invoice.amount)} - - - - - - (showDropdown[i] = !showDropdown[i])} - event="view_invoice"> - View invoice - - { - showDropdown[i] = !showDropdown[i]; - }} - event="download_invoice"> - Download PDF - - {#if status === 'overdue' || status === 'failed'} - + The scheduled payment has failed. . + - -
    - {/if} + {:else} + + {status === 'requires_authentication' ? 'failed' : status} + + {/if} + + + {formatCurrency(invoice.amount)} + + + + + + (showDropdown[i] = !showDropdown[i])} + event="view_invoice"> + View invoice + + { + showDropdown[i] = !showDropdown[i]; + }} + event="download_invoice"> + Download PDF + + {#if status === 'overdue' || status === 'failed'} + { + retryPayment(invoice); + showDropdown[i] = !showDropdown[i]; + trackEvent(`click_retry_payment`, { + from: 'button', + source: 'billing_invoice_menu' + }); + }}> + Retry payment + + {/if} + + + +
    {/each}
    -

    Total results: {invoiceList?.total - 1 ?? 0}

    - +

    Total results: {invoiceList?.total ?? 0}

    +
    {:else} diff --git a/src/routes/console/organization-[organization]/billing/planSummary.svelte b/src/routes/console/organization-[organization]/billing/planSummary.svelte index e1641ac7a..81edb295e 100644 --- a/src/routes/console/organization-[organization]/billing/planSummary.svelte +++ b/src/routes/console/organization-[organization]/billing/planSummary.svelte @@ -21,7 +21,7 @@ onMount(async () => { const invoices = await sdk.forConsole.billing.listInvoices($organization.$id, [ Query.limit(1), - Query.orderDesc('$createdAt') + Query.equal('from', $organization.billingCurrentInvoiceDate) ]); currentInvoice = invoices.invoices[0]; const members = await sdk.forConsole.teams.listMemberships($organization.$id, []);