@extends('header') @section('head_css') @parent @stop @section('head') @parent @include('money_script') @foreach ($account->getFontFolders() as $font) @endforeach @stop @section('content') @if ($errors->first('invoice_items'))
{{ trans($errors->first('invoice_items')) }}
@endif @if ($invoice->id) @endif {!! Former::open($url) ->method($method) ->addClass('warn-on-exit main-form search') ->autocomplete('off') ->name('lastpass-disable-search') // 'search' prevents LastPass auto-fill http://stackoverflow.com/a/30921628/497368 ->onsubmit('return onFormSubmit(event)') ->rules(array( 'client' => 'required', 'invoice_number' => 'required', 'invoice_date' => 'required', 'product_key' => 'max:255' )) !!} @include('partials.autocomplete_fix')
@if ($invoice->id || $data)

@if ($invoice->client->is_deleted)   
{{ trans('texts.deleted') }}
@endif

@can('view', $invoice->client) @can('edit', $invoice->client) {{ trans('texts.edit_client') }} | @endcan {!! link_to('/clients/'.$invoice->client->public_id, trans('texts.view_client'), ['target' => '_blank']) !!} @endcan
@endif {!! Former::select('client') ->addOption('', '') ->data_bind("dropdown: client, dropdownOptions: {highlighter: comboboxHighlighter}") ->addClass('client-input') ->addGroupClass('client_select closer-row') !!} @if ($invoice->id || $data)
@endif
{!! Former::text('invoice_date')->data_bind("datePicker: invoice_date, valueUpdate: 'afterkeydown'")->label(trans("texts.{$entityType}_date")) ->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT, DEFAULT_DATE_PICKER_FORMAT))->appendIcon('calendar')->addGroupClass('invoice_date') !!} {!! Former::text('due_date')->data_bind("datePicker: due_date, valueUpdate: 'afterkeydown'")->label($account->getLabel($invoice->getDueDateLabel())) ->placeholder($invoice->id || $invoice->isQuote() ? ' ' : $account->present()->dueDatePlaceholder()) ->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT, DEFAULT_DATE_PICKER_FORMAT))->appendIcon('calendar')->addGroupClass('due_date') !!}
{!! Former::text('partial')->data_bind("value: partial, valueUpdate: 'afterkeydown'") ->onkeyup('onPartialChange()') ->raw() !!}
{!! Former::text('partial_due_date') ->placeholder('due_date') ->style('display: none') ->data_bind("datePicker: partial_due_date, valueUpdate: 'afterkeydown', visible: showPartialDueDate") ->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT, DEFAULT_DATE_PICKER_FORMAT)) ->raw() !!}
@if ($entityType == ENTITY_INVOICE)
{!! Former::select('frequency_id')->label('frequency')->options($frequencies)->data_bind("value: frequency_id") ->appendIcon('question-sign')->addGroupClass('frequency_id')->onchange('onFrequencyChange()') !!} {!! 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') !!} {!! 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') !!} {!! Former::select('recurring_due_date')->label(trans('texts.due_date'))->options($recurringDueDates)->data_bind("value: recurring_due_date")->appendIcon('question-sign')->addGroupClass('recurring_due_date') !!}
@endif @if ($account->showCustomField('custom_invoice_text_label1', $invoice)) {!! Former::text('custom_text_value1')->label(e($account->custom_invoice_text_label1) ?: ' ')->data_bind("value: custom_text_value1, valueUpdate: 'afterkeydown'") !!} @endif
{!! Former::text('invoice_number') ->label(trans("texts.{$entityType}_number_short")) ->onchange('checkInvoiceNumber()') ->addGroupClass('invoice-number') ->data_bind("value: invoice_number, valueUpdate: 'afterkeydown'") !!}
{!! Former::select('auto_bill') ->data_bind("value: auto_bill, valueUpdate: 'afterkeydown', event:{change:function(){if(auto_bill()==".AUTO_BILL_OPT_IN.")client_enable_auto_bill(0);if(auto_bill()==".AUTO_BILL_OPT_OUT.")client_enable_auto_bill(1)}}") ->options([ AUTO_BILL_OFF => trans('texts.off'), AUTO_BILL_OPT_IN => trans('texts.opt_in'), AUTO_BILL_OPT_OUT => trans('texts.opt_out'), AUTO_BILL_ALWAYS => trans('texts.always'), ]) !!}
{{trans('texts.auto_bill')}}
{{trans('texts.opted_in')}} - ({{trans('texts.disable')}})
{{trans('texts.auto_bill')}}
{{trans('texts.opted_out')}} - ({{trans('texts.enable')}})
{!! Former::text('po_number')->label($account->getLabel('po_number', 'po_number_short'))->data_bind("value: po_number, valueUpdate: 'afterkeydown'") !!} {!! Former::text('discount')->data_bind("value: discount, valueUpdate: 'afterkeydown'") ->addGroupClass('no-padding-or-border')->type('number')->min('0')->step('any')->append( Former::select('is_amount_discount') ->addOption(trans('texts.discount_percent'), '0') ->addOption(trans('texts.discount_amount'), '1') ->data_bind("value: is_amount_discount, event:{ change: isAmountDiscountChanged}") ->raw() ) !!} @if ($account->showCustomField('custom_invoice_text_label2', $invoice)) {!! Former::text('custom_text_value2')->label(e($account->custom_invoice_text_label2) ?: ' ')->data_bind("value: custom_text_value2, valueUpdate: 'afterkeydown'") !!} @endif @if ($entityType == ENTITY_INVOICE)
@if ($invoice->recurring_invoice) {!! trans('texts.created_by_invoice', ['invoice' => link_to('/invoices/'.$invoice->recurring_invoice->public_id, trans('texts.recurring_invoice'))]) !!}

@elseif ($invoice->id) @if (isset($lastSent) && $lastSent) {!! trans('texts.last_sent_on', ['date' => link_to('/invoices/'.$lastSent->public_id, $invoice->last_sent_date, ['id' => 'lastSent'])]) !!}

@endif @if ($invoice->is_recurring && $invoice->getNextSendDate()) {!! trans('texts.next_send_on', ['date' => ''.$account->formatDate($invoice->getNextSendDate()). '']) !!} @if ($invoice->getDueDate())
{!! trans('texts.next_due_on', ['date' => ''.$account->formatDate($invoice->getDueDate($invoice->getNextSendDate())).'']) !!} @endif

@endif @endif

@endif
@include('invoices.edit_table', ['isTasks' => false]) @if ($account->isModuleEnabled(ENTITY_TASK) && ($invoice->has_tasks || ! empty($tasks))) @include('invoices.edit_table', ['isTasks' => true]) @endif @if ($account->showCustomField('custom_invoice_label1', $invoice) && $invoice->custom_taxes1) @endif @if ($account->showCustomField('custom_invoice_label2', $invoice) && $invoice->custom_taxes2) @endif @if ($account->showCustomField('custom_invoice_label1', $invoice) && !$invoice->custom_taxes1) @endif @if ($account->showCustomField('custom_invoice_label2', $invoice) && !$invoice->custom_taxes2) @endif @if (!$account->hide_paid_to_date) @endif
{{ trans('texts.subtotal') }}
{{ trans('texts.discount') }}
{{ $account->custom_invoice_label1 ?: trans('texts.surcharge') }}
{{ $account->custom_invoice_label2 ?: trans('texts.surcharge') }}
{{ trans('texts.tax') }}  
{{ trans('texts.tax') }}   {!! Former::select('') ->id('taxRateSelect1') ->addOption('', '') ->options($taxRateOptions) ->addClass($account->enable_second_tax_rate ? 'tax-select' : '') ->data_bind('value: tax1, event:{change:onTax1Change}') ->raw() !!}
{!! Former::select('') ->addOption('', '') ->options($taxRateOptions) ->addClass('tax-select') ->data_bind('value: tax2, event:{change:onTax2Change}') ->raw() !!}
{{ $account->custom_invoice_label1 ?: trans('texts.surcharge') }}
{{ $account->custom_invoice_label2 ?: trans('texts.surcharge') }}
{{ trans('texts.paid_to_date') }}
{{ $entityType == ENTITY_INVOICE ? $invoiceLabels['balance_due'] : trans('texts.total') }}
{{ $invoiceLabels['partial_due'] }}
{{ Former::setOption('TwitterBootstrap3.labelWidths.large', 0) }} {{ Former::setOption('TwitterBootstrap3.labelWidths.small', 0) }}
{!! Former::textarea('public_notes') ->data_bind("value: public_notes, valueUpdate: 'afterkeydown'") ->label(null)->style('width: 100%')->rows(4)->label(null) !!}
{!! Former::textarea('private_notes') ->data_bind("value: private_notes, valueUpdate: 'afterkeydown'") ->label(null)->style('width: 100%')->rows(4) !!}
{!! Former::textarea('terms') ->data_bind("value:terms, placeholder: terms_placeholder, valueUpdate: 'afterkeydown'") ->label(false)->style('width: 100%')->rows(4) ->help('
') !!}
@if ($account->hasFeature(FEATURE_DOCUMENTS))
@if ($invoice->hasExpenseDocuments() || count($expenses))

{{trans('texts.documents_from_expenses')}}

@foreach($invoice->expenses as $expense) @if ($expense->invoice_documents) @foreach($expense->documents as $document)
{{$document->name}}
@endforeach @endif @endforeach @foreach($expenses as $expense) @if ($expense->invoice_documents) @foreach($expense->documents as $document)
{{$document->name}}
@endforeach @endif @endforeach @endif
@endif
{{ Former::setOption('TwitterBootstrap3.labelWidths.large', 4) }} {{ Former::setOption('TwitterBootstrap3.labelWidths.small', 4) }}
{!! Former::populateField('entityType', $entityType) !!} {!! Former::text('entityType') !!} {!! Former::text('action') !!} {!! Former::text('public_id')->data_bind('value: public_id') !!} {!! Former::text('is_public')->data_bind('value: is_public') !!} {!! Former::text('is_recurring')->data_bind('value: is_recurring') !!} {!! Former::text('is_quote')->data_bind('value: is_quote') !!} {!! Former::text('has_tasks')->data_bind('value: has_tasks') !!} {!! Former::text('data')->data_bind('value: ko.mapping.toJSON(model)') !!} {!! Former::text('has_expenses')->data_bind('value: has_expenses') !!} {!! Former::text('pdfupload') !!}
@if (!Utils::hasFeature(FEATURE_MORE_INVOICE_DESIGNS)) {!! Former::select('invoice_design_id')->style('display:inline;width:150px;background-color:white !important')->raw()->fromQuery($invoiceDesigns, 'name', 'id')->data_bind("value: invoice_design_id")->addOption(trans('texts.more_designs') . '...', '-1') !!} @else {!! Former::select('invoice_design_id')->style('display:inline;width:150px;background-color:white !important')->raw()->fromQuery($invoiceDesigns, 'name', 'id')->data_bind("value: invoice_design_id") !!} @endif @if ( $invoice->id && ! $invoice->is_recurring) {!! Button::primary(trans('texts.download_pdf')) ->withAttributes(['onclick' => 'onDownloadClick()', 'id' => 'downloadPdfButton']) ->appendIcon(Icon::create('download-alt')) !!} @endif @if (Auth::user()->canCreateOrEdit(ENTITY_INVOICE, $invoice)) @if ($invoice->isClientTrashed()) @elseif ($invoice->isSent() && config('ninja.lock_sent_invoices')) @if (! $invoice->trashed()) {!! Button::info(trans("texts.email_{$entityType}"))->withAttributes(array('id' => 'emailButton', 'onclick' => 'onEmailClick()'))->appendIcon(Icon::create('send')) !!} @endif @else @if (!$invoice->is_deleted) @if ($invoice->isSent()) {!! Button::success(trans("texts.save_{$entityType}"))->withAttributes(array('id' => 'saveButton', 'onclick' => 'onSaveClick()'))->appendIcon(Icon::create('floppy-disk')) !!} @else {!! Button::normal(trans("texts.save_draft"))->withAttributes(array('id' => 'draftButton', 'onclick' => 'onSaveDraftClick()'))->appendIcon(Icon::create('floppy-disk')) !!} @if (! $invoice->trashed()) {!! Button::success(trans($invoice->is_recurring ? "texts.mark_ready" : "texts.mark_sent"))->withAttributes(array('id' => 'saveButton', 'onclick' => 'onMarkSentClick()'))->appendIcon(Icon::create('globe')) !!} @endif @endif @if (! $invoice->trashed()) {!! Button::info(trans("texts.email_{$entityType}"))->withAttributes(array('id' => 'emailButton', 'onclick' => 'onEmailClick()'))->appendIcon(Icon::create('send')) !!} @endif @if ($invoice->id) {!! DropdownButton::normal(trans('texts.more_actions'))->withContents($invoice->present()->moreActions())->dropup() !!} @elseif (! $invoice->isQuote() && Request::is('*/clone')) {!! Button::normal(trans($invoice->is_recurring ? 'texts.disable_recurring' : 'texts.enable_recurring'))->withAttributes(['id' => 'recurrButton', 'onclick' => 'onRecurrClick()'])->appendIcon(Icon::create('repeat')) !!} @elseif (! empty($tasks)) {!! Button::normal(trans('texts.add_product'))->withAttributes(['id' => 'addItemButton', 'onclick' => 'onAddItemClick()'])->appendIcon(Icon::create('plus-sign')) !!} @endif @endif @if ($invoice->trashed()) {!! Button::primary(trans('texts.restore'))->withAttributes(['onclick' => 'submitBulkAction("restore")'])->appendIcon(Icon::create('cloud-download')) !!} @endif @endif @endif
@include('invoices.pdf', ['account' => Auth::user()->account, 'hide_pdf' => ! Auth::user()->account->live_preview]) @if (!Auth::user()->account->isPro())
{!! trans('texts.pro_plan_remove_logo', ['link'=>'' . trans('texts.pro_plan_remove_logo_link') . '']) !!}
@endif @include('partials.email_templates') @include('invoices.email') {!! Former::close() !!} {!! Former::open("{$entityType}s/bulk")->addClass('bulkForm') !!} {!! Former::populateField('bulk_public_id', $invoice->public_id) !!} {!! Former::text('bulk_public_id') !!} {!! Former::text('bulk_action') !!} {!! Former::close() !!}
@include('invoices.knockout') @if ($account->hasFeature(FEATURE_DOCUMENTS) && $account->invoice_embed_documents) @foreach ($invoice->documents as $document) @if($document->isPDFEmbeddable()) @endif @endforeach @foreach ($invoice->expenses as $expense) @foreach ($expense->documents as $document) @if($document->isPDFEmbeddable()) @endif @endforeach @endforeach @endif @stop