Changed account search to user search, show connection charges on invoice for pending services
This commit is contained in:
@@ -6,6 +6,7 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
use App\User;
|
||||
use App\Models\{Account,Invoice,Service,Service\Adsl};
|
||||
|
||||
class SearchController extends Controller
|
||||
@@ -23,17 +24,17 @@ class SearchController extends Controller
|
||||
return [];
|
||||
|
||||
$result = collect();
|
||||
$accounts = Auth::user()->all_accounts()->pluck('id');
|
||||
$accounts = ($x=Auth::user()->all_accounts())->pluck('id');
|
||||
$users = $x->transform(function($item) { return $item->user;});
|
||||
|
||||
# Look for Account
|
||||
foreach (Account::Search($request->input('term'))
|
||||
->whereIN('id',$accounts)
|
||||
->orderBy('company')
|
||||
->orderBy('last_name')
|
||||
->orderBy('first_name')
|
||||
foreach (User::Search($request->input('term'))
|
||||
->whereIN('id',$users->pluck('id'))
|
||||
->orderBy('lastname')
|
||||
->orderBy('firstname')
|
||||
->limit(10)->get() as $o)
|
||||
{
|
||||
$result->push(['label'=>sprintf('AC:%s %s',$o->aid,$o->name),'value'=>'/u/account/'.$o->id]);
|
||||
$result->push(['label'=>sprintf('US:%s %s',$o->aid,$o->name),'value'=>'/u/home/'.$o->id]);
|
||||
}
|
||||
|
||||
# Look for a Service
|
||||
|
Reference in New Issue
Block a user