{template "header.html"}
<div class="note note-danger">
    <p><a href="javascript:dr_update_cache('member');">{dr_lang('更改数据之后需要更新缓存之后才能生效')}</a></p>
</div>
<form action="" class="form-horizontal" method="post" name="myform" id="myform">
    {$form}<input name="data[apply]" type="hidden" value="{$apply}">
    <div class="portlet bordered light myfbody">
        <div class="portlet-title">

            <div class="caption">
                <span class="caption-subject font-green "><i class="fa fa-list-ol"></i> {dr_lang('等级制度')}</span>
            </div>
            <div class="actions">
                <div class="btn-group">
                    <a class="btn" href="{dr_url('member/group/level_index', ['gid'=>$gid])}"> <i class="fa fa-mail-reply"></i> {dr_lang('返回列表')}</a>
                </div>
            </div>
        </div>
        <div class="portlet-body">
            <div class="tab-content">
                <div class="form-body">

                    <div class="form-group" id="dr_row_name">
                        <label class="col-xs-2 control-label">{dr_lang('名称')}</label>
                        <div class="col-xs-8">
                            <label><input type="text" class="form-control" name="data[name]" value="{htmlspecialchars((string)$name)}"></label>
                            <span class="help-block">{dr_lang('给它一个描述名称')}</span>
                        </div>
                    </div>
                    {$myfield}
                    <div class="form-group" id="dr_row_value">
                        <label class="col-xs-2 control-label">{dr_lang('升级值')}</label>
                        <div class="col-xs-8">
                            <label><input type="text" class="form-control" name="data[value]" value="{intval($value)}"></label>
                            <label>{$dwz}</label>
                            <span class="help-block">{dr_lang('该等级需要的%s，升级值越低越排在前面，0表示初始等级', $group.unit ? SITE_SCORE : '人民币')}</span>
                        </div>
                    </div>
                    {if $group.setting.timetype && !$group['setting']['level']['auto']}
                    <div class="form-group">
                        <label class="col-xs-2 control-label">{dr_lang('续费值')}</label>
                        <div class="col-xs-8">
                            <label><input type="text" class="form-control" name="setting[xufei]" value="{php echo $setting.xufei ? intval($setting.xufei) : intval($value);}"></label>
                            <label>{$dwz}</label>
                            <span class="help-block">{dr_lang('该等级续费时需要的%s，留空表示按升级值续费', $group.unit ? SITE_SCORE : '人民币')}</span>
                        </div>
                    </div>
                    <div class="form-group mytime time0">
                        <label class="col-md-2 control-label ">{dr_lang('有效时长')}</label>
                        <div class="col-md-9">
                            <label><input type="text" class="form-control" name="setting[days]" value="{intval($setting.days)}"></label>
                            <label><select name="setting[dtype]"  class="form-control">
                                <option value="0" {if !$setting.dtype} selected {/if}> {dr_lang('天')} </option>
                                <option value="1" {if 1 == $setting.dtype} selected {/if}> {dr_lang('月')} </option>
                                <option value="2" {if 2 == $setting.dtype} selected {/if}> {dr_lang('年')} </option>
                            </select></label>
                            <span class="help-block"> {dr_lang('0或留空表示永久')} </span>
                        </div>
                    </div>
                    {/if}
                    <div class="form-group" id="dr_row_note">
                        <label class="col-xs-2 control-label ">{dr_lang('备注说明')}</label>
                        <div class="col-xs-8">
                            <textarea class="form-control" rows="5" name="data[note]">{$note}</textarea>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
    <div class="portlet-body form myfooter">
        <div class="form-actions text-center">
            <button type="button" onclick="dr_ajax_submit('{dr_now_url()}&page='+$('#dr_page').val(), 'myform', '2000', '{php echo $id ? dr_now_url() : dr_url('member/group/level_index', ['gid'=>$gid])}')" class="btn green"> <i class="fa fa-save"></i> {dr_lang('保存')}</button>
        </div>
    </div>
</form>

<link href="{THEME_PATH}assets/global/plugins/bootstrap-touchspin/bootstrap.touchspin.css" rel="stylesheet" type="text/css" />
<script src="{THEME_PATH}assets/global/plugins/fuelux/js/spinner.min.js" type="text/javascript"></script>
<script src="{THEME_PATH}assets/global/plugins/bootstrap-touchspin/bootstrap.touchspin.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function(){
        $("#displayorder").TouchSpin({
            buttondown_class: "btn red",
            buttonup_class: "btn green",
            min: -255,
            max: 255
        });
    });
</script>
{template "footer.html"}