diff --git a/src/routes/console/apply-credit/+page.svelte b/src/routes/console/apply-credit/+page.svelte
index 3ac88c5ca..fe385bf48 100644
--- a/src/routes/console/apply-credit/+page.svelte
+++ b/src/routes/console/apply-credit/+page.svelte
@@ -8,7 +8,6 @@
EstimatedTotalBox,
SelectPaymentMethod
} from '$lib/components/billing';
- import ValidateCreditModal from '$lib/components/billing/validateCreditModal.svelte';
import { BillingPlan, Dependencies } from '$lib/constants';
import { Button, Form, FormList, InputSelect, InputTags, InputText } from '$lib/elements/forms';
import { toLocaleDate } from '$lib/helpers/date';
@@ -66,7 +65,7 @@
}
];
let name: string;
- let showCreditModal = false;
+ let coupon: string;
let couponData = data?.couponData;
onMount(async () => {
@@ -159,6 +158,23 @@
}
}
+ async function addCoupon() {
+ try {
+ const response = await sdk.forConsole.billing.getCoupon(coupon);
+ couponData = response;
+ coupon = null;
+ addNotification({
+ type: 'success',
+ message: 'Credits applied successfully'
+ });
+ } catch (e) {
+ addNotification({
+ type: 'error',
+ message: e.message
+ });
+ }
+ }
+
$: selectedOrg = $organizationList?.teams?.find(
(team) => team.$id === selectedOrgId
) as Organization;
@@ -219,13 +235,16 @@
{/if}
{#if !data?.couponData?.code && selectedOrgId}
-
+ bind:value={coupon}
+ placeholder="Enter coupon code"
+ id="code"
+ label="Coupon code">
+
+
{/if}
@@ -296,8 +315,6 @@
-
-