Added custom invoice fields to search

This commit is contained in:
Hillel Coren 2018-06-17 10:07:55 +03:00
parent 9d6b8aed15
commit bf55ff4ce4
2 changed files with 37 additions and 0 deletions

View File

@ -234,6 +234,21 @@ class AccountRepository
'tokens' => implode(',', [$invoice->invoice_number, $invoice->po_number]), 'tokens' => implode(',', [$invoice->invoice_number, $invoice->po_number]),
'url' => $invoice->present()->url, 'url' => $invoice->present()->url,
]; ];
if ($customValue = $invoice->custom_text_value1) {
$data[$account->present()->customLabel('invoice_text1')][] = [
'value' => "{$customValue}: {$invoice->getDisplayName()}",
'tokens' => $customValue,
'url' => $invoice->present()->url,
];
}
if ($customValue = $invoice->custom_text_value2) {
$data[$account->present()->customLabel('invoice_text2')][] = [
'value' => "{$customValue}: {$invoice->getDisplayName()}",
'tokens' => $customValue,
'url' => $invoice->present()->url,
];
}
} }
} }

View File

@ -95,6 +95,28 @@
} }
} }
@endif @endif
@if (Auth::check() && Auth::user()->account->customLabel('invoice_text1'))
,{
name: 'data',
limit: 3,
display: 'value',
source: searchData(data['{{ Auth::user()->account->present()->customLabel('invoice_text1') }}'], 'tokens'),
templates: {
header: '&nbsp;<span style="font-weight:600;font-size:16px">{{ Auth::user()->account->present()->customLabel('invoice_text1') }}</span>'
}
}
@endif
@if (Auth::check() && Auth::user()->account->customLabel('invoice_text2'))
,{
name: 'data',
limit: 3,
display: 'value',
source: searchData(data['{{ Auth::user()->account->present()->customLabel('invoice_text2') }}'], 'tokens'),
templates: {
header: '&nbsp;<span style="font-weight:600;font-size:16px">{{ Auth::user()->account->present()->customLabel('invoice_text2') }}</span>'
}
}
@endif
@foreach (['clients', 'contacts', 'invoices', 'quotes', 'navigation'] as $type) @foreach (['clients', 'contacts', 'invoices', 'quotes', 'navigation'] as $type)
,{ ,{
name: 'data', name: 'data',