<!-- $Id: goods_type.htm 7374 2007-03-19 09:56:11Z liry $ -->

{if $full_page}
{include file="pageheader.htm"}
{insert_scripts files="../js/utils.js,listtable.js"}
<div class="form-div">
<form method="post" action="javascript:newGoodsType()" name="theForm">
{$lang.new_goods_type}:
<input type="text" name="name" maxlength="40" size="40" />
<input type="submit" value="{$lang.button_submit}" class="button" />
</form>
</div>

<!-- start goods type list -->
<div class="list-div" id="listDiv">
{/if}

<table width="100%" cellpadding="3" cellspacing="1" id="listTable">
  <tr>
    <th>{$lang.goods_type_name}</th>
    <th>{$lang.attribute_number}</th>
    <th>{$lang.goods_type_status}</th>
    <th>{$lang.handler}</th>
  </tr>
  {foreach from=$goods_type_arr item=goods_type}
  <tr>
    <td class="first-cell"><span onclick="javascript:listTable.edit(this, 'edit_type_name', {$goods_type.cat_id})">{$goods_type.cat_name}</span></td>
    <td align="right">{$goods_type.attr_count}</td>
    <td align="center"><img src="images/{if $goods_type.enabled}yes{else}no{/if}.gif" onclick="listTable.toggle(this, 'toggle_enabled', {$goods_type.cat_id})"></a></td>
    <td align="center">
      <a href="attribute.php?act=list&goods_type={$goods_type.cat_id}" title="{$lang.attribute}">{$lang.attribute}</a> |
      <a href="javascript:;" onclick="listTable.remove({$goods_type.cat_id}, '{$lang.remove_confirm}')" title="{$lang.remove}">{$lang.remove}</a>
    </td>
  </tr>
  {/foreach}
</table>

{if $full_page}
</div>
<!-- end goods type list -->

{literal}
<script type="text/javascript" language="JavaScript">
<!--

onload = function()
{
    // 开始检查订单
    startCheckOrder();
}

function newGoodsType()
{
  var name = document.forms['theForm'].elements['name'].value;

  if (Utils.trim(name).length > 0)
  {
    Ajax.call('goods_type.php?is_ajax=1&act=add', 'type_name=' + name, newGoodsTypeResponse, "POST", "JSON");
  }
}

function newGoodsTypeResponse(result)
{
  if (result.error == 0)
  {
    document.getElementById('listDiv').innerHTML = result.content;
    document.forms['theForm'].elements['name'].value = '';
    document.forms['theForm'].elements['name'].focus();
  }

  if (result.message.length > 0)
  {
    alert(result.message);
  }
}
//-->
</script>
{/literal}

{include file="pagefooter.htm"}
{/if}