{% load envipytags %}

{% if meta.can_edit %}
  <li>
    <a
      class="button"
      onclick="document.getElementById('add_pathway_node_modal').showModal(); return false;"
    >
      <i class="glyphicon glyphicon-plus"></i> Add Compound</a
    >
  </li>
  <li>
    <a
      class="button"
      onclick="document.getElementById('add_pathway_edge_modal').showModal(); return false;"
    >
      <i class="glyphicon glyphicon-plus"></i> Add Reaction</a
    >
  </li>
  {% epdb_slot_templates "epdb.actions.objects.pathway.add" as action_button_templates %}

  {% for tpl in action_button_templates %}
    {% include tpl %}
  {% endfor %}
  <li role="separator" class="divider h-px"></li>
{% endif %}
<li>
  <a
    role="button"
    onclick="document.getElementById('generic_copy_object_modal').showModal(); return false;"
  >
    <i class="glyphicon glyphicon-duplicate"></i> Copy</a
  >
</li>
<li>
  <a
    class="button"
    onclick="document.getElementById('download_pathway_csv_modal').showModal(); return false;"
  >
    <i class="glyphicon glyphicon-floppy-save"></i> Download Pathway as CSV</a
  >
</li>
<li>
  <a
    class="button"
    onclick="document.getElementById('download_pathway_image_modal').showModal(); return false;"
  >
    <i class="glyphicon glyphicon-floppy-save"></i> Download Pathway as Image</a
  >
</li>
{% if meta.enabled_features.IUCLID_EXPORT and meta.user.username != 'anonymous' %}
  <li>
    <a class="button" href="/api/v1/pathway/{{ pathway.uuid }}/export/iuclid">
      <i class="glyphicon glyphicon-floppy-save"></i> Download Pathway as IUCLID
      (.i6z)</a
    >
  </li>
{% endif %}
<li>
  <a
    role="button"
    onclick="document.getElementById('engineer_pathway_modal').showModal(); return false;"
  >
    <i class="glyphicon glyphicon-cog"></i> Engineer Pathway</a
  >
</li>
{% if meta.can_edit %}
  <li>
    <a
      class="button"
      onclick="document.getElementById('identify_missing_rules_modal').showModal(); return false;"
    >
      <i class="glyphicon glyphicon-question-sign"></i> Identify Missing
      Rules</a
    >
  </li>
  <li role="separator" class="divider h-px"></li>
  <li>
    <a
      class="button"
      onclick="document.getElementById('edit_pathway_modal').showModal(); return false;"
    >
      <i class="glyphicon glyphicon-edit"></i> Edit Pathway</a
    >
  </li>
  <li>
    <a
      class="button"
      onclick="
      const modal = document.getElementById('edit_pathway_node_modal');
      modal.showModal();
      window.dispatchEvent(new Event('modal-opened'));
      return false;
      "
    >
      <i class="glyphicon glyphicon-edit"></i> Edit Compound</a
    >
  </li>
  <li>
    <a
      role="button"
      onclick="document.getElementById('set_scenario_modal').showModal(); return false;"
    >
      <i class="glyphicon glyphicon-plus"></i> Set Scenarios</a
    >
  </li>
  <li>
    <a
      role="button"
      onclick="document.getElementById('set_aliases_modal').showModal(); return false;"
    >
      <i class="glyphicon glyphicon-plus"></i> Set Aliases</a
    >
  </li>
  <li role="separator" class="divider h-px"></li>
  <li>
    <a
      class="button"
      onclick="
      const modal = document.getElementById('delete_pathway_node_modal');
      modal.showModal();
      window.dispatchEvent(new Event('modal-opened'));
      return false;
      "
    >
      <i class="glyphicon glyphicon-trash"></i> Delete Compound</a
    >
  </li>
  <li>
    <a
      class="button"
      onclick="
      const modal = document.getElementById('delete_pathway_edge_modal');
      modal.showModal();
      window.dispatchEvent(new Event('modal-opened'));
      return false;
      "
    >
      <i class="glyphicon glyphicon-trash"></i> Delete Reaction</a
    >
  </li>
  <li>
    <a
      class="button"
      onclick="document.getElementById('generic_delete_modal').showModal(); return false;"
    >
      <i class="glyphicon glyphicon-trash"></i> Delete Pathway</a
    >
  </li>
{% endif %}
