<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="jp.co.argo21.nautica.workflow.sample.model.OvertimeApp"%>
<%@ page
	import="jp.co.argo21.nautica.workflow.soap.message.Organization"%>
<%@ page import="jp.co.argo21.nautica.workflow.sample.util.StringUtil"%>
<%@ page import="java.text.DateFormat"%>
<%@ page import="java.sql.Timestamp"%>
<%@ page import="java.util.Formatter"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="css/base.css" type="text/css">
<%
	String aim = (String) session.getAttribute("aim");
	String title = null;
	if (aim.equals("APPROVE")) {
		title = "承認待ち";
	} else if (aim.equals("CONFIRM")) {
		title = "同報確認";
	}
	
	OvertimeApp overtime = (OvertimeApp) request
			.getAttribute("overtime");
	Organization org = (Organization) request.getAttribute("org");
	String name = StringUtil.toFullName(overtime.getUser());
	DateFormat df = DateFormat.getDateInstance(DateFormat.FULL);
	Formatter formatter = new Formatter();
	String workTime = formatter.format("%02d : %02d 〜 %02d : %02d",
			overtime.getStartHour(), overtime.getStartMin(),
			overtime.getEndHour(), overtime.getEndMin()).toString();
	String compdayPlan = null;
	if (overtime.isComp()) {
		compdayPlan = "代休取得予定あり";
	} else {
		compdayPlan = "代休取得取得予定なし";
	}
%>
<title><%=title%></title>
</head>
<body>
<%@ include file="include/header.jsp"%>
<table align="center" width="819" border="0">
	<tr>
		<td width="200" height="17"><img src="left-bar.jpg" width="200"
			height="20"></td>
		<td width="405">
		<div align="center"><span class="style5"><%=title%></span></div>
		</td>
		<td width="200"><img src="right-bar.jpg" width="200" height="20"></td>
	</tr>
</table>

<form method="post"
	action="Check"><input
	type="hidden" name="appID" value="<%= overtime.getId()%>" />
<div align="center">
<p><span class="style28"><%=overtime.getKind().getAppkindName()%></span></p>
<table width="800" border="1" cellpadding="5" bordercolor="#00CC33">
	<tr class="style24">
		<th height="20" colspan="2" bgcolor="#00FFCC" class="style24"
			scope="row">申請書番号</th>
		<td width="574" height="20" bgcolor="#EEFFEE">
		<div align="left"><%=overtime.getId()%></div>
		</td>
	</tr>
	<tr class="style24">
		<th height="20" colspan="2" bgcolor="#00FFCC" scope="row">申請日付</th>
		<td height="20" bgcolor="#EEFFEE">
		<div align="left"><span class="style24"><%=df.format(overtime.getDate())%></span></div>
		</td>
	</tr>
	<tr class="style24">
		<th height="20" colspan="2" bgcolor="#00FFCC" scope="row">
		<div align="center" class="style24">申請者</div>
		</th>
		<td height="20" align="left" bgcolor="#EEFFEE" class="style24">
		<div align="left" class="style38">
		<table width="417" border="0">
			<tr>
				<td width="150" class="style24"><%=org.getName()%></td>
				<td width="153" class="style24"><%=name%></td>
				<td width="100" class="style24"><%=overtime.getUser().getId()%></td>
			</tr>
		</table>
		</div>
		</td>
	</tr>
	<tr class="style24">
		<th width="60" height="25" rowspan="3" bgcolor="#00FFCC" scope="row">
		<div align="center">対象日</div>
		</th>
		<th width="120" height="20" align="center" bgcolor="#00FFCC"
			scope="row">
		<div align="center" class="style24">勤務日</div>
		</th>
		<td height="20" bgcolor="#EEFFEE">
		<div align="left" class="style24"><span class="style39">
		<%=df.format(overtime.getWorkday())%></span></div>
		</td>
	</tr>
	<tr>
		<th height="20" align="center" bgcolor="#00FFCC" scope="row"><span
			class="style24">予定時刻</span></th>
		<td height="20" bgcolor="#EEFFEE">
		<div align="left" class="style24"><span class="style39">
		<%=workTime%> </span></div>
		</td>
	</tr>
	<tr>
		<th height="20" align="center" bgcolor="#00FFCC" scope="row"><span
			class="style24">予定時間</span></th>
		<td height="20" bgcolor="#EEFFEE">
		<div align="left" class="style24"><span class="style39">
		<%=overtime.getOvertimeHours()%> 時間</span></div>
		</td>
	</tr>
	<tr class="style24">
		<th height="40" colspan="2" bgcolor="#00FFCC" class="style24"
			scope="row">事由</th>
		<td height="40" align="left" valign="top" bgcolor="#EEFFEE"><%=overtime.getReason()%>
		</td>
	</tr>
	<tr class="style24">
		<th height="20" colspan="2" bgcolor="#00FFCC" scope="row">代休取得予定</th>
		<td height="20" align="left" bgcolor="#EEFFEE">
		<div align="left" class="style38">
		<table width="495" border="0" cellpadding="2">
			<tr>
				<td width="150" height="18" class="style24"><%=compdayPlan%></td>
<%
					if (overtime.isComp()) {
%>
				<td width="331" height="18">
				<div align="left" class="style24"><%=df.format(overtime.getCompDay())%></div>
				</td>
<%
					}
%>
			</tr>
		</table>
		</div>
		</td>
	</tr>
	<tr class="style24">
		<th height="40" colspan="2" bgcolor="#00FFCC" scope="row">備考</th>
		<td height="40" align="left" valign="top" bgcolor="#EEFFEE"
			class="style24"><%=overtime.getRemark()%></td>
	</tr>
</table>
<%
	if (aim.equals("APPROVE")) {
%>
<p><span class="style45">申請内容を確認して、よろしければ承認して下さい。<br>
コメントは差し戻す時にのみ使用します。<br>
このサンプルアプリケーションは、完了したフローを表示させる履歴機能を提供していません。<br>
否認すると申請フローが完了するため、以後、当該申請は表示されません。</span></p>
<table width="800" border="1" cellpadding="5" bordercolor="#00CC33">
	<tr class="style24">
		<th width="196" height="40" bgcolor="#00FFCC" scope="row">コメント</th>
		<td width="572" height="40" align="left" valign="top"
			bgcolor="#EEFFEE" class="style24"><span class="style46">
		<textarea name="comment" cols="80" rows="2" wrap="VIRTUAL"></textarea>
		</span></td>
	</tr>
</table>
<br>
</div>
<table width="254" border="0" align="center">
	<tr>
		<td width="80" align="center"><input type="submit"
			name="pressedButton" value="否認"></td>
		<td width="80">
		<div align="center"><input type="submit" name="pressedButton"
			value="差し戻し"></div>
		</td>
		<td width="80" align="center"><input type="submit"
			name="pressedButton" value="承認"></td>
	</tr>
</table>
<%
	} else if (aim.equals("CONFIRM")) {
%>
<p><span class="style45">申請内容を確認して、確認ボタンを押してください。</span></p>
<table width="86" border="0" align="center">
	<tr>
		<td width="80" align="center"><input type="submit"
			name="pressedButton" value="確認"></td>

	</tr>
</table>
<%
	}
%>
</form>
<%@ include file="include/footer.jsp"%>
</body>
</html>