{% macro admin_btn(child,domain) -%}
<div class="btn-group">
    <a href="{{hiddify.get_account_panel_link(g.account,domain,child_id=child.id)}}" 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="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" and d.mode != "reality"%}
                    {{admin_btn(child,d)}}
                    {% endif %}
                    {% endfor %}
                </td>
            </tr>
            {% endfor %}
        </table>
        {% endif %}
    </div>

</div>