mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-28 20:21:10 -04:00
Merge branch 'master' of gitlab.com:mohit.panjvani/crater-web into fix_all_customer_load
This commit is contained in:
@ -13,6 +13,7 @@ import { handleError } from '@/scripts/helpers/error-handling'
|
||||
import estimateStub from '../stub/estimate'
|
||||
import estimateItemStub from '../stub/estimate-item'
|
||||
import taxStub from '../stub/tax'
|
||||
import { useUserStore } from './user'
|
||||
|
||||
export const useEstimateStore = (useWindow = false) => {
|
||||
const defineStoreFunc = useWindow ? window.pinia.defineStore : defineStore
|
||||
@ -497,6 +498,7 @@ export const useEstimateStore = (useWindow = false) => {
|
||||
const itemStore = useItemStore()
|
||||
const taxTypeStore = useTaxTypeStore()
|
||||
const route = useRoute()
|
||||
const userStore = useUserStore()
|
||||
|
||||
this.isFetchingInitialSettings = true
|
||||
this.newEstimate.selectedCurrency = companyStore.selectedCompanyCurrency
|
||||
@ -546,6 +548,9 @@ export const useEstimateStore = (useWindow = false) => {
|
||||
}
|
||||
|
||||
this.setTemplate(this.templates[0].name)
|
||||
this.newEstimate.template_name =
|
||||
userStore.currentUserSettings.default_estimate_template ?
|
||||
userStore.currentUserSettings.default_estimate_template : this.newEstimate.template_name
|
||||
}
|
||||
|
||||
if (isEdit) {
|
||||
|
||||
@ -61,15 +61,15 @@ export const useExpenseStore = (useWindow = false) => {
|
||||
Object.assign(this.currentExpense, response.data.data)
|
||||
this.currentExpense.selectedCurrency =
|
||||
response.data.data.currency
|
||||
|
||||
if (response.data.data.attachment_receipt) {
|
||||
this.currentExpense.attachment_receipt = null
|
||||
if (response.data.data.attachment_receipt_url) {
|
||||
if (
|
||||
utils.isImageFile(
|
||||
response.data.data.attachment_receipt_meta.mime_type
|
||||
)
|
||||
) {
|
||||
this.currentExpense.receiptFiles = [
|
||||
{ image: `/expenses/${id}/receipt` },
|
||||
{ image: `/reports/expenses/${id}/receipt?${response.data.data.attachment_receipt_meta.uuid}` },
|
||||
]
|
||||
} else {
|
||||
this.currentExpense.receiptFiles = [
|
||||
@ -118,12 +118,13 @@ export const useExpenseStore = (useWindow = false) => {
|
||||
})
|
||||
},
|
||||
|
||||
updateExpense({ id, data }) {
|
||||
updateExpense({ id, data, isAttachmentReceiptRemoved }) {
|
||||
const notificationStore = useNotificationStore()
|
||||
|
||||
const formData = utils.toFormData(data)
|
||||
|
||||
formData.append('_method', 'PUT')
|
||||
formData.append('is_attachment_receipt_removed', isAttachmentReceiptRemoved)
|
||||
|
||||
return new Promise((resolve) => {
|
||||
axios.post(`/api/v1/expenses/${id}`, formData).then((response) => {
|
||||
|
||||
@ -14,6 +14,7 @@ import { useCustomerStore } from './customer'
|
||||
import { useTaxTypeStore } from './tax-type'
|
||||
import { useCompanyStore } from './company'
|
||||
import { useItemStore } from './item'
|
||||
import { useUserStore } from './user'
|
||||
|
||||
export const useInvoiceStore = (useWindow = false) => {
|
||||
const defineStoreFunc = useWindow ? window.pinia.defineStore : defineStore
|
||||
@ -445,6 +446,7 @@ export const useInvoiceStore = (useWindow = false) => {
|
||||
const itemStore = useItemStore()
|
||||
const taxTypeStore = useTaxTypeStore()
|
||||
const route = useRoute()
|
||||
const userStore = useUserStore()
|
||||
|
||||
this.isFetchingInitialSettings = true
|
||||
|
||||
@ -495,6 +497,9 @@ export const useInvoiceStore = (useWindow = false) => {
|
||||
|
||||
if (res3.data) {
|
||||
this.setTemplate(this.templates[0].name)
|
||||
this.newInvoice.template_name =
|
||||
userStore.currentUserSettings.default_invoice_template ?
|
||||
userStore.currentUserSettings.default_invoice_template : this.newInvoice.template_name
|
||||
}
|
||||
}
|
||||
if (isEdit) {
|
||||
|
||||
@ -108,6 +108,14 @@ export const useUserStore = (useWindow = false) => {
|
||||
this.currentUserSettings.language = data.settings.language
|
||||
global.locale = data.settings.language
|
||||
}
|
||||
if (data.settings.default_estimate_template) {
|
||||
this.currentUserSettings.default_estimate_template =
|
||||
data.settings.default_estimate_template
|
||||
}
|
||||
if (data.settings.default_invoice_template) {
|
||||
this.currentUserSettings.default_invoice_template =
|
||||
data.settings.default_invoice_template
|
||||
}
|
||||
resolve(response)
|
||||
})
|
||||
.catch((err) => {
|
||||
|
||||
Reference in New Issue
Block a user