<div class="help">
    <h5>{{ 'Centova Cast order details'|trans }}</h5>
    <p>{{ 'Changing settings does not send actions to CentovaCast server.'|trans }}</p>
</div>

<form method="post" action="admin/servicecentovacast/update" class="mainForm api-form save" data-api-msg="Service updated">
    <fieldset>
        <div class="rowElem noborder">
            <label>{{ 'Server'|trans }}:</label>
            <div class="formRight">
                <a href="{{ 'extension/settings/servicecentovacast'|alink }}">{{service.server_id}}</a>
            </div>
            <div class="fix"></div>
        </div>
        
        <div class="rowElem">
            <label>{{ 'Username'|trans }}:</label>
            <div class="formRight">
                <input type="text" name="username" value="{{ service.username }}" placeholder=""/>
            </div>
            <div class="fix"></div>
        </div>

        <div class="rowElem">
            <label>{{ 'Password'|trans }}:</label>
            <div class="formRight">
                <input type="text" name="pass" value="{{ service.pass }}" placeholder=""/>
            </div>
            <div class="fix"></div>
        </div>

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

{% set account = admin.servicecentovacast_getaccount({ "order_id": order.id, "try": 1 }) %}

<div class="help">
    <h5>{{ 'Reconfigure'|trans }}</h5>
    <p>{{ 'Changing CentovaCast server settings.'|trans }}</p>
</div>

<form method="post" action="admin/servicecentovacast/reconfigure" class="mainForm api-form save" data-api-msg="Service updated">
    <fieldset>
        <div class="rowElem noborder">
            <label>{{ 'Hostname'|trans }}:</label>
            <div class="formRight">
                <input type="text" name="hostname" value="{{ account.hostname }}" placeholder=""/>
            </div>
            <div class="fix"></div>
        </div>
        
        <div class="rowElem">
            <label>{{ 'IP Address'|trans }}:</label>
            <div class="formRight">
                <input type="text" name="ipaddress" value="{{ account.ipaddress }}" placeholder=""/>
            </div>
            <div class="fix"></div>
        </div>
        
        <div class="rowElem">
            <label>{{ 'Port'|trans }}:</label>
            <div class="formRight">
                <input type="text" name="port" value="{{ account.port }}" placeholder=""/>
            </div>
            <div class="fix"></div>
        </div>
        
        <div class="rowElem">
            <label>{{ 'Max clients'|trans }}:</label>
            <div class="formRight">
                <input type="text" name="maxclients" value="{{ account.maxclients }}" placeholder=""/>
            </div>
            <div class="fix"></div>
        </div>
        
        <div class="rowElem">
            <label>{{ 'Source password'|trans }}:</label>
            <div class="formRight">
                <input type="text" name="sourcepassword" value="{{ account.sourcepassword }}" placeholder=""/>
            </div>
            <div class="fix"></div>
        </div>
        
        {#
        <div class="rowElem">
            <label>{{ 'adminpassword'|trans }}:</label>
            <div class="formRight">
                <input type="text" name="adminpassword" value="{{ service.pass }}" placeholder=""/>
            </div>
            <div class="fix"></div>
        </div>
        #}
        <div class="rowElem">
            <label>{{ 'Max BitRate'|trans }}:</label>
            <div class="formRight">
                <input type="text" name="maxbitrate" value="{{ account.maxbitrate }}" placeholder=""/>
            </div>
            <div class="fix"></div>
        </div>
        
        <div class="rowElem">
            <label>{{ 'Transfer limit'|trans }}:</label>
            <div class="formRight">
                <input type="text" name="transferlimit" value="{{ account.transferlimit }}" placeholder=""/>
            </div>
            <div class="fix"></div>
        </div>
        
        <div class="rowElem">
            <label>{{ 'Disk quota'|trans }}:</label>
            <div class="formRight">
                <input type="text" name="diskquota" value="{{ account.diskquota }}" placeholder=""/>
            </div>
            <div class="fix"></div>
        </div>
        
        <div class="rowElem">
            <label>{{ 'Title'|trans }}:</label>
            <div class="formRight">
                <input type="text" name="title" value="{{ account.title }}" placeholder=""/>
            </div>
            <div class="fix"></div>
        </div>
        
        <div class="rowElem">
            <label>{{ 'Organization'|trans }}:</label>
            <div class="formRight">
                <input type="text" name="organization" value="{{ account.organization }}" placeholder=""/>
            </div>
            <div class="fix"></div>
        </div>
        
        <div class="rowElem">
            <label>{{ 'Email'|trans }}:</label>
            <div class="formRight">
                <input type="text" name="email" value="{{ account.email }}" placeholder=""/>
            </div>
            <div class="fix"></div>
        </div>
        
        <div class="rowElem">
            <label>{{ 'URL'|trans }}:</label>
            <div class="formRight">
                <input type="text" name="url" value="{{ account.url }}" placeholder=""/>
            </div>
            <div class="fix"></div>
        </div>
        
        <div class="rowElem">
            <label>{{ 'Auto rebuild list'|trans }}:</label>
            <div class="formRight">
                <input type="radio" name="autorebuildlist" value="0" {% if account.autorebuildlist == 0 %}checked{% endif %}/><label>Do not automatically rebuild the playlist (unless no playlist exists)</label>
                <div class="clear"></div>
                <input type="radio" name="autorebuildlist" value="1" {% if account.autorebuildlist == 1 %}checked{% endif %}/><label>Automatically rebuild the playlist</label>
                <div class="clear"></div>
            </div>
            <div class="fix"></div>
        </div>
        
        {#
        <div class="rowElem">
            <label>{{ 'usesource'|trans }}:</label>
            <div class="formRight">
                <input type="radio" name="usesource" value="0"{% if account.usesource == 0 %}checked{% endif %}/><label>Use of server-side streaming source is prohibited (off-site source must be provided)</label>
                <div class="clear"></div>
                <input type="radio" name="usesource" value="1"{% if account.usesource == 1 %}checked{% endif %}/><label>Use of server-side streaming source is permitted, and enabled by default</label>
                <div class="clear"></div>
                <input type="radio" name="usesource" value="2"{% if account.usesource == 2 %}checked{% endif %}/><label>Use of server-side streaming source is permitted, but disabled by default</label>
                <div class="clear"></div>
            </div>
            <div class="fix"></div>
        </div>
        
        <div class="rowElem">
            <label>{{ 'introfile'|trans }}:</label>
            <div class="formRight">
                <input type="text" name="introfile" value="{{ account.introfile }}" placeholder=""/>
            </div>
            <div class="fix"></div>
        </div>
        
        <div class="rowElem">
            <label>{{ 'fallbackfile'|trans }}:</label>
            <div class="formRight">
                <input type="text" name="fallbackfile" value="{{ account.fallbackfile }}" placeholder=""/>
            </div>
            <div class="fix"></div>
        </div>
        #}
        
        <input type="hidden" name="order_id" value="{{ order.id }}" />
        <input type="submit" value="{{ 'Update'|trans }}" class="greyishBtn submitForm" />
    </fieldset>
</form>

<div class="help">
    <h5>{{ 'Account details'|trans }}</h5>
</div>

<table class="tableStatic wide">
    <thead>
        <tr>
            <th>{{ 'Parameter'|trans }}</th>
            <th>{{ 'Value'|trans }}</th>
        </tr>
    </thead>

    <tbody>
    {% for k,var in account %}
        {% if var|length == 0 or k == 'introfile' or k == 'fallbackfile' or k == 'mountpoints' %}
        {% elseif var|keys|length > 0 %}
            {% for subkey,subvalue in var %}
                <tr>
                    <td>{{ k }}.{{subkey}}</td>
                    <td>{{ subvalue }}</td>
                </tr>
            {% endfor %}
        
        {% else %}
            <tr>
                <td>{{ k|title }}</td>
                <td>{{ var }}</td>
            </tr>
        {% endif %}

    {% endfor %}
    </tbody>
</table>
