{% extends 'layouts/base.html' %}
{% load static %}
{% load i18n %}

{% block content %}
  {% include 'header.html' %}
  <main id="main-content">
  <section>
    <div class="form-view">
      {% if failure_mode_effect_exist %}
        <h1>{% translate 'Create a new failure mode' %}</h1>
        <form novalidate action="{% if editing_view %}{{ object.get_update_url }}{% else %}{% url 'fmea_failure_mode_create' %}{% endif %}" 
          method="post" 
          class="horizontal-view help">
          {% csrf_token %}
          {% translate 'Failure mode and effects' as fieldset_legend %}
          {% include 'partials/form/fieldset.html' with legend=fieldset_legend fieldset='failure_mode description frequency_level detectability_level effect' fields=form  %}
          {% if editing_view %}
            <button class="cta" type="submit">{% translate 'Save' %}</button>
          {% else %}
            <button type="submit">{% translate 'Submit' %}</button>
          {% endif %}
        </form>
      {% else %}
        <p>{% translate 'No failure mode effects created.' %}</p>
        <p>{% translate 'First create failure mode effects wich can be added later to a failure mode.' %}</p>
        <a class="button" href="{% url 'fmea_failure_mode_effect_create' %}">{% translate 'Create failure mode effects' %}</a>
      {% endif %}
    </div>
  </section>
  </main>
{% endblock %}
