<%inherit file="base.html"/>
<%def name="head()">
<script>
    function deleteAttr(attr_id) {
        if (confirm("确认删除吗？")) {
            window.location.href = "/product/attr/delete?attr_id=" +attr_id;
        }
    }
</script>
</%def>
<%def name="body()">
    <div class="panel panel-default">
    <div class="panel-heading"><span class="glyphicon glyphicon-th"></span> 资费信息 <a class="badge pull-right" href="javascript:history.go(-1);">返回</a></div>
        <div class="panel-body">
        <div class="pull-right bottom10">
            % if permit.match('/product/attr/add'):
            <a href="/product/attr/add?product_id=${product.id}" class="btn btn-sm btn-info">增加策略属性</a>
            % endif
        </div>   
        <table class="table table-hover">
                <thead>
                    <tr>
                        <th colspan="6">基本信息</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>资费名称</td>
                        <td>${product.product_name}</td>
                        <td>资费策略</td>
                        <td>${product_policys[product.product_policy]}</td>
                        <td>资费状态</td>
                        <td>${{0:u"正常", 1:u"停用"}[product.product_status]}</td>                 
                    </tr> 
                    <tr>
                        <td>资费价格</td>
                        <td>${fen2yuan(product.fee_price)}</td>
                        <td>计费时段</td>
                        <td>${product.fee_period}</td>
                        <td>买断月数</td>
                        <td>${product.fee_months or  ''}</td>                        
                    </tr>  
                    <tr>
                        <td>绑定MAC</td>
                        <td>${{0:u"否", 1:u"是"}[product.bind_mac]}</td>                        
                        <td>绑定VLAN</td>
                        <td>${{0:u"否", 1:u"是"}[product.bind_vlan]}</td>
                        <td>并发数</td>
                        <td>${product.concur_number}</td>
                    </tr>   
                    <tr>
                        <td>最大上行速率</td>
                        <td>${bps2mbps(product.input_max_limit)} Mbps</td>
                        <td>最大下行速率</td>
                        <td>${bps2mbps(product.output_max_limit)} Mbps</td>
                        <td>授权时长</td>
                        <td>${sec2hour(product.fee_times)} 小时</td>                     
                    </tr>   
                    <tr>
                        <td>创建时间</td>
                        <td>${product.create_time}</td>  
                        <td>更新时间</td>
                        <td>${product.update_time}</td>          
                        <td>授权流量</td>
                        <td>${kb2mb(product.fee_flows)} MB</td>                                      
                    </tr>                                                                                          
            </tbody>
        </table>

        <table class="table table-hover ">
                <thead>
                    <tr>
                        <th colspan="4">扩展策略属性列表</th>
                    </tr>
            <tr class="active">
                <th>策略名称</th>
                <th>策略值</th>
                <th>策略描述</th>
                <th></th>
            </tr>
            </thead>
            <tbody>
            % for attr in product_attrs:
            <tr>
                <td>${attr.attr_name}</td>
                <td>${attr.attr_value}</td>
                <td>${attr.attr_desc}</td>
                <td>
                % if permit.match('/product/attr/update'):
                <a class="opt-btn btn-default" href="/product/attr/update?attr_id=${attr.id}">修改</a>
                % endif
                % if permit.match('/product/attr/delete'):
                <a class="opt-btn btn-default" href="javascript:deleteAttr('${attr.id}');">删除</a>
                % endif
                </td>
            </tr>
            % endfor
            </tbody>
        </table>        
    </div>
</div>
</div>
</%def>