{% extends 'base.html' %}
{% from "macros.html" import render_field, render_included_field %}

{% block title %}Edit License for Current Tenant{% endblock %}

{% block content_title %}Edit License for Current Tenant{% endblock %}
{% block content_description %}Edit a License based on the selected License Tier for the current Tenant{% endblock %}

{% block content %}
    <form method="post">
        {{ form.hidden_tag() }}
        {% set main_fields = ['start_date', 'nr_of_periods', 'currency', 'yearly_payment', 'basic_fee'] %}
        {% for field in form %}
            {{ render_included_field(field, readonly_fields=ext_readonly_fields + ['currency'], include_fields=main_fields) }}
        {% endfor %}
        <!-- Nav Tabs -->
        <div class="row mt-5">
            <div class="col-lg-12">
                <div class="nav-wrapper position-relative end-0">
                    <ul class="nav nav-pills nav-fill p-1" role="tablist">
                        <li class="nav-item" role="presentation">
                            <a class="nav-link mb-0 px-0 py-1 active" data-bs-toggle="tab" href="#storage-tab" role="tab" aria-controls="model-info" aria-selected="true">
                                Storage
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link mb-0 px-0 py-1" data-bs-toggle="tab" href="#embedding-tab" role="tab" aria-controls="license-info" aria-selected="false">
                                Embedding
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link mb-0 px-0 py-1" data-bs-toggle="tab" href="#interaction-tab" role="tab" aria-controls="chunking" aria-selected="false">
                                Interaction
                            </a>
                        </li>
                    </ul>
                </div>
                <div class="tab-content tab-space">
                    <!-- Storage Tab -->
                    <div class="tab-pane fade show active" id="storage-tab" role="tabpanel">
                        {% set storage_fields = ['max_storage_tokens', 'additional_storage_token_price', 'additional_storage_bucket'] %}
                        {% for field in form %}
                            {{ render_included_field(field, readonly_fields=ext_readonly_fields, include_fields=storage_fields) }}
                        {% endfor %}
                    </div>
                    <!-- Embedding Tab -->
                    <div class="tab-pane fade" id="embedding-tab" role="tabpanel">
                        {% set embedding_fields = ['included_embedding_tokens', 'additional_embedding_token_price', 'additional_embedding_bucket'] %}
                        {% for field in form %}
                            {{ render_included_field(field, readonly_fields=ext_readonly_fields, include_fields=embedding_fields) }}
                        {% endfor %}
                    </div>
                    <!-- Interaction Tab -->
                    <div class="tab-pane fade" id="interaction-tab" role="tabpanel">
                        {% set interaction_fields = ['included_interaction_tokens', 'additional_interaction_token_price', 'additional_interaction_bucket'] %}
                        {% for field in form %}
                            {{ render_included_field(field, readonly_fields=ext_readonly_fields, include_fields=interaction_fields) }}
                        {% endfor %}
                    </div>
                </div>
            </div>
        </div>

        <button type="submit" class="btn btn-primary">Save License</button>
    </form>
{% endblock %}


{% block content_footer %}

{% endblock %}
