{% load i18n %}


{% comment %}
<!--
  Copyright (C) 2011 University of Dundee & Open Microscopy Environment.
  All rights reserved.

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU Affero General Public License as
  published by the Free Software Foundation, either version 3 of the
  License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU Affero General Public License for more details.

  You should have received a copy of the GNU Affero General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->
{% endcomment %}


<script type="text/javascript">

$(document).ready(function () {
    $("#id_members").chosen({disable_search_threshold:5, placeholder_text:'Choose members of the share'});

    $('#id_expiration').datepicker({firstDay: 1, dateFormat: 'yy-mm-dd', minDate: 0});

    $(".tooltip").tooltip({
        items: '.tooltip',
        track: true,
        show: false,
        hide: false
    });
}); 


</script>

<p>{% trans "Fields marked in red are mandatory." %}</p>

{% if manager.share.id %}

    {% if manager.share.isExpired %}

        <p class="error">This share has expired. You must change the date to the future before saving.</p>

    {% endif %}

{% endif %}

<div>
    {% for field in form %}
        {% if field.label_tag == form.image.label_tag %}
            {% if field.errors %}
                <div>{% if field.field.required %}<span class="required">{{ field.label_tag }}</span>{% else %}{{ field.label_tag }}{% endif %}</div>
                <div>{{ field.errors }}</div>
            {% endif %}
            <div class="hiddenField">{{ field }}</div>
        {% else %}
            {% if field.label_tag == form.enable.label_tag %}
                <div>
                    {% if field.field.required %}<span class="required">{{ field.label_tag }}</span>{% else %}{{ field.label_tag }}{% endif %}
                    {{ field }}
                    {{ field.help_text|safe }}
                    {% if field.errors %}{{ field.errors }}{% endif %}
                </div>
            {% else %}
                <div>{% if field.field.required %}
                    <span class="required">{{ field.label_tag }}</span>
                {% else %}
                    {{ field.label_tag }}
                {% endif %}
                {{ field.help_text|safe }}</div>
                <div>{% if field.errors %}{{ field.errors }}{% endif %}</div>
                <div>{{ field }}</div>
            {% endif %}
        {% endif %}
    {% endfor %}
</div>

</form>

