mixin boss(tavern, mobile)
  //-.panel.panel-default(bindonce='group', ng-if='group.type==="party" && group.quest.key')
  div(class=mobile ? '' : 'panel panel-default' ng-if='group.quest.key')
    div(class = mobile ? 'item item-divider' : 'panel-heading')
      h3.panel-title(ng-if='group.quest.active==false')=env.t('questInvitation') + ' {{::Content.quests[group.quest.key].text()}}'
      h3.panel-title(ng-if='group.quest.active==true') {{::Content.quests[group.quest.key].text()}}
    .panel-body.modal-fixed-height
      div(ng-if='group.quest.active==false')
        table.table.table-striped
          tr(ng-repeat='member in group.members')
            td
              span(ng-if=':: group.quest.leader && group.quest.leader==member._id && isMemberOfGroup(group.quest.leader,group) && isMemberOfPendingQuest(group.quest.leader,group)')
                |*&nbsp;
              |{{::member.profile.name}}
            td {{group.quest.members[member._id] === true ? env.t('accepted') : group.quest.members[member._id] === false ? env.t('rejected') : env.t('pending')}}

        span(ng-if=':: group.quest.leader && isMemberOfGroup(group.quest.leader,group) && isMemberOfPendingQuest(group.quest.leader,group)')
          |*&nbsp;
          =env.t('questOwner')
        // This is commented-out until we have time to work out why it fails intermittently on the website and always on the mobile app (https://github.com/HabitRPG/habitrpg/issues/4074):
        // span(ng-if=':: group.quest.leader && isMemberOfGroup(group.quest.leader,group) && ! isMemberOfPendingQuest(group.quest.leader,group)')
          // =env.t('questOwnerNotInPendingQuest')
        // span(ng-if=':: ! group.quest.leader || ! isMemberOfGroup(group.quest.leader,group)')
          // =env.t('questOwnerNotInPendingQuestParty')
        hr
        .npc_ian.pull-left
        p=env.t('questStart')

        // only the quest owner sees the begin button:
        button.btn.btn-sm.btn-warning(ng-if=':: group.quest.leader  && group.quest.leader==user._id && isMemberOfGroup(group.quest.leader,group) && isMemberOfPendingQuest(group.quest.leader,group)', ng-click='party.$questAccept({"force":true})')=env.t('begin')
        // // only the quest owner sees the cancel button UNLESS the quest owner is no longer in the quest/party and then everyone sees it:
        // This is commented-out until we have time to work out why it fails intermittently on the website and always on the mobile app (https://github.com/HabitRPG/habitrpg/issues/4074):
        // button.btn.btn-sm.btn-danger(ng-if=':: (group.quest.leader  && group.quest.leader==user._id && isMemberOfGroup(group.quest.leader,group) && isMemberOfPendingQuest(group.quest.leader,group)) || (! group.quest.leader || ! isMemberOfGroup(group.quest.leader,group) || ! isMemberOfPendingQuest(group.quest.leader,group))', ng-click='questCancel()')=env.t('cancel')
        // only the quest owner sees the cancel button:
        button.btn.btn-sm.btn-danger(ng-if=':: (group.quest.leader  && group.quest.leader==user._id && isMemberOfGroup(group.quest.leader,group) && isMemberOfPendingQuest(group.quest.leader,group))', ng-click='questCancel()')=env.t('cancel')

      div(ng-if='group.quest.active==true')
        div(ng-if='::Content.quests[group.quest.key].boss',ng-init='boss=Content.quests[group.quest.key].boss;progress=group.quest.progress')
          if tavern
            div(class="quest_{{group.quest.key}} quest_{{group.quest.key}}_#{env.worldDmg.recent}")
          else
            div(class="quest_{{::group.quest.key}}")
          //-
            .progress
            .bar(style='width: {{Shared.percent(group.quest.hp, Content.quests[group.quest.key].hp)}}%;')
            span.meter-text
              span.glyphicon.glyphicon-heart
              | {{group.quest.hp | number:0}} / {{Content.quests[group.quest.key].hp}}
          .hero-stats
            .meter-label(tooltip=env.t('bossHP'))
              span.glyphicon.glyphicon-heart
            .meter.health
              .bar(style='width: {{Shared.percent(progress.hp, boss.hp)}}%;')
              span.meter-text.value
                | {{Math.ceil(progress.hp) | goldRoundThousandsToK}} / {{boss.hp | goldRoundThousandsToK}}
            .meter-label(tooltip='Rage', ng-if='boss.rage')
              span.glyphicon.glyphicon-fire
            .meter.mana(ng-if='boss.rage',popover="{{::boss.rage.description()}}",popover-title="{{::boss.rage.title()}}",popover-trigger='mouseenter',popover-placement='right')
              .bar(style='width: {{Shared.percent(progress.rage, boss.rage.value)}}%;')
              span.meter-text.value
                | {{Math.ceil(progress.rage)  | goldRoundThousandsToK}} / {{boss.rage.value | goldRoundThousandsToK}}
        div(ng-if='::Content.quests[group.quest.key].collect')
          div(class="quest_{{::group.quest.key}}")
          h4=env.t('collected') + ':'
          table.table.table-striped
            tr(ng-repeat='(k,v) in group.quest.progress.collect', class='quest_collected_{{v >= Content.quests[group.quest.key].collect[k].count}}')
              td
                div.pull-left(class='quest_{{::group.quest.key}}_{{::k}}')
                | {{::Content.quests[group.quest.key].collect[k].text()}}
              td
                |{{v}} / {{Content.quests[group.quest.key].collect[k].count}}

        div(ng-bind-html='::Content.quests[group.quest.key].notes()')
        unless tavern
          hr
          h5=env.t('questParticipants')
          table.table.table-striped
            tr(ng-repeat='(k,v) in group.members', ng-if='::group.quest.members[v._id]')
              td
                span(ng-if=':: group.quest.leader && group.quest.leader==v._id && isMemberOfGroup(group.quest.leader,group) && isMemberOfRunningQuest(group.quest.leader,group)')
                  |*&nbsp;
                |{{::v.profile.name}}
          span(ng-if=':: group.quest.leader && isMemberOfGroup(group.quest.leader,group) && isMemberOfRunningQuest(group.quest.leader,group)')
            |*&nbsp;
            =env.t('questOwner')
          // This is commented-out until we have time to work out why it fails intermittently on the website and always on the mobile app (https://github.com/HabitRPG/habitrpg/issues/4074):
          // span(ng-if=':: group.quest.leader && isMemberOfGroup(group.quest.leader,group) && ! isMemberOfRunningQuest(group.quest.leader,group)')
            // =env.t('questOwnerNotInRunningQuest')
          // span(ng-if=':: ! group.quest.leader || ! isMemberOfGroup(group.quest.leader,group)')
            // =env.t('questOwnerNotInRunningQuestParty')
        unless tavern
          quest-rewards(key='{{::group.quest.key}}')

        div(ng-if='::Content.quests[group.quest.key].boss')
          .npc_ian.pull-left
          if tavern
            p!=env.t('tavernBossInfo')
          else
            p!=env.t('bossDmg1')
            br
            p=env.t('bossDmg2')

        div(ng-if='::Content.quests[group.quest.key].collect')
          .npc_ian.pull-left
          p=env.t('bossColl1')
          br
          p=env.t('bossColl2')

        unless tavern
          // // only the quest owner sees the abort button UNLESS the quest owner is no longer in the quest/party and then everyone sees it:
          // This is commented-out until we have time to work out why it fails intermittently on the website and always on the mobile app (https://github.com/HabitRPG/habitrpg/issues/4074):
          // button.btn.btn-sm.btn-warning(ng-if=':: (group.quest.leader  && group.quest.leader==user._id && isMemberOfGroup(group.quest.leader,group) && isMemberOfRunningQuest(group.quest.leader,group)) || ! group.quest.leader || ! isMemberOfGroup(group.quest.leader,group) || ! isMemberOfRunningQuest(group.quest.leader,group)', ng-click='questAbort()')=env.t('abort')
          // only the quest owner sees the abort button:
          button.btn.btn-sm.btn-warning(ng-if=':: (group.quest.leader  && group.quest.leader==user._id && isMemberOfGroup(group.quest.leader,group) && isMemberOfRunningQuest(group.quest.leader,group))', ng-click='questAbort()')=env.t('abort')
