<div class="modal-header">
    <button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">&times;</span></button>
    <h4 class="modal-title" id="importModelLabel"><i class="fa fa-cloud-upload"></i> Import</h4>
</div>
<form name="importForm" ng-submit="importForm.$valid && import(model, importForm)" ng-show="!processing">
    <div class="modal-body">
        <div class="callout callout-danger validation-errors" ng-show="importForm.$errors">
            <h4>Errors have occurred</h4>
            <ul>
                <li ng-repeat="e in importForm.$errors">{{e}}</li>
            </ul>
        </div>
        <div class="form-group">
            <label for="source">1. Select the format of the import file</label>
            <select id="source" name="source" class="form-control" ng-model="model.source" ng-change="setSource()" required>
                <option value="">-- Select --</option>
                <option ng-repeat="option in options | filter: { featured: true } | orderBy: ['sort', 'name']"
                        value="{{option.id}}">{{option.name}}</option>
                <option value="-" disabled ng-if="splitFeatured"></option>
                <option ng-repeat="option in options | filter: { featured: '!true' } | orderBy: ['sort', 'name']" 
                        value="{{option.id}}">{{option.name}}</option>
            </select>
        </div>
        <div class="callout callout-default" ng-show="model.source">
            <h4><i class="fa fa-info-circle"></i> {{source.name}} Instructions</h4>
            <div ng-bind-html="source.instructions"></div>
        </div>
        <div class="form-group">
            <label for="file">2. Select the import file</label>
            <input type="file" id="file" name="file" />
        </div>
        <div class="form-group">
            <label for="fileContents">or copy/paste the import file contents</label>
            <textarea id="fileContents" class="form-control" name="fileContents" ng-model="model.fileContents"
                      style="height: 150px;"></textarea>
        </div>
    </div>
    <div class="modal-footer">
        <button type="submit" class="btn btn-primary btn-flat">
            Import
        </button>
        <button type="button" class="btn btn-default btn-flat" ng-click="close()">Close</button>
    </div>
</form>
<div ng-show="processing" class="modal-body text-center">
    <p><i class="fa fa-cog fa-spin fa-3x"></i></p>
    <p>Please wait. We are now importing all of your data. Do not close this window. You will be redirected to your vault when the import has completed.</p>
</div>
