mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-28 12:11:08 -04:00
Merge branch 'dashboard-refactor' into 'master'
add separate actions for dashboard tables See merge request mohit.panjvani/crater-web!45
This commit is contained in:
10
.env.example
10
.env.example
@ -21,11 +21,11 @@ REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_DRIVER=smtp
|
||||
MAIL_HOST=mailtrap.io
|
||||
MAIL_PORT=2525
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_ENCRYPTION=null
|
||||
MAIL_HOST=
|
||||
MAIL_PORT=
|
||||
MAIL_USERNAME=
|
||||
MAIL_PASSWORD=
|
||||
MAIL_ENCRYPTION=
|
||||
|
||||
PUSHER_APP_ID=
|
||||
PUSHER_KEY=
|
||||
|
||||
18776
public/assets/css/laraspace.css
vendored
18776
public/assets/css/laraspace.css
vendored
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
13
public/assets/icon/file-alt-solid.svg
Normal file
13
public/assets/icon/file-alt-solid.svg
Normal file
@ -0,0 +1,13 @@
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
focusable="false"
|
||||
data-prefix="fas"
|
||||
data-icon="file-alt"
|
||||
class="svg-inline--fa fa-file-alt fa-w-12"
|
||||
role="img" xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 384 512">
|
||||
<path
|
||||
fill="#55547A"
|
||||
d="M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm64 236c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12v8zm0-64c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12v8zm0-72v8c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12zm96-114.1v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z">
|
||||
</path>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 764 B |
182228
public/assets/js/app.js
182228
public/assets/js/app.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,6 +0,0 @@
|
||||
{
|
||||
"/assets/js/app.js": "/assets/js/app.js",
|
||||
"/assets/css/laraspace.css": "/assets/css/laraspace.css",
|
||||
"/assets/js/app.js.map": "/assets/js/app.js.map",
|
||||
"/assets/css/laraspace.css.map": "/assets/css/laraspace.css.map"
|
||||
}
|
||||
@ -260,6 +260,8 @@ export default {
|
||||
created_message: 'Estimate created successfully',
|
||||
updated_message: 'Estimate updated successfully',
|
||||
deleted_message: 'Estimate deleted successfully | Estimates deleted successfully',
|
||||
user_email_does_not_exist: 'User email does not exist',
|
||||
something_went_wrong: 'something went wrong',
|
||||
item: {
|
||||
title: 'Item Title',
|
||||
description: 'Description',
|
||||
@ -349,6 +351,8 @@ export default {
|
||||
updated_message: 'Invoice updated successfully',
|
||||
deleted_message: 'Invoice deleted successfully | Invoices deleted successfully',
|
||||
marked_as_sent_message: 'Invoice marked as sent successfully',
|
||||
user_email_does_not_exist: 'User email does not exist',
|
||||
something_went_wrong: 'something went wrong',
|
||||
invalid_due_amount_message: 'Total Invoice amount cannot be less than total paid amount for this Invoice. Please update the invoice or delete the associated payments to continue.'
|
||||
},
|
||||
credit_notes: {
|
||||
|
||||
@ -23,108 +23,3 @@ export const getChart = ({ commit, dispatch, state }) => {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const sendEmail = ({ commit, dispatch, state }, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.post(`/api/invoices/send`, data).then((response) => {
|
||||
commit(types.UPDATE_INVOICE_STATUS, { id: data.id, status: 'SENT' })
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export const markAsSent = ({ commit, dispatch, state }, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.post(`/api/invoices/mark-as-sent`, data).then((response) => {
|
||||
commit(types.UPDATE_INVOICE_STATUS, { id: data.id, status: 'SENT' })
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const deleteInvoice = ({ commit, dispatch, state }, id) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.delete(`/api/invoices/${id}`).then((response) => {
|
||||
if (response.data.error) {
|
||||
resolve(response)
|
||||
} else {
|
||||
commit(types.DELETE_INVOICE, id)
|
||||
resolve(response)
|
||||
}
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export const sendEstimateEmail = ({ commit, dispatch, state }, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.post(`/api/estimates/send`, data).then((response) => {
|
||||
commit(types.UPDATE_ESTIMATE_STATUS, { id: data.id, status: 'SENT' })
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const markAsAccepted = ({ commit, dispatch, state }, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.post(`/api/estimates/accept`, data).then((response) => {
|
||||
commit(types.UPDATE_ESTIMATE_STATUS, { id: data.id, status: 'ACCEPTED' })
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const markAsRejected = ({ commit, dispatch, state }, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.post(`/api/estimates/reject`, data).then((response) => {
|
||||
commit(types.UPDATE_ESTIMATE_STATUS, { id: data.id, status: 'REJECTED' })
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const markEstimateAsSent = ({ commit, dispatch, state }, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.post(`/api/estimates/mark-as-sent`, data).then((response) => {
|
||||
commit(types.UPDATE_ESTIMATE_STATUS, { id: data.id, status: 'SENT' })
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const convertToInvoice = ({ commit, dispatch, state }, id) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.post(`/api/estimates/${id}/convert-to-invoice`).then((response) => {
|
||||
// commit(types.UPDATE_INVOICE, response.data)
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const deleteEstimate = ({ commit, dispatch, state }, id) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.delete(`/api/estimates/${id}`).then((response) => {
|
||||
commit(types.DELETE_ESTIMATE, id)
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
import * as types from './mutation-types'
|
||||
|
||||
export default {
|
||||
[types.SET_INITIAL_DATA](state, data) {
|
||||
[types.SET_INITIAL_DATA] (state, data) {
|
||||
state.contacts = data.customersCount
|
||||
state.invoices = data.invoicesCount
|
||||
state.estimates = data.estimatesCount
|
||||
@ -30,29 +30,33 @@ export default {
|
||||
state.netProfit = data.netProfit
|
||||
},
|
||||
|
||||
[types.GET_INITIAL_DATA](state, data) {
|
||||
[types.GET_INITIAL_DATA] (state, data) {
|
||||
state.isDataLoaded = data
|
||||
},
|
||||
|
||||
[types.UPDATE_INVOICE_STATUS](state, data) {
|
||||
[types.UPDATE_INVOICE_STATUS] (state, data) {
|
||||
let pos = state.dueInvoices.findIndex(invoice => invoice.id === data.id)
|
||||
|
||||
state.dueInvoices[pos].status = data.status
|
||||
if (state.dueInvoices[pos]) {
|
||||
state.dueInvoices[pos].status = data.status
|
||||
}
|
||||
},
|
||||
|
||||
[types.DELETE_INVOICE](state, id) {
|
||||
[types.DELETE_INVOICE] (state, id) {
|
||||
let index = state.dueInvoices.findIndex(invoice => invoice.id === id)
|
||||
state.dueInvoices.splice(index, 1)
|
||||
},
|
||||
|
||||
[types.DELETE_ESTIMATE](state, id) {
|
||||
[types.DELETE_ESTIMATE] (state, id) {
|
||||
let index = state.recentEstimates.findIndex(estimate => estimate.id === id)
|
||||
state.recentEstimates.splice(index, 1)
|
||||
},
|
||||
|
||||
[types.UPDATE_ESTIMATE_STATUS](state, data) {
|
||||
[types.UPDATE_ESTIMATE_STATUS] (state, data) {
|
||||
let pos = state.recentEstimates.findIndex(estimate => estimate.id === data.id)
|
||||
|
||||
state.recentEstimates[pos].status = data.status
|
||||
},
|
||||
if (state.recentEstimates[pos]) {
|
||||
state.recentEstimates[pos].status = data.status
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import * as types from './mutation-types'
|
||||
import * as dashboardTypes from '../dashboard/mutation-types'
|
||||
|
||||
export const fetchEstimates = ({ commit, dispatch, state }, params) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -56,7 +57,10 @@ export const fetchViewEstimate = ({ commit, dispatch, state }, id) => {
|
||||
export const sendEmail = ({ commit, dispatch, state }, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.post(`/api/estimates/send`, data).then((response) => {
|
||||
commit(types.UPDATE_ESTIMATE_STATUS, {id: data.id, status: 'SENT'})
|
||||
if (response.data.success) {
|
||||
commit(types.UPDATE_ESTIMATE_STATUS, {id: data.id, status: 'SENT'})
|
||||
commit('dashboard/' + dashboardTypes.UPDATE_ESTIMATE_STATUS, { id: data.id, status: 'SENT' }, { root: true })
|
||||
}
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
@ -80,6 +84,7 @@ export const deleteEstimate = ({ commit, dispatch, state }, id) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.delete(`/api/estimates/${id}`).then((response) => {
|
||||
commit(types.DELETE_ESTIMATE, id)
|
||||
commit('dashboard/' + dashboardTypes.DELETE_ESTIMATE, id, { root: true })
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
@ -112,6 +117,7 @@ export const updateEstimate = ({ commit, dispatch, state }, data) => {
|
||||
export const markAsAccepted = ({ commit, dispatch, state }, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.post(`/api/estimates/accept`, data).then((response) => {
|
||||
commit('dashboard/' + dashboardTypes.UPDATE_ESTIMATE_STATUS, { id: data.id, status: 'ACCEPTED' }, { root: true })
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
@ -122,6 +128,7 @@ export const markAsAccepted = ({ commit, dispatch, state }, data) => {
|
||||
export const markAsRejected = ({ commit, dispatch, state }, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.post(`/api/estimates/reject`, data).then((response) => {
|
||||
commit('dashboard/' + dashboardTypes.UPDATE_ESTIMATE_STATUS, { id: data.id, status: 'REJECTED' }, { root: true })
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
@ -133,6 +140,7 @@ export const markAsSent = ({ commit, dispatch, state }, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.post(`/api/estimates/mark-as-sent`, data).then((response) => {
|
||||
commit(types.UPDATE_ESTIMATE_STATUS, {id: data.id, status: 'SENT'})
|
||||
commit('dashboard/' + dashboardTypes.UPDATE_ESTIMATE_STATUS, { id: data.id, status: 'SENT' }, { root: true })
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
|
||||
@ -40,7 +40,9 @@ export default {
|
||||
[types.UPDATE_ESTIMATE_STATUS] (state, data) {
|
||||
let pos = state.estimates.findIndex(estimate => estimate.id === data.id)
|
||||
|
||||
state.estimates[pos].status = data.status
|
||||
if (state.estimates[pos]) {
|
||||
state.estimates[pos].status = data.status
|
||||
}
|
||||
},
|
||||
|
||||
[types.RESET_SELECTED_ESTIMATES] (state, data) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import * as types from './mutation-types'
|
||||
// import moment from 'moment'
|
||||
import * as dashboardTypes from '../dashboard/mutation-types'
|
||||
|
||||
export const fetchInvoices = ({ commit, dispatch, state }, params) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -47,7 +47,10 @@ export const fetchViewInvoice = ({ commit, dispatch, state }, id) => {
|
||||
export const sendEmail = ({ commit, dispatch, state }, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.post(`/api/invoices/send`, data).then((response) => {
|
||||
commit(types.UPDATE_INVOICE_STATUS, {id: data.id, status: 'SENT'})
|
||||
if (response.data.success) {
|
||||
commit(types.UPDATE_INVOICE_STATUS, {id: data.id, status: 'SENT'})
|
||||
commit('dashboard/' + dashboardTypes.UPDATE_INVOICE_STATUS, {id: data.id, status: 'SENT'}, { root: true })
|
||||
}
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
@ -83,6 +86,7 @@ export const deleteInvoice = ({ commit, dispatch, state }, id) => {
|
||||
resolve(response)
|
||||
} else {
|
||||
commit(types.DELETE_INVOICE, id)
|
||||
commit('dashboard/' + dashboardTypes.DELETE_INVOICE, id, { root: true })
|
||||
resolve(response)
|
||||
}
|
||||
}).catch((err) => {
|
||||
@ -123,6 +127,7 @@ export const markAsSent = ({ commit, dispatch, state }, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.post(`/api/invoices/mark-as-sent`, data).then((response) => {
|
||||
commit(types.UPDATE_INVOICE_STATUS, {id: data.id, status: 'SENT'})
|
||||
commit('dashboard/' + dashboardTypes.UPDATE_INVOICE_STATUS, {id: data.id, status: 'SENT'}, { root: true })
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
|
||||
@ -31,7 +31,9 @@ export default {
|
||||
[types.UPDATE_INVOICE_STATUS] (state, data) {
|
||||
let pos = state.invoices.findIndex(invoice => invoice.id === data.id)
|
||||
|
||||
state.invoices[pos].status = data.status
|
||||
if (state.invoices[pos]) {
|
||||
state.invoices[pos].status = data.status
|
||||
}
|
||||
},
|
||||
|
||||
[types.RESET_SELECTED_INVOICES] (state, data) {
|
||||
|
||||
@ -168,12 +168,12 @@
|
||||
>
|
||||
<table-column :label="$t('dashboard.recent_invoices_card.due_on')" show="formattedDueDate" />
|
||||
<table-column :label="$t('dashboard.recent_invoices_card.customer')" show="user.name" />
|
||||
<table-column
|
||||
<table-column
|
||||
:label="$t('invoices.status')"
|
||||
sort-as="status"
|
||||
>
|
||||
<template slot-scope="row" >
|
||||
<span> {{ $t('invoices.status') }}</span>
|
||||
<span> {{ $t('invoices.status') }}</span>
|
||||
<span :class="'inv-status-'+row.status.toLowerCase()">{{ (row.status != 'PARTIALLY_PAID')? row.status : row.status.replace('_', ' ') }}</span>
|
||||
</template>
|
||||
</table-column>
|
||||
@ -190,7 +190,7 @@
|
||||
>
|
||||
<template slot-scope="row">
|
||||
<v-dropdown>
|
||||
<a slot="activator" href="#">
|
||||
<a slot="activator" href="#/">
|
||||
<dot-icon />
|
||||
</a>
|
||||
<v-dropdown-item>
|
||||
@ -203,14 +203,14 @@
|
||||
{{ $t('invoices.view') }}
|
||||
</router-link>
|
||||
</v-dropdown-item>
|
||||
<v-dropdown-item>
|
||||
<a class="dropdown-item" href="#" @click="sendInvoice(row.id)" >
|
||||
<v-dropdown-item v-if="row.status == 'DRAFT'">
|
||||
<a class="dropdown-item" href="#/" @click="sendInvoice(row.id)" >
|
||||
<font-awesome-icon icon="envelope" class="dropdown-item-icon" />
|
||||
{{ $t('invoices.send_invoice') }}
|
||||
</a>
|
||||
</v-dropdown-item>
|
||||
<v-dropdown-item v-if="row.status === 'DRAFT'">
|
||||
<a class="dropdown-item" href="#" @click="sentInvoice(row.id)">
|
||||
<a class="dropdown-item" href="#/" @click="sentInvoice(row.id)">
|
||||
<font-awesome-icon icon="check-circle" class="dropdown-item-icon" />
|
||||
{{ $t('invoices.mark_as_sent') }}
|
||||
</a>
|
||||
@ -272,7 +272,7 @@
|
||||
>
|
||||
<template slot-scope="row">
|
||||
<v-dropdown>
|
||||
<a slot="activator" href="#">
|
||||
<a slot="activator" href="#/">
|
||||
<dot-icon />
|
||||
</a>
|
||||
<v-dropdown-item>
|
||||
@ -294,35 +294,35 @@
|
||||
</router-link>
|
||||
</v-dropdown-item>
|
||||
<v-dropdown-item>
|
||||
<a class="dropdown-item" href="#" @click="convertInToinvoice(row.id)">
|
||||
<font-awesome-icon icon="envelope" class="dropdown-item-icon" />
|
||||
<a class="dropdown-item" href="#/" @click="convertInToinvoice(row.id)">
|
||||
<font-awesome-icon icon="file-alt" class="dropdown-item-icon" />
|
||||
{{ $t('estimates.convert_to_invoice') }}
|
||||
</a>
|
||||
</v-dropdown-item>
|
||||
<v-dropdown-item v-if="row.status === 'DRAFT'">
|
||||
<a class="dropdown-item" href="#" @click.self="onMarkAsSent(row.id)">
|
||||
<a class="dropdown-item" href="#/" @click.self="onMarkAsSent(row.id)">
|
||||
<font-awesome-icon icon="check-circle" class="dropdown-item-icon" />
|
||||
{{ $t('estimates.mark_as_sent') }}
|
||||
</a>
|
||||
</v-dropdown-item>
|
||||
<v-dropdown-item v-if="row.status !== 'SENT'">
|
||||
<a class="dropdown-item" href="#" @click.self="sendEstimate(row.id)">
|
||||
<a class="dropdown-item" href="#/" @click.self="sendEstimate(row.id)">
|
||||
<font-awesome-icon icon="paper-plane" class="dropdown-item-icon" />
|
||||
{{ $t('estimates.send_estimate') }}
|
||||
</a>
|
||||
</v-dropdown-item>
|
||||
<v-dropdown-item v-if="row.status !== 'ACCEPTED'">
|
||||
<a class="dropdown-item" href="#" @click.self="onMarkAsAccepted(row.id)">
|
||||
<a class="dropdown-item" href="#/" @click.self="onMarkAsAccepted(row.id)">
|
||||
<font-awesome-icon icon="check-circle" class="dropdown-item-icon" />
|
||||
{{ $t('estimates.mark_as_accepted') }}
|
||||
</a>
|
||||
</v-dropdown-item>
|
||||
<v-dropdown-item v-if="row.status !== 'REJECTED'">
|
||||
<a class="dropdown-item" href="#" @click.self="onMarkAsRejected(row.id)">
|
||||
<font-awesome-icon icon="times-circle" class="dropdown-item-icon" />
|
||||
{{ $t('estimates.mark_as_rejected') }}
|
||||
</a>
|
||||
</v-dropdown-item>
|
||||
<v-dropdown-item v-if="row.status !== 'REJECTED'">
|
||||
<a class="dropdown-item" href="#/" @click.self="onMarkAsRejected(row.id)">
|
||||
<font-awesome-icon icon="times-circle" class="dropdown-item-icon" />
|
||||
{{ $t('estimates.mark_as_rejected') }}
|
||||
</a>
|
||||
</v-dropdown-item>
|
||||
</v-dropdown>
|
||||
</template>
|
||||
</table-column>
|
||||
@ -404,17 +404,23 @@ export default {
|
||||
methods: {
|
||||
...mapActions('dashboard', [
|
||||
'getChart',
|
||||
'loadData',
|
||||
'loadData'
|
||||
]),
|
||||
...mapActions('invoice', [
|
||||
'deleteInvoice',
|
||||
'sendEmail',
|
||||
'markAsSent',
|
||||
'sendEstimateEmail',
|
||||
'markAsSent'
|
||||
]),
|
||||
...mapActions('estimate', [
|
||||
'deleteEstimate',
|
||||
'markAsAccepted',
|
||||
'markAsRejected',
|
||||
'markEstimateAsSent',
|
||||
'convertToInvoice'
|
||||
]),
|
||||
...mapActions('estimate', {
|
||||
'sendEstimateEmail': 'sendEmail',
|
||||
'markEstimateAsSent': 'markAsSent'
|
||||
}),
|
||||
|
||||
async loadChart () {
|
||||
await this.$store.dispatch('dashboard/getChart')
|
||||
@ -459,7 +465,7 @@ export default {
|
||||
swal({
|
||||
title: this.$t('general.are_you_sure'),
|
||||
text: this.$t('estimates.confirm_conversion'),
|
||||
icon: '/assets/icon/envelope-solid.svg',
|
||||
icon: '/assets/icon/file-alt-solid.svg',
|
||||
buttons: true,
|
||||
dangerMode: true
|
||||
}).then(async (willDelete) => {
|
||||
@ -532,9 +538,15 @@ export default {
|
||||
}
|
||||
let response = await this.sendEmail(data)
|
||||
this.refreshInvTable()
|
||||
if (response.data) {
|
||||
if (response.data.success) {
|
||||
window.toastr['success'](this.$tc('invoices.send_invoice_successfully'))
|
||||
return true
|
||||
}
|
||||
if (response.data.error === 'user_email_does_not_exist') {
|
||||
window.toastr['error'](this.$tc('invoices.user_email_does_not_exist'))
|
||||
return false
|
||||
}
|
||||
window.toastr['error'](this.$tc('invoices.something_went_wrong'))
|
||||
}
|
||||
})
|
||||
},
|
||||
@ -603,7 +615,7 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
async sendEstimate (id) {
|
||||
swal({
|
||||
title: this.$t('general.are_you_sure'),
|
||||
@ -618,9 +630,15 @@ export default {
|
||||
}
|
||||
let response = await this.sendEstimateEmail(data)
|
||||
this.refreshEstTable()
|
||||
if (response.data) {
|
||||
if (response.data.success) {
|
||||
window.toastr['success'](this.$tc('estimates.send_estimate_successfully'))
|
||||
return true
|
||||
}
|
||||
if (response.data.error === 'user_email_does_not_exist') {
|
||||
window.toastr['success'](this.$tc('estimates.user_email_does_not_exist'))
|
||||
return true
|
||||
}
|
||||
window.toastr['error'](this.$tc('estimates.something_went_wrong'))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -245,31 +245,31 @@
|
||||
</router-link>
|
||||
</v-dropdown-item>
|
||||
<v-dropdown-item>
|
||||
<a class="dropdown-item" href="#" @click="convertInToinvoice(row.id)">
|
||||
<font-awesome-icon icon="envelope" class="dropdown-item-icon" />
|
||||
<a class="dropdown-item" href="#/" @click="convertInToinvoice(row.id)">
|
||||
<font-awesome-icon icon="file-alt" class="dropdown-item-icon" />
|
||||
{{ $t('estimates.convert_to_invoice') }}
|
||||
</a>
|
||||
</v-dropdown-item>
|
||||
<v-dropdown-item v-if="row.status !== 'SENT'">
|
||||
<a class="dropdown-item" href="#" @click.self="onMarkAsSent(row.id)">
|
||||
<a class="dropdown-item" href="#/" @click.self="onMarkAsSent(row.id)">
|
||||
<font-awesome-icon icon="check-circle" class="dropdown-item-icon" />
|
||||
{{ $t('estimates.mark_as_sent') }}
|
||||
</a>
|
||||
</v-dropdown-item>
|
||||
<v-dropdown-item v-if="row.status !== 'SENT'">
|
||||
<a class="dropdown-item" href="#" @click.self="sendEstimate(row.id)">
|
||||
<a class="dropdown-item" href="#/" @click.self="sendEstimate(row.id)">
|
||||
<font-awesome-icon icon="paper-plane" class="dropdown-item-icon" />
|
||||
{{ $t('estimates.send_estimate') }}
|
||||
</a>
|
||||
</v-dropdown-item>
|
||||
<v-dropdown-item v-if="row.status !== 'ACCEPTED'">
|
||||
<a class="dropdown-item" href="#" @click.self="onMarkAsAccepted(row.id)">
|
||||
<a class="dropdown-item" href="#/" @click.self="onMarkAsAccepted(row.id)">
|
||||
<font-awesome-icon icon="check-circle" class="dropdown-item-icon" />
|
||||
{{ $t('estimates.mark_as_accepted') }}
|
||||
</a>
|
||||
</v-dropdown-item>
|
||||
<v-dropdown-item v-if="row.status !== 'REJECTED'">
|
||||
<a class="dropdown-item" href="#" @click.self="onMarkAsRejected(row.id)">
|
||||
<a class="dropdown-item" href="#/" @click.self="onMarkAsRejected(row.id)">
|
||||
<font-awesome-icon icon="times-circle" class="dropdown-item-icon" />
|
||||
{{ $t('estimates.mark_as_rejected') }}
|
||||
</a>
|
||||
@ -424,7 +424,7 @@ export default {
|
||||
let response = await this.markAsAccepted(data)
|
||||
this.refreshTable()
|
||||
if (response.data) {
|
||||
this.filters.status = 'ACCEPTED'
|
||||
this.filters.status = ''
|
||||
this.$refs.table.refresh()
|
||||
window.toastr['success'](this.$tc('estimates.marked_as_accepted_message'))
|
||||
}
|
||||
@ -446,7 +446,7 @@ export default {
|
||||
let response = await this.markAsRejected(data)
|
||||
this.refreshTable()
|
||||
if (response.data) {
|
||||
this.filters.status = 'REJECTED'
|
||||
this.filters.status = ''
|
||||
this.$refs.table.refresh()
|
||||
window.toastr['success'](this.$tc('estimates.marked_as_rejected_message'))
|
||||
}
|
||||
@ -512,7 +512,7 @@ export default {
|
||||
swal({
|
||||
title: this.$t('general.are_you_sure'),
|
||||
text: this.$t('estimates.confirm_conversion'),
|
||||
icon: '/assets/icon/envelope-solid.svg',
|
||||
icon: '/assets/icon/file-alt-solid.svg',
|
||||
buttons: true,
|
||||
dangerMode: true
|
||||
}).then(async (willConvertInToinvoice) => {
|
||||
@ -590,9 +590,15 @@ export default {
|
||||
}
|
||||
let response = await this.sendEmail(data)
|
||||
this.refreshTable()
|
||||
if (response.data) {
|
||||
if (response.data.success) {
|
||||
window.toastr['success'](this.$tc('estimates.send_estimate_successfully'))
|
||||
return true
|
||||
}
|
||||
if (response.data.error === 'user_email_does_not_exist') {
|
||||
window.toastr['success'](this.$tc('estimates.user_email_does_not_exist'))
|
||||
return true
|
||||
}
|
||||
window.toastr['error'](this.$tc('estimates.something_went_wrong'))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -260,9 +260,15 @@ export default {
|
||||
this.isSendingEmail = true
|
||||
let response = await this.sendEmail({id: this.estimate.id})
|
||||
this.isSendingEmail = false
|
||||
if (response.data) {
|
||||
if (response.data.success) {
|
||||
window.toastr['success'](this.$tc('estimates.send_estimate_successfully'))
|
||||
return true
|
||||
}
|
||||
if (response.data.error === 'user_email_does_not_exist') {
|
||||
window.toastr['success'](this.$tc('estimates.user_email_does_not_exist'))
|
||||
return true
|
||||
}
|
||||
window.toastr['error'](this.$tc('estimates.something_went_wrong'))
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@ -248,13 +248,13 @@
|
||||
</router-link>
|
||||
</v-dropdown-item>
|
||||
<v-dropdown-item v-if="row.status == 'DRAFT'">
|
||||
<a class="dropdown-item" href="#" @click="sendInvoice(row.id)" >
|
||||
<a class="dropdown-item" href="#/" @click="sendInvoice(row.id)" >
|
||||
<font-awesome-icon icon="paper-plane" class="dropdown-item-icon" />
|
||||
{{ $t('invoices.send_invoice') }}
|
||||
</a>
|
||||
</v-dropdown-item>
|
||||
<v-dropdown-item v-if="row.status == 'DRAFT'">
|
||||
<a class="dropdown-item" href="#" @click="markInvoiceAsSent(row.id)">
|
||||
<a class="dropdown-item" href="#/" @click="markInvoiceAsSent(row.id)">
|
||||
<font-awesome-icon icon="check-circle" class="dropdown-item-icon" />
|
||||
{{ $t('invoices.mark_as_sent') }}
|
||||
</a>
|
||||
@ -397,9 +397,15 @@ export default {
|
||||
}
|
||||
let response = await this.sendEmail(data)
|
||||
this.refreshTable()
|
||||
if (response.data) {
|
||||
if (response.data.success) {
|
||||
window.toastr['success'](this.$tc('invoices.send_invoice_successfully'))
|
||||
return true
|
||||
}
|
||||
if (response.data.error === 'user_email_does_not_exist') {
|
||||
window.toastr['error'](this.$tc('invoices.user_email_does_not_exist'))
|
||||
return false
|
||||
}
|
||||
window.toastr['error'](this.$tc('invoices.something_went_wrong'))
|
||||
}
|
||||
})
|
||||
},
|
||||
@ -505,6 +511,7 @@ export default {
|
||||
|
||||
if (res.data.success) {
|
||||
window.toastr['success'](this.$tc('invoices.deleted_message'))
|
||||
this.$refs.table.refresh()
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@ -260,9 +260,15 @@ export default {
|
||||
this.isSendingEmail = true
|
||||
let response = await this.sendEmail({id: this.invoice.id})
|
||||
this.isSendingEmail = false
|
||||
if (response.data) {
|
||||
window.toastr['success'](this.$tc('invoices.confirm_send_invoice'))
|
||||
if (response.data.success) {
|
||||
window.toastr['success'](this.$tc('invoices.send_invoice_successfully'))
|
||||
return true
|
||||
}
|
||||
if (response.data.error === 'user_email_does_not_exist') {
|
||||
window.toastr['error'](this.$tc('invoices.user_email_does_not_exist'))
|
||||
return false
|
||||
}
|
||||
window.toastr['error'](this.$tc('invoices.something_went_wrong'))
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@ -166,7 +166,7 @@ export default {
|
||||
user_id: null,
|
||||
payment_number: null,
|
||||
payment_date: null,
|
||||
amount: 100,
|
||||
amount: 0,
|
||||
payment_mode: null,
|
||||
invoice_id: null,
|
||||
notes: null
|
||||
|
||||
Reference in New Issue
Block a user