<ng-container *ngIf="linked; else unlinked">
  <a routerLink="/organizations/{{ org.id }}">
    <ng-template [ngTemplateOutlet]="tag"></ng-template>
  </a>
</ng-container>

<ng-template #tag>
  <nz-tag
    nz-popover
    [nzPopoverPlacement]="popoverPlacement"
    [nzPopoverMouseEnterDelay]="0.5"
    [nzPopoverContent]="enablePopover ? orgPopover : undefined">
    <ng-template [ngTemplateOutlet]="tagContent"></ng-template>
  </nz-tag>
  <ng-template #orgPopover>
    <cvc-organization-popover
      [orgId]="org.id"
      (contentRendered)="updatePopoverPosition()">
    </cvc-organization-popover>
  </ng-template>
</ng-template>

<ng-template #unlinked>
  <ng-template [ngTemplateOutlet]="tag"></ng-template>
</ng-template>

<ng-template #tagContent>
  <i
    nz-icon
    nzType="civic-organization"
    nzTheme="twotone"
    nzTwotoneColor="#58A0C4"></i>
  {{ org.name }}
</ng-template>
