set default country and some styling
This commit is contained in:
@ -54,6 +54,7 @@
|
||||
v-model="company.tax_number"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
<akaunting-date
|
||||
:title="translations.company.financial_start"
|
||||
@ -69,6 +70,7 @@
|
||||
v-model="real_date"
|
||||
></akaunting-date>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<base-input :label="translations.company.address">
|
||||
<textarea
|
||||
@ -81,28 +83,31 @@
|
||||
></textarea>
|
||||
</base-input>
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
<base-input :label="translations.company.country">
|
||||
<el-select name="country" v-model="model" filterable>
|
||||
<el-select name="country" v-model="company.country" filterable>
|
||||
<template slot="prefix">
|
||||
<span class="el-input__suffix-inner el-select-icon">
|
||||
<i :class="'select-icon-position el-input__icon fas fa-globe-americas'"></i>
|
||||
</span>
|
||||
</template>
|
||||
<el-option
|
||||
v-for="(country, index) in country_data"
|
||||
:key="index"
|
||||
:label="country"
|
||||
:value="country"
|
||||
v-for="(country, index) in sortedCountries"
|
||||
:key="index"
|
||||
:label="country.value"
|
||||
:value="country.key"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</base-input>
|
||||
</div>
|
||||
|
||||
<div class="col-6 mb-0">
|
||||
<label class="form-control-label">{{ translations.company.logo }}</label>
|
||||
<akaunting-dropzone-file-upload
|
||||
ref="dropzoneWizard"
|
||||
class="form-file"
|
||||
preview-classes="single"
|
||||
:attachments="logo"
|
||||
:v-model="logo"
|
||||
@ -156,6 +161,10 @@ export default {
|
||||
type: [Object, Array],
|
||||
},
|
||||
|
||||
countries: {
|
||||
type: [Object, Array],
|
||||
},
|
||||
|
||||
translations: {
|
||||
type: [Object, Array],
|
||||
},
|
||||
@ -190,21 +199,30 @@ export default {
|
||||
logo: [],
|
||||
real_date: "",
|
||||
lang_data: '',
|
||||
country_data: wizard_country,
|
||||
model: ''
|
||||
sorted_countries: [],
|
||||
};
|
||||
},
|
||||
|
||||
created() {
|
||||
if(document.documentElement.lang) {
|
||||
if (document.documentElement.lang) {
|
||||
let lang_split = document.documentElement.lang.split("-");
|
||||
|
||||
if (lang_split[0] !== 'en') {
|
||||
const lang = require(`flatpickr/dist/l10n/${lang_split[0]}.js`).default[lang_split[0]];
|
||||
|
||||
const lang = require(`flatpickr/dist/l10n/${lang_split[0]}.js`).default[lang_split[0]];
|
||||
this.dateConfig.locale = lang;
|
||||
this.dateConfig.locale = lang;
|
||||
}
|
||||
}
|
||||
|
||||
this.setSortedCountries();
|
||||
},
|
||||
|
||||
computed: {
|
||||
sortedCountries() {
|
||||
this.sorted_countries.sort(this.sortBy('value'));
|
||||
|
||||
return this.sorted_countries;
|
||||
},
|
||||
},
|
||||
|
||||
mounted() {
|
||||
@ -214,6 +232,57 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
sortBy(option) {
|
||||
return (firstEl, secondEl) => {
|
||||
let first_element = firstEl[option].toUpperCase(); // ignore upper and lowercase
|
||||
let second_element = secondEl[option].toUpperCase(); // ignore upper and lowercase
|
||||
|
||||
if (first_element < second_element) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (first_element > second_element) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// names must be equal
|
||||
return 0;
|
||||
}
|
||||
},
|
||||
|
||||
setSortedCountries() {
|
||||
// Reset sorted_countries
|
||||
this.sorted_countries = [];
|
||||
|
||||
let created_options = this.countries;
|
||||
|
||||
// Option set sort_option data
|
||||
if (!Array.isArray(created_options)) {
|
||||
for (const [key, value] of Object.entries(created_options)) {
|
||||
this.sorted_countries.push({
|
||||
key: key.toString(),
|
||||
value: value
|
||||
});
|
||||
}
|
||||
} else {
|
||||
created_options.forEach(function (option, index) {
|
||||
if (typeof(option) == 'string') {
|
||||
this.sorted_countries.push({
|
||||
index: index,
|
||||
key: index.toString(),
|
||||
value: option
|
||||
});
|
||||
} else {
|
||||
this.sorted_countries.push({
|
||||
index: index,
|
||||
key: option.id.toString(),
|
||||
value: (option.title) ? option.title : (option.display_name) ? option.display_name : option.name
|
||||
});
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
},
|
||||
|
||||
onDataWatch(company) {
|
||||
if (Object.keys(company).length) {
|
||||
if (company.logo) {
|
||||
@ -303,6 +372,7 @@ export default {
|
||||
})
|
||||
.then((response) => {
|
||||
this.onSuccessMessage(response);
|
||||
|
||||
this.$router.push("/wizard/currencies");
|
||||
}, this)
|
||||
.catch((error) => {
|
||||
@ -311,6 +381,7 @@ export default {
|
||||
|
||||
next() {
|
||||
if (this.active++ > 2);
|
||||
|
||||
this.$router.push("/wizard/currencies");
|
||||
},
|
||||
},
|
||||
|
@ -20,6 +20,7 @@
|
||||
<i class="fas fa-spinner fa-pulse fa-7x"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-end mb-3">
|
||||
<base-button
|
||||
type="success"
|
||||
@ -52,6 +53,7 @@
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="(item, index) in currencies"
|
||||
@ -273,7 +275,9 @@
|
||||
</div>
|
||||
|
||||
<notifications></notifications>
|
||||
|
||||
<form id="form-dynamic-component" method="POST" action="#"></form>
|
||||
|
||||
<component
|
||||
v-bind:is="component"
|
||||
@deleted="onDeleteCurrency($event)"
|
||||
@ -286,6 +290,7 @@
|
||||
<base-button type="white" native-type="submit" @click="prev()">{{
|
||||
translations.currencies.previous
|
||||
}}</base-button>
|
||||
|
||||
<base-button type="white" native-type="submit" @click="next()">{{
|
||||
translations.currencies.next
|
||||
}}</base-button>
|
||||
|
Reference in New Issue
Block a user