{% extends "sentry/projects/base.html" %}

{% load crispy_forms_tags %}
{% load i18n %}

{% block title %}{% trans "New Project" %} | {{ block.super }}{% endblock %}

{% block breadcrumb %}
    {{ block.super }}
    <li class="divider"></li>
    <li><a href="{% url sentry-new-project team.slug %}">{% trans "New Project" %}</a></li>
{% endblock %}

{% block main %}
    <section class="body">
        <div class="page-header">
            <h2>{% trans "Create a New Project" %}</h2>
        </div>

        <p>{% blocktrans %}Projects allow you to scope events to a specific application in your organization. For example, you might have seperate projects for production vs development instances, or separate projects for your web app and mobile app.{% endblocktrans %}</p>

        <br>

        <form class="form-stacked" action="" method="post" id="new_project">
            {% csrf_token %}

            {{ project_form|as_crispy_errors }}
            {% for field in project_form %}
                {% include "sentry/partial/_form_field.html" %}
            {% endfor %}

            {% if select_team_form %}
                <div id="select_team">
                    {{ select_team_form|as_crispy_errors }}

                    {% for field in select_team_form %}
                        {% include "sentry/partial/_form_field.html" %}
                    {% endfor %}
        
                    {% if new_team_form %}
                        <p><small>You can also <a href="#" rel="create-new-team">create a new team</a>.</small></p>
                    {% endif %}
                </div>
            {% endif %}
    
            {% if new_team_form %}
                <div id="new_team">
                    {% for field in new_team_form %}
                        {% include "sentry/partial/_form_field.html" %}
                    {% endfor %}

                    {% if select_team_form %}
                        <p><small>You can also <a href="#" rel="select-team">select an existing team</a>.</small></p>
                    {% endif %}
                </div>
            {% endif %}

            <div class="actions">
                <button type="submit" class="btn btn-primary">{% trans "Save Changes" %}</button>
            </div>
        </form>
    </section>
    <script>
    new app.NewProjectPage({
        el: '#new_project',
        canSelectTeam: {% if select_team_form %}true{% else %}false{% endif %},
        canCreateTeam: {% if new_team_form %}true{% else %}false{% endif %},
    })
    </script>
{% endblock %}
