<!-- $Id: snatch_info.htm 13961 2008-01-07 06:54:44Z dolphin $ -->
{include file="pageheader.htm"}
{insert_scripts files="../js/utils.js,listtable.js,validator.js"}
<script type="text/javascript" src="../js/calendar.php?lang={$cfg_lang}"></script>
<link href="../js/calendar/calendar.css" rel="stylesheet" type="text/css" />
<div class="main-div">
<form method="post" action="snatch.php" name="theForm" onsubmit="return validate()">
<table cellspacing="1" cellpadding="3" width="100%">
  <tr>
    <td class="label">{$lang.snatch_name}</td>
    <td><input type="text" name="snatch_name" maxlength="60" size="40" value="{$snatch.snatch_name}" />{$lang.require_field}</td>
  </tr>
  <tr>
    <td align="right">{$lang.keywords}</td>
    <td><input type="text" name="keywords" size="30" />
    <input type="button" value="{$lang.button_search}" class="button" onclick="searchGoods()"></td>
  </tr>
  <tr>
    <td class="label"><a href="javascript:showNotice('noticegoodsid');" title="{$lang.form_notice}"><img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}"></a>{$lang.goodsid}</td>
    <td>
        <select name="goods_id">
        {$snatch.option}
        </select>
        {$lang.require_field}
     <br /><span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticegoodsid">{$lang.notice_goodsid}</span></td>
  </tr>
  <tr>
    <td class="label">{$lang.start_time}</td>
    <td>
      <input type="text" name="start_time" maxlength="60" size="40" value="{$snatch.start_time}" readonly="readonly" id="start_time_id" />
      <input name="selbtn1" type="button" id="selbtn1" onclick="return showCalendar('start_time_id', '%Y-%m-%d %H:%M', '24', false, 'selbtn1');" value="{$lang.btn_select}" class="button"/>
      {$lang.require_field}
    </td>
  </tr>
  <tr>
    <td class="label">{$lang.end_time}</td>
    <td>
      <input type="text" name="end_time" maxlength="60" size="40" value="{$snatch.end_time}"  readonly="readonly" id ="end_time_id" />
      <input name="selbtn1" type="button" id="selbtn1" onclick="return showCalendar('end_time_id', '%Y-%m-%d %H:%M', '24', false, 'selbtn1');" value="{$lang.btn_select}" class="button"/>
      {$lang.require_field}</td>
  </tr>
  <tr>
    <td class="label"><a href="javascript:showNotice('noticeminPrice');" title="{$lang.form_notice}"><img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}"></a>{$lang.min_price}</td>
    <td><input type="text" name="start_price" maxlength="60" size="20" value="{$snatch.start_price}" />{$lang.require_field}<br /><span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticeminPrice">{$lang.notice_min_price}</span></td>
  </tr>
   <tr>
    <td class="label"><a href="javascript:showNotice('noticemaxPrice');" title="{$lang.form_notice}"><img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}"></a>{$lang.max_price}</td>
    <td><input type="text" name="end_price" maxlength="60" size="20" value="{$snatch.end_price}" />{$lang.require_field}<br /><span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticemaxPrice">{$lang.notice_max_price}</span></td>
  </tr>
  <tr>
    <td class="label"><a href="javascript:showNotice('noticePrice');" title="{$lang.form_notice}"><img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}"></a>{$lang.price}</td>
    <td><input type="text" name="max_price" maxlength="60" size="20" value="{$snatch.max_price}" />{$lang.require_field}<br /><span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticePrice">{$lang.notice_price}</span></td>
  </tr>
  <tr>
    <td class="label"><a href="javascript:showNotice('noticeintegral');" title="{$lang.form_notice}"><img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}"></a>{$lang.integral}</td>
    <td><input type="text" name="cost_points" maxlength="60" size="20" value="{$snatch.cost_points}" />{$lang.require_field}<br /><span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticeintegral">{$lang.notice_integral}</span></td>
  </tr>
  <tr>
    <td class="label">{$lang.desc}</td>
    <td><textarea  name="desc" cols="60" rows="4"  >{$snatch.act_desc}</textarea></td>
  </tr>

  <tr>
    <td colspan="2" align="center">
      <input type="submit" value="{$lang.button_submit}" class="button" />
      <input type="reset" value="{$lang.button_reset}" class="button" />
      <input type="hidden" name="act" value="{$form_action}" />
      <input type="hidden" name="id" value="{$snatch.act_id}" />
    </td>
  </tr>
</table>
</form>
</div>
<script language="JavaScript">
<!--
{literal}
document.forms['theForm'].elements['snatch_name'].focus();
onload = function()
{
    // 开始检查订单
    startCheckOrder();
}

/**
 * 检查表单输入的数据
 */
function validate()
{
    validator = new Validator("theForm");
    validator.required("snatch_name",  no_name);
    validator.required("desc",         no_desc);
    validator.isNullOption("goods_id", no_goods_id);
    validator.isTime("start_time", invalid_starttime, true);
    validator.isTime("end_time", invalid_endtime, true);
    validator.gt("end_time", "start_time", invalid_gt);
    validator.gt("end_price", "start_price", invalid_price);
    validator.isNumber("start_price", invalid_min_price, true);
	validator.isNumber("max_price", invalid_max_price, true);
    validator.isInt("cost_points", invalid_integral, true);

    if (document.forms['theForm'].elements['act'] == "insert")
    {
        validator.required("password", no_password);
    }

    return validator.passed();
}

function searchGoods()
{
    var filter = new Object;
    filter.keyword = document.forms['theForm'].elements['keywords'].value;

    Ajax.call('snatch.php?is_ajax=1&act=search_goods', filter, searchGoodsResponse, 'GET', 'JSON')
}

function searchGoodsResponse(result)
{
  var frm = document.forms['theForm'];
  var sel = frm.elements['goods_id'];

  if (result.error == 0)
  {
    /* 清除 options */
    sel.length = 0;

    /* 创建 options */
    var goods = result.content;
    if (goods)
    {
        for (i = 0; i < goods.length; i++)
        {
            var opt = document.createElement("OPTION");
            opt.value = goods[i].goods_id;
            opt.text  = goods[i].goods_name;
            sel.options.add(opt);
        }
    }
    else
    {
        var opt = document.createElement("OPTION");
        opt.value = 0;
        opt.text  = search_is_null;
        sel.options.add(opt);
    }
  }

  if (result.message.length > 0)
  {
    alert(result.message);
  }
}
//-->
{/literal}
</script>
{include file="pagefooter.htm"}