<!-- 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">New host</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" name="name" placeholder="Name" ng-model="hostdata.name" required/>
                    <span class="help-block normal-size">
                        Example: 192.168.0.1
                    </span>
                </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="hostdata.description"></textarea>
                </div>
            </div><!-- .form-group -->
            <div class="form-group">
                <div class="col-md-12">
                    <label class="sr-only" for="os">Operating System</label>
                    <input type="text" class="form-control" id="os" placeholder="Operating System" ng-model="hostdata.os"/>
                    <span class="help-block normal-size">
                        Example: Linux 3.18.6-1-ARCH
                    </span>
                </div>
            </div><!-- .form-group -->
            <div class="form-group">
                <div class="col-md-12">
                    <input type="checkbox" id="owned" ng-model="hostdata.owned"/>
                    <span class="normal-size">Owned</span>
                </div>
            </div><!-- .form-group -->
            <div class="form-group">
                <div class="col-md-12">
                    <h5><b>Hostnames</b></h5>
                    <span class="input-group-addon button-radius" ng-click="newHostnames($event)">Add Hostname</span>
                </div>
                <div class="col-md-12 input-margin" ng-repeat="hostname in interfaceData.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.hostname"/>
                        <span class="input-group-addon" ng-click="interfaceData.hostnames.splice($index, 1)" ng-hide="interfaceData.hostnames.length == 1"><i class="fa fa-minus-circle"></i></span>
                    </div>
                </div>
            </div><!-- .form-group -->
            <div class="form-group">
                <div class="col-md-6" ng-class="{'has-error': form.ipv6.$invalid }">
                    <label class="sr-only" for="ipv4">IP v4</label>
                    <input type="text" class="form-control" id="ipv4" name="ipv6" placeholder="IP v4" ng-model="interfaceData.ipv4" ng-required="!interfaceData.ipv6"/>
                </div>
                <div class="col-md-6" ng-class="{'has-error': form.ipv4.$invalid }">
                    <label class="sr-only" for="ipv6">IP v6</label>
                    <input type="text" class="form-control" id="ipv6" name="ipv4" placeholder="IP v6" ng-model="interfaceData.ipv6" ng-required="!interfaceData.ipv4"/>
                </div>
            </div><!-- .form-group -->
            <div class="form-group">
                <div class="col-md-12">
                    <label class="sr-only" for="mac">MAC</label>
                    <input type="text" class="form-control" id="mac" placeholder="MAC" ng-model="interfaceData.mac"/>
                </div>
            </div><!-- .form-group -->
           <h5>
               <b>Credential</b>
           </h5>
            <div class="form-group">
                <div class="col-md-3" ng-class="{'has-error': form.nameCredential.$invalid}">
                    <input type="text" class="form-control" id="nameCredential" name="nameCredential" placeholder="Name" ng-model="credentialData.name" ng-required="credentialData.username || credentialData.password"/>
                </div>
                <div class="col-md-3" ng-class="{'has-error': form.usernameCredential.$invalid}">
                    <input type="text" class="form-control" id="usernameCredential" name="usernameCredential" placeholder="Username" ng-model="credentialData.username" ng-required="credentialData.name || credentialData.password"/>
                </div>
                <div class="col-md-3" ng-class="{'has-error': form.passwordCredential.$invalid}">
                    <input type="text" class="form-control" id="passwordCredential" name="passwordCredential" placeholder="Password" ng-model="credentialData.password" ng-required="credentialData.name || credentialData.username"/>
                </div>
            </div><!-- .form-group -->
        </div>
    </div><!-- .modal-body -->
    <div class="modal-footer">
        <div class="modal-button">
            <button class="btn btn-success" ng-disabled="form.$invalid" ng-click="ok()">OK</button>
            <button class="btn btn-danger" ng-click="cancel()">Cancel</button>
        </div>
    </div>
</form>
