<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 href="{* license.systemIdHref *}" target="_blank">{{ info["pro.systemid"] }} <i class='fas fa-external-link-alt'></i></a>

<button style="" class="btn btn-sm border ms-1" data-placement="bottom" id="btn-copy-system-id" data="{* license.systemId *}"><i class="fas fa-copy"></i></button>
<script>$('#btn-copy-system-id').click(function(e) { NtopUtils.copyToClipboard($(this).attr('data'), '{* i18n("copied") *}', '{* i18n("request_failed_message") *}', $(this));});</script>

                    <br>
                    {% if not(info["pro.forced_community"]) then %}
                    <small>
                        {* 
                            i18n("about.licence_generation", {
                                purchase_url='https://shop.ntop.org/',
                                universities_url='https://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 ntop.isWindows() 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>
                        {% end %}
                    {% else %}
		        {% if license.license ~= "" then %}
		          <textarea readonly style="resize: none;" class="form-control w-50" rows="7">{{ info["pro.license_encoded"] }}</textarea>
                        {% else %}
   		          {{ i18n("about.licence_save_path") }}
                        {% 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>
                    {% if info["pro.license_days_left"] and info["pro.license_days_left"] > 0 then %}
                    {*
                        i18n("about.maintenance_left", {
                            _until = format_utils.formatEpoch(info["pro.license_ends_at"]),
                            days_left = info["pro.license_days_left"]
                        })
                    *}
                    {% else %}
                    {*
                        i18n("about.maintenance_expired_no_days_left")
                    *}
                    {% end %}
                </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>
