Add delete functionality to the scouting app
This patch adds the ability to delete data scouting entries
from the database through the view tab.
Signed-off-by: Filip Kujawa <filip.j.kujawa@gmail.com>
Change-Id: I294fd3ebfa3721dace00582ba7f22e3da5f0f419
diff --git a/scouting/www/view/view.ng.html b/scouting/www/view/view.ng.html
index 667765f..2273217 100644
--- a/scouting/www/view/view.ng.html
+++ b/scouting/www/view/view.ng.html
@@ -11,12 +11,22 @@
</button>
<ul class="dropdown-menu">
<li>
- <a class="dropdown-item" href="#" (click)="switchDataSource('Notes')">
+ <a
+ class="dropdown-item"
+ href="#"
+ (click)="switchDataSource('Notes')"
+ id="notes_source_dropdown"
+ >
Notes
</a>
</li>
<li>
- <a class="dropdown-item" href="#" (click)="switchDataSource('Stats2023')">
+ <a
+ class="dropdown-item"
+ href="#"
+ (click)="switchDataSource('Stats2023')"
+ id="stats_source_dropdown"
+ >
Stats
</a>
</li>
@@ -25,6 +35,7 @@
class="dropdown-item"
href="#"
(click)="switchDataSource('DriverRanking')"
+ id="driver_ranking_source_dropdown"
>
Driver Ranking
</a>
@@ -64,7 +75,7 @@
<td>{{parseKeywords(note)}}</td>
<!-- Delete Icon. -->
<td>
- <button class="btn btn-danger" (click)="deleteData()">
+ <button class="btn btn-danger" (click)="deleteNoteData()">
<i class="bi bi-trash"></i>
</button>
</td>
@@ -94,13 +105,17 @@
</thead>
<tbody>
<tr *ngFor="let stat2023 of statList; index as i;">
- <th scope="row">{{stat2023.match()}}</th>
- <td>{{stat2023.team()}}</td>
+ <th scope="row">{{stat2023.matchNumber()}}</th>
+ <td>{{stat2023.teamNumber()}}</td>
<td>{{stat2023.setNumber()}}</td>
<td>{{COMP_LEVEL_LABELS[stat2023.compLevel()]}}</td>
<!-- Delete Icon. -->
<td>
- <button class="btn btn-danger" (click)="deleteData()">
+ <button
+ class="btn btn-danger"
+ id="delete_button_{{i}}"
+ (click)="deleteDataScouting(stat2023.compLevel(), stat2023.matchNumber(), stat2023.setNumber(), stat2023.teamNumber())"
+ >
<i class="bi bi-trash"></i>
</button>
</td>
@@ -136,7 +151,7 @@
<td>{{ranking.rank3()}}</td>
<!-- Delete Icon. -->
<td>
- <button class="btn btn-danger" (click)="deleteData()">
+ <button class="btn btn-danger" (click)="deleteDriverRankingData()">
<i class="bi bi-trash"></i>
</button>
</td>