blob: a1cffc3a549383822dd910a158a45956dc43bfee [file] [log] [blame]
Philipp Schrader80587432022-03-05 15:41:22 -08001import { Component, OnInit } from '@angular/core';
2
3type Section = 'Auto'|'TeleOp'|'Climb'|'Defense'|'Review and Submit'|'Home'
4type 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 {
12 section: Section = 'Auto'; //placeholder
13 autoUpperShotsMade: number = 0;
14 autoLowerShotsMade: number = 0;
15 autoShotsMissed: number = 0;
16 teleUpperShotsMade: number = 0;
17 teleLowerShotsMade: number = 0;
18 teleShotsMissed: number = 0;
Alex Perrybb3d2062022-03-05 18:14:33 -080019 defensePlayedOnScore: number = 3;
20 defensePlayedScore: number = 3;
Philipp Schrader80587432022-03-05 15:41:22 -080021 level: Level;
22 proper: boolean = false;
23 climbed: boolean = false;
24
25 toggleProper() {
26 this.proper = !this.proper;
27 }
28
29 setLow() {
30 this.level = 'Low';
31 }
32
33 setMedium() {
34 this.level = 'Medium';
35 }
36
37 setHigh() {
38 this.level = 'High';
39 }
40
41 setTransversal() {
42 this.level = 'Transversal';
43 }
44
45 defensePlayedOnSlider(event) {
46 this.defensePlayedOnScore = event.target.value;
47 }
48
49 defensePlayedSlider(event) {
50 this.defensePlayedScore = event.target.value;
51 }
52
53 setClimbedTrue() {
54 this.climbed = true;
55 }
56
57 setClimbedFalse() {
58 this.climbed = false;
59 }
60
61 nextSection() {
62 if (this.section === 'Auto') {
63 this.section = 'TeleOp';
64 } else if (this.section === 'TeleOp') {
65 this.section = 'Climb';
66 } else if (this.section === 'Climb') {
67 this.section = 'Defense';
68 } else if (this.section === 'Defense') {
69 this.section = 'Review and Submit';
70 } else if (this.section === 'Review and Submit') {
71 this.section = 'Home';
72 }
73 }
74
Alex Perrybb3d2062022-03-05 18:14:33 -080075 prevSection() {
76 if (this.section === 'TeleOp') {
77 this.section = 'Auto';
78 } else if (this.section === 'Climb') {
79 this.section = 'TeleOp';
80 } else if (this.section === 'Defense') {
81 this.section = 'Climb';
82 } else if (this.section === 'Review and Submit') {
83 this.section = 'Defense';
84 }
85 }
86
Philipp Schrader80587432022-03-05 15:41:22 -080087 adjustAutoUpper(by: number) {
88 this.autoUpperShotsMade = Math.max(0, this.autoUpperShotsMade + by);
89 }
90
91 adjustAutoLower(by: number) {
92 this.autoLowerShotsMade = Math.max(0, this.autoLowerShotsMade + by);
93 }
94
95 adjustAutoMissed(by: number) {
96 this.autoShotsMissed = Math.max(0, this.autoShotsMissed + by);
97 }
98
99 adjustTeleUpper(by: number) {
100 this.teleUpperShotsMade = Math.max(0, this.teleUpperShotsMade + by);
101 }
102
103 adjustTeleLower(by: number) {
104 this.teleLowerShotsMade = Math.max(0, this.teleLowerShotsMade + by);
105 }
106
107 adjustTeleMissed(by: number) {
108 this.teleShotsMissed = Math.max(0, this.teleShotsMissed + by);
109 }
110}