mirror of
https://github.com/crater-invoice/crater.git
synced 2026-02-08 11:52:40 -05:00
Add New SweetAlert & Notification Components
This commit is contained in:
committed by
Mohit Panjwani
parent
3f7db2793f
commit
c3d3e5e35f
@@ -33,18 +33,18 @@
|
||||
:show-labels="false"
|
||||
:placeholder="$t('settings.disk.select_disk')"
|
||||
:allow-empty="false"
|
||||
:custom-label="getCustomLabel"
|
||||
track-by="id"
|
||||
label="name"
|
||||
:custom-label="getCustomLabel"
|
||||
@select="refreshTable"
|
||||
/>
|
||||
</sw-input-group>
|
||||
</div>
|
||||
<sw-table-component
|
||||
ref="table"
|
||||
variant="gray"
|
||||
:show-filter="false"
|
||||
:data="fetchBackupsData"
|
||||
variant="gray"
|
||||
>
|
||||
<sw-table-column :label="$t('settings.backup.path')" show="path">
|
||||
<template slot-scope="row">
|
||||
@@ -119,6 +119,8 @@ export default {
|
||||
|
||||
...mapActions('modal', ['openModal']),
|
||||
|
||||
...mapActions('notification', ['showNotification']),
|
||||
|
||||
getCustomLabel({ driver, name }) {
|
||||
if (!name) {
|
||||
return
|
||||
@@ -127,14 +129,17 @@ export default {
|
||||
},
|
||||
|
||||
async onRemoveBackup(backup) {
|
||||
swal({
|
||||
this.$swal({
|
||||
title: this.$t('general.are_you_sure'),
|
||||
text: this.$t('settings.backup.backup_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 data = {
|
||||
disk: this.filters.selected_disk.driver,
|
||||
file_disk_id: this.filters.selected_disk.id,
|
||||
@@ -142,7 +147,10 @@ export default {
|
||||
}
|
||||
let response = await this.removeBackup(data)
|
||||
if (response.data.success) {
|
||||
window.toastr['success'](this.$t('settings.backup.deleted_message'))
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$t('settings.backup.deleted_message'),
|
||||
})
|
||||
this.$refs.table.refresh()
|
||||
return true
|
||||
}
|
||||
@@ -170,9 +178,10 @@ export default {
|
||||
let response = await this.fetchBackups(data)
|
||||
|
||||
if (response.data.error) {
|
||||
window.toastr['error'](
|
||||
this.$t('settings.backup.' + response.data.error)
|
||||
)
|
||||
this.showNotification({
|
||||
type: 'error',
|
||||
message: this.$t('settings.backup.' + response.data.error),
|
||||
})
|
||||
}
|
||||
|
||||
this.isRequestOngoing = false
|
||||
@@ -225,7 +234,10 @@ export default {
|
||||
})
|
||||
.catch((e) => {
|
||||
this.isRequestOngoing = false
|
||||
window.toastr['error'](e.response.data.message)
|
||||
this.showNotification({
|
||||
type: 'error',
|
||||
message: e.response.data.message,
|
||||
})
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<form @submit.prevent="updateCompanyData" class="relative h-full">
|
||||
<form class="relative h-full" @submit.prevent="updateCompanyData">
|
||||
<base-loader v-if="isRequestOnGoing" :show-bg-overlay="true" />
|
||||
<sw-card variant="setting-card">
|
||||
<template slot="header">
|
||||
@@ -41,8 +41,8 @@
|
||||
</div>
|
||||
|
||||
<sw-avatar
|
||||
trigger="#logo-box"
|
||||
:preview-avatar="previewLogo"
|
||||
trigger="#logo-box"
|
||||
@changed="onChange"
|
||||
@uploadHandler="onUploadHandler"
|
||||
@handleUploadError="onHandleUploadError"
|
||||
@@ -74,8 +74,8 @@
|
||||
<sw-input-group :label="$tc('settings.company_info.phone')">
|
||||
<sw-input
|
||||
v-model="formData.phone"
|
||||
class="mt-2"
|
||||
:placeholder="$t('settings.company_info.phone')"
|
||||
class="mt-2"
|
||||
/>
|
||||
</sw-input-group>
|
||||
|
||||
@@ -153,9 +153,9 @@
|
||||
</div>
|
||||
|
||||
<sw-button
|
||||
class="mt-4"
|
||||
:loading="isLoading"
|
||||
:disabled="isLoading"
|
||||
class="mt-4"
|
||||
variant="primary"
|
||||
>
|
||||
<save-icon v-if="!isLoading" class="mr-2 -ml-1" />
|
||||
@@ -269,13 +269,17 @@ export default {
|
||||
methods: {
|
||||
...mapActions('company', ['updateCompany', 'updateCompanyLogo']),
|
||||
...mapActions('user', ['fetchCurrentUser']),
|
||||
...mapActions('notification', ['showNotification']),
|
||||
onUploadHandler(cropper) {
|
||||
this.previewLogo = cropper
|
||||
.getCroppedCanvas()
|
||||
.toDataURL(this.cropperOutputMime)
|
||||
},
|
||||
onHandleUploadError() {
|
||||
window.toastr['error']('Oops! Something went wrong...')
|
||||
this.showNotification({
|
||||
type: 'error',
|
||||
message: 'Oops! Something went wrong...',
|
||||
})
|
||||
},
|
||||
onChange(file) {
|
||||
this.cropperOutputMime = file.type
|
||||
@@ -322,13 +326,17 @@ export default {
|
||||
await this.updateCompanyLogo(logoData)
|
||||
}
|
||||
this.isLoading = false
|
||||
window.toastr['success'](
|
||||
this.$t('settings.company_info.updated_message')
|
||||
)
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$t('settings.company_info.updated_message'),
|
||||
})
|
||||
return true
|
||||
}
|
||||
this.isLoading = false
|
||||
window.toastr['error'](response.data.error)
|
||||
this.showNotification({
|
||||
type: 'error',
|
||||
message: response.data.error,
|
||||
})
|
||||
return true
|
||||
},
|
||||
},
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
|
||||
<sw-table-component
|
||||
ref="table"
|
||||
variant="gray"
|
||||
:show-filter="false"
|
||||
:data="fetchData"
|
||||
variant="gray"
|
||||
>
|
||||
<sw-table-column
|
||||
:sortable="true"
|
||||
@@ -118,6 +118,8 @@ export default {
|
||||
|
||||
...mapActions('modal', ['openModal']),
|
||||
|
||||
...mapActions('notification', ['showNotification']),
|
||||
|
||||
async fetchData({ page, filter, sort }) {
|
||||
let data = {
|
||||
orderByField: sort.fieldName || 'created_at',
|
||||
@@ -138,26 +140,31 @@ export default {
|
||||
},
|
||||
|
||||
async removeCustomField(id) {
|
||||
swal({
|
||||
this.$swal({
|
||||
title: this.$t('general.are_you_sure'),
|
||||
text: this.$t('settings.custom_fields.custom_field_confirm_delete'),
|
||||
icon: '/assets/icon/trash-solid.svg',
|
||||
buttons: true,
|
||||
dangerMode: true,
|
||||
}).then(async (value) => {
|
||||
if (value) {
|
||||
icon: 'error',
|
||||
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.deleteCustomFields(id)
|
||||
if (response.data.success) {
|
||||
window.toastr['success'](
|
||||
this.$t('settings.custom_fields.deleted_message')
|
||||
)
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$t('settings.custom_fields.deleted_message'),
|
||||
})
|
||||
this.id = null
|
||||
this.$refs.table.refresh()
|
||||
return true
|
||||
}
|
||||
window.toastr['error'](
|
||||
this.$t('settings.custom_fields.already_in_use')
|
||||
)
|
||||
this.showNotification({
|
||||
type: 'error',
|
||||
message: this.$t('settings.custom_fields.already_in_use'),
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -110,6 +110,8 @@ export default {
|
||||
'deleteCategory',
|
||||
]),
|
||||
|
||||
...mapActions('notification', ['showNotification']),
|
||||
|
||||
async fetchData({ page, filter, sort }) {
|
||||
let data = {
|
||||
orderByField: sort.fieldName || 'created_at',
|
||||
@@ -132,26 +134,31 @@ export default {
|
||||
},
|
||||
|
||||
async removeExpenseCategory(id, index) {
|
||||
swal({
|
||||
this.$swal({
|
||||
title: this.$t('general.are_you_sure'),
|
||||
text: this.$t('settings.expense_category.confirm_delete'),
|
||||
icon: '/assets/icon/trash-solid.svg',
|
||||
buttons: true,
|
||||
dangerMode: true,
|
||||
}).then(async (willDelete) => {
|
||||
if (willDelete) {
|
||||
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>s`,
|
||||
showCancelButton: true,
|
||||
showConfirmButton: true,
|
||||
}).then(async (result) => {
|
||||
if (result.value) {
|
||||
let response = await this.deleteCategory(id)
|
||||
if (response.data.success) {
|
||||
window.toastr['success'](
|
||||
this.$tc('settings.expense_category.deleted_message')
|
||||
)
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$tc('settings.expense_category.deleted_message'),
|
||||
})
|
||||
this.id = null
|
||||
this.$refs.table.refresh()
|
||||
return true
|
||||
}
|
||||
window.toastr['error'](
|
||||
this.$t('settings.expense_category.already_in_use')
|
||||
)
|
||||
this.showNotification({
|
||||
type: 'error',
|
||||
message: this.$t('settings.expense_category.already_in_use'),
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
|
||||
<sw-table-component
|
||||
ref="table"
|
||||
variant="gray"
|
||||
:show-filter="false"
|
||||
:data="fetchData"
|
||||
variant="gray"
|
||||
table-class="table tax-table"
|
||||
class="mt-0 mb-3"
|
||||
>
|
||||
@@ -173,6 +173,8 @@ export default {
|
||||
|
||||
...mapActions('company', ['updateCompanySettings', 'fetchCompanySettings']),
|
||||
|
||||
...mapActions('notification', ['showNotification']),
|
||||
|
||||
async fetchData({ page, filter, sort }) {
|
||||
let data = {
|
||||
orderByField: sort.fieldName || 'created_at',
|
||||
@@ -243,20 +245,39 @@ export default {
|
||||
let response = await this.updateCompanySettings(data)
|
||||
|
||||
if (response.data.success) {
|
||||
window.toastr['success'](this.$t('general.setting_updated'))
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$t('general.setting_updated'),
|
||||
})
|
||||
}
|
||||
this.$refs.table.refresh()
|
||||
},
|
||||
|
||||
async setDefaultDiskData(id) {
|
||||
swal({
|
||||
this.$swal({
|
||||
title: this.$t('general.are_you_sure'),
|
||||
text: this.$t('settings.disk.set_default_disk_confirm'),
|
||||
icon: '/assets/icon/check-circle-solid.svg',
|
||||
buttons: true,
|
||||
dangerMode: true,
|
||||
}).then(async (value) => {
|
||||
if (value) {
|
||||
icon: 'question',
|
||||
iconHtml: `<svg
|
||||
aria-hidden="true"
|
||||
class="w-6 h-6"
|
||||
focusable="false"
|
||||
data-prefix="fas"
|
||||
data-icon="check-circle"
|
||||
class="svg-inline--fa fa-check-circle fa-w-16"
|
||||
role="img"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 512 512"
|
||||
>
|
||||
<path
|
||||
fill="#55547A"
|
||||
d="M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z"
|
||||
></path>
|
||||
</svg>`,
|
||||
showCancelButton: true,
|
||||
showConfirmButton: true,
|
||||
}).then(async (result) => {
|
||||
if (result.value) {
|
||||
this.loading = true
|
||||
let data = {
|
||||
set_as_default: true,
|
||||
@@ -266,26 +287,33 @@ export default {
|
||||
|
||||
if (response.data.success) {
|
||||
this.refreshTable()
|
||||
window.toastr['success'](
|
||||
this.$t('settings.disk.success_set_default_disk')
|
||||
)
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$t('settings.disk.success_set_default_disk'),
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
async removeDisk(id) {
|
||||
swal({
|
||||
this.$swal({
|
||||
title: this.$t('general.are_you_sure'),
|
||||
text: this.$t('settings.disk.confirm_delete'),
|
||||
icon: '/assets/icon/trash-solid.svg',
|
||||
buttons: true,
|
||||
dangerMode: true,
|
||||
}).then(async (value) => {
|
||||
if (value) {
|
||||
icon: 'error',
|
||||
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.deleteFileDisk(id)
|
||||
if (response.data.success) {
|
||||
window.toastr['success'](this.$t('settings.disk.deleted_message'))
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$t('settings.disk.deleted_message'),
|
||||
})
|
||||
this.refreshTable()
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ export default {
|
||||
'fetchMailConfig',
|
||||
'updateMailConfig',
|
||||
]),
|
||||
...mapActions('notification', ['showNotification']),
|
||||
|
||||
async loadData() {
|
||||
this.isRequestOnGoing = true
|
||||
@@ -100,17 +101,22 @@ export default {
|
||||
let response = await this.updateMailConfig(mailConfigData)
|
||||
if (response.data.success) {
|
||||
this.isLoading = false
|
||||
window.toastr['success'](
|
||||
this.$t('wizard.success.' + response.data.success)
|
||||
)
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$t('wizard.success.' + response.data.success),
|
||||
})
|
||||
} else {
|
||||
window.toastr['error'](
|
||||
this.$t('wizard.errors.' + response.data.error)
|
||||
)
|
||||
this.showNotification({
|
||||
type: 'error',
|
||||
message: this.$t('wizard.errors.' + response.data.error),
|
||||
})
|
||||
}
|
||||
return true
|
||||
} catch (e) {
|
||||
window.toastr['error']('Something went wrong')
|
||||
this.showNotification({
|
||||
type: 'error',
|
||||
message: 'Something went wrong',
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
|
||||
<sw-table-component
|
||||
ref="table"
|
||||
variant="gray"
|
||||
:show-filter="false"
|
||||
:data="fetchData"
|
||||
variant="gray"
|
||||
>
|
||||
<sw-table-column
|
||||
:label="$t('settings.customization.notes.name')"
|
||||
@@ -93,6 +93,8 @@ export default {
|
||||
|
||||
...mapActions('notes', ['fetchNotes', 'deleteNote']),
|
||||
|
||||
...mapActions('notification', ['showNotification']),
|
||||
|
||||
async fetchData({ page, filter, sort }) {
|
||||
let data = {
|
||||
orderByField: sort.fieldName || 'created_at',
|
||||
@@ -112,26 +114,31 @@ export default {
|
||||
}
|
||||
},
|
||||
removeNote(id) {
|
||||
swal({
|
||||
this.$swal({
|
||||
title: this.$t('general.are_you_sure'),
|
||||
text: this.$t('settings.customization.notes.note_confirm_delete'),
|
||||
icon: '/assets/icon/trash-solid.svg',
|
||||
buttons: true,
|
||||
dangerMode: true,
|
||||
}).then(async (value) => {
|
||||
if (value) {
|
||||
icon: 'error',
|
||||
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.deleteNote(id)
|
||||
|
||||
if (response.data.success) {
|
||||
window.toastr['success'](
|
||||
this.$t('settings.customization.notes.deleted_message')
|
||||
)
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$t('settings.customization.notes.deleted_message'),
|
||||
})
|
||||
this.$refs.table.refresh()
|
||||
return true
|
||||
}
|
||||
window.toastr['error'](
|
||||
this.$t('settings.customization.notes.already_in_use')
|
||||
)
|
||||
this.showNotification({
|
||||
type: 'error',
|
||||
message: this.$t('settings.customization.notes.already_in_use'),
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -133,6 +133,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
...mapActions('company', ['fetchCompanySettings', 'updateCompanySettings']),
|
||||
...mapActions('notification', ['showNotification']),
|
||||
|
||||
async fetchData() {
|
||||
this.isRequestOnGoing = true
|
||||
@@ -176,9 +177,10 @@ export default {
|
||||
if (response.data.success) {
|
||||
this.isLoading = false
|
||||
|
||||
window.toastr['success'](
|
||||
this.$tc('settings.notification.email_save_message')
|
||||
)
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$tc('settings.notification.email_save_message'),
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
@@ -199,7 +201,10 @@ export default {
|
||||
let response = await this.updateCompanySettings(data)
|
||||
|
||||
if (response.data.success) {
|
||||
window.toastr['success'](this.$tc('general.setting_updated'))
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$tc('general.setting_updated'),
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
@@ -220,7 +225,10 @@ export default {
|
||||
let response = await this.updateCompanySettings(data)
|
||||
|
||||
if (response.data) {
|
||||
window.toastr['success'](this.$tc('general.setting_updated'))
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$tc('general.setting_updated'),
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
|
||||
<sw-table-component
|
||||
ref="table"
|
||||
variant="gray"
|
||||
:show-filter="false"
|
||||
:data="fetchData"
|
||||
variant="gray"
|
||||
>
|
||||
<sw-table-column
|
||||
:label="$t('settings.customization.payments.mode_name')"
|
||||
@@ -79,6 +79,8 @@ export default {
|
||||
|
||||
...mapActions('payment', ['deletePaymentMode', 'fetchPaymentModes']),
|
||||
|
||||
...mapActions('notification', ['showNotification']),
|
||||
|
||||
async fetchData({ page, filter, sort }) {
|
||||
let data = {
|
||||
orderByField: sort.fieldName || 'created_at',
|
||||
@@ -117,29 +119,36 @@ export default {
|
||||
},
|
||||
|
||||
removePaymentMode(id) {
|
||||
swal({
|
||||
this.$swal({
|
||||
title: this.$t('general.are_you_sure'),
|
||||
text: this.$t(
|
||||
'settings.customization.payments.payment_mode_confirm_delete'
|
||||
),
|
||||
icon: '/assets/icon/trash-solid.svg',
|
||||
buttons: true,
|
||||
dangerMode: true,
|
||||
}).then(async (value) => {
|
||||
if (value) {
|
||||
icon: 'error',
|
||||
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.deletePaymentMode(id)
|
||||
|
||||
if (response.data.success) {
|
||||
window.toastr['success'](
|
||||
this.$t('settings.customization.payments.deleted_message')
|
||||
)
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$t(
|
||||
'settings.customization.payments.deleted_message'
|
||||
),
|
||||
})
|
||||
this.id = null
|
||||
this.$refs.table.refresh()
|
||||
return true
|
||||
}
|
||||
window.toastr['error'](
|
||||
this.$t('settings.customization.payments.already_in_use')
|
||||
)
|
||||
this.showNotification({
|
||||
type: 'error',
|
||||
message: this.$t('settings.customization.payments.already_in_use'),
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<form action="" @submit.prevent="updatePreferencesData" class="relative">
|
||||
<form action="" class="relative" @submit.prevent="updatePreferencesData">
|
||||
<base-loader v-if="isRequestOnGoing" :show-bg-overlay="true" />
|
||||
<sw-card variant="setting-card">
|
||||
<template slot="header">
|
||||
@@ -113,11 +113,11 @@
|
||||
</div>
|
||||
|
||||
<sw-button
|
||||
:disabled="isLoading"
|
||||
:loading="isLoading"
|
||||
class="mt-6"
|
||||
variant="primary"
|
||||
type="submit"
|
||||
:disabled="isLoading"
|
||||
:loading="isLoading"
|
||||
>
|
||||
<save-icon v-if="!isLoading" class="mr-2 -ml-1" />
|
||||
{{ $tc('settings.company_info.save') }}
|
||||
@@ -267,6 +267,8 @@ export default {
|
||||
'fetchTimeZones',
|
||||
]),
|
||||
|
||||
...mapActions('notification', ['showNotification']),
|
||||
|
||||
currencyNameWithCode({ name, code }) {
|
||||
return `${code} - ${name}`
|
||||
},
|
||||
@@ -340,12 +342,16 @@ export default {
|
||||
this.isLoading = false
|
||||
// window.i18n.locale = this.formData.language.code
|
||||
this.setDefaultCurrency(this.formData.currency)
|
||||
window.toastr['success'](
|
||||
this.$t('settings.preferences.updated_message')
|
||||
)
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$t('settings.preferences.updated_message'),
|
||||
})
|
||||
return true
|
||||
}
|
||||
window.toastr['error'](response.data.error)
|
||||
this.showNotification({
|
||||
type: 'error',
|
||||
message: response.data.error,
|
||||
})
|
||||
return true
|
||||
},
|
||||
|
||||
@@ -357,7 +363,10 @@ export default {
|
||||
}
|
||||
let response = await this.updateCompanySettings(data)
|
||||
if (response.data.success) {
|
||||
window.toastr['success'](this.$t('general.setting_updated'))
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$t('general.setting_updated'),
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -160,6 +160,8 @@ export default {
|
||||
]),
|
||||
...mapActions('company', ['fetchCompanySettings', 'updateCompanySettings']),
|
||||
|
||||
...mapActions('notification', ['showNotification']),
|
||||
|
||||
async fetchData({ page, filter, sort }) {
|
||||
let data = {
|
||||
orderByField: sort.fieldName || 'created_at',
|
||||
@@ -194,28 +196,38 @@ 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'),
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
async removeTax(id, index) {
|
||||
swal({
|
||||
this.$swal({
|
||||
title: this.$t('general.are_you_sure'),
|
||||
text: this.$t('settings.tax_types.confirm_delete'),
|
||||
icon: '/assets/icon/trash-solid.svg',
|
||||
buttons: true,
|
||||
dangerMode: true,
|
||||
}).then(async (value) => {
|
||||
if (value) {
|
||||
icon: 'error',
|
||||
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.deleteTaxType(id)
|
||||
if (response.data.success) {
|
||||
window.toastr['success'](
|
||||
this.$t('settings.tax_types.deleted_message')
|
||||
)
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$t('settings.tax_types.deleted_message'),
|
||||
})
|
||||
this.$refs.table.refresh()
|
||||
return true
|
||||
}
|
||||
window.toastr['error'](this.$t('settings.tax_types.already_in_use'))
|
||||
this.showNotification({
|
||||
type: 'error',
|
||||
message: this.$t('settings.tax_types.already_in_use'),
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -58,9 +58,9 @@
|
||||
</label>
|
||||
<table class="w-1/2 mt-2 border-2 border-gray-200 table-fixed">
|
||||
<tr
|
||||
class="p-2 border-2 border-gray-200"
|
||||
v-for="(ext, i) in requiredExtentions"
|
||||
:key="i"
|
||||
class="p-2 border-2 border-gray-200"
|
||||
>
|
||||
<td width="70%" class="p-2 text-sm truncate">
|
||||
{{ i }}
|
||||
@@ -106,8 +106,8 @@
|
||||
<!-- -->
|
||||
<ul v-if="isUpdating" class="w-full p-0 list-none">
|
||||
<li
|
||||
class="flex justify-between w-full py-3 border-b border-gray-200 border-solid last:border-b-0"
|
||||
v-for="step in updateSteps"
|
||||
class="flex justify-between w-full py-3 border-b border-gray-200 border-solid last:border-b-0"
|
||||
>
|
||||
<p class="m-0 text-sm leading-8">{{ $t(step.translationKey) }}</p>
|
||||
<div class="flex flex-row items-center">
|
||||
@@ -115,8 +115,8 @@
|
||||
{{ step.time }}
|
||||
</span>
|
||||
<span
|
||||
class="block py-1 text-sm text-center uppercase rounded-full"
|
||||
:class="statusClass(step)"
|
||||
class="block py-1 text-sm text-center uppercase rounded-full"
|
||||
style="width: 88px"
|
||||
>
|
||||
{{ getStatus(step) }}
|
||||
@@ -130,7 +130,7 @@
|
||||
|
||||
<script>
|
||||
import LoadingIcon from '../../components/icon/LoadingIcon'
|
||||
|
||||
import { mapActions } from 'vuex'
|
||||
export default {
|
||||
components: {
|
||||
LoadingIcon,
|
||||
@@ -228,6 +228,8 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
...mapActions('notification', ['showNotification']),
|
||||
|
||||
getStatus(step) {
|
||||
if (step.started && step.completed) {
|
||||
return 'finished'
|
||||
@@ -266,7 +268,11 @@ export default {
|
||||
this.isCheckingforUpdate = false
|
||||
|
||||
if (!response.data.version) {
|
||||
window.toastr['info'](this.$t('settings.update_app.latest_message'))
|
||||
this.showNotification({
|
||||
title: 'Info!',
|
||||
type: 'info',
|
||||
message: this.$t('settings.update_app.latest_message'),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -283,16 +289,21 @@ export default {
|
||||
} catch (e) {
|
||||
this.isUpdateAvailable = false
|
||||
this.isCheckingforUpdate = false
|
||||
window.toastr['error']('Something went wrong')
|
||||
this.showNotification({
|
||||
type: 'error',
|
||||
message: 'Something went wrong',
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
async onUpdateApp() {
|
||||
let path = null
|
||||
if (!this.allowToUpdate) {
|
||||
window.toastr['error'](
|
||||
'Your current configuration does not match the update requirements. Please try again after all the requirements are fulfilled. '
|
||||
)
|
||||
this.showNotification({
|
||||
type: 'error',
|
||||
message:
|
||||
'Your current configuration does not match the update requirements. Please try again after all the requirements are fulfilled.',
|
||||
})
|
||||
return true
|
||||
}
|
||||
for (let index = 0; index < this.updateSteps.length; index++) {
|
||||
@@ -321,9 +332,10 @@ export default {
|
||||
currentStep.translationKey == 'settings.update_app.finishing_update'
|
||||
) {
|
||||
this.isUpdating = false
|
||||
window.toastr['success'](
|
||||
this.$t('settings.update_app.update_success')
|
||||
)
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$t('settings.update_app.update_success'),
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
location.reload()
|
||||
@@ -332,7 +344,10 @@ export default {
|
||||
} catch (error) {
|
||||
currentStep.started = false
|
||||
currentStep.completed = true
|
||||
window.toastr['error'](this.$t('validation.something_went_wrong'))
|
||||
this.showNotification({
|
||||
type: 'error',
|
||||
message: this.$t('validation.something_went_wrong'),
|
||||
})
|
||||
this.onUpdateFailed(currentStep.translationKey)
|
||||
return false
|
||||
}
|
||||
@@ -341,7 +356,7 @@ export default {
|
||||
|
||||
onUpdateFailed(translationKey) {
|
||||
let stepName = this.$t(translationKey)
|
||||
swal({
|
||||
this.$swal({
|
||||
title: this.$t('settings.update_app.update_failed'),
|
||||
text: this.$tc('settings.update_app.update_failed_text', stepName, {
|
||||
step: stepName,
|
||||
|
||||
@@ -264,6 +264,8 @@ export default {
|
||||
|
||||
...mapActions(['fetchLanguages']),
|
||||
|
||||
...mapActions('notification', ['showNotification']),
|
||||
|
||||
onUploadHandler(cropper) {
|
||||
this.previewAvatar = cropper
|
||||
.getCroppedCanvas()
|
||||
@@ -271,7 +273,10 @@ export default {
|
||||
},
|
||||
|
||||
onHandleUploadError() {
|
||||
window.toastr['error']('Oops! Something went wrong...')
|
||||
this.showNotification({
|
||||
type: 'error',
|
||||
message: 'Oops! Something went wrong...',
|
||||
})
|
||||
},
|
||||
|
||||
onChange(file) {
|
||||
@@ -348,10 +353,10 @@ export default {
|
||||
|
||||
this.uploadAvatar(avatarData)
|
||||
}
|
||||
|
||||
window.toastr['success'](
|
||||
this.$t('settings.account_settings.updated_message')
|
||||
)
|
||||
this.showNotification({
|
||||
type: 'success',
|
||||
message: this.$t('settings.account_settings.updated_message'),
|
||||
})
|
||||
|
||||
this.formData.password = ''
|
||||
this.formData.confirm_password = ''
|
||||
|
||||
@@ -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