Last change
on this file since baf4cc4 was baf4cc4, checked in by ppaunovski <paunovskipavel@…>, 3 months ago |
split group project and individual project into two separate folders
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | import {Component, Input} from '@angular/core';
|
---|
2 | import { TicketResponse } from '../../model/responses/TicketResponse';
|
---|
3 | import {MatButtonModule} from '@angular/material/button';
|
---|
4 | import {MatCardModule} from '@angular/material/card';
|
---|
5 | import {TicketService} from "../../services/ticket/ticket.service";
|
---|
6 | import {Router} from "@angular/router";
|
---|
7 | import {MatSnackBar} from '@angular/material/snack-bar';
|
---|
8 | import {MatInputModule} from '@angular/material/input';
|
---|
9 | import {MatFormFieldModule} from '@angular/material/form-field';
|
---|
10 |
|
---|
11 |
|
---|
12 | @Component({
|
---|
13 | selector: 'app-ticket',
|
---|
14 | standalone: true,
|
---|
15 | imports: [MatCardModule, MatButtonModule],
|
---|
16 | templateUrl: './ticket.component.html',
|
---|
17 | })
|
---|
18 | export class TicketComponent {
|
---|
19 | @Input() ticket: TicketResponse | undefined;
|
---|
20 |
|
---|
21 | constructor(private service: TicketService, private router: Router, private _snackBar: MatSnackBar) {
|
---|
22 | }
|
---|
23 |
|
---|
24 | activateTicket() {
|
---|
25 | if(this.ticket) {
|
---|
26 | this.service.activateTicket(this.ticket.id).subscribe({
|
---|
27 | next: () => {
|
---|
28 | this.openSnackBar("Ticket successfully activated!", "Okay");
|
---|
29 | }
|
---|
30 | })
|
---|
31 | }
|
---|
32 | }
|
---|
33 |
|
---|
34 | openSnackBar(message: string, action: string) {
|
---|
35 | this._snackBar.open(message, action);
|
---|
36 | }
|
---|
37 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.