<script type="text/x-template" id="tmpl-zwave-group">
    <div class="item group" :class="{selected: selected}">
        <div class="row name vertical-center" :class="{selected: selected}"
             v-text="group.label" @click="onGroupClicked"></div>

        <div class="params" v-if="selected">
            <div class="section nodes">
                <div class="header">
                    <div class="title col-10">Nodes</div>
                    <div class="buttons col-2">
                        <button class="btn btn-default" title="Add to group" @click="bus.$emit('openAddToGroupModal')"
                                v-if="!group.max_associations || Object.keys(nodes).length < group.max_associations">
                            <i class="fa fa-plus"></i>
                        </button>
                    </div>
                </div>

                <div class="body">
                    <div class="row"
                         v-for="node in nodes">
                        <div class="col-10"
                             v-text="node.name && node.name.length ? node.name : '<Node ' + node.node_id + '>'"></div>
                        <div class="buttons col-2">
                            <button class="btn btn-default" title="Remove from group" @click="removeFromGroup(node.node_id)">
                                <i class="fa fa-trash"></i>
                            </button>
                        </div>
                    </div>
                </div>
            </div>

            <div class="section config">
                <div class="header">
                    <div class="title">Parameters</div>
                </div>

                <div class="body">
                    <div class="row">
                        <div class="param-name">Index</div>
                        <div class="param-value" v-text="group.index"></div>
                    </div>

                    <div class="row">
                        <div class="param-name">Max associations</div>
                        <div class="param-value" v-text="group.max_associations"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</script>

<script type="application/javascript" src="{{ url_for('static', filename='js/plugins/zwave/group.js') }}"></script>

