dyjh il y a 6 ans
Parent
commit
86b608319c
1 fichiers modifiés avec 123 ajouts et 128 suppressions
  1. 123 128
      resources/views/admin/album/cat/index.blade.php

+ 123 - 128
resources/views/admin/album/cat/index.blade.php

xqd
@@ -1,139 +1,134 @@
-@extends('admin.layout') 
+@extends('admin.layout')
 
 @section('content')
-<div class="wrapper wrapper-content animated fadeInRight">
-	<div class="row">
-		<div class="col-sm-12">
-			<div class="ibox float-e-margins">
-				<div class="ibox-title">
-					<h5>产品分类</h5>
-					<div class="ibox-tools">
-						<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
-						</a>
-					</div>
-				</div>
-				<div class="ibox-content">
-				    <div class="row">
-				        <form method="GET" action="" accept-charset="UTF-8">
 
-				        <div class="col-sm-4">
-				            <div class="input-group">
-								<input type="text" value="{{Request::get('keyword')}}"	placeholder="请输入关键词" name="keyword"class="input-sm form-control"> 
-								<span class="input-group-btn">
+    <div class="wrapper wrapper-content animated fadeInRight">
+        <div class="row">
+            <div class="col-sm-12">
+                <div class="ibox float-e-margins">
+                    <div class="ibox-title">
+                        <h5>产品分类</h5>
+                        <div class="ibox-tools">
+                            <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+                            </a>
+                        </div>
+                    </div>
+                    <div class="ibox-content">
+                        <div class="row">
+                            <form method="GET" action="" accept-charset="UTF-8">
+
+                                <div class="col-sm-4">
+                                    <div class="input-group">
+                                        <input type="text" value="{{Request::get('keyword')}}"	placeholder="请输入关键词" name="keyword"class="input-sm form-control">
+                                        <span class="input-group-btn">
 									<button type="submit" class="btn btn-sm btn-primary">搜索</button>
 								</span>
-    						</div>
-				        </div>
-				        </form>
-						@if(role('Album/Cat/create'))
-    					<div class="col-sm-3 pull-right">
-    					   <a href="{{ U('Album/Cat/create')}}" class="btn btn-sm btn-primary pull-right">添加</a>
-    					</div>
-						@endif
-					</div>
-					
-					<table class="table table-striped table-bordered table-hover dataTables-example dataTable">
-						<thead>
-    						<tr>
-								
-            <th class="sorting" data-sort="id"> ID </th>
-            <th class="sorting" data-sort="name"> 名称 </th>
-            <th class="sorting" data-sort="level"> 分类级别 </th>
-            <th class="sorting" data-sort="sort"> 排序 </th>
-            <th class="sorting" data-sort="pic_url"> 分类图标 </th>
-            <th class="sorting" data-sort="created_at"> 添加时间 </th>
-        						<th width="22%">相关操作</th>
-        					</tr>
-						</thead>
-						<tbody>
-						@if(isset($list))
-						@foreach($list as $key => $item)
-							<tr style="background-color: white;">
-								<td>{{ $item->id }}</td>
-								<td>{{ $item->name }}</td>
-								<td>{{ $item->level }}</td>
-								<td>{{ $item->sort }}</td>
-								<td><img src="{{ $item->pic_url }}" width="50"/></td>
-								<td>{{ $item->created_at }}</td>
-								<td>
-									<div class="btn-group">
-										<button data-toggle="dropdown"
-											class="btn btn-warning btn-sm dropdown-toggle"
-											aria-expanded="false">
-											操作 <span class="caret"></span>
-										</button>
-										<ul class="dropdown-menu">
-
-
-											@if(role('Album/Cat/update'))
-											<li><a href="{{ U('Album/Cat/update',['id'=>$item->id])}}" class="font-bold">修改</a></li>
-											@endif
-
-											@if(role('Album/Cat/destroy'))
-											<li class="divider"></li>
-											<li><a href="{{ U('Album/Cat/destroy',['id'=>$item->id])}}" onclick="return confirm('你确定执行删除操作?');">删除</a></li>
-											@endif
-
-										</ul>
-									</div>
-								{{--@if(role('Album/Cat/view'))
-										<button onclick="layer.open({type: 2,area: ['80%', '90%'],content: '{{ U('Album/Cat/view',['id'=>$item->id])}}'});"  class="btn btn-primary ">查看</button>
-									@endif--}}
-								</td>
-							</tr>
-							@if(isset($item->sonlist))
-								@foreach($item->sonlist as $k => $t)
-									<tr style="background-color: #f9f9f9;">
-										<td>{{ $t->id }}</td>
-										<td>{{ $t->name }}</td>
-										<td>{{ $t->level }}</td>
-										<td><img src="{{ $t->pic_url }}" width="50"/></td>
-										<td>{{ $t->created_at }}</td>
-										<td>
-											<div class="btn-group">
-												<button data-toggle="dropdown"
-														class="btn btn-warning btn-sm dropdown-toggle"
-														aria-expanded="false">
-													操作 <span class="caret"></span>
-												</button>
-												<ul class="dropdown-menu">
-
+                                    </div>
+                                </div>
+                            </form>
+                            @if(role('Album/Cat/create'))
+                                <div class="col-sm-3 pull-right">
+                                    <a href="{{ U('Album/Cat/create')}}" class="btn btn-sm btn-primary pull-right">添加</a>
+                                </div>
+                            @endif
+                        </div>
 
-													@if(role('Album/Cat/update'))
-														<li><a href="{{ U('Album/Cat/update',['id'=>$t->id])}}" class="font-bold">修改</a></li>
-													@endif
+                        <table class="table table-striped table-bordered table-hover dataTables-example dataTable">
+                            <thead>
+                            <tr>
 
-													@if(role('Album/Cat/destroy'))
-														<li class="divider"></li>
-														<li><a href="{{ U('Album/Cat/destroy',['id'=>$t->id])}}" onclick="return confirm('你确定执行删除操作?');">删除</a></li>
-													@endif
+                                <th class="sorting" data-sort="id" width="10%"> ID </th>
+                                <th class="sorting" data-sort="name" width="20%"> 名称 </th>
+                                <th class="sorting" data-sort="level" width="10%"> 分类级别 </th>
+                                <th class="sorting" data-sort="sort" width="10%"> 排序 </th>
+                                <th class="sorting" data-sort="pic_url" width="10%"> 分类图标 </th>
+                                <th class="sorting" data-sort="created_at" width="18%"> 添加时间 </th>
+                                <th width="22%">相关操作</th>
+                            </tr>
+                            </thead>
+                            <tbody>
+                            @if(isset($list))
+                                @foreach($list as $key => $item)
+                                    <tr style="background-color: white;">
+                                        <td>{{ $item->id }}</td>
+                                        <td>{{ $item->name }}</td>
+                                        <td>{{ $item->level }}</td>
+                                        <td>{{ $item->sort }}</td>
+                                        <td><img src="{{ $item->pic_url }}" width="50"/></td>
+                                        <td>{{ $item->created_at }}</td>
+                                        <td>
+                                            <div class="pull-left">
+                                                @if(role('Album/Cat/update'))
+                                                    <a href="{{ U('Album/Cat/update',['id'=>$item->id])}}" class="btn btn-sm btn-warning pull-right">修改</a>
+                                                @endif
+                                                @if(role('Album/Cat/destroy'))
+                                                    <a href="{{ U('Album/Cat/destroy',['id'=>$item->id])}}" onclick="return confirm('你确定执行删除操作?');" class="btn btn-sm btn-danger pull-right">删除</a>
+                                                @endif
+                                                @if(count($item->sonlist) > 0)
+                                                    <a id="a{{ $item->id }}" onclick="showHidden({{ $item->id }})" class="btn btn-sm btn-default pull-right">查看</a>
+                                                @endif
+                                            </div>
+                                            {{--@if(role('Album/Cat/view'))
+                                                    <button onclick="layer.open({type: 2,area: ['80%', '90%'],content: '{{ U('Album/Cat/view',['id'=>$item->id])}}'});"  class="btn btn-primary ">查看</button>
+                                                @endif--}}
+                                        </td>
+                                    </tr>
+                                    @if(isset($item->sonlist))
+                                        @foreach($item->sonlist as $k => $t)
+                                            <div style="display: none" id="son{{ $item->id }}">
+                                                <tr style="background-color: #f9f9f9;display: none" id="son{{ $item->id }}">
+                                                    <td>{{ $t->id }}</td>
+                                                    <td>{{ $t->name }}</td>
+                                                    <td>{{ $t->level }}</td>
+                                                    <td>{{ $t->sort }}</td>
+                                                    <td><img src="{{ $t->pic_url }}" width="50"/></td>
+                                                    <td>{{ $t->created_at }}</td>
+                                                    <td>
+                                                        <div class="pull-left">
+                                                            @if(role('Album/Cat/update'))
+                                                                <a href="{{ U('Album/Cat/update',['id'=>$t->id])}}" class="btn btn-sm btn-warning pull-right">修改</a>
+                                                            @endif
+                                                            @if(role('Album/Cat/destroy'))
+                                                                <a href="{{ U('Album/Cat/destroy',['id'=>$t->id])}}" onclick="return confirm('你确定执行删除操作?');" class="btn btn-sm btn-danger pull-right">删除</a>
+                                                            @endif
+                                                        </div>
+                                                    </td>
+                                                </tr>
+                                            </div>
+                                        @endforeach
+                                    @endif
+                                @endforeach
+                            @endif
 
-												</ul>
-											</div>
-										</td>
-									</tr>
+                            </tbody>
+                        </table>
+                        <div class="row">
+                            <div class="col-sm-6">
+                                <div class="dataTables_info" id="DataTables_Table_0_info"
+                                     role="alert" aria-live="polite" aria-relevant="all">每页{{ $list->count() }}条,共{{ $list->lastPage() }}页,总{{ $list->total() }}条。</div>
+                            </div>
+                            <div class="col-sm-6">
+                                <div class="dataTables_paginate paging_simple_numbers" id="DataTables_Table_0_paginate">
+                                    {!! $list->setPath('')->appends(Request::all())->render() !!}
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
 
-									@endforeach
-									@endif
-							@endforeach
-							@endif
+    <script>
+        function showHidden(id){
+            var text = $("#a"+id).text();
+            if (text == '查看') {
+                $("#a"+id).text('隐藏');
+            } else {
+                $("#a"+id).text('查看');
+            }
 
-						</tbody>
-					</table>
-					<div class="row">
-						<div class="col-sm-6">
-							<div class="dataTables_info" id="DataTables_Table_0_info"
-								role="alert" aria-live="polite" aria-relevant="all">每页{{ $list->count() }}条,共{{ $list->lastPage() }}页,总{{ $list->total() }}条。</div>
-						</div>
-						<div class="col-sm-6">
-						<div class="dataTables_paginate paging_simple_numbers" id="DataTables_Table_0_paginate">
-						{!! $list->setPath('')->appends(Request::all())->render() !!}
-						</div>
-						</div>
-					</div>
-				</div>
-			</div>
-		</div>
-	</div>
-</div>
+            $("#son"+id).slideToggle(1000);
+        }
+    </script>
 @endsection