{% import 'macros/links.html' as links %}
<tr class="{{ styles.tr }}">
  <td class="p-2 align-top w-1/3">
    <div class="font-medium">
      {% call links.link(
        url_for(
          'calendars.calendar.day.calendar_entries.calendar_entry.ticket_types.ticket_type.get',
          slug=post.slug,
          calendar_slug=calendar.slug,
          year=year,
          month=month,
          day=day,
          entry_id=entry.id,
          ticket_type_id=tt.id
        ),
        hx_select_search,
        aclass=styles.pill
      ) %}
        {{ tt.name }}
      {% endcall %}
    </div>
  </td>
  <td class="p-2 align-top w-1/4">
    £{{ ('%.2f'|format(tt.cost)) if tt.cost is not none else '0.00' }}
  </td>
  <td class="p-2 align-top w-1/4">
    {{ tt.count }}
  </td>
  <td class="p-2 align-top w-1/6">
    <button
      class="{{styles.action_button}}"
      data-confirm="true"
      data-confirm-title="Delete ticket type?"
      data-confirm-text="This action cannot be undone."
      data-confirm-icon="warning"
      data-confirm-confirm-text="Yes, delete it"
      data-confirm-cancel-text="Cancel"
      data-confirm-event="confirmed"
      hx-delete="{{ url_for('calendars.calendar.day.calendar_entries.calendar_entry.ticket_types.ticket_type.delete',
                            slug=post.slug,
                            calendar_slug=calendar.slug,
                            year=year,
                            month=month,
                            day=day,
                            entry_id=entry.id,
                            ticket_type_id=tt.id) }}"
      hx-target="#tickets-table"
      hx-select="#tickets-table"
      hx-swap="outerHTML"
      hx-headers='{"X-CSRFToken": "{{ csrf_token() }}"}'
      hx-trigger="confirmed"
      type="button"
    >
      <i class="fa-solid fa-trash"></i>
    </button>
  </td>
</tr>
