diff options
author | TAMARA JERINIC <tamara.jerinic@gmail.com> | 2022-04-12 19:01:22 +0200 |
---|---|---|
committer | TAMARA JERINIC <tamara.jerinic@gmail.com> | 2022-04-12 21:08:08 +0200 |
commit | 39f9fcb303924c3f9dd8fce3f332d4bc4aa14a9d (patch) | |
tree | 5166f7d973f31eab4581a0b61ca44bd4ecf5495d /frontend/src/app/_modals/yes-no-dialog | |
parent | 681f851a6b3663285f32bc380b48a8e80c6e7ade (diff) |
Reorganizovani su item-dataset, item-model, my-datasets, my-models. Dodat je yes-no-dialog.
123
Diffstat (limited to 'frontend/src/app/_modals/yes-no-dialog')
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(); + } + + +} |