Merge pull request #2914 from EnesSacid-Buker/master
this.errors is undefined issue
This commit is contained in:
commit
6015e3a1e7
6
resources/assets/js/plugins/error.js
vendored
6
resources/assets/js/plugins/error.js
vendored
@ -17,13 +17,15 @@ export default class Errors {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get(field) {
|
get(field) {
|
||||||
if (this.errors[field]) {
|
if (this.has(field)) {
|
||||||
return this.errors[field][0];
|
return this.errors[field][0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
record(errors) {
|
record(errors) {
|
||||||
this.errors = errors;
|
if (errors instanceof Object) {
|
||||||
|
this.errors = errors;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
clear(field) {
|
clear(field) {
|
||||||
|
10
resources/assets/js/plugins/form.js
vendored
10
resources/assets/js/plugins/form.js
vendored
@ -104,7 +104,7 @@ export default class Form {
|
|||||||
if (!this[form_element.getAttribute('data-field')][name].push) {
|
if (!this[form_element.getAttribute('data-field')][name].push) {
|
||||||
this[form_element.getAttribute('data-field')][name] = [this[form_element.getAttribute('data-field')][name]];
|
this[form_element.getAttribute('data-field')][name] = [this[form_element.getAttribute('data-field')][name]];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (form_element.checked) {
|
if (form_element.checked) {
|
||||||
this[form_element.getAttribute('data-field')][name].push(form_element.value);
|
this[form_element.getAttribute('data-field')][name].push(form_element.value);
|
||||||
}
|
}
|
||||||
@ -171,7 +171,7 @@ export default class Form {
|
|||||||
this[name] = form_element.value;
|
this[name] = form_element.value;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (form_element.dataset.type != undefined) {
|
if (form_element.dataset.type != undefined) {
|
||||||
if (form_element.dataset.type == 'multiple') {
|
if (form_element.dataset.type == 'multiple') {
|
||||||
this[name] = [];
|
this[name] = [];
|
||||||
@ -383,7 +383,7 @@ export default class Form {
|
|||||||
}
|
}
|
||||||
|
|
||||||
submit() {
|
submit() {
|
||||||
FormData.prototype.appendRecursive = function(data, wrapper = null) {
|
FormData.prototype.appendRecursive = function(data, wrapper = null) {
|
||||||
for (var name in data) {
|
for (var name in data) {
|
||||||
if (name == "previewElement" || name == "previewTemplate") {
|
if (name == "previewElement" || name == "previewTemplate") {
|
||||||
continue;
|
continue;
|
||||||
@ -427,7 +427,7 @@ export default class Form {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async asyncSubmit() {
|
async asyncSubmit() {
|
||||||
FormData.prototype.appendRecursive = function(data, wrapper = null) {
|
FormData.prototype.appendRecursive = function(data, wrapper = null) {
|
||||||
for (var name in data) {
|
for (var name in data) {
|
||||||
if (name == "previewElement" || name == "previewTemplate") {
|
if (name == "previewElement" || name == "previewTemplate") {
|
||||||
continue;
|
continue;
|
||||||
@ -497,7 +497,7 @@ export default class Form {
|
|||||||
if (error.request.status == 419) {
|
if (error.request.status == 419) {
|
||||||
window.location.href = '';
|
window.location.href = '';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof this.errors != "undefined") {
|
if (typeof this.errors != "undefined") {
|
||||||
|
16
resources/assets/js/views/common/documents.js
vendored
16
resources/assets/js/views/common/documents.js
vendored
@ -120,12 +120,12 @@ const app = new Vue({
|
|||||||
let item_index = this.form.items.indexOf(this.form.items[event.oldIndex]);
|
let item_index = this.form.items.indexOf(this.form.items[event.oldIndex]);
|
||||||
let item = this.form.items.splice(item_index, 1)[0];
|
let item = this.form.items.splice(item_index, 1)[0];
|
||||||
|
|
||||||
this.form.items.splice(event.newIndex, 0, item);
|
this.form.items.splice(event.newIndex, 0, item);
|
||||||
},
|
},
|
||||||
|
|
||||||
onRefFocus(ref) {
|
onRefFocus(ref) {
|
||||||
let index = this.form.items.length - 1;
|
let index = this.form.items.length - 1;
|
||||||
|
|
||||||
if (typeof (this.$refs['items-' + index + '-' + ref]) !== 'undefined') {
|
if (typeof (this.$refs['items-' + index + '-' + ref]) !== 'undefined') {
|
||||||
let first_ref = this.$refs['items-' + index + '-' + ref];
|
let first_ref = this.$refs['items-' + index + '-' + ref];
|
||||||
|
|
||||||
@ -486,13 +486,13 @@ const app = new Vue({
|
|||||||
}
|
}
|
||||||
|
|
||||||
let selected_tax;
|
let selected_tax;
|
||||||
|
|
||||||
this.dynamic_taxes.forEach(function(tax) {
|
this.dynamic_taxes.forEach(function(tax) {
|
||||||
if (tax.id == this.tax_id) {
|
if (tax.id == this.tax_id) {
|
||||||
selected_tax = tax;
|
selected_tax = tax;
|
||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
if (selected_tax) {
|
if (selected_tax) {
|
||||||
this.items[item_index].tax_ids.push({
|
this.items[item_index].tax_ids.push({
|
||||||
id: selected_tax.id,
|
id: selected_tax.id,
|
||||||
@ -677,7 +677,7 @@ const app = new Vue({
|
|||||||
|
|
||||||
onFormCapture() {
|
onFormCapture() {
|
||||||
let form_html = document.querySelector('form');
|
let form_html = document.querySelector('form');
|
||||||
|
|
||||||
if (form_html && form_html.getAttribute('id') == 'document') {
|
if (form_html && form_html.getAttribute('id') == 'document') {
|
||||||
form_html.querySelectorAll('input, textarea, select, ul, li, a').forEach((element) => {
|
form_html.querySelectorAll('input, textarea, select, ul, li, a').forEach((element) => {
|
||||||
element.addEventListener('click', () => {
|
element.addEventListener('click', () => {
|
||||||
@ -839,9 +839,9 @@ const app = new Vue({
|
|||||||
|
|
||||||
if (newVal != '' && newVal.search('^(?=.*?[0-9])[0-9.,]+$') !== 0) {
|
if (newVal != '' && newVal.search('^(?=.*?[0-9])[0-9.,]+$') !== 0) {
|
||||||
this.form.discount = oldVal;
|
this.form.discount = oldVal;
|
||||||
|
|
||||||
if (Number(newVal) == null) {
|
if (Number(newVal) == null) {
|
||||||
this.form.discount.replace(',', '.');
|
this.form.discount.replace(',', '.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -865,4 +865,4 @@ const app = new Vue({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user