{template "header.html"}

{php echo \Phpcmf\Service::L('Field')->get('select')->get_select_search_code();}



<div class="right-card-box">
    <form class="form-horizontal" role="form" id="myform">
        {dr_form_hidden()}
        {if $ci->_is_admin_auth('add')}
        <div class="bootstrap-table bootstrap-table2">
            <div id="toolbar" class="toolbar">
                <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 style="min-width: 200px;">
                    <select name="groupid[]" class="bs-select form-control"  multiple="multiple"  data-actions-box="true" >
                        {loop $group $t}
                        <option value="{$t.id}">{dr_lang($t.name)}</option>
                        {/loop}
                    </select>
                </label>
            </div>
        </div>
        {/if}

        <div class="table-scrollable">
            <table class="table table-striped table-bordered table-hover table-checkable dataTable">
                <thead>
                <tr class="heading">

                    {if $ci->_is_admin_auth('add')}
                    <th class="myselect">
                        <label class="mt-table mt-checkbox mt-checkbox-single mt-checkbox-outline">
                            <input type="checkbox" class="group-checkable" data-set=".checkboxes" />
                            <span></span>
                        </label>
                    </th>

                    {/if}
                    <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 {if $color[$gid]}{$color[$gid]}{else}default{/if}">{dr_lang($group[$gid]['name'])} <i class="fa fa-times"></i> </a></label>
                        {/loop}
                        {if !$t.group}
                        <font color="red">{dr_lang('未划分字段不能在前端显示')}</font>
                        {else}
                        <label><a href="javascript:dr_ajax_confirm_url('{dr_url($uriprefix.'/all_del', ['id'=>$t.id])}', '{dr_lang('确定要删除该字段的全部用户组权限吗？')}', '{dr_now_url()}');" class="btn btn-xs red"> <i class="fa fa-trash"></i> {dr_lang('一键清除')} </a></label>
                        {/if}
                    </td>
                </tr>
                {/loop}
                </tbody>
            </table>
        </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, this, thrownError);;
                }
            });
        }
</script>

{template "footer.html"}