<!DOCTYPE html>
<html lang="ko">

<head>
    <?php $this->load->view('adm/layout/head')?>
</head>

<body>
    <!-- start wrapper -->
    <div class="wrapper">
        <!-- start nav -->
        <?php $this->load->view('adm/layout/nav')?>
        <!-- end nav -->
        <!-- start content_wrapper -->
        <div class="content_wrapper">
            <!-- start header -->
            <?php $this->load->view('adm/layout/header')?>
            <!-- end header -->
            <div class="contents">
                <h3 style="font-size:17px;font-weight:bold;color:#aaa">회원관리 > 에디터관리 > 등록</h3>
                <!-- 여기까지 레이아웃 상단입니다 -->
                <div class="box">
                    <div class="box-table" style="overflow:visible">
                        <form method="post" action="" enctype="multipart/form-data">
                            <input type="hidden" name="contentId" value="<?php if(isset($post)) echo $post->idx?>">
                            <table class="table table-bordered">
                                <tbody>

                                    <tr>
                                        <th>아이디</th>
                                        <td>
                                            <input type="text" name="partner_id" class="form-control" value="<?php if(isset($post)) echo $post->partner_id?>">
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>이름</th>
                                        <td>
                                            <input type="text" name="partner_real_name" class="form-control" value="<?php if(isset($post)) echo convertEmoji($post->partner_real_name)?>">
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>채널명</th>
                                        <td>
                                            <input type="text" name="partner_name" class="form-control" value="<?php if(isset($post)) echo convertEmoji($post->partner_name)?>">
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>설명</th>
                                        <td>
                                            <input type="text" name="partner_intro" class="form-control" value="<?php if(isset($post)) echo convertEmoji($post->partner_intro)?>">
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>홈페이지</th>
                                        <td>
                                            <input type="text" name="partner_homepage" class="form-control" value="<?php if(isset($post)) echo $post->partner_homepage?>">
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>아이콘</th>
                                        <td>
                                            <input type="hidden" name="partner_img" value="<?php if(isset($post)) echo $post->partner_img?>">
                                            <input type="file" class="cm-main-img" name="uploadfile">
                                            <img src="<?php if(isset($post)) echo imgSrc($post->partner_img)?>" width="200"
                                                style="margin-top:5px;<?php if(isset($post)) echo $post ? '':'display:none;'?>">
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>메인이미지</th>
                                        <td>
                                            <input type="hidden" name="main_img" value="<?php if(isset($post)) echo $post->main_img?>">
                                            <input type="file" class="cm-main-img" name="uploadfile2">
                                            <img src="<?php if(isset($post)) echo imgSrc($post->main_img)?>"
                                                style="max-width:800px;margin-top:5px;<?php if(isset($post)) echo $post ? '':'display:none;'?>">
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>활성/비활성</th>
                                        <td>
                                            <select name="is_del" data-width="80">
                                                <option value="N" <?php if(isset($post) && $post->is_del == 'N') echo ' selected';?>>활성</option>
                                                <option value="Y" <?php if(isset($post) && $post->is_del == 'Y') echo ' selected';?>>비활성</option>
                                            </select>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                            <div style="text-align:center">
                                <a class="btn btn-danger cm-contentedit-cancel">취소</a>
                                <button type="submit" class="btn btn-success">저장</button>
                            </div>
                        </form>
                    </div>
                </div>
                <!-- 여기부터 레이아웃 하단입니다 -->
            </div>
        </div>
        <!-- end content_wrapper -->
    </div>
    <!-- end wrapper -->
    <?php $this->load->view('adm/layout/footer')?>
    <script>
    var contentEdited = false;
    $(function() {
        $('input,select').on('change', function() {
            contentEdited = true;
        })

        $('.cm-contentedit-cancel').on('click', function() {
            if (contentEdited) {
                if (confirm('정말로 취소하시겠습니까?')) {
                    location.href = '/adm/member/editor'
                }
            } else location.href = '/adm/member/editor';
        })
    })
    </script>
</body>

</html>