mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 19:04:41 -04:00
Added navigation to search
This commit is contained in:
parent
c9f38699d2
commit
3ca89b2792
@ -5,6 +5,7 @@ use Request;
|
|||||||
use Session;
|
use Session;
|
||||||
use Utils;
|
use Utils;
|
||||||
use DB;
|
use DB;
|
||||||
|
use URL;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
use Validator;
|
use Validator;
|
||||||
use Schema;
|
use Schema;
|
||||||
@ -70,6 +71,16 @@ class AccountRepository
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getSearchData()
|
public function getSearchData()
|
||||||
|
{
|
||||||
|
$data = $this->getAccountSearchData();
|
||||||
|
|
||||||
|
$type = trans('texts.navigation');
|
||||||
|
$data[$type] = $this->getNavigationSearchData();
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getAccountSearchData()
|
||||||
{
|
{
|
||||||
$clients = \DB::table('clients')
|
$clients = \DB::table('clients')
|
||||||
->where('clients.deleted_at', '=', null)
|
->where('clients.deleted_at', '=', null)
|
||||||
@ -109,9 +120,56 @@ class AccountRepository
|
|||||||
|
|
||||||
$data[$type][] = [
|
$data[$type][] = [
|
||||||
'value' => $row->name,
|
'value' => $row->name,
|
||||||
'public_id' => $row->public_id,
|
|
||||||
'tokens' => $tokens,
|
'tokens' => $tokens,
|
||||||
'entity_type' => $row->type,
|
'url' => URL::to("/{$row->type}/{$row->public_id}"),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getNavigationSearchData()
|
||||||
|
{
|
||||||
|
$features = [
|
||||||
|
['dashboard', '/dashboard'],
|
||||||
|
['customize_design', '/settings/customize_design'],
|
||||||
|
];
|
||||||
|
|
||||||
|
$entityTypes = [
|
||||||
|
ENTITY_INVOICE,
|
||||||
|
ENTITY_CLIENT,
|
||||||
|
ENTITY_QUOTE,
|
||||||
|
ENTITY_TASK,
|
||||||
|
ENTITY_EXPENSE,
|
||||||
|
ENTITY_RECURRING_INVOICE,
|
||||||
|
ENTITY_PAYMENT,
|
||||||
|
ENTITY_CREDIT
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($entityTypes as $entityType) {
|
||||||
|
$features[] = [
|
||||||
|
"new_{$entityType}",
|
||||||
|
"/{$entityType}s/create",
|
||||||
|
];
|
||||||
|
$features[] = [
|
||||||
|
"list_{$entityType}s",
|
||||||
|
"/{$entityType}s",
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$settings = array_merge(Account::$basicSettings, Account::$advancedSettings);
|
||||||
|
|
||||||
|
foreach ($settings as $setting) {
|
||||||
|
$features[] = [
|
||||||
|
$setting,
|
||||||
|
"/settings/{$setting}",
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($features as $feature) {
|
||||||
|
$data[] = [
|
||||||
|
'value' => trans('texts.' . $feature[0]),
|
||||||
|
'url' => URL::to($feature[1])
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,8 +122,8 @@ $LANG = array(
|
|||||||
'filter' => 'Filter',
|
'filter' => 'Filter',
|
||||||
'new_client' => 'New Client',
|
'new_client' => 'New Client',
|
||||||
'new_invoice' => 'New Invoice',
|
'new_invoice' => 'New Invoice',
|
||||||
'new_payment' => 'Enter Payment',
|
'new_payment' => 'New Payment',
|
||||||
'new_credit' => 'Enter Credit',
|
'new_credit' => 'New Credit',
|
||||||
'contact' => 'Contact',
|
'contact' => 'Contact',
|
||||||
'date_created' => 'Date Created',
|
'date_created' => 'Date Created',
|
||||||
'last_login' => 'Last Login',
|
'last_login' => 'Last Login',
|
||||||
@ -868,7 +868,7 @@ $LANG = array(
|
|||||||
'white_label_purchase_link' => 'Purchase a white label license',
|
'white_label_purchase_link' => 'Purchase a white label license',
|
||||||
'expense' => 'Expense',
|
'expense' => 'Expense',
|
||||||
'expenses' => 'Expenses',
|
'expenses' => 'Expenses',
|
||||||
'new_expense' => 'Enter Expense',
|
'new_expense' => 'New Expense',
|
||||||
'enter_expense' => 'Enter Expense',
|
'enter_expense' => 'Enter Expense',
|
||||||
'vendors' => 'Vendors',
|
'vendors' => 'Vendors',
|
||||||
'new_vendor' => 'New Vendor',
|
'new_vendor' => 'New Vendor',
|
||||||
@ -1028,6 +1028,16 @@ $LANG = array(
|
|||||||
'user_unconfirmed' => 'Please confirm your account to send emails',
|
'user_unconfirmed' => 'Please confirm your account to send emails',
|
||||||
'invalid_contact_email' => 'Invalid contact email',
|
'invalid_contact_email' => 'Invalid contact email',
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'navigation' => 'Navigation',
|
||||||
|
'list_invoices' => 'List Invoices',
|
||||||
|
'list_clients' => 'List Clients',
|
||||||
|
'list_quotes' => 'List Quotes',
|
||||||
|
'list_tasks' => 'List Tasks',
|
||||||
|
'list_expensess' => 'List Expenses',
|
||||||
|
'list_recurring_invoices' => 'List Recurring Invoices',
|
||||||
|
'list_payments' => 'List Payments',
|
||||||
|
'list_credits' => 'List Credits',
|
||||||
);
|
);
|
||||||
|
|
||||||
return $LANG;
|
return $LANG;
|
||||||
|
@ -268,6 +268,7 @@
|
|||||||
} else {
|
} else {
|
||||||
trackEvent('/activity', '/search');
|
trackEvent('/activity', '/search');
|
||||||
$.get('{{ URL::route('getSearchData') }}', function(data) {
|
$.get('{{ URL::route('getSearchData') }}', function(data) {
|
||||||
|
console.log(data);
|
||||||
window.searchData = true;
|
window.searchData = true;
|
||||||
var datasets = [];
|
var datasets = [];
|
||||||
for (var type in data)
|
for (var type in data)
|
||||||
@ -283,8 +284,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$('#search').typeahead(datasets).on('typeahead:selected', function(element, datum, name) {
|
$('#search').typeahead(datasets).on('typeahead:selected', function(element, datum, name) {
|
||||||
var type = name == 'Contacts' ? 'clients' : name.toLowerCase();
|
window.location = datum.url;
|
||||||
window.location = '{{ URL::to('/') }}' + '/' + datum.entity_type + '/' + datum.public_id;
|
|
||||||
}).focus().typeahead('setQuery', $('#search').val());
|
}).focus().typeahead('setQuery', $('#search').val());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user