a.pull-right.gem-wallet(ng-if='group.type!="party"', popover-trigger='mouseenter', popover-title=env.t('guildBankPop1'), popover=env.t('guildBankPop2'), popover-placement='left')
  // <span class="task-action-btn tile flush bright add-gems-btn">＋</span>
  span.task-action-btn.tile.flush.neutral
    .Pet_Currency_Gem2x.Gems
    | {{group.balance * 4 | number:0 }}
    =' ' + env.t('guildGems')

.container-fluid
  .row
    .col-md-4

      // ------ Bosses -------
      +boss(false, false)

      // ------ Information -------
      .panel.panel-default
        .panel-heading(bindonce='group')
          h3.panel-title
            | {{group.name}}
            span(ng-if='group.leader == user.id')
              button.btn.btn-primary.pull-right(ng-click='save(group)', ng-show='group._editing')=env.t('save')
              button.btn.btn-default.pull-right(ng-click='group._editing = true', ng-hide='group._editing')=env.t('editGroup')

        .panel-body
          form(ng-show='group._editing')
            .form-group
              label=env.t('groupName')
              input.form-control(type='text', ng-model='group.name', placeholder=env.t('groupName'))
            .form-group
              label=env.t('description')
              textarea.form-control(rows=6, ng-model='group.description')
              include ../../shared/formatting-help
            .form-group
              label=env.t('logoUrl')
              input.form-control(type='url', placeholder=env.t('logoUrl'), ng-model='group.logo')
            .form-group
              .checkbox
                label
                  input(type='checkbox', ng-model='group.leaderOnly.challenges')
                  | Only group leader can create challenges

            h4=env.t('assignLeader')
            select#group-leader-selection(ng-model='group._newLeader', ng-options='member.profile.name for member in group.members')

          div(ng-show='!group._editing')
            img.pull-right(ng-show='group.logo', ng-src='{{group.logo}}')
            markdown(text='group.description')
          hr
          small.muted Group ID: {{group._id}}

      include ./challenge-box

      // ------ Members -------
      .panel.panel-default
        .panel-heading
          h3.panel-title
            =env.t('members')
            button.pull-right.btn.btn-primary(ng-click="openModal('invite-friends', {controller:'GroupsCtrl'})", ng-if='::group.type=="party"') Invite Friends
        .panel-body.modal-fixed-height
          div.form-group(ng-if='::group.type=="party"')
            =env.t('partyList')
            select.form-control#partyOrder(
              ng-model='user.party.order',
              ng-controller='ChatCtrl',
              ng-options='k as v for (k , v) in partyOrderChoices',
              ng-change='set({"party.order": user.party.order})'
              )
          table.table.table-striped(bindonce='group')
            tr(ng-repeat='member in group.members track by member._id')
              td.media
                // allow leaders to ban members
                div.pull-left(ng-show='group.leader == user.id && user.id!=member._id')
                  a.media-object(ng-click='removeMember(group, member, true)')
                    span.glyphicon.glyphicon-ban-circle(tooltip=env.t('banTip'))
                a.media-body
                  span(ng-class='{"badge badge-info": group.leader==member._id}', ng-click='clickMember(member._id, true)')
                    | {{member.profile.name}}
            tr(ng-if='group.memberCount > group.members.length')
              td
                |<span class='badge'>{{group.memberCount - group.members.length}}
                = ' ' + env.t('moreMembers')
                |</span>

          h4(ng-show='group.invites.length > 0')=env.t('invited')
          table.table.table-striped
            tr(ng-repeat='invite in group.invites')
              td.media
                // allow leaders to ban members
                div.pull-left(ng-show='group.leader == user.id')
                  a.media-object(ng-click='removeMember(group, invite, false)')
                    span.glyphicon.glyphicon-ban-circle(tooltip=env.t('banTip'))
                a.media-body
                  span(ng-click='clickMember(invite._id, true)')
                    | {{invite.profile.name}}
        .panel-footer(ng-if='::group.type!="party"')
          form.form-inline(ng-submit='invite(group)')
            //.alert.alert-danger(ng-show='_groupError') {{_groupError}}
            .input-group
              input.form-control(type='text', placeholder=env.t('userId'), ng-model='group.invitee')
              span.input-group-btn
                input.btn.btn-default(type='submit', value=env.t('invite'))


      a.btn.btn-danger(data-id='{{group.id}}', ng-click='clickLeave(group, $event)')=env.t('leave')

    .col-md-8
      div()
        textarea.form-control(ng-show='group._editing', rows=6, placeholder=env.t('leaderMsg'), ng-model='group.leaderMessage')
      table(ng-show='group.leaderMessage')
        tr
          td
            .popover.static-popover.fade.right.in.wide-popover
              .arrow
              h3.popover-title {{Members.members[group.leader].profile.name}}
              .popover-content
                markdown(text='group.leaderMessage')
      div(ng-controller='ChatCtrl')
        h3=env.t('chat')
        include ./chat-box

        +chatMessages()
