@extends('header') @section('head') @parent @include('money_script') @stop @section('content') {!! Former::open($url) ->addClass('warn-on-exit main-form') ->onsubmit('return onFormSubmit(event)') ->method($method) !!}
{!! Former::text('action') !!} {!! Former::text('data')->data_bind('value: ko.mapping.toJSON(model)') !!}
@if ($expense) {!! Former::populate($expense) !!} {!! Former::populateField('should_be_invoiced', intval($expense->should_be_invoiced)) !!}
{!! Former::text('public_id') !!} {!! Former::text('invoice_id') !!}
@endif
{!! Former::select('vendor_id')->addOption('', '') ->data_bind('combobox: vendor_id') ->label(trans('texts.vendor')) ->addGroupClass('vendor-select') !!} {!! Former::select('expense_category_id')->addOption('', '') ->data_bind('combobox: expense_category_id') ->label(trans('texts.category')) ->addGroupClass('category-select') !!} {!! Former::text('expense_date') ->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT, DEFAULT_DATE_PICKER_FORMAT)) ->addGroupClass('expense_date') ->label(trans('texts.date')) ->append('') !!} {!! Former::select('expense_currency_id')->addOption('','') ->data_bind('combobox: expense_currency_id') ->label(trans('texts.currency_id')) ->data_placeholder(Utils::getFromCache($account->getCurrencyId(), 'currencies')->name) ->fromQuery($currencies, 'name', 'id') !!} {!! Former::text('amount') ->label(trans('texts.amount')) ->data_bind("value: amount, valueUpdate: 'afterkeydown'") ->addGroupClass('amount') ->append('') !!} @if ($expense && $expense->invoice_id) {!! Former::plaintext() ->label('client') ->value($expense->client->getDisplayName()) !!} @else {!! Former::select('client_id') ->addOption('', '') ->label(trans('texts.client')) ->data_bind('combobox: client_id') ->addGroupClass('client-select') !!} @endif @if (!$expense || ($expense && !$expense->invoice_id && !$expense->client_id)) {!! Former::checkbox('should_be_invoiced') ->text(trans('texts.should_be_invoiced')) ->data_bind('checked: should_be_invoiced() || client_id(), enable: !client_id()') ->label(' ') ->value(1) !!} @endif @if (!$expense || ($expense && ! $expense->isExchanged())) {!! Former::checkbox('convert_currency') ->text(trans('texts.convert_currency')) ->data_bind('checked: convert_currency') ->label(' ') ->value(1) !!} @endif

{!! Former::select('invoice_currency_id')->addOption('','') ->label(trans('texts.invoice_currency')) ->data_placeholder(Utils::getFromCache($account->getCurrencyId(), 'currencies')->name) ->data_bind('combobox: invoice_currency_id, disable: true') ->fromQuery($currencies, 'name', 'id') !!} {!! Former::plaintext('test') ->value('') ->style('min-height:46px') ->label(trans('texts.invoice_currency')) !!} {!! Former::text('exchange_rate') ->data_bind("value: exchange_rate, enable: enableExchangeRate, valueUpdate: 'afterkeydown'") !!} {!! Former::text('invoice_amount') ->addGroupClass('converted-amount') ->data_bind("value: convertedAmount, enable: enableExchangeRate") ->append('') !!}
@if (!$expense || ($expense && (!$expense->tax_name1 && !$expense->tax_name2))) {!! Former::checkbox('apply_taxes') ->text(trans('texts.apply_taxes')) ->data_bind('checked: apply_taxes') ->label(' ') ->value(1) !!} @endif

{!! Former::select('tax_select1') ->addOption('','') ->label(trans('texts.tax_rate')) ->onchange('taxSelectChange(event)') ->fromQuery($taxRates) !!}
{!! Former::input('tax_rate1') !!} {!! Former::input('tax_name1') !!}
{!! Former::select('tax_select2') ->addOption('','') ->label(trans('texts.tax_rate')) ->onchange('taxSelectChange(event)') ->fromQuery($taxRates) !!}
{!! Former::input('tax_rate2') !!} {!! Former::input('tax_name2') !!}
{!! Former::textarea('public_notes')->rows(8) !!} {!! Former::textarea('private_notes')->rows(8) !!}
@if ($account->hasFeature(FEATURE_DOCUMENTS))
{{trans('texts.expense_documents')}}
@endif
{!! Button::normal(trans('texts.cancel')) ->asLinkTo(URL::to('/expenses')) ->appendIcon(Icon::create('remove-circle')) ->large() !!} @if (Auth::user()->canCreateOrEdit(ENTITY_EXPENSE, $expense)) @if (Auth::user()->hasFeature(FEATURE_EXPENSES)) @if (!$expense || !$expense->is_deleted) {!! Button::success(trans('texts.save')) ->appendIcon(Icon::create('floppy-disk')) ->large() ->submit() !!} @endif @if ($expense && !$expense->trashed()) {!! DropdownButton::normal(trans('texts.more_actions')) ->withContents($actions) ->large() ->dropup() !!} @endif @if ($expense && $expense->trashed()) {!! Button::primary(trans('texts.restore')) ->withAttributes(['onclick' => 'submitAction("restore")']) ->appendIcon(Icon::create('cloud-download')) ->large() !!} @endif @endif @endif
{!! Former::close() !!} @stop