<!DOCTYPE html>

{% extends "base.html" %}
{% block pagename %}regression{% endblock %}
{% block title %}Регрессия проекта {{ project }}{% endblock %}

<div class="header-bottom-padding"></div>
{% block navigation %}
<table class="nav_table">
	<tbody>
	<tr>
		<td>
			<a href="/{{ project }}" target="_blank">{{ project }}</a>
		</td>
		<td class="navigation-delimiter">
			→
		</td>
		<td>
			<span style="font-size: 11pt;">Регрессия</span>
		</td>
		<td class="navigation-delimiter">
			→
		</td>
		<td id='service_nav'>
		</td>
	</tr>
	</tbody>
</table>
{% endblock %}

{% block body %}

<div class="header-bottom-padding"></div>
<div class="container-fluid">
<h4>{{ project }}</h4>
{% block panel %}

<div class="tab_panel">
<ul class="nav nav-pills">
	{% if not tab %}
	<li class="nav-item tab_panel_tab" id="tab_panel_tab__" data-project="{{ project }}" data-service="">
		<a id="tab_panel_tab_link__" class="tab_panel_tab_link nav-link active" data-project="{{ project }}" data-service="" data-component="{{ component }}">Без сервиса</a>
	</li>
	{% else %}
	<li class="tab_panel_tab" id="tab_panel_tab__" data-project="{{ project }}" data-service="">
		<a id="tab_panel_tab_link__" class="tab_panel_tab_link nav-link" data-project="{{ project }}" data-service="" data-component="{{ component }}">Без сервиса</a>
	</li>
	{% endif %}
	
	{% for service in services %}
		{% if service == tab %}
			<script nonce='{{ common.CSP_SCRIPT_NONCE }}'>
				function add_service_nav() {
					$("td#service_nav").html('<span style="margin-right: 0.5em;">Сервис:&nbsp;&quot;{{ service }}&quot;</span>')
                }
                add_service_nav();
			</script>
			<li class="nav-item tab_panel_tab" id="tab_panel_tab__{{ service }}" data-project="{{ project }}" data-service="{{ service }}">
				<a id="tab_panel_tab_link__{{ service }}" class="tab_panel_tab_link nav-link active" data-project="{{ project }}" data-service="{{ service }}" data-component="{{ component }}">{{ service }}</a>
			</li>
		{% else %}
			{% if service in failed_services %}
				<li class="nav-item tab_panel_tab failed" id="tab_panel_tab__{{ service }}" data-project="{{ project }}" data-service="{{ service }}">
					<a id="tab_panel_tab_link__{{ service }}" class="tab_panel_tab_link nav-link tab_panel_tab_link" data-project="{{ project }}" data-service="{{ service }}" data-component="{{ component }}">{{ service }}</a>
				</li>
			{% else %}
				<li class="nav-item tab_panel_tab" id="tab_panel_tab__{{ service }}" data-project="{{ project }}" data-service="{{ service }}">
					<a id="tab_panel_tab_link__{{ service }}" class="tab_panel_tab_link nav-link" data-project="{{ project }}" data-service="{{ service }}" data-component="{{ component }}">{{ service }}</a>
				</li>
			{% endif %}
		{% endif %}
	{% endfor %}
</ul>
</div>

<div class="popup-box" data-job-id="">
	<div class="popup-top">
		<h2 id="popup-title"></h2>
		<small id="popup-version"></small>
	</div>
	<div class="popup-bottom">
	    <button id="popup-redirect" type="button" class="btn btn-secondary btn-sm job_button">К стрельбе</button>
	    <br>
	    <button id="popup-delete" type="button" class="btn btn-secondary btn-sm job_button">Удалить стрельбу</button>
	    <br>
	    <button id="popup-comment" type="button" class="btn btn-secondary btn-sm job_button">Комментировать</button>
    </div>
</div>

{% endblock %}

{% block overview %}
		
	<script nonce='{{ common.CSP_SCRIPT_NONCE }}' type="text/html" id="componentTemplate">
		<div class="row">
			<div class="container-fluid">
				<div style="float: right" class='btn-group kpi_radio_container' id="kpi_radio_container__<%= compId %>" role="group">
					<%  if (component.job_order == "timeline") { %>
						<button type="button" id="radio_month" data-limit="month" class="btn btn-secondary btn-sm active">Месяц</button>
						<button type="button" id="radio_halfyear" data-limit="halfyear" class="btn btn-secondary btn-sm">Полгода</button>
						<button type="button" id="radio_year" data-limit="year" class="btn btn-secondary btn-sm">Год</button>
						<button type="button" id="radio_all" data-limit="" class="btn btn-secondary btn-sm">Все</button>
					<% } else { %>
						<button type="button" id="radio_50" data-limit="50" class="btn btn-secondary btn-sm active">50</button>
						<button type="button" id="radio_100" data-limit="100" class="btn btn-secondary btn-sm">100</button>
						<button type="button" id="radio_all" data-limit="" class="btn btn-secondary btn-sm">Все</button>
					<% } %>
				</div>
				<div style="float: right; padding-top: 2px; padding-right: 5px;">
					<i class="fa fa-pencil text-warning componentEditIcon" style="font-size: 24px; cursor: pointer; margin-right: 5px;" data-project='<%= projectValue %>' data-component='<%= component.n %>' title='Редактировать'></i>
					<i class="fa fa-trash text-danger componentDeleteIcon" style="font-size: 24px; cursor: pointer; margin-right: 5px;" data-project='<%= projectValue %>' data-component='<%= component.n %>' title='Удалить'></i>
				</div>
                <a href='/regress/<%= component.tag %>/<%= component.n %>'>
                    <% if (anotherProject) { %>
                        <h3 id="<%= component.name %>"><%= component.name %> [<%= anotherProject %>]&emsp;<i style="display: none;" class='fa fa-paragraph text-muted'></i></h3>
                    <% } else { %>
                        <h3><%= component.name %>&emsp;<i style="display: none;" class='fa fa-paragraph text-muted'></i></h3>
                    <% } %>
                </a>
				<% if (component.dsc) { %>
					<br>
					<span class="component_dsc">Описание: <%= component.dsc %></span>
				<% } %>
			</div>
		</div>
		<div class='row kpi_list_row' id="kpi_list_<%= compId %>"></div>
	</script>
		
	<div id="component_list" data-comp_id="{{ component.n }}">
		<i class="krutilka fa fa-circle-o-notch fa-spin" aria-hidden="true"></i>
	</div>
		
{% endblock %}

</div>

<link href="/media/css/regression.css?version=43.4" type="text/css" rel="stylesheet" />
<script nonce='{{ common.CSP_SCRIPT_NONCE }}' type='text/javascript' src='/media/js/regression.js?version=43.4'></script>

{% endblock %}
