Merge branch 'master'

This commit is contained in:
Mohit Panjwani
2019-11-20 14:04:57 +05:30
13 changed files with 68 additions and 91 deletions

View File

@ -36,6 +36,7 @@ class CustomerRequest extends FormRequest
'name' => 'required',
'addresses.*.address_street_1' => 'max:255',
'addresses.*.address_street_2' => 'max:255',
'email' => 'email|nullable|unique:users,email,'.$this->id
];
break;
default:

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{
"/assets/js/app.js": "/assets/js/app.js?id=163d38f203813d39876c",
"/assets/css/crater.css": "/assets/css/crater.css?id=cfbb5bcff9172ae150e6"
"/assets/js/app.js": "/assets/js/app.js?id=0de16e5183b0d24fd95d",
"/assets/css/crater.css": "/assets/css/crater.css?id=361d275866b6299acb36"
}

View File

@ -148,7 +148,11 @@ export default {
}
if (response.data) {
window.toastr['success'](this.$t('settings.expense_category.created_message'))
if (!this.isEdit) {
window.toastr['success'](this.$t('settings.expense_category.created_message'))
} else {
window.toastr['success'](this.$t('settings.expense_category.updated_message'))
}
window.hub.$emit('newCategory', response.data.category)
this.closeCategoryModal()
this.isLoading = false

View File

@ -67,15 +67,10 @@
<label class="col-sm-4 col-form-label input-label">{{ $t('customers.phone') }}</label>
<div class="col-sm-7">
<base-input
:invalid="$v.formData.phone.$error"
v-model.trim="formData.phone"
type="text"
name="phone"
@input="$v.formData.phone.$touch()"
/>
<div v-if="$v.formData.phone.$error">
<span v-if="!$v.formData.phone.numeric" class="text-danger">{{ $tc('validation.numbers_only') }}</span>
</div>
</div>
</div>
<div class="form-group row">
@ -113,15 +108,10 @@
<label class="col-sm-4 col-form-label input-label">{{ $t('customers.phone') }}</label>
<div class="col-sm-7">
<base-input
:invalid="$v.billing.phone.$error"
v-model.trim="billing.phone"
type="text"
name="phone"
@input="$v.billing.phone.$touch()"
/>
<div v-if="$v.billing.phone.$error">
<span v-if="!$v.billing.phone.numberic" class="text-danger">{{ $tc('validation.numbers_only') }}</span>
</div>
</div>
</div>
@ -249,15 +239,10 @@
<label class="col-sm-4 col-form-label input-label">{{ $t('customers.phone') }}</label>
<div class="col-sm-7">
<base-input
:invalid="$v.shipping.phone.$error"
v-model.trim="shipping.phone"
type="text"
name="phone"
@input="$v.shipping.phone.$touch()"
/>
<div v-if="$v.shipping.phone.$error">
<span v-if="!$v.shipping.phone.numberic" class="text-danger">{{ $tc('validation.numbers_only') }}</span>
</div>
</div>
</div>
@ -426,17 +411,11 @@ export default {
email: {
email
},
phone: {
numeric
},
website: {
url
}
},
billing: {
phone: {
numeric
},
address_street_1: {
maxLength: maxLength(255)
},
@ -445,9 +424,6 @@ export default {
}
},
shipping: {
phone: {
numeric
},
address_street_1: {
maxLength: maxLength(255)
},
@ -629,21 +605,28 @@ export default {
} else {
this.formData.currency_id = this.defaultCurrency.id
}
let response = await this.addCustomer(this.formData)
if (response.data) {
window.toastr['success'](this.$tc('customers.created_message'))
this.isLoading = false
if (this.$route.name === 'invoices.create') {
this.setInvoiceCustomer(response.data.customer.id)
try {
let response = await this.addCustomer(this.formData)
if (response.data) {
window.toastr['success'](this.$tc('customers.created_message'))
this.isLoading = false
if (this.$route.name === 'invoices.create') {
this.setInvoiceCustomer(response.data.customer.id)
}
if (this.$route.name === 'estimates.create') {
this.setEstimateCustomer(response.data.customer.id)
}
this.resetData()
this.closeModal()
return true
}
if (this.$route.name === 'estimates.create') {
this.setEstimateCustomer(response.data.customer.id)
// window.toastr['error'](response.data.error)
} catch (err) {
if (err.response.data.errors.email) {
this.isLoading = false
window.toastr['error'](this.$t('validation.email_already_taken'))
}
this.resetData()
this.closeModal()
return true
}
window.toastr['error'](response.data.error)
},
async fetchCountry () {
let res = await window.axios.get('/api/countries')

View File

@ -189,7 +189,11 @@ export default {
response = await this.updateTaxType(this.formData)
}
if (response.data) {
window.toastr['success'](this.$t('settings.tax_types.created_message'))
if (!this.isEdit) {
window.toastr['success'](this.$t('settings.tax_types.created_message'))
} else {
window.toastr['success'](this.$t('settings.tax_types.updated_message'))
}
window.hub.$emit('newTax', response.data.taxType)
this.closeTaxModal()
this.isLoading = false

View File

@ -34,7 +34,7 @@
</div>
</div>
<button class="list-add-button" @click="openCustomerModal">
<button type="button" class="list-add-button" @click="openCustomerModal">
<font-awesome-icon class="icon" icon="user-plus" />
<label>{{ $t('customers.add_new_customer') }}</label>
</button>

View File

@ -642,9 +642,9 @@ export default {
percent: 'Percent',
action: 'Action',
tax_setting_description: 'Enable this if you want to add taxes to individual invoice items. By default, taxes are added directly to the invoice.',
created_message: 'Sales tax created successfully',
updated_message: 'Sales tax updated successfully',
deleted_message: 'Sales tax deleted successfully',
created_message: 'Tax type created successfully',
updated_message: 'Tax type updated successfully',
deleted_message: 'Tax type deleted successfully',
confirm_delete: 'You will not be able to recover this Tax Type',
already_in_use: 'Tax is already in use'
},
@ -655,7 +655,7 @@ export default {
add_new_category: 'Add New Category',
category_name: 'Category Name',
category_description: 'Description',
created_message: 'Category created successfully',
created_message: 'Expense Category created successfully',
deleted_message: 'Expense category deleted successfully',
updated_message: 'Expense category updated successfully',
confirm_delete: 'You will not be able to recover this Expense Category',

View File

@ -638,9 +638,9 @@ export default {
percent: 'Por ciento',
action: 'Acción',
tax_setting_description: 'Habilítelo si desea agregar impuestos a artículos de factura individuales. Por defecto, los impuestos se agregan directamente a la factura.',
created_message: 'Impuesto sobre las ventas creado con éxito',
updated_message: 'Impuesto sobre ventas actualizado con éxito',
deleted_message: 'Impuesto sobre las ventas eliminado con éxito',
created_message: 'Tipo de impuesto creado con éxito',
updated_message: 'Tipo de impuesto actualizado correctamente',
deleted_message: 'Tipo de impuesto eliminado correctamente',
confirm_delete: 'No podrá recuperar este tipo de impuesto',
already_in_use: 'El impuesto ya está en uso.'
},
@ -651,7 +651,7 @@ export default {
add_new_category: 'Añadir nueva categoria',
category_name: 'nombre de la categoría',
category_description: 'Descripción',
created_message: 'Categoría creada con éxito',
created_message: 'Categoría de gastos creada con éxito',
deleted_message: 'Categoría de gastos eliminada correctamente',
updated_message: 'Categoría de gastos actualizada con éxito',
confirm_delete: 'No podrá recuperar esta categoría de gastos',

View File

@ -640,9 +640,9 @@ export default {
percent: 'Pour cent',
action: 'action',
tax_setting_description: 'Activez cette option si vous souhaitez ajouter des taxes à des postes de facture individuels. Par défaut, les taxes sont ajoutées directement à la facture.',
created_message: 'La taxe de vente créée avec succès',
updated_message: 'La taxe de vente a été mise à jour avec succès',
deleted_message: 'La taxe de vente a été supprimée avec succès',
created_message: 'Type de taxe créé avec succès',
updated_message: 'Type de taxe mis à jour avec succès',
deleted_message: 'Type de taxe supprimé avec succès',
confirm_delete: 'Vous ne pourrez pas récupérer ce type de taxe',
already_in_use: 'La taxe est déjà utilisée'
},
@ -653,7 +653,7 @@ export default {
add_new_category: 'Ajouter une nouvelle catégorie',
category_name: 'Nom de catégorie',
category_description: 'La description',
created_message: 'Catégorie créée avec succès',
created_message: 'Catégorie de dépenses créée avec succès',
deleted_message: 'La catégorie de dépenses a été supprimée avec succès',
updated_message: 'Catégorie de dépenses mise à jour avec succès',
confirm_delete: 'Vous ne pourrez pas récupérer cette catégorie de dépenses',

View File

@ -84,16 +84,11 @@
<div class="form-group">
<label class="form-label">{{ $t('customers.phone') }}</label>
<base-input
:invalid="$v.formData.phone.$error"
v-model.trim="formData.phone"
type="text"
name="phone"
tab-index="4"
@input="$v.formData.phone.$touch()"
/>
<div v-if="$v.formData.phone.$error">
<span v-if="!$v.formData.phone.numeric" class="text-danger">{{ $tc('validation.numbers_only') }}</span>
</div>
</div>
<div class="form-group">
<label class="form-label">{{ $t('customers.website') }}</label>
@ -196,16 +191,11 @@
<div class="form-group">
<label class="form-label">{{ $t('customers.phone') }}</label>
<base-input
:invalid="$v.billing.phone.$error"
v-model.trim="billing.phone"
type="text"
name="phone"
tab-index="13"
@input="$v.billing.phone.$touch()"
/>
<div v-if="$v.billing.phone.$error">
<span v-if="!$v.billing.phone.numberic" class="text-danger">{{ $tc('validation.numbers_only') }}</span>
</div>
</div>
<div class="form-group">
<label class="form-label">{{ $t('customers.zip_code') }}</label>
@ -315,16 +305,11 @@
<div class="form-group">
<label class="form-label">{{ $t('customers.phone') }}</label>
<base-input
:invalid="$v.shipping.phone.$error"
v-model.trim="shipping.phone"
type="text"
name="phone"
tab-index="21"
@input="$v.shipping.phone.$touch()"
/>
<div v-if="$v.shipping.phone.$error">
<span v-if="!$v.shipping.phone.numberic" class="text-danger">{{ $tc('validation.numbers_only') }}</span>
</div>
</div>
<div class="form-group">
<label class="form-label">{{ $t('customers.zip_code') }}</label>
@ -432,17 +417,11 @@ export default {
email: {
email
},
phone: {
numeric
},
website: {
url
}
},
billing: {
phone: {
numeric
},
address_street_1: {
maxLength: maxLength(255)
},
@ -451,9 +430,6 @@ export default {
}
},
shipping: {
phone: {
numeric
},
address_street_1: {
maxLength: maxLength(255)
},
@ -608,16 +584,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) {

View File

@ -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)
}
}
}
},