{template "header.html"}

<div class="note note-danger">
    <p><a href="javascript:dr_update_cache('member');">{dr_lang('更改数据之后需要更新缓存之后才能生效')}</a></p>
</div>

<div class="right-card-box">
    <form class="form-horizontal" role="form" id="myform">
        {dr_form_hidden()}
        <div class="table-scrollable">
            <table class="table table-striped table-bordered table-hover table-checkable dataTable">
                <thead>
                <tr class="heading">
                    <th width="45"></th>
                    <th width="250">{dr_lang('字段信息')}</th>
                    <th width="80" style="text-align:center">{dr_lang('注册显示')}</th>
                    <th>{dr_lang('字段划分情况')}</th>
                </tr>
                </thead>
                <tbody>
                {loop $list $t}
                <tr class="odd gradeX" id="dr_row_{$t.id}">
                    {if $ci->_is_admin_auth('add')}
                    <td class="myselect">
                        <label class="mt-table mt-checkbox mt-checkbox-single mt-checkbox-outline">
                            <input type="checkbox" class="checkboxes" name="ids[]" value="{$t.id}" />
                            <span></span>
                        </label>
                    </td>
                    {/if}
                    <td>{dr_lang($t.name)} / {$t.fieldname}</td>
                    <td style="text-align:center">
                        <a href="javascript:;" onclick="dr_ajax_open_close(this, '{dr_url($uriprefix.'/reg_edit', ['id'=>$t.id])}', 1);" class="badge badge-{if !$t.register}no{else}yes{/if}"><i class="fa fa-{if !$t.register}times{else}check{/if}"></i></a>
                    </td>
                    <td>
                        {loop $t.group $gid}
                        <label id="dr_row_{$t.id}_{$gid}"><a href="javascript:dr_delete('{$t.id}', '{$gid}');" class="btn btn-xs {$color[$gid]}">{dr_lang($group[$gid]['name'])} <i class="fa fa-times"></i> </a></label>
                        {/loop}
                        {if !$t.group}
                        <font color="red">{dr_lang('未划分字段不能在前端显示')}</font>
                        {/if}
                    </td>
                </tr>
                {/loop}
                </tbody>
            </table>
        </div>

        <div class="row fc-list-footer table-checkable ">
            <div class="col-md-12 fc-list-select">
            {if $ci->_is_admin_auth('add')}
            <label class="mt-table mt-checkbox mt-checkbox-single mt-checkbox-outline">
                <input type="checkbox" class="group-checkable" data-set=".checkboxes" />
                <span></span>
            </label>
            <label><button type="button" onclick="dr_ajax_option('{dr_url($uriprefix.'/add')}', '{dr_lang('你确定要这样操作吗？')}', 1)" class="btn green btn-sm"> <i class="fa fa-edit"></i> {dr_lang('批量划分')}</button></label>
            <label>
                <select name="groupid" class="form-control">
                    <option value=""> {dr_lang('--')} </option>
                    {loop $group $t}
                    <option value="{$t.id}">{dr_lang($t.name)}</option>
                    {/loop}
                </select>
            </label>
            {/if}
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    function dr_delete(fid, gid) {
        {if !$ci->_is_admin_auth('del')}
        dr_tips(0, '{dr_lang('无权限删除')}');
        return;
        {/if}
            var index = layer.load(2, {
                shade: [0.3,'#fff'], //0.1透明度的白色背景
                time: 10000
            });
            $.ajax({
                type: "GET",
                cache: false,
                url: '{dr_url($uriprefix.'/del')}&fid='+fid+'&gid='+gid,
                dataType: "json",
                success: function (json) {
                    layer.close(index);
                    if (json.code == 1) {
                        $('#dr_row_'+fid+'_'+gid).hide();
                        dr_tips(1, json.msg);
                    } else {
                        dr_tips(0, json.msg);
                    }
                },
                error: function(HttpRequest, ajaxOptions, thrownError) {
                    dr_ajax_alert_error(HttpRequest, ajaxOptions, thrownError);
                }
            });
        }
</script>

{template "footer.html"}