Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

2.6 KB
Raw Blame
@if ((selectedTimes$ | async); as selectedTimes) {
  <ng-container
    [formGroup]="form"
    >
    <div class="op-form--section-header">
      <h3 [textContent]="text.title" class="op-form--section-header-title"></h3>
      <p [textContent]="text.explanation"></p>
    </div>
    <spot-selector-field
      [label]="text.enable"
      [control]="form.get('enabled')">
      <input
        slot="input"
        type="checkbox"
        formControlName="enabled"
        />
    </spot-selector-field>
    @for (time of selectedTimes; track i; let i = $index) {
      <div
        class="op-reminder-settings-daily-time--row"
        >
        @if ((activeTimes$ | async); as activeTimes) {
          <input
            type="checkbox"
            [ngModel]="isActive(time)"
            (ngModelChange)="toggleActive($event, i, selectedTimes)"
            [ngModelOptions]="{standalone: true}"
            [disabled]="isDisabled(time, activeTimes)"
            class="op-reminder-settings-daily-time--active"
            attr.data-test-selector="op-settings-daily-time--active-{{i + 1}}">
        }
        <label
          class="op-reminder-settings-daily-time--label"
          [textContent]="text.timeLabel(i + 1)"
          attr.for="op-reminder-settings-daily-time-{{i + 1}}--time">
        </label>
        <select
          [ngModel]="time"
          (ngModelChange)="changeTime($event, selectedTimes, i)"
          [ngModelOptions]="{standalone: true}"
          [disabled]="(enabled$ | async) === false"
          class="op-reminder-settings-daily-time--time form--select -narrow"
          attr.id="op-reminder-settings-daily-time-{{i + 1}}--time"
          required="true">
          @for (availableTime of availableTimes; track availableTime) {
            <option
              [value]="availableTime"
              [disabled]="time !== availableTime && selectedTimes.includes(availableTime)">
              {{timeLabel(availableTime)}}
            </option>
          }
        </select>
        @if (timeRemovable$ | async) {
          <button
            class="spot-link op-reminder-settings-daily-time--remove"
            type="button"
            (click)="removeTime(selectedTimes, i)"
            attr.data-test-selector="op-settings-daily-time--remove-{{i + 1}}">
            <op-icon icon-classes="icon-small icon-remove icon4" />
          </button>
        }
      </div>
    }
    <button
      class="button op-reminder-settings-daily-time--add"
      type="button"
      [disabled]="nonAddable$ | async"
      (click)="addTime(selectedTimes)">
      <i class="button--icon icon-add"></i>
      <span class="button--text">{{text.addTime}}</span>
    </button>
  </ng-container>
}