{% import 'macros/form.html' as form %}

<div class="">
    <form class="form-control border-0 shadow-none p-0" hx-post="{{ h.url_for('selftools_htmx.selftools_db_update') }}" hx-trigger="submit" hx-target="#db-update-resp" hx-swap="innerHTML">
        <div class="mb-3">
            <div class="info-block mb-2">
                <i class="fa fa-info-circle"></i>
                {{ _('If Dataset is being updated or Resource, make sure to re-index the Dataset afterwards.') }}
            </div>
        </div>
        <div>
            {{ form.select('model', label=_('Model'), options=extras.model_options, error='') }}
        </div>
        <div class="my-3">
            <b>{{ _('UPDATE') }}</b>
        </div>
        <div class="row">
            <div class="col-lg-6">
                <label for="">Field</label>
                <input type="text" name="field" id="" class="form-control" required>                
            </div>
            <div class="col-lg-6">
                <label for="value">Value</label>
                <input type="text" name="value" id="" class="form-control" required>                
            </div>
        </div>
        <div class="my-3">
            <b>{{ _('WHERE') }}</b>
        </div>
        <div>
            <div class="row">
                <div class="col-lg-6">
                    <label for="solr_q">WHERE Field</label>
                    <input type="text" name="where_field" id="" class="form-control" required>                
                </div>
                <div class="col-lg-6">
                    <label for="value">WHERE Value</label>
                    <input type="text" name="where_value" id="" class="form-control" required>                
                </div>
            </div>    
        </div>
        <div class="mt-3 mb-3">
            <label for="limit">Limit</label>
            <input type="number" name="limit" min="1" max="{{ h.get_operations_limit() }}" step="1" value="1" class=""  required />
        </div>

        <button type="button" class="btn btn-dark mt-2" data-bs-toggle="modal" data-bs-target="#db-update-confirmation">
            Submit
        </button>

        {% snippet "selftools/snippets/confirmation.html", modal_id='db-update-confirmation', modal_label_id='db-update-label-id' %}
    </form>
</div>

<div id="db-update-resp" class="bg-light p-3 border rounded mt-3">Output here...</div>
