mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-28 12:11:08 -04:00
fix estimate status in view page
This commit is contained in:
@ -101,7 +101,7 @@ export const deleteMultipleEstimates = ({ commit, dispatch, state }, id) => {
|
|||||||
export const updateEstimate = ({ commit, dispatch, state }, data) => {
|
export const updateEstimate = ({ commit, dispatch, state }, data) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
window.axios.put(`/api/estimates/${data.id}`, data).then((response) => {
|
window.axios.put(`/api/estimates/${data.id}`, data).then((response) => {
|
||||||
commit(types.UPDATE_ESTIMATE_STATUS, response.data)
|
commit(types.UPDATE_ESTIMATE, response.data)
|
||||||
resolve(response)
|
resolve(response)
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
reject(err)
|
reject(err)
|
||||||
@ -132,7 +132,7 @@ export const markAsRejected = ({ commit, dispatch, state }, data) => {
|
|||||||
export const markAsSent = ({ commit, dispatch, state }, data) => {
|
export const markAsSent = ({ commit, dispatch, state }, data) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
window.axios.post(`/api/estimates/mark-as-sent`, data).then((response) => {
|
window.axios.post(`/api/estimates/mark-as-sent`, data).then((response) => {
|
||||||
// commit(types.UPDATE_INVOICE, response.data)
|
commit(types.UPDATE_ESTIMATE_STATUS, {id: data.id, status: 'SENT'})
|
||||||
resolve(response)
|
resolve(response)
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
reject(err)
|
reject(err)
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
</v-dropdown>
|
</v-dropdown>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="estimate-si debar">
|
<div class="estimate-sidebar">
|
||||||
<base-loader v-if="isSearching" />
|
<base-loader v-if="isSearching" />
|
||||||
<div v-else class="side-header">
|
<div v-else class="side-header">
|
||||||
<base-input
|
<base-input
|
||||||
@ -141,8 +141,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
// import { mapActions } from 'vuex'
|
import { mapActions } from 'vuex'
|
||||||
import { mapActions, mapGetters } from 'vuex'
|
|
||||||
|
|
||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
export default {
|
export default {
|
||||||
@ -151,9 +150,7 @@ export default {
|
|||||||
id: null,
|
id: null,
|
||||||
count: null,
|
count: null,
|
||||||
estimates: [],
|
estimates: [],
|
||||||
// estimate: null,
|
|
||||||
currency: null,
|
currency: null,
|
||||||
// shareableLink: null,
|
|
||||||
searchData: {
|
searchData: {
|
||||||
orderBy: null,
|
orderBy: null,
|
||||||
orderByField: null,
|
orderByField: null,
|
||||||
@ -176,14 +173,10 @@ export default {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
shareableLink () {
|
shareableLink () {
|
||||||
return `/estimates/pdf/${this.estimate.unique_hash}`
|
return `/estimates/pdf/${this.estimate.unique_hash}`
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
'$route.params.id' (val) {
|
|
||||||
this.fetchEstimate()
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
@ -205,7 +198,6 @@ export default {
|
|||||||
if (response.data) {
|
if (response.data) {
|
||||||
this.estimates = response.data.estimates.data
|
this.estimates = response.data.estimates.data
|
||||||
}
|
}
|
||||||
this.fetchEstimate()
|
|
||||||
},
|
},
|
||||||
async onSearched () {
|
async onSearched () {
|
||||||
let data = ''
|
let data = ''
|
||||||
@ -227,15 +219,6 @@ export default {
|
|||||||
this.estimates = response.data.estimates.data
|
this.estimates = response.data.estimates.data
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// async fetchEstimate () {
|
|
||||||
// let estimate = await this.fetchViewEstimate(this.$route.params.id)
|
|
||||||
|
|
||||||
// if (estimate.data) {
|
|
||||||
// this.estimate = estimate.data.estimate
|
|
||||||
// this.shareableLink = estimate.data.shareable_link
|
|
||||||
// this.currency = estimate.data.estimate.user.currency
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
sortData () {
|
sortData () {
|
||||||
if (this.searchData.orderBy === 'asc') {
|
if (this.searchData.orderBy === 'asc') {
|
||||||
this.searchData.orderBy = 'desc'
|
this.searchData.orderBy = 'desc'
|
||||||
|
|||||||
Reference in New Issue
Block a user