#*
 * Aipo is a groupware program developed by Aimluck,Inc.
 * Copyright (C) 2004-2011 Aimluck,Inc.
 * http://www.aipo.com
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *#

## ---------------------------------------------------------------------------
#set ($indicator_id = "indicator-dlg-")
## ---------------------------------------------------------------------------
#ALdialogheader("ワークフロー詳細")
#ALajaxIndicator("$indicator_id" "$!portlet.ID" "")
#ALerrmsg($errmsgs)
<div id="messageDiv"></div>
<form name="workflowForm$!portlet.ID" id="workflowForm$!portlet.ID" action="$!jslink.getPortletById($!portlet.ID).addQueryData('template','WorkflowFormJSONScreen').addQueryData('entityid',$!{result.Detail.RequestId})" method="post" onsubmit="aimluck.io.submit(this,'$indicator_id','$!portlet.ID',aipo.workflow.onReceiveMessage);return false;">
<input type="hidden" name="mode" value="none" />
<input type="hidden" name="secid" value="$secid" />
<div class"p">
#ALtableheaderWide()
#ALtdcaption('決裁状況')
#ALtditemheader()
#if($!result.Detail.Progress.Value == "D")
<span class="caution">差戻要確認</span>&nbsp;&nbsp;
#set ( $editUrl = $!utils.escapeXML("$!jslink.getPortletById($!portlet.ID).addQueryData('template','WorkflowFormScreen').addQueryData('entityid',$!{result.Detail.RequestId})") )
<input name="ajaxbuttonEdit" class="button" type="button" value="再申請する" onclick="aipo.common.showDialog('$!editUrl', '$!portlet.ID' , aipo.workflow.onLoadWorkflowDialog )" />
#else
<span class="caution">#if($!result.Detail.Progress.Value == "A") 承認済み #else 決裁待ち #end</span>
#end
#if($!result.Detail.UserId.Value == $!result.LoginUser.UserId.Value)
&nbsp;&nbsp;#ALsubmitJS('eventSubmit_doWorkflow_delete' '削除する' "aipo.workflow.onDelete('$!portlet.ID');")
#end
#ALtditemfooter()
#ALtdcaption('表題')
#ALtditemheader()
$!result.Detail.CategoryName #if($!result.Detail.RequestName != '') <br/> $!result.Detail.RequestName #end
#ALtditemfooter()
#ALtdcaption('申請日')
#ALtditem($!result.Detail.CreateDate)
#ALtdcaption('重要度')
#ALtditem($!result.Detail.PriorityString)
#if($!result.Detail.HasRootName)
#ALtdcaption('申請経路')
#ALtditemheader()
$!result.Detail.RouteName
#ALtditemfooter()
#end
#ALtdcaption('申請内容')
#ALtditem($!result.Detail.Note)
#ALtdcaption('金額')
#ALtditem("$!{result.Detail.PriceStr}&nbsp;円")
#if($!result.Detail.OldRequestLinks.size() > 0)
#ALtdcaption('過去の申請内容')
#ALtditemheader()
#set ($count = 1)
#foreach ($record in $!result.Detail.OldRequestLinks)
<div><a href="javascript:void(0);" onclick="aipo.common.showDialog('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","WorkflowDetailScreen").addQueryData('mode','detail').addQueryData('entityid',$record.RequestId).addQueryData('prvid',$!{result.PreviousID}))');">${count}回目 $record.CategoryName #if($record.RequestName.toString() != '') &nbsp;&nbsp; $record.RequestName #end $record.UpdateDate</a></div>
#set ($count = $count + 1)
#end
#ALtditemfooter()
#end
#if($!result.Detail.AttachmentFileList && $!result.Detail.AttachmentFileList.size() > 0)
#ALtdcaption('添付ファイル')
#ALtditemheader()
#foreach( $attachmentFile in $!result.Detail.AttachmentFileList )
<img src="images/workflow/workflow_item.gif">&nbsp;<a href="$jslink.getTemplate("WorkflowFileRawScreen").addQueryData("attachmentIndex", $attachmentFile.FileId).addQueryData("ownerid", $!{result.Detail.UserId}).addQueryData("entityid", $!result.Detail.RequestId)">$attachmentFile.FileName</a><br>
#end
#ALtditemfooter()
#end
#ALtablefooter()
</div>
#ALtableheaderWide()
<tr>
#ALtdheadAtt("決裁履歴" "colspan='4' align='center'")
</tr>
<tr>
#ALtdheadThin("決裁")
#ALtdheadAtt("ユーザー名" "style='width:20%'")
#ALtdheadThin("日時")
#ALtdhead("コメント")
</tr>
#set ($confirm_view_flg = true)
#foreach ($record in $result.Detail.DecisionRecords)
<tr>
#ALtdcellheaderAtt("nowrap='nowrap'")
#if($!record.Status.Value == "C")
#if($confirm_view_flg)
<span class="caution">$!{record.StatusString}</span>
#end
#elseif($!record.Status.Value == "R" || $!record.Status.Value == "A" || $!record.Status.Value == "D" || $!record.Status.Value == "T")
$!{record.StatusString}
#end
#ALtdcellfooter()
#ALtdcell("$!record.UserAliasName")
#ALtdcellheaderAtt("nowrap='nowrap'")
#if($!record.Status.Value == "R" || $!record.Status.Value == "A" || $!record.Status.Value == "D" || $!record.Status.Value == "T") $!{record.UpdateDate} #end
#ALtdcellfooter()
#ALtdcellheader()
#if($confirm_view_flg && $!record.Status.Value == "C" && $!record.UserId.Value == $!result.LoginUser.UserId.Value)
#ALtextarea('comment' $!record.NoteR 10 40)
<div class="alignleft">
<div class="alignleft">#ALsubmitJS('eventSubmit_doWorkflow_accept' '承認する' "aipo.workflow.onAccept('$!portlet.ID');")／</div>
#if(!($!result.Detail.CanRemandApplicant) && $!result.Detail.RemandingRecords.size() == 0)
#ALsubmitJS('eventSubmit_doWorkflow_delete' '削除する' "aipo.workflow.onDelete('$!portlet.ID');")
#else
<div class="alignleft">
<span id="order_field">
#ALselectpdheader("passback_order" "90%" "" )
#if($!result.Detail.CanRemandApplicant)
<option value='0'>申請者</option>
#end
#foreach ($record in $result.Detail.RemandingRecords)
#if($!record.Status.Value == "A")
<option value='$!record.Order'>$!record.UserAliasName</option>
#end
#end
#ALselectfooter()
</span>に#ALsubmitJS('eventSubmit_doWorkflow_denial'  '差し戻す' "aipo.workflow.onDenial('$!portlet.ID');")</div>
</div>
#end
#else
$!record.Note
#end
#ALtdcellfooter()
</tr>
#if($!record.Status.Value == "C")
#set ($confirm_view_flg = false)
#end
#end
#ALtablefooter()
#ALbuttonheader()
#if($!result.Detail.Progress.Value == "R")
#set ( $editUrl = $!utils.escapeXML("$!jslink.getPortletById($!portlet.ID).addQueryData('template','WorkflowDetailScreen').addQueryData('mode', 'detail').addQueryData('entityid', $!{result.PreviousID}).addQueryData('prvid',$!{result.PreviousID})") )
<input name="ajaxbuttonBack" class="button" type="button" value="戻る" onclick="aipo.common.showDialog('$!editUrl', '$!portlet.ID' )" />
#end
#ALajaxbuttonClose()
#ALbuttonfooter()
#ALformfooter()
#ALdialogfooter()
