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

            <section id="main" class="seccion clearfix">
                <div class="faraday-header-border-fix">
                    <div ng-controller="headerCtrl" ng-include="'scripts/commons/partials/header.html'"></div>
                    <div id="reports-main" class="fila clearfix">
                    <div class="reports col-md-8 col-sm-8 col-xs-8 pr" style="border-right: 1px solid #CCC">
                        <form name="form">
                            <h3>
                                Create a host
                                <span style="float:right">
                                    <a class="btn btn-sm btn-default" href="#/host/ws/{{workspace}}/hid/{{host._id}}/edit" ng-if="!editing">
                                        <span class="glyphicon glyphicon-pencil"></span>
                                        Edit
                                    </a>
                                    <button type="button" class="btn btn-sm btn-default" title="Delete host" ng-click="deleteHost()" ng-if="!editing">
                                        <span class="glyphicon glyphicon-trash"></span>
                                        Delete
                                    </button>
                                    <a class="btn btn-danger" href="#/hosts/ws/{{workspace}}" ng-if="editing && creating">Cancel</a>
                                    <button class="btn btn-success" ng-disabled="form.$invalid" ng-click="ok()" ng-if="editing">OK</button>
                                </span>
                            </h3>
                            <div class="form-horizontal">
                                <div class="form-group" ng-class="{'has-error': !host.ip }">
                                    <div class="col-md-12">
                                        <strong ng-if="!editing">IP v4 or v6</strong>
                                        <h5 ng-if="editing">IP v4 or v6</h5>
                                        <label class="sr-only" for="ip">IP v4 or v6</label>
                                        <input type="text" class="form-control" id="ip" placeholder="IP" ng-model="host.ip" ng-if="editing" required/>
                                        <p ng-if="!editing">{{host.ip}}</p>
                                        <span class="help-block normal-size" ng-if="editing">
                                            Example: 192.168.0.1
                                        </span>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-md-3" style="margin-bottom: 15px">
                                        <div class="checkbox">
                                            <label>
                                                <input type="checkbox" id="owned" ng-model="host.owned" ng-disabled="!editing"/>
                                                <span class="normal-size">Owned</span>
                                            </label>
                                        </div><!-- .checkbox -->
                                    </div>
                                    <div class="col-md-12">
                                        <strong ng-if="!editing">Operating System</strong>
                                        <h5 ng-if="editing">Operating System</h5>
                                        <label class="sr-only" for="os">Operating System</label>
                                        <input type="text" class="form-control" id="os" placeholder="Operating System" ng-model="host.os" ng-if="editing"/>
                                        <p ng-if="!editing">
                                        <img ng-if="host.icon != undefined" ng-src="images/{{host.icon}}.png" uib-tooltip="{{host.os}}"/>
                                        {{host.os}}
                                        </p>
                                    </div>
                                    <div class="col-md-12">
                                        <strong ng-if="!editing">MAC</strong>
                                        <h5 ng-if="editing">MAC</h5>
                                        <input type="text" class="form-control" id="ipv4" placeholder="MAC" ng-model="host.mac" ng-if="editing"/>
                                        <p ng-if="!editing">{{host.mac}}</p>
                                    </div>
                                    <div class="col-md-12">
                                        <strong ng-if="!editing">Description</strong>
                                        <h5 ng-if="editing">Description</h5>
                                        <label class="sr-only" for="description">Description</label>
                                        <textarea class="form-control" id="description" placeholder="Description" ng-model="host.description" ng-if="editing"></textarea>
                                        <p ng-if="!editing">{{host.description}}</p>
                                    </div>
                                </div><!-- .form-group -->
                            </div>
                        </form>
                    </div>
                    <div class="col-md-4 col-sm-4 col-xs-4 pl">
                        <h3>
                            Hostnames
                            <span style="float:right">
                                <button class="btn btn-success background-blue" ng-click="newHostnames($event)">Add Hostname</button>
                            </span>
                        </h3>
                        <h5 ng-if="editing" style="min-height: 1.1em"></h5>
                        <div class="form-horizontal">
                            <div class="form-group">
                                <span ng-if="editing">
                                    <div class="col-md-12 input-margin" ng-repeat="hostname in host.hostnames">
                                        <div class="input-group margin-bottom-sm col-md-12">
                                            <label class="sr-only" for="hostsnames">Hostname</label>
                                            <input type="text" class="form-control" id="hostsnames" placeholder="Hostname" ng-model="hostname.key" />
                                            <span class="input-group-addon" ng-click="host.hostnames.splice($index, 1)" ng-hide="host.hostnames.length == 1" ng-if="editing"><i class="fa fa-minus-circle"></i></span>
                                        </div>
                                    </div>
                                </span>
                            </div>
                        </div>
                    </div>
                </div><!-- #reports-main --></div><!-- .right-main -->
            </section><!-- #main -->
