{#snippet actions()} Create new subscriptionc {/snippet} {#snippet tools()} {#if failure || manualCards.failure} {failure || manualCards.failure} {/if} {period.label} {/snippet} {#if bills.isPending}

Loading subscriptions

{:else if bills.error}

{bills.error.message}

{:else if rows.length === 0}

No subscriptions yet. Create a subscription

{:else} open || (armed = false)}>
{#each sections as section, s (section.id)} {@const monthTotals = perMonth(section.items)} {#each section.items as item, j (item.id)} {@const i = offsets[s] + j} {@const bill = item.attributes} {@const ends = bill.end_date?.slice(0, 10)} {@const last = lastOf(item)} {@const who = payer(item)} {@const stale = paid.isSuccess ? staleSince(bill, last, day) : null} {@const extra = found.get(item.id) ?? []} {@const armedHere = arm.key?.endsWith(`:${item.id}`)} nav.click(i, e)} oncontextmenu={() => { menuFor = item; nav.cursor = i; }} > {#if extra.length > 0 || stale !== null || armedHere} {/if} {/each} {/each} {#if sections.length > 1} {/if}
Name Amount Paid this period
{section.title} {section.items.length} {monthTotals.length > 0 ? "a month" : ""}
{#if extra.length > 0} Not linked: {#each extra as p (p.journalId)} {formatDate(p.date, "short")} {p.description} {/each} {#if linking[item.id]} {linking[item.id]} {/if} {/if} {#if stale !== null || armedHere} {#if inactiveGroup} {/if} {/if}
Total, active subscriptions a month
{#if menuFor} {@const target = menuFor} show(target)}>Show edit(target)}>Edit {#if target.attributes.active} {/if} Move to group {#each groups.data ?? [] as group (group.id)} update(target, { object_group_title: group.attributes.title, })} >{group.attributes.title} {/each} update(target, { object_group_title: "" })} >No group update(target, { active: !target.attributes.active })} >{target.attributes.active ? "Deactivate" : "Activate"} location.assign(`/rules/create-from-bill/${target.id}`)} >Create rule from subscription location.assign( oldUiUrl(`${location.origin}/subscriptions/show/${target.id}`) )} >Open in old UI { if (!armed) { e.preventDefault(); armed = true; return; } remove(target); }} variant="destructive" >{armed ? "Press again to delete" : "Delete"} {/if}
{/if} {#snippet footer()} Create new subscription {/snippet}