{% extends "tcms_base.html" %}
{% load static %}
{% block subtitle %}Clone Test Case{% endblock %}
{% block custom_stylesheet %}
{% endblock %}
{% block custom_javascript %}
<script type="text/javascript" src="{% static "js/testcase_actions.js" %}"></script>
<script type="text/javascript">
Nitrate.Utils.after_page_load(Nitrate.TestCases.Clone.on_load);
</script>
{% endblock %}
{% block contents %}
<div id="content">
	<div class="sprites crumble">
		<a href="{% url "nitrate-index" %}">Home</a>
		{% if test_plan %}
		>>Plan: <a href="{{ test_plan.get_absolute_url }}">{{ test_plan.plan_id }}: {{ test_plan.name }}</a>
		{% else %}
		>> <a href="{% url "cases-search" %}">Search Cases</a>
		{% endif %}
		>> Clone case
	</div>

	<div id="hidden">
		<input id="value_plan_id" type="hidden" name="plan_id" value="{{ test_plan.plan_id }}" />
	</div>

	<h2>Clone Test Case(s)</h2>
	<div class="Detailform border-1">
		<div class="editor" cellspacing="0" cellspan="0">
			<div class="listinfo">
				<label class="strong title">Select Plan </label>
				{% if test_plan %}
				<div>
					<input type="radio" id="id_use_sameplan" name="selectplan" value="{{ test_plan.plan_id }}"/>
					<label for="id_use_sameplan" class="strong">Use the same Plan -- {{ test_plan.plan_id }} : {{ test_plan.name }}</label>
				</div>
				{% endif %}
				<div>
					<input type="radio" id="id_use_filterplan" checked name="selectplan" />
					<label for="id_use_filterplan" class="strong">Filter another plan</label>
					<div id="id_filterPlan">
					<form id="id_form_search_plan" action="{% url "plans-for-cloning-cases" %}" method="get">
						{% include 'plan/form/filter.html' %}
						<div class="cell" style=" margin-left:0">
							<input type="submit" value="Filter plan" />
						</div>
					</form>
					</div>
				{% if submit_action %}
				{{ clone_form.plan.errors }}
				{% endif %}
				</div>
			</div>
			<form id="id_clone_form" action="{% url "cases-clone" %}" method="post">{% csrf_token %}
				{{ form.case_id }}
				<div class="listinfo">
					<label class="strong title"></label>
					<input id="id_plan_id" type="hidden" name="" value="" />
					<div id="id_plan_container" style="display: none;">
						<div class="ajax_loading"></div>
					</div>
				</div>
				<div class="listinfo">
					<label class="strong title">Case(s)</label>
					<div class="linotype">{{ clone_form.case }}</div>
				</div>
				<div class="listinfo">
					<label class="strong title">Clone Settings</label>
					<fieldset class="choose">
						<legend class="">Case Properties</legend>
						<ul class="ul-no-format">
							<li>
								{{ clone_form.copy_case }}
								<span>
									<label for="id_copy_case">{{ clone_form.copy_case.help_text }}</label>
								</span>
							</li>
							<li>
								{{ clone_form.maintain_case_orignal_author }}
								<span>
									<label for="orignal_author">{{ clone_form.maintain_case_orignal_author.help_text }}</label>
								</span>
							</li>
							<li>
								{{ clone_form.maintain_case_orignal_default_tester }}
								<span>
									<label for="id_maintain_case_orignal_default_tester">{{ clone_form.maintain_case_orignal_default_tester.help_text }}</label>
								</span>
							</li>
							<li>
								{{ clone_form.copy_component }}
								<span>
									<label for="id_copy_component">{{ clone_form.copy_component.help_text }}</label>
								</span>
							</li>
							<li>
								{{ clone_form.copy_attachment }}
								<span>
									<label for="id_copy_attachments">{{ clone_form.copy_attachment.help_text }}</label>
								</span>
							</li>
						</ul>
					</fieldset>
				</div>
				<div class="submit-row">
					<input type="hidden" name="from_plan" value="{{ test_plan.pk }}"/>
					<input type="submit" name="submit" value="Clone" />
					<input type="button" value="Cancel" class="js-cancel-button"/>
				</div>
			</form>
		</div>
	</div>
</div>
{% endblock %}
