Code refactoring
This commit is contained in:
parent
c08c080900
commit
aaa7f79670
@ -11,12 +11,12 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'Wizard',
|
name: "Wizard",
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
page_loaded: true,
|
page_loaded: true,
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
let self = this;
|
let self = this;
|
||||||
|
|
||||||
@ -36,9 +36,12 @@ export default {
|
|||||||
return data.currency_codes[key];
|
return data.currency_codes[key];
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(
|
||||||
|
function () {
|
||||||
self.page_loaded = false;
|
self.page_loaded = false;
|
||||||
}.bind(self), 800);
|
}.bind(self),
|
||||||
|
800
|
||||||
|
);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -93,24 +96,24 @@ export default {
|
|||||||
|
|
||||||
.form-container .has-error {
|
.form-container .has-error {
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-bottom:unset !important;
|
margin-bottom: unset !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-container .has-error .form-control {
|
.form-container .has-error .form-control {
|
||||||
border-top-right-radius: 5px;
|
border-top-right-radius: 5px;
|
||||||
border-bottom-right-radius: 5px;
|
border-bottom-right-radius: 5px;
|
||||||
border-right:1px solid;
|
border-right: 1px solid;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-step__icon {
|
.el-step__icon {
|
||||||
-webkit-transition: unset;
|
-webkit-transition: unset;
|
||||||
transition: unset;
|
transition: unset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 991px) {
|
@media screen and (max-width: 991px) {
|
||||||
.form-container .has-error {
|
.form-container .has-error {
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-bottom:1.5rem !important;
|
margin-bottom: 1.5rem !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.current-tab-btn {
|
.current-tab-btn {
|
||||||
|
@ -86,7 +86,7 @@
|
|||||||
description: "Input label (text before input)"
|
description: "Input label (text before input)"
|
||||||
},
|
},
|
||||||
error: {
|
error: {
|
||||||
type: [String, Object, Array],
|
type: String,
|
||||||
description: "Input error (below input)"
|
description: "Input error (below input)"
|
||||||
},
|
},
|
||||||
footerError: {
|
footerError: {
|
||||||
|
10
resources/assets/js/mixins/spa-global.js
vendored
10
resources/assets/js/mixins/spa-global.js
vendored
@ -10,10 +10,9 @@ export default {
|
|||||||
select: "",
|
select: "",
|
||||||
enabled: 1
|
enabled: 1
|
||||||
},
|
},
|
||||||
error_field: {}
|
error_field: {},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
addItem() {
|
addItem() {
|
||||||
this.newDatas = true;
|
this.newDatas = true;
|
||||||
@ -99,7 +98,6 @@ export default {
|
|||||||
onEditEvent(form_method, form_url, plus_data, form_list, form_id) {
|
onEditEvent(form_method, form_url, plus_data, form_list, form_id) {
|
||||||
const formData = new FormData(this.$refs["form"]);
|
const formData = new FormData(this.$refs["form"]);
|
||||||
const data = {};
|
const data = {};
|
||||||
let file = {};
|
|
||||||
|
|
||||||
for (let [key, val] of formData.entries()) {
|
for (let [key, val] of formData.entries()) {
|
||||||
Object.assign(data, {
|
Object.assign(data, {
|
||||||
@ -131,7 +129,6 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.onSuccessEvent(response);
|
this.onSuccessEvent(response);
|
||||||
|
|
||||||
}, this)
|
}, this)
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
this.onFailError(error)
|
this.onFailError(error)
|
||||||
@ -169,7 +166,6 @@ export default {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.onSuccessEvent(response);
|
this.onSuccessEvent(response);
|
||||||
|
|
||||||
}, this)
|
}, this)
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
this.onFailError(error);
|
this.onFailError(error);
|
||||||
@ -199,8 +195,8 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const formData = new FormData(this.$refs["form"]);
|
const formData = new FormData(this.$refs["form"]);
|
||||||
|
|
||||||
let data_name = {};
|
let data_name = {};
|
||||||
|
|
||||||
for (let [key, val] of formData.entries()) {
|
for (let [key, val] of formData.entries()) {
|
||||||
Object.assign(data_name, {
|
Object.assign(data_name, {
|
||||||
[key]: val,
|
[key]: val,
|
||||||
@ -210,6 +206,7 @@ export default {
|
|||||||
['_method']: 'POST',
|
['_method']: 'POST',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
formData.appendRecursive(data_name);
|
formData.appendRecursive(data_name);
|
||||||
|
|
||||||
window.axios({
|
window.axios({
|
||||||
@ -224,7 +221,6 @@ export default {
|
|||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.onSuccessEvent(response);
|
this.onSuccessEvent(response);
|
||||||
|
|
||||||
}, this)
|
}, this)
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
this.onFailError(error)
|
this.onFailError(error)
|
||||||
|
@ -26,7 +26,9 @@
|
|||||||
/>
|
/>
|
||||||
<p class="mb-0 mt--3">
|
<p class="mb-0 mt--3">
|
||||||
<small>
|
<small>
|
||||||
<div v-html="translations.company.get_api_key"></div>
|
<div><a href="https://akaunting.com/dashboard" target="_blank">Click here</a>
|
||||||
|
to get your API key.
|
||||||
|
</div>
|
||||||
</small>
|
</small>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@ -123,6 +125,10 @@ export default {
|
|||||||
translations: {
|
translations: {
|
||||||
type: [Object, Array],
|
type: [Object, Array],
|
||||||
},
|
},
|
||||||
|
url: {
|
||||||
|
type: String,
|
||||||
|
default: 'text'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -133,9 +139,7 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
let company_data = this.company;
|
let company_data = this.company;
|
||||||
setTimeout(() => {
|
|
||||||
this.dataWatch(company_data);
|
this.dataWatch(company_data);
|
||||||
}, 500);
|
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
company: function (company) {
|
company: function (company) {
|
||||||
@ -159,6 +163,7 @@ export default {
|
|||||||
this.real_date = company.financial_start;
|
this.real_date = company.financial_start;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
next() {
|
next() {
|
||||||
if (this.active++ > 2);
|
if (this.active++ > 2);
|
||||||
this.$router.push("/wizard/currencies");
|
this.$router.push("/wizard/currencies");
|
||||||
|
@ -300,9 +300,7 @@ import MixinsSpaGlobal from "./../../mixins/spa-global";
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Currencies",
|
name: "Currencies",
|
||||||
|
|
||||||
mixins: [MixinsGlobal, MixinsSpaGlobal],
|
mixins: [MixinsGlobal, MixinsSpaGlobal],
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
[Step.name]: Step,
|
[Step.name]: Step,
|
||||||
[Steps.name]: Steps,
|
[Steps.name]: Steps,
|
||||||
@ -310,7 +308,6 @@ export default {
|
|||||||
[Option.name]: Option,
|
[Option.name]: Option,
|
||||||
AkauntingRadioGroup,
|
AkauntingRadioGroup,
|
||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
currencies: {
|
currencies: {
|
||||||
type: [Object, Array],
|
type: [Object, Array],
|
||||||
|
@ -255,6 +255,7 @@ export default {
|
|||||||
this.onStatus(item.id, event);
|
this.onStatus(item.id, event);
|
||||||
this.onStatusControl(this.taxes, item.id, event);
|
this.onStatusControl(this.taxes, item.id, event);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleClickDelete(item) {
|
handleClickDelete(item) {
|
||||||
this.confirmDelete(
|
this.confirmDelete(
|
||||||
`${
|
`${
|
||||||
@ -275,14 +276,17 @@ export default {
|
|||||||
this.translations.taxes.delete
|
this.translations.taxes.delete
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
next() {
|
next() {
|
||||||
if (this.active++ > 2);
|
if (this.active++ > 2);
|
||||||
this.$router.push("/wizard/finish");
|
this.$router.push("/wizard/finish");
|
||||||
},
|
},
|
||||||
|
|
||||||
prev() {
|
prev() {
|
||||||
if (this.active-- > 2);
|
if (this.active-- > 2);
|
||||||
this.$router.push("/wizard/currencies");
|
this.$router.push("/wizard/currencies");
|
||||||
},
|
},
|
||||||
|
|
||||||
onEditSave(item) {
|
onEditSave(item) {
|
||||||
this.onEditEvent(
|
this.onEditEvent(
|
||||||
"PATCH",
|
"PATCH",
|
||||||
@ -292,9 +296,11 @@ export default {
|
|||||||
item.id
|
item.id
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
onSubmitForm() {
|
onSubmitForm() {
|
||||||
this.onSubmitEvent("POST", url + "/wizard/taxes", "type", this.taxes);
|
this.onSubmitEvent("POST", url + "/wizard/taxes", "type", this.taxes);
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteCurrency(event) {
|
deleteCurrency(event) {
|
||||||
this.onDeleteEvent(event, this.taxes, event.tax_id);
|
this.onDeleteEvent(event, this.taxes, event.tax_id);
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user