 angular.module 'IdleLands'
 .controller 'PlayerGuild', [
-  '$scope', 'CurrentGuild', 'CurrentGuildInvites', 'CurrentPlayer', 'API'
-  ($scope, CurrentGuild, CurrentGuildInvites, CurrentPlayer, API) ->
+  '$scope', '$mdDialog', 'CurrentGuild', 'CurrentGuildInvites', 'CurrentPlayer', 'API'
+  ($scope, $mdDialog, CurrentGuild, CurrentGuildInvites, CurrentPlayer, API) ->
 
     $scope.initialize = ->
       $scope.guild = CurrentGuild.getGuild()

      API.guild.buff {type: type, tier: $scope.editable.buffLevel}

    $scope.kickMember = (name) ->
      API.guild.kick {memberName: name}

    $scope.rescindInvite = (invIdent) ->
      API.guild.rescind {invIdent: invIdent}

    $scope.promoteMember = (name) ->
      API.guild.promote {memberName: name}

      yes

    $scope.leaveGuild = ->
      confirm = $mdDialog.confirm()
      .title 'Leave Guild'
      .content 'Are you sure you want to leave your guild?'
      .ok 'Yes'
      .cancel 'No'

      $mdDialog.show(confirm).then ->
        API.guild.leave()

    $scope.disbandGuild = ->
      confirm = $mdDialog.confirm()
      .title 'Disband Guild'
      .content 'Are you sure you want to disband your guild?'
      .ok 'Yes'
      .cancel 'No'

      $mdDialog.show(confirm).then ->
        API.guild.disband()

    $scope.donateGold = (gold) ->
      API.guild.donate {gold: gold}
