<?= view('layout/header')->send(); ?>

<form id="cv-form" method="post" class="cv-mt-15">
    <div class="cv-normal-input-box">
        <select class="easyui-combobox" name="cv[field_type]" label="块类型" limitToList="true" editable="false" style="width:100%">
            <option value="single_text">单行文本</option>
            <option value="multi_text">多行文本</option>
            <option value="image">单张图片</option>
            <option value="image_group">图片组</option>
            <option value="video">视频</option>
        </select>
    </div>
    <div class="cv-normal-input-box">
        <input class="easyui-textbox" name="cv[title]" label="属性名称" prompt="<?= lang('请输入属性名称'); ?>" missingMessage="<?= lang('属性名称为必填项'); ?>" required style="width: 100%;"  />
    </div>
    <div class="cv-normal-input-box">
        <input class="easyui-textbox" name="cv[tag]" label="属性标识" prompt="<?= lang('请输入属性唯一标识'); ?>" missingMessage="<?= lang('属性标识为必填项'); ?>" required style="width: 100%;"  />
    </div>
    <div class="cv-normal-input-box">
        <input class="easyui-textbox" name="cv[remark]" label="属性备注" prompt="<?= lang('可备注该属性'); ?>" style="width: 100%;" multiline="true"  />
    </div>
</form>

<div class="cv-submit">
    <a href="javascript:void(0);" class="easyui-linkbutton c8" onclick="saveForm()" style="width:80px">确定</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="closeSelf()" style="width:80px">取消</a>
</div>
<?= view('layout/footer')->send(); ?>

<script type="text/javascript">
    function saveForm(){
        $("#cv-form").form('submit',{
            onSubmit: function(){
                return $(this).form('validate');
            },
            success: function(result){
                var response = JSON.parse(result);
                parent.message(response.message);
                if (response.success){
//                    parent.reloadProductAttrListData();
                    closeSelf();
                }
            }
        });
    }

    function closeSelf() {
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    }
</script>
