<!DOCTYPE html>
<html dir="ltr" lang="zh-TW">
<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">
<link href="css/jquery.minicolors.css" rel="stylesheet">
<script src="/jquery/jquery-1.10.js"></script>
<script src="/js/jquery.minicolors.js"></script><!--顏色選擇器-->
<script src="ckeditor/ckeditor.js"></script>
<script src="ckfinder/ckfinder.js"></script>
<!--tabs-->
<script src="/jquery/horizontalmenu/jquery.horizontalmenu.js"></script>
<!-- 瀏覽用燈箱片效果 -->
<link href="/jquery/fancybox-3.0/dist/jquery.fancybox.css" rel="stylesheet">
<script src="/jquery/fancybox-3.0/dist/jquery.fancybox.min.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 ?>
		<form id="form1" name="form1" method="post">
            <input type="hidden" id="id" name="id" value="<?# id ?>" />
			<div class="row mt_10 mb_5 h3 page_title"><?# editTitle ?><?# page_name ?></div>
			<div class="card">
				<div class="pos_rel bg_g_100 tabs_warp" id="tabs_warp">
					<div class="tabs_list">
						<a class="tabs_item" data-action="true" data-id="box1" href="javascript:void(0);"><?# page_name ?></a>
						<php:repeater id="listT">
						<template>
						<a class="tabs_item" data-id="<?# id ?>" href="javascript:void(0);"><?# name ?></a>
						</template>
						</php:repeater>
					</div>
				</div>
				<?# delTxt ?>
				<div id="tabs_box" class="card_body form_box">
					<div id="box1" class="d_md_flex flex_wrap tab_content" data-action="true">
						<div class="col_md_6 d_flex form_list"><label>分類名稱</label><input type="text" id="CategoryName" name="CategoryName" value="<?# CategoryName ?>" /></div>
						<div class="col_md_6 d_flex form_list"><label>中文路徑</label><input type="text" id="TwPathName" name="TwPathName" value="<?# TwPathName ?>" /></div>
						<div class="col_md_4 d_flex form_list IsIndex"><label>首頁</label><p><font class="checkbox"><input type="checkbox" id="IsIndex" name="IsIndex" value="1"><span></span></font></p></div>
						<div class="col_md_4 d_flex form_list"><label>狀態</label><p><font class="checkbox"><input type="checkbox" id="Visible" name="Visible" value="1"><span></span></font></p></div>
						<div class="col_md_4 d_flex form_list"><label>排序</label><input type="text" id="OrderNO" name="OrderNO" value="<?# OrderNO ?>" onkeypress="if (event.keyCode < 48 || event.keyCode >57) event.returnValue = false;" /></div>
						<div class="col_12 form_list"><label>說明</label><textarea class="ckeditor" id="Description" name="Description"><?# Description ?></textarea></div>
						<div class="col_12 d_flex form_btn"><a class="ml_2 btn btn_tertiary" data-action="nextPage" href="javascript:void(0);">下一步</a></div>
					</div>
					<php:repeater id="listH">
                    <template>
                    <?# html_box ?>
                    </template>
                    </php:repeater>
				</div>
			</div>
            <div class="row mt_5 d_flex start_box">
				<a class="mr_2 btn btn_info" id="btnOK" href="javascript:void(0);">送出</a>
                <a class="mr_2 btn btn_g_300" id="btnCancel" href="javascript:void(0);">返回</a>
			</div>
		</form>
		<?# footer ?>
	</div>
</body>
</html>
<script>
	$(function(){
		if('<?# IsIndex ?>' == '1') $('#IsIndex').prop('checked', true);
		if('<?# Visible ?>' == '1') $('#Visible').prop('checked', true);

		$('#tabs_warp').horizontalmenu({
			itemClick: function (item) {
				$('#tabs_box .tab_content').removeAttr('data-action');
				$('#tabs_box .tab_content:eq(' + $(item).index() + ')').attr('data-action', 'true');
				return false;
			}
		});
		
		$('#btnOK').click(function(){
			if($('#CategoryName').val() == ''){
				alert('分類名稱不可空白!');
				$('#CategoryName').focus();
				tabchk(1);
				return false;
			}
			$('#form1').submit();
		});
		$('#btnCancel').click(function(){
			location.href = 'faq_categoryList.php';
		});
	});
	
	build_ckeditor('Description', 'Faq');
</script>