
{% macro admin_btn(child,domain) -%}
<div class="btn-group">
    
    <a href="https://{{domain}}/{{hconfig(ConfigEnum.proxy_path,child.id)}}/{{hconfig(ConfigEnum.admin_secret,child.id)}}/admin/"
        class="btn btn-xs btn-{{"success" if child.is_active else "warning"}} orig-link ltr" target="_blank">{{domain}}</a>
</div>
{%- endmacro -%}


<div class="card card-info">
    <div class="card-header">
        <h3 class="card-title">{{_('Childs')}}</h3>
    </div>
    <div class="card-body">
        %if not childs
        {{_("No children!")}}
        %else
        <table>
            <tr><th></th><th></th> <th>{{_('Status')}}</th><th>{{_("Domain")}}</th></tr>
            
            
            %for child in childs
                <tr><td>{{child.id}} </td>
                    <td>
                    % if not child.is_active
                    <form method="post" action="remove_child">
                        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
                        <input type="hidden" name="child_id" value="{{child.id}}"/>
                        <button type="submit" class="btn btn-xs btn-danger"><i class="fa fa-trash"></i></a>
                    </form>
                    %endif
                </td>
                <td class="text-center"><span class="btn btn-xs badge-{{"success" if child.is_active else "warning"}}">&nbsp{{icon('solid','check') if child.is_active else icon('solid','triangle-exclamation')}}</span></td>
                <td>

                    %for d in child.domains
                    % if d.mode !="fake"
                        {{admin_btn(child,d)}} 
                    %endif
                    %endfor
                </td></tr>
            %endfor
        </table>
        %endif
    </div>

</div>
