mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-28 12:11:08 -04:00
Add New SweetAlert & Notification Components
This commit is contained in:
committed by
Mohit Panjwani
parent
3f7db2793f
commit
c3d3e5e35f
@ -147,6 +147,11 @@ export default {
|
||||
required,
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
noteType() {
|
||||
this.setFields()
|
||||
},
|
||||
},
|
||||
async mounted() {
|
||||
this.setFields()
|
||||
if (this.modalDataID) {
|
||||
@ -158,14 +163,10 @@ export default {
|
||||
: (this.noteType = 'Invoice')
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
noteType() {
|
||||
this.setFields()
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
...mapActions('modal', ['closeModal', 'resetModalData']),
|
||||
...mapActions('notes', ['addNote', 'updateNote']),
|
||||
...mapActions('notification', ['showNotification']),
|
||||
...mapActions('invoice', {
|
||||
setInvoiceNote: 'selectNote',
|
||||
}),
|
||||
@ -222,15 +223,19 @@ export default {
|
||||
|
||||
let res = await this.updateNote(data)
|
||||
if (res.data) {
|
||||
window.toastr['success'](
|
||||
this.$t('settings.customization.notes.note_updated')
|
||||
)
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$t('settings.customization.notes.note_updated'),
|
||||
})
|
||||
|
||||
this.refreshData ? this.refreshData() : ''
|
||||
this.closeNoteModal()
|
||||
return true
|
||||
}
|
||||
window.toastr['error'](res.data.error)
|
||||
this.showNotification({
|
||||
type: 'error',
|
||||
message: res.data.error,
|
||||
})
|
||||
} else {
|
||||
try {
|
||||
let data = {
|
||||
@ -243,9 +248,10 @@ export default {
|
||||
|
||||
if (response.data && response.data.note) {
|
||||
this.isLoading = false
|
||||
window.toastr['success'](
|
||||
this.$t('settings.customization.notes.note_added')
|
||||
)
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$t('settings.customization.notes.note_added'),
|
||||
})
|
||||
if (
|
||||
(this.$route.name === 'invoices.create' &&
|
||||
response.data.note.type === 'Invoice') ||
|
||||
@ -277,7 +283,10 @@ export default {
|
||||
this.closeNoteModal()
|
||||
return true
|
||||
}
|
||||
window.toastr['error'](response.data.error)
|
||||
this.showNotification({
|
||||
type: 'error',
|
||||
message: response.data.error,
|
||||
})
|
||||
} catch (err) {
|
||||
if (err.response.data.errors.name) {
|
||||
this.isLoading = true
|
||||
|
||||
Reference in New Issue
Block a user