<extend name="Public/base"/>

<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
    <!-- 标题栏 -->
    <div class="main-place">
        <span class="main-placetitle">位置</span>
        <ul class="main-placeul">
            <li><a href="{:U('lists')}">开发者</a></li>
            <li><a href="{:U('lists')}">游戏管理</a></li>
            <li><a href="#">{$meta_title}</a></li>
        </ul>
        <div class="question">
            <i class="question_mark">?</i>
            <ul class="question_content">
                <li class="question_title">功能以及数据相关说明</li>
                <li class="question_list">
                    <span class="">{$meta_title}</span>
                    <span class="">对所有开发者账号进行信息记录以及相关管理操作</span>
                </li>
            </ul>
        </div>
    </div>
	<div class="cf top_nav_list">
		<div class="fl button_list">
		<empty name="model.extend">
			<div class="tools">
			</div>
		</empty>
		</div>
		<!-- 高级搜索 -->
		<div class="jssearch fr cf search_list">
        <div class="input-list input-list-promote search_label_rehab">
            <label>开发者账号:</label>
            <select id="promote_id" name="develop_id" class="select_gallery" >
                <option value="">请选择开发者账号</option>
                <volist name=":get_developers_list()" id="vo">
                    <option promote-id="{$vo.id}" value="{$vo.id}">{$vo.account}</option>
                </volist>
            </select>  
        </div>
            <div class="input-list input-list-channelstatus">
                <label>状态:</label>
                <select name="status">
                    <option value="">全部</option>
                    <option value="1">已签署</option>
                    <option value="2">待签署</option>
                    <option value="4">已确认</option>
                </select>
            </div>
            <input type="hidden" name="" value="" class="sortBy">
            <div class="input-list">
                <a class="sch-btn" href="javascript:;" id="search" url="{:U('lists','model='.$model['name'],false)}">搜索</a>
            </div>
	</div>
    </div>
    <!-- 数据列表 -->
    <div class="data_list">
        <div class="">
            <table>
                <!-- 表头 -->
                <thead>
                    <tr>
                        <th>
                            <input class="check-all" type="checkbox">
                        </th>
                        <th>ID</th>
                        <th>开发者账号t</th>
                        <th>游戏名称</th>
                        <th>合同编号</th>
                        <th>创建时间</th>
                        <th>签约日期</th>
                        <th>终止日期</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                </thead>

                <!-- 列表 -->
                <tbody>
                <empty name="list_data" >
	                <tr>
	                	<td colspan="10" class="text-center">aOh! 暂时还没有内容!</td>
	                </tr>
                <else />
                    <volist name="list_data" id="data">
                        <tr>
                            <td><input class="ids" type="checkbox" value="{$data['id']}" name="ids[]"></td>
                            <td>{$data.id}</td>
                            <td>{$data.account}</td>
                            <td>{$data.game_name}</td>
                            <td>{$data.contract_number}</td>
                            <td>{:empty($data['create_time']) ? '' : time_format($data['create_time'])}</td>
                            <td>{:empty($data['start_time']) ? '' : time_format($data['start_time'])}</td>
                            <td>
                                <eq name="data.status" value="1">
                                    <input id="{$data.id}_end_time" class="end_time" name="end_time"  placeholder="合同截止时间">
                                    <else />
                                    {:empty($data['end_time']) ? '' : time_format($data['end_time'])}
                                </eq>
                            </td>
                            <td>
                                {:get_info_status($data['status'],28)}
                            </td>
                            <td>
                                <eq name="data.status" value="1">
                                    <a href="javascript:" data-id="{$data.id}" class="sure">确认</a>
                                </eq>
                            </td>
                        </tr>
                    </volist>
                    </empty>
                </tbody>
            </table>
        </div>
    </div>
    <div class="page">
        {$_page|default=''}
    </div>
</block>

<block name="script">
    <link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
    <php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
    <link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
    <script type="text/javascript" src="__STATIC__/layer/layer.js" charset="UTF-8"></script>
<script>
<volist name=":I('get.')" id="vo">
    Think.setValue('{$key}',"{$vo}");
</volist>
$(".select_gallery").select2();
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav('{:U('lists')}');
$(function(){
    $(".end_time").datetimepicker({
        format: 'yyyy-mm-dd',
        language:"zh-CN",
        minView:2,
        autoclose:true
    });
    
    //确认
    $(".sure").click(function () {
        var id = $(this).attr('data-id');
        var end_time = $("#"+id + "_end_time").val();
        if(end_time == undefined){
            end_time = "";
            layer.msg("终止日期不能为空");
            return false;
        }
        location.href = "{:U('setContractStatus','',false)}" + "/id/" + id + "/end_time/" + end_time
    });
    
	//搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
        var query  = $('.jssearch').find('input').serialize();
        query  += "&"+$('.jssearch').find('select').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		window.location.href = url;
	});
    $(".paixu").click(function(){
        var that=$(this);
        $data_order=that.attr('data-order');
        $order_type='{$userarpu_order}';
        if($order_type==''||$order_type=='4'){
            $(".sortBy").attr('name','data_order');
            val='3,'+$data_order;
            $(".sortBy").attr('value',val);
            $("#search").click();
        }else if($order_type=='3'){
            $(".sortBy").attr('name','data_order');
            val='4,'+$data_order;
            $(".sortBy").attr('value',val);
            $("#search").click();
        }
    });
    //回车自动提交
    $('.jssearch').find('input').keyup(function(event){
        if(event.keyCode===13){
            $("#search").click();
        }
    });
    $("#admin").on('click',function(event) {
        var navlist = $(this).find('.i_list_li');
        if (navlist.hasClass('hidden')) {
            navlist.removeClass('hidden');
            $(this).find('#i_list_id').focus().val('');            
        } else {
            navlist.addClass('hidden');
        }
        $(document).one("click", function(){
            navlist.addClass('hidden');
        });
        event.stopPropagation();
    });

    $('#admin #i_list_id').on('keyup',function(event) {
        var val  = $.trim($(this).val()).toLowerCase();
        $(this).closest('.drop-down').find('#i_list_idh').val(val);
    });
    
    $("#admin #i_list_li").find("a").each(function(){
        $(this).click(function(){
            var text = $.trim($(this).text()).toLowerCase();
            $(this).closest('.drop-down').find("#i_list_id").val(text);
            $(this).closest('.drop-down').find('#i_list_idh').val(text);
        })
    });

            //下拉内容框
    $(".drop-down2").on('click',function(event) {
        var navlist = $(this).find('.i_list_li');
        if (navlist.hasClass('hidden')) {
            navlist.removeClass('hidden');
            $('#i_list_id').focus().val('');            
        } else {
            navlist.addClass('hidden');
        }
        $(document).one("click", function(){
            navlist.addClass('hidden');
        });
        event.stopPropagation();
    });
    /* 状态搜索子菜单 */

})
</script>
</block>