<?php include_once( "../../../../spider.inc.php" ); ?>
{charset:UTF-8}
{template:admin_default.tpl}
{module:shopping.category.LoadList}
{module:shopping.order.Load}
{module:shopping.order.file.Download}
{preset:page_title 'ショップ管理 > ' . SHOPPING_LABEL_ORDER . '一覧 > ' . SHOPPING_LABEL_ORDER . '情報詳細'}

	{set:memberObject shopping.order.orderObject->'memberObject'}
	<div class="panc">
		<a href="../../../">管理パネルトップ</a>
		&gt; <a href="../../">ショップ管理</a>
		&gt; <a href="../">{write:SHOPPING_LABEL_ORDER}一覧</a>
		{if:!is_null(shopping.order.orderObject) && strlen(shopping.order.orderObject->'order_id')>0}
		&gt; <a href="../detail.php?shpon={write:shopping.order.orderObject->'order_number'}">{write:shopping.order.orderObject->'order_id'}</a>
		{else}
		{/if}
		&gt; ファイル
	</div>

	<h1>ショップ管理 &gt; {write:SHOPPING_LABEL_ORDER}一覧 &gt; {write:shopping.order.orderObject->'order_id'}の{write:SHOPPING_LABEL_ORDER}情報 &gt; ファイル</h1>

{if:IS_ERROR}
	<ul class="error">
	{foreach:errors error}
		<li>{write:error}</li>
	{/foreach}
	</ul>
	<br />
{else}

	<table class="detail" style="width:96%;margin:0 auto;">
	<tbody>
	<tr>
		<th style="width:12em;">{write:SHOPPING_LABEL_ORDER}ID</th>
		<td>
			{write:shopping.order.orderObject->'order_id'}
		</td>
	</tr>
	<tr>
		<th style="width:12em;">{write:SHOPPING_LABEL_ORDER}日時</th>
		<td>
			{write:shopping.order.orderObject->'registered_date'}
		</td>
	</tr>
	</tbody>
	</table><br />

	{foreach:shopping.order.orderObject::shoppingOrderAddressObjectArray addressOrder shoppingOrderAddressObject}
	{foreach:shoppingOrderAddressObject::shoppingOrderItemObjectArray orderItemObject}
	{if:orderItemObject->'item_number'==get.shpoin}
	<h2 class="global">{write:SHOPPING_LABEL_ORDER}内容</h2>
	<div class="admin_cart">
	<table style="width:96%;margin:0 auto;border-collapse:collapse;">
	<thead>
	<tr>
		<th colspan="2">情報</th>
		<th>単価</th>
		<th>{write:SHOPPING_LABEL_ORDER}数</th>
		<th>金額</th>
	</tr>
	</thead>
	<tbody>
	{set:unitObject orderItemObject->'shoppingProductUnitObject'}
	{set:productObject unitObject->'shoppingProductObject'}
	<tr>
		<td {if:count(orderItemObject->'shoppingOrderOptionObjectArray')>0} rowspan="{write:count(orderItemObject->'shoppingOrderOptionObjectArray')+1}"{/if}style="width:120px;height:120px;text-align:center;vertical-align:middle;padding:3px;">
			{set:fileIdArray productObject::fileIdArray}
			{if:strlen(fileIdArray[0])>0}
				<img src="/file/download.php?fi={write:fileIdArray[0]}&amp;w=120&amp;h=120" />
			{else}
				画像なし
			{/if}
		</td>
		<td style="vertical-align:top;padding:3px;">
			{write:productObject->'product_name'} {write:unitObject->'unit_name'}
			{if:900==orderItemObject->'delivery_type'}
				チェックイン日：{write:date('Y年m月d日',strtotime(orderItemObject->'svc_start_date'))}({write:WEEK_DAY_NAME_ARRAY[date('w',strtotime(orderItemObject->'svc_start_date'))]})<br />
				チェックアウト日：{write:date('Y年m月d日',strtotime(orderItemObject->'svc_limit_date'))}({write:WEEK_DAY_NAME_ARRAY[date('w',strtotime(orderItemObject->'svc_limit_date'))]})<br />
			{else-if:200<=orderItemObject->'delivery_type'}
				<br />
				{write:date('Y年m月d日',strtotime(orderItemObject->'svc_start_date'))}({write:WEEK_DAY_NAME_ARRAY[date('w',strtotime(orderItemObject->'svc_start_date'))]})<br />
				{write:date('H:i',strtotime(orderItemObject->'svc_start_date'))}
				～ {write:date('H:i',strtotime(orderItemObject->'svc_limit_date'))}
			{else-if:20<=orderItemObject->'delivery_type'}
				{write:date('Y年m月d日',strtotime(orderItemObject->'svc_start_date'))}～{write:date('Y年m月d日',strtotime(orderItemObject->'svc_limit_date'))}
			{/if}
		</td>
		<td style="vertical-align:top;text-align:right;padding:3px;">
			&yen;{write:number_format(orderItemObject->'price_unit')}-
		</td>
		<td style="vertical-align:top;text-align:right;padding:3px;">
			{write:orderItemObject->'order_count'}
		</td>
		<td style="vertical-align:top;text-align:right;padding:3px;">
			&yen;{write:number_format(orderItemObject->getTotalUnitPrice(request))}-
		</td>
	</tr>
	{if:count(orderItemObject->'shoppingOrderOptionObjectArray')>0}
	{foreach:orderItemObject::shoppingOrderOptionObjectArray orderOptionObject}
	<tr>
		<td style="vertical-align:top;padding:3px;">
			{write:orderOptionObject->'option_name'}
			{write:orderOptionObject->'option_value'}
		</td>
		<td style="vertical-align:top;text-align:right;padding:3px;">
			&yen;{write:orderOptionObject->'option_price'}-
		</td>
		<td style="vertical-align:top;text-align:right;padding:3px;">
			{write:orderOptionObject->'order_count'}
		</td>
		<td style="vertical-align:top;text-align:right;padding:3px;">
			&yen;{write:number_format(orderOptionObject->getTotalPrice( request ))}-
		</td>
	</tr>
	{/foreach}
	{/if}
	</tbody>
	</table>
	</div>
	<br />
	<?php break;?>
	{/if}
	{/foreach}
	{/foreach}
	
	<h2 class="global">ファイル</h2>
	<table class="detail" style="width:95%;margin:0 auto;">
	<tbody>
	<?php for( $GLOBALS['number']=0; $GLOBALS['number']<3; $GLOBALS['number']++ ) { ?>
	{set:fileName orderItemObject->getUploadFilePath( request, number )}
	<tr>
		<th style="width:12em;">ファイル{write:number+1}</th>
		<td id="fileNameArea{write:number}">
			{if:fileName}
				<a href="./download.php?shpon={write:shopping.order.orderObject->'order_number'}&amp;shpoin={write:orderItemObject->'item_number'}&amp;shpoinn={write:number}">{write:basename(fileName)}</a>
			{else}
				登録なし
			{/if}
		</td>
		<td>
			<form name="uploadForm{write:sprintf('%02d',number)}"
			action="./upload.php?shpon={write:shopping.order.orderObject->'order_number'}&amp;shpoin={write:orderItemObject->'item_number'}"
			method="post" enctype="multipart/form-data"
			target="upfileResult_{write:sprintf('%02d',number)}">
			{if:fileName}
				<input type="checkbox" name="delete_fileIdArray[]" value="{write:fileIdArray[number]}"
					onclick="if(this.checked){document.getElementById('itemfiles_{write:number}').disabled='disabled';}else{document.getElementById('itemfiles_{write:number}').disabled='';}"
					/> 削除<br />
			{/if}
			<input type="file" id="itemfiles_{write:number}" name="order_item_file" size="40" value=""
			/><input type="button" value="アップロード" onclick="shoppingOrderFileUploadExecute(document.uploadForm{write:sprintf('%02d',number)})" />
			<input type="hidden" name="item_number" value="{write:orderItemObject->'item_number'}" />
			<input type="hidden" name="order_number" value="{write:number}" />
			</form>
			<iframe id="upload_frame" name="upfileResult_{write:sprintf('%02d',number)}" style="visibility:hidden;width:0px;height:0px;"></iframe>
			<img src="/<?php echo SYSTEM_DIR_NAME_ADMIN_PANEL; ?>/images/transparent.gif" />
			
		</td>
	</tr>
	<?php } ?>
	</tbody>
	</table>
	<br />

<script type="text/javascript"><!--
function shoppingOrderFileUploadExecute(formObject) {
	FormerCommon.displayGrayOut(9999);
	formObject.submit();
}
function shoppingOrderFileUploadError( errorMessage ) {
	alert(errorMessage);
	setTimeout(FormerCommon.displayWhiteIn, 100);
}
function shoppingOrderFileUploadOk( itemNumber, orderNumber, fileName ) {
	setTimeout(FormerCommon.displayWhiteIn, 100);
	var nameArea	= document.getElementById('fileNameArea'+orderNumber);
	if( nameArea ) {
		nameArea.innerHTML	= fileName;
	}
}
//--></script>	
{/if}
	<hr style="width:96%;margin:0 auto;margin-top:1em;" />

	<div style="width:96%;margin:0 auto;text-align:right;">
		{if:!is_null(shopping.order.orderObject) && strlen(shopping.order.orderObject->'order_id')>0}
		<a href="/<?php echo SYSTEM_DIR_NAME_ADMIN_PANEL; ?>/shopping/order/modify/purchaser.php?shpoi={write:shopping.order.orderObject->'order_id'}">&gt;&gt; {write:SHOPPING_LABEL_ORDER}情報の編集</a>
		&nbsp;&nbsp;
		{/if}
		<a href="./">&gt;&gt; {write:SHOPPING_LABEL_ORDER}一覧へ戻る</a>
	</div>