<div class="delivery-selector">
  @if (isDigital) {
    <div class="delivery-chip delivery-chip--digital">{{ 'cart.digitalDelivery' | translate }}</div>
  } @else if (options.length > 0) {
    <label class="delivery-label" [for]="selectId">{{ 'cart.deliveryMethod' | translate }}</label>

    <div class="delivery-control">
      <select [id]="selectId" [ngModel]="selectedKey" (ngModelChange)="onSelectionChange($event)" [attr.aria-required]="required ? 'true' : null">
        @if (required) {
          <option value="">{{ 'cart.selectDelivery' | translate }}</option>
        }

        @for (option of options; track trackByOption($index, option)) {
          <option [value]="optionKey(option)">{{ optionLabel(option) }}</option>
        }
      </select>
    </div>

    @if (selectedDelivery) {
      <div class="delivery-meta">
        @if (selectedDelivery.deliveryPlace) {
          <span>{{ 'cart.deliveryPlace' | translate }}: {{ selectedDelivery.deliveryPlace }}</span>
        }
        @if (selectedDelivery.deliveryTime) {
          <span>{{ 'cart.deliveryTime' | translate }}: {{ selectedDelivery.deliveryTime }}</span>
        }
        <span>
          {{ 'cart.deliveryLabel' | translate }}:
          {{ selectedDeliveryTotal | number:'1.2-2' }} {{ currency }}
        </span>
      </div>
    }
  }
</div>