blob: 139268fadadb5d475135e4d690e69eea5f7f3183 [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', robotDead: true});"
>
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-4': autoPhase === true, 'gap-3': autoPhase === false}"
>
<button class="btn btn-secondary" (click)="undoLastAction()">UNDO</button>
<button
class="btn btn-danger"
(click)="changeSectionTo('Dead'); addAction({type: 'robotDeathAction', robotDead: true});"
>
DEAD
</button>
<button
class="btn btn-info"
(click)="changeSectionTo('Pickup'); addAction({type: 'placeNoteAction', scoreType: ScoreType.kDROPPED});"
>
Dropped
</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-2">
<button class="btn btn-secondary" (click)="undoLastAction()">UNDO</button>
<button
class="btn btn-danger"
(click)="changeSectionTo('Dead'); addAction({type: 'robotDeathAction', robotDead: true});"
>
DEAD
</button>
<div class="button_row">
<label>
<input
#park
type="radio"
id="option1"
name="endgameaction"
value="park"
/>
Park
</label>
<label>
<input
#onStage
type="radio"
id="option2"
name="endgameaction"
value="onStage"
/>
On Stage
</label>
</div>
<div class="button_row">
<label>
<input
#harmony
type="radio"
id="option3"
name="endgameaction"
value="harmony"
/>
Harmony
</label>
<label>
<input
#na
type="radio"
id="option2"
name="endgameaction"
value="na"
/>
N/A
</label>
</div>
<label>
<input
#trapNote
type="checkbox"
id="trapnote"
name="trapnote"
value="trapNote"
/>
Trap Note
</label>
<label>
<input
#spotlight
type="checkbox"
id="spotlight"
name="spotlight"
value="spotlight"
/>
Spotlight
</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', stageType: (park.checked ? StageType.kPARK : onStage.checked ? StageType.kON_STAGE : harmony.checked ? StageType.kHARMONY : StageType.kMISSING), trapNote: trapNote.checked, spotlight: spotlight.checked});"
>
End Match
</button>
</div>
</div>
<div *ngSwitchCase="'Dead'" id="Dead" class="container-fluid">
<h2>Robot is dead</h2>
<div class="d-grid gap-3">
<button class="btn btn-secondary" (click)="undoLastAction()">UNDO</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-success"
(click)="changeSectionTo('Pickup'); addAction({type: 'robotDeathAction', robotDead: false}); "
>
Revive
</button>
<button
*ngIf="!autoPhase"
class="btn btn-info"
(click)="changeSectionTo('Review and Submit'); addPenalties(); addAction({type: 'endMatchAction', stageType: (park.checked ? StageType.kPARK : onStage.checked ? StageType.kON_STAGE : harmony.checked ? StageType.kHARMONY : StageType.kMISSING), trapNote: trapNote.checked, spotlight: spotlight.checked});"
>
End Match
</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; stageType: {{(action.stageType === 0 ? "kON_STAGE" :
action.stageType === 1 ? "kPARK" : action.stageType === 2 ?
"kHARMONY" : "kMISSING")}}, trapNote: {{action.trapNote}},
spotlight: {{action.spotlight}}
</span>
<span *ngSwitchCase="'robotDeathAction'">
Robot dead: {{action.robotDead}}
</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-info" (click)="changeSectionTo('QR Code');">
Create QR Code
</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>
<div *ngSwitchCase="'QR Code'" id="QR Code" class="container-fluid">
<span>Density:</span>
<select
[(ngModel)]="qrCodeValuePieceSize"
(ngModelChange)="updateQrCodeValuePieceSize()"
type="number"
id="qr_code_piece_size"
>
<option
*ngFor="let pieceSize of QR_CODE_PIECE_SIZES"
[ngValue]="pieceSize"
>
{{pieceSize}}
</option>
</select>
<div class="qr-container">
<qrcode
[qrdata]="qrCodeValuePieces[qrCodeValueIndex]"
[width]="1000"
[errorCorrectionLevel]="'M'"
[margin]="6"
class="qrcode"
></qrcode>
</div>
<nav class="qrcode-nav">
<ul
class="qrcode-buttons pagination pagination-lg justify-content-center"
>
<li class="page-item">
<a
class="page-link"
href="#"
aria-label="Previous"
(click)="setQrCodeValueIndex(qrCodeValueIndex - 1)"
>
<span aria-hidden="true">&laquo;</span>
<span class="visually-hidden">Previous</span>
</a>
</li>
<li *ngFor="let _ of qrCodeValuePieces; index as i" class="page-item">
<a
class="page-link"
href="#"
(click)="setQrCodeValueIndex(i)"
[class.active]="qrCodeValueIndex == i"
>
{{i + 1}}
</a>
</li>
<li class="page-item">
<a
class="page-link"
href="#"
aria-label="Next"
(click)="setQrCodeValueIndex(qrCodeValueIndex + 1)"
>
<span aria-hidden="true">&raquo;</span>
<span class="visually-hidden">Next</span>
</a>
</li>
</ul>
</nav>
<button
class="btn btn-secondary"
(click)="changeSectionTo('Review and Submit')"
>
BACK
</button>
</div>
<span class="progress_message" role="alert">{{ progressMessage }}</span>
<span class="error_message" role="alert">{{ errorMessage }}</span>
</ng-container>