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

@ -62,7 +62,7 @@
:allow-empty="false"
:show-labels="false"
:placeholder="$t('customers.select_currency')"
:maxHeight="200"
:max-height="200"
label="name"
class="mt-1 md:mt-0"
track-by="id"
@ -343,7 +343,7 @@
>
{{ $t('general.cancel') }}
</sw-button>
<sw-button variant="primary" type="submit" :loading="isLoading">
<sw-button :loading="isLoading" variant="primary" type="submit">
<save-icon v-if="!isLoading" class="mr-2" />
{{ $t('general.save') }}
</sw-button>
@ -444,6 +444,8 @@ export default {
...mapGetters(['currencies', 'countries']),
...mapGetters('company', ['defaultCurrency']),
...mapGetters('modal', ['modalDataID', 'modalData', 'modalActive']),
...mapActions('notification', ['showNotification']),
nameError() {
if (!this.$v.formData.name.$error) {
return ''
@ -586,6 +588,7 @@ export default {
'updateCustomer',
]),
...mapActions('modal', ['closeModal']),
...mapActions('notification', ['showNotification']),
resetData() {
this.formData = {
name: null,
@ -700,9 +703,15 @@ export default {
}
if (response.data) {
if (this.modalDataID) {
window.toastr['success'](this.$tc('customers.updated_message'))
this.showNotification({
type: 'success',
message: this.$tc('customers.updated_message'),
})
} else {
window.toastr['success'](this.$tc('customers.created_message'))
this.showNotification({
type: 'success',
message: this.$tc('customers.created_message'),
})
}
this.isLoading = false