{include file="admin/header.html"}
{include file="admin/gnavi.html"}

<script><!--
  var cal2 = new JKL.Calendar("calendar1","form1","salestartdate");
//--></script>

<script><!--
  var cal3 = new JKL.Calendar("calendar2","form1","orderclosedate");
//--></script>

<div id="container">

{include file="admin/menu/submenu_item.html"}

<!-- ↓段組み　メイン側 -->
<div id="main">

<h3>{$action.title}</h3>

<form action="{$scriptName}" id="form1" method="POST" name="fm1">
  <input type="hidden" id="ac" name="action" value="">
  <input type="hidden" id="cd" name="cd" value="">
  <input type="hidden" id="structcd" name="structcd" value="">
  <input type="hidden" name="itemnm" value="{$action.itemnm}">
  <input type="hidden" name="actionnm" value="{$action.actionnm}">
  <input type="hidden" name="from" value="{$action.from}">
  <input type="hidden" id="janc" name="jancode" value="{$action.jancode}">
  <input type="hidden" id="hb" name="hinban" value="{$action.hinban}">
  <input type="hidden" id="t" name="itemtitle" value="{$action.itemtitle}">
  <input type="hidden" id="rds" name="release_date_start" value="{$action.release_date_start}">
  <input type="hidden" id="rde" name="release_date_end" value="{$action.release_date_end}">
  <input type="hidden" id="pds" name="publish_date_start" value="{$action.publish_date_start}">
  <input type="hidden" id="pde" name="publish_date_end" value="{$action.publish_date_end}">
  <input type="hidden" id="mc" name="maker_capital" value="{$action.maker_capital}">
  <input type="hidden" id="mn" name="maker_name" value="{$action.maker_name}">
  <input type="hidden" id="mda" name="media" value="{$action.media}">
  <input type="hidden" id="cst" name="cast" value="{$action.cast}">
  <input type="hidden" id="stut" name="situation" value="{$action.situation}">
  <input type="hidden" id="phs" name="photo_situation" value="{$action.photo_situation}">
  <input type="hidden" id="pus" name="publish_situation" value="{$action.publish_situation}">
  <input type="hidden" id="srt" name="sort" value="{$action.sort}">
{foreach name=list from=$action.genre_select item=genre}
  <input type="hidden" id="gnr" name="genre_select[]" value="{$genre}">
{/foreach}

  <!-- ↓項目（上） --> 
    <table border="0" cellspacing="0" cellpadding="0" class="hyou">
      <tr>
        <th align="left">品目コード</th>
        <td align="left">{$action.cd}</td>
        <td align="right" colspan="2">
          <input type="button" onClick="document.getElementById('ac').value='admin_itemmanage_reference'; document.getElementById('cd').value='{$action.cd}'; document.fm1.submit();" value="詳細画面へ"></td>
      </tr>
      <tr>
        <th align="left">タイトル</th>
        <td align="left" colspan="3">
          {$action.itemnm}</td>
      </tr>
    </table>

  <!-- ↑項目（上） --> 
  
  <!-- ↓項目（下） --> 

    {errorList->getMessages assign=errmsg}
{if $errmsg}
    <br>
    <!--↓エラーメッセージ -->
    <div class="error">
      <ul class="alert">
{foreach from=$errmsg item=msg}
        <li>{$msg|escape}</li>
{/foreach}
      </ul>
    </div>
    <!--↑エラーメッセージ -->
{/if}
    
    <input type="hidden" name="item_struct_updcnt" value="{$action.item_struct_updcnt}">
    
    <table border="0" cellspacing="0" cellpadding="0" class="hyou">
      <tr>
        <th align="left">販売方法</th>
        <td align="left" colspan="3">
{if $action.actionnm == "insert"}
          <label name="dl0"><input type="radio" name="download" value="0"{if empty($action.download)} checked{/if}>一般販売</label>&nbsp;
          <label name="dl1"><input type="radio" name="download" value="1"{if !empty($action.download)} checked{/if}>ダウンロード販売</label>
{elseif $action.actionnm == "update"}
          販売方法の変更はできません。
{/if}
        </td>
      </tr>

{if $action.actionnm == "update"}
      <tr id="dl">
        <th align="left">ダウンロード期間</th>
        <td align="left">
          <input type="hidden" name="download" value="{$action.download}">
          <input type="text" name="dlperioddays" size="6" value="{$action.dlperioddays}"> 日<br/>
          購入日からの日数を設定してください。<br />
          （当日のみの場合は「0」を入力）
        </td>
        <th align="left">販売価格</th>
        <td align="left">
          <input type="hidden" name="stockcd" value="{$action.stockcd}">
          <input type="text" name="sellingprice" size="6" value="{$action.sellingprice}"> 円<br/>
          1円以上の価格を設定してください。<br />
          <span style="font-size: 10px;">※0円を設定すると「無料ダウンロード」商品として<br />販売されます。</span>
        </td>
      </tr>
      <script>
      <!--
{if empty($action.download)}
          Element.hide($('dl'));
{else}
          Element.show($('dl'));
{/if}
      -->
      </script>
{/if}
      <tr>
        <th align="left">バリエーション名</th>
        <td align="left" colspan="3">
          <input type="text" name="variationnm" value="{$action.variationnm}" size="60">
        </td>
      </tr>
      <tr>
        <th align="left">品番</th>
        <td align="left">
          <input type="text" name="makeritemcd" value="{$action.makeritemcd}"></td>
        <th align="left">JANコード</th>
        <td align="left">
          <input type="text" name="jancd" value="{$action.jancd}"></td>
      </tr>
      <tr>
{*
        <th align="left">メーカー定価</th>
        <td align="left">
          <input type="text" name="makerprice" value="{$action.makerprice}" size="10">&nbsp;円</td>
*}
        <th align="left">発売日</th>
        <td align="left">
          <input type="text" name="salestartdate" value="{$action.salestartdate}">
          <img id="calendar-button" src="./images/calendar.png" width="16" height="16" align="middle" onClick="cal2.write();">
          <div id="calendar1"></div></td>
        <th align="left">発注締切日</th>
        <td align="left">
          <input type="text" name="orderclosedate" value="{$action.orderclosedate}">
          <img id="calendar-button" src="./images/calendar.png" width="16" height="16" align="middle" onClick="cal3.write();">
          <div id="calendar2"></div></td>
      </tr>

<!-- オプション情報 -->
{action->getOption assign=option}
{foreach from=$option item="option" key="key" name="opt"}
      <tr>
        <th align="left">{$option.name}</th>
        <td align="left"  colspan="3">
{assign var="div" value=$smarty.foreach.opt.iteration|string_format:"%02s"}
{assign var="nm" value="option$div"}
{if is_array($option.attributes)}
          <select name="{$nm}">
            <option value="">未選択</option>
            {html_options options=$option.attributes selected=$action.$nm}
          </select>
{else}
          <input type="text" name="{$nm}" value="{$action.$nm}" size="65">
{/if}
        </td>
      </tr>
{/foreach}

      <tr>
        <th align="left">コメント</th>
        <td align="left" colspan="5">
          <textarea name="struct_comment" rows="7" cols="40">{$action.struct_comment|escape}</textarea></td>
      </tr>
      <tr>
        <td align="right" colspan="6">
          <input type="submit" onClick="document.getElementById('ac').value='admin_itemmanage_change_struct_check';
                                        document.getElementById('cd').value='{$action.cd}';
                                        document.getElementById('structcd').value='{$action.structcd}';" value="変更確認"></td>
      </tr>
    </table>
  <!-- ↑項目（下） --> 
</form>

<div class="pagetop" title="ページトップへ"><a href="#top">ページトップへ</a></div>

</div>
<!--End of main-->

<div class="cr"></div>
</div>
<!--End of container-->

{literal}
<script language="javascript">
<!--
  var jsonString = '{/literal}{action->getStructurejson_serial_noencode}{literal}';
  if(jsonString){
    structureArray = jsonString.parseJSON();
    initList();
  }
//-->
</script>
{/literal} 

{include file="admin/footer.html"}
