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)) {
|
||||||
|
@ -1,121 +1,124 @@
|
|||||||
<template>
|
<template>
|
||||||
<router-view
|
<router-view
|
||||||
:translations="translations"
|
:translations="translations"
|
||||||
:currencies="currencies"
|
:currencies="currencies"
|
||||||
:taxes="taxes"
|
:taxes="taxes"
|
||||||
:modules="modules.data"
|
:modules="modules.data"
|
||||||
:currency_codes="currency_codes"
|
:currency_codes="currency_codes"
|
||||||
:company="company"
|
:company="company"
|
||||||
:pageLoad="page_loaded"
|
:countries="countries"
|
||||||
></router-view>
|
:pageLoad="page_loaded"
|
||||||
|
></router-view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: "Wizard",
|
name: "Wizard",
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.translations = wizard_translations;
|
this.translations = wizard_translations;
|
||||||
this.company = wizard_company;
|
this.company = wizard_company;
|
||||||
this.currencies = wizard_currencies;
|
this.countries = wizard_countries;
|
||||||
this.currency_codes = wizard_currency_codes;
|
this.currencies = wizard_currencies;
|
||||||
this.taxes = wizard_taxes;
|
this.currency_codes = wizard_currency_codes;
|
||||||
this.modules = wizard_modules;
|
this.taxes = wizard_taxes;
|
||||||
|
this.modules = wizard_modules;
|
||||||
|
|
||||||
Object.keys(this.currency_codes).map((key) => {
|
Object.keys(this.currency_codes).map((key) => {
|
||||||
return this.currency_codes[key];
|
return this.currency_codes[key];
|
||||||
});
|
});
|
||||||
|
|
||||||
this.page_loaded = false;
|
this.page_loaded = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
translations: {
|
translations: {
|
||||||
company: {},
|
company: {},
|
||||||
currencies: {},
|
currencies: {},
|
||||||
taxes: {},
|
taxes: {},
|
||||||
finish: {},
|
finish: {},
|
||||||
},
|
},
|
||||||
company: {},
|
company: {},
|
||||||
currencies: [],
|
countries: {},
|
||||||
currency_codes: [],
|
currencies: [],
|
||||||
taxes: [],
|
currency_codes: [],
|
||||||
modules: {},
|
taxes: [],
|
||||||
page_loaded: true
|
modules: {},
|
||||||
|
page_loaded: true
|
||||||
|
};
|
||||||
|
},
|
||||||
};
|
};
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.document-loading {
|
.document-loading {
|
||||||
width: 1140px;
|
width: 1140px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
top: 0;
|
top: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.document-loading div {
|
.document-loading div {
|
||||||
margin-top: unset;
|
margin-top: unset;
|
||||||
margin-left: unset;
|
margin-left: unset;
|
||||||
}
|
}
|
||||||
|
|
||||||
.current-tab {
|
.current-tab {
|
||||||
background-color: #f6f9fc;
|
background-color: #f6f9fc;
|
||||||
}
|
|
||||||
|
|
||||||
.current-tab-btn {
|
|
||||||
text-align: right;
|
|
||||||
padding: 0 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-container {
|
|
||||||
flex-flow: row wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-container .invalid-feedback {
|
|
||||||
position: absolute;
|
|
||||||
bottom: -18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-container .has-error {
|
|
||||||
position: relative;
|
|
||||||
margin-bottom: unset !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-container .has-error .form-control {
|
|
||||||
border-top-right-radius: 5px;
|
|
||||||
border-bottom-right-radius: 5px;
|
|
||||||
border-right: 1px solid;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-step__icon {
|
|
||||||
-webkit-transition: unset;
|
|
||||||
transition: unset;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: 991px) {
|
|
||||||
.form-container .has-error {
|
|
||||||
position: relative;
|
|
||||||
margin-bottom: 1.5rem !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.current-tab-btn {
|
.current-tab-btn {
|
||||||
padding: 0 15px;
|
text-align: right;
|
||||||
|
padding: 0 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-container {
|
.form-container {
|
||||||
flex-direction: column;
|
flex-flow: row wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-container .form-group {
|
.form-container .invalid-feedback {
|
||||||
width: 100%;
|
position: absolute;
|
||||||
|
bottom: -18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-container .has-error {
|
||||||
|
position: relative;
|
||||||
|
margin-bottom: unset !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-container .has-error .form-control {
|
||||||
|
border-top-right-radius: 5px;
|
||||||
|
border-bottom-right-radius: 5px;
|
||||||
|
border-right: 1px solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-step__icon {
|
||||||
|
-webkit-transition: unset;
|
||||||
|
transition: unset;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 991px) {
|
||||||
|
.form-container .has-error {
|
||||||
|
position: relative;
|
||||||
|
margin-bottom: 1.5rem !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.current-tab-btn {
|
||||||
|
padding: 0 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-container {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-container .form-group {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -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,21 +199,30 @@ export default {
|
|||||||
logo: [],
|
logo: [],
|
||||||
real_date: "",
|
real_date: "",
|
||||||
lang_data: '',
|
lang_data: '',
|
||||||
country_data: wizard_country,
|
sorted_countries: [],
|
||||||
model: ''
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
if(document.documentElement.lang) {
|
if (document.documentElement.lang) {
|
||||||
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>
|
||||||
|
80
resources/assets/js/wizard.js
vendored
80
resources/assets/js/wizard.js
vendored
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
require('./bootstrap');
|
require('./bootstrap');
|
||||||
|
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
@ -21,47 +20,48 @@ const router = new VueRouter({
|
|||||||
mode: 'history',
|
mode: 'history',
|
||||||
base: base_path,
|
base: base_path,
|
||||||
routes: [
|
routes: [
|
||||||
{
|
{
|
||||||
path: '/wizard',
|
path: '/wizard',
|
||||||
name: 'Wizard',
|
name: 'Wizard',
|
||||||
component: Company
|
component: Company
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/wizard/companies',
|
path: '/wizard/companies',
|
||||||
name: 'Company',
|
name: 'Company',
|
||||||
component: Company
|
component: Company
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/wizard/currencies',
|
path: '/wizard/currencies',
|
||||||
name: 'Currencies',
|
name: 'Currencies',
|
||||||
component: Currencies
|
component: Currencies
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/wizard/taxes',
|
path: '/wizard/taxes',
|
||||||
name: 'Taxes',
|
name: 'Taxes',
|
||||||
component: Taxes
|
component: Taxes
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/wizard/finish',
|
path: '/wizard/finish',
|
||||||
name: 'Finish',
|
name: 'Finish',
|
||||||
component: Finish
|
component: Finish
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
linkActiveClass: 'active',
|
linkActiveClass: 'active',
|
||||||
scrollBehavior: (to, from ,savedPosition) => {
|
scrollBehavior: (to, from ,savedPosition) => {
|
||||||
if (savedPosition) {
|
if (savedPosition) {
|
||||||
return savedPosition;
|
return savedPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (to.hash) {
|
||||||
|
return { selector: to.hash };
|
||||||
|
}
|
||||||
|
|
||||||
|
return { x: 0, y: 0 };
|
||||||
}
|
}
|
||||||
if (to.hash) {
|
|
||||||
return { selector: to.hash };
|
|
||||||
}
|
|
||||||
return { x: 0, y: 0 };
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
new Vue({
|
new Vue({
|
||||||
el : '#app',
|
el : '#app',
|
||||||
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