context = window

@SessionInviteMusiciansBtn = React.createClass({

  mixins: [Reflux.listenTo(@AppStore,"onAppInit")]

  onAppInit: (app) ->
    @app = app

    @inviteMusiciansUtil = new JK.InviteMusiciansUtil(@app)
    @inviteMusiciansUtil.initialize(JK.FriendSelectorDialogInstance)

  openInviteDialog : (e) ->
    e.preventDefault()

    friendInput = @inviteMusiciansUtil.inviteSessionUpdate('#update-session-invite-musicians', context.SessionStore.currentSessionId)
    @inviteMusiciansUtil.loadFriends()
    $(friendInput).show()
    @app.layout.showDialog('select-invites')

  render: () ->
    `<a className="session-invite-musicians" onClick={this.openInviteDialog}>
      <img src="/assets/content/icon_add.png" width="19" height="19" />
      Invite Musicians
    </a>`
})