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:
@ -21,7 +21,7 @@
|
||||
|
||||
<template #actions>
|
||||
<BaseButton
|
||||
v-if="isEdit && expenseStore.currentExpense.attachment_receipt"
|
||||
v-if="isEdit && expenseStore.currentExpense.attachment_receipt_url"
|
||||
:href="receiptDownloadUrl"
|
||||
tag="a"
|
||||
variant="primary-outline"
|
||||
@ -319,6 +319,7 @@ const globalStore = useGlobalStore()
|
||||
let isSaving = ref(false)
|
||||
let isFetchingInitialData = ref(false)
|
||||
const expenseValidationScope = 'newExpense'
|
||||
const isAttachmentReceiptRemoved = ref(false)
|
||||
|
||||
const rules = computed(() => {
|
||||
return {
|
||||
@ -383,7 +384,7 @@ const pageTitle = computed(() =>
|
||||
)
|
||||
|
||||
const receiptDownloadUrl = computed(() =>
|
||||
isEdit.value ? `/expenses/${route.params.id}/download-receipt` : ''
|
||||
isEdit.value ? `/reports/expenses/${route.params.id}/download-receipt` : ''
|
||||
)
|
||||
|
||||
expenseStore.resetCurrentExpenseData()
|
||||
@ -397,6 +398,7 @@ function onFileInputChange(fileName, file) {
|
||||
|
||||
function onFileInputRemove() {
|
||||
expenseStore.currentExpense.attachment_receipt = null
|
||||
isAttachmentReceiptRemoved.value = true
|
||||
}
|
||||
|
||||
function openCategoryModal() {
|
||||
@ -487,11 +489,14 @@ async function submitForm() {
|
||||
await expenseStore.updateExpense({
|
||||
id: route.params.id,
|
||||
data: formData,
|
||||
isAttachmentReceiptRemoved: isAttachmentReceiptRemoved.value
|
||||
})
|
||||
} else {
|
||||
await expenseStore.addExpense(formData)
|
||||
}
|
||||
isSaving.value = false
|
||||
expenseStore.currentExpense.attachment_receipt = null
|
||||
isAttachmentReceiptRemoved.value = false
|
||||
router.push('/admin/expenses')
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
|
||||
Reference in New Issue
Block a user