{include "header.inc.html"}
<link rel="stylesheet" href="{$baseUrl}static/jquery-ui-1.8.24/themes/base/jquery.ui.all.css">
<script src="{$baseUrl}static/jquery-ui-1.8.24/ui/jquery.ui.core.js"></script>
<script src="{$baseUrl}static/jquery-ui-1.8.24/ui/jquery.ui.widget.js"></script>
<script src="{$baseUrl}static/jquery-ui-1.8.24/ui/jquery.ui.datepicker.js"></script>
{$temaiLang = $lang.admin.temai.form}
<div class="content_box">
	<div class="toolbar_box">
		<div class="toolbar"> <span> <strong>{$lang.admin.temai.name}</strong><br />
		<span class="english">{$lang.admin.temai.name_en}</span> </span> </div>
	</div>
{if $smarty.get.act=="edit" || $smarty.get.act=="add"}
<div class="brandForm">
<form class="form" action="" method="post">
<input type="hidden" name="act" value="{$smarty.get.act}" />
{if $smarty.get.act=="edit"}
<input type="hidden" name="id" value="{$smarty.get.id}" />
{/if}
<div class="form-line">
<label class="label">{$temaiLang.name}：</label><div class="element"><input type="text" class="text w200" name="name" value="{$temaiInfo.name}" /></div>
</div>
<div class="form-line">
<label class="label">{$temaiLang.brand}：</label><div class="element"><select name="brandId">
{brand limit="false"}
<option value="{$item.id}"{if $temaiInfo.brandId==$item.id} selected{/if}>{$item.name}</option>
{/brand}
</select></div>
</div>
<div class="form-line">
<label class="label">{$temaiLang.starttime}：</label><div class="element"><input type="text" class="text w90 datepicker" name="starttime" value="{if $temaiInfo.starttime}{$temaiInfo.starttime|date_format:'Y-m-d'}{/if}" /></div>
</div>
<div class="form-line">
<label class="label">{$temaiLang.endtime}：</label><div class="element"><input type="text" class="text w90 datepicker" name="endtime" value="{if $temaiInfo.endtime}{$temaiInfo.endtime|date_format:'Y-m-d'}{/if}" /></div>
</div>
<div class="form-line">
<label class="label">折扣：</label><div class="element"><input type="text" class="text w50" name="zhekou" value="{$temaiInfo.zhekou}" /> 折起</div>
</div>
<div class="form-line">
<label class="label">{$lang.form.sort}：</label><div class="element"><input type="text" class="text w200" name="sortId" value="{$temaiInfo.sortId|default:50}" /></div>
</div>
<div class="form-line">
<label class="label">{$lang.form.iStatus}：</label><div class="element"><input type="radio" name="iStatus" value="1"{if $temaiInfo.iStatus==1} checked{/if} /> 有效 <input type="radio" name="iStatus" value="0"{if $temaiInfo && $temaiInfo.iStatus==0} checked{/if} /> 无效</div>
</div>
<div class="form-line">
<label class="label">简介：</label><div class="element"><textarea class="text w300" name="desc" style="height:60px;">{$temaiInfo.desc}</textarea></div>
</div><div class="form-line">
<label class="label">展示图：</label><div class="element"><input type="hidden" name="thumbId" id="thumbId" value="{$temaiInfo.thumbId}" />
{if  $temaiInfo.thumbId}
{attachment id=$temaiInfo.thumbId limit=1}
<img id="img-thumb" src="{$item.url}" />
{/attachment}
{else}
<img id="img-thumb" src="/static/images/default.png" />
{/if}<br><span id="uploadBtn"></span>
</div>
</div>
<div class="form-line">
<label class="label">Banner图：</label><div class="element"><input type="hidden" name="bannerId" id="bannerId" value="{$temaiInfo.bannerId}" />
{if  $temaiInfo.bannerId}
{attachment id=$temaiInfo.bannerId limit=1}
<img id="img-thumb-banner" src="{$item.url}" />
{/attachment}
{else}
<img id="img-thumb-banner" src="/static/images/default.png" />
{/if}<br><span id="uploadBtnBanner"></span>
</div>
</div>
<div class="form-line">
<label class="label"></label><div class="element"><input class="btn_sub" type="submit" value="{$lang.form.submit}"></div>
</div>
</form>
</div>
 {else}
 <table class="table-ca table_1" id="tInfo">
 <tr>
<th class="w60">编号</th><th>{$temaiLang.name}</th><th>{$temaiLang.event}</th><th>{$temaiLang.goods}</th><th class="w50">排序</th><th class="w50">{$lang.form.iStatus}</th><th class="w100">添加时间</th><th class="w100">操作</th>
 </tr>
{temai limit=15 pager="true"}
<tr>
<td>{$item.id}</td><td>{$item.name}</td><td>{$item.eventName}</td><td>{$item.goodsName}</td><td>{$item.sortId}</td>
<td><img class="smodtoggles" name="iStatus" sid="{$item.id}" src="{$adminUrl}images/{if $item.iStatus==1}yes{else}no{/if}.gif"></td>
<td>{$item.posttime|date_format:"Y-m-d"}</td><td><a href="{$adminUrl}temai/act/edit/id/{$item.id}" class="modBtn">{$lang.edit}</a> <a href="{$adminUrl}temai/act/del/id/{$item.id}" class="delLink delBtn">{$lang.del}</a></td>
</tr>
{/temai}
</table>
<div class="page">
	<div class="pagin fr">{pager allCount=$allCount url='/admin/brand/page/page' number="false"}</div>
</div>
{/if}

{if $smarty.get.act=="edit" || $smarty.get.act=="add"}
<script type="text/javascript" src="/plugins/swfupload/swfupload.js"></script>
<script type="text/javascript">
$(function(){
	window.onerror=function(){ return true; }
	$("input.datepicker").datepicker({ showOn: "both",buttonImage:"{$baseUrl}static/images/calendar-blue.png",dateFormat:"yy-mm-dd" });
	swfu_settings.button_placeholder_id = "uploadBtn";
	swfu = new SWFUpload(swfu_settings);
	swfu.uploadSuccess = function(obj,data,resp){
			var data = eval('('+data+')');
			if(data.success){
				var url = decodeURIComponent(data.url);
				swfu.setButtonText("<span class='redText'>上传成功</span>");
				swfu.setButtonDisabled(false);
				$("#img-thumb").attr("src","/"+url);
				$("#thumbId").val(data.id);
			}
	}

	swfuBanner = new SWFUpload(swfu_settings_banner);
	swfuBanner.uploadSuccess = function(obj,data,resp){
			var data = eval('('+data+')');
			if(data.success){
				var url = decodeURIComponent(data.url);
				swfuBanner.setButtonText("<span class='redText'>{$lang.admin.success}</span>");
				swfuBanner.setButtonDisabled(false);
				$("#img-thumb-banner").attr("src","/"+url);
				$("#bannerId").val(data.id);
			}
	};

});
</script>
{/if}
</div><!--.content_box-->
{include "footer.inc.html"}