<div class="help">
    <h2>{{ 'License details'|trans }}</h2>
</div>
{% set service = admin.order_service({ "id": order.id }) %}
<table class="tableStatic wide">
    <tbody>
        <tr class="noborder">
            <td style="width: 30%;">
                {{ 'Key'|trans }}
            </td>
            <td>
                <strong>{{ service.license_key }}</strong>
            </td>
        </tr>

        <tr>
            <td>
                {{ 'Plugin'|trans }}
            </td>
            <td>{{ service.plugin }}</td>
        </tr>
        
        <tr>
            <td>
                {{ 'Last ping'|trans }}
            </td>
            <td>{{ service.pinged_at|bb_date }} ({{ service.pinged_at|timeago }} ago)</td>
        </tr>

    </tbody>

    <tfoot>
        <tr>
            <td colspan="2">
                <div class="aligncenter">
                    {{ order_actions }}
                </div>
            </td>
        </tr>
    </tfoot>
</table>

<form method="post" action="{{ 'api/admin/servicelicense/update'|link }}" class="mainForm api-form" data-api-msg="License updated">
    <fieldset>
        <legend>{{ 'License data'|trans }}</legend>
        <div class="rowElem">
            <label>{{ 'License Key'|trans }}: </label>
            <div class="formRight">
                <textarea type="text" cols="" rows="5" name="license_key" required="required" >{{ request.license_key|default(service.license_key) }}</textarea>
            </div>
            <div class="fix"></div>
        </div>
        <div class="rowElem">
            <label>{{ 'Plugin'|trans }}: </label>
            <div class="formRight">
                <input type="text" name="plugin" value="{{ request.plugin|default(service.plugin) }}" required="required" >
            </div>
            <div class="fix"></div>
        </div>
    </fieldset>
    <fieldset>
        <legend>License validation rules</legend>
        <div class="rowElem">
            <label>{{ 'Validate IP'|trans }}:</label>
            <div class="formRight">
                <input type="radio" name="validate_ip" value="1"{% if service.validate_ip  %} checked="checked"{% endif %}/><label>Yes</label>
                <input type="radio" name="validate_ip" value="0"{% if not service.validate_ip %} checked="checked"{% endif %} /><label>No</label>
            </div>
            <div class="fix"></div>
        </div>
        <div class="rowElem noborder">
            <label class="">{{ 'Valid IPs (one per line)'|trans }}:</label>
            <div class="formRight">
                <textarea name="ips" cols="" rows="5">{% for v in service.ips %}{{ v }}{{constant("PHP_EOL")}}{% endfor %}</textarea>
            </div>
            <div class="fix"></div>
        </div>

        <div class="rowElem">
            <label>{{ 'Validate host'|trans }}:</label>
            <div class="formRight">
                <input type="radio" name="validate_host" value="1"{% if service.validate_host  %} checked="checked"{% endif %}/><label>Yes</label>
                <input type="radio" name="validate_host" value="0"{% if not service.validate_host %} checked="checked"{% endif %} /><label>No</label>
            </div>
            <div class="fix"></div>
        </div>
        <div class="rowElem noborder">
            <label class="">{{ 'Valid hosts (one per line)'|trans }}:</label>
            <div class="formRight">
                <textarea name="hosts" cols="" rows="5">{% for v in service.hosts %}{{ v }}{{constant("PHP_EOL")}}{% endfor %}</textarea>
            </div>
            <div class="fix"></div>
        </div>

        <div class="rowElem">
            <label>{{ 'Validate path'|trans }}:</label>
            <div class="formRight">
                <input type="radio" name="validate_path" value="1"{% if service.validate_path  %} checked="checked"{% endif %}/><label>Yes</label>
                <input type="radio" name="validate_path" value="0"{% if not service.validate_path %} checked="checked"{% endif %} /><label>No</label>
            </div>
            <div class="fix"></div>
        </div>
        <div class="rowElem noborder">
            <label class="">{{ 'Valid paths (one per line)'|trans }}:</label>
            <div class="formRight">
                <textarea name="paths" cols="" rows="5">{% for v in service.paths %}{{ v }}{{constant("PHP_EOL")}}{% endfor %}</textarea>
            </div>
            <div class="fix"></div>
        </div>
        
        <div class="rowElem">
            <label>{{ 'Validate version'|trans }}:</label>
            <div class="formRight">
                <input type="radio" name="validate_version" value="1"{% if service.validate_version  %} checked="checked"{% endif %}/><label>Yes</label>
                <input type="radio" name="validate_version" value="0"{% if not service.validate_version %} checked="checked"{% endif %} /><label>No</label>
            </div>
            <div class="fix"></div>
        </div>
        <div class="rowElem noborder">
            <label class="">{{ 'Valid versions (one per line)'|trans }}:</label>
            <div class="formRight">
                <textarea name="versions" cols="" rows="5">{% for v in service.versions %}{{ v }}{{constant("PHP_EOL")}}{% endfor %}</textarea>
            </div>
            <div class="fix"></div>
        </div>
    </fieldset>

    <fieldset>
        <input type="submit" value="{{ 'Update'|trans }}" class="greyishBtn submitForm" />
        <input type="hidden" name="order_id" value="{{ order.id }}"/>
    </fieldset>
</form>
