<!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">
<script src="/jquery/jquery-1.10.js"></script>
<script src="ckfinder/ckfinder.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">
			<div class="row mt_10 mb_5 h3 page_title">匯入產品</div>
			<div class="card">
				<div class="pos_rel bg_g_100 tabs_warp" id="tabs_warp">
					<div class="tabs_list">
						<a class="tabs_item" href="productList.php">產品資訊</a>
						<a class="tabs_item" data-action="true" href="javascript:void(0);">匯入產品</a>
					</div>
				</div>
				<div class="mt_3 mb_3 row card_body">
					<p>請先下載匯入用Excel表，按照Excel欄位填入商品資料。分類名稱必須填寫最下層的分類。圖片欄位請填寫完整圖檔名如：1.jpg。大圖欄位可以填寫多個圖檔名，請以換行來區分。</p>
					<p class="d_flex">請將圖片和Excel表直接壓縮成<b class="txt_red">zip檔</b>。</p>
					<input type="hidden" id="UpFileZip" name="UpFileZip" />
					<div class="mt_7 d_flex start_box">
						<a class="mr_2 btn btn_yellow" href="downExcel.php" target="_blank">下載匯入用Excel</a>
						<a class="mr_2 btn btn_indigo" id="btnUP" href="javascript:void(0);">上傳ZIP檔</a>
					</div>
				</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(){
		$('#btnUP').click(function(){
			CKFinder.modal({
				chooseFiles: true,
				resourceType: 'Zip',
				width: 980,
				height: 600,
				onInit: function(finder) {
					finder.on('files:choose', function(evt) {
						var file = evt.data.files.first();
						$('#UpFileZip').val(file.getUrl());
					});
				}
			});
		});

		$('#btnOK').click(function(){
			if($('#UpFileZip').val() == ''){
				alert('請先選擇匯入檔案!');
				return false;
			}
			$('#form1').submit();
		});
		$('#btnCancel').click(function(){
			location.href = 'productList.php';
		});
	});
</script>