<?= 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[kf_type]" label="客服类型" limitToList="true" editable="false" style="width:100%">
            <?php foreach ($kf_types as $k=>$kf_type):?>
            <option value="<?= $k; ?>"><?= $kf_type; ?></option>
            <?php endforeach;?>
        </select>
    </div>


    <div class="cv-normal-input-box">
        <input class="easyui-textbox" name="cv[symbol]" label="客服名称" prompt="<?= lang('请输入客服名称'); ?>" style="width: 100%;"  />
    </div>
    <div class="cv-normal-input-box">
        <input class="easyui-textbox" name="cv[account]" 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.reloadKefuListData();
                    closeSelf();
                }
            }
        });
    }

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