{% extends "modal_base.html" %}

{% block form_attributes %}
hx-patch="/knowledge-entity/{{entity.id}}"
hx-target="#entity-list"
hx-swap="outerHTML"
{% endblock %}

{% block modal_content %}
<h3 class="text-xl font-extrabold tracking-tight">Edit Entity</h3>

<div class="form-control">
  <label class="w-full">
    <div class="text-xs uppercase tracking-wide opacity-70 mb-1">Name</div>
    <input type="text" name="name" value="{{ entity.name }}" class="nb-input w-full">
  </label>
</div>

<div class="form-control relative" style="margin-top: -1.5rem;">
  <div class="absolute !left-3 !top-2.5 z-50 p-0.5 bg-base-100 text-xs">Type</div>
      <select name="entity_type" class="nb-select w-full">
    <option disabled>You must select a type</option>
         {% for et in entity_types %}
          <option value="{{ et }}" {% if entity.entity_type==et %}selected{% endif %}>{{ et }}</option>
         {% endfor %}
  </select>
</div>

<input type="text" name="id" value="{{ entity.id }}" class="hidden">

<div class="form-control">
  <label class="w-full">
    <div class="text-xs uppercase tracking-wide opacity-70 mb-1">Description</div>
    <textarea name="description" class="nb-input w-full h-32">{{ entity.description }}</textarea>
  </label>
</div>
{% endblock %}

{% block primary_actions %}
<button type="submit" class="nb-btn nb-cta">Save Changes</button>
{% endblock %}
