<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理後臺</title>
<meta name="keywords" content="管理後臺" />
<meta name="description" content="管理後臺" />
<script src="/jquery/jquery-1.8.2.min.js"></script>
</head>

<body>
	<div class="wrapper">
    	<?# header ?>
    	<div class="wrap">
        	<?# sidePage ?>
            <div class="contentMain">
            	<h3>會員列表</h3>
                <div class="article">
                	<form id="form1" name="form1" action="customerList.php" method="get">
                    	<fieldset style="width: 100%;">
                            <div style="overflow: hidden;">
                                <div class="abbNew" style="width: 125px; float: left; margin: 10px;"><a class="add" href="customerEdit.php?pUrl=<?# encodeUrl ?>">新增會員</a></div>
                            </div>
                            <p style="width: 800px; margin: 15px auto;">會員等級：
                                <select id="cl" name="cl">
                                    <option value="" style="#000">全部</option>
                                    <option value="0">普通會員</option>
                                    <option value="-1">停權會員</option>
                                </select>
                                <input type="button" id="btnOK" name="btnOK" value="搜尋" />
                            </p>
                            <div class="titleTyp">
                            	<div class="visible"><input type="checkbox" id="chkAll" name="chkAll" /></div>
                                <div class="visible" style="width: 60px;">評論數</div>
                            	<div class="userName" style="width: 150px;">會員級別</div>
                                <div class="userName" style="width: 180px;">電子信箱</div>
                                <div class="userName" style="width: 150px;">姓名</div>
                                <div class="userName" style="width: 150px;">手機</div>
                                <div class="userName" style="width: 150px;">申請IP</div>
                                <div class="userName" style="width: 150px;">申請時間</div>
                                <div class="operating">操作</div>
                            </div>
                            <php:repeater id="list">
                                <template>
                                    <div class="listTyp">
                                    	<div class="visible"><input type="checkbox" name="chk[]" value="<?# CustomerID ?>" /></div>
                                        <div class="visible" style="width: 60px;"><?# countC ?></div>
                                        <div class="userName" style="width: 150px;"><?# LevelName ?></div>
                                        <div class="userName" style="width: 180px;"><?# LoginName ?><?# Facebook ?></div>
                                        <div class="userName" style="width: 150px;"><?# CustomerName ?></div>
                                        <div class="userName" style="width: 150px;"><?# Mobile ?></div>
                                        <div class="userName" style="width: 150px;"><?# CreatedIP ?></div>
                                        <div class="userName" style="width: 150px;"><?# CreatedTime ?></div>
                                        <div class="operating">
                                            <div class="modification"><span></span><a href="customerEdit.php?id=<?# CustomerID ?>&pUrl=<?# encodedUrl ?>">修改</a></div>
                                            <div class="delete"><span></span><a data-action="<?# AuthorityType ?>" data-id="<?# CustomerID ?>" href="javascript:void(0);"><?# AuthorityName ?></a></div>
                                        </div>
                                    </div>
                                </template>
                            </php:repeater>
                            <p>
                            	<input type="button" id="btnDel" value="停權" /> &nbsp;
                                <input type="button" id="btnRec" value="復權" />
                            	<?# pagtxt ?>&nbsp; &nbsp;
                            	每頁&nbsp;<input type="text" id="pz" name="pz" value="<?# pz ?>" style="width:20px;" />&nbsp;筆資料，跳到第&nbsp;<input type="text" id="p" name="p" value="<?# p ?>" style="width:20px;" />&nbsp;頁&nbsp;<input type="button" id="btnGO" name="btnGO" value="GO" />
                            </p>
                        </fieldset>
                    </form>
                </div>
            </div>
        </div>
        <?# footer ?>
    </div>
<script>
<!--
	$(function(){
		$('#cl').val('<?# cl ?>');
		$('#btnOK').click(function(){
			$('#p').val('1');
			$('#form1').submit();
		});
		$('#chkAll').click(function(){
			$('input:checkbox[name="chk[]"]').attr('checked',$('#chkAll').is(':checked'));
		});
		$('a[data-action="delItem"]').click(function(){
			$.ajax({
				url: 'ajax/customer.php',
				async: false,
				type: 'POST',
				data: {'do':'del','id':$(this).data('id')},
				dataType: "text",
				context: $(this).parent('div').parent('div').parent('div'),
				success: function(msg){
					if(msg == '1'){
						location.href = 'customerList.php';
					}else{
						alert('停權失敗!\r\n'+msg);
					}
				},
				error: function(){
					alert('系統異常!!');
				}
			});
		});
		$('#btnDel').click(function(){
			var ids = [];
			$('input:checkbox[name="chk[]"]:checked').each(function(index, element){
				ids[ids.length] = $(element).val();
			});
			if(ids.length == 0){
				alert('請先勾選要停權的會員!');
				return false;
			}else{
				$.ajax({
					url: 'ajax/customer.php',
					async: false,
					type: 'POST',
					data: {'do':'del','ids':ids.join(',')},
					dataType: "text",
					success: function(msg){
						if(msg == '1'){
							if('<?# currentUrl ?>' == ''){
								location.href = 'customerList.php';
							}else{
								location.href = '<?# currentUrl ?>';
							}
						}else{
							alert('刪除失敗!\r\n'+msg);
						}
					},
					error: function(){
						alert('系統異常!!');
					}
				});
			}
		});
		$('a[data-action="recItem"]').click(function(){
			$.ajax({
				url: 'ajax/customer.php',
				async: false,
				type: 'POST',
				data: {'do':'recovery','id':$(this).data('id')},
				dataType: "text",
				context: $(this).parent('div').parent('div').parent('div'),
				success: function(msg){
					if(msg == '1'){
						location.href = 'customerList.php';
					}else{
						alert('停權失敗!\r\n'+msg);
					}
				},
				error: function(){
					alert('系統異常!!');
				}
			});
		});
		$('#btnRec').click(function(){
			var ids = [];
			$('input:checkbox[name="chk[]"]:checked').each(function(index, element){
				ids[ids.length] = $(element).val();
			});
			if(ids.length == 0){
				alert('請先勾選要停權的會員!');
				return false;
			}else{
				$.ajax({
					url: 'ajax/customer.php',
					async: false,
					type: 'POST',
					data: {'do':'recovery','ids':ids.join(',')},
					dataType: "text",
					success: function(msg){
						if(msg == '1'){
							if('<?# currentUrl ?>' == ''){
								location.href = 'customerList.php';
							}else{
								location.href = '<?# currentUrl ?>';
							}
						}else{
							alert('刪除失敗!\r\n'+msg);
						}
					},
					error: function(){
						alert('系統異常!!');
					}
				});
			}
		});
		$('a[data-action="goPage"]').click(function(){
			$('#p').val($(this).data('id'));
			$('#form1').submit();
		});
		$('#btnGO').click(function(){
			$('#form1').submit();
		});
	});
//-->
</script>
</body>
</html>