project_form.html 1.86 KB
{% extends "base_page.html" %}

{# Make link with form_manager #}
{% set project = object_struct %}

{#  Set the title that will be used in base_page #}

{% if project['id'] and project['id'] != '' and project['name'] != None %}
  {% set subtitle = "Modifier le projet " + project['name'] %}
{% else %}
  {% set subtitle = "Ajouter un nouveau projet" %}
{% endif %}

{% block content %}

  <!-- Invisible span to define wich ul and a in the navbar are actived -->
  <span id="nav_actived" style="display: none">admin,project_edit</span>

  <form id="project_form" class="pdc-form" action="{{ url_for('main.project_edit') }}" method="post">
    {% if project['id'] and project['id'] != '' %}
      <input class="form-control" id="project_id" name="project_id" type="hidden" value="{{ project['id'] }}">
    {% endif %}
    
    <div class="form-group">
      <label for="name">Nom</label>
      <input class="form-control" id="name" name="name" type="text" placeholder="Nom de Projet"
             value="{{ project['name'] if project['name'] }}">
    </div>
    {% for c in categories %}
      <div class="form-group">
        <label for="{{ c.name }}">{{ c.name }}</label>
        <select id="{{ c.name }}" name="{{ c.name }}" class="form-control" multiple>
          {% for l in c.labels %}
            <option value="{{ l.id }}" {{ "selected" if l.name in project['labels'] }}>{{ l.name }}</option>
          {% endfor %}
        </select>
      </div>
    {% endfor %}
    <div class="form-group">
      <label for="status_id">État</label>
      <select id="status_id" name="status_id" class="form-control">
        {% for s in project_statuses %}
          <option value="{{ s.id }}" {{ "selected" if s.id == project['status_id'] }}>{{ s.name }}</option>
        {% endfor %}
      </select>
    </div>
    <input class="pdc-form-submit" type="submit" value="Valider">
  </form>
{% endblock %}