<%--
MosP - Mind Open Source Project    http://www.mosp.jp/
Copyright (C) MIND Co., Ltd.       http://www.e-mind.co.jp/

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/>.
--%>
<%@ page
language = "java"
pageEncoding = "UTF-8"
buffer = "256kb"
autoFlush = "false"
errorPage = "/jsp/common/error.jsp"
%><%@ page
import = "jp.mosp.framework.base.MospParams"
import = "jp.mosp.framework.constant.MospConst"
import = "jp.mosp.framework.utils.HtmlUtility"
import = "jp.mosp.platform.constant.PlatformConst"
import = "jp.mosp.platform.human.action.HumanInfoAction"
import = "jp.mosp.platform.human.action.HumanHistoryCardAction"
import = "jp.mosp.platform.human.action.HumanHistoryListAction"
import = "jp.mosp.platform.human.constant.PlatformHumanConst"
import = "jp.mosp.platform.human.vo.HumanHistoryCardVo"
import = "jp.mosp.framework.xml.ViewProperty"
import = "jp.mosp.platform.human.constant.PlatformHumanConst"
import = "jp.mosp.framework.property.ConventionProperty"
import = "jp.mosp.framework.xml.InputProperty"
import = "jp.mosp.framework.xml.TableItemProperty"
import = "jp.mosp.framework.xml.ViewTableProperty"
import = "jp.mosp.framework.xml.ItemProperty"
import = "jp.mosp.framework.property.ViewConfigProperty"
%><%
// MosP処理情報取得
MospParams params = (MospParams)request.getAttribute(MospConst.ATT_MOSP_PARAMS);
// VO取得
HumanHistoryCardVo vo = (HumanHistoryCardVo)params.getVo();
// MosP処理情報から人事汎用管理区分及び表示区分を取得
String division = vo.getDivision();
if(division == null){
	division = (String)params.getGeneralParam(PlatformHumanConst.PRM_HUMAN_DIVISION);
	}
// 人事汎用管理区分設定取得
ViewConfigProperty viewConfig = params.getProperties().getViewConfigProperties().get(division);
String view = HumanHistoryCardAction.KEY_VIEW_HUMAN_HISTORY_CARD;
// 人事汎用表示区分設定取得
ViewProperty viewProperty = viewConfig.getView(view);
// 人事汎用表示テーブル配列取得
String[] viewTables = viewProperty.getViewTableKeys();
//画面名区分取得(履歴編集/履歴追加)
String imageName = (String)params.getGeneralParam(HumanHistoryCardAction.KEY_VIEW_HUMAN_HISTORY_CARD);
// 履歴追加画面区分をMosP処理情報に追加
params.addGeneralParam(HumanHistoryCardAction.KEY_VIEW_HUMAN_HISTORY_CARD, imageName);
%>
<jsp:include page="<%= PlatformHumanConst.PATH_HUMAN_COMMON_INFO_JSP %>" flush="false" />

<%
//表示テーブル毎に処理
for (String viewTable : viewTables) {
%>
<div class="List" id="divHistoryCard">
	<table class="ListTable" id="tblActivateDate">
		<tr>
			<td class="TitleTd"><span class="RequiredLabel">*&nbsp;</span><span>
<%
	//人事汎用表示テーブル設定取得
	String dateName = viewConfig.getViewTable(viewTable).getDateName();
	// 日付名設定
	params.addGeneralParam(PlatformHumanConst.PRM_HUMAN_DATE_NAME,dateName);
	// 日付名が設定されている場合
	if(dateName != null && dateName.isEmpty() == false){
%>
			<%= params.getName(dateName) %>
<%
	} else {
%>
			<%= params.getName("ActivateDate") %>
<%
	}
%>			
			</span></td>
			<td class="InputTd" id="inputActivateDate">
				<input type="text" class="Number4RequiredTextBox" id="txtActivateYear" name="txtActivateYear" value="<%= HtmlUtility.escapeHTML(vo.getTxtActivateYear()) %>" />&nbsp;<label for="txtActivateYear"><%= params.getName("Year") %></label>
				<input type="text" class="Number2RequiredTextBox" id="txtActivateMonth" name="txtActivateMonth" value="<%= HtmlUtility.escapeHTML(vo.getTxtActivateMonth())%>" />&nbsp;<label for="txtActivateMonth"><%= params.getName("Month") %></label>
				<input type="text" class="Number2RequiredTextBox" id="txtActivateDay" name="txtActivateDay" value="<%= HtmlUtility.escapeHTML(vo.getTxtActivateDay()) %>"/>&nbsp;<label for="txtActivateDay"><%= params.getName("Day") %></label>
				<button type="button" class="Name2Button" id="btnActivateDate" onclick="submitTransfer(event, null, addValidate('inputActivateDate',null,event), new Array('<%= PlatformConst.PRM_TRANSFERRED_COMMAND %>', '<%= imageName %>'),'<%= HumanHistoryCardAction.CMD_SET_ACTIVATION_DATE %>');"><%= vo.getModeActivateDate().equals(PlatformConst.MODE_ACTIVATE_DATE_FIXED) ? params.getName("Change") : params.getName("Decision") %></button>
			</td>
		</tr>
	</table>
<%
	// 人事汎用管理管理区分設定
	params.addGeneralParam(PlatformHumanConst.PRM_HUMAN_DIVISION,division);
	// 人事汎用管理画面設定
	params.addGeneralParam(PlatformHumanConst.PRM_HUMAN_VIEW, view);
	// 表示テーブル設定
	params.addGeneralParam(PlatformHumanConst.PRM_HUMAN_VIEW_TABLE, viewTable);
	// 有効日を決定しないと項目を表示しない
	if(vo.getModeActivateDate().equals(PlatformConst.MODE_ACTIVATE_DATE_FIXED)){
%>
	<jsp:include page="<%= PlatformHumanConst.PATH_HUMAN_VIEW_CONFIG_JSP %>" flush="false" />
<%
	}
}
%>	
</div>
<div class="Button">
<%
if (vo.getModeCardEdit().equals(PlatformConst.MODE_CARD_EDIT_INSERT)) {
%>
	<button type="button" id="btnRegist" class="Name4Button" onclick="submitRegist(event, 'divHistoryCard', null, '<%= HumanHistoryCardAction.CMD_ADD %>')"><%= params.getName("Insert") %></button>
<%
} else if (vo.getModeCardEdit().equals(PlatformConst.MODE_CARD_EDIT_EDIT)) {
%>
	<button type="button" id="btnRegist" class="Name4Button" onclick="submitRegist(event, 'divHistoryCard', null, '<%= HumanHistoryCardAction.CMD_UPDATE %>')"><%= params.getName("Update") %></button>
<%
}
%>
	<button type="button" id="btnHumenInfo" class="Name4Button"
		onclick="submitTransfer(event, null, null, new Array('<%=PlatformConst.PRM_TRANSFERRED_TYPE%>','<%= division %>','<%= PlatformConst.PRM_TRANSFERRED_ACTION %>', '<%=HumanInfoAction.class.getName() %>'), '<%= HumanHistoryCardAction.CMD_TRANSFER %>');">
		<%= params.getName("Information") %><%= params.getName("List") %>
	</button>
	<button type="button" id="btnBasicList" class="Name4Button"
		onclick="submitTransfer(event, null, null, new Array('<%=PlatformConst.PRM_TRANSFERRED_TYPE%>','<%= division %>','<%= PlatformConst.PRM_TRANSFERRED_ACTION %>', '<%=HumanHistoryListAction.class.getName() %>'), '<%= HumanHistoryCardAction.CMD_TRANSFER%>');">
		<%= params.getName("History") %><%= params.getName("List") %>
	</button>
</div>
