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

<form name="form" novalidate>
    <div class="modal-header">
        <div class="modal-button">
            <button class="btn btn-success" ng-click="ok()" ng-disabled="form.$invalid">OK</button>
            <button class="btn btn-danger" ng-click="cancel()">Cancel</button>
        </div>
        <h3 class="modal-title">Edit service</h3>
    </div>
    <div class="modal-body">
        <div class="form-horizontal">
            <div class="form-group" ng-class="{'has-error': form.name.$invalid }">
                <div class="col-md-12">
                    <label class="sr-only" for="name">Name</label>
                    <input type="text" class="form-control" id="name" required name="name" placeholder="Name" ng-model="data.name" />
                </div>
            </div><!-- .form-group -->
            <div class="form-group">
                <div class="col-md-12">
                    <label class="sr-only" for="description">Description</label>
                    <textarea class="form-control" id="description" placeholder="Description" ng-model="data.description"></textarea>
                </div>
            </div><!-- .form-group -->
            <div class="form-group">
                <div class="col-md-12">
                    <div class="checkbox">
                        <label>
                            <input type="checkbox" id="owned" ng-model="data.owned"/>
                            <span class="normal-size">Owned</span>
                        </label>
                    </div><!-- .checkbox -->
                </div>
            </div><!-- .form-group -->
            <div class="form-group">
                <div class="col-md-3">
                    <h5>Port</h5>
                    <div class="input-margin">
                        <label class="sr-only" for="ports">Port</label>
                        <input type="number" min="0" max="65535" class="form-control" id="ports" placeholder="Port" ng-model="data.ports"/>
                    </div>
                </div>
                <div class="col-md-3 protocol">
                    <h5>Protocol</h5>
                    <label class="sr-only" for="protocol">Protocol</label>
                    <input type="text" class="form-control" id="protocol" placeholder="Protocol" ng-model="data.protocol"/>
                </div>
                <div class="col-md-3">
                    <h5>Version</h5>
                    <label class="sr-only" for="version">Version</label>
                    <input type="text" class="form-control" id="version" placeholder="Version" ng-model="data.version"/>
                </div>
                <div class="col-md-3">
                    <h5>Status</h5>
                    <label class="sr-only" for="status">Status</label>
                    <select class="form-control" ng-model="data.status" ng-options="e for e in statuses" id="status">
                    </select>
                </div>
            </div><!-- .form-group -->
            <div class="form-group">
                <div class="reports col-md-12 col-sm-12 col-xs-12" ng-if="servicesSelected">
                    <h5><small>
                        Services to update
                    </small></h5>
                    <table class="status-report hosts-list table table-responsive">
                        <thead>
                            <tr>
                                <th>
                                    <a href="" ng-click="toggleSort('name')">Name</a>
                                </th>
                                <th>
                                    <a href="" ng-click="toggleSort('description')">Description</a>
                                </th>
                                <th>
                                    <a href="" ng-click="toggleSort('ports')">Port</a>
                                </th>
                                <th>
                                    <a href="" ng-click="toggleSort('protocol')">Protocol</a>
                                </th>
                                <th>
                                    <a href="" ng-click="toggleSort('status')">Status</a>
                                </th>
                                <th>Copy</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr ng-repeat="service in servicesSelected | filter:query | orderBy:sortField:reverse">
                                <td ng-bind="service.name"></td>
                                <td ng-bind="service.description || '-'"></td>
                                <td ng-bind="service.ports"></td>
                                <td ng-bind="service.protocol"></td>
                                <td ng-bind="service.status"></td>
                                <td><i class="fa fa-copy copy-icon fa-lg" ng-click="call(service);"></i></td>
                            </tr>
                        </tbody>
                    </table><!-- #hosts -->
                </div>
            </div>
        </div>
    </div><!-- .modal-body -->
    <div class="modal-footer">
        <div class="modal-button">
            <button class="btn btn-success" ng-disabled="form.$invalid || workspace.readonly === true" ng-click="ok()">OK</button>
            <button class="btn btn-danger" ng-click="cancel()">Cancel</button>
        </div>
    </div>
</form>
