 KDButtonView            = kd.ButtonView
 KDTabPaneView           = kd.TabPaneView
 InviteSomeoneView       = require './invitesomeoneview'
+AdminSubTabHandleView   = require './../adminsubtabhandleview'
 PendingInvitationsView  = require './pendinginvitationsview'
 AcceptedInvitationsView = require './acceptedinvitationsview'
 
+module.exports = class AdminInvitationsView extends KDView
 
-module.exports = class AdminInvitationsView extends KDView
+  PANE_NAMES_BY_ROUTE =
+    'Invite'   : 'Invite Teammates'
+    'Pending'  : 'Pending Invitations'
+    'Accepted' : 'Accepted Invitations'
 
   constructor: (options = {}, data) ->
 

    @addSubView tabView = @tabView = new KDTabView
      hideHandleCloseIcons : yes
      maxHandleWidth       : 210

    tabView.addPane pending  = new KDTabPaneView name: 'Pending Invitations'
    tabView.addPane accepted = new KDTabPaneView name: 'Accepted Invitations'
    tabView.addPane invite   = new KDTabPaneView name: 'Invite', hiddenHandle: yes

    pending.addSubView  pendingView  = new PendingInvitationsView  {}, data
    accepted.addSubView acceptedView = new AcceptedInvitationsView {}, data
    invite.addSubView   inviteView   = new InviteSomeoneView {}, data

    tabView.showPaneByIndex 0

    inviteView.on 'InvitationViewCancelled', =>
      tabView.showPaneByIndex tabView.lastOpenPaneIndex
      @inviteButton.show()

    tabView.on 'PaneDidShow', => @inviteButton.show()
    inviteView.on 'NewInvitationsAdded', -> pendingView.refresh()


  createInviteButton: ->

    @addSubView @inviteButton = new KDButtonView
      title    : 'INVITE SOMEONE'
      cssClass : 'solid compact green invite'
      callback : =>
        @tabView.showPaneByName 'Invite'
        @inviteButton.hide()

    super options, data

    @createTabView()


  createTabView: ->
