blob: 9490237ec1016b468daaca013dd4815b289d4114 [file] [log] [blame]
<div class="header" #header>
<h2>
<span *ngIf="section != 'Team Selection'">{{teamNumber}}</span>
{{section}}
</h2>
</div>
<ng-container [ngSwitch]="section">
<div
*ngSwitchCase="'Team Selection'"
id="team_selection"
class="container-fluid"
>
<div class="row">
<label for="match_number">Match Number</label>
<input
[(ngModel)]="matchNumber"
(ngModelChange)="updateTeamSelectionValidity()"
type="number"
id="match_number"
min="1"
max="999"
/>
</div>
<div class="row">
<label for="team_number">Team Number</label>
<input
[(ngModel)]="teamNumber"
(ngModelChange)="updateTeamSelectionValidity()"
type="text"
id="team_number"
/>
</div>
<div class="row">
<label for="set_number">Set Number</label>
<input
[(ngModel)]="setNumber"
(ngModelChange)="updateTeamSelectionValidity()"
type="number"
id="set_number"
min="1"
max="10"
/>
</div>
<div class="row">
<label for="comp_level">Comp Level</label>
<select
[(ngModel)]="compLevel"
(ngModelChange)="updateTeamSelectionValidity()"
type="number"
id="comp_level"
>
<option *ngFor="let level of COMP_LEVELS" [ngValue]="level">
{{COMP_LEVEL_LABELS[level]}}
</option>
</select>
</div>
<div class="row">
<label>
<input
id="pre_scouting"
type="checkbox"
[(ngModel)]="preScouting"
(ngModelChange)="updateTeamSelectionValidity()"
/>
Pre-scouting
</label>
</div>
<div class="buttons">
<!-- hack to right align the next button -->
<div></div>
<button
class="btn btn-primary"
(click)="changeSectionTo('Init');"
[disabled]="!teamSelectionIsValid"
>
Next
</button>
</div>
</div>
<div *ngSwitchCase="'Init'" id="init" class="container-fluid">
<h2>Select Starting Position</h2>
<img
id="field_starting_positions_image"
src="/sha256/bb83d2c976c1496bb470371821d1d1882d6baf31178009a6f6cba579880c6a03/pictures/field/2024_field.png"
alt="Starting Positions Image"
class="img-fluid"
/>
<div *ngFor="let i of [1, 2, 3, 4]">
<label>
<input
type="radio"
name="radio-group"
[value]="i"
(change)="selectedValue = $event.target.value"
/>
{{ i }}
</label>
</div>
<div class="buttons">
<!-- Creates a responsive stack of full-width, "block buttons". -->
<div class="d-grid gap-5">
<button
class="btn btn-primary"
[disabled]="!selectedValue"
(click)="changeSectionTo('Pickup'); addAction({type: 'startMatchAction', position: selectedValue});"
>
Start Match
</button>
</div>
</div>
</div>
<div *ngSwitchCase="'Pickup'" id="PickUp" class="container-fluid">
<h6 class="text-muted">
Last Action: {{actionList[actionList.length - 1].type}}
</h6>
<!--
Decrease distance between buttons during auto to make space for auto balancing
selection and keep all buttons visible without scrolling on most devices.
-->
<div
[ngClass]="{'d-grid': true, 'gap-3': autoPhase === true, 'gap-5': autoPhase === false}"
>
<button class="btn btn-secondary" (click)="undoLastAction()">UNDO</button>
<button
class="btn btn-danger"
(click)="changeSectionTo('Dead'); addAction({type: 'robotDeathAction', robotOn: false});"
>
DEAD
</button>
<button
class="btn btn-warning"
(click)="changeSectionTo('Place'); addAction({type: 'pickupNoteAction'});"
>
NOTE
</button>
<button
*ngIf="autoPhase && !mobilityCompleted"
class="btn btn-light"
(click)="addAction({type: 'mobilityAction', mobility: true});"
>
Mobility
</button>
<div style="display: flex">
<h5>Penalties :</h5>
<button
class="btn-light"
style="width: 40px; margin-right: 15px"
(click)="removePenalty()"
>
-
</button>
<p>{{this.penalties}}</p>
<button
class="btn-light"
style="width: 40px; margin-left: 15px"
(click)="addPenalty()"
>
+
</button>
</div>
<button
*ngIf="autoPhase"
class="btn btn-dark"
(click)="autoPhase = false; addAction({type: 'endAutoPhase'});"
>
Start Teleop
</button>
<button
*ngIf="!autoPhase"
class="btn btn-info"
(click)="changeSectionTo('Endgame'); addAction({type: 'endTeleopPhase'});"
>
Endgame
</button>
</div>
</div>
<div *ngSwitchCase="'Place'" id="Place" class="container-fluid">
<h6 class="text-muted">
Last Action: {{actionList[actionList.length - 1].type}}
</h6>
<!--
Decrease distance between buttons during auto to make space for auto balancing
selection and keep all buttons visible without scrolling on most devices.
-->
<div
[ngClass]="{'d-grid': true, 'gap-3': autoPhase === true, 'gap-5': autoPhase === false}"
>
<button class="btn btn-secondary" (click)="undoLastAction()">UNDO</button>
<button
class="btn btn-danger"
(click)="changeSectionTo('Dead'); addAction({type: 'robotDeathAction', robotOn: false});"
>
DEAD
</button>
<div *ngIf="!autoPhase" class="d-grid gap-1" style="padding: 0">
<div
style="
display: flex-wrap;
padding: 0;
justify-content: center;
text-align: center;
align-content: center;
margin: 0;
"
>
<button
class="btn btn-success"
(click)="changeSectionTo('Pickup'); addAction({type: 'placeNoteAction', scoreType: ScoreType.kAMP});"
style="width: 48%; height: 12vh; margin: 0px 10px 10px 0px"
>
AMP
</button>
<button
class="btn btn-warning"
(click)="changeSectionTo('Pickup'); addAction({type: 'placeNoteAction', scoreType: ScoreType.kAMP_AMPLIFIED});"
style="width: 48%; height: 12vh; margin: 0px 0px 10px 0px"
>
AMP AMPLIFIED
</button>
<button
class="btn btn-success"
(click)="changeSectionTo('Pickup'); addAction({type: 'placeNoteAction', scoreType: ScoreType.kSPEAKER});"
style="width: 48%; height: 12vh; margin: 0px 10px 0px 0px"
>
SPEAKER
</button>
<button
class="btn btn-warning"
(click)="changeSectionTo('Pickup'); addAction({type: 'placeNoteAction', scoreType: ScoreType.kSPEAKER_AMPLIFIED});"
style="width: 48%; height: 12vh; margin: 0px 0px 0px 0px"
>
SPEAKER AMPLIFIED
</button>
</div>
</div>
<button
*ngIf="autoPhase"
class="btn btn-success"
(click)="changeSectionTo('Pickup'); addAction({type: 'placeNoteAction', scoreType: ScoreType.kAMP});"
>
AMP
</button>
<button
*ngIf="autoPhase"
class="btn btn-warning"
(click)="changeSectionTo('Pickup'); addAction({type: 'placeNoteAction', scoreType: ScoreType.kSPEAKER});"
>
SPEAKER
</button>
<button
*ngIf="autoPhase && !mobilityCompleted"
class="btn btn-light"
(click)="addAction({type: 'mobilityAction', mobility: true});"
>
Mobility
</button>
<div style="display: flex">
<h5>Penalties :</h5>
<button
class="btn-light"
style="width: 40px; margin-right: 15px"
(click)="removePenalty()"
>
-
</button>
<p>{{this.penalties}}</p>
<button
class="btn-light"
style="width: 40px; margin-left: 15px"
(click)="addPenalty()"
>
+
</button>
</div>
<button
class="btn btn-dark"
*ngIf="autoPhase"
(click)="autoPhase = false; addAction({type: 'endAutoPhase'});"
>
Start Teleop
</button>
<button
*ngIf="!autoPhase"
class="btn btn-info"
(click)="changeSectionTo('Endgame'); addAction({type: 'endTeleopPhase'});"
>
Endgame
</button>
</div>
</div>
<div *ngSwitchCase="'Endgame'" id="Endgame" class="container-fluid">
<h6 class="text-muted">
Last Action: {{actionList[actionList.length - 1].type}}
</h6>
<div class="d-grid gap-4">
<button class="btn btn-secondary" (click)="undoLastAction()">UNDO</button>
<button
class="btn btn-danger"
(click)="changeSectionTo('Dead'); addAction({type: 'robotDeathAction', robotOn: false});"
>
DEAD
</button>
<label style="padding: 0">
<input
#park
type="radio"
id="option1"
name="endgameaction"
value="park"
/>
Park
</label>
<label style="padding: 0">
<input
#onStage
type="radio"
id="option2"
name="endgameaction"
value="onStage"
/>
On Stage
</label>
<label style="padding: 0">
<input
#harmony
type="radio"
id="option3"
name="endgameaction"
value="harmony"
/>
Harmony
</label>
<label style="padding: 0">
<input
#trapNote
type="checkbox"
id="trapnote"
name="trapnote"
value="trapNote"
/>
Trap Note
</label>
<div style="display: flex">
<h5>Penalties :</h5>
<button
class="btn-light"
style="width: 40px; margin-right: 15px"
(click)="removePenalty()"
>
-
</button>
<p>{{this.penalties}}</p>
<button
class="btn-light"
style="width: 40px; margin-left: 15px"
(click)="addPenalty()"
>
+
</button>
</div>
<button
*ngIf="!autoPhase"
class="btn btn-info"
(click)="changeSectionTo('Review and Submit'); addPenalties(); addAction({type: 'endMatchAction', park: park.checked, onStage: onStage.checked, harmony: harmony.checked, trapNote: trapNote.checked});"
>
End Match
</button>
</div>
</div>
<div *ngSwitchCase="'Dead'" id="Dead" class="container-fluid">
<h2>Robot is dead</h2>
<div class="d-grid gap-2">
<button
class="btn btn-success"
(click)="changeSectionTo('Pickup'); addAction({type: 'robotDeathAction', robotOn: true}); "
>
Revive
</button>
</div>
</div>
<div *ngSwitchCase="'Review and Submit'" id="Review" class="container-fluid">
<div class="row">
<ul id="review_data">
<li
*ngFor="let action of actionList"
[ngValue]="action"
style="display: flex"
>
<div [ngSwitch]="action.type" style="padding: 0px">
<span *ngSwitchCase="'startMatchAction'">
Started match at position {{action.position}}
</span>
<span *ngSwitchCase="'pickupNoteAction'">Picked up Note</span>
<span *ngSwitchCase="'placeNoteAction'">
Placed at {{stringifyScoreType(action.scoreType)}}
</span>
<span *ngSwitchCase="'endAutoPhase'">Ended auto phase</span>
<span *ngSwitchCase="'endMatchAction'">
Ended Match; park: {{action.park}}, onStage: {{action.onStage}},
harmony: {{action.harmony}}, trapNote: {{action.trapNote}}
</span>
<span *ngSwitchCase="'robotDeathAction'">
Robot on: {{action.robotOn}}
</span>
<span *ngSwitchCase="'mobilityAction'">
Mobility: {{action.mobility}}
</span>
<span *ngSwitchDefault>{{action.type}}</span>
<span *ngSwitchCase="'penaltyAction'">
Penalties: {{action.penalties}}
</span>
</div>
</li>
</ul>
</div>
<div class="d-grid gap-5">
<button class="btn btn-secondary" (click)="undoLastAction()">UNDO</button>
<button class="btn btn-warning" (click)="submit2024Actions();">
Submit
</button>
</div>
</div>
<div *ngSwitchCase="'Success'" id="Success" class="container-fluid">
<h2>Successfully submitted data.</h2>
</div>
<span class="progress_message" role="alert">{{ progressMessage }}</span>
<span class="error_message" role="alert">{{ errorMessage }}</span>
</ng-container>