{% load i18n %}
<form id="id_form_case_runs">
<div class="mixbar">
	<ul class="btnBlue btnBlueFilter" id="showFilterBtn">
		<li class="btnBlueL"></li>
                <li class="btnBlueC"><a title="Click to show filter case-run options" id='filter_case_run'>{% trans "Show filter options" %}</a></li>
		<li class="btnBlueR"></li>
	</ul>
	<div class='right_float tit'>
		<input id="id_check_box_auto_blinddown" type="checkbox" />
                <label for="id_check_box_auto_blinddown" title="Automatically display next text case">{% trans "Automatically" %}</label>
		<input id="id_check_box_highlight" type="checkbox" />
                <label for="id_check_box_highlight" title="Highlight my assigned runs">{% trans "Highlight" %}</label>
	</div>
	<div class="paddingLeft">
		<div class="btnBlueCaserun">
			<span>Cases</span>
			<ul>
				{% if perms.testruns.add_testexecution %}
                                <li><a href="{% url "add-cases-to-run" test_run.pk %}" class="addBlue9">{% trans "Add" %}</a></li>
				{% endif %}
				{% if perms.testruns.delete_testexecution %}
                                <li><a href="#" title="{% trans 'Remove selected cases form this test run' %}" data-param="{{ test_run.pk }}" class="removeBlue9 js-del-case">{% trans "Remove" %}</a></li>
				{% endif %}
				{% if perms.testruns.change_testexecution %}
                                <li><a href="#" title="{% trans 'Update the IDLE case runs to newest case text' %}" href="javascript:void(0)" data-param="{% url 'testruns-update_case_run_text' test_run.pk %}" class="updateBlue9 js-update-case" id="update_case_run_text">{% trans "Update" %}</a></li>
				{% endif %}
				{% if perms.testruns.change_testexecution %}
                                <li><a href="#" title="{% trans 'Assign this case(s) to other people' %}" class="assigneeBlue9 js-change-assignee">{% trans "Assignee" %}</a></li>
				{% endif %}
			</ul>
		</div>
		<div class="btnBlueCaserun">
                    <span>{% trans "Status" %}</span>
			{% if perms.testruns.change_testexecution %}
				<ul class="statusOptions" style="width: auto; white-space: nowrap">
					{% for execution_status in test_status %}
					<li><a style="padding-left: 0" value="{{ execution_status.pk }}" href="#"><i class="{{execution_status.icon}}" style="color: {{execution_status.color}}"></i> {{ execution_status.name }}</a></li>
					{% endfor %}
				</ul>
			{% endif %}
		</div>
		<div class="btnBlueCaserun">
                    <span>{% trans "Comment" %}</span>
			<ul>
                            {% if perms.django_comments.add_comment %}
                                <li><a href="#" class="addBlue9 js-show-commentdialog">{% trans "Add" %}</a></li>
                            {% endif %}
			</ul>
		</div>
                <div class="btnBlueCaserun">
                    <span>{% trans "Hyperlink" %}</span>
                        <ul>
                            {% if perms.linkreference.add_linkreference %}
                            <li><a href="#" class="addBlue9 js-add-links">{% trans "Add" %}</a></li>
                            {% endif %}
                        </ul>
                </div>
	</div>
	<div class="clear"></div>
</div>
</form>
<form id="id_filter" action="." method="get" style='display:none'>
	<div style="border:1px solid #235D9F; margin:2px; padding:8px; background:#DEEAF7;">
		<input type="hidden" name="order_by" value="{{ REQUEST_CONTENTS.order_by }}" />
		<div class="leftlistinfo">
			<div class="listinfo">
                            <span class="title"><label for="id_summary">{% trans "Summary" %}&nbsp;:</label></span>
				<input id="id_summary" type="text" name="case__summary__icontains" value="{{ REQUEST_CONTENTS.case__summary__icontains }}" />
			</div>
			<div class="listinfo">
                            <span class="title"><label for="id_default_tester">{% trans "Default tester" %}&nbsp;:</label></span>
				<input id="id_default_tester" type="text" name="tested_by__email__startswith" value="{{ REQUEST_CONTENTS.tested_by__email__startswith }}" />
			</div>
			<div class="listinfo">
                            <span class="title"><label for="id_assignee">{% trans "Assignee" %}&nbsp;:</label></span>
				<input id="id_assignee" type="text" name="assignee__email__startswith" value="{{ REQUEST_CONTENTS.assignee__email__startswith }}" />
			</div>
			<div class="listinfo">
                            <span class="title"><label for="id_is_automated">{% trans "Automated" %}&nbsp;:</label></span>
				<select id="id_is_automated" name="case__is_automated">
					<option value="">--------</option>
                                        <option value="0">{% trans "Manual" %}</option>
                                        <option value="1">{% trans "Auto" %}</option>
				</select>
			</div>
		</div>
		<div class="rightlistinfo">
			<div class="listinfo">
                            <span class="title"><label for="id_bug">{% trans "Bug" %}&nbsp;:</label></span>
				<input id="id_bug" type="text" name="linkreference__url__icontains" value="{{ REQUEST_CONTENTS.case_run_bug__bug_id__in }}" />
			</div>
			<div class="listinfo">
                            <span class="title"><label for="id_status">{% trans "Status" %}&nbsp;:</label></span>
				<select id="id_status" name="status__pk">
					<option value="">--------</option>
					{% for status in test_status %}
					<option value="{{ status.pk }}" {% if status.pk|escape == REQUEST_CONTENTS.status__pk %}selected="selected"{% endif %}>{{ status }}</option>
					{% endfor %}
				</select>
			</div>
			<div class="listinfo">
                            <span class="title"><label for="id_priority">{% trans "Priority" %}&nbsp;:</label></span>
				<select id="id_priority" name="case__priority__pk">
					<option value="">--------</option>
					{% for priority in priorities %}
					<option value="{{ priority.pk }}" {% if priority.pk|escape == REQUEST_CONTENTS.case__priority__pk %}selected="selected"{% endif %}>{{ priority }}</option>
					{% endfor %}
				</select>
			</div>
			<div class="listinfo">
                            <span class="title"><label for="id_tags">{% trans "Tag" %}&nbsp;:</label></span>
				<input id="id_tag" type="text" name="case__tag__name" value="{{ REQUEST_CONTENTS.case_tag__name }}" />
			</div>
		</div>
		<div class='clear'></div>
		<div class='button_box2'>
		<input type="submit" value='Search' />
		<input type="reset" value='Reset' />
	</div>
	</div>
</form>

<div class="mixbar fixed">
    <div class="tit" style="width: 50px; float: left; height: 100%; margin: 0px; text-align: center;">{% trans "Tags" %}:</div>
	<div style="margin-left: 50px; line-height:22px;" class="taglist">
		{% for tag in case_own_tags %}
		{{ tag }}&nbsp;&nbsp;<span class="grey">-</span>&nbsp;&nbsp;
		{% empty %}
                <span class="grey">{% trans "No tags in cases" %}</span>
		{% endfor %}
	</div>
</div>

{% include "run/table_executions.html" %}

<div id="addlink_dialog" title="Add hyperlink">
    <form>
        <fieldset>
            <label for="testlog_url">{% trans "URL" %} <span style="color:red">*</span></label>
            <input type="text" id="testlog_url" name="testlog_url" style="width: 95%"/>
            <div class="case_run_add_link">
                <div>
                    <input type="checkbox" id="is_defect" name="is_defect" />
                    <label for="is_defect">{% trans "URL points to a defect" %}</label>
                </div>
                <div>
                    <input type="checkbox" id="update_tracker" name="update_tracker" />
                    <label for="update_tracker">{% trans "Auto-update Issue Tracker" %}</label>
                </div>
            </div>
            <br/>
            <label for="testlog_name">{% trans "Name" %}</label>
            <input type="text" id="testlog_name" name="testlog_name" style="width: 95%"/>
        </fieldset>
    </form>
</div>

	<script id="add_issue_form_template" type="text/x-handlebars-template">
{% verbatim %}
	<h4>{{ action_button_text }} bug</h4>
		<form id="add_issue_form">
			<input type="hidden" name="a" value="{{ a }}">
				{{#each hiddenFields}}
					<input type="hidden" name="{{ this.name }}" value="{{ this.value }}">
				{{/each}}
{% endverbatim %}
			<div class="bug_type" id="id_bug_type">Issue Tracker</div>
			<select name="bug_system_id" id="bug_system_id">
			{% for btr in bug_trackers %}
				<option value="{{ btr.pk }}">{{ btr.name }}</option>
			{% endfor %}
			</select>
			</br>
{% verbatim %}
			<div>
				<input type="submit" value="{{ action_button_text }}">
{% endverbatim %}
				<input type="button" value="Cancel" class="js-cancel-button" >
			</div>
		</form>
	</script>
	<script id="batch_add_comment_to_caseruns_template" type="text/x-handlebars-template">
		<ul>
                        <li><b>{% trans "Comments" %}: </b></li>
			<li><textarea name="comments" id="commentText" style="width:100%;height:100px;"></textarea></li>
			<li>
                                <button id="btnComment">{% trans "Confirm" %}</button>
                                <button id="btnCancelComment">{% trans "Cancel" %}</button>
				<span id="commentsErr"></span>
			</li>
		</ul>
	</script>
