This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
memberdb/resources/theme/backend/adminlte/layouts/partials/sidebar.blade.php
Deon George c7e2a6866e WIP
2017-11-21 21:47:44 +11:00

118 lines
3.9 KiB
PHP

<!-- 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('adminlte_lang::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('adminlte_lang::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') }}"><i class='fa fa-link'></i> <span>{{ trans('adminlte_lang::message.home') }}</span></a></li>
<li class="active"><a href="{{ url('my') }}"><i class='fa fa-link'></i> <span>My Accounts</span></a></li>
<li class="active"><a href="{{ url('brand') }}"><i class='fa fa-link'></i> <span>Brand Compare</span></a></li>
<li class="treeview">
<a href="#"><i class='fa fa-link'></i> <span>Contracts</span> <i class="fa fa-angle-left pull-right"></i></a>
<ul class="treeview-menu">
<li><a href="{{ url('new') }}">New</a></li>
<li><a href="{{ url('expiring') }}">Expiring</a></li>
</ul>
</li>
</ul><!-- /.sidebar-menu -->
</section>
<!-- /.sidebar -->
</aside>
@section('page-scripts')
<script src="{{ url('/plugins/bootstrap3-typeahead.min.js') }}"></script>
<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") }}',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