{{#if instances.length}}
    <div class="table-container">
        <table class="table">
            <thead>
                <tr>
                    <th>{{t 'common.form.name'}}</th>
                    <th>{{t 'common.form.type'}}</th>
                    <th class="fr-col-btn-2"/>
                </tr>
            </thead>
            <tbody>
                {{#each instances}}
                    <tr data-subschema-id="{{_id}}" data-subschema-type="{{_type._id}}">
                        <td class="wordwrap">
                            <a href="{{routeTo 'globalServiceSubSchemaEdit' ../type _type._id _id}}"
                                title="{{t 'common.form.edit'}}">{{_id}}</a>
                        </td>
                        <td class="wordwrap">{{_type.name}}</td>
                        <td class="fr-col-btn-2">
                            <div class="btn-group">
                                <a class="btn btn-link" href="{{routeTo 'globalServiceSubSchemaEdit' ../type _type._id _id}}"
                                    title="{{t 'common.form.edit'}}">
                                    <i class="fa fa-pencil"/>
                                </a>
                                <button type="button" data-subschema-delete class="btn btn-link" title="{{t 'common.form.delete'}}">
                                    <i class="fa fa-close"/>
                                </button>
                            </div>
                        </td>
                    </tr>
                {{/each}}
            </tbody>
        </table>
    </div>

    {{#if creatables.[1]}}
        <div class="btn-group pull-right">
            <button type="button" class="btn btn-default dropdown-toggle"
                data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                {{t "console.services.subSchema.add"}} <span class="caret"></span>
            </button>

            <ul class="dropdown-menu">
                {{#each creatables}}
                <li><a href="{{routeTo 'globalServiceSubSchemaNew' ../type _id}}">{{name}}</a></li>
                {{/each}}
            </ul>
        </div>
    {{else}}
        <a class="btn btn-default pull-right" href="{{routeTo 'globalServiceSubSchemaNew' type creatables.[0]._id}}"
            title="{{t 'common.form.edit'}}">
            <i class="fa fa-plus"/> {{t "console.services.subSchema.add"}}
        </a>
    {{/if}}
{{else}}
    <div class="call-to-action-block">
        <h3>{{t "console.services.subSchema.callToAction"}}</h3>

        {{#if creatables.[1]}}
            <div class="btn-group">
                <button type="button" class="btn btn-primary dropdown-toggle"
                    data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    {{t "console.services.subSchema.add"}} <span class="caret"></span>
                </button>

                <ul class="dropdown-menu">
                    {{#each creatables}}
                    <li><a href="{{routeTo 'globalServiceSubSchemaNew' ../type _id}}">{{name}}</a></li>
                    {{/each}}
                </ul>
            </div>
        {{else}}
            <a class="btn btn-primary" href="{{routeTo 'globalServiceSubSchemaNew' type creatables.[0]._id}}"
                title="{{t 'common.form.edit'}}">
                <i class="fa fa-plus"/> {{t "console.services.subSchema.add"}}
            </a>
        {{/if}}
    </div>
{{/if}}
