<section class="dialog">
    <form (submit)="save()" [formGroup]="form">
        <div [translate]="'redact-text.dialog.title'" class="dialog-header heading-l"></div>

        <div class="dialog-content redaction">
            <div *ngIf="form.controls.selectedText.value as selectedText" class="iqser-input-group w-450">
                <label [translate]="'redact-text.dialog.content.selected-text'" class="selected-text"></label>
                {{ selectedText }}
            </div>

            <iqser-details-radio
                (extraOptionChanged)="extraOptionChanged($event)"
                [options]="options"
                formControlName="option"
            ></iqser-details-radio>

            <div *ngIf="dictionaryRequest" class="iqser-input-group required w-450">
                <label [translate]="'redact-text.dialog.content.type'"></label>

                <mat-form-field>
                    <mat-select [placeholder]="'redact-text.dialog.content.type-placeholder' | translate" formControlName="dictionary">
                        <mat-select-trigger>{{ displayedDictionaryLabel }}</mat-select-trigger>
                        <mat-option
                            (click)="typeChanged()"
                            *ngFor="let dictionary of dictionaries"
                            [matTooltip]="dictionary.description"
                            [value]="dictionary.type"
                            matTooltipPosition="after"
                        >
                            <span> {{ dictionary.label }} </span>
                        </mat-option>
                    </mat-select>
                </mat-form-field>
            </div>

            <div *ngIf="!dictionaryRequest" class="iqser-input-group w-450">
                <label [translate]="'redact-text.dialog.content.comment'"></label>
                <textarea
                    [placeholder]="'redact-text.dialog.content.comment-placeholder' | translate"
                    formControlName="comment"
                    iqserHasScrollbar
                    name="comment"
                    rows="4"
                    type="text"
                ></textarea>
            </div>
        </div>

        <div class="dialog-actions">
            <iqser-icon-button [label]="'redact-text.dialog.actions.save' | translate" [submit]="true" [type]="iconButtonTypes.primary">
            </iqser-icon-button>

            <div [translate]="'redact-text.dialog.actions.cancel'" class="all-caps-label cancel" mat-dialog-close></div>
        </div>
    </form>

    <iqser-circle-button (action)="close()" class="dialog-close" icon="iqser:close"></iqser-circle-button>
</section>
