#*
 * Aipo is a groupware program developed by Aimluck,Inc.
 * Copyright (C) 2004-2008 Aimluck,Inc.
 * http://aipostyle.com/
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU 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 General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *#
## ---------------------------------------------------------------------------
#set ($tabs = [["タイムカード一覧", "",""]])
## ---------------------------------------------------------------------------
#ALajaxtabheader($tabs "")
#ALspacebothheader()
#ALtableheaderSimpleWide()
#ALtdcaption('表示切替')
#ALtditemheader()
<div>
<select name="target_group_name" onchange="aipo.viewPage(this.options[this.selectedIndex].value, '$!portlet.ID')">
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","TimecardListScreen").addQueryData("target_group_name","all").addQueryData("target_user_id","none"))">（グループ全体）</option>
#foreach( $record in $!result.MyGroupList )
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","TimecardListScreen").addQueryData("target_group_name",$!{record.Name.toString()}).addQueryData("target_user_id","none"))" #if($!result.TargetGroupName == $!record.Name.toString()) selected="selected" #end>$!record.AliasName</option>
#end
#if(($result.MyGroupList.size() > 0) && ($result.PostMap.size() > 0))
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","TimecardListScreen").addQueryData("target_group_name","all").addQueryData("target_user_id", "none"))" #if ($!result.CurrentFilter == $!record.Name.toString()) selected="selected" #end>----------</option>
#end
#foreach( $record in $!result.PostMap )
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","TimecardListScreen").addQueryData("target_group_name",$!{record.GroupName.toString()}).addQueryData("target_user_id", "none"))" #if($!result.TargetGroupName == $!record.GroupName.toString()) selected="selected" #end>$!record.PostName</option>
#end
</select>
<select name="target_user_id" onchange="aipo.viewPage(this.options[this.selectedIndex].value, '$!portlet.ID')">
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","TimecardListScreen").addQueryData("target_group_name",$!{result.TargetGroupName}).addQueryData("target_user_id","none"))">（ユーザー選択）</option>
#foreach($record in $!result.Users)
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","TimecardListScreen").addQueryData("target_group_name",$!{result.TargetGroupName}).addQueryData("target_user_id",$!{record.UserId.toString()}))" #if($!result.TargetUserId != "all") #if($!result.TargetUserId == $!record.UserId.toString()) selected="selected" #end #end>$!record.AliasName</option>
#end
</select>
</div>
<div>
<select name="view_date_year" size="1" onchange="aipo.viewPage(this.options[this.selectedIndex].value, '$!portlet.ID')">
#set($end_year = 2010)
#foreach ( $num in [2006..$!{end_year}] )
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","TimecardListScreen").addQueryData("view_date_year","$num").addQueryData("view_date_month","$!result.ViewDate.Month"))" #if ($!result.ViewDate.Year == "$num") selected="selected" #end>$num年</option>
#end
</select>
<select name="view_date_month" size="1" onchange="aipo.viewPage(this.options[this.selectedIndex].value, '$!portlet.ID')">
#foreach ( $num in [1..12] )
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","TimecardListScreen").addQueryData("view_date_year","$!result.ViewDate.Year").addQueryData("view_date_month","$num"))" #if ($!result.ViewDate.Month == "$num") selected="selected" #end>$num月</option>
#end
</select>
</div>
#ALtditemfooter()
#ALtablefooter()

#if($result.DateListKeys.size() == 0)
<div class="message">指定された条件に該当するタイムカードはありません。</div>
#else
#if($!result.hasAclXlsExport())
<div>
<form name="Timecard" action="$jslink.getTemplate('TimecardXlsExportScreen')" method="post">
#ALtableheaderSimpleWide()
#ALtdcaption('エクスポート')
#ALtditemheader() 現在表示している一覧を
#ALsubmit('eventSubmit_doTimecard_download' 'ダウンロードする')
#ALtditemfooter()
#ALtablefooter()
<input type="hidden" name="target_user_id" value="$!result.TargetUserId"/>
<input type="hidden" name="view_date_year" value="$!result.ViewDate.Year"/>
<input type="hidden" name="view_date_month" value="$!result.ViewDate.Month"/>
</form>
</div>
#end
#if($!result.TargetUserId == $!result.UserId) #set($col_count = 6) #else #set($col_count = 5) #end
#ALtableheaderWide()
<tr>
#ALtdheadThin("日付")
#ALtdheadThin("合計")
#ALtdheadThin("状態")
#ALtdheadThin("勤怠時間")
#ALtdheadWide("修正理由")
#if($!result.TargetUserId == $!result.UserId)
#ALtdheadThin(' ')
#end
</tr>
#foreach ($key in $result.DateListKeys)
#set($tclistrd = $result.getDateListValue($key))
#set($viewlist = $tclistrd.ViewList)
#set($listsize = $viewlist.size())
<tr>
#ALtdcellAtt($tclistrd.DateStr "nowrap='nowrap' rowspan='$listsize'")
#ALtdcellAtt("${tclistrd.SummayTimes}h" "nowrap='nowrap' align='right' rowspan='$listsize'")
#foreach ($record in $viewlist)
#if($velocityCount > 1)
<tr>
#end
#ALtdcellAtt("#if($!record.WorkFlag.toString() == '0')退勤 #else出勤 #end" 'align="center" nowrap="nowrap"')
#ALtdcellAtt($!record.WorkDateStr 'align="right" nowrap="nowrap"')
#ALtdcell($!record.Reason)
#if($!result.TargetUserId == $!result.UserId)
#ALtdcellAtt("#ALajaxbuttonLinkCallback('編集' $!jslink.getPortletById($!portlet.ID).addQueryData('template','TimecardFormScreen').addQueryData('eventSubmit_doTimecard_form','1').addQueryData('entityid', $!record.TimecardId) 'images/icon/icon_edit.gif' $!portlet.ID 'aipo.timecard.onLoadTimecardDialog')" 'nowrap="nowrap"')
#end
</tr>
#end
#end
#ALtablefooter()
#end
#ALspacebothfooter()
#ALajaxtabfooter()
