blob: 0e7223b8d3c97c035e368f80e903c02a03a4dad9 [file] [log] [blame]
Philipp Schrader80587432022-03-05 15:41:22 -08001import { Component, OnInit } from '@angular/core';
2
Philipp Schrader93ade042022-03-05 17:16:10 -08003type Section = 'Team Selection'|'Auto'|'TeleOp'|'Climb'|'Defense'|'Review and Submit'|'Home'
Philipp Schrader80587432022-03-05 15:41:22 -08004type Level = 'Low'|'Medium'|'High'|'Transversal'
5
6@Component({
7 selector: 'app-entry',
8 templateUrl: './entry.ng.html',
9 styleUrls: ['./entry.component.css']
10})
11export class EntryComponent {
Philipp Schrader93ade042022-03-05 17:16:10 -080012 section: Section = 'Team Selection';
13 matchNumber: number = 1
14 teamNumber: number = 1
Philipp Schrader80587432022-03-05 15:41:22 -080015 autoUpperShotsMade: number = 0;
16 autoLowerShotsMade: number = 0;
17 autoShotsMissed: number = 0;
18 teleUpperShotsMade: number = 0;
19 teleLowerShotsMade: number = 0;
20 teleShotsMissed: number = 0;
Alex Perrybb3d2062022-03-05 18:14:33 -080021 defensePlayedOnScore: number = 3;
22 defensePlayedScore: number = 3;
Philipp Schrader80587432022-03-05 15:41:22 -080023 level: Level;
24 proper: boolean = false;
25 climbed: boolean = false;
26
27 toggleProper() {
28 this.proper = !this.proper;
29 }
30
31 setLow() {
32 this.level = 'Low';
33 }
34
35 setMedium() {
36 this.level = 'Medium';
37 }
38
39 setHigh() {
40 this.level = 'High';
41 }
42
43 setTransversal() {
44 this.level = 'Transversal';
45 }
46
47 defensePlayedOnSlider(event) {
48 this.defensePlayedOnScore = event.target.value;
49 }
50
51 defensePlayedSlider(event) {
52 this.defensePlayedScore = event.target.value;
53 }
54
55 setClimbedTrue() {
56 this.climbed = true;
57 }
58
59 setClimbedFalse() {
60 this.climbed = false;
61 }
62
63 nextSection() {
Philipp Schrader93ade042022-03-05 17:16:10 -080064 if (this.section === 'Team Selection') {
65 this.section = 'Auto';
66 } else if (this.section === 'Auto') {
Philipp Schrader80587432022-03-05 15:41:22 -080067 this.section = 'TeleOp';
68 } else if (this.section === 'TeleOp') {
69 this.section = 'Climb';
70 } else if (this.section === 'Climb') {
71 this.section = 'Defense';
72 } else if (this.section === 'Defense') {
73 this.section = 'Review and Submit';
74 } else if (this.section === 'Review and Submit') {
75 this.section = 'Home';
76 }
77 }
78
Alex Perrybb3d2062022-03-05 18:14:33 -080079 prevSection() {
Philipp Schrader93ade042022-03-05 17:16:10 -080080 if (this.section === 'Auto') {
81 this.section = 'Team Selection';
82 } else if (this.section === 'TeleOp') {
Alex Perrybb3d2062022-03-05 18:14:33 -080083 this.section = 'Auto';
84 } else if (this.section === 'Climb') {
85 this.section = 'TeleOp';
86 } else if (this.section === 'Defense') {
87 this.section = 'Climb';
88 } else if (this.section === 'Review and Submit') {
89 this.section = 'Defense';
90 }
91 }
92
Philipp Schrader80587432022-03-05 15:41:22 -080093 adjustAutoUpper(by: number) {
94 this.autoUpperShotsMade = Math.max(0, this.autoUpperShotsMade + by);
95 }
96
97 adjustAutoLower(by: number) {
98 this.autoLowerShotsMade = Math.max(0, this.autoLowerShotsMade + by);
99 }
100
101 adjustAutoMissed(by: number) {
102 this.autoShotsMissed = Math.max(0, this.autoShotsMissed + by);
103 }
104
105 adjustTeleUpper(by: number) {
106 this.teleUpperShotsMade = Math.max(0, this.teleUpperShotsMade + by);
107 }
108
109 adjustTeleLower(by: number) {
110 this.teleLowerShotsMade = Math.max(0, this.teleLowerShotsMade + by);
111 }
112
113 adjustTeleMissed(by: number) {
114 this.teleShotsMissed = Math.max(0, this.teleShotsMissed + by);
115 }
116}