<div class="row">
    <div class="col-md-12">
        <table class="table table-bordered table-striped">
            {% 
                local badge_class = ternary(info["pro.has_valid_license"], 'bg-success', 'bg-danger') 
                local badge_title = ternary(info["pro.has_valid_license"], i18n("license_page.valid"), i18n("license_page.not_valid"))
            %}
            {% if info["pro.license_type"] then %}
                <tr>
                    <th>{{ i18n("license_page.status") }}</th>
                    <td>
                        <span class="badge {{ badge_class }}">{{ badge_title }}</span> {# -- info["pro.license_type"] #}
                    </td>
                </tr>
            {% end %}
            <tr>
                <th>SystemId</th>
                <td>
                    <a class="ntopng-external-link" href="{* license.systemIdHref *}" target="_blank">{{ info["pro.systemid"] }} <i class='fas fa-external-link-alt'></i></a>
                    <br>
                    {% if not(info["pro.forced_community"]) then %}
                    <small>
                        {* 
                            i18n("about.licence_generation", {
                                purchase_url='http://shop.ntop.org/',
                                universities_url='http://www.ntop.org/support/faq/do-you-charge-universities-no-profit-and-research/'
                            })
                        *}
                    </small>
                    {% end %}
                </td>
            </tr>
            <tr>
                <th>{{ i18n("about.licence") }}</th>
                <td>
                    {% if license.is_admin then %}
                        {% if (info["pro.use_redis_license"] or (info["pro.license_encoded"] == "")) then %}
                            <form class="form" method="post" id="license-form" onsubmit="return trimLicenceSpaces();">
                                <div class="mb-3 w-100">
                                    <input type="hidden" name="csrf" value="{{ ntop.getRandomCSRFValue() }}">
                                    <textarea style="resize: none;" pattern="{* getLicensePattern() *}" class="form-control w-50" rows="7" id="ntopng_license" name="ntopng_license" placeholder="{{ i18n("about.specify_licence") }}">{{ info["ntopng.license"] }}</textarea>
                                </div>
                                <button type="submit" class="btn btn-primary">
                                    <i class="fas fa-save"></i> {{ i18n("about.save_licence") }}
                                </button>
                            </form>
                        {% else %}
                            {% if info["pro.license_encoded"] then %}
			        <textarea readonly style="resize: none;" class="form-control w-50" rows="7">{{ info["pro.license_encoded"] }}</textarea>
                            {% end %}
                        {% end %}
                    {% end %}
                </td>
            </tr>
            {% if (info["pro.license_ends_at"] ~= nil and info["pro.license_days_left"] ~= nil) then %}
            <tr>
                <th>{{i18n("about.maintenance")}}</th>
                <td>
                    {*
                        i18n("about.maintenance_left", {
                            _until = format_utils.formatEpoch(info["pro.license_ends_at"]),
                            days_left = info["pro.license_days_left"]
                        })
                    *}
                </td>
            </tr>
            {% end %}
        </table>
        {* ui_utils.render_notes({{content = i18n("license_page.agreement") .. ': <a class="ntopng-external-link" target="_blank" href="{{ license.external_link }}">EULA <i class="fas fa-external-link-alt"></i></a>' }}) *}
    </div>
</div>
<script>
    function trimLicenceSpaces() {
        $("#ntopng_license").val($("#ntopng_license").val().trim());
        return true;
    }
 </script>