Testing result fixed
This commit is contained in:
parent
0a9d80ca1b
commit
4230997598
@ -51,7 +51,7 @@
|
|||||||
:title="translations.company.financial_start"
|
:title="translations.company.financial_start"
|
||||||
data-name="financial_start"
|
data-name="financial_start"
|
||||||
:placeholder="translations.company.financial_start"
|
:placeholder="translations.company.financial_start"
|
||||||
prepend-icon="fas fa-calendar"
|
icon="fas fa-calendar"
|
||||||
:date-config="{
|
:date-config="{
|
||||||
dateFormat: 'd-m',
|
dateFormat: 'd-m',
|
||||||
allowInput: true,
|
allowInput: true,
|
||||||
@ -84,6 +84,7 @@
|
|||||||
:v-model="logo"
|
:v-model="logo"
|
||||||
>
|
>
|
||||||
</akaunting-dropzone-file-upload>
|
</akaunting-dropzone-file-upload>
|
||||||
|
<div class="invalid-feedback d-block">The logo must be a file of type: pdf, jpeg, jpg, png.</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -93,7 +94,7 @@
|
|||||||
<base-button
|
<base-button
|
||||||
id="button"
|
id="button"
|
||||||
type="success"
|
type="success"
|
||||||
native-type="submit"
|
native-type="button"
|
||||||
@click="onEditSave()"
|
@click="onEditSave()"
|
||||||
>{{ translations.company.save }}</base-button
|
>{{ translations.company.save }}</base-button
|
||||||
>
|
>
|
||||||
@ -170,8 +171,68 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
onEditSave() {
|
onEditSave() {
|
||||||
this.onEditCompany();
|
FormData.prototype.appendRecursive = function (data, wrapper = null) {
|
||||||
|
for (var name in data) {
|
||||||
|
if (name == "previewElement" || name == "previewTemplate") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (wrapper) {
|
||||||
|
if (
|
||||||
|
(typeof data[name] == "object" || Array.isArray(data[name])) &&
|
||||||
|
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" || Array.isArray(data[name])) &&
|
||||||
|
data[name] instanceof File != true &&
|
||||||
|
data[name] instanceof Blob != true
|
||||||
|
) {
|
||||||
|
this.appendRecursive(data[name], name);
|
||||||
|
} else {
|
||||||
|
this.append(name, data[name]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const formData = new FormData(this.$refs["form"]);
|
||||||
|
let data_name = {};
|
||||||
|
|
||||||
|
for (let [key, val] of formData.entries()) {
|
||||||
|
Object.assign(data_name, {
|
||||||
|
[key]: val,
|
||||||
|
["logo"]: this.$refs.dropzoneWizard.files[1]
|
||||||
|
? this.$refs.dropzoneWizard.files[1]
|
||||||
|
: this.$refs.dropzoneWizard.files[0],
|
||||||
|
["_prefix"]: "company",
|
||||||
|
["_token"]: window.Laravel.csrfToken,
|
||||||
|
["_method"]: "POST",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
formData.appendRecursive(data_name);
|
||||||
|
window
|
||||||
|
.axios({
|
||||||
|
method: "POST",
|
||||||
|
url: url + "/wizard/companies",
|
||||||
|
data: formData,
|
||||||
|
headers: {
|
||||||
|
"X-CSRF-TOKEN": window.Laravel.csrfToken,
|
||||||
|
"X-Requested-With": "XMLHttpRequest",
|
||||||
|
"Content-Type": "multipart/form-data",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
this.onSuccessMessage(response);
|
||||||
this.$router.push("/wizard/currencies");
|
this.$router.push("/wizard/currencies");
|
||||||
|
}, this)
|
||||||
|
.catch((error) => {
|
||||||
|
}, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
next() {
|
next() {
|
||||||
|
@ -389,7 +389,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
onEditForm(item) {
|
onEditForm(item) {
|
||||||
this.onEditItemEvent(
|
this.onSubmitEvent(
|
||||||
"PATCH",
|
"PATCH",
|
||||||
url + "/wizard/currencies/" + item.id,
|
url + "/wizard/currencies/" + item.id,
|
||||||
"",
|
"",
|
||||||
|
@ -282,7 +282,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
onEditForm(item) {
|
onEditForm(item) {
|
||||||
this.onEditItemEvent(
|
this.onSubmitEvent(
|
||||||
"PATCH",
|
"PATCH",
|
||||||
url + "/wizard/taxes/" + item.id,
|
url + "/wizard/taxes/" + item.id,
|
||||||
"type",
|
"type",
|
||||||
|
110
resources/assets/js/views/wizard/wizardAction.js
vendored
110
resources/assets/js/views/wizard/wizardAction.js
vendored
@ -95,47 +95,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onEditItemEvent(form_method, form_url, plus_data, form_list, form_id) {
|
onSubmitEvent(form_method, form_url, plus_data, form_list, form_id) {
|
||||||
const formData = new FormData(this.$refs["form"]);
|
|
||||||
const data = {};
|
|
||||||
|
|
||||||
for (let [key, val] of formData.entries()) {
|
|
||||||
Object.assign(data, {
|
|
||||||
[key]: val,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if(plus_data == 'type') {
|
|
||||||
Object.assign(data, {
|
|
||||||
['type']: 'normal',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
window.axios({
|
|
||||||
method: form_method,
|
|
||||||
url: form_url,
|
|
||||||
data: data,
|
|
||||||
})
|
|
||||||
.then(response => {
|
|
||||||
if (form_list.length) {
|
|
||||||
form_list.forEach(item => {
|
|
||||||
if (item.id == form_id) {
|
|
||||||
item.name = response.data.data.name;
|
|
||||||
item.code = response.data.data.code;
|
|
||||||
item.rate = response.data.data.rate;
|
|
||||||
item.type = plus_data == undefined ? 'normal' : ''
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.onSuccessMessage(response);
|
|
||||||
}, this)
|
|
||||||
.catch(error => {
|
|
||||||
this.onFailError(error)
|
|
||||||
}, this);
|
|
||||||
},
|
|
||||||
|
|
||||||
onSubmitEvent(form_method, form_url, plus_data, form_list) {
|
|
||||||
const formData = new FormData(this.$refs["form"]);
|
const formData = new FormData(this.$refs["form"]);
|
||||||
const data = {};
|
const data = {};
|
||||||
|
|
||||||
@ -157,6 +117,8 @@ export default {
|
|||||||
data: data,
|
data: data,
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
if(form_list.length && form_list.length != undefined) {
|
||||||
|
if(form_method == 'POST') {
|
||||||
form_list.push({
|
form_list.push({
|
||||||
"id": response.data.data.id,
|
"id": response.data.data.id,
|
||||||
"name": response.data.data.name,
|
"name": response.data.data.name,
|
||||||
@ -164,7 +126,18 @@ export default {
|
|||||||
"rate": response.data.data.rate,
|
"rate": response.data.data.rate,
|
||||||
"enabled": response.data.data.enabled != undefined ? response.data.data.enabled : 'true'
|
"enabled": response.data.data.enabled != undefined ? response.data.data.enabled : 'true'
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if(form_method == 'PATCH') {
|
||||||
|
form_list.forEach(item => {
|
||||||
|
if (item.id == form_id) {
|
||||||
|
item.name = response.data.data.name;
|
||||||
|
item.code = response.data.data.code;
|
||||||
|
item.rate = response.data.data.rate;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
this.onSuccessMessage(response);
|
this.onSuccessMessage(response);
|
||||||
}, this)
|
}, this)
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
@ -172,61 +145,6 @@ export default {
|
|||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
onEditCompany() {
|
|
||||||
FormData.prototype.appendRecursive = function(data, wrapper = null) {
|
|
||||||
for(var name in data) {
|
|
||||||
if (name == "previewElement" || name == "previewTemplate") {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (wrapper) {
|
|
||||||
if ((typeof data[name] == 'object' || Array.isArray(data[name])) && ((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' || Array.isArray(data[name])) && ((data[name] instanceof File != true ) && (data[name] instanceof Blob != true))) {
|
|
||||||
this.appendRecursive(data[name], name);
|
|
||||||
} else {
|
|
||||||
this.append(name, data[name]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const formData = new FormData(this.$refs["form"]);
|
|
||||||
let data_name = {};
|
|
||||||
|
|
||||||
for (let [key, val] of formData.entries()) {
|
|
||||||
Object.assign(data_name, {
|
|
||||||
[key]: val,
|
|
||||||
['logo']: this.$refs.dropzoneWizard.files[1] ? this.$refs.dropzoneWizard.files[1] : this.$refs.dropzoneWizard.files[0],
|
|
||||||
['_prefix']: 'company',
|
|
||||||
['_token']: window.Laravel.csrfToken,
|
|
||||||
['_method']: 'POST',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
formData.appendRecursive(data_name);
|
|
||||||
|
|
||||||
window.axios({
|
|
||||||
method: 'POST',
|
|
||||||
url: url + "/wizard/companies",
|
|
||||||
data: formData,
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': window.Laravel.csrfToken,
|
|
||||||
'X-Requested-With': 'XMLHttpRequest',
|
|
||||||
'Content-Type': 'multipart/form-data'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(response => {
|
|
||||||
this.onSuccessMessage(response);
|
|
||||||
}, this)
|
|
||||||
.catch(error => {
|
|
||||||
this.onFailError(error)
|
|
||||||
}, this);
|
|
||||||
},
|
|
||||||
|
|
||||||
onEjetItem(event, form_list, event_id) {
|
onEjetItem(event, form_list, event_id) {
|
||||||
form_list.forEach(function (item, index) {
|
form_list.forEach(function (item, index) {
|
||||||
if (item.id == event_id) {
|
if (item.id == event_id) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user