{extends "reports/reports_base.tpl.html"}
{block "title"}{t}Issues By User{/t}{/block}

{block "report_content"}
<script type="text/javascript">

function changeType() {
    if ($('input[name=report_type]:checked').val() == 'range') {
        $('#week_row').hide();
        $('#start_row, #end_row').show();
    } else {
        $('#week_row').show();
        $('#start_row, #end_row').hide();
    }
}
$().ready(function() {

    changeType();
    $('input[name=report_type]').click(changeType);
});
</script>
<h3 align="center">
    {t}Weekly Report{/t}
</h3>

<form method="post" name="weekly_report">
<input type="hidden" name="cat" value="generate">
      <table class="bordered">
        <tr>
          <td width="120">
            {t}Report Type{/t}:
          </td>
          <td width="200" NOWRAP>
            <label><input type="radio" name="report_type" value="weekly" {if $report_type!='range'}checked{/if}>
                {t}Weekly{/t}</label>&nbsp;
            <label><input type="radio" name="report_type" value="range" {if $report_type=='range'}CHECKED{/if}>
                {t}Date Range{/t}</label>&nbsp;
          </td>
        </tr>
        <tr id="week_row">
          <td width="120">
            {t}Week{/t}:
          </td>
          <td width="200">
            <select name="week">
                {html_options options=$weeks selected=$week}
            </select>
          </td>
        </tr>
        <tr id="start_row">
          <td width="120">
            {t}Start{/t}:
          </td>
          <td width="200">
            {if empty($start_date)}
              {assign var="start_date" value=time()}
            {/if}
            {html_select_date time=$start_date prefix="" field_array="start" start_year="-2" end_year="+1" field_order="YMD" month_format="%b" day_value_format="%02d" all_extra="class='default'"}
          </td>
        </tr>
        <tr id="end_row">
          <td width="120">
            {t}End{/t}:
          </td>
          <td width="200">
            {if empty($end_date)}
              {assign var="end_date" value=time()}
            {/if}
            {html_select_date time=$end_date prefix="" field_array="end" start_year="-2" end_year="+1" field_order="YMD" month_format="%b" day_value_format="%02d" all_extra="class='default'"}
          </td>
        </tr>
        <tr>
          <td width="120">
            {t}Developer{/t}:
          </td>
          <td width="200">
            <select name="developer">
                {html_options options=$users selected=$developer}
            </select>
          </td>
        </tr>
        <tr>
          <td width="120" valign="top">
            {t}Options{/t}:
          </td>
          <td width="200">
            <label><input type="checkbox" name="separate_closed" value="1" {if $smarty.request.separate_closed|default:'' == 1}checked{/if}>
            {t}Separate Closed Issues{/t}</label>&nbsp;
            <br />
            <label><input type="checkbox" name="separate_not_assigned_to_user" value="1" {if $smarty.request.separate_not_assigned_to_user|default:'' == 1}checked{/if}>
            {t}Separate Not Assigned to User{/t}</label>&nbsp;
            <br />
            <label><input type="checkbox" name="ignore_statuses" value="1" {if $smarty.request.ignore_statuses|default:'' == 1}checked{/if}>
            {t}Ignore Issue Status Changes{/t}</label>&nbsp;
            <br />
            <label><input type="checkbox" name="show_per_issue" value="1" {if $smarty.request.show_per_issue|default:'' == 1}checked{/if}>
            {t}Show Times spent on issue{/t}</label>&nbsp;
            <br />
            <label>&nbsp;&nbsp;<input type="checkbox" name="separate_no_time" value="1" {if $smarty.request.separate_no_time|default:'' == 1}checked{/if}>
            {t}Separate No time spent{/t}</label>&nbsp;
            <br />
            <label><input type="checkbox" name="show_status" value="1" {if $smarty.request.show_status|default:'' == 1}checked{/if}>
            {t}Show Status{/t}</label>&nbsp;
            <br />
            <label><input type="checkbox" name="show_priority" value="1" {if $smarty.request.show_priority|default:'' == 1}checked{/if}>
            {t}Show Priority{/t}</label>&nbsp;

          </td>
        </tr>
        <tr class="buttons">
          <td colspan="2">
            <input type="submit" value="{t}Generate{/t}" class="shortcut">
          </td>
        </tr>
      </table>
</form>

{if $data|default:'' != ''}
<pre class="bordered">
{include file="reports/weekly_data.tpl.html"}
</pre>
{/if}
{/block}
