source: bus-n-go-pavel-216049/bus-n-go-frontend/src/app/components/ticket/ticket.component.ts@ baf4cc4

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 
1import {Component, Input} from '@angular/core';
2import { TicketResponse } from '../../model/responses/TicketResponse';
3import {MatButtonModule} from '@angular/material/button';
4import {MatCardModule} from '@angular/material/card';
5import {TicketService} from "../../services/ticket/ticket.service";
6import {Router} from "@angular/router";
7import {MatSnackBar} from '@angular/material/snack-bar';
8import {MatInputModule} from '@angular/material/input';
9import {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})
18export 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.