<%@ taglib uri="/tags/struts-bean-el" prefix="bean-el" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html-el" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/tags/fw" prefix="fw" %>
<%@ taglib uri="/tags/esr-core" prefix="esrcore" %>
<%@ page import='gov.va.med.esr.ui.report.action.ReportConstants' %>
<%@ page import='gov.va.med.esr.ui.report.action.ReportScheduleInfoForm' %>
<%@ page import='gov.va.med.esr.common.model.lookup.ReportScheduleType' %>

<c:set var="mmddyyyyText" scope="page"><bean-el:message key="label.mmddyyyy"/></c:set>

<c:set var="DAY_OF_WEEK"><%=ReportScheduleType.DAY_OF_WEEK.getName()%></c:set>
<c:set var="DAY_OF_MONTH"><%=ReportScheduleType.DAY_OF_MONTH.getName()%></c:set>
<c:set var="DAY_OF_QUARTER"><%=ReportScheduleType.DAY_OF_QUARTER.getName()%></c:set>
<c:set var="WEEK_DAY"><%=ReportScheduleType.WEEK_DAY.getName()%></c:set>
<c:set var="WEEK_DAY_MONTH"><%=ReportScheduleType.WEEK_DAY_MONTH.getName()%></c:set>
<c:set var="MONTH_DAY"><%=ReportScheduleType.MONTH_DAY.getName()%></c:set>

<tr>
    <td class="moduleLabel"><bean-el:message key="label.required.prefix" />&nbsp;<bean-el:message key="label.report.generateReport" />:</td>
    <td class="moduleValue" colspan="2">
    	<esrcore:setLookup var="ReportRunFrequencyList" className="gov.va.med.esr.common.model.lookup.ReportRunFrequency" />
  	<table border="0" cellpadding="0" cellspacing="0">
  	<tr>
    	    <c:forEach var="item" items="${ReportRunFrequencyList}">
    	    <c:set var="generateReportText"><bean-el:message key="label.required" />,&nbsp;<bean-el:message key="label.report.generateReport"/>&nbsp;(<c:out value="${item.description}" />)</c:set>
	    	<td><html-el:radio title="${generateReportText}" property="generateReport" styleId="generateReportId_${item.code}" value="${item.code}" onclick="selectDayToGenerateReport('${item.code}')" /></td><td class="moduleValue">
	    	<fw:label property="generateReport" forId="generateReportId_${item.code}" ><c:out value="${item.description}" /></fw:label></td><td class="moduleValue">&nbsp;&nbsp;</td>
    	    </c:forEach>
    	</tr>
  	</table>
    </td>
</tr>
<!--  ******************************************* Fields for Daily/Weekly  ******************************************* -->
<tr id="dayToGenerateReportParam1">
    <td class="moduleLabel"><bean-el:message key="label.required.prefix" />&nbsp;<bean-el:message key="label.report.dayToGenerateReport" />:</td>
    <td class="moduleValue" colspan="2">
    	<esrcore:setLookup var="DayOfWeekList" className="gov.va.med.esr.common.model.lookup.DayOfWeek" />
  	<table border="0" cellpadding="0" cellspacing="0">
  	<tr>
    	    <c:forEach var="item" items="${DayOfWeekList}" varStatus="status">
    	     <c:if test="${status.count == 5}"> 
    	     </tr><tr>
    	     </c:if>
    	    <c:set var="dayOfWeekToGenerateReportText"><bean-el:message key="label.required" />,&nbsp;<bean-el:message key="label.report.dayToGenerateReport"/>&nbsp;(<c:out value="${item.description}" />)</c:set>
	    	<td><html-el:multibox title="${dayOfWeekToGenerateReportText}" styleId="dailyWeeklyDayId_${item.code}" property="dailyWeeklyDay" value="${item.code}" /></td><td class="moduleValue">
	    	<fw:label property="dailyWeeklyDay" forId="dailyWeeklyDayId_${item.code}" ><c:out value="${item.description}" /></fw:label></td><td class="moduleValue">&nbsp;&nbsp;</td>
    	    </c:forEach>
    	</tr>
  	</table>
    </td>
</tr>

<!--  ******************************************* Fields for Monthly  ******************************************* -->
<tr id="dayToGenerateReportParam2">
    <td class="moduleLabel" style="vertical-align: top"><bean-el:message key="label.required.prefix" />&nbsp;<bean-el:message key="label.report.dayToGenerateReport" />:</td>
    <td class="moduleValue" colspan="2">
  	<table border="0" cellpadding="0" cellspacing="0">
  	<c:set var="specificDayOfMonthText"><bean-el:message key="label.required" />,&nbsp;<bean-el:message key="label.report.dayToGenerateReport"/>&nbsp;(<bean-el:message key="label.report.specificDayOfMonth"/>)</c:set>
  	    <tr><td><html-el:radio title="${specificDayOfMonthText}" styleId="scheduleSpecificDayOfMonth" property="scheduleType" value="${DAY_OF_MONTH}" /><fw:label property="scheduleType" forId="scheduleSpecificDayOfMonth"><span style="display:none">DayOfMonth</span></fw:label></td>
  	    <c:set var="dayOfMonthMonthText"><bean-el:message key="label.required" />,&nbsp;<bean-el:message key="label.report.dayToGenerateReport"/>&nbsp;(<bean-el:message key="label.report.dayOfMonth"/>)</c:set>
  	    <td class="moduleValue">
  	    	<fw:label property="monthlyDayOfEveryMonth" forId="dayOfMonth">The</fw:label>
  	    	<html-el:select title="${dayOfMonthMonthText}" styleClass="moduleEdit" styleId="dayOfMonth" property="monthlyDayOfEveryMonth">
			<esrcore:options styleClass="moduleEdit" collection="gov.va.med.esr.common.model.lookup.DayOfMonth" property="code" labelProperty="description"/>
		</html-el:select>
  	    	day of every month
  	    </td></tr>
  	    <c:set var="typeOfDayOfMonthText"><bean-el:message key="label.required" />,&nbsp;<bean-el:message key="label.report.dayToGenerateReport"/>&nbsp;(<bean-el:message key="label.report.typeOfDayOfMonth"/>)</c:set>
  	    <tr><td><html-el:radio title="${typeOfDayOfMonthText}" property="scheduleType" styleId="typeOfDayOfMonth" value="${WEEK_DAY}" /><fw:label property="scheduleType" forId="typeOfDayOfMonth"><span style="display:none">TypeOfDayOfMonth</span></fw:label></td>
  	    <td class="moduleValue">
  	    <c:set var="whichDayOfMonthText"><bean-el:message key="label.required" />,&nbsp;<bean-el:message key="label.report.dayToGenerateReport"/>&nbsp;(<bean-el:message key="label.report.whichDayOfMonth"/>)</c:set>
  	    	<fw:label property="monthlyWeekOfEveryMonth" forId="whichDayOfMonth">The</fw:label>
  	    	<html-el:select title="${whichDayOfMonthText}" styleClass="moduleEdit" styleId="whichDayOfMonth" property="monthlyWeekOfEveryMonth">  	    	 
			<esrcore:options styleClass="moduleEdit" collection="gov.va.med.esr.common.model.lookup.WeekOfMonth" property="code" labelProperty="description"/>
		</html-el:select>
		 <c:set var="actualDayOfMonthText"><bean-el:message key="label.required" />,&nbsp;<bean-el:message key="label.report.dayToGenerateReport"/>&nbsp;(<bean-el:message key="label.report.actualDayOfMonth"/>)</c:set>
		<html-el:select title="${actualDayOfMonthText}" styleClass="moduleEdit" styleId="actualDayOfMonth" property="monthlyDayOfEveryWeek">
			<esrcore:options styleClass="moduleEdit" collection="gov.va.med.esr.common.model.lookup.DayOfWeek" property="code" labelProperty="description"/>
		</html-el:select>
  	    	<fw:label property="monthlyDayOfEveryWeek" forId="actualDayOfMonth">day of every month</fw:label>
  	    </td></tr>
  	</table>
    </td>
</tr>

<!--  ******************************************* Fields for Quarterly  ******************************************* -->
<tr id="dayToGenerateReportParam3">
    <td class="moduleLabel"><fw:label required="true" property="quarterlyDayOfQuarter" forId="quarterlyDayOfQuarterId"><bean-el:message key="label.report.dayToGenerateReport" />:</fw:label></td>
    <td class="moduleValue" colspan="2">
  	<table border="0" cellpadding="0" cellspacing="0">
  	    <td class="moduleValue">
  	    <c:set var="whichTypeDayOfQuarterText"><bean-el:message key="label.required" />,&nbsp;<bean-el:message key="label.report.dayToGenerateReport"/>&nbsp;(<bean-el:message key="label.report.whichTypeDayOfQuarter"/>)</c:set>
  	    	The
  	    	<html-el:select title="${whichTypeDayOfQuarterText}" styleClass="moduleEdit" styleId="quarterlyDayOfQuarterId" property="quarterlyDayOfQuarter">
			<esrcore:options styleClass="moduleEdit" collection="gov.va.med.esr.common.model.lookup.DayOfQuarter" property="code" labelProperty="description"/>
		</html-el:select>
  	    	day of every quarter
  	    </td></tr>
  	</table>
    </td>
</tr>

<!--  ******************************************* Fields for Yearly  ******************************************* -->
<tr id="dayToGenerateReportParam4">
    <td class="moduleLabel" style="vertical-align: top"><bean-el:message key="label.required.prefix" />&nbsp;<bean-el:message key="label.report.dayToGenerateReport" />:</td>
    <td class="moduleValue" colspan="2">
  	<table border="0" cellpadding="0" cellspacing="0">
  	<c:set var="specificDayOfYearText"><bean-el:message key="label.required" />,&nbsp;<bean-el:message key="label.report.dayToGenerateReport"/>&nbsp;(<bean-el:message key="label.report.specificDayOfYear"/>)</c:set>
  	    <tr><td><html-el:radio title="${specificDayOfYearText}" property="scheduleType" styleId="specificDayOfYearId" value="${MONTH_DAY}" /><fw:label property="scheduleType" forId="specificDayOfYearId"><span style="display:none">specificDayOfYearId</span></fw:label></td>
  	    <td class="moduleValue">
  	    	<fw:label property="yearlyMonthOfYear" forId="whichMonthOfYearId">Every</fw:label>
  	    	<c:set var="whichMonthOfYearText"><bean-el:message key="label.required" />,&nbsp;<bean-el:message key="label.report.dayToGenerateReport"/>&nbsp;(<bean-el:message key="label.report.whichMonthOfYear"/>)</c:set>
  	    	<html-el:select title="${whichMonthOfYearText}" styleClass="moduleEdit" styleId="whichMonthOfYearId" property="yearlyMonthOfYear">
			<esrcore:options styleClass="moduleEdit" collection="gov.va.med.esr.common.model.lookup.Month" property="code" labelProperty="description"/>
		</html-el:select>
		<c:set var="whichDayOfSelectedMonthOfYearText"><bean-el:message key="label.required" />,&nbsp;<bean-el:message key="label.report.dayToGenerateReport"/>&nbsp;(<bean-el:message key="label.report.whichDayOfSelectedMonthOfYear"/>)</c:set>
		<fw:label property="yearlyMonthOfYear" forId="whichDayOfSelectedMonthOfYearId"><span style="display:none">whichDayOfSelectedMonthOfYear</span></fw:label>
		<html-el:text title="${whichDayOfSelectedMonthOfYearText}" property="yearlyDayOfMonth" styleId="whichDayOfSelectedMonthOfYearId" styleClass="moduleEdit" size="3" maxlength="2"/>
  	    </td></tr>
  	    <c:set var="typeOfDayOfMonthOfYearText"><bean-el:message key="label.required" />,&nbsp;<bean-el:message key="label.report.dayToGenerateReport"/>&nbsp;(<bean-el:message key="label.report.typeOfDayOfMonthOfYear"/>)</c:set>
  	    <tr><td><html-el:radio title="${typeOfDayOfMonthOfYearText}" property="scheduleType" styleId="typeOfDayOfMonthOfYear" value="${WEEK_DAY_MONTH}" /><fw:label property="scheduleType" forId="typeOfDayOfMonthOfYear"><span style="display:none">typeOfDayOfMonthOfYear</span></fw:label></td>
  	    <c:set var="whichWeekOfText"><bean-el:message key="label.required" />,&nbsp;<bean-el:message key="label.report.dayToGenerateReport"/>&nbsp;(<bean-el:message key="label.report.whichWeekOf"/>)</c:set>
  	    <td class="moduleValue">
  	    	<fw:label property="yearlyWeekOfMonth" forId="whichWeekOfText">The</fw:label>
  	    	<html-el:select title="${whichWeekOfText}" styleClass="moduleEdit" styleId="whichWeekOfText" property="yearlyWeekOfMonth">
			<esrcore:options styleClass="moduleEdit" collection="gov.va.med.esr.common.model.lookup.WeekOfMonth" property="code" labelProperty="description"/>
		</html-el:select>
		<c:set var="whichWeekDayOfText"><bean-el:message key="label.required" />,&nbsp;<bean-el:message key="label.report.dayToGenerateReport"/>&nbsp;(<bean-el:message key="label.report.whichWeekDayOf"/>)</c:set>
		<fw:label property="yearlyDayOfWeek" forId="whichWeekDayOfText"><span style="display:none">whichWeekDayOfText</span></fw:label>
		<html-el:select title="${whichWeekDayOfText}" styleClass="moduleEdit" styleId="whichWeekDayOfText" property="yearlyDayOfWeek">
			<esrcore:options styleClass="moduleEdit" collection="gov.va.med.esr.common.model.lookup.DayOfWeek" property="code" labelProperty="description"/>
		</html-el:select>
		<c:set var="whichMonthOfYearText"><bean-el:message key="label.required" />,&nbsp;<bean-el:message key="label.report.dayToGenerateReport"/>&nbsp;(<bean-el:message key="label.report.whichMonthOfYear"/>)</c:set>
		<fw:label property="yearlyMonth" forId="whichMonthOfYearTxt"><span style="display:none">yearlyWeekOfMonth</span></fw:label>
		<html-el:select title="${whichMonthOfYearText}" styleClass="moduleEdit" styleId="whichMonthOfYearTxt" property="yearlyMonth">
			<esrcore:options styleClass="moduleEdit" collection="gov.va.med.esr.common.model.lookup.Month" property="code" labelProperty="description"/>
		</html-el:select>
  	    </td></tr>
  	</table>
    </td>
</tr>
<!--  ******************************************* Fields for Other  ******************************************* -->
<tr id="dayToGenerateReportParam5">
	<td class="moduleLabel"><fw:label required="true" property="otherDateToGenerateReport" forId="otherDateToGenerateReportId"><bean-el:message key="label.report.dateToGenerateReport" />:</fw:label></td>
	<c:set var="otherGenerateReportText"><bean-el:message key="label.required" />,&nbsp;<bean-el:message key="label.report.dayToGenerateReport"/>&nbsp;<c:out value="${mmddyyyyText}" /></c:set>
	<td class="moduleValue" colspan="2" nowrap><html-el:text title="${otherGenerateReportText}" property="otherDateToGenerateReport" styleClass="moduleEdit" styleId="otherDateToGenerateReportId" size="10" maxlength="10"/>&nbsp;<bean-el:message key="label.mmddyyyy" /></td>
</tr>


<c:set var="hoursList" value="${reportInfoForm.hours}" />
<c:set var="minutesList" value="${reportInfoForm.minutes}" />
<tr>
    	<td class="moduleLabel"><bean-el:message key="label.required.prefix" />&nbsp;<bean-el:message key="label.report.timeToGenerateReport" />:</td>
    	<c:set var="timeToGenerateReportHoursText"><bean-el:message key="label.required" />,&nbsp;<bean-el:message key="label.report.timeToGenerateReport"/>,&nbsp;hour(s)</c:set>
    	<td class="moduleValue" colspan="2">
    	<table border="0" cellpadding="0" cellspacing="0">
  	    <tr>
  	    	<td class="moduleValue">
    	  	    <html-el:select title="${timeToGenerateReportHoursText}" styleClass="moduleEdit" styleId="timeToGenerateHoursId" property="timeToGenerateReportHour" >
			<esrcore:options styleClass="moduleEdit" collection="hoursList" property="label" labelProperty="value"/>
	  	    </html-el:select>
	  	    <fw:label property="timeToGenerateReportHour" forId="timeToGenerateHoursId">hour(s)</fw:label>
	  	</td>
	  	<c:set var="timeToGenerateReportminutesText"><bean-el:message key="label.required" />,&nbsp;<bean-el:message key="label.report.timeToGenerateReport"/>,&nbsp;minute(s)</c:set>
	  	<td class="moduleValue">
	  	    <html-el:select title="${timeToGenerateReportminutesText}" styleClass="moduleEdit" styleId="timeToGenerateMinutesId" property="timeToGenerateReportMinute" >
	  		<esrcore:options styleClass="moduleEdit" collection="minutesList" property="label" labelProperty="value"/>
	  	    </html-el:select>
	  	    <fw:label property="timeToGenerateReportMinute" forId="timeToGenerateMinutesId">minute(s)</fw:label>
	  	</td>
	    </tr>
  	</table>
    	</td>
</tr>
<tr>
	<td class="moduleLabel" style="vertical-align: top"><fw:label property="emailReportTo" forId="emailReportTo"><bean-el:message key="label.report.emailReportTo" />:</fw:label></td>
	<td class="moduleValue" colspan="2" nowrap>
	    <table width="100" border="0" cellspacing="0" cellpadding="0">
	    <c:set var="emailReportToText"><bean-el:message key="label.required" />,&nbsp;<bean-el:message key="label.report.emailReportTo"/>&nbsp;(<bean-el:message key="label.report.separateEmailRecipientNamesWithSemicolon" />)</c:set>
	      <tr>
	         <td><html-el:textarea title="${emailReportToText}" styleId="emailReportTo" property="emailReportTo" styleClass="moduleEdit" rows="3" cols="50"/></td>
	         <td>&nbsp;</td>
		 <td>
		    <table width="100" border="0" align="center" cellspacing="0" cellpadding="0">
			<tr>
        <td width="50%"><img alt=""  src="../images/spacer.gif"/></td>
        <td><img alt=""  src="../images/buttonEndLeft.gif"/></td>
        <td><html-el:button property="methodName" onclick="clearField('emailReportTo')" style="width:50; vertical-align: top;" styleClass="buttonText"><bean-el:message key="button.clear"/></html-el:button></td>
        <td><img alt=""  src="../images/buttonEndRight.gif"/></td>
        <td width="50%"><img alt=""  src="../images/spacer.gif"/></td>
			</tr>
		    </table>
		 </td>
	      </tr>
	      <tr><td colspan="2" class="moduleValue"><bean-el:message key="label.report.separateEmailRecipientNamesWithSemicolon" /></td></tr>
	    </table>
	</td>
</tr>
