mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-29 20:51:09 -04:00
fix payment/create and customer email validation
This commit is contained in:
@ -608,16 +608,20 @@ export default {
|
||||
this.formData.currency_id = this.currency.id
|
||||
}
|
||||
this.isLoading = true
|
||||
let response = await this.updateCustomer(this.formData)
|
||||
|
||||
if (response.data) {
|
||||
window.toastr['success'](this.$t('customers.updated_message'))
|
||||
this.$router.push('/admin/customers')
|
||||
this.isLoading = false
|
||||
return true
|
||||
try {
|
||||
let response = await this.updateCustomer(this.formData)
|
||||
if (response.data) {
|
||||
window.toastr['success'](this.$t('customers.updated_message'))
|
||||
this.$router.push('/admin/customers')
|
||||
this.isLoading = false
|
||||
return true
|
||||
}
|
||||
} catch (err) {
|
||||
if (err.response.data.errors.email) {
|
||||
this.isLoading = false
|
||||
window.toastr['error'](this.$t('validation.email_already_taken'))
|
||||
}
|
||||
}
|
||||
|
||||
window.toastr['error'](response.data.error)
|
||||
} else {
|
||||
this.isLoading = true
|
||||
if (this.currency) {
|
||||
|
||||
@ -246,14 +246,19 @@ export default {
|
||||
watch: {
|
||||
customer (newValue) {
|
||||
this.formData.user_id = newValue.id
|
||||
this.invoice = null
|
||||
this.formData.amount = 0
|
||||
this.invoiceList = []
|
||||
if (!this.isEdit) {
|
||||
this.fetchCustomerInvoices(newValue.id)
|
||||
}
|
||||
},
|
||||
invoice (newValue) {
|
||||
this.formData.invoice_id = newValue.id
|
||||
if (!this.isEdit) {
|
||||
this.setPaymentAmountByInvoiceData(newValue.id)
|
||||
if (newValue) {
|
||||
this.formData.invoice_id = newValue.id
|
||||
if (!this.isEdit) {
|
||||
this.setPaymentAmountByInvoiceData(newValue.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user