{% extends "tcms_base.html" %}

{% load i18n admin_modify %}
{% load static %}

{% block subtitle %}Edit Environment group{% endblock %}

{% block custom_stylesheet %}

{% endblock %}

{% block custom_javascript %}
<script type="text/javascript" src="/jsi18n/"></script>
<script type="text/javascript" src="{% static "admin/js/jquery.init.js" %}"></script>
<script type="text/javascript" src="{% static "admin/js/core.js" %}"></script>
<script type="text/javascript" src="{% static "admin/js/SelectFilter2.js" %}"></script>
<script type="text/javascript" src="{% static "admin/js/SelectBox.js" %}"></script>
<script type="text/javascript" src="{% static "js/management_actions.js" %}"></script>
<script type="text/javascript">
Nitrate.Utils.after_page_load(Nitrate.Management.Environment.Edit.on_load);
</script>
{% endblock %}

{% block content_type %}
	<input type="hidden" name="content_type" value="management.tcmsenvgroup" />
	<input type="hidden" name="object_pk" value="{{ environment.pk }}" />
	<input type="hidden" name="name" value="{{ environment.name }}" />
{% endblock %}

{% block contents %}
<div id="content">
	<div class="sprites crumble">
		<a href="{% url "nitrate-index" %}">Home</a>
		>> <a href="{% url "management-env-groups" %}">Environment groups</a>
		>> Edit group - {{ environment.name }}
	</div>
	<form id="js-edit-group" action="{% url "management-env-group-edit" environment.id %}" method="POST">
		<input type="hidden" name="action" value="modify">
		<input type="hidden" name="id" value="{{ environment.id }}">
		<h2>Edit Environment Group</h2>
		<table border="0" class="manage" cellspan="0" cellspacing="0 "  width="98%">
			<tr>
				<td class="manage-tit" width="15%" height="28">
					<label>Environment Group Name</label>
				</td>
				<td>
					<input type="text" name="name" value="{{ environment.name }}" />
					<span><label for="enable-group">Enabled</label></span>
					<input type="checkbox" id="enable-group" name="enabled" {% if environment.is_active %}checked{% endif %} />
				</td>
			</tr>
			<tr>
				<td class="manage-tit">
					<label>
						Properties<br />
						<a class="editlink" href="{% url "management-env-properties" %}">Edit</a>
					</label>
				</td>
				<td>
					<div class="selectgroup">
						<select id="id_properties" name="selected_property_ids" multiple="multiple">
							{% for property in properties %}
							<option value="{{ property.id }}" {% if property in selected_properties %}selected{% endif %}>{{ property.name }}</option>
							{% endfor %}
						</select>
					</div>
				</td>
			</tr>
			<tr>
				<td colspan="2" class="manage-tit" align="center" height="25">
					<input type="submit" value="Save">
					<input type="button" value="Back" id="js-back-button">
					<br clear="all">
					<span class="successlink">{{ message }}</span>
				</td>
			</tr>
		</table>
	</form>
</div>
{% endblock %}
