Selectbox add new and validation message.
This commit is contained in:
parent
3f80aa18f3
commit
fd25e31d96
@ -393,6 +393,7 @@ import { Select, Option, OptionGroup, ColorPicker } from 'element-ui';
|
|||||||
|
|
||||||
import AkauntingModalAddNew from './AkauntingModalAddNew';
|
import AkauntingModalAddNew from './AkauntingModalAddNew';
|
||||||
import AkauntingModal from './AkauntingModal';
|
import AkauntingModal from './AkauntingModal';
|
||||||
|
import AkauntingMoney from './AkauntingMoney';
|
||||||
import AkauntingRadioGroup from './forms/AkauntingRadioGroup';
|
import AkauntingRadioGroup from './forms/AkauntingRadioGroup';
|
||||||
import AkauntingSelect from './AkauntingSelect';
|
import AkauntingSelect from './AkauntingSelect';
|
||||||
import AkauntingDate from './AkauntingDate';
|
import AkauntingDate from './AkauntingDate';
|
||||||
@ -412,6 +413,7 @@ export default {
|
|||||||
AkauntingRadioGroup,
|
AkauntingRadioGroup,
|
||||||
AkauntingSelect,
|
AkauntingSelect,
|
||||||
AkauntingModal,
|
AkauntingModal,
|
||||||
|
AkauntingMoney,
|
||||||
AkauntingDate,
|
AkauntingDate,
|
||||||
AkauntingRecurring,
|
AkauntingRecurring,
|
||||||
},
|
},
|
||||||
@ -584,6 +586,7 @@ export default {
|
|||||||
AkauntingRadioGroup,
|
AkauntingRadioGroup,
|
||||||
AkauntingSelect,
|
AkauntingSelect,
|
||||||
AkauntingModal,
|
AkauntingModal,
|
||||||
|
AkauntingMoney,
|
||||||
AkauntingDate,
|
AkauntingDate,
|
||||||
AkauntingRecurring,
|
AkauntingRecurring,
|
||||||
[ColorPicker.name]: ColorPicker,
|
[ColorPicker.name]: ColorPicker,
|
||||||
@ -618,7 +621,41 @@ export default {
|
|||||||
onSubmit(event) {
|
onSubmit(event) {
|
||||||
this.form = event;
|
this.form = event;
|
||||||
|
|
||||||
axios.post(this.form.action, this.form.data())
|
this.loading = true;
|
||||||
|
|
||||||
|
let data = this.form.data();
|
||||||
|
|
||||||
|
FormData.prototype.appendRecursive = function(data, wrapper = null) {
|
||||||
|
for(var name in data) {
|
||||||
|
if (wrapper) {
|
||||||
|
if ((typeof data[name] == 'object' || data[name].constructor === Array) && ((data[name] instanceof File != true ) && (data[name] instanceof Blob != true))) {
|
||||||
|
this.appendRecursive(data[name], wrapper + '[' + name + ']');
|
||||||
|
} else {
|
||||||
|
this.append(wrapper + '[' + name + ']', data[name]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ((typeof data[name] == 'object' || data[name].constructor === Array) && ((data[name] instanceof File != true ) && (data[name] instanceof Blob != true))) {
|
||||||
|
this.appendRecursive(data[name], name);
|
||||||
|
} else {
|
||||||
|
this.append(name, data[name]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let form_data = new FormData();
|
||||||
|
form_data.appendRecursive(data);
|
||||||
|
|
||||||
|
window.axios({
|
||||||
|
method: this.form.method,
|
||||||
|
url: this.form.action,
|
||||||
|
data: form_data,
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-TOKEN': window.Laravel.csrfToken,
|
||||||
|
'X-Requested-With': 'XMLHttpRequest',
|
||||||
|
'Content-Type': 'multipart/form-data'
|
||||||
|
}
|
||||||
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.form.loading = false;
|
this.form.loading = false;
|
||||||
|
|
||||||
|
@ -681,7 +681,39 @@ export default {
|
|||||||
onSubmit(event) {
|
onSubmit(event) {
|
||||||
this.form = event;
|
this.form = event;
|
||||||
|
|
||||||
axios.post(this.form.action, this.form.data())
|
let data = this.form.data();
|
||||||
|
|
||||||
|
FormData.prototype.appendRecursive = function(data, wrapper = null) {
|
||||||
|
for(var name in data) {
|
||||||
|
if (wrapper) {
|
||||||
|
if ((typeof data[name] == 'object' || data[name].constructor === Array) && ((data[name] instanceof File != true ) && (data[name] instanceof Blob != true))) {
|
||||||
|
this.appendRecursive(data[name], wrapper + '[' + name + ']');
|
||||||
|
} else {
|
||||||
|
this.append(wrapper + '[' + name + ']', data[name]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ((typeof data[name] == 'object' || data[name].constructor === Array) && ((data[name] instanceof File != true ) && (data[name] instanceof Blob != true))) {
|
||||||
|
this.appendRecursive(data[name], name);
|
||||||
|
} else {
|
||||||
|
this.append(name, data[name]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let form_data = new FormData();
|
||||||
|
form_data.appendRecursive(data);
|
||||||
|
|
||||||
|
window.axios({
|
||||||
|
method: this.form.method,
|
||||||
|
url: this.form.action,
|
||||||
|
data: form_data,
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-TOKEN': window.Laravel.csrfToken,
|
||||||
|
'X-Requested-With': 'XMLHttpRequest',
|
||||||
|
'Content-Type': 'multipart/form-data'
|
||||||
|
}
|
||||||
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.form.loading = false;
|
this.form.loading = false;
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
@if (!empty($attributes['v-error']))
|
@if (!empty($attributes['v-error']))
|
||||||
:form-classes="[{'has-error': {{ $attributes['v-error'] }} }]"
|
:form-classes="[{'has-error': {{ $attributes['v-error'] }} }]"
|
||||||
@else
|
@else
|
||||||
:form-classes="[{'has-error': form.errors.get('{{ $name }}') }]"
|
:form-classes="[{'has-error': form.errors.has('{{ $name }}') }]"
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
icon="{{ $icon }}"
|
icon="{{ $icon }}"
|
||||||
@ -28,7 +28,7 @@
|
|||||||
@elseif (!empty($attributes['data-field']))
|
@elseif (!empty($attributes['data-field']))
|
||||||
@interface="{{ 'form.' . $attributes['data-field'] . '.' . $name . ' = $event' }}"
|
@interface="{{ 'form.' . $attributes['data-field'] . '.' . $name . ' = $event' }}"
|
||||||
@else
|
@else
|
||||||
@interface="form.{{ $name }} = $event"
|
@interface="form.errors.clear('{{ $name }}'); form.{{ $name }} = $event;"
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if (!empty($attributes['change']))
|
@if (!empty($attributes['change']))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user