Next/Future invoices for users

This commit is contained in:
Deon George
2020-02-08 22:51:50 +11:00
parent b61e00d80f
commit eb316f65fc
18 changed files with 277 additions and 96 deletions

View File

@@ -27,7 +27,7 @@ class SearchController extends Controller
$accounts = ($x=Auth::user()->all_accounts())->pluck('id');
$users = $x->transform(function($item) { return $item->user;});
# Look for Account
# Look for User
foreach (User::Search($request->input('term'))
->whereIN('id',$users->pluck('id'))
->orderBy('lastname')
@@ -37,6 +37,15 @@ class SearchController extends Controller
$result->push(['label'=>sprintf('US:%s %s',$o->aid,$o->name),'value'=>'/u/home/'.$o->id]);
}
# Look for Account
foreach (Account::Search($request->input('term'))
->whereIN('user_id',$users->pluck('id'))
->orderBy('company')
->limit(10)->get() as $o)
{
$result->push(['label'=>sprintf('AC:%s %s',$o->aid,$o->company),'value'=>'/u/home/'.$o->user_id]);
}
# Look for a Service
foreach (Service::Search($request->input('term'))
->whereIN('account_id',$accounts)

View File

@@ -24,8 +24,11 @@ class UserHomeController extends Controller
*/
public function home(User $o=NULL): View
{
if (is_null($o))
$o = Auth::user();
if ($o)
return View('u.home',['o'=>$o]);
// If User was null, then test and see what type of logged on user we have
$o = Auth::user();
switch (Auth::user()->role()) {
case 'customer':