mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Support custom fields with defined options
This commit is contained in:
parent
5eedd23447
commit
dae4df2a3e
@ -1007,7 +1007,7 @@ class Utils
|
|||||||
$host = explode('.', $parts['host']);
|
$host = explode('.', $parts['host']);
|
||||||
} else {
|
} else {
|
||||||
$host = explode('.', $parts['path']);
|
$host = explode('.', $parts['path']);
|
||||||
}
|
}
|
||||||
if (count($host) > 2) {
|
if (count($host) > 2) {
|
||||||
$subdomain = $host[0];
|
$subdomain = $host[0];
|
||||||
}
|
}
|
||||||
@ -1087,6 +1087,25 @@ class Utils
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getCustomLabel($value)
|
||||||
|
{
|
||||||
|
if (strpos($value, '|') !== false) {
|
||||||
|
return explode('|', $value)[0];
|
||||||
|
} else {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCustomValues($value)
|
||||||
|
{
|
||||||
|
if (strpos($value, '|') !== false) {
|
||||||
|
$values = explode(',', explode('|', $value)[1]);
|
||||||
|
return array_combine($values, $values);
|
||||||
|
} else {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static function formatWebsite($link)
|
public static function formatWebsite($link)
|
||||||
{
|
{
|
||||||
if (! $link) {
|
if (! $link) {
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Models\Traits;
|
namespace App\Models\Traits;
|
||||||
|
|
||||||
|
use Utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class PresentsInvoice.
|
* Class PresentsInvoice.
|
||||||
*/
|
*/
|
||||||
@ -362,7 +364,7 @@ trait PresentsInvoice
|
|||||||
'product.custom_value1' => 'custom_invoice_item_label1',
|
'product.custom_value1' => 'custom_invoice_item_label1',
|
||||||
'product.custom_value2' => 'custom_invoice_item_label2',
|
'product.custom_value2' => 'custom_invoice_item_label2',
|
||||||
] as $field => $property) {
|
] as $field => $property) {
|
||||||
$data[$field] = e($this->$property) ?: trans('texts.custom_field');
|
$data[$field] = e(Utils::getCustomLabel($this->$property)) ?: trans('texts.custom_field');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
@ -264,4 +264,56 @@ class AccountPresenter extends Presenter
|
|||||||
|
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function customClientLabel1()
|
||||||
|
{
|
||||||
|
return Utils::getCustomLabel($this->entity->custom_client_label1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function customClientLabel2()
|
||||||
|
{
|
||||||
|
return Utils::getCustomLabel($this->entity->custom_client_label2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function customContactLabel1()
|
||||||
|
{
|
||||||
|
return Utils::getCustomLabel($this->entity->custom_contact_label1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function customContactLabel2()
|
||||||
|
{
|
||||||
|
return Utils::getCustomLabel($this->entity->custom_contact_label2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function customInvoiceLabel1()
|
||||||
|
{
|
||||||
|
return Utils::getCustomLabel($this->entity->custom_invoice_label1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function customInvoiceLabel2()
|
||||||
|
{
|
||||||
|
return Utils::getCustomLabel($this->entity->custom_invoice_label2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function customInvoiceTextLabel1()
|
||||||
|
{
|
||||||
|
return Utils::getCustomLabel($this->entity->custom_invoice_text_label1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function customInvoiceTextLabel2()
|
||||||
|
{
|
||||||
|
return Utils::getCustomLabel($this->entity->custom_invoice_text_label1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function customProductLabel1()
|
||||||
|
{
|
||||||
|
return Utils::getCustomLabel($this->entity->custom_invoice_item_label1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function customProductLabel2()
|
||||||
|
{
|
||||||
|
return Utils::getCustomLabel($this->entity->custom_invoice_item_label2);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -143,10 +143,10 @@ class AccountRepository
|
|||||||
|
|
||||||
// include custom client fields in search
|
// include custom client fields in search
|
||||||
if ($account->custom_client_label1) {
|
if ($account->custom_client_label1) {
|
||||||
$data[$account->custom_client_label1] = [];
|
$data[$account->present()->customClientLabel1] = [];
|
||||||
}
|
}
|
||||||
if ($account->custom_client_label2) {
|
if ($account->custom_client_label2) {
|
||||||
$data[$account->custom_client_label2] = [];
|
$data[$account->present()->customClientLabel2] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->hasPermission('view_all')) {
|
if ($user->hasPermission('view_all')) {
|
||||||
@ -176,14 +176,14 @@ class AccountRepository
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($client->custom_value1) {
|
if ($client->custom_value1) {
|
||||||
$data[$account->custom_client_label1][] = [
|
$data[$account->present()->customClientLabel1][] = [
|
||||||
'value' => "{$client->custom_value1}: " . $client->getDisplayName(),
|
'value' => "{$client->custom_value1}: " . $client->getDisplayName(),
|
||||||
'tokens' => $client->custom_value1,
|
'tokens' => $client->custom_value1,
|
||||||
'url' => $client->present()->url,
|
'url' => $client->present()->url,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if ($client->custom_value2) {
|
if ($client->custom_value2) {
|
||||||
$data[$account->custom_client_label2][] = [
|
$data[$account->present()->customClientLabel2][] = [
|
||||||
'value' => "{$client->custom_value2}: " . $client->getDisplayName(),
|
'value' => "{$client->custom_value2}: " . $client->getDisplayName(),
|
||||||
'tokens' => $client->custom_value2,
|
'tokens' => $client->custom_value2,
|
||||||
'url' => $client->present()->url,
|
'url' => $client->present()->url,
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -646,13 +646,13 @@ NINJA.invoiceLines = function(invoice, isSecondTable) {
|
|||||||
|
|
||||||
if (field == 'custom_value1') {
|
if (field == 'custom_value1') {
|
||||||
if (invoice.has_custom_item_value1) {
|
if (invoice.has_custom_item_value1) {
|
||||||
value = account.custom_invoice_item_label1;
|
value = NINJA.getCustomLabel(account.custom_invoice_item_label1);
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else if (field == 'custom_value2') {
|
} else if (field == 'custom_value2') {
|
||||||
if (invoice.has_custom_item_value2) {
|
if (invoice.has_custom_item_value2) {
|
||||||
value = account.custom_invoice_item_label2;
|
value = NINJA.getCustomLabel(account.custom_invoice_item_label2);
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1136,22 +1136,22 @@ NINJA.renderField = function(invoice, field, twoColumn) {
|
|||||||
value = contact.phone;
|
value = contact.phone;
|
||||||
} else if (field == 'client.custom_value1') {
|
} else if (field == 'client.custom_value1') {
|
||||||
if (account.custom_client_label1 && client.custom_value1) {
|
if (account.custom_client_label1 && client.custom_value1) {
|
||||||
label = account.custom_client_label1;
|
label = NINJA.getCustomLabel(account.custom_client_label1);
|
||||||
value = client.custom_value1;
|
value = client.custom_value1;
|
||||||
}
|
}
|
||||||
} else if (field == 'client.custom_value2') {
|
} else if (field == 'client.custom_value2') {
|
||||||
if (account.custom_client_label2 && client.custom_value2) {
|
if (account.custom_client_label2 && client.custom_value2) {
|
||||||
label = account.custom_client_label2;
|
label = NINJA.getCustomLabel(account.custom_client_label2);
|
||||||
value = client.custom_value2;
|
value = client.custom_value2;
|
||||||
}
|
}
|
||||||
} else if (field == 'contact.custom_value1') {
|
} else if (field == 'contact.custom_value1') {
|
||||||
if (account.custom_contact_label1 && contact.custom_value1) {
|
if (account.custom_contact_label1 && contact.custom_value1) {
|
||||||
label = account.custom_contact_label1;
|
label = NINJA.getCustomLabel(account.custom_contact_label1);
|
||||||
value = contact.custom_value1;
|
value = contact.custom_value1;
|
||||||
}
|
}
|
||||||
} else if (field == 'contact.custom_value2') {
|
} else if (field == 'contact.custom_value2') {
|
||||||
if (account.custom_contact_label2 && contact.custom_value2) {
|
if (account.custom_contact_label2 && contact.custom_value2) {
|
||||||
label = account.custom_contact_label2;
|
label = NINJA.getCustomLabel(account.custom_contact_label2);
|
||||||
value = contact.custom_value2;
|
value = contact.custom_value2;
|
||||||
}
|
}
|
||||||
} else if (field == 'account.company_name') {
|
} else if (field == 'account.company_name') {
|
||||||
@ -1222,12 +1222,12 @@ NINJA.renderField = function(invoice, field, twoColumn) {
|
|||||||
}
|
}
|
||||||
} else if (field == 'invoice.custom_text_value1') {
|
} else if (field == 'invoice.custom_text_value1') {
|
||||||
if (invoice.custom_text_value1 && account.custom_invoice_text_label1) {
|
if (invoice.custom_text_value1 && account.custom_invoice_text_label1) {
|
||||||
label = invoice.account.custom_invoice_text_label1;
|
label = NINJA.getCustomLabel(invoice.account.custom_invoice_text_label1);
|
||||||
value = invoice.is_recurring ? processVariables(invoice.custom_text_value1) : invoice.custom_text_value1;
|
value = invoice.is_recurring ? processVariables(invoice.custom_text_value1) : invoice.custom_text_value1;
|
||||||
}
|
}
|
||||||
} else if (field == 'invoice.custom_text_value2') {
|
} else if (field == 'invoice.custom_text_value2') {
|
||||||
if (invoice.custom_text_value2 && account.custom_invoice_text_label2) {
|
if (invoice.custom_text_value2 && account.custom_invoice_text_label2) {
|
||||||
label = invoice.account.custom_invoice_text_label2;
|
label = NINJA.getCustomLabel(invoice.account.custom_invoice_text_label2);
|
||||||
value = invoice.is_recurring ? processVariables(invoice.custom_text_value2) : invoice.custom_text_value2;
|
value = invoice.is_recurring ? processVariables(invoice.custom_text_value2) : invoice.custom_text_value2;
|
||||||
}
|
}
|
||||||
} else if (field == 'invoice.balance_due') {
|
} else if (field == 'invoice.balance_due') {
|
||||||
@ -1478,3 +1478,11 @@ NINJA.parseRegExpLine = function(line, regExp, formatter, groupText)
|
|||||||
|
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NINJA.getCustomLabel = function(value) {
|
||||||
|
if (value && value.indexOf('|') > 0) {
|
||||||
|
return value.split('|')[0];
|
||||||
|
} else {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -2651,6 +2651,7 @@ $LANG = array(
|
|||||||
'return_to_login' => 'Return to Login',
|
'return_to_login' => 'Return to Login',
|
||||||
'convert_products_tip' => 'Note: add a custom field named ":name" to see the exchange rate.',
|
'convert_products_tip' => 'Note: add a custom field named ":name" to see the exchange rate.',
|
||||||
'amount_greater_than_balance' => 'The amount is greater than the invoice balance, a credit will be created with the remaining amount.',
|
'amount_greater_than_balance' => 'The amount is greater than the invoice balance, a credit will be created with the remaining amount.',
|
||||||
|
'custom_fields_tip' => 'Use <code>Label|Option1,Option2</code> to show a select box.'
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -242,7 +242,7 @@
|
|||||||
->label(trans('texts.field_label')) !!}
|
->label(trans('texts.field_label')) !!}
|
||||||
{!! Former::text('custom_client_label2')
|
{!! Former::text('custom_client_label2')
|
||||||
->label(trans('texts.field_label'))
|
->label(trans('texts.field_label'))
|
||||||
->help(trans('texts.custom_client_fields_helps')) !!}
|
->help(trans('texts.custom_client_fields_helps') . ' ' . trans('texts.custom_fields_tip')) !!}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -253,7 +253,7 @@
|
|||||||
->label(trans('texts.field_label')) !!}
|
->label(trans('texts.field_label')) !!}
|
||||||
{!! Former::text('custom_contact_label2')
|
{!! Former::text('custom_contact_label2')
|
||||||
->label(trans('texts.field_label'))
|
->label(trans('texts.field_label'))
|
||||||
->help(trans('texts.custom_contact_fields_help')) !!}
|
->help(trans('texts.custom_contact_fields_help') . ' ' . trans('texts.custom_fields_tip')) !!}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -280,7 +280,7 @@
|
|||||||
->label(trans('texts.field_label')) !!}
|
->label(trans('texts.field_label')) !!}
|
||||||
{!! Former::text('custom_invoice_item_label2')
|
{!! Former::text('custom_invoice_item_label2')
|
||||||
->label(trans('texts.field_label'))
|
->label(trans('texts.field_label'))
|
||||||
->help(trans('texts.custom_product_fields_help')) !!}
|
->help(trans('texts.custom_product_fields_help') . ' ' . trans('texts.custom_fields_tip')) !!}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -291,7 +291,7 @@
|
|||||||
->label(trans('texts.field_label')) !!}
|
->label(trans('texts.field_label')) !!}
|
||||||
{!! Former::text('custom_invoice_text_label2')
|
{!! Former::text('custom_invoice_text_label2')
|
||||||
->label(trans('texts.field_label'))
|
->label(trans('texts.field_label'))
|
||||||
->help(trans('texts.custom_invoice_fields_helps')) !!}
|
->help(trans('texts.custom_invoice_fields_helps') . ' ' . trans('texts.custom_fields_tip')) !!}
|
||||||
|
|
||||||
{!! Former::text('custom_invoice_label1')
|
{!! Former::text('custom_invoice_label1')
|
||||||
->label(trans('texts.surcharge_label'))
|
->label(trans('texts.surcharge_label'))
|
||||||
|
@ -29,10 +29,16 @@
|
|||||||
|
|
||||||
@if ($account->hasFeature(FEATURE_INVOICE_SETTINGS))
|
@if ($account->hasFeature(FEATURE_INVOICE_SETTINGS))
|
||||||
@if ($account->custom_invoice_item_label1)
|
@if ($account->custom_invoice_item_label1)
|
||||||
{!! Former::text('custom_value1')->label(e($account->custom_invoice_item_label1)) !!}
|
@include('partials.custom_field', [
|
||||||
|
'field' => 'custom_value1',
|
||||||
|
'label' => $account->custom_invoice_item_label1
|
||||||
|
])
|
||||||
@endif
|
@endif
|
||||||
@if ($account->custom_invoice_item_label2)
|
@if ($account->custom_invoice_item_label2)
|
||||||
{!! Former::text('custom_value2')->label(e($account->custom_invoice_item_label2)) !!}
|
@include('partials.custom_field', [
|
||||||
|
'field' => 'custom_value2',
|
||||||
|
'label' => $account->custom_invoice_item_label2
|
||||||
|
])
|
||||||
@endif
|
@endif
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@ -46,7 +52,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<center class="buttons">
|
<center class="buttons">
|
||||||
{!! Button::normal(trans('texts.cancel'))->large()->asLinkTo(HTMLUtils::previousUrl('/products'))->appendIcon(Icon::create('remove-circle')) !!}
|
{!! Button::normal(trans('texts.cancel'))->large()->asLinkTo(HTMLUtils::previousUrl('/products'))->appendIcon(Icon::create('remove-circle')) !!}
|
||||||
{!! Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk')) !!}
|
{!! Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk')) !!}
|
||||||
|
@ -53,10 +53,16 @@
|
|||||||
|
|
||||||
@if (Auth::user()->hasFeature(FEATURE_INVOICE_SETTINGS))
|
@if (Auth::user()->hasFeature(FEATURE_INVOICE_SETTINGS))
|
||||||
@if ($customLabel1)
|
@if ($customLabel1)
|
||||||
{!! Former::text('custom_value1')->label(e($customLabel1)) !!}
|
@include('partials.custom_field', [
|
||||||
|
'field' => 'custom_value1',
|
||||||
|
'label' => $customLabel1
|
||||||
|
])
|
||||||
@endif
|
@endif
|
||||||
@if ($customLabel2)
|
@if ($customLabel2)
|
||||||
{!! Former::text('custom_value2')->label(e($customLabel2)) !!}
|
@include('partials.custom_field', [
|
||||||
|
'field' => 'custom_value2',
|
||||||
|
'label' => $customLabel2
|
||||||
|
])
|
||||||
@endif
|
@endif
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@ -154,14 +160,20 @@
|
|||||||
|
|
||||||
@if (Auth::user()->hasFeature(FEATURE_INVOICE_SETTINGS))
|
@if (Auth::user()->hasFeature(FEATURE_INVOICE_SETTINGS))
|
||||||
@if ($account->custom_contact_label1)
|
@if ($account->custom_contact_label1)
|
||||||
{!! Former::text('custom_contact1')->data_bind("value: custom_value1, valueUpdate: 'afterkeydown',
|
@include('partials.custom_field', [
|
||||||
attr: {name: 'contacts[' + \$index() + '][custom_value1]'}")
|
'field' => 'custom_contact1',
|
||||||
->label(e($account->custom_contact_label1)) !!}
|
'label' => $account->custom_contact_label1,
|
||||||
|
'databind' => "value: custom_value1, valueUpdate: 'afterkeydown',
|
||||||
|
attr: {name: 'contacts[' + \$index() + '][custom_value1]'}",
|
||||||
|
])
|
||||||
@endif
|
@endif
|
||||||
@if ($account->custom_contact_label2)
|
@if ($account->custom_contact_label2)
|
||||||
{!! Former::text('custom_contact2')->data_bind("value: custom_value2, valueUpdate: 'afterkeydown',
|
@include('partials.custom_field', [
|
||||||
attr: {name: 'contacts[' + \$index() + '][custom_value2]'}")
|
'field' => 'custom_contact2',
|
||||||
->label(e($account->custom_contact_label2)) !!}
|
'label' => $account->custom_contact_label2,
|
||||||
|
'databind' => "value: custom_value2, valueUpdate: 'afterkeydown',
|
||||||
|
attr: {name: 'contacts[' + \$index() + '][custom_value2]'}",
|
||||||
|
])
|
||||||
@endif
|
@endif
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
@ -99,10 +99,10 @@
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if ($client->account->custom_client_label1 && $client->custom_value1)
|
@if ($client->account->custom_client_label1 && $client->custom_value1)
|
||||||
{{ $client->account->custom_client_label1 . ': ' . $client->custom_value1 }}<br/>
|
{{ $client->account->present()->customClientLabel1 . ': ' . $client->custom_value1 }}<br/>
|
||||||
@endif
|
@endif
|
||||||
@if ($client->account->custom_client_label2 && $client->custom_value2)
|
@if ($client->account->custom_client_label2 && $client->custom_value2)
|
||||||
{{ $client->account->custom_client_label2 . ': ' . $client->custom_value2 }}<br/>
|
{{ $client->account->present()->customClientLabel2 . ': ' . $client->custom_value2 }}<br/>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if ($client->work_phone)
|
@if ($client->work_phone)
|
||||||
@ -172,10 +172,10 @@
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if ($client->account->custom_contact_label1 && $contact->custom_value1)
|
@if ($client->account->custom_contact_label1 && $contact->custom_value1)
|
||||||
{{ $client->account->custom_contact_label1 . ': ' . $contact->custom_value1 }}<br/>
|
{{ $client->account->present()->customContactLabel1() . ': ' . $contact->custom_value1 }}<br/>
|
||||||
@endif
|
@endif
|
||||||
@if ($client->account->custom_contact_label2 && $contact->custom_value2)
|
@if ($client->account->custom_contact_label2 && $contact->custom_value2)
|
||||||
{{ $client->account->custom_contact_label2 . ': ' . $contact->custom_value2 }}<br/>
|
{{ $client->account->present()->customContactLabel2() . ': ' . $contact->custom_value2 }}<br/>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if (Auth::user()->confirmed && $client->account->enable_client_portal)
|
@if (Auth::user()->confirmed && $client->account->enable_client_portal)
|
||||||
|
@ -25,20 +25,20 @@
|
|||||||
<td>{{ trans('texts.public_notes') }}</td>
|
<td>{{ trans('texts.public_notes') }}</td>
|
||||||
<td>{{ trans('texts.private_notes') }}</td>
|
<td>{{ trans('texts.private_notes') }}</td>
|
||||||
@if ($account->custom_client_label1)
|
@if ($account->custom_client_label1)
|
||||||
<td>{{ $account->custom_client_label1 }}</td>
|
<td>{{ $account->present()->customClientLabel1 }}</td>
|
||||||
@endif
|
@endif
|
||||||
@if ($account->custom_client_label2)
|
@if ($account->custom_client_label2)
|
||||||
<td>{{ $account->custom_client_label2 }}</td>
|
<td>{{ $account->present()->customClientLabel2 }}</td>
|
||||||
@endif
|
@endif
|
||||||
<td>{{ trans('texts.first_name') }}</td>
|
<td>{{ trans('texts.first_name') }}</td>
|
||||||
<td>{{ trans('texts.last_name') }}</td>
|
<td>{{ trans('texts.last_name') }}</td>
|
||||||
<td>{{ trans('texts.email') }}</td>
|
<td>{{ trans('texts.email') }}</td>
|
||||||
<td>{{ trans('texts.phone') }}</td>
|
<td>{{ trans('texts.phone') }}</td>
|
||||||
@if ($account->custom_contact_label1)
|
@if ($account->custom_contact_label1)
|
||||||
<td>{{ $account->custom_contact_label1 }}</td>
|
<td>{{ $account->present()->customContactLabel1 }}</td>
|
||||||
@endif
|
@endif
|
||||||
@if ($account->custom_contact_label2)
|
@if ($account->custom_contact_label2)
|
||||||
<td>{{ $account->custom_contact_label2 }}</td>
|
<td>{{ $account->present()->customContactLabel2 }}</td>
|
||||||
@endif
|
@endif
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
@ -8,10 +8,10 @@
|
|||||||
<td>{{ trans('texts.email') }}</td>
|
<td>{{ trans('texts.email') }}</td>
|
||||||
<td>{{ trans('texts.phone') }}</td>
|
<td>{{ trans('texts.phone') }}</td>
|
||||||
@if ($account->custom_contact_label1)
|
@if ($account->custom_contact_label1)
|
||||||
<td>{{ $account->custom_contact_label1 }}</td>
|
<td>{{ $account->present()->customContactLabel1 }}</td>
|
||||||
@endif
|
@endif
|
||||||
@if ($account->custom_contact_label2)
|
@if ($account->custom_contact_label2)
|
||||||
<td>{{ $account->custom_contact_label2 }}</td>
|
<td>{{ $account->present()->customContactLabel2 }}</td>
|
||||||
@endif
|
@endif
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
@ -18,24 +18,24 @@
|
|||||||
<td>{{ trans('texts.public_notes') }}</td>
|
<td>{{ trans('texts.public_notes') }}</td>
|
||||||
<td>{{ trans('texts.private_notes') }}</td>
|
<td>{{ trans('texts.private_notes') }}</td>
|
||||||
@if ($account->custom_invoice_label1)
|
@if ($account->custom_invoice_label1)
|
||||||
<td>{{ $account->custom_invoice_label1 }}</td>
|
<td>{{ $account->present()->customInvoiceLabel1 }}</td>
|
||||||
@endif
|
@endif
|
||||||
@if ($account->custom_invoice_label2)
|
@if ($account->custom_invoice_label2)
|
||||||
<td>{{ $account->custom_invoice_label2 }}</td>
|
<td>{{ $account->present()->customInvoiceLabel2 }}</td>
|
||||||
@endif
|
@endif
|
||||||
@if ($account->custom_invoice_text_label1)
|
@if ($account->custom_invoice_text_label1)
|
||||||
<td>{{ $account->custom_invoice_text_label1 }}</td>
|
<td>{{ $account->present()->customInvoiceTextLabel1 }}</td>
|
||||||
@endif
|
@endif
|
||||||
@if ($account->custom_invoice_text_label2)
|
@if ($account->custom_invoice_text_label2)
|
||||||
<td>{{ $account->custom_invoice_text_label2 }}</td>
|
<td>{{ $account->present()->customInvoiceTextLabel1 }}</td>
|
||||||
@endif
|
@endif
|
||||||
<td>{{ trans('texts.item_product') }}</td>
|
<td>{{ trans('texts.item_product') }}</td>
|
||||||
<td>{{ trans('texts.item_notes') }}</td>
|
<td>{{ trans('texts.item_notes') }}</td>
|
||||||
@if ($account->custom_invoice_item_label1)
|
@if ($account->custom_invoice_item_label1)
|
||||||
<td>{{ $account->custom_invoice_item_label1 }}</td>
|
<td>{{ $account->present()->customProductLabel1 }}</td>
|
||||||
@endif
|
@endif
|
||||||
@if ($account->custom_invoice_item_label2)
|
@if ($account->custom_invoice_item_label2)
|
||||||
<td>{{ $account->custom_invoice_item_label2 }}</td>
|
<td>{{ $account->present()->customProductLabel2 }}</td>
|
||||||
@endif
|
@endif
|
||||||
<td>{{ trans('texts.item_cost') }}</td>
|
<td>{{ trans('texts.item_cost') }}</td>
|
||||||
<td>{{ trans('texts.item_quantity') }}</td>
|
<td>{{ trans('texts.item_quantity') }}</td>
|
||||||
@ -77,10 +77,10 @@
|
|||||||
@if ($account->custom_invoice_label2)
|
@if ($account->custom_invoice_label2)
|
||||||
<td>{{ $invoice->custom_value2 }}</td>
|
<td>{{ $invoice->custom_value2 }}</td>
|
||||||
@endif
|
@endif
|
||||||
@if ($account->custom_invoice_label1)
|
@if ($account->custom_invoice_text_label1)
|
||||||
<td>{{ $invoice->custom_text_value1 }}</td>
|
<td>{{ $invoice->custom_text_value1 }}</td>
|
||||||
@endif
|
@endif
|
||||||
@if ($account->custom_invoice_label2)
|
@if ($account->custom_invoice_text_label2)
|
||||||
<td>{{ $invoice->custom_text_value2 }}</td>
|
<td>{{ $invoice->custom_text_value2 }}</td>
|
||||||
@endif
|
@endif
|
||||||
<td>{{ $item->product_key }}</td>
|
<td>{{ $item->product_key }}</td>
|
||||||
|
@ -5,6 +5,12 @@
|
|||||||
<td>{{ trans('texts.product') }}</td>
|
<td>{{ trans('texts.product') }}</td>
|
||||||
<td>{{ trans('texts.notes') }}</td>
|
<td>{{ trans('texts.notes') }}</td>
|
||||||
<td>{{ trans('texts.cost') }}</td>
|
<td>{{ trans('texts.cost') }}</td>
|
||||||
|
@if ($account->custom_invoice_item_label1)
|
||||||
|
<td>{{ $account->present()->customProductLabel1 }}</td>
|
||||||
|
@endif
|
||||||
|
@if ($account->custom_invoice_item_label2)
|
||||||
|
<td>{{ $account->present()->customProductLabel2 }}</td>
|
||||||
|
@endif
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@foreach ($products as $product)
|
@foreach ($products as $product)
|
||||||
@ -15,5 +21,14 @@
|
|||||||
<td>{{ $product->product_key }}</td>
|
<td>{{ $product->product_key }}</td>
|
||||||
<td>{{ $product->notes }}</td>
|
<td>{{ $product->notes }}</td>
|
||||||
<td>{{ $product->cost }}</td>
|
<td>{{ $product->cost }}</td>
|
||||||
|
@if ($account->custom_invoice_item_label1)
|
||||||
|
|
||||||
|
@endif
|
||||||
|
@if ($account->custom_invoice_item_label1)
|
||||||
|
<td>{{ $product->custom_value1 }}</td>
|
||||||
|
@endif
|
||||||
|
@if ($account->custom_invoice_item_label2)
|
||||||
|
<td>{{ $product->custom_value2 }}</td>
|
||||||
|
@endif
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
@ -57,7 +57,6 @@
|
|||||||
window.loadedSearchData = true;
|
window.loadedSearchData = true;
|
||||||
trackEvent('/activity', '/search');
|
trackEvent('/activity', '/search');
|
||||||
var request = $.get('{{ URL::route('get_search_data') }}', function(data) {
|
var request = $.get('{{ URL::route('get_search_data') }}', function(data) {
|
||||||
console.log(data);
|
|
||||||
$('#search').typeahead({
|
$('#search').typeahead({
|
||||||
hint: true,
|
hint: true,
|
||||||
highlight: true,
|
highlight: true,
|
||||||
@ -67,9 +66,9 @@
|
|||||||
name: 'data',
|
name: 'data',
|
||||||
limit: 3,
|
limit: 3,
|
||||||
display: 'value',
|
display: 'value',
|
||||||
source: searchData(data['{{ Auth::user()->account->custom_client_label1 }}'], 'tokens'),
|
source: searchData(data['{{ Auth::user()->account->present()->customClientLabel1 }}'], 'tokens'),
|
||||||
templates: {
|
templates: {
|
||||||
header: ' <span style="font-weight:600;font-size:16px">{{ Auth::user()->account->custom_client_label1 }}</span>'
|
header: ' <span style="font-weight:600;font-size:16px">{{ Auth::user()->account->present()->customClientLabel1 }}</span>'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@endif
|
@endif
|
||||||
@ -78,9 +77,9 @@
|
|||||||
name: 'data',
|
name: 'data',
|
||||||
limit: 3,
|
limit: 3,
|
||||||
display: 'value',
|
display: 'value',
|
||||||
source: searchData(data['{{ Auth::user()->account->custom_client_label2 }}'], 'tokens'),
|
source: searchData(data['{{ Auth::user()->account->present()->customClientLabel2 }}'], 'tokens'),
|
||||||
templates: {
|
templates: {
|
||||||
header: ' <span style="font-weight:600;font-size:16px">{{ Auth::user()->account->custom_client_label2 }}</span>'
|
header: ' <span style="font-weight:600;font-size:16px">{{ Auth::user()->account->present()->customClientLabel2 }}</span>'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@endif
|
@endif
|
||||||
|
@ -225,7 +225,11 @@
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if ($account->showCustomField('custom_invoice_text_label1', $invoice))
|
@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'") !!}
|
@include('partials.custom_field', [
|
||||||
|
'field' => 'custom_text_value1',
|
||||||
|
'label' => $account->custom_invoice_text_label1,
|
||||||
|
'databind' => "value: custom_text_value1, valueUpdate: 'afterkeydown'",
|
||||||
|
])
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -273,7 +277,11 @@
|
|||||||
) !!}
|
) !!}
|
||||||
|
|
||||||
@if ($account->showCustomField('custom_invoice_text_label2', $invoice))
|
@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'") !!}
|
@include('partials.custom_field', [
|
||||||
|
'field' => 'custom_text_value2',
|
||||||
|
'label' => $account->custom_invoice_text_label2,
|
||||||
|
'databind' => "value: custom_text_value2, valueUpdate: 'afterkeydown'",
|
||||||
|
])
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if ($entityType == ENTITY_INVOICE)
|
@if ($entityType == ENTITY_INVOICE)
|
||||||
@ -617,14 +625,18 @@
|
|||||||
|
|
||||||
@if (Auth::user()->hasFeature(FEATURE_INVOICE_SETTINGS))
|
@if (Auth::user()->hasFeature(FEATURE_INVOICE_SETTINGS))
|
||||||
@if ($account->custom_client_label1)
|
@if ($account->custom_client_label1)
|
||||||
{!! Former::text('client[custom_value1]')
|
@include('partials.custom_field', [
|
||||||
->label(e($account->custom_client_label1))
|
'field' => 'client[custom_value1]',
|
||||||
->data_bind("value: custom_value1, valueUpdate: 'afterkeydown'") !!}
|
'label' => $account->custom_client_label1,
|
||||||
|
'databind' => "value: custom_value1, valueUpdate: 'afterkeydown'",
|
||||||
|
])
|
||||||
@endif
|
@endif
|
||||||
@if ($account->custom_client_label2)
|
@if ($account->custom_client_label2)
|
||||||
{!! Former::text('client[custom_value2]')
|
@include('partials.custom_field', [
|
||||||
->label(e($account->custom_client_label2))
|
'field' => 'client[custom_value2]',
|
||||||
->data_bind("value: custom_value2, valueUpdate: 'afterkeydown'") !!}
|
'label' => $account->custom_client_label2,
|
||||||
|
'databind' => "value: custom_value1, valueUpdate: 'afterkeydown'",
|
||||||
|
])
|
||||||
@endif
|
@endif
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@ -677,14 +689,20 @@
|
|||||||
@endif
|
@endif
|
||||||
@if (Auth::user()->hasFeature(FEATURE_INVOICE_SETTINGS))
|
@if (Auth::user()->hasFeature(FEATURE_INVOICE_SETTINGS))
|
||||||
@if ($account->custom_contact_label1)
|
@if ($account->custom_contact_label1)
|
||||||
{!! Former::text('custom_contact1')->data_bind("value: custom_value1, valueUpdate: 'afterkeydown',
|
@include('partials.custom_field', [
|
||||||
attr: {name: 'client[contacts][' + \$index() + '][custom_value1]'}")
|
'field' => 'custom_contact1',
|
||||||
->label(e($account->custom_contact_label1)) !!}
|
'label' => $account->custom_contact_label1,
|
||||||
|
'databind' => "value: custom_value1, valueUpdate: 'afterkeydown',
|
||||||
|
attr: {name: 'client[contacts][' + \$index() + '][custom_value1]'}",
|
||||||
|
])
|
||||||
@endif
|
@endif
|
||||||
@if ($account->custom_contact_label2)
|
@if ($account->custom_contact_label2)
|
||||||
{!! Former::text('custom_contact2')->data_bind("value: custom_value2, valueUpdate: 'afterkeydown',
|
@include('partials.custom_field', [
|
||||||
attr: {name: 'client[contacts][' + \$index() + '][custom_value2]'}")
|
'field' => 'custom_contact2',
|
||||||
->label(e($account->custom_contact_label2)) !!}
|
'label' => $account->custom_contact_label2,
|
||||||
|
'databind' => "value: custom_value2, valueUpdate: 'afterkeydown',
|
||||||
|
attr: {name: 'client[contacts][' + \$index() + '][custom_value2]'}",
|
||||||
|
])
|
||||||
@endif
|
@endif
|
||||||
@endif
|
@endif
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
@ -10,10 +10,10 @@
|
|||||||
<th style="min-width:120px;width:25%">{{ $invoiceLabels[$isTasks ? 'service' : 'item'] }}</th>
|
<th style="min-width:120px;width:25%">{{ $invoiceLabels[$isTasks ? 'service' : 'item'] }}</th>
|
||||||
<th style="width:100%">{{ $invoiceLabels['description'] }}</th>
|
<th style="width:100%">{{ $invoiceLabels['description'] }}</th>
|
||||||
@if ($account->showCustomField('custom_invoice_item_label1'))
|
@if ($account->showCustomField('custom_invoice_item_label1'))
|
||||||
<th style="min-width:120px">{{ $account->custom_invoice_item_label1 }}</th>
|
<th style="min-width:120px">{{ $account->present()->customProductLabel1 }}</th>
|
||||||
@endif
|
@endif
|
||||||
@if ($account->showCustomField('custom_invoice_item_label2'))
|
@if ($account->showCustomField('custom_invoice_item_label2'))
|
||||||
<th style="min-width:120px">{{ $account->custom_invoice_item_label2 }}</th>
|
<th style="min-width:120px">{{ $account->present()->customProductLabel2 }}</th>
|
||||||
@endif
|
@endif
|
||||||
<th style="min-width:120px">{{ $invoiceLabels[$isTasks ? 'rate' : 'unit_cost'] }}</th>
|
<th style="min-width:120px">{{ $invoiceLabels[$isTasks ? 'rate' : 'unit_cost'] }}</th>
|
||||||
<th style="min-width:120px;display:{{ $account->hasInvoiceField($isTasks ? 'task' : 'product', $isTasks ? 'product.hours' : 'product.quantity') ? 'table-cell' : 'none' }}">{{ $invoiceLabels[$isTasks ? 'hours' : 'quantity'] }}</th>
|
<th style="min-width:120px;display:{{ $account->hasInvoiceField($isTasks ? 'task' : 'product', $isTasks ? 'product.hours' : 'product.quantity') ? 'table-cell' : 'none' }}">{{ $invoiceLabels[$isTasks ? 'hours' : 'quantity'] }}</th>
|
||||||
@ -44,12 +44,24 @@
|
|||||||
</td>
|
</td>
|
||||||
@if ($account->showCustomField('custom_invoice_item_label1'))
|
@if ($account->showCustomField('custom_invoice_item_label1'))
|
||||||
<td>
|
<td>
|
||||||
<input data-bind="value: custom_value1, valueUpdate: 'afterkeydown', attr: {name: 'invoice_items[{{ $isTasks ? 'T' : '' }}' + $index() + '][custom_value1]'}" class="form-control invoice-item"/>
|
@include('partials.custom_field', [
|
||||||
|
'field' => 'custom_invoice_item_label1',
|
||||||
|
'label' => $account->custom_invoice_item_label1,
|
||||||
|
'databind' => "value: custom_value1, valueUpdate: 'afterkeydown',
|
||||||
|
attr: {name: 'invoice_items[" . ($isTasks ? 'T' : '') . "' + \$index() + '][custom_value1]'}",
|
||||||
|
'raw' => true,
|
||||||
|
])
|
||||||
</td>
|
</td>
|
||||||
@endif
|
@endif
|
||||||
@if ($account->showCustomField('custom_invoice_item_label2'))
|
@if ($account->showCustomField('custom_invoice_item_label2'))
|
||||||
<td>
|
<td>
|
||||||
<input data-bind="value: custom_value2, valueUpdate: 'afterkeydown', attr: {name: 'invoice_items[{{ $isTasks ? 'T' : '' }}' + $index() + '][custom_value2]'}" class="form-control invoice-item"/>
|
@include('partials.custom_field', [
|
||||||
|
'field' => 'custom_invoice_item_label2',
|
||||||
|
'label' => $account->custom_invoice_item_label2,
|
||||||
|
'databind' => "value: custom_value2, valueUpdate: 'afterkeydown',
|
||||||
|
attr: {name: 'invoice_items[" . ($isTasks ? 'T' : '') . "' + \$index() + '][custom_value2]'}",
|
||||||
|
'raw' => true,
|
||||||
|
])
|
||||||
</td>
|
</td>
|
||||||
@endif
|
@endif
|
||||||
<td>
|
<td>
|
||||||
|
29
resources/views/partials/custom_field.blade.php
Normal file
29
resources/views/partials/custom_field.blade.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
@if (empty($raw))
|
||||||
|
@if (strpos($label, '|') !== false)
|
||||||
|
{!! Former::select($field)
|
||||||
|
->label(Utils::getCustomLabel($label))
|
||||||
|
->addOption('', '')
|
||||||
|
->options(Utils::getCustomValues($label))
|
||||||
|
->data_bind(empty($databind) ? '' : $databind) !!}
|
||||||
|
@else
|
||||||
|
{!! Former::text($field)
|
||||||
|
->label(e($label))
|
||||||
|
->data_bind(empty($databind) ? '' : $databind) !!}
|
||||||
|
@endif
|
||||||
|
@else
|
||||||
|
@if (strpos($label, '|') !== false)
|
||||||
|
{!! Former::select($field)
|
||||||
|
->label(Utils::getCustomLabel($label))
|
||||||
|
->addOption('', '')
|
||||||
|
->options(Utils::getCustomValues($label))
|
||||||
|
->data_bind(empty($databind) ? '' : $databind)
|
||||||
|
->addClass('form-control invoice-item')
|
||||||
|
->raw() !!}
|
||||||
|
@else
|
||||||
|
{!! Former::text($field)
|
||||||
|
->label(e($label))
|
||||||
|
->data_bind(empty($databind) ? '' : $databind)
|
||||||
|
->addClass('form-control invoice-item')
|
||||||
|
->raw() !!}
|
||||||
|
@endif
|
||||||
|
@endif
|
Loading…
x
Reference in New Issue
Block a user