{% load i18n %}
{% load django_bootstrap5 %}
{% load bootstrap_icons %}
{% if request.user.is_superuser %}
    {% if state != 0 %}
        {% if pool == "iso" %}
            <a href="#IsoUpload" class="btn btn-success float-end" data-bs-toggle="modal">
                <span aria-hidden="true">{% bs_icon 'plus-circle-fill' %} </span>
            </a>

            <!-- Modal Upload -->
            <div class="modal fade" id="IsoUpload" tabindex="-1" role="dialog" aria-labelledby="IsoUploadLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h5 class="modal-title">{% trans "Upload ISO Image" %}</h5>
                            <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                        </div>
                        <div class="modal-body">
                            <form enctype="multipart/form-data" method="post" role="form" aria-label="Upload iso form">{% csrf_token %}
                                <div class="row">
                                    <label class="col-sm-3 col-form-label">{% trans "Name" %}</label>
                                    <div class="col-sm-6">
                                        <input type="file" name="file" id="id_file">
                                    </div>
                                </div>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{% trans "Close" %}</button>
                            <button type="submit" class="btn btn-primary" name="iso_upload">{% trans "Upload" %}</button>
                        </div>
                            </form>

                    </div> <!-- /.modal-content -->
                </div> <!-- /.modal-dialog -->
            </div> <!-- /.modal -->
        {% else %}
            <a href="#AddImage" class="btn btn-success float-end" data-bs-toggle="modal">
                <span aria-hidden="true">{% bs_icon 'plus-circle-fill' %} </span>
            </a>

            <!-- Modal Image -->
            <div class="modal fade" id="AddImage" tabindex="-1" role="dialog" aria-labelledby="AddImageLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h5 class="modal-title">{% trans "Add New Volume" %}</h5>
                            <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                        </div>
                        <div class="modal-body">
                            <form action="{% url 'create_volume' compute_id pool %}" id="create-volume" method="post" role="form" aria-label="Create volume to storage form">
                                {% csrf_token %}
                                {% bootstrap_form form layout='horizontal' %}
                            </form>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{% trans "Close" %}</button>
                            <button type="submit" form="create-volume" class="btn btn-primary">{% trans "Create" %}</button>
                        </div>
                    </div> <!-- /.modal-content -->
                </div> <!-- /.modal-dialog -->
            </div> <!-- /.modal -->
        {% endif %}
    {% endif %}
{% endif %}