{% from "components/delete_confirmation.html" import DeleteConfirmation %}
{% from "components/alert.html" import Alert %}
{% from "components/modal.html" import Modal %}

<section id="primary-point-of-contact" class="panel">
  <div class="panel__content">
    <h2>{{ "fragments.delete_portfolio.title" | translate }}</h2>
    <p>{{ "fragments.delete_portfolio.subtitle" | translate }}</p>


    <div
      class="usa-button-primary {% if applications_count == 0 %}button-danger{% else %}usa-button-disabled{% endif %}"
      {% if applications_count == 0 %}v-on:click="openModal('delete_portfolio')"{% endif %}
    >
      {{ "common.deactivate" | translate }}
    </div>
  </div>
</section>

{% call Modal(name="delete_portfolio") %}
  <h1>
    {{ 'fragments.delete_portfolio.title' | translate }}
  </h1>
  <hr>
  {{
    Alert(
      level="warning",
      title=('components.modal.destructive_title' | translate),
      message=('components.modal.destructive_message' | translate({"resource": "portfolio"})),
    )
  }}

  {{
    DeleteConfirmation(
      modal_id='delete_portfolio',
      delete_text='Deactivate',
      delete_action=url_for('portfolios.delete_portfolio', portfolio_id=portfolio.id),
      form=portfolio_form,
      confirmation_text="deactivate",
    )
  }}
{% endcall %}
