<!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="template_categoryList.php" method="get">
                            <div class="abbNew" style="width: 125px;"><a class="add" href="template_categoryEdit.php">新增版型分類</a></div>
                            <div class="titleTyp" style=" width: 720px;">
                                <div class="visible">編號</div>
                                <div class="visible">啟用</div>
                                <div class="userName" style="width: 200px;">版型分類名稱</div>
                                <div class="visible">排序</div>
                                <div class="operating">操作</div>
                            </div>
                            <php:repeater id="list">
                                <template>
                                    <div class="listTyp" style=" width: 720px;">
                                        <div class="visible"><?# CategoryID ?></div>
                                        <div class="visible"><?# Visible ?></div>
                                        <div class="userName" style="width: 200px;"><?# CategoryName ?></div>
                                        <div class="visible"><?# OrderNO ?></div>
                                        <div class="operating">
                                            <div class="modification"><span></span><a href="template_categoryEdit.php?id=<?# CategoryID ?>">修改</a></div>
                                            <div class="delete"><span></span><a data-action="delItem" data-id="<?# CategoryID ?>" href="javascript:void(0);">刪除</a></div>
                                        </div>
                                    </div>
                                </template>
                            </php:repeater>
                    </form>
                </div>
            </div>
        </div>
        <?# footer ?>
    </div>
<script>
<!--
	$(function(){
		$('a[data-action="delItem"]').click(function(){
			if(!confirm('刪除資料後將無法恢復!是否確定要刪除版型分類資料?')){
				return false;
			}else{
				$.ajax({
					url: 'ajax/template_category.php',
					async: false,
					type: 'POST',
					data: {'do':'del','id':$(this).data('id')},
					dataType: "text",
					context: $(this).parent('td').parent('tr'),
					success: function(msg){
						if(msg == '1'){
							$(this).remove();
						}else if(msg == '-10'){
							alert('版型分類下面還有版型，不能刪除!\r\n請先轉移或刪除相關資料，再進行刪除動作!');
						}else{
							alert('刪除失敗!\r\n'+msg);
						}
					},
					error: function(){
						alert('系統異常!!');
					}
				});
			}
		});
	});
//-->
</script>
</body>
</html>