From 4c4909592845f534fadcfdcc3abab1208df2d7ed Mon Sep 17 00:00:00 2001 From: Burak Civan Date: Sat, 29 May 2021 17:01:22 +0300 Subject: [PATCH] Unusage codes and files ejected --- app/Http/Controllers/Settings/Settings.php | 19 ++- .../{views/wizard => mixins}/wizardAction.js | 0 resources/assets/js/views/wizard/Company.vue | 2 +- .../assets/js/views/wizard/Currencies.vue | 3 +- resources/assets/js/views/wizard/Taxes.vue | 2 +- resources/assets/js/views/wizard/company.js | 44 ------- .../assets/js/views/wizard/currencies.js | 114 ------------------ resources/assets/js/views/wizard/finish.js | 41 ------- resources/assets/js/views/wizard/taxes.js | 87 ------------- webpack.mix.js | 6 - 10 files changed, 19 insertions(+), 299 deletions(-) rename resources/assets/js/{views/wizard => mixins}/wizardAction.js (100%) delete mode 100644 resources/assets/js/views/wizard/company.js delete mode 100644 resources/assets/js/views/wizard/currencies.js delete mode 100644 resources/assets/js/views/wizard/finish.js delete mode 100644 resources/assets/js/views/wizard/taxes.js diff --git a/app/Http/Controllers/Settings/Settings.php b/app/Http/Controllers/Settings/Settings.php index 9b80174c4..f84bfd6a7 100644 --- a/app/Http/Controllers/Settings/Settings.php +++ b/app/Http/Controllers/Settings/Settings.php @@ -16,10 +16,12 @@ class Settings extends Controller { use DateTime, Uploads; - public $skip_keys = ['company_id', '_method', '_token', '_prefix', 'uploaded_logo']; + public $skip_keys = ['company_id', '_method', '_token', '_prefix']; public $file_keys = ['company.logo', 'invoice.logo']; + public $uploaded_file_keys = ['company.uploaded_logo', 'invoice.uploaded_logo']; + /** * Show the form for editing the specified resource. * @@ -95,6 +97,11 @@ class Settings extends Controller continue; } + // change dropzone middleware already uploaded file + if (in_array($real_key, $this->uploaded_file_keys)) { + continue; + } + // Process file uploads if (in_array($real_key, $this->file_keys)) { // Upload attachment @@ -113,6 +120,10 @@ class Settings extends Controller } if ($real_key == 'default.locale') { + if (!in_array($value, config('language.allowed'))) { + continue; + } + user()->setAttribute('locale', $value)->save(); } @@ -156,14 +167,14 @@ class Settings extends Controller Installer::updateEnv(['MAIL_FROM_NAME' => '"' . $value . '"']); break; case 'company.email': - Installer::updateEnv(['MAIL_FROM_ADDRESS' => $value]); + Installer::updateEnv(['MAIL_FROM_ADDRESS' => '"' . $value . '"']); break; case 'default.locale': - Installer::updateEnv(['APP_LOCALE' => $value]); + Installer::updateEnv(['APP_LOCALE' => '"' . $value . '"']); break; case 'schedule.time': Installer::updateEnv(['APP_SCHEDULE_TIME' => '"' . $value . '"']); break; } } -} +} \ No newline at end of file diff --git a/resources/assets/js/views/wizard/wizardAction.js b/resources/assets/js/mixins/wizardAction.js similarity index 100% rename from resources/assets/js/views/wizard/wizardAction.js rename to resources/assets/js/mixins/wizardAction.js diff --git a/resources/assets/js/views/wizard/Company.vue b/resources/assets/js/views/wizard/Company.vue index 8bda62a6c..fa9f484ec 100644 --- a/resources/assets/js/views/wizard/Company.vue +++ b/resources/assets/js/views/wizard/Company.vue @@ -112,7 +112,7 @@ import { Step, Steps } from "element-ui"; import AkauntingDropzoneFileUpload from "./../../components/AkauntingDropzoneFileUpload"; import AkauntingDate from "./../../components/AkauntingDate"; -import WizardAction from "./wizardAction"; +import WizardAction from "./../../mixins/wizardAction"; export default { name: "Company", diff --git a/resources/assets/js/views/wizard/Currencies.vue b/resources/assets/js/views/wizard/Currencies.vue index 6dea7923c..3323360c2 100644 --- a/resources/assets/js/views/wizard/Currencies.vue +++ b/resources/assets/js/views/wizard/Currencies.vue @@ -296,7 +296,7 @@ import { Step, Steps, Select, Option } from "element-ui"; import AkauntingRadioGroup from "./../../components/forms/AkauntingRadioGroup"; import BulkAction from "./../../plugins/bulk-action"; import MixinsGlobal from "./../../mixins/global"; -import WizardAction from "./wizardAction"; +import WizardAction from "./../../mixins/wizardAction"; export default { name: "Currencies", @@ -409,6 +409,7 @@ export default { prev() { if (this.active-- > 2); + history.back() this.$router.push("/wizard/companies"); }, diff --git a/resources/assets/js/views/wizard/Taxes.vue b/resources/assets/js/views/wizard/Taxes.vue index f2e809f14..bc6e311b4 100644 --- a/resources/assets/js/views/wizard/Taxes.vue +++ b/resources/assets/js/views/wizard/Taxes.vue @@ -226,7 +226,7 @@ import { Step, Steps } from "element-ui"; import AkauntingRadioGroup from "./../../components/forms/AkauntingRadioGroup"; import BulkAction from "./../../plugins/bulk-action"; import MixinsGlobal from "./../../mixins/global"; -import WizardAction from "./wizardAction"; +import WizardAction from "./../../mixins/wizardAction"; export default { name: "Taxes", diff --git a/resources/assets/js/views/wizard/company.js b/resources/assets/js/views/wizard/company.js deleted file mode 100644 index a982c5005..000000000 --- a/resources/assets/js/views/wizard/company.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * First we will load all of this project's JavaScript dependencies which - * includes Vue and other libraries. It is a great starting point when - * building robust, powerful web applications using Vue and Laravel. - */ - -require('./../../bootstrap'); - -import Vue from 'vue'; - -import DashboardPlugin from './../../plugins/dashboard-plugin'; - -import Global from './../../mixins/global'; - -import Form from './../../plugins/form'; - -import {Step, Steps} from 'element-ui'; - -// plugin setup -Vue.use(DashboardPlugin, Step, Steps); - -const app = new Vue({ - el: '#app', - - mixins: [ - Global - ], - - components: { - [Step.name]: Step, - [Steps.name]: Steps, - }, - - data: function () { - return { - form: new Form('company'), - active: 0 - } - }, - - methods: { - - } -}); diff --git a/resources/assets/js/views/wizard/currencies.js b/resources/assets/js/views/wizard/currencies.js deleted file mode 100644 index 9287755ef..000000000 --- a/resources/assets/js/views/wizard/currencies.js +++ /dev/null @@ -1,114 +0,0 @@ -/** - * First we will load all of this project's JavaScript dependencies which - * includes Vue and other libraries. It is a great starting point when - * building robust, powerful web applications using Vue and Laravel. - */ - -require('../../bootstrap'); - -import Vue from 'vue'; - -import DashboardPlugin from './../../plugins/dashboard-plugin'; - -import Global from '../../mixins/global'; - -import Form from '../../plugins/form'; -import BulkAction from './../../plugins/bulk-action'; - -import {Step, Steps} from 'element-ui'; - -// plugin setup -Vue.use(DashboardPlugin, Step, Steps); - -const app = new Vue({ - el: '#app', - - mixins: [ - Global - ], - - components: { - [Step.name]: Step, - [Steps.name]: Steps, - }, - - data: function () { - return { - form: new Form('currency'), - active: 1, - bulk_action: new BulkAction(url + '/settings/currencies'), - show: false, - currency: { - name: '', - code: '', - rate: '1', - enabled: 1 - }, - submit_function: '', - } - }, - - methods: { - onAddCurrency() { - this.submit_function = 'onStoreCurrency'; - this.form.method = 'post'; - this.form.action = url + '/wizard/currencies'; - - this.form.name = ''; - this.form.code = ''; - this.form.rate = ''; - this.form.enabled = 1; - this.form.precision = ''; - this.form.symbol = ''; - this.form.symbol_first = ''; - this.form.decimal_mark = ''; - this.form.thousands_separator = ''; - - this.show = true; - }, - - onEditCurrency(currency_id) { - this.submit_function = 'onUpdateCurrency'; - this.form.method = 'patch'; - this.form.action = url + '/wizard/currencies/' + currency_id; - - currencies.forEach(currency => { - if (currency.id == currency_id) { - this.form.name = currency.name; - this.form.code = currency.code; - this.form.rate = currency.rate; - this.form.enabled = currency.enabled; - this.form.precision = currency.precision; - this.form.symbol = currency.symbol; - this.form.symbol_first = currency.symbol_first; - this.form.decimal_mark = currency.decimal_mark; - this.form.thousands_separator = currency.thousands_separator; - } - }); - - this.show = true; - }, - - onChangeCode(code) { - axios.get(url + '/settings/currencies/config', { - params: { - code: code - } - }) - .then(response => { - this.form.rate = response.data.rate; - this.form.precision = response.data.precision; - this.form.symbol = response.data.symbol; - this.form.symbol_first = response.data.symbol_first; - this.form.decimal_mark = response.data.decimal_mark; - this.form.thousands_separator = response.data.thousands_separator; - }) - .catch(error => { - }); - }, - - onSubmit() { - this.form.oldSubmit(); - }, - } -}); diff --git a/resources/assets/js/views/wizard/finish.js b/resources/assets/js/views/wizard/finish.js deleted file mode 100644 index 090fb9857..000000000 --- a/resources/assets/js/views/wizard/finish.js +++ /dev/null @@ -1,41 +0,0 @@ -/** - * First we will load all of this project's JavaScript dependencies which - * includes Vue and other libraries. It is a great starting point when - * building robust, powerful web applications using Vue and Laravel. - */ - -require('./../../bootstrap'); - -import Vue from 'vue'; - -import DashboardPlugin from './../../plugins/dashboard-plugin'; - -import Global from './../../mixins/global'; - -import {Step, Steps} from 'element-ui'; - -// plugin setup -Vue.use(DashboardPlugin, Step, Steps); - -const app = new Vue({ - el: '#app', - - mixins: [ - Global - ], - - components: { - [Step.name]: Step, - [Steps.name]: Steps, - }, - - data: function () { - return { - active: 3, - } - }, - - methods: { - - } -}); diff --git a/resources/assets/js/views/wizard/taxes.js b/resources/assets/js/views/wizard/taxes.js deleted file mode 100644 index 6eace74ed..000000000 --- a/resources/assets/js/views/wizard/taxes.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * First we will load all of this project's JavaScript dependencies which - * includes Vue and other libraries. It is a great starting point when - * building robust, powerful web applications using Vue and Laravel. - */ - - require('../../bootstrap'); - - import Vue from 'vue'; - - import DashboardPlugin from './../../plugins/dashboard-plugin'; - - import Global from '../../mixins/global'; - - import Form from '../../plugins/form'; - import BulkAction from './../../plugins/bulk-action'; - - import {Step, Steps} from 'element-ui'; - - // plugin setup - Vue.use(DashboardPlugin, Step, Steps); - - const app = new Vue({ - el: '#app', - - mixins: [ - Global - ], - - components: { - [Step.name]: Step, - [Steps.name]: Steps, - }, - - data: function () { - return { - form: new Form('tax'), - active: 2, - bulk_action: new BulkAction(url + '/settings/taxes'), - show: false, - tax: { - name: '', - code: '', - type: 'normal', - enabled: 1 - }, - submit_function: '' - } - }, - - methods: { - onAddTax() { - this.submit_function = 'onStoreTax'; - this.form.method = 'post'; - this.form.action = url + '/wizard/taxes'; - - this.form.name = ''; - this.form.rate = ''; - this.form.type = 'normal'; - this.form.enabled = 1; - - this.show = true; - }, - - onEditTax(tax_id) { - this.submit_function = 'onUpdateTax'; - this.form.method = 'patch'; - this.form.action = url + '/wizard/taxes/' + tax_id; - - taxes.forEach(tax => { - if (tax.id == tax_id) { - this.form.name = tax.name; - this.form.rate = tax.rate; - this.form.type = tax.type; - this.form.enabled = tax.enabled; - } - }); - - this.show = true; - }, - - onSubmit() { - this.form.oldSubmit(); - }, - } - }); - \ No newline at end of file diff --git a/webpack.mix.js b/webpack.mix.js index 7ae4d9eeb..35859fefd 100644 --- a/webpack.mix.js +++ b/webpack.mix.js @@ -78,10 +78,4 @@ mix .js('resources/assets/js/views/settings/settings.js', 'public/js/settings') .js('resources/assets/js/views/settings/taxes.js', 'public/js/settings') - // Wizard - .js('resources/assets/js/views/wizard/company.js', 'public/js/wizard') - .js('resources/assets/js/views/wizard/currencies.js', 'public/js/wizard') - .js('resources/assets/js/views/wizard/taxes.js', 'public/js/wizard') - .js('resources/assets/js/views/wizard/finish.js', 'public/js/wizard') - .sass('resources/assets/sass/argon.scss', 'public/css');