{% import 'ReportBundle:Overview:macros.html.twig' as macros %}
<section class="report-wrapper">
	<header>
		<h2>
			<span class="drop-option">
				<select class="grouping-field" name="sla_id">
					<option value="0">All SLAs</option>
					{% for sla in app.getDataService('Sla').getAllSlas() %}
						<option {% if data.sla_id == sla.id %}selected="selected"{% endif %} value="{{ sla.id }}">{{ sla.title }}</option>
					{% endfor %}
				</select>
				<i></i>
			</span>

			for Tickets Created

			<span class="drop-option">
				<select class="grouping-field" name="date_choice">
					{% for field,title in {
						'today': 'Today',
						'this_week': 'This Week',
						'this_month': 'This Month',
						'this_year': 'This Year',
					} %}
						<option {% if data.date_choice == field %}selected="selected"{% endif %} value="{{ field }}">{{ title }}</option>
					{% endfor %}
				</select>
				<i></i>
			</span>
		</h2>
		<h3>Showing Grouped by Status</h3>
	</header>
	<article>
		{% if data.values %}
			<table class="stat-table" width="100%">
				{% for id, title in data.titles %}
					{% if data.values[id] %}
						<tr>
							<td class="title"><span>{{ title }}</span></td>
							<td width="100%">
								<table width="100%" class="stat-value"><tr>
									{% set perc = (data.values[id] / data.max|default(1)) * 100 %}
									{% if perc < 1.0 %}
										<td class="value" width="1%"><div>&nbsp;</div></td>
										<td width="{{ 100 - 1 }}%">{{ data.values[id] }}</td>
									{% else %}
										<td class="value" width="{{ perc }}%"><div>&nbsp;</div></td>
										<td width="{{ 100 - perc }}%">{{ data.values[id] }}</td>
									{% endif %}
								</tr></table>
							</td>
						</tr>
					{% endif %}
				{% endfor %}
				<tr class="total-row">
					<td class="title">Total:</td>
					<td class="val">{{ data.sum }}</td>
				</tr>
			</table>
		{% else %}
			{{ macros.no_data() }}
		{% endif %}
	</article>
</section>