<?= view('layout/header')->send(); ?>
<!--container start-->
<form method="post" id="cv_form_model_1">
    <div class="cv-fixed-global">
        <div class="easyui-layout" style="width: 100%;height: 100%;">
            <!--top start-->
            <div id="cv_archive_north_header">
                <div class="panel-title">
                    <a class="cv-tool easyui-linkbutton" href="javascript:saveForm();"> 提交</a>
                    <a class="easyui-linkbutton" href="javascript:closeSelf();"> 关闭</a>
                </div>
            </div>
            <!--center start-->
            <div border="false" header="#cv_archive_north_header" data-options="region:'center'" style="padding-top: 15px;overflow-x: hidden;background-color: #fefefe;">
                <div class="cv-archive-new-center" style="width: 800px;">
                    <div class="cv-input-box">
                        <label for="cv_title" required>项目名称</label>
                        <div class="controls">
                            <input value="<?= $item['title']; ?>" class="cv-input-xlarge cv-input-rule" type="text" name="cv[title]" />
                        </div>
                    </div>
                    <div class="cv-input-box">
                        <label for="cv_title" required>推荐</label>
                        <div class="controls">
                            <input type="radio" name="cv[recom]" value="0" <?php if (intval($item['recom'])===0):?>checked<?php endif;?> />&nbsp;否&nbsp;&nbsp;
                            <input type="radio" name="cv[recom]" value="1" <?php if (intval($item['recom'])===1):?>checked<?php endif;?> />&nbsp;是
                        </div>
                    </div>
                    <div class="cv-input-box">
                        <label for="cv_title" required>置顶</label>
                        <div class="controls">
                            <input type="radio" name="cv[top]" value="0" <?php if (intval($item['top'])===0):?>checked<?php endif;?> />&nbsp;否&nbsp;&nbsp;
                            <input type="radio" name="cv[top]" value="1" <?php if (intval($item['top'])===1):?>checked<?php endif;?> />&nbsp;是
                        </div>
                    </div>
                    <div class="cv-input-box">
                        <label for="cv_keywords" >关键词</label>
                        <div class="controls">
                            <input value="<?= $item['keywords']; ?>" type="text" name="cv[keywords]" class="cv-input-large" />
                        </div>
                    </div>
                    <div class="cv-input-box">
                        <label for="cv_description" >项目介绍</label>
                        <div class="controls">
                            <textarea rows="8" name="cv[description]"  class="cv-input-xlarge"><?= $item['description']; ?></textarea>
                        </div>
                    </div>
                    <div class="cv-input-box">
                        <label for="cv_description" >项目背景</label>
                        <div class="controls">
                            <textarea  rows="8" name="cv[background]" class="cv-input-xlarge"><?= $item['background']; ?></textarea>
                        </div>
                    </div>
                    <div class="cv-input-box">
                        <label for="cv_keywords" >项目地址</label>
                        <div class="controls">
                            <input value="<?= $item['online']; ?>" type="text" name="cv[online]" class="cv-input-xlarge" />
                        </div>
                    </div>
                    <div class="cv-input-box">
                        <label for="cv_cover" >封面大图</label>
                        <div class="controls">
                            <input type="hidden" name="cv[cover]" id="cv_cover" />
                            <img onclick="upload_cv_case_cover()" id="cv_cover_preview" src="<?php if (!empty(trim($item['cover']))):?><?= $item['cover']; ?><?php else:?><?= asset('dash/img/addpicture.png'); ?><?php endif;?>" style="width: 80px;height: 60px;" class="cv-cursor" /><div style="text-align: center;position: relative;top: -42px;right: -75px;" class="cv-cursor">
                                <img onclick="delete_cv_case_cover();" src="<?= asset('dash/img/icon_delete15.gif'); ?>">
                            </div>
                        </div>
                    </div>
                    <script type="text/javascript">
                        function delete_cv_case_cover() {
                            $('#cv_cover').val('');
                            $('#cv_cover_preview').attr('src', '<?= asset('dash/img/addpicture.png'); ?>');
                        }
                        function upload_cv_case_cover() {
                            parent.openDialog("媒体上传","<?= url('dash/media/new'); ?>?cl=returnImageToParent('cv_cover',response.f_url);|closeSelf();",'750px','520px');
                        }
                    </script>

                    <script type="text/javascript" src="<?= asset('share/libs/ckeditor/ckeditor.js'); ?>"></script>
                    <div class="cv-input-box">
                        <div class="cv-single-title">服务内容</div>
                        <textarea id="cv_full_text" name="cv[full_text]"><?= $item['full_text']; ?></textarea>
                    </div>
                    <script type='text/javascript'>
                        CKEDITOR.replace("cv_full_text")
                    </script>
                </div>
            </div>
            <!--center end-->
        </div>
    </div>
</form><!--container end-->

<?= view('layout/footer')->send(); ?>
<!--js start-->
<script type="text/javascript">
    var mediaEntry = '<?= url('dash/media/new'); ?>';
    var videoEntry = '<?= url('dash/media/video'); ?>';
    var siteHost = 'http://localhost/cover/public/';
    var videoCloud = '<?= config('cloud.video'); ?>';
    var uploadedImages = [];
    var uploadedVideo;
    function saveForm(){
        $("#cv_form_model_1").form('submit',{
            onSubmit: function(){
                return $(this).form('validate');
            },
            success: function(result){
                var response = JSON.parse(result);
                parent.message(response.message);
                if (response.success){
                    parent.reloadCaseListData();
                    closeSelf();
                }
            }
        });
    }

    function openDialog(title, url, width, height, full) {
        var dialog = layer.open({
            type: 2,
            title: title,
            content: url,
            area: [width, height],
            anim: 5,
            shade: [0.1, '#666']
        });
        if (full) {
            layer.full(dialog);
        }
    }

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