<che-popup title="Add developers" on-close="addDeveloperController.abort()">
  <ng-form name="workspaceUsersForm" class="add-workspace-developers">
    <div class="form-input-fields" ng-if="addDeveloperController.canShare">
      <md-chips flex class="share-user-input"
                name="emails"
                ng-model="addDeveloperController.callbackController.emails"
                md-separator-keys="addDeveloperController.callbackController.separators"
                md-transform-chip="addDeveloperController.callbackController.handleUserAdding($chip)"
                md-on-remove="addDeveloperController.callbackController.onRemoveEmail($chip)"
                secondary-placeholder="Enter comma-separated email list of developers to invite">
        <md-chip-template>
          <div>{{$chip}}
            <span class="material-design icon-ic_done_24px user-exists-checked"
                  ng-if="addDeveloperController.callbackController.isUserExists($chip)"></span>
          </div>
        </md-chip-template>
      </md-chips>
      <div ng-show="addDeveloperController.callbackController.notExistingUsers.length > 0" class="user-not-found">
        User<span ng-if="addDeveloperController.callbackController.notExistingUsers.length > 1">s</span> with email<span
        ng-if="addDeveloperController.callbackController.notExistingUsers.length > 1">s</span>
        <b>{{addDeveloperController.callbackController.getNotExistingEmails()}}</b> not found. Workspaces can be shared with registered users only.
      </div>
    </div>

    <div class="message-panel" ng-if="addDeveloperController.canShare === false">
      This workspace can be shared only by its owner. Please contact owner - or create a team.
    </div>

    <div class="buttons-panel"
         layout="row" layout-align="end stretch">
      <che-button-primary
        ng-disabled="addDeveloperController.callbackController.existingUsers.size === 0 || addDeveloperController.callbackController.isLoading"
        che-button-title="Share" name="shareButton"
        ng-click="addDeveloperController.shareWorkspace()"></che-button-primary>
      <che-button-notice che-button-title="Close"
                         ng-click="addDeveloperController.abort()"></che-button-notice>
    </div>
  </ng-form>
</che-popup>
