-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(billing): revamp billing overview (#2322)
Co-authored-by: Shariq Ansari <[email protected]>
- Loading branch information
1 parent
db0482c
commit 63cb077
Showing
28 changed files
with
2,210 additions
and
547 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<template> | ||
<Dialog v-model="show" :options="{ title: 'Add new card' }"> | ||
<template #body-content> | ||
<div | ||
v-if="showMessage" | ||
class="mb-5 inline-flex gap-1.5 text-base text-gray-700" | ||
> | ||
<FeatherIcon class="h-4" name="info" /> | ||
<span> Add at least one card before changing the payment mode. </span> | ||
</div> | ||
<CardForm | ||
@success=" | ||
() => { | ||
show = false; | ||
emit('success'); | ||
} | ||
" | ||
/> | ||
</template> | ||
</Dialog> | ||
</template> | ||
<script setup> | ||
import CardForm from './CardForm.vue'; | ||
import { Dialog, FeatherIcon } from 'frappe-ui'; | ||
const props = defineProps({ | ||
showMessage: { | ||
type: Boolean, | ||
default: false | ||
} | ||
}); | ||
const emit = defineEmits(['success']); | ||
const show = defineModel(); | ||
</script> |
37 changes: 37 additions & 0 deletions
37
dashboard/src2/components/billing/AddPrepaidCreditsDialog.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<template> | ||
<Dialog v-model="show" :options="{ title: 'Add Credit Balance' }"> | ||
<template #body-content> | ||
<div | ||
v-if="showMessage" | ||
class="mb-5 inline-flex gap-1.5 text-base text-gray-700" | ||
> | ||
<FeatherIcon class="h-4" name="info" /> | ||
<span> | ||
Add credits to your account before changing the payment mode. | ||
</span> | ||
</div> | ||
<PrepaidCreditsForm | ||
@success=" | ||
() => { | ||
show = false; | ||
emit('success'); | ||
} | ||
" | ||
/> | ||
</template> | ||
</Dialog> | ||
</template> | ||
<script setup> | ||
import PrepaidCreditsForm from './PrepaidCreditsForm.vue'; | ||
import { Dialog, FeatherIcon } from 'frappe-ui'; | ||
const props = defineProps({ | ||
showMessage: { | ||
type: Boolean, | ||
default: false | ||
} | ||
}); | ||
const emit = defineEmits(['success']); | ||
const show = defineModel(); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<template> | ||
<div class="flex flex-col gap-5"> | ||
<FormControl | ||
v-model="billingInformation.billing_name" | ||
type="text" | ||
name="billing_name" | ||
label="Billing Name" | ||
:required="true" | ||
/> | ||
<NewAddressForm | ||
ref="addressFormRef" | ||
v-model="billingInformation" | ||
@success="() => emit('success')" | ||
/> | ||
<ErrorMessage class="mt-2" :message="errorMessage" /> | ||
</div> | ||
<div v-if="addressFormRef" class="mt-6"> | ||
<Button | ||
class="w-full" | ||
variant="solid" | ||
label="Update billing details" | ||
:loading="addressFormRef.updateBillingInformation.loading" | ||
@click="updateBillingInformation" | ||
/> | ||
</div> | ||
</template> | ||
<script setup> | ||
import NewAddressForm from './NewAddressForm.vue'; | ||
import { FormControl, ErrorMessage, Button, createResource } from 'frappe-ui'; | ||
import { reactive, ref } from 'vue'; | ||
const emit = defineEmits(['success']); | ||
const addressFormRef = ref(null); | ||
const billingInformation = reactive({ | ||
billing_name: '', | ||
address: '', | ||
city: '', | ||
state: '', | ||
postal_code: '', | ||
country: '', | ||
gstin: '' | ||
}); | ||
createResource({ | ||
url: 'press.api.account.get_billing_information', | ||
auto: true, | ||
onSuccess: data => { | ||
Object.assign(billingInformation, { | ||
address: data.address_line1, | ||
city: data.city, | ||
state: data.state, | ||
postal_code: data.pincode, | ||
country: data.country, | ||
gstin: data.gstin == 'Not Applicable' ? '' : data.gstin, | ||
billing_name: data.billing_name | ||
}); | ||
} | ||
}); | ||
const errorMessage = ref(''); | ||
function updateBillingInformation() { | ||
if (!billingInformation.billing_name) { | ||
errorMessage.value = 'Billing Name is required'; | ||
return; | ||
} | ||
addressFormRef.value.updateBillingInformation.submit(); | ||
} | ||
</script> |
Oops, something went wrong.