blessing-skin-server/resources/views/admin/users.tpl

194 lines
9.5 KiB
Smarty
Raw Normal View History

2016-07-22 19:36:24 +08:00
@extends('admin.master')
@section('title', '用户管理')
@section('content')
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
2016-07-23 15:20:10 +08:00
@if (isset($_GET['q']))
搜索结果:{{ $_GET['q'] }}
2016-07-22 19:36:24 +08:00
@else
用户管理
@endif
<small>User Management</small>
<form method="get" action="" class="user-search-form">
2016-07-23 15:20:10 +08:00
<input type="text" name="q" class="form-control user-search-input" placeholder="输入,回车搜索。" value="{{ $q }}">
<select name="filter" class="form-control pull-right user-search-input">
<option value='email' {{ $filter == 'email' ? 'selected="selected"' : '' }}>搜索邮箱</option>
<option value='nickname' {{ $filter == 'nickname' ? 'selected="selected"' : '' }}>搜索昵称</option>
</select>
2016-07-22 19:36:24 +08:00
</form>
2016-07-23 15:20:10 +08:00
2016-07-22 19:36:24 +08:00
</h1>
</section>
2016-08-17 13:11:48 +08:00
<?php $current_user = new App\Models\User($_SESSION['uid']); ?>
2016-07-22 19:36:24 +08:00
<!-- Main content -->
<section class="content">
<div class="box">
<div class="box-body table-responsive no-padding">
<table class="table table-hover">
<thead>
<tr>
<th>UID</th>
<th>邮箱</th>
<th>昵称</th>
<th>积分</th>
2016-07-23 15:20:10 +08:00
<th>状态</th>
2016-07-22 19:36:24 +08:00
<th>注册时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
@forelse($users as $user)
<tr id="{{ $user->uid }}">
<td>{{ $user->uid }}</td>
<td id="email">{{ $user->email }}</td>
<td id="nickname">{{ $user->nickname }}</td>
<td><input type="text" class="form-control score" value="{{ $user->score }}" title="输入修改后的积分,回车提交" data-placement="top"></td>
<td id="permission">
@if ($user->permission == "0")
正常
@elseif ($user->permission == "-1")
封禁
@elseif ($user->permission == "1")
管理员
@elseif ($user->permission == "2")
超级管理员
@endif
</td>
2016-07-22 19:36:24 +08:00
<td>{{ $user->register_at }}</td>
<td>
<div class="btn-group">
<button type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
更多操作 <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="javascript:changeUserEmail('{{ $user->uid }}');">修改邮箱</a></li>
<li><a href="javascript:changeUserNickName('{{ $user->uid }}');">修改昵称</a></li>
<li><a href="javascript:changeUserPwd('{{ $user->uid }}');">更改密码</a></li>
2016-07-23 15:20:10 +08:00
<li class="divider"></li>
<li><a href="../admin/players?filter=uid&q={{ $user->uid }}">查看该用户拥有的角色</a></li>
<li class="divider"></li>
{{-- If current user is super admin --}}
@if ($current_user->getPermission() == "2")
@if ($user->permission == "1")
<li><a id="admin" href="javascript:changeAdminStatus('{{ $user->uid }}');">解除管理员</a></li>
@elseif ($user->permission == "2")
<li><a href="javascript:;">无法解除超级管理员</a></li>
@else
<li><a id="admin" href="javascript:changeAdminStatus('{{ $user->uid }}');">设为管理员</a></li>
@endif
<li class="divider"></li>
@if ($user->permission == "2")
<li><a href="javascript:;">无法封禁超级管理员</a></li>
@elseif ($user->permission == "-1")
<li><a id="ban" href="javascript:changeBanStatus('{{ $user->uid }}');">解封</a></li>
@else
<li><a id="ban" href="javascript:changeBanStatus('{{ $user->uid }}');">封禁</a></li>
@endif
{{-- If current user is ordinary admin --}}
2016-07-23 15:20:10 +08:00
@else
@if ($user->permission == "1" || $user->permission == "2")
<li><a href="javascript:;">无法封禁管理员</a></li>
@elseif ($user->permission == "0")
<li><a id="ban" href="javascript:changeBanStatus('{{ $user->uid }}');">封禁</a></li>
@else
<li><a id="ban" href="javascript:changeBanStatus('{{ $user->uid }}');">解封</a></li>
@endif
2016-07-23 15:20:10 +08:00
@endif
2016-07-22 19:36:24 +08:00
</ul>
</div>
{{-- If current user is super admin --}}
@if ($current_user->getPermission() == "2")
@if ($user->permission == "2")
<a class="btn btn-danger btn-sm" disabled="disabled" data-toggle="tooltip" data-placement="bottom" title="超级管理员账号不能被这样删除的啦">删除用户</a>
@else
<a class="btn btn-danger btn-sm" href="javascript:deleteUserAccount('{{ $user->uid }}');">删除用户</a>
@endif
2016-07-23 15:20:10 +08:00
@else
@if ($user->permission == "1" || $user->permission == "2")
<a class="btn btn-danger btn-sm" disabled="disabled" data-toggle="tooltip" data-placement="bottom" title="你不能删除管理员账号哦">删除用户</a>
@else
<a class="btn btn-danger btn-sm" href="javascript:deleteUserAccount('{{ $user->uid }}');">删除用户</a>
@endif
2016-07-23 15:20:10 +08:00
@endif
2016-07-22 19:36:24 +08:00
</td>
</tr>
@empty
<tr>
<td>0</td>
<td>无结果</td>
2016-07-23 15:20:10 +08:00
<td>(´・ω・`)</td>
2016-07-22 19:36:24 +08:00
</tr>
@endforelse
</tbody>
</table>
</div>
<div class="box-footer">
2016-07-23 15:20:10 +08:00
<!-- Pagination -->
2016-07-22 19:36:24 +08:00
<ul class="pagination pagination-sm no-margin pull-right">
2016-07-23 15:20:10 +08:00
<?php $base_url = ($filter != "" && $q != "") ? "?filter=$filter&q=$q&" : "?"; ?>
2016-07-22 19:36:24 +08:00
<li><a href="?page=1">«</a></li>
2016-07-23 15:20:10 +08:00
2016-07-22 19:36:24 +08:00
@if ($page != 1)
2016-07-23 15:20:10 +08:00
<li><a href="{{ $base_url }}page={{ $page-1 }}">{{ $page - 1 }}</a></li>
2016-07-22 19:36:24 +08:00
@endif
2016-07-23 15:20:10 +08:00
<li><a href="{{ $base_url }}page={{ $page }}" class="active">{{ $page }}</a></li>
2016-07-22 19:36:24 +08:00
@if ($total_pages > $page)
2016-07-23 15:20:10 +08:00
<li><a href="{{ $base_url }}page={{ $page+1 }}">{{ $page+1 }}</a></li>
2016-07-22 19:36:24 +08:00
@endif
2016-07-23 15:20:10 +08:00
<li><a href="{{ $base_url }}page={{ $total_pages }}">»</a></li>
2016-07-22 19:36:24 +08:00
</ul>
<select id="page-select" class="pull-right">
2016-07-23 15:20:10 +08:00
@for ($i = 1; $i <= $total_pages; $i++)
2016-07-22 19:36:24 +08:00
@if ($i == $page)
<option value='{{ $i }}' selected="selected">{{ $i }}</option>
@else
<option value='{{ $i }}'>{{ $i }}</option>
@endif
2016-07-23 15:20:10 +08:00
@endfor
2016-07-22 19:36:24 +08:00
</select>
<p class="pull-right">第 {{ $page }} 页,共 {{ $total_pages }} 页</p>
</div>
</div>
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
@endsection
@section('script')
<script type="text/javascript">
$(document).ready(function() {
$('.box-body').css('min-height', $('.content-wrapper').height() - $('.content-header').outerHeight() - 120);
});
</script>
@endsection