set default country and some styling
This commit is contained in:
parent
9a95426d90
commit
643c907d60
@ -68,8 +68,6 @@ class Companies extends Controller
|
|||||||
$real_key = 'localisation.' . $key;
|
$real_key = 'localisation.' . $key;
|
||||||
break;
|
break;
|
||||||
case 'country':
|
case 'country':
|
||||||
$countries = trans('countries');
|
|
||||||
$value = array_search($value, $countries);
|
|
||||||
$real_key = 'company.' . $key;
|
$real_key = 'company.' . $key;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -99,6 +97,10 @@ class Companies extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
setting()->set($real_key, $value);
|
setting()->set($real_key, $value);
|
||||||
|
|
||||||
|
if ($key == 'country') {
|
||||||
|
setting()->set('default.' . $key, $value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save all settings
|
// Save all settings
|
||||||
|
@ -89,6 +89,7 @@ class CreateCompany extends Job implements HasOwner, HasSource, ShouldCreate
|
|||||||
'company.country' => $this->request->get('country'),
|
'company.country' => $this->request->get('country'),
|
||||||
'default.currency' => $this->request->get('currency'),
|
'default.currency' => $this->request->get('currency'),
|
||||||
'default.locale' => $this->request->get('locale', 'en-GB'),
|
'default.locale' => $this->request->get('locale', 'en-GB'),
|
||||||
|
'default.country' => $this->request->get('country'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (!empty($this->request->settings)) {
|
if (!empty($this->request->settings)) {
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
:modules="modules.data"
|
:modules="modules.data"
|
||||||
:currency_codes="currency_codes"
|
:currency_codes="currency_codes"
|
||||||
:company="company"
|
:company="company"
|
||||||
|
:countries="countries"
|
||||||
:pageLoad="page_loaded"
|
:pageLoad="page_loaded"
|
||||||
></router-view>
|
></router-view>
|
||||||
</template>
|
</template>
|
||||||
@ -17,6 +18,7 @@ export default {
|
|||||||
created() {
|
created() {
|
||||||
this.translations = wizard_translations;
|
this.translations = wizard_translations;
|
||||||
this.company = wizard_company;
|
this.company = wizard_company;
|
||||||
|
this.countries = wizard_countries;
|
||||||
this.currencies = wizard_currencies;
|
this.currencies = wizard_currencies;
|
||||||
this.currency_codes = wizard_currency_codes;
|
this.currency_codes = wizard_currency_codes;
|
||||||
this.taxes = wizard_taxes;
|
this.taxes = wizard_taxes;
|
||||||
@ -38,6 +40,7 @@ export default {
|
|||||||
finish: {},
|
finish: {},
|
||||||
},
|
},
|
||||||
company: {},
|
company: {},
|
||||||
|
countries: {},
|
||||||
currencies: [],
|
currencies: [],
|
||||||
currency_codes: [],
|
currency_codes: [],
|
||||||
taxes: [],
|
taxes: [],
|
||||||
|
@ -54,6 +54,7 @@
|
|||||||
v-model="company.tax_number"
|
v-model="company.tax_number"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<akaunting-date
|
<akaunting-date
|
||||||
:title="translations.company.financial_start"
|
:title="translations.company.financial_start"
|
||||||
@ -69,6 +70,7 @@
|
|||||||
v-model="real_date"
|
v-model="real_date"
|
||||||
></akaunting-date>
|
></akaunting-date>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<base-input :label="translations.company.address">
|
<base-input :label="translations.company.address">
|
||||||
<textarea
|
<textarea
|
||||||
@ -81,28 +83,31 @@
|
|||||||
></textarea>
|
></textarea>
|
||||||
</base-input>
|
</base-input>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<base-input :label="translations.company.country">
|
<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">
|
<template slot="prefix">
|
||||||
<span class="el-input__suffix-inner el-select-icon">
|
<span class="el-input__suffix-inner el-select-icon">
|
||||||
<i :class="'select-icon-position el-input__icon fas fa-globe-americas'"></i>
|
<i :class="'select-icon-position el-input__icon fas fa-globe-americas'"></i>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="(country, index) in country_data"
|
v-for="(country, index) in sortedCountries"
|
||||||
:key="index"
|
:key="index"
|
||||||
:label="country"
|
:label="country.value"
|
||||||
:value="country"
|
:value="country.key"
|
||||||
>
|
>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</base-input>
|
</base-input>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-6 mb-0">
|
<div class="col-6 mb-0">
|
||||||
<label class="form-control-label">{{ translations.company.logo }}</label>
|
<label class="form-control-label">{{ translations.company.logo }}</label>
|
||||||
<akaunting-dropzone-file-upload
|
<akaunting-dropzone-file-upload
|
||||||
ref="dropzoneWizard"
|
ref="dropzoneWizard"
|
||||||
|
class="form-file"
|
||||||
preview-classes="single"
|
preview-classes="single"
|
||||||
:attachments="logo"
|
:attachments="logo"
|
||||||
:v-model="logo"
|
:v-model="logo"
|
||||||
@ -156,6 +161,10 @@ export default {
|
|||||||
type: [Object, Array],
|
type: [Object, Array],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
countries: {
|
||||||
|
type: [Object, Array],
|
||||||
|
},
|
||||||
|
|
||||||
translations: {
|
translations: {
|
||||||
type: [Object, Array],
|
type: [Object, Array],
|
||||||
},
|
},
|
||||||
@ -190,8 +199,7 @@ export default {
|
|||||||
logo: [],
|
logo: [],
|
||||||
real_date: "",
|
real_date: "",
|
||||||
lang_data: '',
|
lang_data: '',
|
||||||
country_data: wizard_country,
|
sorted_countries: [],
|
||||||
model: ''
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -200,11 +208,21 @@ export default {
|
|||||||
let lang_split = document.documentElement.lang.split("-");
|
let lang_split = document.documentElement.lang.split("-");
|
||||||
|
|
||||||
if (lang_split[0] !== 'en') {
|
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() {
|
mounted() {
|
||||||
@ -214,6 +232,57 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
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) {
|
onDataWatch(company) {
|
||||||
if (Object.keys(company).length) {
|
if (Object.keys(company).length) {
|
||||||
if (company.logo) {
|
if (company.logo) {
|
||||||
@ -303,6 +372,7 @@ export default {
|
|||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
this.onSuccessMessage(response);
|
this.onSuccessMessage(response);
|
||||||
|
|
||||||
this.$router.push("/wizard/currencies");
|
this.$router.push("/wizard/currencies");
|
||||||
}, this)
|
}, this)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@ -311,6 +381,7 @@ export default {
|
|||||||
|
|
||||||
next() {
|
next() {
|
||||||
if (this.active++ > 2);
|
if (this.active++ > 2);
|
||||||
|
|
||||||
this.$router.push("/wizard/currencies");
|
this.$router.push("/wizard/currencies");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
<i class="fas fa-spinner fa-pulse fa-7x"></i>
|
<i class="fas fa-spinner fa-pulse fa-7x"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="d-flex justify-content-end mb-3">
|
<div class="d-flex justify-content-end mb-3">
|
||||||
<base-button
|
<base-button
|
||||||
type="success"
|
type="success"
|
||||||
@ -52,6 +53,7 @@
|
|||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr
|
<tr
|
||||||
v-for="(item, index) in currencies"
|
v-for="(item, index) in currencies"
|
||||||
@ -273,7 +275,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<notifications></notifications>
|
<notifications></notifications>
|
||||||
|
|
||||||
<form id="form-dynamic-component" method="POST" action="#"></form>
|
<form id="form-dynamic-component" method="POST" action="#"></form>
|
||||||
|
|
||||||
<component
|
<component
|
||||||
v-bind:is="component"
|
v-bind:is="component"
|
||||||
@deleted="onDeleteCurrency($event)"
|
@deleted="onDeleteCurrency($event)"
|
||||||
@ -286,6 +290,7 @@
|
|||||||
<base-button type="white" native-type="submit" @click="prev()">{{
|
<base-button type="white" native-type="submit" @click="prev()">{{
|
||||||
translations.currencies.previous
|
translations.currencies.previous
|
||||||
}}</base-button>
|
}}</base-button>
|
||||||
|
|
||||||
<base-button type="white" native-type="submit" @click="next()">{{
|
<base-button type="white" native-type="submit" @click="next()">{{
|
||||||
translations.currencies.next
|
translations.currencies.next
|
||||||
}}</base-button>
|
}}</base-button>
|
||||||
|
4
resources/assets/js/wizard.js
vendored
4
resources/assets/js/wizard.js
vendored
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
require('./bootstrap');
|
require('./bootstrap');
|
||||||
|
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
@ -52,9 +51,11 @@ const router = new VueRouter({
|
|||||||
if (savedPosition) {
|
if (savedPosition) {
|
||||||
return savedPosition;
|
return savedPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (to.hash) {
|
if (to.hash) {
|
||||||
return { selector: to.hash };
|
return { selector: to.hash };
|
||||||
}
|
}
|
||||||
|
|
||||||
return { x: 0, y: 0 };
|
return { x: 0, y: 0 };
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -64,4 +65,3 @@ new Vue({
|
|||||||
router,
|
router,
|
||||||
render: h => h(Wizard),
|
render: h => h(Wizard),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var wizard_translations = {!! json_encode($translations) !!};
|
var wizard_translations = {!! json_encode($translations) !!};
|
||||||
var wizard_company = {!! json_encode($company) !!};
|
var wizard_company = {!! json_encode($company) !!};
|
||||||
var wizard_country = {!! json_encode(trans('countries')) !!};
|
var wizard_countries = {!! json_encode(trans('countries')) !!};
|
||||||
var wizard_currencies = {!! json_encode($currencies) !!};
|
var wizard_currencies = {!! json_encode($currencies) !!};
|
||||||
var wizard_currency_codes = {!! json_encode($currency_codes) !!};
|
var wizard_currency_codes = {!! json_encode($currency_codes) !!};
|
||||||
var wizard_taxes = {!! json_encode($taxes) !!};
|
var wizard_taxes = {!! json_encode($taxes) !!};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user