if statistics
  ui-checkbox class='toggle' label=(t 'user.statistics1.project_specific.label') checked=project_specific onChange=(action (mut project_specific))
  '
  if project_specific
    each-in statistics as |project_id stats|
      if (can 'read' 'model' 'panda/project-instance')
        .ui.header
          = link-to 'project.show' project_id
            = stats.project.name
      else
        .ui.header= stats.project.name
      each stats.states as |stat|
        if (can 'read' 'model' 'panda/project-instance')
          = link-to 'project.show.project-instance-action' project_id (query-params state=stat.state organization_id=record.id)
            = state-badge stat.state
              '
              span.between-brackets= stat.count
        else
          = state-badge stat.state
            '
            span.between-brackets= stat.count
  else
    /.ui.header= t 'user.statistics1.global.title'
    each-in statistics as |state count|
      if (can 'read' 'model' 'panda/project-instance')
        = link-to 'action-list' (query-params state=state organization_id=record.id)
          = state-badge state
            '
            span.between-brackets= count
      else
        = state-badge state
          '
          span.between-brackets= count
  = yield
else
  .ui.active.inline.centered.loader
