@if (showGrouping()) {
  @for (group of groupedItems(); track group.orderType; let last = $last) {
    <div class="item-group-header">
      <ng-icon
        [name]="group.icon"
        [size]="group.orderType === 'B2B-Versand' ? '36' : '24'"
      />
      <div class="label">{{ group.orderType }}</div>
    </div>

    @for (
      subGroup of group.subGroups;
      track subGroup.branchId ?? $index;
      let isFirst = $first
    ) {
      @if (subGroup.branchName) {
        <div class="branch-header rounded-2xl" [class.rounded-t-none]="isFirst">
          <span class="branch-name">
            {{ subGroup.branchName }} | {{ subGroup.branchAddress }}
          </span>
        </div>
      }

      @for (item of subGroup.items; track item.item.id; let isLast = $last) {
        <lib-reward-selection-item class="py-4" [rewardSelectionItem]="item" />
        @if (!isLast) {
          <hr />
        }
      }
    }
  }
} @else {
  @for (item of items(); track item.item.id; let last = $last) {
    <lib-reward-selection-item class="py-4" [rewardSelectionItem]="item" />
    @if (!last) {
      <hr />
    }
  }
}
