<%include ./common.html %>
<div class="panel-content">
    <div class="panel-title">
        <div class="title-main">
            <h2>
                <span><%= selectedCompilation.name%></span>
                <a href="javascript:void(0);" id="save-valuation" class="btn btn-primary btn-sm pull-right">保存</a>
                <a href="/compilation" class="btn btn-default btn-sm pull-right">返回</a>
            </h2>
        </div>
    </div>
    <div class="content-wrap">
        <div class="c-header" style="padding:0">
            <ul class="nav nav-tabs">
                <% valuationList.forEach(function(valuation) { %>
                <li role="presentation" <% if (valuation.id.toString() === valuationId) { %>class="active"<% } %>><a href="/compilation/valuation/<%= section %>/<%= valuation.id %>"><%= valuation.name %></a></li>
                <% }) %>
            </ul>
        </div>
        <div class="c-body">
            <form action="/compilation/save-valuation" method="post" enctype="application/x-www-form-urlencoded">
                <div class=" row">
                    <div class="col-md-4">
                        <div class="form-group">
                            <label>名称</label>
                            <input type="text" class="form-control" name="name" value="<%= valuationData.name %>">
                        </div>
                    </div>
                    <div class="col-md-12">
                        <legend>
                            工程专业
                        </legend>
                        <table class="table engineer_table">
                            <thead>
                            <tr>
                                <th>工程名称</th>
                                <th>标准清单</th>
                                <th>定额库</th>
                                <th>人材机库</th>
                                <th>费率标准</th>
                                <th>人工系数</th>
                                <th>前台显示</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                                <% engineeringList.forEach(function(engineering) {%>
                                <tr >
                                    <td>
                                        <div><span><%= engineering.name %></span> <a onclick='editEngineerName(this)'><i class="glyphicon glyphicon-pencil"></i></a></div>
                                        <div class="input-group input-group-sm input_group_div" style="width:200px;display: none">
                                            <input class="form-control">
                                            <div class="input-group-btn">
                                                <button type="button" class="btn btn-success" onclick='confirmName(this,"<%= engineering._id.toString()%>")'>
                                                    <span class="glyphicon glyphicon-ok"></span></button>
                                            </div>
                                        </div>
                                    </td>
                                    <td><%= engineering.bill_lib.length %></td>
                                    <td><%= engineering.ration_lib.length %></td>
                                    <td><%= engineering.glj_lib.length %></td>
                                    <td><%= engineering.fee_lib.length %></td>
                                    <td><%= engineering.artificial_lib.length %></td>
                                    <td><label><input type="checkbox"  <% if (engineering.visible) { %>checked<% } %>  onclick='engineerVisibleChange(this,"<%= engineering._id.toString()%>")'> 显示</label></td>
                                    <td><a href="/compilation/<%= section %>/<%= valuationId %>/<%= engineering._id.toString()%>">编辑</a></td>
                                </tr>
                                <% }) %>
                            </tbody>
                        </table>
                    </div>
                </div>
                <input type="hidden" name="section" value="<%= section %>" id="section">
                <input type="hidden" name="id" value="<%= valuationId %>">
            </form>
        </div>
    </div>
</div>
<script type="text/javascript" src="/public/web/common_ajax.js"></script>
<script type="text/javascript" src="/web/users/js/compilation.js"></script>
<%include ../compilation/modal.html %>