<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:51:"D:\mijia/application/admin\view\category\index.html";i:1539445236;}*/ ?>
<!DOCTYPE html>
<html>
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>H+ 后台主题UI框架 - 选项卡 &amp; 面板</title>
    <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
    <meta name="description" content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">

    <link rel="shortcut icon" href="favicon.ico"> <link href="/public/static/admin/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="/public/static/admin/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="/public/static/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/public/static/admin/css/animate.min.css" rel="stylesheet">
    <link href="/public/static/admin/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <link rel="stylesheet" href="/public/static/admin/css/admin.css">
    <style type="text/css">
        .open{
            border:1px solid #ccc;
            padding: 0 3px 0 3px;
            cursor: pointer;
            background: #CCC;
        }
    </style>
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeIn">
        <div class="row">
            <div class="col-sm-12">
                <div class="tabs-container">
                    <ul class="nav nav-tabs">
                        <li class="<?php if(input('tab',1) == 1): ?>active<?php endif; ?>"><a data-toggle="tab" href="#tab-1" aria-expanded="true">栏目列表</a>
                        </li>
                        <li class="<?php if(input('tab',1) == 2): ?>active<?php endif; ?>"><a data-toggle="tab" href="#tab-2" aria-expanded="false">添加栏目</a>
                        </li>
                        <li id="showtab" class="<?php if(input('tab',1) == 3): ?>active<?php endif; ?>" style="<?php if(input('tab',1)!=3): ?>display:none<?php endif; ?>"><a data-toggle="tab" href="#tab-3" aria-expanded="false">编辑栏目</a>
                        </li>
                    </ul>
                    <div class="tab-content">
                        <div id="tab-1" class="tab-pane <?php if(input('tab',1) == 1): ?>active<?php endif; ?>">
                            <div class="panel-body">
                                
                                    <input type="hidden" name="tab" value="1" />
                                    <div class="table-responsive">
                                        <table class="table table-striped">
                                            <thead>
                                                <tr pid="0">
                                                    <th width="5%">伸缩</th>
                                                    <th width="5%">排序</th>
                                                    <th width="15%">分类ID</th>
                                                    <th style="float: left">分类名称</th>
                                                    <th width="20%">所属模型</th>
                                                    <th width="25%">操作</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <?php if(is_array($category) || $category instanceof \think\Collection || $category instanceof \think\Paginator): $i = 0; $__LIST__ = $category;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                                                    <tr id="<?php echo $vo['id']; ?>" pid="<?php echo $vo['parentid']; ?>">
                                                        <td>
                                                            <span class="open">+</span>
                                                        </td>
                                                        <td>
                                                            <input type="text" class="form-control js-ajaxsort" name="listorder[<?php echo $vo['id']; ?>]" value="<?php echo $vo['listorder']; ?>" data-id="<?php echo $vo['id']; ?>">
                                                        </td>
                                                        <td><?php echo $vo['id']; ?></td>
                                                        <td style="text-align:left"><?php echo $vo['catname']; ?></td>
                                                        <td><?php echo $vo['models']; ?></td>
                                                        <td>
                                                            <?php if($vo['isend'] == '0'): ?>
                                                            <a href="<?php echo url('index',['tab'=>2,'parentid'=>$vo['id']]); ?>" title="添加子分类"><i class="fa fa-plus text-navy"></i></a>&nbsp;&nbsp;
                                                            <?php endif; if($vo['isend'] == '1'): ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php endif; ?>
                                                            <a href="<?php echo url('index',['tab'=>3,'id'=>$vo['id']]); ?>" title="编辑"><i class="fa fa-edit text-navy"></i></a>&nbsp;&nbsp;
                                                            <a name="delete" href="<?php echo url('delete',['id'=>$vo['id']]); ?>" title="删除"><i class="fa fa-trash-o text-navy"></i></a>
                                                        </td>
                                                    </tr>
                                                <?php endforeach; endif; else: echo "" ;endif; ?>
                                            </tbody>
                                        </table>
                                    </div>
                                   
                            </div>
                        </div>
                        <div id="tab-2" class="tab-pane <?php if(input('tab',1) == 2): ?>active<?php endif; ?>">
                            <div class="panel-body">
                                <form method="post" class="form-horizontal" action="<?php echo url('add'); ?>" data-type="ajax">
                                    <input type="hidden" name="tab" value="2" />

                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">分类名称</label>
                                        <div class="col-sm-6">
                                            <input type="text" name="catname" class="form-control" value="">
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">上级分类</label>
                                        <div class="col-sm-3">
                                            <select class="form-control m-b" name="parentid">
                                                <option value="0" selected>≡ 作为顶级分类 ≡</option>
                                                <?php if(is_array($category) || $category instanceof \think\Collection || $category instanceof \think\Paginator): $i = 0; $__LIST__ = $category;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                                                    <option value="<?php echo $vo['id']; ?>"  <?php if(input('parentid',0) == $vo['id']): ?>selected<?php endif; ?>><?php echo $vo['catname']; ?></option>
                                                <?php endforeach; endif; else: echo "" ;endif; ?>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">所属模型</label>
                                        <div class="col-sm-3">
                                            <select class="form-control m-b" name="modelid">
                                                <option value="0" selected>≡ 请选择模型 ≡</option>
                                                <?php if(is_array($models) || $models instanceof \think\Collection || $models instanceof \think\Paginator): $i = 0; $__LIST__ = $models;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                                                    <option value="<?php echo $vo['id']; ?>"><?php echo $vo['name']; ?></option>
                                                <?php endforeach; endif; else: echo "" ;endif; ?>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">是否终极分类</label>
                                        <div class="col-sm-10 checkbox i-checks">
                                            <label><input type="radio" name="isend" value="0" checked="checked"> <i></i> 是</label>

                                            <label><input type="radio" name="isend" value="1"> <i></i> 否</label>
                                        </div>
                                    </div>
                                    
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">SEO标题</label>
                                        <div class="col-sm-6">
                                            <input type="text" name="seo_title" class="form-control" value="">
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                      <div class="form-group">
                                        <label class="col-sm-2 control-label">SEO关键词</label>
                                        <div class="col-sm-6">
                                            <input type="text" name="seo_keywords" class="form-control" value="">
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                      <div class="form-group">
                                        <label class="col-sm-2 control-label">SEO描述</label>
                                        <div class="col-sm-6">
                                            <textarea class="form-control" name="seo_description" style="height: 100px"></textarea>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">分类目录</label>
                                        <div class="col-sm-6">
                                            <input type="text" name="catdir" class="form-control" value="">
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">指定分类地址</label>
                                        <div class="col-sm-6">
                                            <input type="text" name="seturl" class="form-control" value=""> <span class="help-block m-b-none">留空按默认地址访问.</span>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">是否首页菜单显示</label>
                                        <div class="col-sm-10">
                                            <div class="radio i-checks">
                                                <label><input type="radio" value="1" name="ismenu" checked> <i></i> 显示</label>
                                                <label><input type="radio" value="0" name="ismenu"> <i></i> 隐藏</label>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">排序</label>
                                        <div class="col-sm-3">
                                            <input type="text" name="listorder" value="0" class="form-control" value="">
                                        </div>
                                    </div>

                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <div class="col-sm-4 col-sm-offset-2">
                                            <button class="btn btn-primary" type="submit">提交</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                        <div id="tab-3" class="tab-pane <?php if(input('tab',1) == 3): ?>active<?php endif; ?>">
                            <div class="panel-body">
                                <form method="post" class="form-horizontal" action="<?php echo url('edit'); ?>" data-type="ajax">
                                     
                                    <input type="hidden" name="id" value="<?php echo $category_info['id']; ?>" />

                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">分类名称</label>
                                        <div class="col-sm-10">
                                            <input type="text" name="catname" class="form-control" value="<?php echo $category_info['catname']; ?>">
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">上级分类</label>
                                        <div class="col-sm-10">
                                            <select class="form-control m-b" name="parentid">
                                                <option value="0" selected>≡ 作为顶级分类 ≡</option>
                                                <?php if(is_array($category) || $category instanceof \think\Collection || $category instanceof \think\Paginator): $i = 0; $__LIST__ = $category;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                                                    <option value="<?php echo $vo['id']; ?>" <?php echo !empty($vo['isend'])?'disabled' : ''; ?> <?php echo $category_info['parentid']==$vo['id']?'selected' : ''; ?>><?php echo $vo['catname']; ?></option>
                                                <?php endforeach; endif; else: echo "" ;endif; ?>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">所属模型</label>
                                        <div class="col-sm-10">
                                            <select class="form-control m-b" name="modelid">
                                                <option value="0" selected>≡ 请选择模型 ≡</option>
                                                <?php if(is_array($models) || $models instanceof \think\Collection || $models instanceof \think\Paginator): $i = 0; $__LIST__ = $models;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                                                    <option value="<?php echo $vo['id']; ?>" <?php echo $category_info['modelid']==$vo['id']?'selected' : ''; ?>><?php echo $vo['name']; ?></option>
                                                <?php endforeach; endif; else: echo "" ;endif; ?>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">是否终极分类</label>
                                        <div class="col-sm-10 checkbox i-checks">
                                           
                                             <label><input type="radio" name="isend" value="0" <?php if($category_info['isend'] == '0'): ?>checked="checked"<?php endif; ?>> <i></i> 是</label>

                                             <label><input type="radio" name="isend" value="1" <?php if($category_info['isend'] == '1'): ?>checked="checked"<?php endif; ?>> <i></i> 否</label>
                                        </div>
                                    </div>
                                    
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">SEO标题</label>
                                        <div class="col-sm-6">
                                            <input type="text" name="seo_title" class="form-control" value="<?php echo $category_info['seo_title']; ?>">
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                      <div class="form-group">
                                        <label class="col-sm-2 control-label">SEO关键词</label>
                                        <div class="col-sm-6">
                                            <input type="text" name="seo_keywords" class="form-control" value="<?php echo $category_info['seo_keywords']; ?>">
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                      <div class="form-group">
                                        <label class="col-sm-2 control-label">SEO描述</label>
                                        <div class="col-sm-6">
                                            <textarea class="form-control" name="seo_description" style="height: 100px"><?php echo $category_info['seo_description']; ?></textarea>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">分类目录</label>
                                        <div class="col-sm-10">
                                            <input type="text" name="catdir" class="form-control" value="<?php echo $category_info['catdir']; ?>">
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">指定分类地址</label>
                                        <div class="col-sm-10">
                                            <input type="text" name="seturl" class="form-control" value="<?php echo $category_info['seturl']; ?>"> <span class="help-block m-b-none">留空按默认地址访问.</span>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">是否首页菜单显示</label>
                                        <div class="col-sm-10">
                                            <div class="radio i-checks">
                                                <label><input type="radio" value="1" name="ismenu" <?php echo !empty($category_info['ismenu'])?'checked' : ''; ?>> <i></i> 显示</label>
                                                <label><input type="radio" value="0" name="ismenu" <?php echo !empty($category_info['ismenu'])?'' : 'checked'; ?>> <i></i> 隐藏</label>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">排序</label>
                                        <div class="col-sm-10">
                                            <input type="text" name="listorder" class="form-control" value="<?php echo $category_info['listorder']; ?>">
                                        </div>
                                    </div>

                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <div class="col-sm-4 col-sm-offset-2">
                                            <button class="btn btn-primary" type="submit">提交</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="/public/static/admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="/public/static/admin/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="/public/static/admin/js/content.min.js?v=1.0.0"></script>
    <script src="/public/static/admin/js/plugins/iCheck/icheck.min.js"></script>
    <script>
        $(document).ready(function(){$(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",})});

        $('.js-ajaxsort').on('blur',function(){
            var sort_url="<?php echo url('sort'); ?>";
            var sort_val=$(this).val();
            var id=$(this).attr('data-id');

            $.post(sort_url,{id:id,sort:sort_val},function(data){
                location.href ="";
            },'json');
        });

        $('tr[pid!=0]').hide();
            $('.open').click(function(){
                var id=$(this).parents('tr').attr('id');
                if($(this).text()=='+'){
                    $(this).text('-');
                    $('tr[pid='+id+']').show();
                }else{
                    $(this).text('+');
                    // $('tr[pid='+id+']').hide();

                    $.ajax({
                        type:"post",
                        dataType:"json",
                        data:{id:id},
                        url:"<?php echo url('ajaxlst'); ?>",
                       
                        success:function(data){
                            // alert(typeof(data));
                            var sonids=[];
                            var idsobj=$('tr[pid!=0]');
                            idsobj.each(function(k,v){
                                sonids.push($(this).attr('id'));
                            });
                            $.each(data,function(k,v){
                                if($.inArray(v,sonids)){
                                    $('tr[id='+v+']').hide();
                                    $('tr[id='+v+']').find('span:first').text('+');
                                }
                            });
                        }
                    });
                }
            });
    </script>
    <script src="/public/static/admin/js/plugins/layer/layer.min.js"></script>
    <script src="/public/static/admin/js/layer_hplus.js"></script>

</body>

</html>
