{% load i18n %}
{% if messages %}
    <script>
        setTimeout(function () {
            $('#dynamicCreateModalHeader').children(".oh-modal__close--custom").click();
            reloadMessage();
        }, 500);
    </script>
{% endif %}
<div class="oh-modal__dialog-header" id="dynamicCreateModalHeader">
    <h2 class="oh-modal__dialog-title" id="addAssetReportLabel">{% trans 'Add Asset Report' %}</h2>
    <button type="button" class="oh-modal__close--custom"
        onclick="$(this).closest('.oh-modal--show').removeClass('oh-modal--show');"><ion-icon name="close-outline"
            role="img" aria-label="close outline"></ion-icon>
    </button>
</div>
<div class="oh-modal__dialog-body">
    <form id="add-form" hx-post="{% url 'add-asset-report' %}" hx-target="#dynamicCreateModalTarget"
        hx-encoding="multipart/form-data">
        {% csrf_token %}
        <input type="text" hidden name="asset_id" value="{{ asset_id }}" />
        <div class="oh-profile-section pt-0">
            <div class="row">
                <div class="col-12 col-sm-12 col-md-4 col-lg-6">
                    <div class="oh-input__group">
                        <label class="oh-input__label" for="{{ asset_report_form.title.id_for_label }}">
                            {% trans 'Title' %}
                        </label>
                        {{ asset_report_form.title }}
                        {{ asset_report_form.title.errors }}
                    </div>
                </div>
                <div class="col-12 col-sm-12 col-md-4 col-lg-6">
                    <div class="oh-input__group">
                        <label class="oh-input__label" for="{{ asset_report_form.asset_id.id_for_label }}">
                            {% trans 'Asset' %}
                        </label>
                        {{ asset_report_form.asset_id }}
                        {{ asset_report_form.asset_id.errors }}
                    </div>
                </div>
            </div>
            <div class="oh-input__group">
                <label class="oh-input__label" for="fileUpload">{% trans 'File' %}</label>
                <input name="file" multiple="True" type="file" id="fileUpload" />
            </div>
            <div class="oh-modal__dialog-footer p-0">
                <button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow">
                    {% trans "Save" %}
                </button>
            </div>
        </div>
    </form>
</div>
