diff --git a/app/View/Components/Layouts/Wizard/Scripts.php b/app/View/Components/Layouts/Wizard/Scripts.php index 7b3de49db..14304ac4d 100644 --- a/app/View/Components/Layouts/Wizard/Scripts.php +++ b/app/View/Components/Layouts/Wizard/Scripts.php @@ -103,6 +103,7 @@ class Scripts extends Component 'name' => trans('general.name'), 'code' => trans('currencies.code'), 'rate' => trans('currencies.rate'), + 'default' => trans('currencies.default'), 'enabled' => trans('general.enabled'), 'actions' => trans('general.actions') , 'yes' => trans('general.yes'), @@ -162,7 +163,15 @@ class Scripts extends Component protected function getCurrencies() { - return Currency::all(); + $currencies = collect(); + + Currency::all()->each(function ($currency) use (&$currencies) { + $currency->default = setting('default.currency') == $currency->code; + + $currencies->push($currency); + }); + + return $currencies; } protected function getCurrencyCodes() diff --git a/public/css/app.css b/public/css/app.css index 5025842c9..c2ca0f4cb 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -48204,6 +48204,10 @@ body{ grid-column: span 7 / span 7; } + .sm\:col-span-12{ + grid-column: span 12 / span 12; + } + .sm\:row-span-2{ grid-row: span 2 / span 2; } @@ -48316,6 +48320,10 @@ body{ grid-template-columns: repeat(8, minmax(0, 1fr)); } + .sm\:grid-cols-12{ + grid-template-columns: repeat(12, minmax(0, 1fr)); + } + .sm\:flex-row{ -webkit-box-orient: horizontal; -webkit-box-direction: normal; diff --git a/resources/assets/js/Wizard.vue b/resources/assets/js/Wizard.vue index 895c91921..9a61e052e 100644 --- a/resources/assets/js/Wizard.vue +++ b/resources/assets/js/Wizard.vue @@ -25,7 +25,7 @@ this.modules = wizard_modules; Object.keys(this.currency_codes).map((key) => { - return this.currency_codes[key]; + return this.currency_codes[key]; }); this.page_loaded = false; @@ -34,10 +34,10 @@ data() { return { translations: { - company: {}, - currencies: {}, - taxes: {}, - finish: {}, + company: {}, + currencies: {}, + taxes: {}, + finish: {}, }, company: {}, countries: {}, diff --git a/resources/assets/js/mixins/wizardAction.js b/resources/assets/js/mixins/wizardAction.js index 478617194..6bac85a7b 100644 --- a/resources/assets/js/mixins/wizardAction.js +++ b/resources/assets/js/mixins/wizardAction.js @@ -8,6 +8,7 @@ export default { name: "", rate: "", select: "", + default_currency: 0, enabled: 1 }, error_field: {}, @@ -15,6 +16,7 @@ export default { button_loading: false, } }, + methods: { onAddItem() { this.new_datas = true; @@ -25,6 +27,8 @@ export default { this.model.name = ''; this.model.rate = ''; this.model.select = ''; + this.model.default = false; + this.model.default_currency = false; } }, @@ -36,6 +40,8 @@ export default { if (this.model) { this.model.name = item.name ? item.name : ''; this.model.rate = item.rate ? item.rate : ''; + this.model.default = item.default ? item.default : false; + this.model.default_currency = item.default ? item.default : false; this.model.select = item.code ? item.code : ''; } }, @@ -50,6 +56,8 @@ export default { this.model.name = ''; this.model.rate = ''; this.model.select = ''; + this.model.default = false; + this.model.default_currency = false; this.model.enabled = 1; }, @@ -74,8 +82,8 @@ export default { }, onDeleteItemMessage(event) { - let type = event.success ? 'success' : 'error'; - let timeout = 1000; + let type = event.success ? 'success' : 'danger'; + let timeout = 5000; if (event.important) { timeout = 0; @@ -84,7 +92,7 @@ export default { this.$notify({ message: event.message, timeout: timeout, - icon: "", + icon: "error_outline", type, }); @@ -108,6 +116,10 @@ export default { }); } + if (data.default_currency) { + data.rate = 1; + } + window.axios({ method: form_method, url: form_url, @@ -125,7 +137,7 @@ export default { }); } - if(form_method == 'PATCH') { + if (form_method == 'PATCH') { form_list.forEach(item => { if (item.id == form_id) { item.name = response.data.data.name; @@ -135,6 +147,7 @@ export default { }); } } + this.onSuccessMessage(response); }, this) .catch(error => { @@ -145,20 +158,23 @@ export default { onEjetItem(event, form_list, event_id) { form_list.forEach(function (item, index) { if (item.id == event_id) { - form_list.splice(index, 1); - return; - } - }, this); + form_list.splice(index, 1); - this.component = ""; - document.body.classList.remove("overflow-hidden"); - this.onDeleteItemMessage(event); + return; + } + }, this); + + this.component = ""; + document.body.classList.remove("overflow-hidden"); + + this.onDeleteItemMessage(event); }, onFailErrorGet(field_name) { - if(this.error_field[field_name]) { + if (this.error_field[field_name]) { return this.error_field[field_name][0]; } + this.button_loading = false; }, diff --git a/resources/assets/js/views/wizard/Company.vue b/resources/assets/js/views/wizard/Company.vue index d7d88b4a6..23995a026 100644 --- a/resources/assets/js/views/wizard/Company.vue +++ b/resources/assets/js/views/wizard/Company.vue @@ -119,271 +119,273 @@ - + diff --git a/resources/assets/js/views/wizard/Currencies.vue b/resources/assets/js/views/wizard/Currencies.vue index 63005fd4d..76055a0e3 100644 --- a/resources/assets/js/views/wizard/Currencies.vue +++ b/resources/assets/js/views/wizard/Currencies.vue @@ -9,7 +9,7 @@ - -
+ + diff --git a/resources/views/components/form/group/toggle.blade.php b/resources/views/components/form/group/toggle.blade.php index 6fc6cc63d..1bd1459b2 100644 --- a/resources/views/components/form/group/toggle.blade.php +++ b/resources/views/components/form/group/toggle.blade.php @@ -11,27 +11,27 @@
@if (empty($attributes['disabled'])) - + @else - + @endif @if (empty($attributes['disabled'])) - + @else - + @endif
diff --git a/resources/views/components/layouts/wizard/scripts.blade.php b/resources/views/components/layouts/wizard/scripts.blade.php index 70a228087..0f0a2ab25 100644 --- a/resources/views/components/layouts/wizard/scripts.blade.php +++ b/resources/views/components/layouts/wizard/scripts.blade.php @@ -1,6 +1,8 @@ @stack('scripts_start') + +