mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-31 21:51:10 -04:00
Add New SweetAlert & Notification Components
This commit is contained in:
committed by
Mohit Panjwani
parent
3f7db2793f
commit
c3d3e5e35f
@ -56,6 +56,7 @@
|
||||
</transition>
|
||||
</template>
|
||||
<script>
|
||||
import { mapActions } from 'vuex'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -134,13 +135,17 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
...mapActions('notification', ['showNotification']),
|
||||
async updateAddressSetting() {
|
||||
let data = { type: 'ADDRESSES', ...this.addresses, large: true }
|
||||
|
||||
// if (this.updateSetting(data)) {
|
||||
window.toastr['success'](
|
||||
this.$t('settings.customization.addresses.address_setting_updated')
|
||||
)
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$t(
|
||||
'settings.customization.addresses.address_setting_updated'
|
||||
),
|
||||
})
|
||||
// }
|
||||
},
|
||||
},
|
||||
|
||||
@ -107,9 +107,7 @@
|
||||
</div>
|
||||
<div class="ml-4">
|
||||
<p class="p-0 mb-1 text-base leading-snug text-black">
|
||||
{{
|
||||
$t('settings.customization.estimates.estimate_email_attachment')
|
||||
}}
|
||||
{{ $t('settings.customization.estimates.estimate_email_attachment') }}
|
||||
</p>
|
||||
|
||||
<p
|
||||
@ -117,7 +115,9 @@
|
||||
style="max-width: 480px"
|
||||
>
|
||||
{{
|
||||
$t('settings.customization.estimates.estimate_email_attachment_setting_description')
|
||||
$t(
|
||||
'settings.customization.estimates.estimate_email_attachment_setting_description'
|
||||
)
|
||||
}}
|
||||
</p>
|
||||
</div>
|
||||
@ -126,7 +126,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapActions, mapGetters } from 'vuex'
|
||||
import { mapActions } from 'vuex'
|
||||
const { required, maxLength, alpha } = require('vuelidate/lib/validators')
|
||||
|
||||
export default {
|
||||
@ -244,7 +244,7 @@ export default {
|
||||
|
||||
methods: {
|
||||
...mapActions('company', ['updateCompanySettings']),
|
||||
|
||||
...mapActions('notification', ['showNotification']),
|
||||
async setEstimateSetting() {
|
||||
let data = {
|
||||
settings: {
|
||||
@ -254,7 +254,10 @@ export default {
|
||||
}
|
||||
let response = await this.updateCompanySettings(data)
|
||||
if (response.data) {
|
||||
window.toastr['success'](this.$t('general.setting_updated'))
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$t('general.setting_updated'),
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
@ -286,9 +289,12 @@ export default {
|
||||
}
|
||||
|
||||
if (this.updateSetting(data)) {
|
||||
window.toastr['success'](
|
||||
this.$t('settings.customization.estimates.estimate_setting_updated')
|
||||
)
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$t(
|
||||
'settings.customization.estimates.estimate_setting_updated'
|
||||
),
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -113,9 +113,7 @@
|
||||
|
||||
<div class="ml-4">
|
||||
<p class="p-0 mb-1 text-base leading-snug text-black">
|
||||
{{
|
||||
$t('settings.customization.invoices.invoice_email_attachment')
|
||||
}}
|
||||
{{ $t('settings.customization.invoices.invoice_email_attachment') }}
|
||||
</p>
|
||||
|
||||
<p
|
||||
@ -123,7 +121,9 @@
|
||||
style="max-width: 480px"
|
||||
>
|
||||
{{
|
||||
$t('settings.customization.invoices.invoice_email_attachment_setting_description')
|
||||
$t(
|
||||
'settings.customization.invoices.invoice_email_attachment_setting_description'
|
||||
)
|
||||
}}
|
||||
</p>
|
||||
</div>
|
||||
@ -240,6 +240,7 @@ export default {
|
||||
|
||||
methods: {
|
||||
...mapActions('company', ['updateCompanySettings']),
|
||||
...mapActions('notification', ['showNotification']),
|
||||
|
||||
async setInvoiceSetting() {
|
||||
let data = {
|
||||
@ -252,7 +253,10 @@ export default {
|
||||
let response = await this.updateCompanySettings(data)
|
||||
|
||||
if (response.data) {
|
||||
window.toastr['success'](this.$t('general.setting_updated'))
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$t('general.setting_updated'),
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
@ -283,9 +287,12 @@ export default {
|
||||
}
|
||||
|
||||
if (this.updateSetting(data)) {
|
||||
window.toastr['success'](
|
||||
this.$t('settings.customization.invoices.invoice_setting_updated')
|
||||
)
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$t(
|
||||
'settings.customization.invoices.invoice_setting_updated'
|
||||
),
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -9,9 +9,9 @@
|
||||
|
||||
<sw-table-component
|
||||
ref="table"
|
||||
variant="gray"
|
||||
:data="fetchData"
|
||||
:show-filter="false"
|
||||
variant="gray"
|
||||
>
|
||||
<sw-table-column
|
||||
:sortable="true"
|
||||
@ -66,6 +66,8 @@ export default {
|
||||
|
||||
...mapActions('item', ['deleteItemUnit', 'fetchItemUnits']),
|
||||
|
||||
...mapActions('notification', ['showNotification']),
|
||||
|
||||
async fetchData({ page, filter, sort }) {
|
||||
let data = {
|
||||
orderByField: sort.fieldName || 'created_at',
|
||||
@ -104,26 +106,31 @@ export default {
|
||||
},
|
||||
|
||||
async removeItemUnit(id) {
|
||||
swal({
|
||||
this.$swal({
|
||||
title: this.$t('general.are_you_sure'),
|
||||
text: this.$t('settings.customization.items.item_unit_confirm_delete'),
|
||||
icon: '/assets/icon/trash-solid.svg',
|
||||
buttons: true,
|
||||
dangerMode: true,
|
||||
}).then(async (value) => {
|
||||
if (value) {
|
||||
icon: 'question',
|
||||
iconHtml: `<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 text-red-600"fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" />
|
||||
</svg>`,
|
||||
showCancelButton: true,
|
||||
showConfirmButton: true,
|
||||
}).then(async (result) => {
|
||||
if (result.value) {
|
||||
let response = await this.deleteItemUnit(id)
|
||||
|
||||
if (response.data.success) {
|
||||
window.toastr['success'](
|
||||
this.$t('settings.customization.items.deleted_message')
|
||||
)
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$t('settings.customization.items.deleted_message'),
|
||||
})
|
||||
this.$refs.table.refresh()
|
||||
return true
|
||||
}
|
||||
window.toastr['error'](
|
||||
this.$t('settings.customization.items.already_in_use')
|
||||
)
|
||||
this.showNotification({
|
||||
type: 'error',
|
||||
message: this.$t('settings.customization.items.already_in_use'),
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@ -102,9 +102,7 @@
|
||||
|
||||
<div class="ml-4">
|
||||
<p class="p-0 mb-1 text-base leading-snug text-black">
|
||||
{{
|
||||
$t('settings.customization.payments.payment_email_attachment')
|
||||
}}
|
||||
{{ $t('settings.customization.payments.payment_email_attachment') }}
|
||||
</p>
|
||||
|
||||
<p
|
||||
@ -112,7 +110,9 @@
|
||||
style="max-width: 480px"
|
||||
>
|
||||
{{
|
||||
$t('settings.customization.payments.payment_email_attachment_setting_description')
|
||||
$t(
|
||||
'settings.customization.payments.payment_email_attachment_setting_description'
|
||||
)
|
||||
}}
|
||||
</p>
|
||||
</div>
|
||||
@ -228,6 +228,8 @@ export default {
|
||||
|
||||
...mapActions('company', ['updateCompanySettings']),
|
||||
|
||||
...mapActions('notification', ['showNotification']),
|
||||
|
||||
changeToUppercase(currentTab) {
|
||||
if (currentTab === 'PAYMENTS') {
|
||||
this.payments.payment_prefix = this.payments.payment_prefix.toUpperCase()
|
||||
@ -244,7 +246,10 @@ export default {
|
||||
}
|
||||
let response = await this.updateCompanySettings(data)
|
||||
if (response.data) {
|
||||
window.toastr['success'](this.$t('general.setting_updated'))
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$t('general.setting_updated'),
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
@ -266,9 +271,12 @@ export default {
|
||||
}
|
||||
|
||||
if (this.updateSetting(data)) {
|
||||
window.toastr['success'](
|
||||
this.$t('settings.customization.payments.payment_setting_updated')
|
||||
)
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$t(
|
||||
'settings.customization.payments.payment_setting_updated'
|
||||
),
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user