mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 11:41:09 -04:00
Fix an issue with due date + expiry date not setting correctly & mark as sent button issue
This commit is contained in:
@ -496,9 +496,11 @@ export const useEstimateStore = (useWindow = false) => {
|
||||
this.newEstimate.discount_per_item =
|
||||
companyStore.selectedCompanySettings.discount_per_item
|
||||
this.newEstimate.estimate_date = moment().format('YYYY-MM-DD')
|
||||
this.newEstimate.expiry_date = moment()
|
||||
.add(7, 'days')
|
||||
.format('YYYY-MM-DD')
|
||||
if (companyStore.selectedCompanySettings.estimate_set_expiry_date_automatically === 'YES') {
|
||||
this.newEstimate.expiry_date = moment()
|
||||
.add(companyStore.selectedCompanySettings.estimate_expiry_date_days, 'days')
|
||||
.format('YYYY-MM-DD')
|
||||
}
|
||||
} else {
|
||||
editActions = [this.fetchEstimate(route.params.id)]
|
||||
}
|
||||
|
||||
@ -449,9 +449,11 @@ export const useInvoiceStore = (useWindow = false) => {
|
||||
this.newInvoice.discount_per_item =
|
||||
companyStore.selectedCompanySettings.discount_per_item
|
||||
this.newInvoice.invoice_date = moment().format('YYYY-MM-DD')
|
||||
this.newInvoice.due_date = moment()
|
||||
.add(7, 'days')
|
||||
.format('YYYY-MM-DD')
|
||||
if (companyStore.selectedCompanySettings.invoice_set_due_date_automatically ==='YES') {
|
||||
this.newInvoice.due_date = moment()
|
||||
.add(companyStore.selectedCompanySettings.invoice_due_date_days, 'days')
|
||||
.format('YYYY-MM-DD')
|
||||
}
|
||||
} else {
|
||||
editActions = [this.fetchInvoice(route.params.id)]
|
||||
}
|
||||
|
||||
@ -195,7 +195,7 @@
|
||||
truncate
|
||||
"
|
||||
/>
|
||||
|
||||
|
||||
<div
|
||||
class="
|
||||
mt-1
|
||||
@ -461,6 +461,7 @@ async function onMarkAsSent() {
|
||||
estimateData.value.status = 'SENT'
|
||||
isMarkAsSent.value = true
|
||||
}
|
||||
isMarkAsSent.value = false
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -185,9 +185,6 @@ const rules = {
|
||||
estimate_date: {
|
||||
required: helpers.withMessage(t('validation.required'), required),
|
||||
},
|
||||
expiry_date: {
|
||||
required: helpers.withMessage(t('validation.required'), required),
|
||||
},
|
||||
estimate_number: {
|
||||
required: helpers.withMessage(t('validation.required'), required),
|
||||
},
|
||||
|
||||
@ -26,8 +26,6 @@
|
||||
<BaseInputGroup
|
||||
:label="$t('estimates.expiry_date')"
|
||||
:content-loading="isLoading"
|
||||
required
|
||||
:error="v.expiry_date.$error && v.expiry_date.$errors[0].$message"
|
||||
>
|
||||
<BaseDatePicker
|
||||
v-model="estimateStore.newEstimate.expiry_date"
|
||||
@ -82,6 +80,8 @@
|
||||
<script setup>
|
||||
import { useEstimateStore } from '@/scripts/stores/estimate'
|
||||
import ExchangeRateConverter from '@/scripts/components/estimate-invoice-common/ExchangeRateConverter.vue'
|
||||
import { useCompanyStore } from '@/scripts/stores/company'
|
||||
import { reactive, inject } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
v: {
|
||||
|
||||
@ -101,6 +101,7 @@ async function onMarkAsSent() {
|
||||
invoiceData.value.status = 'SENT'
|
||||
isMarkAsSent.value = true
|
||||
}
|
||||
isMarkAsSent.value = false
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -186,9 +186,6 @@ const rules = {
|
||||
invoice_date: {
|
||||
required: helpers.withMessage(t('validation.required'), required),
|
||||
},
|
||||
due_date: {
|
||||
required: helpers.withMessage(t('validation.required'), required),
|
||||
},
|
||||
reference_number: {
|
||||
maxLength: helpers.withMessage(
|
||||
t('validation.price_maxlength'),
|
||||
|
||||
@ -26,8 +26,6 @@
|
||||
<BaseInputGroup
|
||||
:label="$t('invoices.due_date')"
|
||||
:content-loading="isLoading"
|
||||
required
|
||||
:error="v.due_date.$error && v.due_date.$errors[0].$message"
|
||||
>
|
||||
<BaseDatePicker
|
||||
v-model="invoiceStore.newInvoice.due_date"
|
||||
|
||||
Reference in New Issue
Block a user