<!-- Faraday Penetration Test IDE -->
<!-- Copyright (C) 2017  Infobyte LLC (http://www.infobytesec.com/) -->
<!-- See the file 'doc/LICENSE' for the license information -->

<section id="main" class="seccion clearfix">
    <div class="right-main"><div id="reports-main" class="fila clearfix">
        <h2 class="ws-label">

            <span id="ws-name" ng-show="parentObject.type" title="Credentials">{{credentials.length > 0? credentials.length: 'Not found'}} credentials for {{parentObject.type}} {{parentObject.nameHost}}{{parentObject.nameService? '/' + parentObject.nameService: ''}} </span>
            <span id="ws-name" ng-show="!parentObject.type && workspace" title="Credentials">{{credentials.length > 0? credentials.length: 'Not found'}} credentials for workspace {{workspace}}</span>
            <span id="ws-name" ng-show="!workspace" title="Credentials">Select a workspace</span>
            
            <div id="ws-control" class="btn-group">
                <button id="refresh" type="button" class="btn btn-danger" title="Refresh current workspace" ng-click="reloadPage()">
                    <span class="glyphicon glyphicon-refresh"></span>
                </button>

                <button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown" title="Change current workspace">
                        Change workspace <span class="caret"></span>
                </button>
                <ul id="nav" class="dropdown-menu dropdown-menu-right" role="menu">
                    <li ng-repeat="ws in workspaces"><a href="#/credentials/ws/{{ws}}" class="ws" >{{ws}}</a></li>
                </ul><!-- WS navigation -->
            </div>

            <button id="delete" type="button" class="btn btn-default" title="Delete selected credentials" ng-disabled="selectedCredentials().length == 0" ng-click="delete()">
                <span class="glyphicon glyphicon-trash"></span>
                Delete
            </button>
            <button id="merge" type="button" class="btn btn-default" title="Edit selected credentials" ng-disabled="selectedCredentials().length != 1" ng-click="edit()">
                <span class="glyphicon glyphicon-pencil"></span>
                Edit
            </button>
            <button id="merge" type="button" class="btn btn-success" title="New credential" ng-if="parentObject.type" ng-click="new()">
                <span class="glyphicon glyphicon-plus-sign"></span>
                New
            </button>
        </h2><!-- .ws-label -->
        </div>
        <div class="reports col-md-12 col-sm-12 col-xs-12">
            <div class="col-md-6 col-sm-3 col-xs-11">
                <div class="form-group">
                    <div class="input-group">
                        <input type="text" class="form-control input-sm" ng-model="search" placeholder="enter keywords" />
                        <span class="input-group-btn">
                            <button class="btn btn-sm" type="button"> 
                                <i class="fa fa-search"></i>
                            </button>
                        </span>
                    </div>
                </div>
            </div>
            <table class="status-report licenses-list table table-responsive">
                <thead>
                    <tr>
                        <th><input type="checkbox" ng-model="selectall" ng-click="checkAll()"/></th>
                        <th ng-if="!parentObject.type">
                            <a href="" ng-click="toggleSort('target')">Target</a>
                        </th>
                        <th>
                            <a href="" ng-click="toggleSort('name')">Name</a>
                        </th>
                        <th>
                            <a href="" ng-click="toggleSort('username')">Username</a>
                        </th>
                        <th>
                            <a href="" ng-click="toggleSort('password')">Password</a>
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="credential in credentials | filter:search | orderBy:sort_field:reverse"
                        selection-model selection-model-type="checkbox"
                        selection-model-mode="multiple-additive"
                        selection-model-selected-class="multi-selected"
                        selection-model-on-change="selectedCredentials()">
                        <td><input type="checkbox" name="{{credential._id}}"/></td>
                        <td ng-if="!parentObject.type"> {{credential.target}} </td>
                        <td>{{credential.name}}</td>
                        <td>{{credential.username}}</td>
                        <td>{{credential.password}}</td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div></div>
</section>
