diff options
Diffstat (limited to 'frontend/src/app/_modals')
4 files changed, 66 insertions, 0 deletions
| diff --git a/frontend/src/app/_modals/yes-no-dialog/yes-no-dialog.component.css b/frontend/src/app/_modals/yes-no-dialog/yes-no-dialog.component.css new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/frontend/src/app/_modals/yes-no-dialog/yes-no-dialog.component.css diff --git a/frontend/src/app/_modals/yes-no-dialog/yes-no-dialog.component.html b/frontend/src/app/_modals/yes-no-dialog/yes-no-dialog.component.html new file mode 100644 index 00000000..06e74093 --- /dev/null +++ b/frontend/src/app/_modals/yes-no-dialog/yes-no-dialog.component.html @@ -0,0 +1,8 @@ +<h2 mat-dialog-title class="text-muted">{{data.title}}</h2> +<div mat-dialog-content class="mt-4" style="color: rgb(81, 76, 76);"> +  {{data.message}} +</div> +<div mat-dialog-actions class="d-flex justify-content-center mt-4"> +  <button mat-button cdkFocusInitial (click)="onYesClick()" style="background-color: lightgray;">Da</button> +  <button mat-button cdkFocusInitial (click)="onNoClick()" style="background-color: lightgray;">Ne</button> +</div>
\ No newline at end of file diff --git a/frontend/src/app/_modals/yes-no-dialog/yes-no-dialog.component.spec.ts b/frontend/src/app/_modals/yes-no-dialog/yes-no-dialog.component.spec.ts new file mode 100644 index 00000000..eecf6468 --- /dev/null +++ b/frontend/src/app/_modals/yes-no-dialog/yes-no-dialog.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import {YesNoDialogComponent } from './yes-no-dialog.component'; + +describe('AlertDialogComponent', () => { +  let component: YesNoDialogComponent; +  let fixture: ComponentFixture<YesNoDialogComponent>; + +  beforeEach(async () => { +    await TestBed.configureTestingModule({ +      declarations: [ YesNoDialogComponent ] +    }) +    .compileComponents(); +  }); + +  beforeEach(() => { +    fixture = TestBed.createComponent(YesNoDialogComponent); +    component = fixture.componentInstance; +    fixture.detectChanges(); +  }); + +  it('should create', () => { +    expect(component).toBeTruthy(); +  }); +}); diff --git a/frontend/src/app/_modals/yes-no-dialog/yes-no-dialog.component.ts b/frontend/src/app/_modals/yes-no-dialog/yes-no-dialog.component.ts new file mode 100644 index 00000000..de1cdd4f --- /dev/null +++ b/frontend/src/app/_modals/yes-no-dialog/yes-no-dialog.component.ts @@ -0,0 +1,33 @@ +import { Component, OnInit } from '@angular/core'; +import { Inject} from '@angular/core'; +import { MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog'; + +interface DialogData { +  title: string; +  message: string; +  yesFunction:Function; +} + +@Component({ +  selector: 'app-yes-no-dialog', +  templateUrl: './yes-no-dialog.component.html', +  styleUrls: ['./yes-no-dialog.component.css'] +}) +export class YesNoDialogComponent { +   +  constructor( +    public dialogRef: MatDialogRef<YesNoDialogComponent>, +    @Inject(MAT_DIALOG_DATA) public data: DialogData, +    //public dialog: MatDialog +  ) {} + +  onNoClick(): void { +    this.dialogRef.close(); +  } +  onYesClick():void{ +    this.data.yesFunction(); +    this.dialogRef.close(); +  } + + +} | 
