{% from "macros/model-form.html" import inner_model_form %}
{% from "macros/model-table.html" import model_table %}
<p class="label">Torrent details:</p>
{{ model_table(id="torrent-table", model=torrent) }}

<form id='upload-form' class="form">
    {{ inner_model_form(id="upload-form", model=model, exclude=["torrent_infohash", "part_slugs"]) }}
    <div class="form-item">
        <label for="upload-form-torrent_infohash" class="form-label">Torrent Infohash</label>
        <input id="upload-form-torrent_infohash"
               class="form-input"
               type="text"
               name="torrent_infohash"
               value="{{ torrent.infohash }}"
               readonly="readonly">
    </div>
    {% if parts %}
    {% for part in parts %}
    <input name="part_slugs" value="{{ part }}" type="hidden" readonly="readonly">
    {% endfor %}
    {% endif %}

</form>

<button
    class="form-button"
    type="submit"
    name="upload"
    hx-post="{{ config.api_prefix }}/datasets/{{ dataset.slug }}/uploads/form{% if parts %}?{{ parts | join('=on&') }}=on{% endif %}"
    hx-include="#upload-form"
>Submit</button>

