mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 11:41:09 -04:00
Merge branch 'master'
This commit is contained in:
@ -36,6 +36,7 @@ class CustomerRequest extends FormRequest
|
|||||||
'name' => 'required',
|
'name' => 'required',
|
||||||
'addresses.*.address_street_1' => 'max:255',
|
'addresses.*.address_street_1' => 'max:255',
|
||||||
'addresses.*.address_street_2' => 'max:255',
|
'addresses.*.address_street_2' => 'max:255',
|
||||||
|
'email' => 'email|nullable|unique:users,email,'.$this->id
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
2
public/assets/css/crater.css
vendored
2
public/assets/css/crater.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"/assets/js/app.js": "/assets/js/app.js?id=163d38f203813d39876c",
|
"/assets/js/app.js": "/assets/js/app.js?id=0de16e5183b0d24fd95d",
|
||||||
"/assets/css/crater.css": "/assets/css/crater.css?id=cfbb5bcff9172ae150e6"
|
"/assets/css/crater.css": "/assets/css/crater.css?id=361d275866b6299acb36"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -148,7 +148,11 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (response.data) {
|
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)
|
window.hub.$emit('newCategory', response.data.category)
|
||||||
this.closeCategoryModal()
|
this.closeCategoryModal()
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
|
|||||||
@ -67,15 +67,10 @@
|
|||||||
<label class="col-sm-4 col-form-label input-label">{{ $t('customers.phone') }}</label>
|
<label class="col-sm-4 col-form-label input-label">{{ $t('customers.phone') }}</label>
|
||||||
<div class="col-sm-7">
|
<div class="col-sm-7">
|
||||||
<base-input
|
<base-input
|
||||||
:invalid="$v.formData.phone.$error"
|
|
||||||
v-model.trim="formData.phone"
|
v-model.trim="formData.phone"
|
||||||
type="text"
|
type="text"
|
||||||
name="phone"
|
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>
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
@ -113,15 +108,10 @@
|
|||||||
<label class="col-sm-4 col-form-label input-label">{{ $t('customers.phone') }}</label>
|
<label class="col-sm-4 col-form-label input-label">{{ $t('customers.phone') }}</label>
|
||||||
<div class="col-sm-7">
|
<div class="col-sm-7">
|
||||||
<base-input
|
<base-input
|
||||||
:invalid="$v.billing.phone.$error"
|
|
||||||
v-model.trim="billing.phone"
|
v-model.trim="billing.phone"
|
||||||
type="text"
|
type="text"
|
||||||
name="phone"
|
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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -249,15 +239,10 @@
|
|||||||
<label class="col-sm-4 col-form-label input-label">{{ $t('customers.phone') }}</label>
|
<label class="col-sm-4 col-form-label input-label">{{ $t('customers.phone') }}</label>
|
||||||
<div class="col-sm-7">
|
<div class="col-sm-7">
|
||||||
<base-input
|
<base-input
|
||||||
:invalid="$v.shipping.phone.$error"
|
|
||||||
v-model.trim="shipping.phone"
|
v-model.trim="shipping.phone"
|
||||||
type="text"
|
type="text"
|
||||||
name="phone"
|
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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -426,17 +411,11 @@ export default {
|
|||||||
email: {
|
email: {
|
||||||
email
|
email
|
||||||
},
|
},
|
||||||
phone: {
|
|
||||||
numeric
|
|
||||||
},
|
|
||||||
website: {
|
website: {
|
||||||
url
|
url
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
billing: {
|
billing: {
|
||||||
phone: {
|
|
||||||
numeric
|
|
||||||
},
|
|
||||||
address_street_1: {
|
address_street_1: {
|
||||||
maxLength: maxLength(255)
|
maxLength: maxLength(255)
|
||||||
},
|
},
|
||||||
@ -445,9 +424,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
shipping: {
|
shipping: {
|
||||||
phone: {
|
|
||||||
numeric
|
|
||||||
},
|
|
||||||
address_street_1: {
|
address_street_1: {
|
||||||
maxLength: maxLength(255)
|
maxLength: maxLength(255)
|
||||||
},
|
},
|
||||||
@ -629,21 +605,28 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.formData.currency_id = this.defaultCurrency.id
|
this.formData.currency_id = this.defaultCurrency.id
|
||||||
}
|
}
|
||||||
let response = await this.addCustomer(this.formData)
|
try {
|
||||||
if (response.data) {
|
let response = await this.addCustomer(this.formData)
|
||||||
window.toastr['success'](this.$tc('customers.created_message'))
|
if (response.data) {
|
||||||
this.isLoading = false
|
window.toastr['success'](this.$tc('customers.created_message'))
|
||||||
if (this.$route.name === 'invoices.create') {
|
this.isLoading = false
|
||||||
this.setInvoiceCustomer(response.data.customer.id)
|
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') {
|
// window.toastr['error'](response.data.error)
|
||||||
this.setEstimateCustomer(response.data.customer.id)
|
} 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 () {
|
async fetchCountry () {
|
||||||
let res = await window.axios.get('/api/countries')
|
let res = await window.axios.get('/api/countries')
|
||||||
|
|||||||
@ -189,7 +189,11 @@ export default {
|
|||||||
response = await this.updateTaxType(this.formData)
|
response = await this.updateTaxType(this.formData)
|
||||||
}
|
}
|
||||||
if (response.data) {
|
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)
|
window.hub.$emit('newTax', response.data.taxType)
|
||||||
this.closeTaxModal()
|
this.closeTaxModal()
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</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" />
|
<font-awesome-icon class="icon" icon="user-plus" />
|
||||||
<label>{{ $t('customers.add_new_customer') }}</label>
|
<label>{{ $t('customers.add_new_customer') }}</label>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@ -642,9 +642,9 @@ export default {
|
|||||||
percent: 'Percent',
|
percent: 'Percent',
|
||||||
action: 'Action',
|
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.',
|
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',
|
created_message: 'Tax type created successfully',
|
||||||
updated_message: 'Sales tax updated successfully',
|
updated_message: 'Tax type updated successfully',
|
||||||
deleted_message: 'Sales tax deleted successfully',
|
deleted_message: 'Tax type deleted successfully',
|
||||||
confirm_delete: 'You will not be able to recover this Tax Type',
|
confirm_delete: 'You will not be able to recover this Tax Type',
|
||||||
already_in_use: 'Tax is already in use'
|
already_in_use: 'Tax is already in use'
|
||||||
},
|
},
|
||||||
@ -655,7 +655,7 @@ export default {
|
|||||||
add_new_category: 'Add New Category',
|
add_new_category: 'Add New Category',
|
||||||
category_name: 'Category Name',
|
category_name: 'Category Name',
|
||||||
category_description: 'Description',
|
category_description: 'Description',
|
||||||
created_message: 'Category created successfully',
|
created_message: 'Expense Category created successfully',
|
||||||
deleted_message: 'Expense category deleted successfully',
|
deleted_message: 'Expense category deleted successfully',
|
||||||
updated_message: 'Expense category updated successfully',
|
updated_message: 'Expense category updated successfully',
|
||||||
confirm_delete: 'You will not be able to recover this Expense Category',
|
confirm_delete: 'You will not be able to recover this Expense Category',
|
||||||
|
|||||||
@ -638,9 +638,9 @@ export default {
|
|||||||
percent: 'Por ciento',
|
percent: 'Por ciento',
|
||||||
action: 'Acción',
|
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.',
|
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',
|
created_message: 'Tipo de impuesto creado con éxito',
|
||||||
updated_message: 'Impuesto sobre ventas actualizado con éxito',
|
updated_message: 'Tipo de impuesto actualizado correctamente',
|
||||||
deleted_message: 'Impuesto sobre las ventas eliminado con éxito',
|
deleted_message: 'Tipo de impuesto eliminado correctamente',
|
||||||
confirm_delete: 'No podrá recuperar este tipo de impuesto',
|
confirm_delete: 'No podrá recuperar este tipo de impuesto',
|
||||||
already_in_use: 'El impuesto ya está en uso.'
|
already_in_use: 'El impuesto ya está en uso.'
|
||||||
},
|
},
|
||||||
@ -651,7 +651,7 @@ export default {
|
|||||||
add_new_category: 'Añadir nueva categoria',
|
add_new_category: 'Añadir nueva categoria',
|
||||||
category_name: 'nombre de la categoría',
|
category_name: 'nombre de la categoría',
|
||||||
category_description: 'Descripción',
|
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',
|
deleted_message: 'Categoría de gastos eliminada correctamente',
|
||||||
updated_message: 'Categoría de gastos actualizada con éxito',
|
updated_message: 'Categoría de gastos actualizada con éxito',
|
||||||
confirm_delete: 'No podrá recuperar esta categoría de gastos',
|
confirm_delete: 'No podrá recuperar esta categoría de gastos',
|
||||||
|
|||||||
@ -640,9 +640,9 @@ export default {
|
|||||||
percent: 'Pour cent',
|
percent: 'Pour cent',
|
||||||
action: 'action',
|
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.',
|
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',
|
created_message: 'Type de taxe créé avec succès',
|
||||||
updated_message: 'La taxe de vente a été mise à jour avec succès',
|
updated_message: 'Type de taxe mis à jour avec succès',
|
||||||
deleted_message: 'La taxe de vente a été supprimée 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',
|
confirm_delete: 'Vous ne pourrez pas récupérer ce type de taxe',
|
||||||
already_in_use: 'La taxe est déjà utilisée'
|
already_in_use: 'La taxe est déjà utilisée'
|
||||||
},
|
},
|
||||||
@ -653,7 +653,7 @@ export default {
|
|||||||
add_new_category: 'Ajouter une nouvelle catégorie',
|
add_new_category: 'Ajouter une nouvelle catégorie',
|
||||||
category_name: 'Nom de catégorie',
|
category_name: 'Nom de catégorie',
|
||||||
category_description: 'La description',
|
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',
|
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',
|
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',
|
confirm_delete: 'Vous ne pourrez pas récupérer cette catégorie de dépenses',
|
||||||
|
|||||||
@ -84,16 +84,11 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label">{{ $t('customers.phone') }}</label>
|
<label class="form-label">{{ $t('customers.phone') }}</label>
|
||||||
<base-input
|
<base-input
|
||||||
:invalid="$v.formData.phone.$error"
|
|
||||||
v-model.trim="formData.phone"
|
v-model.trim="formData.phone"
|
||||||
type="text"
|
type="text"
|
||||||
name="phone"
|
name="phone"
|
||||||
tab-index="4"
|
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>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label">{{ $t('customers.website') }}</label>
|
<label class="form-label">{{ $t('customers.website') }}</label>
|
||||||
@ -196,16 +191,11 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label">{{ $t('customers.phone') }}</label>
|
<label class="form-label">{{ $t('customers.phone') }}</label>
|
||||||
<base-input
|
<base-input
|
||||||
:invalid="$v.billing.phone.$error"
|
|
||||||
v-model.trim="billing.phone"
|
v-model.trim="billing.phone"
|
||||||
type="text"
|
type="text"
|
||||||
name="phone"
|
name="phone"
|
||||||
tab-index="13"
|
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>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label">{{ $t('customers.zip_code') }}</label>
|
<label class="form-label">{{ $t('customers.zip_code') }}</label>
|
||||||
@ -315,16 +305,11 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label">{{ $t('customers.phone') }}</label>
|
<label class="form-label">{{ $t('customers.phone') }}</label>
|
||||||
<base-input
|
<base-input
|
||||||
:invalid="$v.shipping.phone.$error"
|
|
||||||
v-model.trim="shipping.phone"
|
v-model.trim="shipping.phone"
|
||||||
type="text"
|
type="text"
|
||||||
name="phone"
|
name="phone"
|
||||||
tab-index="21"
|
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>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label">{{ $t('customers.zip_code') }}</label>
|
<label class="form-label">{{ $t('customers.zip_code') }}</label>
|
||||||
@ -432,17 +417,11 @@ export default {
|
|||||||
email: {
|
email: {
|
||||||
email
|
email
|
||||||
},
|
},
|
||||||
phone: {
|
|
||||||
numeric
|
|
||||||
},
|
|
||||||
website: {
|
website: {
|
||||||
url
|
url
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
billing: {
|
billing: {
|
||||||
phone: {
|
|
||||||
numeric
|
|
||||||
},
|
|
||||||
address_street_1: {
|
address_street_1: {
|
||||||
maxLength: maxLength(255)
|
maxLength: maxLength(255)
|
||||||
},
|
},
|
||||||
@ -451,9 +430,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
shipping: {
|
shipping: {
|
||||||
phone: {
|
|
||||||
numeric
|
|
||||||
},
|
|
||||||
address_street_1: {
|
address_street_1: {
|
||||||
maxLength: maxLength(255)
|
maxLength: maxLength(255)
|
||||||
},
|
},
|
||||||
@ -608,16 +584,20 @@ export default {
|
|||||||
this.formData.currency_id = this.currency.id
|
this.formData.currency_id = this.currency.id
|
||||||
}
|
}
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
let response = await this.updateCustomer(this.formData)
|
try {
|
||||||
|
let response = await this.updateCustomer(this.formData)
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
window.toastr['success'](this.$t('customers.updated_message'))
|
window.toastr['success'](this.$t('customers.updated_message'))
|
||||||
this.$router.push('/admin/customers')
|
this.$router.push('/admin/customers')
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
return true
|
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 {
|
} else {
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
if (this.currency) {
|
if (this.currency) {
|
||||||
|
|||||||
@ -246,14 +246,19 @@ export default {
|
|||||||
watch: {
|
watch: {
|
||||||
customer (newValue) {
|
customer (newValue) {
|
||||||
this.formData.user_id = newValue.id
|
this.formData.user_id = newValue.id
|
||||||
|
this.invoice = null
|
||||||
|
this.formData.amount = 0
|
||||||
|
this.invoiceList = []
|
||||||
if (!this.isEdit) {
|
if (!this.isEdit) {
|
||||||
this.fetchCustomerInvoices(newValue.id)
|
this.fetchCustomerInvoices(newValue.id)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
invoice (newValue) {
|
invoice (newValue) {
|
||||||
this.formData.invoice_id = newValue.id
|
if (newValue) {
|
||||||
if (!this.isEdit) {
|
this.formData.invoice_id = newValue.id
|
||||||
this.setPaymentAmountByInvoiceData(newValue.id)
|
if (!this.isEdit) {
|
||||||
|
this.setPaymentAmountByInvoiceData(newValue.id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user