blob: 828e0362ae5c715769d75c2831787f7ada2e66f9 [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"
type="number"
id="match_number"
min="1"
max="999"
/>
</div>
<div class="row">
<label for="team_number">Team Number</label>
<input
[(ngModel)]="teamNumber"
type="number"
id="team_number"
min="1"
max="9999"
/>
</div>
<div class="row">
<label for="set_number">Set Number</label>
<input
[(ngModel)]="setNumber"
type="number"
id="set_number"
min="1"
max="10"
/>
</div>
<div class="row">
<label for="comp_level">Comp Level</label>
<select [(ngModel)]="compLevel" type="number" id="comp_level">
<option *ngFor="let level of COMP_LEVELS" [ngValue]="level">
{{COMP_LEVEL_LABELS[level]}}
</option>
</select>
</div>
<div class="buttons">
<!-- hack to right align the next button -->
<div></div>
<button class="btn btn-primary" (click)="changeSectionTo('Init');">
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/b71def525fb78486617a8b350c0ba6907e8ea25f78d4084a932cba8ae922528c/pictures/field/field.jpg"
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: 'pickupObjectAction', objectType: ObjectType.kCone});"
>
CONE
</button>
<button
class="btn btn-primary"
(click)="changeSectionTo('Place'); addAction({type: 'pickupObjectAction', objectType: ObjectType.kCube});"
>
CUBE
</button>
<button
*ngIf="autoPhase"
class="btn btn-light"
(click)="addAction({type: 'mobilityAction', mobility: true});"
>
Mobility
</button>
<!-- 'Balancing' during auto. -->
<div *ngIf="autoPhase" class="d-grid gap-2">
<label>
<input #docked type="checkbox" />
Docked (on the charging station)
</label>
<label>
<input #engaged type="checkbox" />
Engaged (level &amp; station lights on)
</label>
<label>
<input #attempted type="checkbox" />
Attempted to dock and engage but failed
</label>
<br />
<button
class="btn btn-info"
(click)="addAction({type: 'autoBalanceAction', docked: docked.checked, engaged: engaged.checked, balanceAttempt: attempted.checked});"
>
Submit Balancing
</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')"
>
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>
<button
class="btn btn-success"
(click)="changeSectionTo('Pickup'); addAction({type: 'placeObjectAction', scoreLevel: ScoreLevel.kHigh});"
>
HIGH
</button>
<button
class="btn btn-warning"
(click)="changeSectionTo('Pickup'); addAction({type: 'placeObjectAction', scoreLevel: ScoreLevel.kMiddle});"
>
MID
</button>
<button
class="btn btn-danger"
(click)="changeSectionTo('Pickup'); addAction({type: 'placeObjectAction', scoreLevel: ScoreLevel.kLow});"
>
LOW
</button>
<button
*ngIf="autoPhase"
class="btn btn-light"
(click)="addAction({type: 'mobilityAction', mobility: true});"
>
Mobility
</button>
<!-- Impossible to place supercharged pieces in auto. -->
<div *ngIf="autoPhase == false" class="d-grid gap-2">
<button
class="btn btn-dark"
(click)="changeSectionTo('Pickup'); addAction({type: 'placeObjectAction', scoreLevel: ScoreLevel.kSupercharged});"
>
SUPERCHARGED
</button>
</div>
<!-- 'Balancing' during auto. -->
<div *ngIf="autoPhase" class="d-grid gap-1">
<label>
<input #docked type="checkbox" />
Docked (on the charging station)
</label>
<label>
<input #engaged type="checkbox" />
Engaged (level &amp; station lights on)
</label>
<label>
<input #attempted type="checkbox" />
Attempted to dock and engage but failed
</label>
<br />
<button
class="btn btn-info"
(click)="addAction({type: 'autoBalanceAction', docked: docked.checked, engaged: engaged.checked, balanceAttempt: attempted.checked});"
>
Submit Balancing
</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')"
>
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-5">
<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>
<input #docked type="checkbox" />
Docked (on the charging station)
</label>
<label>
<input #engaged type="checkbox" />
Engaged (level &amp; station lights on)
</label>
<label>
<input #attempted type="checkbox" />
Attempted to dock and engage but failed
</label>
<button
*ngIf="!autoPhase"
class="btn btn-info"
(click)="changeSectionTo('Review and Submit'); addAction({type: 'endMatchAction', docked: docked.checked, engaged: engaged.checked, balanceAttempt: attempted.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>
<button
class="btn btn-info"
(click)="changeSectionTo('Review and Submit'); addAction({type: 'endMatchAction', docked: docked.checked, engaged: engaged.checked});"
>
End Match
</button>
</div>
</div>
<div *ngSwitchCase="'Review and Submit'" id="Review" class="container-fluid">
<div class="d-grid gap-5">
<button class="btn btn-secondary" (click)="undoLastAction()">UNDO</button>
<button class="btn btn-warning" (click)="submitActions();">Submit</button>
</div>
</div>
<div *ngSwitchCase="'Success'" id="Success" class="container-fluid">
<h2>Successfully submitted data.</h2>
</div>
<span class="error_message" role="alert">{{ errorMessage }}</span>
</ng-container>