<!DOCTYPE html>
<!--[if IE 8 ]><html dir="ltr" lang="zh-TW" class="ie8"><![endif]-->
<!--[if IE 9 ]><html dir="ltr" lang="zh-TW" class="ie9"><![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<html dir="ltr" lang="zh-TW">
<!--<![endif]--><head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
<title>管理後臺</title>
<meta name="robots" content="noindex, nofollow" />
<link href="less/page.less" rel="stylesheet/less">
<link href="css/main.css" rel="stylesheet">
<link href="css/page.css" rel="stylesheet">
<script src="/jquery/jquery-1.10.js"></script>
<!-- 下拉選單 -->
<link href="/jquery/select/nice-select.css" rel="stylesheet">
<script src="/jquery/select/jquery.nice-select.js"></script>
<script>
	if('<?# alertMsg ?>' != ''){
		alert('<?# alertMsg ?>');
		if('<?# goBack ?>' == 'Y') history.back();
	}
	if('<?# locationHref ?>' != '') location.href = '<?# locationHref ?>';
</script>
</head>
<body>
	<?# sidePage ?>
	<div class="pos_rel" id="content">
		<?# header ?>
		<div class="row mt_10 mb_5 h3 page_title"><?# page_name ?></div>
		<form id="form1" name="form1">
			<div class="card">
				<div class="pos_rel bg_g_100 tabs_warp" id="tabs_warp">
					<div class="tabs_list">
						<a class="tabs_item" href="index.php">控制台</a>
						<a class="tabs_item" data-action="true" href="javascript:void(0);"><?# page_name ?></a>
					</div>
				</div>
				<div class="mall_5">
					<div class="mb_5 add_btn"><a class="mr_2 btn btn_success" href="messageEdit.php">新增訊息</a></div>
					<div class="search_box">
						<div class="mr_5 mb_3 d_inblock">
							<label>類型</label>
							<select id="ty" name="ty">
								<option value="0">全部類型</option>
								<php:repeater id="listT">
								<template>
								<option value="<?# TypeID ?>"><?# TypeName ?></option>
								</template>
								</php:repeater>
							</select>
						</div>
						<div class="mr_5 mb_3 d_inblock">
							<select id="kt" name="kt">
								<option value="1">標題</option>
								<option value="2">會員姓名</option>
								<option value="3">會員暱稱</option>
								<option value="4">會員帳號</option>
								<option value="5">會員信箱</option>
								<option value="6">會員手機</option>
							</select>
							<input type="text" id="kw" name="kw" value="<?# kw ?>" />
						</div>
						<div class="mr_5 mb_3 d_inblock">
							<label>啟用狀態</label>
							<select id="vv" name="vv">
								<option value="">全部</option>
								<option value="1">啟用</option>
								<option value="0">不啟用</option>
							</select>
						</div>
						<div class="mr_5 mb_3 d_inblock">
							<label>是否重要</label>
							<select id="ih" name="ih">
								<option value="">全部</option>
								<option value="1">至頂</option>
								<option value="0">非至頂</option>
							</select>
						</div>
						<div class="mr_5 mb_3 d_inblock">
							<label>讀取狀態</label>
							<select id="ir" name="ir">
								<option value="">全部</option>
								<option value="1">已讀</option>
								<option value="0">未讀</option>
							</select>
						</div>
						<div class="mb_3 d_inblock"><a id="btnOK" class="btn btn_info" href="javascript:void(0);">搜尋</a></div>
					</div>
				</div>
                <ul class="list_box">
                    <php:repeater id="list">
                    <template>
                    <li class="d_lg_flex">
                        <p class="col_lg_1"><label>狀態</label><font><?# txtV ?></font></p>
                        <p class="col_lg_1"><label>重要</label><font><?# txtH ?></font></p>
                        <p class="col_lg_1"><label>讀取</label><font><?# txtR ?></font></p>
                        <p class="col_lg_4"><label>標題</label><font><?# Title ?></font></p>
                        <p class="col_lg_1"><label>回覆</label><font><?# countR ?></font></p>
                        <p class="col_lg_4"><label>類型</label><font><?# TypeName ?></font></p>
                        <p class="col_lg_4"><label>發送者</label><font><?# txtF ?></font></p>
                        <p class="col_lg_4"><label>接收者</label><font><?# txtT ?></font></p>
                        <p class="col_lg_2">
							<label>操作</label>
							<font>
								<a class="mr_2 btn btn_primary" href="messageEdit.php?id=<?# ID ?>">修改</a>
								<a class="mr_2 btn btn_red" href="javascript:void(0);" data-action="del" data-id="<?# ID ?>">刪除</a>
							</font>
						</p>
                    </li>
                    </template>
                    </php:repeater>
                </ul>
			</div>
			<div class="mt_5 d_flex flex_wrap f_justify_end f_aitems_center pag_box row">
				<font class="mr_3 d_flex pag_no"><?# pagtxt ?></font>
				<font><span>每頁</span><input type="text" id="pz" name="pz" value="<?# pz ?>"><span>筆資料，</span></font>
				<font><span>跳到第</span><input type="text" id="p" name="p" value="<?# p ?>"><span>頁</span></font>
				<a class="ml_3 btn btn_info" id="btnGO" href="javascript:void(0);">GO</a>
			</div>
		</form>
		<?# footer ?>
	</div>
</body>
</html>
<script>
	$(function(){
		$('#ty').val('<?# ty ?>');
		$('#kt').val('<?# kt ?>');
		$('#vv').val('<?# vv ?>');
		$('#ih').val('<?# ih ?>');
		$('#ir').val('<?# ir ?>');
		$('#btnOK').click(function(){
			$('#p').val('1');
			$('#form1').submit();
		});
		$('a[data-action="del"]').click(function(){
			if(!confirm('訊息刪除後將無法恢復!是否確定要刪除?')) return false;
			$.ajax({
				'url': 'ajax/message.php',
				'async': false,
				'type': 'POST',
				'data': {'do': 'del', 'id': $(this).data('id')},
				'dataType': 'json',
				'context': $(this).parent().parent().parent(),
				'success': function(obj){
					if(obj.error == '0'){
						$(this).remove();
					}else{
						alert(obj.msg);
					}
				},
				'error': function(){
					alert('系統異常!請重新整理頁面再試一次!');
				}
			});
		});
		$('a[data-action="goPage"]').click(function(){
			$('#p').val($(this).data('page'));
			$('#form1').submit();
		});
		$('#btnGO').click(function(){
			$('#form1').submit();
		});
	});
</script>