{% extends "schedules/_layout.html" %}
{% from "_macros.html" import icon %}
{% set section = "scheduled" %}

{% block title %}{{ schedule.title }} - {{ brand.name }}{% endblock %}
{% block heading %}{{ schedule.title }}{% endblock %}
{% block actions %}
<a class="btn btn--sm" href="/chat/{{ schedule.chat_id }}">Open its chat</a>
{% endblock %}

{% block schedules_content %}
<form method="post" action="/api/schedules/{{ schedule.id }}" class="card">
  {% include "schedules/_form.html" %}
  <div class="btn-row">
    <button class="btn btn--primary" type="submit">Save</button>
    <a class="btn" href="/scheduled">Cancel</a>
  </div>
</form>

<div class="card">
  <h2 class="card__title">Remove</h2>
  <p class="card__lede">
    Stops it running. Its chat is kept by default and becomes an ordinary one,
    so the transcript of everything it has already done stays where it is.
  </p>
  <form method="post" action="/api/schedules/{{ schedule.id }}/delete"
        data-confirm="Remove this schedule? It will stop running.">
    <label class="checkbox">
      <input type="checkbox" name="keep_chat" value="1" checked>
      <span>Keep its chat</span>
    </label>
    <button class="btn btn--danger btn--sm" type="submit">
      {{ icon("trash", "icon--sm") }} Remove schedule
    </button>
  </form>
</div>
{% endblock %}
