{include "header.inc.html"}
<div class="content_box">
	<div class="toolbar_box">
		<div class="toolbar"> <span> <strong>{$lang.admin.industry.name}</strong><br />
		<span class="english">{$lang.admin.industry.name_en}</span> </span> </div>
	</div>
{if $smarty.get.act=="add" || $smarty.get.act=="edit"}
<div class="categoryForm">
<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">行业编号：</label><div class="element"><input type="text" class="text w300" name="code" value="{$catInfo.code}"></div></div>
<div class="form-line"><label class="label">行业名称：</label><div class="element"><input type="text" class="text w300" name="name" value="{$catInfo.name}"></div></div>
<div class="form-line"><label class="label">上级行业：</label><div class="element"><select name="parentId"><option value="0">顶级行业</option>
{foreach from=$category item=item}
<option value="{$item.id}"{if $catInfo.parentId==$item.id || $smarty.session.industryParentId==$item.id} selected{/if}>{for $foo=1 to $item.grade*4}&nbsp;{/for}{$item.code} {$item.name}</option>
{/foreach}
</select>
</div></div>
<div class="form-line"><label class="label">排序：</label><div class="element"><input type="text" class="text w300" name="sortId" value="{$catInfo.sortId|default:50}" /></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="w40">ID</th><th>行业编号</th><th>分类名称</th><th>首页显示</th><th class="w60">排序</th><th class="w90">添加时间</th><th class="w100">操作</th>
 </tr>
 {$limit=15}
 {$allCount=$category|@count}
 {$page=$smarty.get.page|default:1}
{industry limit=15 pager="true"}
<tr>
<td>{$item.id}</td><td>{$item.code}</td><td>{for $foo=1 to $item.grade*4}&nbsp;{/for}{$item.name}</td>
<td><img class="smodtoggle" name="isIndex" sid="{$item.id}" src="/admin/images/{if $item.isIndex==1}yes{else}no{/if}.gif"></td>
<td><span class="smodedit" name="sortId" sid="{$item.id}" >{$item.sortId}</span></td>
<td>{$item.posttime|date_format:"%Y-%m-%d"}</td><td><a href="/admin/industry/act/edit/id/{$item.id}" title="{$lang.edit}" class="modBtn">{$lang.edit}</a> <a href="/admin/industry/act/del/id/{$item.id}" class="delBtn" title="{$lang.del}">{$lang.del}</a></td>
</tr>
{/industry}
</table>
<div class="page">
	<div class="pagin fr">{pager allCount=$allCount url='/admin/industry/page/' number="false"}</div>
</div>
{/if}
</div><!--.content_box-->
{if $smarty.get.act=="list"}
{literal}
<script type="text/javascript">
$(function(){
	$(".delBtn").click(function(){
			if(!confirm("删除后不可恢复，是否确认删除？")){return false;}
			var tr = $(this).parent("td").parent("tr");
			var id = tr.find("td").eq(0).text();
			if(parseInt(id,10)){
				var sdata = "inajax=1&act=del&id="+id;
				$.ajax({
					type:"POST",
					url:".",
					data:sdata,
					dataType:"json",
					success:function(data){
						alert(data.message);
						if(data.success){
							tr.fadeOut("slow").remove();
						}
					}
				});
			}
		return false;
	});
})
</script>
{/literal}
{/if}
<script type="text/javascript">
<!--
	$(function(){
		$("input[name='code']").focus();
	})
//-->
</script>
{include "footer.inc.html"}