@extends('header') @section('head') @parent @include('money_script') @stop @section('content') {!! Former::open($url) ->addClass('warn-on-exit main-form') ->onsubmit('return onFormSubmit(event)') ->autocomplete('off') ->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('', '') ->label(trans('texts.vendor')) ->addGroupClass('vendor-select') !!} {!! Former::select('expense_category_id')->addOption('', '') ->label(trans('texts.category')) ->addGroupClass('expense-category-select') !!} {!! Former::text('amount') ->label(trans('texts.amount')) ->data_bind("value: amount, valueUpdate: 'afterkeydown'") ->addGroupClass('amount') ->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')->getTranslatedName()) ->fromQuery($currencies, 'name', 'id') !!} @if (! $isRecurring) {!! 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('') !!} @endif @if ($expense && $expense->invoice_id) {!! Former::plaintext() ->label('client') ->value($expense->client->present()->link) !!} @else {!! Former::select('client_id') ->addOption('', '') ->label(trans('texts.client')) ->data_bind('combobox: client_id') ->addGroupClass('client-select') !!} @endif @include('partials/custom_fields', ['entityType' => ENTITY_EXPENSE]) @if (count($taxRates)) @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 @endif

@include('partials.tax_rates')
@if (!$expense || ($expense && !$expense->invoice_id)) {!! Former::checkbox('should_be_invoiced') ->text(trans('texts.mark_billable')) ->data_bind('checked: should_be_invoiced()') ->label(' ') ->value(1) !!} @endif @if ($isRecurring) {!! Former::select('frequency_id') ->label('frequency') ->options(\App\Models\Frequency::selectOptions()) ->data_bind("value: frequency_id") !!} {!! Former::text('start_date') ->data_bind("datePicker: start_date, valueUpdate: 'afterkeydown'") ->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT, DEFAULT_DATE_PICKER_FORMAT)) ->appendIcon('calendar') ->addGroupClass('start_date') ->data_date_start_date($expense ? false : $account->formatDate($account->getDateTime())) !!} {!! Former::text('end_date') ->data_bind("datePicker: end_date, valueUpdate: 'afterkeydown'") ->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT, DEFAULT_DATE_PICKER_FORMAT)) ->appendIcon('calendar') ->addGroupClass('end_date') ->data_date_start_date($expense ? false : $account->formatDate($account->getDateTime())) !!} @else @if ((! $expense || ! $expense->transaction_id)) @if (! $expense || ! $expense->isPaid()) {!! Former::checkbox('mark_paid') ->data_bind('checked: mark_paid') ->text(trans('texts.mark_expense_paid')) ->label(' ') ->value(1) !!} @endif
{!! Former::select('payment_type_id') ->addOption('','') ->fromQuery($paymentTypes, 'name', 'id') ->addGroupClass('payment-type-select') !!} {!! Former::text('payment_date') ->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT)) ->addGroupClass('payment_date') ->append('') !!} {!! Former::text('transaction_reference') !!}
@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('') ->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 ($account->hasFeature(FEATURE_DOCUMENTS)) {!! Former::checkbox('invoice_documents') ->text(trans('texts.add_documents_to_invoice')) ->onchange('onInvoiceDocumentsChange()') ->data_bind('checked: invoice_documents') ->label(' ') ->value(1) !!} @endif @endif
{!! Former::textarea('private_notes')->rows(! $isRecurring && $account->hasFeature(FEATURE_DOCUMENTS) ? 6 : 10) !!} {!! Former::textarea('public_notes')->rows(! $isRecurring && $account->hasFeature(FEATURE_DOCUMENTS) ? 6 : 10) !!} @if (! $isRecurring && $account->hasFeature(FEATURE_DOCUMENTS))
@endif
{!! Button::normal(trans('texts.cancel')) ->asLinkTo(HTMLUtils::previousUrl('/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