File

src/app/test-controller/components/review-dialog/review-dialog.component.ts

Metadata

templateUrl ./review-dialog.component.html

Index

Properties
Methods

Constructor

constructor(data: ReviewDialogData)
Parameters :
Name Type Optional
data ReviewDialogData No

Methods

getCategories
getCategories()
Returns : string

Properties

Public data
Type : ReviewDialogData
Decorators :
@Inject(MAT_DIALOG_DATA)
Static oldName
Type : string
Default value : ''
reviewform
Default value : new FormGroup({ target: new FormControl('u', Validators.required), priority: new FormControl('', Validators.required), tech: new FormControl(''), content: new FormControl(''), design: new FormControl(''), entry: new FormControl('', Validators.required), sender: new FormControl(ReviewDialogComponent.oldName) })
import { FormGroup, Validators, FormControl } from '@angular/forms';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import { Component, Inject } from '@angular/core';
import { ReviewDialogData } from '../../interfaces/test-controller.interfaces';

@Component({
  templateUrl: './review-dialog.component.html'
})
export class ReviewDialogComponent {
  reviewform = new FormGroup({
    target: new FormControl('u', Validators.required),
    priority: new FormControl('', Validators.required),
    tech: new FormControl(''),
    content: new FormControl(''),
    design: new FormControl(''),
    entry: new FormControl('', Validators.required),
    sender: new FormControl(ReviewDialogComponent.oldName)
  });

  static oldName = '';

  constructor(
    @Inject(MAT_DIALOG_DATA) public data: ReviewDialogData
  ) { }

  getCategories(): string {
    let myreturn = '';
    if (this.reviewform.get('tech').value === true) {
      myreturn = 'tech';
    }
    if (this.reviewform.get('design').value === true) {
      if (myreturn.length > 0) {
        myreturn += ' ';
      }
      myreturn += 'design';
    }
    if (this.reviewform.get('content').value === true) {
      if (myreturn.length > 0) {
        myreturn += ' ';
      }
      myreturn += 'content';
    }
    return myreturn;
  }
}
<form [formGroup]="reviewform">
  <h1 mat-dialog-title>Kommentar geben ({{ data.loginname }})</h1>

  <mat-dialog-content fxLayout="column">
    <div fxLayout="row" fxLayoutAlign="start center" fxLayoutGap="10px">
        <p>Kommentar für:</p>
        <mat-radio-group formControlName="target" fxLayout="column" fxLayoutGap="4px">
            <mat-radio-button value="b" [matTooltip]="data.bookletname">aktuelles Testheft "{{ data.bookletname }}"</mat-radio-button>
            <mat-radio-button value="u" [disabled]="data.unitDbKey.length === 0" [matTooltip]="data.unitDbKey">aktuelle Aufgabe "{{ data.unitTitle }}"</mat-radio-button>
        </mat-radio-group>
    </div>
    <div fxLayout="row" fxLayoutAlign="start center" fxLayoutGap="10px">
        <p>Priorität:</p>
        <mat-radio-group formControlName="priority" fxLayout="row" fxLayoutGap="10px">
            <mat-radio-button value="1">dringend/kritisch</mat-radio-button>
            <mat-radio-button value="2">mittelfristig</mat-radio-button>
            <mat-radio-button value="3">optional</mat-radio-button>
        </mat-radio-group>
    </div>
    <div fxLayout="row" fxLayoutAlign="start center" fxLayoutGap="10px">
        <p>Kategorie:</p>
        <mat-checkbox formControlName="tech">Technisches</mat-checkbox>
        <mat-checkbox formControlName="content">Inhaltlich</mat-checkbox>
        <mat-checkbox formControlName="design">Gestaltung</mat-checkbox>
    </div>
    <mat-form-field>
      <input matInput formControlName="sender" placeholder="Mein Name">
    </mat-form-field>
    <mat-form-field>
      <textarea matInput formControlName="entry" placeholder="Kommentar" rows="15"></textarea>
      <mat-icon matSuffix>mode_edit</mat-icon>
    </mat-form-field>
  </mat-dialog-content>

  <mat-dialog-actions>
    <button mat-raised-button color="primary" type="submit" [mat-dialog-close]="reviewform.value" [disabled]="reviewform.invalid">Speichern</button>
    <button mat-raised-button [mat-dialog-close]="false">Abbrechen</button>
  </mat-dialog-actions>
</form>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""