{% if order.status == 'active' %}
<div class="card mb-4">
    <div class="card-header">
        <h2>{{ order.title }}</h2>
    </div>
    <div class="card-body">
        <h3>{{ 'API key details'|trans }}</h3>
        <table class="table table-striped table-bordered table-sm">
            <tbody>
                <tr>
                    <td>{{ 'API key'|trans }}</td>
                    <td>
                        <strong>{{ service.api_key }}</strong>
                    </td>
                </tr>
            </tbody>
        </table>

        <h4>{{ 'Reset API key'|trans }}</h4>
        <div class="block">
            <button class="btn btn-primary" type="button" id="license-apikey">{{ 'Reset'|trans }}</button>
        </div>
    </div>
</div>

<script type="text/javascript">
    document.querySelector('#license-apikey').addEventListener('click', (event) => {
        event.preventDefault();

        if (confirm("{{ 'Are you sure?'|trans }}")) {
            API.client.post('serviceapikey/reset', { order_id: {{ order.id }} }, function(result) {
                bb.reload();
            });
        }
    });
</script>
{% endif %}
