@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@using MES.Production.Service;
@using Central.Control.Domain;
@using Ant.Service.Common;
@model List<COM_INDEX>
<!-- table star -->
<div class="row col-lg-12">
    <div class="wrapper wrapper-content animated fadeInUp">
        <div class="ibox">
            <div class="ibox-title">
                <h5>快速导航管理</h5>
                <div class="ibox-tools rboor">
                    <a class="btn btn-primary btn-xs p310" id="insert"><i class="im-plus"></i> 添加新导航</a>
                    <a class="btn btn-primary btn-xs p310" id="modify"><i class="im-pencil2"></i> 编辑</a>
                    <a class="btn btn-primary btn-xs p310" id="delete"><i class="im-remove4"></i> 删除</a>
                </div>
            </div>
            <div class="ibox-content">
                <div id="example_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
                    <table id="example" class="table table-striped table-bordered table-hover dataTables-example dataTable" cellspacing="0" width="100%">
                        <thead>
                            <tr>
                                <th class="tn" style="width: 50px !important;"><input name="checkall" id="checkall" type="checkbox" value=""></th>
                                <th style="width:60px !important;">序号</th>
                                <th>标题</th>
                                <th>路径</th>
                                <th style="width:80px !important;">图标</th>
                                <th style="width:80px !important;">颜色</th>
                                <th style="width:80px !important;">背景色</th>
                            </tr>
                        </thead>
                        <tbody>
                            @{foreach (var item in Model)
                            {
                                <tr>
                                    <td class="tn"><input name="checkbox_name" type="checkbox" value="@item.ID"></td>
                                    <td>@item.SHOWORDER</td>
                                    <td><a href="javascript:detail('@item.ID')">@item.TITLE</a></td>
                                    <td>@item.PATH</td>
                                    <td style="color: #18a689;"><i class="@item.ICON"></i></td>
                                    <td><span style="width: 20px; line-height:20px; height: 20px; background-color:#000000; color: @item.COLOR">&nbsp;示例&nbsp;&nbsp;</span></td>
                                    <td><span style="width: 20px; line-height:20px; height: 20px; background-color: @item.BACKGROUNDCOLOR">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
                                </tr>
                            }
                            }
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- table end -->
@section scripts{
<script type="text/javascript">
    function detail(id) {
        dig.addModel('添加/编辑导航', '/Com/WinIndex/Detail/' + id, 600, 350, function () {
            if (this.returnValue == 'yes'){
                location.reload();
            }
        });
    }
    $('#insert').click(function () { detail('') });
    //修改
    $('#modify').click(function () {
        var vals = '';
        var num = 0;
        $('input[name="checkbox_name"]:checked').each(function () {
            vals = $(this).val();
            num++;
        });
        if (!vals) {
            dig.alertError("提示", "对不起,请选中您要操作的记录!");
            return;
        }
        if (num > 1) {
            dig.alertError("提示", "对不起,每次只能修改一条记录!");
            return;
        }
        detail(vals);
    });
</script>    
}