Merge pull request #1572 from appwrite/fix-update-payment-address-with-payment-address

Inform the user to first add a billing address to their account
This commit is contained in:
Ernst Mulders authored and GitHub committed 2024-12-20 11:25:40 +01:00
commit 0c084db575
1 file changed
+14 -2
@@ -1,6 +1,6 @@
<script lang="ts">
import { invalidate } from '$app/navigation';
import { Modal, RadioBoxes } from '$lib/components';
import { Alert, Modal, RadioBoxes } from '$lib/components';
import { Button, FormItem, FormList, InputSelect, InputText } from '$lib/elements/forms';
import { sdk } from '$lib/stores/sdk';
import { organization } from '$lib/stores/organization';
@@ -10,6 +10,7 @@
import { addNotification } from '$lib/stores/notifications';
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
import { Pill } from '$lib/elements';
import { base } from '$app/paths';
export let show = false;
let addresses: AddressesList;
@@ -185,10 +186,21 @@
</FormList>
</RadioBoxes>
</FormList>
{:else}
<Alert
buttons={[
{
slot: 'Add address',
href: `${base}/account/payments`
}
]}>There are no billing addresses linked to your account.</Alert>
{/if}
<svelte:fragment slot="footer">
<Button text on:click={() => (show = false)}>Cancel</Button>
<Button secondary submit disabled={selectedAddress === $organization.billingAddressId}>
<Button
secondary
submit
disabled={selectedAddress === $organization.billingAddressId || !addresses?.total}>
Save
</Button>
</svelte:fragment>