<?php
$menu_code = '1020';
require_once (APPPATH.'views/skin/admin/_content_comm.php');
?>


<form name="input_form" id="input_form" method="post" action="/admin/member/member_list/4">

<!-- <div class="common_tep clearfix type01">


	<div class="searh_area">
		
	</div>
</div>
 -->
<div class="write_btn">
	<!--a href="javascript:news_arr_del_proc();">삭제</a-->
	<a href="#" id="btn_reg">등록</a>
</div>

<div class="common_table"  style="margin-top: 30px">
	<span style="font-weight:bold">Total:</span> <?php echo number_format($total_count);?>

	 <span style="margin-left:20px">
    <?/*
        foreach ($arr_default_member_gendar as $val) {
            $member_gender_count = 0;
            if(isset($arr_member_gender[$val['code']])==true) {
                $member_gender_count = $arr_member_gender[$val['code']];
            }
	?>
			<b><?=$val['txt']?>:</b> <a href="javascript:click_search('search_member_gender', '<?=$val['code']?>');"><?=number_format($member_gender_count)?></a>&nbsp;&nbsp;
    <?
        }
    ?>
        </span>
        <span style="margin-left:20px">
    <?
        foreach ($arr_default_member_group as $val) {
            $member_group_count = 0;
            if(isset($arr_member_group[$val['code']])==true) {
                $member_group_count = $arr_member_group[$val['code']];
            }
            echo '<b>'.$val['txt'].':</b> '.number_format($member_group_count).'&nbsp;&nbsp;';
        }
    ?>
        </span>
        <span style="margin-left:20px"><b>오늘신규가입:</b> <a href="javascript:click_search('search_member_new', 'today');"><?=number_format($member_new_count);?></a></span>
	</ul>
    <ul style="text-align:left; padding-top:10px; padding-bottom:10px;">
        <span>
    <?
        foreach ($arr_default_member_age as $val) {
            $member_age_count = 0;
            if(isset($arr_member_age[$val['code']])==true) {
                $member_age_count = $arr_member_age[$val['code']];
            }
	?>
			<b><?=$val['txt']?>:</b> <a href="javascript:click_search('search_member_age', '<?=$val['code']?>');"><?=number_format($member_age_count)?></a>&nbsp;&nbsp;
    <?
        }*/
    ?>
        </span>


</div>




<!-- 테이블 시작-->
<div class="common_table">
<table>
	<thead>
		<th>번호</th>
		<th>썸네일</th>
		<th>웹툰이름</th>
		<th>작가명</th>
		<th>상태</th>
		<th>관심웹툰 등록수</th>
		<th>연재일</th>
		<th>관리</th>
	</thead>
	<tbody>
		

<?php
	if(($total_rows=count($list))==0) {
?>
		<tr>
			<td colspan="13">등록된 내용이 없습니다.</td>
		</tr>
<?php
	} else {

	    $dataNumber = ($total_rows + $limit)-($page*$limit);
		foreach($list as $val) {
            $idx                = $val['idx'];
			$main_img 	    = $val['main_img'];
			$name 	    = $val['name'];
			if($val['status']==0) {
				$status = '연재중';
			} else if($val['status']==1) {
				$status = '완결';
			} else if($val['status']==2) {
				$status = '미완결';
			} else {
				$status = '';
			}
			$date_sun 	        = ($val['date_sun']==1) ? '일 / ' : '';
			$date_mon 	        = ($val['date_mon']==1) ? '월 / ' : '';
			$date_tue 	        = ($val['date_tue']==1) ? '화 / ' : '';
			$date_wed 	        = ($val['date_wed']==1) ? '수 / ' : '';
			$date_thu 	        = ($val['date_thu']==1) ? '목 / ' : '';
			$date_fri 	        = ($val['date_fri']==1) ? '금 / ' : '';
			$date_sat 	        = ($val['date_sat']==1) ? '토 / ' : '';
			$interest_count = $val['interest_count'];
?>

				<tr>
					<td><?php echo $dataNumber;?></td>
					<td><?php if($main_img!='') echo '<img src="'.$main_img.'" width="100" />';?></td>
					<td><?php echo $name;?></td>
					<td>
<?php 
foreach($cartoonist as $v) {
	if($v['idx']==$val['mt_cartoonists_idx']) {
		echo $v['name'];
	}
}
?>
					</td>
					<td><?php echo $status?></td>
					<td><?php echo number_format($interest_count);?></td>
					<td><?php echo $date_sun.$date_mon.$date_tue.$date_wed.$date_thu.$date_fri.$date_sat;?></td>
					<td style="width:200px" class="tool_btn">
						<a href="/admin/maptoon/maptoon_detail/10?idx=<?php echo $idx;?>"><i class="fa fa-pencil"></i>수정</a>
<?php
if($val['num_of_episodes']==0) {
	echo '<a id="btn_del" attr="'.$idx.'" style="cursor:pointer;"><i class="fa fa-close"></i>삭제</a>';
}
?>						
						
					</td>
				</tr>
<?php
		    $dataNumber--;
		}
	}
?>


	</tbody>
	</table>
</div>


<div class="pasing_wrap">
	<?//=$pagination?>
</div>

</form>

<script type="text/javascript">
$(document).ready(function() {
	$("#btn_reg").click(function() {
		document.location.href = '/admin/maptoon/maptoon_detail/10';
	});

	$("#btn_del").click(function() {
		idx = $(this).attr('attr');
		if(confirm('정말 삭제하시겠습니다. 삭제 후 복구 불가능합니다.') && idx!=undefined && idx>0) {
			$.ajax({
				url: '/admin/maptoon/maptoon_list_del',
				data: {
					format: 'json',
					idx:idx
				},
				//dataType: 'jsonp',
				type:'post',
				success: function(msg) {
			        var json = $.parseJSON(msg);
			        if(json.result=='success') {
			        	document.location.reload();
			        } else {
			        	alert(json.result);
						document.location.reload();
			        }
			    },
			      error: function(err) {
			        // console.log(err);
			    }
			});
		}
	});
});
</script>