@extends('header')
@section('head')
@parent
@stop
@section('content')
@if ($invoice)
@if ($invoice)
@endif
{{ Former::select('client')->addOption('', '')->data_bind("dropdown: client")->addGroupClass('client_select closer-row') }}
@if ($invoice)
@endif
{{ Former::text('invoice_date')->data_bind("datePicker: invoice_date, valueUpdate: 'afterkeydown'")
->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT))->append('') }}
{{ Former::text('due_date')->data_bind("datePicker: due_date, valueUpdate: 'afterkeydown'")
->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT))->append('') }}
{{ Former::select('frequency_id')->options($frequencies)->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))->append('') }}
{{ Former::text('end_date')->data_bind("datePicker: end_date, valueUpdate: 'afterkeydown'")
->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT))->append('') }}
@if ($invoice && $invoice->recurring_invoice_id)
Created by a {{ link_to('/invoices/'.$invoice->recurring_invoice_id, 'recurring invoice') }}
@else
{{ Former::checkbox('recurring')->text(trans('texts.enable').'
'.trans('texts.learn_more').'')->data_bind("checked: is_recurring")
->inlineHelp($invoice && $invoice->last_sent_date ? 'Last invoice sent ' . Utils::dateToString($invoice->last_sent_date) : '') }}
@endif
{{ Former::text('invoice_number')->label(trans('texts.invoice_number_short'))->data_bind("value: invoice_number, valueUpdate: 'afterkeydown'") }}
{{ Former::text('po_number')->label(trans('texts.po_number_short'))->data_bind("value: po_number, valueUpdate: 'afterkeydown'") }}
{{ Former::text('discount')->data_bind("value: discount, valueUpdate: 'afterkeydown'")->append('%') }}
{{-- Former::select('currency_id')->addOption('', '')->fromQuery($currencies, 'name', 'id')->data_bind("value: currency_id") --}}
{{ Former::hidden('data')->data_bind("value: ko.mapping.toJSON(model)") }}
{{ Former::text('action') }}
@if ($invoice)
{{ Former::populateField('id', $invoice->public_id) }}
{{ Former::text('id') }}
@endif
{{ Former::select('invoice_design_id')->style('display:inline;width:120px')->raw()
->fromQuery($invoiceDesigns, 'name', 'id')->data_bind("value: invoice_design_id") }}
{{ Button::primary(trans('texts.download_pdf'), array('onclick' => 'onDownloadClick()'))->append_with_icon('download-alt'); }}
@if (!$invoice || (!$invoice->trashed() && !$invoice->client->trashed()))
@if ($invoice)
{{-- DropdownButton::normal('Download PDF',
Navigation::links(
array(
array('Download PDF', "javascript:onDownloadClick()"),
array(Navigation::DIVIDER),
array('Create Payment', "javascript:onPaymentClick()"),
array('Create Credit', "javascript:onCreditClick()"),
)
)
, array('id'=>'relatedActions', 'style'=>'text-align:left'))->split(); --}}
{{-- DropdownButton::primary('Save Invoice',
Navigation::links(
array(
array('Save Invoice', "javascript:onSaveClick()"),
array('Clone Invoice', "javascript:onCloneClick()"),
array(Navigation::DIVIDER),
array('Archive Invoice', "javascript:onArchiveClick()"),
array('Delete Invoice', "javascript:onDeleteClick()"),
)
)
, array('id'=>'primaryActions', 'style'=>'text-align:left', 'data-bind'=>'css: $root.enable.save'))->split(); --}}
@else
{{ Button::success(trans('texts.save_invoice'), array('id' => 'saveButton', 'onclick' => 'onSaveClick()')) }}
@endif
{{ Button::normal(trans('texts.email_invoice'), array('id' => 'email_button', 'onclick' => 'onEmailClick()'))->append_with_icon('send'); }}
@if ($invoice)
{{ Button::primary(trans('texts.enter_payment'), array('onclick' => 'onPaymentClick()'))->append_with_icon('usd'); }}
@endif
@endif
@if (false && !Auth::user()->account->isPro())
@endif
{{ Former::legend('organization') }}
{{ Former::text('name')->data_bind("value: name, valueUpdate: 'afterkeydown', attr { placeholder: name.placeholder }") }}
{{ Former::text('website')->data_bind("value: website, valueUpdate: 'afterkeydown'") }}
{{ Former::text('work_phone')->data_bind("value: work_phone, valueUpdate: 'afterkeydown'") }}
@if (Auth::user()->isPro())
@if ($account->custom_client_label1)
{{ Former::text('custom_value1')->label($account->custom_client_label1)
->data_bind("value: custom_value1, valueUpdate: 'afterkeydown'") }}
@endif
@if ($account->custom_client_label2)
{{ Former::text('custom_value2')->label($account->custom_client_label2)
->data_bind("value: custom_value2, valueUpdate: 'afterkeydown'") }}
@endif
@endif
{{ Former::legend('address') }}
{{ Former::text('address1')->data_bind("value: address1, valueUpdate: 'afterkeydown'") }}
{{ Former::text('address2')->data_bind("value: address2, valueUpdate: 'afterkeydown'") }}
{{ Former::text('city')->data_bind("value: city, valueUpdate: 'afterkeydown'") }}
{{ Former::text('state')->data_bind("value: state, valueUpdate: 'afterkeydown'") }}
{{ Former::text('postal_code')->data_bind("value: postal_code, valueUpdate: 'afterkeydown'") }}
{{ Former::select('country_id')->addOption('','')->addGroupClass('country_select')
->fromQuery($countries, 'name', 'id')->data_bind("dropdown: country_id") }}
{{ Former::legend('contacts') }}
{{ Former::hidden('public_id')->data_bind("value: public_id, valueUpdate: 'afterkeydown'") }}
{{ Former::text('first_name')->data_bind("value: first_name, valueUpdate: 'afterkeydown'") }}
{{ Former::text('last_name')->data_bind("value: last_name, valueUpdate: 'afterkeydown'") }}
{{ Former::text('email')->data_bind('value: email, valueUpdate: \'afterkeydown\', attr: {id:\'email\'+$index()}') }}
{{ Former::text('phone')->data_bind("value: phone, valueUpdate: 'afterkeydown'") }}
{{ Former::legend('additional_info') }}
{{ Former::select('payment_terms')->addOption('','0')->data_bind('value: payment_terms')
->fromQuery($paymentTerms, 'name', 'num_days') }}
{{ Former::select('currency_id')->addOption('','')->data_bind('value: currency_id')
->fromQuery($currencies, 'name', 'id') }}
{{ Former::select('size_id')->addOption('','')->data_bind('value: size_id')
->fromQuery($sizes, 'name', 'id') }}
{{ Former::select('industry_id')->addOption('','')->data_bind('value: industry_id')
->fromQuery($industries, 'name', 'id') }}
{{ Former::textarea('private_notes')->data_bind('value: private_notes') }}
{{ Former::checkbox('invoice_taxes')->text(trans('texts.enable_invoice_tax'))
->label(trans('texts.settings'))->data_bind('checked: $root.invoice_taxes, enable: $root.tax_rates().length > 1') }}
{{ Former::checkbox('invoice_item_taxes')->text(trans('texts.enable_line_item_tax'))
->label(' ')->data_bind('checked: $root.invoice_item_taxes, enable: $root.tax_rates().length > 1') }}
{{ trans('texts.recurring_help') }}
{{ Former::close() }}
@stop