WIP: User table populated and login
This commit is contained in:
parent
96673a9e53
commit
64b6c09b8f
73
app/Console/Commands/UserAccountMerge.php
Normal file
73
app/Console/Commands/UserAccountMerge.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
use App\Models\Account;
|
||||
use App\User;
|
||||
|
||||
class UserAccountMerge extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'user:merge';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
foreach (Account::all() as $ao)
|
||||
{
|
||||
if (is_null($ao->user_id) AND $ao->email)
|
||||
{
|
||||
$o = User::where('email',$ao->email)->first();
|
||||
|
||||
if (! $o) {
|
||||
$o = new User;
|
||||
$o->id = $ao->id;
|
||||
$o->site_id = $ao->site_id;
|
||||
$o->email = $ao->email;
|
||||
$o->password = $ao->password;
|
||||
$o->active = $ao->active;
|
||||
$o->title = $ao->title;
|
||||
$o->firstname = $ao->first_name;
|
||||
$o->lastname = $ao->last_name;
|
||||
$o->country_id = $ao->country_id;
|
||||
$o->address1 = $ao->address1;
|
||||
$o->address2 = $ao->address2;
|
||||
$o->city = $ao->city;
|
||||
$o->state = $ao->state;
|
||||
$o->postcode = $ao->zip;
|
||||
$o->save();
|
||||
}
|
||||
|
||||
$ao->user_id = $o->id;
|
||||
$ao->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class UserHomeController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
@ -11,6 +13,18 @@ class UserHomeController extends Controller
|
||||
|
||||
public function home()
|
||||
{
|
||||
return View('home');
|
||||
switch (Auth::user()->role()) {
|
||||
case 'Customer':
|
||||
return View('home');
|
||||
|
||||
case 'Reseller':
|
||||
break;
|
||||
|
||||
case 'Wholesaler':
|
||||
break;
|
||||
|
||||
default:
|
||||
abort(500,'Unknown role: ',Auth::user()->role());
|
||||
}
|
||||
}
|
||||
}
|
@ -7,4 +7,23 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class Account extends Model
|
||||
{
|
||||
protected $table = 'ab_account';
|
||||
public $timestamps = FALSE;
|
||||
|
||||
/**
|
||||
* Return the country the user belongs to
|
||||
*/
|
||||
public function country()
|
||||
{
|
||||
return $this->belongsTo(Country::class);
|
||||
}
|
||||
|
||||
public function language()
|
||||
{
|
||||
return $this->belongsTo(Language::class);
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(\App\User::class);
|
||||
}
|
||||
}
|
@ -29,7 +29,7 @@ class Invoice extends Model
|
||||
|
||||
public function account()
|
||||
{
|
||||
return $this->belongsTo(\App\User::class);
|
||||
return $this->belongsTo(Account::class);
|
||||
}
|
||||
|
||||
public function items()
|
||||
|
@ -23,7 +23,7 @@ class Payment extends Model
|
||||
|
||||
public function account()
|
||||
{
|
||||
return $this->belongsTo(\App\User::class);
|
||||
return $this->belongsTo(Account::class);
|
||||
}
|
||||
|
||||
public function items()
|
||||
|
@ -34,7 +34,7 @@ class Service extends Model
|
||||
|
||||
public function account()
|
||||
{
|
||||
return $this->belongsTo(\App\User::class);
|
||||
return $this->belongsTo(Account::class);
|
||||
}
|
||||
|
||||
public function service_adsl()
|
||||
|
81
app/User.php
81
app/User.php
@ -4,13 +4,14 @@ namespace App;
|
||||
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Laravel\Passport\HasApiTokens;
|
||||
|
||||
use Leenooks\Carbon;
|
||||
use App\Models\Account;
|
||||
use Leenooks\Traits\UserSwitch;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use Notifiable;
|
||||
use HasApiTokens,Notifiable,UserSwitch;
|
||||
|
||||
protected $dates = ['created_at','updated_at','last_access'];
|
||||
|
||||
@ -32,12 +33,43 @@ class User extends Authenticatable
|
||||
'password', 'remember_token',
|
||||
];
|
||||
|
||||
|
||||
public function accounts()
|
||||
{
|
||||
return $this->hasMany(Models\Account::class);
|
||||
}
|
||||
|
||||
protected function agents() {
|
||||
return $this->hasMany(static::class,'parent_id','id');
|
||||
}
|
||||
|
||||
protected function clients() {
|
||||
return $this->hasMany(\App\User::class);
|
||||
}
|
||||
|
||||
public function invoices()
|
||||
{
|
||||
return $this->hasManyThrough(Models\Invoice::class,Models\Account::class);
|
||||
}
|
||||
|
||||
public function payments()
|
||||
{
|
||||
return $this->hasManyThrough(Models\Payment::class,Models\Account::class);
|
||||
}
|
||||
|
||||
public function services()
|
||||
{
|
||||
return $this->hasManyThrough(Models\Service::class,Models\Account::class);
|
||||
}
|
||||
|
||||
protected function supplier()
|
||||
{
|
||||
return $this->belongsTo(static::class,'parent_id','id');
|
||||
}
|
||||
|
||||
protected function suppliers() {
|
||||
return $this->hasMany(static::class,'parent_id','id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Logged in users full name
|
||||
*
|
||||
@ -52,7 +84,7 @@ class User extends Authenticatable
|
||||
* Return a Carbon Date if it has a value.
|
||||
*
|
||||
* @param $value
|
||||
* @return Leenooks\Carbon
|
||||
* @return \Leenooks\Carbon
|
||||
* @todo This attribute is not in the schema
|
||||
*/
|
||||
public function getLastAccessAttribute($value)
|
||||
@ -60,6 +92,28 @@ class User extends Authenticatable
|
||||
if (! is_null($value))
|
||||
return new Carbon($value);
|
||||
}
|
||||
public function getInvoicesDueAttribute()
|
||||
{
|
||||
return $this->invoices
|
||||
->where('active',TRUE)
|
||||
->sortBy('id')
|
||||
->transform(function ($item) { if ($item->due) return $item; })
|
||||
->reverse()
|
||||
->filter();
|
||||
}
|
||||
|
||||
public function getPaymentHistoryAttribute()
|
||||
{
|
||||
return $this->payments
|
||||
->sortBy('date_payment')
|
||||
->reverse();
|
||||
}
|
||||
|
||||
public function getServicesActiveAttribute()
|
||||
{
|
||||
return $this->services
|
||||
->where('active',TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use static::getFullNameAttribute()
|
||||
@ -70,23 +124,6 @@ class User extends Authenticatable
|
||||
return $this->full_name;
|
||||
}
|
||||
|
||||
protected function agents() {
|
||||
return $this->hasMany(static::class,'parent_id','id');
|
||||
}
|
||||
|
||||
protected function clients() {
|
||||
return $this->hasMany(\App\User::class);
|
||||
}
|
||||
|
||||
protected function supplier()
|
||||
{
|
||||
return $this->belongsTo(static::class,'parent_id','id');
|
||||
}
|
||||
|
||||
protected function suppliers() {
|
||||
return $this->hasMany(static::class,'parent_id','id');
|
||||
}
|
||||
|
||||
// List all the agents, including agents of agents
|
||||
public function all_agents()
|
||||
{
|
||||
|
@ -21,7 +21,7 @@
|
||||
"laravel/passport": "^6.0",
|
||||
"laravel/socialite": "^3.0",
|
||||
"laravel/tinker": "^1.0",
|
||||
"leenooks/laravel": "0.*",
|
||||
"leenooks/laravel": "^0.1.6",
|
||||
"quickbooks/v3-php-sdk": "^5.0",
|
||||
"spatie/laravel-demo-mode": "^2.2",
|
||||
"spatie/laravel-failed-job-monitor": "^3.0",
|
||||
|
57
composer.lock
generated
57
composer.lock
generated
@ -1,10 +1,10 @@
|
||||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "9d58976ecb12e11253a69e8d1e49e613",
|
||||
"content-hash": "e6283e4f1d3de303b1abab3cc342c8cd",
|
||||
"packages": [
|
||||
{
|
||||
"name": "acacha/user",
|
||||
@ -2369,11 +2369,11 @@
|
||||
},
|
||||
{
|
||||
"name": "leenooks/laravel",
|
||||
"version": "0.1.6",
|
||||
"version": "0.1.7",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://dev.leenooks.net/leenooks/laravel",
|
||||
"reference": "b0fcdaa3756f844332e2be5e2b36e270e8a4cdb6"
|
||||
"reference": "ac867a25265d07476967eef7d01516a92b9f2b73"
|
||||
},
|
||||
"require": {
|
||||
"igaster/laravel-theme": "2.0.6",
|
||||
@ -2409,7 +2409,7 @@
|
||||
"laravel",
|
||||
"leenooks"
|
||||
],
|
||||
"time": "2018-06-15T04:14:04+00:00"
|
||||
"time": "2018-07-13T04:39:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "maximebf/debugbar",
|
||||
@ -3442,53 +3442,6 @@
|
||||
],
|
||||
"time": "2018-05-26T01:33:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "quickbooks/v3-php-sdk",
|
||||
"version": "v5.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/intuit/QuickBooks-V3-PHP-SDK.git",
|
||||
"reference": "f1b1db3171dc2005e072a36ed7d240ccc0412c15"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/intuit/QuickBooks-V3-PHP-SDK/zipball/f1b1db3171dc2005e072a36ed7d240ccc0412c15",
|
||||
"reference": "f1b1db3171dc2005e072a36ed7d240ccc0412c15",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.6.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^5.7"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"QuickBooksOnline\\API\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"Apache-2.0"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "hlu2",
|
||||
"email": "Hao_Lu@intuit.com"
|
||||
}
|
||||
],
|
||||
"description": "The Official PHP SDK for QuickBooks Online Accounting API",
|
||||
"homepage": "http://developer.intuit.com",
|
||||
"keywords": [
|
||||
"api",
|
||||
"http",
|
||||
"quickbooks",
|
||||
"rest",
|
||||
"smallbusiness"
|
||||
],
|
||||
"time": "2018-05-26T01:33:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "ramsey/uuid",
|
||||
"version": "3.7.3",
|
||||
|
2243
public/js/app.js
vendored
2243
public/js/app.js
vendored
File diff suppressed because one or more lines are too long
@ -1,52 +0,0 @@
|
||||
@extends('layouts.auth')
|
||||
|
||||
@section('htmlheader_title')
|
||||
Log in
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<body class="hold-transition login-page">
|
||||
<div id="app" v-cloak>
|
||||
<div class="login-box">
|
||||
<div class="login-logo">
|
||||
<a href="{{ url('/home') }}">{!! config('app.name_html_long') !!}</a>
|
||||
</div><!-- /.login-logo -->
|
||||
|
||||
@if (count($errors) > 0)
|
||||
<div class="alert alert-danger">
|
||||
<strong>Whoops!</strong> {{ trans('message.someproblems') }}<br><br>
|
||||
<ul>
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="login-box-body">
|
||||
<p class="login-box-msg"> {{ trans('message.siginsession') }} </p>
|
||||
|
||||
<login-form name="{{ config('auth.providers.users.field','email') }}"
|
||||
domain="{{ config('auth.defaults.domain','') }}"></login-form>
|
||||
|
||||
<a href="{{ url('/password/reset') }}">{{ trans('message.forgotpassword') }}</a><br>
|
||||
|
||||
@if(isset($site_social))
|
||||
@include('auth.partials.social_login')
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@include('layouts.partials.scripts_auth')
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$('input').iCheck({
|
||||
checkboxClass: 'icheckbox_square-blue',
|
||||
radioClass: 'iradio_square-blue',
|
||||
increaseArea: '20%' // optional
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
@endsection
|
@ -1,6 +0,0 @@
|
||||
<div class="social-auth-links text-center">
|
||||
<p>- OR -</p>
|
||||
@foreach($site_social as $o)
|
||||
<a href="{{ url('/auth/'.$o['name']) }}" class="btn btn-block btn-social btn-{{ $o['name'] }} btn-flat"><i class="fa fa-{{ $o['name'] }}"></i> {{ trans('message.sign'.$o['name']) }}</a>
|
||||
@endforeach
|
||||
</div><!-- /.social-auth-links -->
|
@ -1,44 +0,0 @@
|
||||
@extends('layouts.auth')
|
||||
|
||||
@section('htmlheader_title')
|
||||
Register
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
|
||||
<body class="hold-transition register-page">
|
||||
<div id="app" v-cloak>
|
||||
<div class="register-box">
|
||||
<div class="register-logo">
|
||||
<a href="{{ url('/home') }}">{!! config('app.name_html_long') !!}</a>
|
||||
</div>
|
||||
|
||||
@if (count($errors) > 0)
|
||||
<div class="alert alert-danger">
|
||||
<strong>Whoops!</strong> {{ trans('message.someproblems') }}<br><br>
|
||||
<ul>
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="register-box-body">
|
||||
<p class="login-box-msg">Register for access</p>
|
||||
|
||||
<register-form></register-form>
|
||||
<!-- #include('auth.partials.social_login') -->
|
||||
|
||||
<a href="{{ url('/login') }}" class="text-center">I already have an account</a>
|
||||
</div><!-- /.form-box -->
|
||||
</div><!-- /.register-box -->
|
||||
</div>
|
||||
|
||||
@include('layouts.partials.scripts_auth')
|
||||
|
||||
@include('auth.terms')
|
||||
|
||||
</body>
|
||||
|
||||
@endsection
|
@ -1,41 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
@section('htmlheader')
|
||||
@include('layouts.partials.htmlheader')
|
||||
@show
|
||||
|
||||
<body class="fixed skin-blue sidebar-mini">
|
||||
<div id="app" v-cloak>
|
||||
<div class="wrapper">
|
||||
@include('layouts.partials.mainheader')
|
||||
|
||||
@include('layouts.partials.sidebar')
|
||||
|
||||
<!-- Content Wrapper. Contains page content -->
|
||||
<div class="content-wrapper">
|
||||
|
||||
@include('layouts.partials.contentheader')
|
||||
|
||||
<!-- Main content -->
|
||||
<section class="content">
|
||||
<div class="row">
|
||||
<!-- Your Page Content Here -->
|
||||
@yield('main-content')
|
||||
</div>
|
||||
</section><!-- /.content -->
|
||||
|
||||
</div><!-- /.content-wrapper -->
|
||||
|
||||
<!-- #include('layouts.partials.controlsidebar') -->
|
||||
@include('layouts.partials.footer')
|
||||
</div><!-- ./wrapper -->
|
||||
</div> <!-- ./app -->
|
||||
|
||||
@section('scripts')
|
||||
@include('layouts.partials.scripts')
|
||||
{{-- Scripts --}}
|
||||
{!! Asset::scripts() !!}
|
||||
@show
|
||||
</body>
|
||||
</html>
|
@ -1,8 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
@include('layouts.partials.htmlheader')
|
||||
|
||||
@yield('content')
|
||||
|
||||
</html>
|
@ -1,17 +0,0 @@
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
<div id="search_results"></div>
|
||||
<h1>
|
||||
@yield('contentheader_title', 'Software Deployment')
|
||||
<small>@yield('contentheader_description')</small>
|
||||
</h1>
|
||||
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ url('/home') }}"><i class="fa fa-dashboard"></i>Home</a></li>
|
||||
@isset($breadcrumb)
|
||||
@foreach ($breadcrumb as $item => $url)
|
||||
<li><a href="{{url($url)}}">{{ $item }}</a></li>
|
||||
@endforeach
|
||||
@endisset
|
||||
</ol> <!-- /.breadcrumb -->
|
||||
</section> <!-- /.content-header -->
|
@ -1,8 +0,0 @@
|
||||
<!-- Main Footer -->
|
||||
<footer class="main-footer">
|
||||
<!-- To the right -->
|
||||
<div class="pull-right hidden-xs">
|
||||
<a href="#"></a><b>{{ config('app.name') }}</b></a>
|
||||
</div>
|
||||
<strong>© Leenooks</strong>
|
||||
</footer>
|
@ -1,31 +0,0 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{{ config('app.name') }} - @yield('htmlheader_title', 'Your title here')</title>
|
||||
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
|
||||
<!-- CSRF Token -->
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
|
||||
<link href="{{ asset('/css/all.css') }}" rel="stylesheet" type="text/css" />
|
||||
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<script>
|
||||
//See https://laracasts.com/discuss/channels/vue/use-trans-in-vuejs
|
||||
window.trans =
|
||||
@php
|
||||
// copy all translations from /resources/lang/CURRENT_LOCALE/* to global JS variable
|
||||
$lang_files = File::files(resource_path() . '/lang/' . App::getLocale());
|
||||
$trans = [];
|
||||
foreach ($lang_files as $f) {
|
||||
$filename = pathinfo($f)['filename'];
|
||||
$trans[$filename] = trans($filename);
|
||||
}
|
||||
$trans['adminlte_lang_message'] = trans('message');
|
||||
echo json_encode($trans);
|
||||
@endphp
|
||||
</script>
|
||||
</head>
|
@ -1,95 +0,0 @@
|
||||
<!-- Main Header -->
|
||||
<header class="main-header">
|
||||
|
||||
<!-- Logo -->
|
||||
<a href="{{ url('/home') }}" class="logo">
|
||||
<!-- mini logo for sidebar mini 50x50 pixels -->
|
||||
<span class="logo-mini">{!! config('name_html_short','<b>A</b>N') !!}</span>
|
||||
<!-- logo for regular state and mobile devices -->
|
||||
<span class="logo-lg">{!! config('name_html_long','<b>App</b>Name') !!}</span>
|
||||
</a>
|
||||
|
||||
<!-- Header Navbar -->
|
||||
<nav class="navbar navbar-static-top" role="navigation">
|
||||
<!-- Sidebar toggle button-->
|
||||
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
|
||||
<span class="sr-only">{{ trans('message.togglenav') }}</span>
|
||||
</a>
|
||||
<!-- Navbar Right Menu -->
|
||||
<div class="navbar-custom-menu">
|
||||
<ul class="nav navbar-nav">
|
||||
<!-- Tasks Menu -->
|
||||
@if (Auth::guest())
|
||||
<li><a href="{{ url('/register') }}">{{ trans('message.register') }}</a></li>
|
||||
<li><a href="{{ url('/login') }}">{{ trans('message.login') }}</a></li>
|
||||
@else
|
||||
|
||||
@if (isset($topmenu))
|
||||
<!-- Available Data Menu -->
|
||||
<li class="dropdown tasks-menu" id="import_date">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<span class="hidden-xs">Items</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="header">Header</li>
|
||||
<li>
|
||||
<ul class="menu small">
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<li class="footer"><a href="#">(Not Active)</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
@endif
|
||||
|
||||
<li class="dropdown user user-menu" id="user_menu">
|
||||
<!-- Menu Toggle Button -->
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<!-- The user image in the navbar-->
|
||||
<img src="{{ Gravatar::get($user->email) }}" class="user-image" alt="User Image"/>
|
||||
<!-- hidden-xs hides the username on small devices so only the image appears. -->
|
||||
<span class="hidden-xs">{{ $user->name }}</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- The user image in the menu -->
|
||||
<li class="user-header">
|
||||
<img src="{{ Gravatar::get($user->email) }}" class="img-circle" alt="User Image" />
|
||||
<p>
|
||||
{{ $user->name }}
|
||||
<small>{{ trans('message.login') }}: @if($user->last_access) {{ $user->last_access->format('Y-m-d') }} @else Unknown @endif</small>
|
||||
</p>
|
||||
</li>
|
||||
<!-- Menu Footer-->
|
||||
<li class="user-footer">
|
||||
<div class="pull-left">
|
||||
<a href="{{ url('/settings') }}" class="btn btn-default btn-flat">{{ trans('message.profile') }}</a>
|
||||
</div>
|
||||
|
||||
<div class="pull-right">
|
||||
<a href="{{ url('/logout') }}" class="btn btn-default btn-flat" id="logout"
|
||||
onclick="event.preventDefault();
|
||||
document.getElementById('logout-form').submit();">
|
||||
{{ trans('message.signout') }}
|
||||
</a>
|
||||
|
||||
<form id="logout-form" action="{{ url('/logout') }}" method="POST" style="display: none;">
|
||||
{{ csrf_field() }}
|
||||
<input type="submit" value="logout" style="display: none;">
|
||||
</form>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@endif
|
||||
|
||||
<!-- Control Sidebar Toggle Button -->
|
||||
@if (isset($controlbar))
|
||||
<li>
|
||||
<a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a>
|
||||
</li>
|
||||
@endif
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
@ -1,13 +0,0 @@
|
||||
<!-- REQUIRED JS SCRIPTS -->
|
||||
|
||||
<!-- JQuery and bootstrap are required by Laravel 5.3 in resources/assets/js/bootstrap.js-->
|
||||
<!-- Laravel App -->
|
||||
<script src="{{ url (mix('/js/app.js')) }}" type="text/javascript"></script>
|
||||
|
||||
@yield('page-scripts')
|
||||
<!-- Optionally, you can add Slimscroll and FastClick plugins.
|
||||
Both of these plugins are recommended to enhance the
|
||||
user experience. Slimscroll is required when using the
|
||||
fixed layout. -->
|
||||
@js('/site/js/jquery.slimscroll.min.js',jquery)
|
||||
@js('/site/js/fastclick.min.js')
|
@ -1,2 +0,0 @@
|
||||
<!-- Compiled app javascript -->
|
||||
<script src="{{ url (mix('/js/app.js')) }}"></script>
|
@ -1,108 +0,0 @@
|
||||
<!-- Left side column. contains the logo and sidebar -->
|
||||
<aside class="main-sidebar">
|
||||
|
||||
<!-- sidebar: style can be found in sidebar.less -->
|
||||
<section class="sidebar">
|
||||
|
||||
<!-- Sidebar user panel (optional) -->
|
||||
@if (! Auth::guest())
|
||||
<div class="user-panel">
|
||||
<div class="pull-left image">
|
||||
<img src="{{ Gravatar::get($user->email) }}" class="img-circle" alt="User Image" />
|
||||
</div>
|
||||
<div class="pull-left info">
|
||||
<p>{{ Auth::user()->name }}</p>
|
||||
<!-- Status -->
|
||||
<a href="#"><i class="fa fa-circle text-success"></i> {{ trans('message.online') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- search form (Optional) -->
|
||||
<form action="#" method="get" class="sidebar-form">
|
||||
<div class="input-group">
|
||||
<input type="text" name="q" class="form-control" autocomplete="off" placeholder="{{ trans('message.search') }}..."/>
|
||||
<span class="input-group-btn">
|
||||
<button type='submit' name='search' id='search-btn' class="btn btn-flat"><i class="fa fa-search"></i></button>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
<!-- /.search form -->
|
||||
|
||||
<!-- Sidebar Menu -->
|
||||
<ul class="sidebar-menu">
|
||||
<li class="header">Menu</li>
|
||||
<!-- Optionally, you can add icons to the links -->
|
||||
<li class="active"><a href="{{ url('home',['date'=>(isset($ido) ? $ido->id : NULL)]) }}"><i class='fa fa-link'></i> <span>{{ trans('message.home') }}</span></a></li>
|
||||
</ul><!-- /.sidebar-menu -->
|
||||
</section>
|
||||
<!-- /.sidebar -->
|
||||
</aside>
|
||||
|
||||
@section('page-scripts')
|
||||
@js('/site/js/bootstrap3-typeahead.min.js')
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("input[name=q]").typeahead({
|
||||
delay: 300,
|
||||
minLength: 2,
|
||||
fitToElement: false,
|
||||
appendTo: "#search_results",
|
||||
source: function (query,process) {
|
||||
search('{{ url("search",['date'=>isset($ido) ? $ido->id : NULL]) }}',query,process);
|
||||
},
|
||||
|
||||
matcher: function () { return true; },
|
||||
|
||||
updater: function (item) {
|
||||
window.parent.location.href = '{{ url("/") }}'+users[item];
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
var c=0;
|
||||
var search = _.debounce(function(url,query,process,icon){
|
||||
$.ajax({
|
||||
url : url,
|
||||
type : 'GET',
|
||||
data : 'term=' + query,
|
||||
dataType : 'JSON',
|
||||
async : false,
|
||||
cache : false,
|
||||
beforeSend : function() {
|
||||
if (c++ == 0) {
|
||||
if (icon)
|
||||
$('i[name='+icon+']').addClass("fa-spin");
|
||||
else
|
||||
$('i[name=searching]').removeClass("hidden");
|
||||
}
|
||||
},
|
||||
success : function(data) {
|
||||
// if json is null, means no match, won't do again.
|
||||
if(data==null || (data.length===0)) return;
|
||||
|
||||
users = {};
|
||||
userLabels = [];
|
||||
_.each(data,function(item,ix,list) {
|
||||
if (_.includes(users,item.label))
|
||||
item.label = item.label + ' #' + item.value;
|
||||
|
||||
userLabels.push(item.label);
|
||||
users[item.label] = item.value;
|
||||
});
|
||||
|
||||
process(userLabels);
|
||||
},
|
||||
complete : function() {
|
||||
if (--c == 0) {
|
||||
if (icon)
|
||||
$('i[name='+icon+']').removeClass("fa-spin");
|
||||
else
|
||||
$('i[name=searching]').addClass("hidden");
|
||||
}
|
||||
}
|
||||
})
|
||||
}, 500);
|
||||
</script>
|
||||
@append
|
Loading…
Reference in New Issue
Block a user