<?$data=$mt_data[0] //맵툰 정보?>
<main id="main" role="main" tabindex="-1">
  <div class="container">
    <div class="layout-blog">
      <div>
        <article class="current-webtoon poster gap-bottom-sm">
          <a href=""><img src="<?=imgSrc($data['main_img'])?>" alt="" width="191" height="241"></a>
          <h2 class="title"><?=$data['name']?></h2>
          <div class="summary">
            <p><?=$data['description']?></p>
          </div>
          <div class="tools">
            <a href="" id="recommend">추천</a>
            <?//<!-- <a class="add" href="">관심웹툰 <span class="plus-circle"></span></a> -->?>
            <a href="/web/maptoon/article?mtId=<?=$data['idx']?>&no=1">첫화보기</a>
          </div>
        </article>
        <?if(count($notice)!=0){?>
          <div class="webtoon-tips gap-bottom-md">
              <span>공지</span>
              <?foreach($notice as $val){
                  echo $val;
              }?>
          </div>
        <?}?>
        <div class="webtoon-series-list-wrapper">
          <table class="webtoon-series-list" cellspacing="0" cellpadding="0">
            <caption><span class="visually-hidden">회차별 목록</span></caption>
            <colgroup>
              <col width="99">
              <col width="*">
              <col width="141">
              <col width="76">
            </colgroup>
            <thead>
              <tr>
                <th scope="col">이미지</th>
                <th scope="col">제목</th>
                <th scope="col">별점</th>
                <th scope="col">등록일</th>
              </tr>
            </thead>
            <!-- 게임배너 or 광고배너 -->
            <tbody>
              <?foreach($episodes as $val){?>
                <tr>
                  <td>
                    <a href="/web/maptoon/article?mtId=<?=$val['mt_list_idx']?>&no=<?=$val['ep_no']?>">
                      <img src="<?=imgSrc($val['main_img'])?>" title="<?=$val['title']?>" alt="31화" onerror="this.src='https://static-comic.pstatic.net/staticImages/COMICWEB/NAVER/img/common/non71_41.gif'" width="71" height="41">
                      <span class="mask"></span>
                    </a>
                  </td>
                  <td class="title">
                    <a href="/web/maptoon/article?mtId=<?=$val['mt_list_idx']?>&no=<?=$val['ep_no']?>"><span class="episode"><?=$val['title']?></span></a></td>
                  <td>
                    <div>
                      <span class="webtoon-star"><span style="width:<?=$val['grade']*10?>%">평점</span></span>
                      <strong><?=$val['grade']?></strong>
                    </div>
                  </td>
                  <td class="num"><?=explode(" ",$val['reg_date'])[0]?></td>
                </tr>
              <?}?>
            </tbody>
          </table>
        </div>
        <?=$pagination?>
        <?/*<!--
        <div class="pagination">
          <a href="" class="prev prev-angle">이전</a>
          <a href="">1</a>
          <span class="current">2</span>
          <a href="">3</a>
          <a href="">4</a>
          <a href="" class="next next-angle">다음</a>
        </div>-->*/?>
      </div>
      
      <!-- side bar -->
        <? include_once ('mt_right_inc.php');?>
      <!-- side bar -->

    </div>
  </div>
</main>

<script >
$("#recommend").on("click",function(e){
  e.preventDefault();
  $.ajax({
        url: '/web/maptoon/mt_recommend',
        sync: false,
        type: 'POST',
        dataType: 'json',
        data:{
          mt_list_idx: <?=$data['idx']?>
        },
        success: function (response_data){
          if(response_data.state==0){
            var _login = confirm(response_data.message+" 로그인 페이지로 이동하시겠습니까?");
            if(_login){
              window.location.href='https://crossmap.co.kr/web/user/login';
            }
          }else{
            alert(response_data.message);
            return false;
          }
        },
        error: function (response_data) {
          console.log(response_data);
            alert("실패했습니다 관리자에게 문의주세요");
            return false;
        }
    });
})
</script>

