{extend name="base/header" /}
{block name="body"}
<style>
    .layui-table .widthtd{ width: 120px;}
</style>
<div style="margin: 0px 10px">
    <table class="layui-table">
        <tbody>
        <tr>
            <td class="widthtd"><strong>项目编号</strong></td>
            <td>{$info.sn}</td>
            <td class="widthtd"><strong>项目名称</strong></td>
            <td>{$info.title}</td>
        </tr>
        <tr>
            <td class="widthtd"><strong>发布者</strong></td>
            <td>{$info.getuserdata.username}</td>
            <td class="widthtd"><strong>类别</strong></td>
            <td>{$info.projectcatedata.title}</td>
        </tr>
        <tr>
            <td class="widthtd"><strong>项目标签</strong></td>
            <td>{$info.tagstr}</td>
            <td class="widthtd"><strong>预算</strong></td>
            <td>{$info.yusuan}</td>
        </tr>
        <tr>
            <td class="widthtd"><strong>周期</strong></td>
            <td>{$info.zhouqi}天</td>
            <td class="widthtd"><strong>创建时间</strong></td>
            <td>{$info.createtime}</td>
        </tr>


        <tr>
            <td class="widthtd"><strong>审核状态</strong></td>
            <td >
                {if $info.sh_status == 1}
                 {$info.sh_status_text} - {$info.sh_status_desc}

                {else /}
                 {$info.sh_status_text}
                {/if}
            </td>
            <td class="widthtd"><strong>项目状态</strong></td>
            <td  colspan="4">
                {$info.status_text}
            </td>

        </tr>

        <tr>

            <td class="widthtd"><strong>项目简介</strong></td>
            <td colspan="4">{$info.description}</td>
        </tr>
        </tbody>
    </table>

    <div class="layui-tab layui-tab-card"  lay-filter="proputdemotest">
        <ul class="layui-tab-title">
            <li class="layui-this">项目内容</li>
            <li>接单人</li>

        </ul>
        <div class="layui-tab-content" >
            <div class="layui-tab-item layui-show">
                <div style="width: 95%; margin: 10px auto;">

                    {$info.content}
                </div>
            </div>
            <div class="layui-tab-item">

                <div class="layui-card-body" style="  padding: 0px 10px !important; ">
                    <div class="layui-card-box">
                        <table lay-filter="projectput" id="projectput"></table>
                    </div>
                </div>

            </div>
        </div>

    </div>


</div>

<script type="text/html" id="putstatus-demo">
    {{# if (d.complete_status === 3) { }}
    <a class="layui-btn layui-btn-xs layui-btn-normal" >{{=d.complete_status_text}}</a>
    {{# } else { }}
    {{# if(d.complete_status === 2) { }}
    <a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="statuserror">{{=d.complete_status_text}}</a>
    {{# } else { }}
    <a class="layui-btn layui-btn-xs">{{=d.complete_status_text}}</a>
    {{# } }}
    {{# } }}
</script>
<script type="text/html" id="put-demo">
    {{# if (d.status === 2) { }}
    <a class="layui-btn layui-btn-xs layui-btn-normal" >{{=d.status_text}}</a>
    {{# } else { }}
    {{# if(d.status === 1) { }}
    <a class="layui-btn layui-btn-xs layui-btn-danger" >{{=d.status_text}}</a>
    {{# } else { }}
    <a class="layui-btn layui-btn-xs">{{=d.status_text}}</a>
    {{# } }}
    {{# } }}
</script>
{/block}
{block name="script"}
<script type="text/javascript">
    var project_id = "{$info.id}";
    layui.use(['buildItems', 'form', 'laydate', 'util','vinfo','element'], function () {

        var layer = layui.layer,table=layui.table,form=layui.form,admin=layui.admin;
        var element = layui.element;
        /*解析顶部分组选项*/
        var map_root = layui.cache.maps;
        table.render({
            elem: '#projectput',
            page: true,
            limit:20,
            height: 'full-341',
            url: map_root+"project.project_put/index?&do=json",
            where:{project_id:project_id},
            cols: [[
                {field:'id',width:50,align:'center',title:'ID',sort:!0},
                {field:'title',width:200,align:'center',title:'申请人',templet:'<div>{{= d.getuserdata.username}}</div>'},
                {field:'mobile',width:120,align:'center',title:'申请人手机号',templet:'<div>{{= d.getuserdata.mobile}}</div>'},
                {field:'createtime',width:150,align:'center',title:'申请日期'},
                {field:'sh_status',width:100,align:'center',title:'审核状态',templet:'#put-demo'},
                {field:'status',width:100,align:'center',title:'作品状态',templet:'#putstatus-demo'},
                {field:'user_desc',width:300,align:'center',title:'个人介绍'},
                {fixed:'right',width:130,align:'center',toolbar:'<div><a class="layui-btn layui-btn-xs" lay-event="fileclcik">查看附件</a></div>',title:'操作'}
            ]],
            done: function(){
                admin.vShow($('[lay-table-id="projectput"]'));
            }
        });


        /*工具条监听*/
        table.on('tool(projectput)', function(obj){
            var data = obj.data;

            if(obj.event === 'fileclcik'){

                projectputOpen(data.id);
            }
        });/**/

        //一些事件
        element.on('tab(proputdemotest)', function(data){

            if(data.index === 1){
                table.reloadData('projectput');
            }
        });

    });
    $(".imgclick").click(function (){

        var src = $(this).attr('src'), alt = $(this).attr('alt');
        layer.photos({photos:{data:[{alt:alt,src:src}],start:'0'},anim:5,shade:[0.4,'#000']});
    });


    function projectputOpen(id='',type=''){

        layer.open({
            type: 2,
            area: ['800px', '600px'],
            title: "查看附件",
            btn: ['确定', '关闭'],
            fixed: false, //不固定
            content: '/admin/project.project_put/detail?id='+id,
            yes: function(index, layero){
                layer.close(index); // 关闭弹窗
            },
        });
    }/**/

    var callbackdata = function () {

    };

</script>
{/block}