{% extends "report/common/search_run.html" %}

{% block report %}
{% if report_data %}
	{% if queries %}
	<div class="queries">
		<ul>
			{% for k, v in queries.items %}
			<li><label>{{ k|title }}:</label>{{ v|safe }};</li>
			{% endfor %}
			{% if not report_data.builds_selected %}
			<li>
				<label>Builds:</label>
				{% for b in report_data.builds %}{{ b }}, {% endfor %}
			</li>
			{% endif %}
			<li class="clear"></li>
		</ul>
	</div>
	{% endif %}

	<div class="reportSummary01">
		<ul><li class="tagTab">Tester:<span>All Testers</span></li></ul>
		<ul>
			<li>
				Plan:<span>{{ report_data.plans_count }}</span>
				Run:<span>{{ report_data.runs_count }}</span>
				Case-Run:<span>{{ report_data.caseruns_count }}</span>
			</li>
		</ul>
		<div class="clear"></div>
	</div>

	{% spaceless %}
	<table width="100%" border="0" cellpadding="0" cellspacing="0" class="listTdReport">
		<tr>
			{% if report_data.builds_selected %}<th class="w200">Build</th>{% endif %}
			<th class="w200">Tested By </th>
			<th class="w90">Run Tested </th>
			<th class="w90">Case-Run Tested</th>
			<th class="w50">Idle</th>
			<th class="w50">Running</th>
			<th class="w50">Paused</th>
			<th class="w50">Passed</th>
			<th class="w50">Failed</th>
			<th class="w50">Blocked</th>
			<th class="w50">Error</th>
			<th>Waived</th>
		</tr>
		{% if report_data.builds_selected %}
			{% for build, tested_by, runs_count, status_subtotal in report_data.reports %}
			<tr>
					{% if build.1 is not None %}
					<td rowspan="{{ build.1 }}" class="bgRowspan"><span>{{ build.0 }}</span></td>
					{% endif %}
					<td><span>{{ tested_by }}</span></td>
					<td><span>{{ runs_count }}</span></td>
					<td><a href="{{ report_url }}{{ path_without_build }}&r_build={{ build.0.pk }}&tester={{ tested_by.pk|default:0 }}">{{ status_subtotal.total }}</a></td>
					<td><a href="{{ report_url }}{{ path_without_build }}&r_build={{ build.0.pk }}&tester={{ tested_by.pk|default:0 }}&status=idle">{{ status_subtotal.IDLE|default:0 }}</a></td>
					<td><a href="{{ report_url }}{{ path_without_build }}&r_build={{ build.0.pk }}&tester={{ tested_by.pk|default:0 }}&status=running">{{ status_subtotal.RUNNING|default:0 }}</a></td>
					<td><a href="{{ report_url }}{{ path_without_build }}&r_build={{ build.0.pk }}&tester={{ tested_by.pk|default:0 }}&status=paused">{{ status_subtotal.PAUSED|default:0 }}</a></td>
					<td><a href="{{ report_url }}{{ path_without_build }}&r_build={{ build.0.pk }}&tester={{ tested_by.pk|default:0 }}&status=passed">{{ status_subtotal.PASSED|default:0 }}</a></td>
					<td><a href="{{ report_url }}{{ path_without_build }}&r_build={{ build.0.pk }}&tester={{ tested_by.pk|default:0 }}&status=failed">{{ status_subtotal.FAILED|default:0 }}</a></td>
					<td><a href="{{ report_url }}{{ path_without_build }}&r_build={{ build.0.pk }}&tester={{ tested_by.pk|default:0 }}&status=blocked">{{ status_subtotal.BLOCKED|default:0 }}</a></td>
					<td><a href="{{ report_url }}{{ path_without_build }}&r_build={{ build.0.pk }}&tester={{ tested_by.pk|default:0 }}&status=error">{{ status_subtotal.ERROR|default:0 }}</a></td>
					<td><a href="{{ report_url }}{{ path_without_build }}&r_build={{ build.0.pk }}&tester={{ tested_by.pk|default:0 }}&status=waived">{{ status_subtotal.WAIVED|default:0 }}</a></td>
			</tr>
			{% empty %}
			<tr><td colspan="11" align="center">No report data.</td></tr>
			{% endfor %}
		{% else %}
			{% for tested_by, runs_count, status_subtotal in report_data.reports %}
			<tr>
					<td><span>{{ tested_by }}</span></td>
					<td><span>{{ runs_count }}</span></td>
					<td><a href="{{ report_url }}{{ request_path }}&tester={{ tested_by.pk|default:0 }}">{{ status_subtotal.total }}</a></td>
					<td><a href="{{ report_url }}{{ request_path }}&tester={{ tested_by.pk|default:0 }}&status=idle">{{ status_subtotal.IDLE|default:0 }}</a></td>
					<td><a href="{{ report_url }}{{ request_path }}&tester={{ tested_by.pk|default:0 }}&status=running">{{ status_subtotal.RUNNING|default:0 }}</a></td>
					<td><a href="{{ report_url }}{{ request_path }}&tester={{ tested_by.pk|default:0 }}&status=paused">{{ status_subtotal.PAUSED|default:0 }}</a></td>
					<td><a href="{{ report_url }}{{ request_path }}&tester={{ tested_by.pk|default:0 }}&status=passed">{{ status_subtotal.PASSED|default:0 }}</a></td>
					<td><a href="{{ report_url }}{{ request_path }}&tester={{ tested_by.pk|default:0 }}&status=failed">{{ status_subtotal.FAILED|default:0 }}</a></td>
					<td><a href="{{ report_url }}{{ request_path }}&tester={{ tested_by.pk|default:0 }}&status=blocked">{{ status_subtotal.BLOCKED|default:0 }}</a></td>
					<td><a href="{{ report_url }}{{ request_path }}&tester={{ tested_by.pk|default:0 }}&status=error">{{ status_subtotal.ERROR|default:0 }}</a></td>
					<td><a href="{{ report_url }}{{ request_path }}&tester={{ tested_by.pk|default:0 }}&status=waived">{{ status_subtotal.WAIVED|default:0 }}</a></td>
			</tr>
			{% empty %}
			<tr><td colspan="11" align="center">No report data.</td></tr>
			{% endfor %}
		{% endif %}
	</table>
	{% endspaceless %}
{% endif %} {# end of report data adjudgement #}
{% endblock %}
