{% import "macros/buttons.html" as buttons %}
{% import "macros/icons.html" as icons %}

{% extends "admin/webhooks/list.html" %}

{% block head_title_content %}{{ webhook.url }} · {{ super() }}{% endblock %}

{% set open_aside = true %}

{% block aside %}
<h2 class="text-slate-800 font-semibold text-center mb-6">{{ webhook.url }}</h2>
<div class="mt-6">
  <div class="text-sm font-semibold text-slate-800 mb-1">Events</div>
  <ul>
    {% for event in webhook.events %}
      <li class="flex items-center justify-between py-3 border-b border-slate-200">
        <div class="text-sm text-slate-800 ml-2 truncate">{{ event }}</div>
      </li>
    {% endfor %}
  </ul>
</div>
<div class="mt-6">
  <a
    href="{{ url_for('dashboard.webhooks:update', id=webhook.id) }}"
    class="btn w-full border-slate-200 hover:border-slate-300"
    hx-boost="true"
    hx-target="#modal"
    _="install OpenModal"
  >
    Edit Webhook
  </a>
</div>
<div class="mt-6">
  <button
    type="button"
    class="btn w-full bg-yellow-500 hover:bg-yellow-600 text-white"
    hx-post="{{ url_for('dashboard.webhooks:secret', id=webhook.id) }}"
    hx-trigger="click"
    hx-target="#modal"
    _="install OpenModal"
  >
    Regenerate secret
  </button>
</div>
<div class="mt-6">
  <a
    href="{{ url_for('dashboard.webhooks:delete', id=webhook.id) }}"
    class="btn w-full bg-red-500 hover:bg-red-600 text-white"
    hx-boost="true"
    hx-target="#modal"
    _="install OpenModal"
  >
    Delete Webhook
  </a>
</div>
{% endblock %}
