diff --git a/resources/views/expenses/edit.blade.php b/resources/views/expenses/edit.blade.php index 414778efbc..c07103a3d4 100644 --- a/resources/views/expenses/edit.blade.php +++ b/resources/views/expenses/edit.blade.php @@ -21,6 +21,7 @@ ->method($method) !!}
@if ($expense) @@ -306,9 +307,8 @@ @else // otherwise create blank model window.model = new ViewModel({!! $expense !!}); - - ko.applyBindings(model); @endif + ko.applyBindings(model); @if (!$expense && $clientPublicId) onClientChange(); @@ -386,6 +386,11 @@ self.convert_currency = ko.observable({{ ($expense && $expense->isExchanged()) ? 'true' : 'false' }}); self.apply_taxes = ko.observable({{ ($expense && ($expense->tax_name1 || $expense->tax_name2)) ? 'true' : 'false' }}); + self.account_currency_id = ko.observable({{ $account->getCurrencyId() }}); + self.client_id = ko.observable({{ $clientPublicId }}); + self.vendor_id = ko.observable({{ $vendorPublicId }}); + self.expense_category_id = ko.observable({{ $categoryPublicId }}); + self.mapping = { 'documents': { create: function(options) { @@ -398,11 +403,6 @@ ko.mapping.fromJS(data, self.mapping, this); } - self.account_currency_id = ko.observable({{ $account->getCurrencyId() }}); - self.client_id = ko.observable({{ $clientPublicId }}); - self.vendor_id = ko.observable({{ $vendorPublicId }}); - self.expense_category_id = ko.observable({{ $categoryPublicId }}); - self.convertedAmount = ko.computed({ read: function () { return roundToTwo(self.amount() * self.exchange_rate()).toFixed(2);