Add New SweetAlert & Notification Components

This commit is contained in:
Aman Upadhyay
2021-04-09 12:35:50 +00:00
committed by Mohit Panjwani
parent 3f7db2793f
commit c3d3e5e35f
78 changed files with 2295 additions and 984 deletions

View File

@@ -4,8 +4,8 @@
<div class="p-4 md:p-8">
<sw-input-group
:label="$t('general.to')"
class="mt-3"
:error="emailError"
class="mt-3"
variant="horizontal"
required
>
@@ -19,8 +19,8 @@
</sw-input-group>
<sw-input-group
:label="$t('general.subject')"
class="mt-3"
:error="subjectError"
class="mt-3"
variant="horizontal"
required
>
@@ -33,8 +33,8 @@
</sw-input-group>
<sw-input-group
:label="$t('general.message')"
class="mt-3"
:error="messageError"
class="mt-3"
variant="horizontal"
required
>
@@ -57,7 +57,7 @@
>
{{ $t('general.cancel') }}
</sw-button>
<sw-button variant="primary" type="submit" :loading="isLoading">
<sw-button :loading="isLoading" variant="primary" type="submit">
<paper-airplane-icon v-if="!isLoading" class="mr-2" />
{{ !isEdit ? $t('general.send') : $t('general.update') }}
</sw-button>
@@ -149,6 +149,7 @@ export default {
methods: {
...mapActions('modal', ['closeModal', 'resetModalData']),
...mapActions('company', ['sendTestMail']),
...mapActions('notification', ['showNotification']),
resetFormData() {
this.formData = {
to: null,
@@ -169,18 +170,26 @@ export default {
if (response.data) {
if (response.data.success) {
window.toastr['success'](this.$tc('general.send_mail_successfully'))
this.showNotification({
type: 'success',
message: this.$tc('general.send_mail_successfully'),
})
this.closeTaxModal()
this.isLoading = false
return true
}
window.toastr['error'](this.$tc('validation.something_went_wrong'))
this.showNotification({
type: 'error',
message: this.$tc('validation.something_went_wrong'),
})
this.closeTaxModal()
this.isLoading = false
return true
}
window.toastr['error'](response.data.error)
this.showNotification({
type: 'error',
message: response.data.error,
})
},
closeTaxModal() {
this.resetModalData()