diff --git a/app/Http/Controllers/Api/Auth/Permissions.php b/app/Http/Controllers/Api/Auth/Permissions.php index 530d24c2a..76b242ae5 100644 --- a/app/Http/Controllers/Api/Auth/Permissions.php +++ b/app/Http/Controllers/Api/Auth/Permissions.php @@ -32,7 +32,7 @@ class Permissions extends ApiController */ public function show(Permission $permission) { - return $this->response->item($permission, new Transformer()); + return $this->item($permission, new Transformer()); } /** @@ -45,7 +45,7 @@ class Permissions extends ApiController { $permission = $this->dispatch(new CreatePermission($request)); - return $this->response->created(route('api.permissions.show', $permission->id)); + return $this->response->created(route('api.permissions.show', $permission->id), $this->item($permission, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Auth/Roles.php b/app/Http/Controllers/Api/Auth/Roles.php index d9ad12c2c..fc88fc5ab 100644 --- a/app/Http/Controllers/Api/Auth/Roles.php +++ b/app/Http/Controllers/Api/Auth/Roles.php @@ -32,7 +32,7 @@ class Roles extends ApiController */ public function show(Role $role) { - return $this->response->item($role, new Transformer()); + return $this->item($role, new Transformer()); } /** @@ -45,7 +45,7 @@ class Roles extends ApiController { $role = $this->dispatch(new CreateRole($request)); - return $this->response->created(route('api.roles.show', $role->id)); + return $this->response->created(route('api.roles.show', $role->id), $this->item($role, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Auth/Users.php b/app/Http/Controllers/Api/Auth/Users.php index 6f4987b32..0610b6c64 100644 --- a/app/Http/Controllers/Api/Auth/Users.php +++ b/app/Http/Controllers/Api/Auth/Users.php @@ -39,7 +39,7 @@ class Users extends ApiController $user = User::with('companies', 'permissions', 'roles')->where('email', $id)->first(); } - return $this->response->item($user, new Transformer()); + return $this->item($user, new Transformer()); } /** @@ -52,7 +52,7 @@ class Users extends ApiController { $user = $this->dispatch(new CreateUser($request)); - return $this->response->created(route('api.users.show', $user->id)); + return $this->response->created(route('api.users.show', $user->id), $this->item($user, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Banking/Accounts.php b/app/Http/Controllers/Api/Banking/Accounts.php index 9b1490583..6471ef077 100644 --- a/app/Http/Controllers/Api/Banking/Accounts.php +++ b/app/Http/Controllers/Api/Banking/Accounts.php @@ -39,7 +39,7 @@ class Accounts extends ApiController $account = Account::where('number', $id)->first(); } - return $this->response->item($account, new Transformer()); + return $this->item($account, new Transformer()); } /** @@ -52,7 +52,7 @@ class Accounts extends ApiController { $account = $this->dispatch(new CreateAccount($request)); - return $this->response->created(route('api.accounts.show', $account->id)); + return $this->response->created(route('api.accounts.show', $account->id), $this->item($account, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Banking/Reconciliations.php b/app/Http/Controllers/Api/Banking/Reconciliations.php index e45d53d21..e4f2e2936 100644 --- a/app/Http/Controllers/Api/Banking/Reconciliations.php +++ b/app/Http/Controllers/Api/Banking/Reconciliations.php @@ -32,7 +32,7 @@ class Reconciliations extends ApiController */ public function show(Reconciliation $reconciliation) { - return $this->response->item($reconciliation, new Transformer()); + return $this->item($reconciliation, new Transformer()); } /** @@ -45,7 +45,7 @@ class Reconciliations extends ApiController { $reconciliation = $this->dispatch(new CreateReconciliation($request)); - return $this->response->created(route('api.reconciliations.show', $reconciliation->id)); + return $this->response->created(route('api.reconciliations.show', $reconciliation->id), $this->item($reconciliation, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Banking/Transactions.php b/app/Http/Controllers/Api/Banking/Transactions.php index 7ad0175d9..6861130ea 100644 --- a/app/Http/Controllers/Api/Banking/Transactions.php +++ b/app/Http/Controllers/Api/Banking/Transactions.php @@ -32,7 +32,7 @@ class Transactions extends ApiController */ public function show(Transaction $transaction) { - return $this->response->item($transaction, new Transformer()); + return $this->item($transaction, new Transformer()); } /** @@ -45,7 +45,7 @@ class Transactions extends ApiController { $transaction = $this->dispatch(new CreateTransaction($request)); - return $this->response->created(route('api.transactions.show', $transaction->id)); + return $this->response->created(route('api.transactions.show', $transaction->id), $this->item($transaction, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Banking/Transfers.php b/app/Http/Controllers/Api/Banking/Transfers.php index 41e41ce9e..841926940 100644 --- a/app/Http/Controllers/Api/Banking/Transfers.php +++ b/app/Http/Controllers/Api/Banking/Transfers.php @@ -62,7 +62,7 @@ class Transfers extends ApiController */ public function show(Transfer $transfer) { - return $this->response->item($transfer, new Transformer()); + return $this->item($transfer, new Transformer()); } /** @@ -75,7 +75,7 @@ class Transfers extends ApiController { $transfer = $this->dispatch(new CreateTransfer($request)); - return $this->response->created(route('api.transfers.show', $transfer->id)); + return $this->response->created(route('api.transfers.show', $transfer->id), $this->item($transfer, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Common/Companies.php b/app/Http/Controllers/Api/Common/Companies.php index 4f5b8a5a3..022b09842 100644 --- a/app/Http/Controllers/Api/Common/Companies.php +++ b/app/Http/Controllers/Api/Common/Companies.php @@ -40,7 +40,7 @@ class Companies extends ApiController // Check if user can access company $this->canAccess($company); - return $this->response->item($company, new Transformer()); + return $this->item($company, new Transformer()); } catch (\Exception $e) { $this->response->errorUnauthorized($e->getMessage()); } @@ -56,7 +56,7 @@ class Companies extends ApiController { $company = $this->dispatch(new CreateCompany($request)); - return $this->response->created(route('api.companies.show', $company->id)); + return $this->response->created(route('api.companies.show', $company->id), $this->item($company, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Common/Contacts.php b/app/Http/Controllers/Api/Common/Contacts.php index b8ea62159..8a5a00790 100644 --- a/app/Http/Controllers/Api/Common/Contacts.php +++ b/app/Http/Controllers/Api/Common/Contacts.php @@ -42,7 +42,7 @@ class Contacts extends ApiController $contact = Contact::where('email', $id)->first(); } - return $this->response->item($contact, new Transformer()); + return $this->item($contact, new Transformer()); } /** @@ -55,7 +55,7 @@ class Contacts extends ApiController { $contact = $this->dispatch(new CreateContact($request)); - return $this->response->created(route('api.contacts.show', $contact->id)); + return $this->response->created(route('api.contacts.show', $contact->id), $this->item($contact, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Common/Dashboards.php b/app/Http/Controllers/Api/Common/Dashboards.php index 4a50ec90f..0dba14271 100644 --- a/app/Http/Controllers/Api/Common/Dashboards.php +++ b/app/Http/Controllers/Api/Common/Dashboards.php @@ -42,7 +42,7 @@ class Dashboards extends ApiController // Check if user can access dashboard $this->canAccess($dashboard); - return $this->response->item($dashboard, new Transformer()); + return $this->item($dashboard, new Transformer()); } catch (\Exception $e) { $this->response->errorUnauthorized($e->getMessage()); } @@ -58,7 +58,7 @@ class Dashboards extends ApiController { $dashboard = $this->dispatch(new CreateDashboard($request)); - return $this->response->created(route('api.dashboards.show', $dashboard->id)); + return $this->response->created(route('api.dashboards.show', $dashboard->id), $this->item($dashboard, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Common/Items.php b/app/Http/Controllers/Api/Common/Items.php index 5910ac2b1..bbe05a16a 100644 --- a/app/Http/Controllers/Api/Common/Items.php +++ b/app/Http/Controllers/Api/Common/Items.php @@ -34,7 +34,7 @@ class Items extends ApiController { $item = Item::with('category', 'taxes')->find($id); - return $this->response->item($item, new Transformer()); + return $this->item($item, new Transformer()); } /** @@ -47,7 +47,7 @@ class Items extends ApiController { $item = $this->dispatch(new CreateItem($request)); - return $this->response->created(route('api.items.show', $item->id)); + return $this->response->created(route('api.items.show', $item->id), $this->item($item, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Common/Reports.php b/app/Http/Controllers/Api/Common/Reports.php index 162529be3..0a402e90b 100644 --- a/app/Http/Controllers/Api/Common/Reports.php +++ b/app/Http/Controllers/Api/Common/Reports.php @@ -32,7 +32,7 @@ class Reports extends ApiController */ public function show(Report $report) { - return $this->response->item($report, new Transformer()); + return $this->item($report, new Transformer()); } /** @@ -45,7 +45,7 @@ class Reports extends ApiController { $report = $this->dispatch(new CreateReport($request)); - return $this->response->created(route('api.reports.show', $report->id)); + return $this->response->created(route('api.reports.show', $report->id), $this->item($report, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Document/DocumentTransactions.php b/app/Http/Controllers/Api/Document/DocumentTransactions.php index 9ed91490a..59f61f372 100644 --- a/app/Http/Controllers/Api/Document/DocumentTransactions.php +++ b/app/Http/Controllers/Api/Document/DocumentTransactions.php @@ -48,7 +48,7 @@ class DocumentTransactions extends ApiController { $transaction = Transaction::documentId($document_id)->find($id); - return $this->response->item($transaction, new Transformer()); + return $this->item($transaction, new Transformer()); } /** @@ -64,7 +64,7 @@ class DocumentTransactions extends ApiController $transaction = $this->dispatch(new CreateBankingDocumentTransaction($document, $request)); - return $this->response->created(route('api.documents.transactions.show', [$document_id, $transaction->id])); + return $this->response->created(route('api.documents.transactions.show', [$document_id, $transaction->id]), $this->item($transaction, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Document/Documents.php b/app/Http/Controllers/Api/Document/Documents.php index f77fcdd5e..032934af8 100644 --- a/app/Http/Controllers/Api/Document/Documents.php +++ b/app/Http/Controllers/Api/Document/Documents.php @@ -39,7 +39,7 @@ class Documents extends ApiController $document = Document::where('document_number', $id)->first(); } - return $this->response->item($document, new Transformer()); + return $this->item($document, new Transformer()); } /** @@ -53,7 +53,7 @@ class Documents extends ApiController { $document = $this->dispatch(new CreateDocument($request)); - return $this->response->created(route('api.documents.show', $document->id)); + return $this->response->created(route('api.documents.show', $document->id), $this->item($document, new Transformer())); } /** @@ -68,7 +68,7 @@ class Documents extends ApiController { $document = $this->dispatch(new UpdateDocument($document, $request)); - return $this->response->item($document->fresh(), new Transformer()); + return $this->item($document->fresh(), new Transformer()); } /** diff --git a/app/Http/Controllers/Api/Settings/Categories.php b/app/Http/Controllers/Api/Settings/Categories.php index 5fb18c698..35fe3b831 100644 --- a/app/Http/Controllers/Api/Settings/Categories.php +++ b/app/Http/Controllers/Api/Settings/Categories.php @@ -32,7 +32,7 @@ class Categories extends ApiController */ public function show(Category $category) { - return $this->response->item($category, new Transformer()); + return $this->item($category, new Transformer()); } /** @@ -45,7 +45,7 @@ class Categories extends ApiController { $category = $this->dispatch(new CreateCategory($request)); - return $this->response->created(route('api.categories.show', $category->id)); + return $this->response->created(route('api.categories.show', $category->id), $this->item($category, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Settings/Currencies.php b/app/Http/Controllers/Api/Settings/Currencies.php index e867d9838..f518074c9 100644 --- a/app/Http/Controllers/Api/Settings/Currencies.php +++ b/app/Http/Controllers/Api/Settings/Currencies.php @@ -39,7 +39,7 @@ class Currencies extends ApiController $currency = Currency::where('code', $id)->first(); } - return $this->response->item($currency, new Transformer()); + return $this->item($currency, new Transformer()); } /** @@ -52,7 +52,7 @@ class Currencies extends ApiController { $currency = $this->dispatch(new CreateCurrency($request)); - return $this->response->created(route('api.currencies.show', $currency->id)); + return $this->response->created(route('api.currencies.show', $currency->id), $this->item($currency, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Settings/Settings.php b/app/Http/Controllers/Api/Settings/Settings.php index 6454bbb46..ebaa7f0a6 100644 --- a/app/Http/Controllers/Api/Settings/Settings.php +++ b/app/Http/Controllers/Api/Settings/Settings.php @@ -39,7 +39,7 @@ class Settings extends ApiController $setting = Setting::where('key', $id)->first(); } - return $this->response->item($setting, new Transformer()); + return $this->item($setting, new Transformer()); } /** @@ -52,7 +52,7 @@ class Settings extends ApiController { $setting = Setting::create($request->all()); - return $this->response->created(route('api.settings.show', $setting->id)); + return $this->response->created(route('api.settings.show', $setting->id), $this->item($setting, new Transformer())); } /** @@ -66,7 +66,7 @@ class Settings extends ApiController { $setting->update($request->all()); - return $this->response->item($setting->fresh(), new Transformer()); + return $this->item($setting->fresh(), new Transformer()); } /** diff --git a/app/Http/Controllers/Api/Settings/Taxes.php b/app/Http/Controllers/Api/Settings/Taxes.php index fcbba72b7..279768643 100644 --- a/app/Http/Controllers/Api/Settings/Taxes.php +++ b/app/Http/Controllers/Api/Settings/Taxes.php @@ -32,7 +32,7 @@ class Taxes extends ApiController */ public function show(Tax $tax) { - return $this->response->item($tax, new Transformer()); + return $this->item($tax, new Transformer()); } /** @@ -45,7 +45,7 @@ class Taxes extends ApiController { $tax = $this->dispatch(new CreateTax($request)); - return $this->response->created(route('api.taxes.show', $tax->id)); + return $this->response->created(route('api.taxes.show', $tax->id), $this->item($tax, new Transformer())); } /** diff --git a/app/Http/Controllers/Wizard/Data.php b/app/Http/Controllers/Wizard/Data.php index fa3a43b9f..34bdac7a1 100644 --- a/app/Http/Controllers/Wizard/Data.php +++ b/app/Http/Controllers/Wizard/Data.php @@ -125,8 +125,8 @@ class Data extends Controller $company->api_key = setting('apps.api_key'); $company->financial_start = setting('localisation.financial_start'); - if ($company->logo) { - $logo = \Plank\Mediable\Media::find($company->logo); + if ($company->company_logo) { + $logo = $company->logo; $logo->path = route('uploads.get', $logo->id); diff --git a/resources/assets/js/views/wizard/Company.vue b/resources/assets/js/views/wizard/Company.vue index fa9f484ec..c57573992 100644 --- a/resources/assets/js/views/wizard/Company.vue +++ b/resources/assets/js/views/wizard/Company.vue @@ -115,129 +115,140 @@ import AkauntingDate from "./../../components/AkauntingDate"; import WizardAction from "./../../mixins/wizardAction"; export default { - name: "Company", - mixins: [WizardAction], - components: { - [Step.name]: Step, - [Steps.name]: Steps, - AkauntingDropzoneFileUpload, - AkauntingDate, - }, - props: { - company: { - type: [Object, Array], - }, - translations: { - type: [Object, Array], - }, - url: { - type: String, - default: "text", - }, - }, - data() { - return { - active: 0, - logo: [], - real_date: "", - }; - }, - mounted() { - let company_data = this.company; - this.onDataWatch(company_data); - }, - watch: { - company: function (company) { - this.onDataWatch(company); - }, - }, - methods: { - onDataWatch(company) { - if (Object.keys(company).length) { - let logo_arr = [ - { - id: company.logo.id, - name: company.logo.filename + "." + company.logo.extension, - path: company.logo.path, - type: company.logo.mime_type, - size: company.logo.size, - downloadPath: false, - }, - ]; - this.logo.push(logo_arr); - this.real_date = company.financial_start; - } + name: "Company", + + mixins: [WizardAction], + + components: { + [Step.name]: Step, + [Steps.name]: Steps, + AkauntingDropzoneFileUpload, + AkauntingDate, }, - onEditSave() { - FormData.prototype.appendRecursive = function (data, wrapper = null) { - for (var name in data) { - if (name == "previewElement" || name == "previewTemplate") { - continue; - } - if (wrapper) { - if ( - (typeof data[name] == "object" || Array.isArray(data[name])) && - data[name] instanceof File != true && - data[name] instanceof Blob != true - ) { - this.appendRecursive(data[name], wrapper + "[" + name + "]"); - } else { - this.append(wrapper + "[" + name + "]", data[name]); - } - } else { - if ( - (typeof data[name] == "object" || Array.isArray(data[name])) && - data[name] instanceof File != true && - data[name] instanceof Blob != true - ) { - this.appendRecursive(data[name], name); - } else { - this.append(name, data[name]); - } - } - } - }; + props: { + company: { + type: [Object, Array], + }, - const formData = new FormData(this.$refs["form"]); - let data_name = {}; + translations: { + type: [Object, Array], + }, + + url: { + type: String, + default: "text", + }, + }, + + data() { + return { + active: 0, + logo: [], + real_date: "", + }; + }, + + mounted() { + let company_data = this.company; + + this.onDataWatch(company_data); + }, + + methods: { + onDataWatch(company) { + if (Object.keys(company).length) { + let logo_arr = [{ + id: company.logo.id, + name: company.logo.filename + "." + company.logo.extension, + path: company.logo.path, + type: company.logo.mime_type, + size: company.logo.size, + downloadPath: false, + }]; + + this.logo.push(logo_arr); + this.real_date = company.financial_start; + } + }, + + onEditSave() { + FormData.prototype.appendRecursive = function (data, wrapper = null) { + for (var name in data) { + if (name == "previewElement" || name == "previewTemplate") { + continue; + } + + if (wrapper) { + if ( + (typeof data[name] == "object" || Array.isArray(data[name])) && + data[name] instanceof File != true && + data[name] instanceof Blob != true + ) { + this.appendRecursive(data[name], wrapper + "[" + name + "]"); + } else { + this.append(wrapper + "[" + name + "]", data[name]); + } + } else { + if ( + (typeof data[name] == "object" || Array.isArray(data[name])) && + data[name] instanceof File != true && + data[name] instanceof Blob != true + ) { + this.appendRecursive(data[name], name); + } else { + this.append(name, data[name]); + } + } + } + }; + + const formData = new FormData(this.$refs["form"]); + + let data_name = {}; - for (let [key, val] of formData.entries()) { - Object.assign(data_name, { - [key]: val, - ["logo"]: this.$refs.dropzoneWizard.files[1] - ? this.$refs.dropzoneWizard.files[1] - : this.$refs.dropzoneWizard.files[0], - ["_prefix"]: "company", - ["_token"]: window.Laravel.csrfToken, - ["_method"]: "POST", - }); - } + for (let [key, val] of formData.entries()) { + Object.assign(data_name, { + [key]: val, + ["logo"]: this.$refs.dropzoneWizard.files[1] + ? this.$refs.dropzoneWizard.files[1] + : this.$refs.dropzoneWizard.files[0], + ["_prefix"]: "company", + ["_token"]: window.Laravel.csrfToken, + ["_method"]: "POST", + }); + } - formData.appendRecursive(data_name); - window - .axios({ - method: "POST", - url: url + "/wizard/companies", - data: formData, - headers: { - "X-CSRF-TOKEN": window.Laravel.csrfToken, - "X-Requested-With": "XMLHttpRequest", - "Content-Type": "multipart/form-data", - }, - }) - .then((response) => { - this.onSuccessMessage(response); - this.$router.push("/wizard/currencies"); - }, this) - .catch((error) => { - }, this); + formData.appendRecursive(data_name); + + window.axios({ + method: "POST", + url: url + "/wizard/companies", + data: formData, + headers: { + "X-CSRF-TOKEN": window.Laravel.csrfToken, + "X-Requested-With": "XMLHttpRequest", + "Content-Type": "multipart/form-data", + }, + }) + .then((response) => { + this.onSuccessMessage(response); + this.$router.push("/wizard/currencies"); + }, this) + .catch((error) => { + }, this); + }, + + next() { + if (this.active++ > 2); + this.$router.push("/wizard/currencies"); + }, }, - next() { - if (this.active++ > 2); - this.$router.push("/wizard/currencies"); + watch: { + company: function (company) { + this.onDataWatch(company); + }, }, - }, }; \ No newline at end of file diff --git a/resources/assets/js/views/wizard/Currencies.vue b/resources/assets/js/views/wizard/Currencies.vue index 3323360c2..c99b49b85 100644 --- a/resources/assets/js/views/wizard/Currencies.vue +++ b/resources/assets/js/views/wizard/Currencies.vue @@ -299,124 +299,133 @@ import MixinsGlobal from "./../../mixins/global"; import WizardAction from "./../../mixins/wizardAction"; export default { - name: "Currencies", - mixins: [MixinsGlobal, WizardAction], - components: { - [Step.name]: Step, - [Steps.name]: Steps, - [Select.name]: Select, - [Option.name]: Option, - AkauntingRadioGroup, - }, - props: { - currencies: { - type: [Object, Array], - }, - currency_codes: { - type: [Object, Array], - }, - translations: { - type: [Object, Array], - }, - }, - data() { - return { - active: 1, - bulk_action: new BulkAction(url + "/settings/currencies"), - }; - }, - methods: { - onSwitchUpdate(item) { - this.onStatus(item.id, event); - this.onStatusControl(this.currencies, item.id, event); + name: "Currencies", + + mixins: [MixinsGlobal, WizardAction], + + components: { + [Step.name]: Step, + [Steps.name]: Steps, + [Select.name]: Select, + [Option.name]: Option, + AkauntingRadioGroup, }, - onClickDelete(item) { - this.confirmDelete( - `${ - new URL(url).protocol + - "//" + - location.host + - location.pathname + - "/" + - item.id - }`, - this.translations.currencies.title, - `Confirm Delete ${item.name} ${this.translations.currencies.title}?`, - this.translations.currencies.cancel, - this.translations.currencies.delete - ); + props: { + currencies: { + type: [Object, Array], + }, + + currency_codes: { + type: [Object, Array], + }, + + translations: { + type: [Object, Array], + }, }, - onDeleteCurrency(event) { - this.onEjetItem(event, this.currencies, event.currency_id); + data() { + return { + active: 1, + bulk_action: new BulkAction(url + "/settings/currencies"), + }; }, - onChangeCodeItem(code) { - const formData = new FormData(this.$refs["form"]); - const data = { - rate: "", - precision: "", - symbol: "", - symbol_first: "", - decimal_mark: "", - thousands_separator: "", - }; + methods: { + onSwitchUpdate(item) { + this.onStatus(item.id, event); - for (let [key, val] of formData.entries()) { - Object.assign(data, { - [key]: val, - }); - } + this.onStatusControl(this.currencies, item.id, event); + }, - window - .axios({ - method: "GET", - url: url + "/settings/currencies/config", - params: { - code: code, - }, - }) - .then((response) => { - data.rate = response.data.rate; - data.precision = response.data.precision; - data.symbol = response.data.symbol; - data.symbol_first = response.data.symbol_first; - data.decimal_mark = response.data.decimal_mark; - data.thousands_separator = response.data.thousands_separator; - this.model.rate = response.data.rate; - }, this); + onClickDelete(item) { + this.confirmDelete( + `${ + new URL(url).protocol + + "//" + + location.host + + location.pathname + + "/" + + item.id + }`, + this.translations.currencies.title, + `Confirm Delete ${item.name} ${this.translations.currencies.title}?`, + this.translations.currencies.cancel, + this.translations.currencies.delete + ); + }, + + onDeleteCurrency(event) { + this.onEjetItem(event, this.currencies, event.currency_id); + }, + + onChangeCodeItem(code) { + const formData = new FormData(this.$refs["form"]); + const data = { + rate: "", + precision: "", + symbol: "", + symbol_first: "", + decimal_mark: "", + thousands_separator: "", + }; + + for (let [key, val] of formData.entries()) { + Object.assign(data, { + [key]: val, + }); + } + + window.axios({ + method: "GET", + url: url + "/settings/currencies/config", + params: { + code: code, + }, + }) + .then((response) => { + data.rate = response.data.rate; + data.precision = response.data.precision; + data.symbol = response.data.symbol; + data.symbol_first = response.data.symbol_first; + data.decimal_mark = response.data.decimal_mark; + data.thousands_separator = response.data.thousands_separator; + + this.model.rate = response.data.rate; + }, this); + }, + + onEditForm(item) { + this.onSubmitEvent( + "PATCH", + url + "/wizard/currencies/" + item.id, + "", + this.currencies, + item.id + ); + }, + + onSubmitForm() { + this.onSubmitEvent( + "POST", + url + "/wizard/currencies", + "", + this.currencies + ); + }, + + prev() { + if (this.active-- > 2); + history.back() + + this.$router.push("/wizard/companies"); + }, + + next() { + if (this.active++ > 2); + this.$router.push("/wizard/taxes"); + }, }, - - onEditForm(item) { - this.onSubmitEvent( - "PATCH", - url + "/wizard/currencies/" + item.id, - "", - this.currencies, - item.id - ); - }, - - onSubmitForm() { - this.onSubmitEvent( - "POST", - url + "/wizard/currencies", - "", - this.currencies - ); - }, - - prev() { - if (this.active-- > 2); - history.back() - this.$router.push("/wizard/companies"); - }, - - next() { - if (this.active++ > 2); - this.$router.push("/wizard/taxes"); - }, - }, }; diff --git a/resources/assets/js/views/wizard/Finish.vue b/resources/assets/js/views/wizard/Finish.vue index beaeb4868..4e1ab1c8e 100644 --- a/resources/assets/js/views/wizard/Finish.vue +++ b/resources/assets/js/views/wizard/Finish.vue @@ -1,5 +1,5 @@