feat: turning around rolling stock

This commit is contained in:
2025-04-04 20:53:09 +02:00
parent 50f573e8c6
commit c9ad50b01e
3 changed files with 28 additions and 0 deletions
@@ -67,6 +67,16 @@
>
<Shuffle :stroke-width="2.5" />
</button>
<button
class="btn btn--image"
:data-disabled="stockIsEmpty"
:disabled="stockIsEmpty"
@click="turnAroundCars"
:data-button-tooltip="$t('stocklist.action-switch')"
>
<Repeat :stroke-width="2.5" />
</button>
</div>
<div class="actions-bottom" :data-disabled="store.chosenStockListIndex == -1">
@@ -201,6 +211,22 @@ export default defineComponent({
}
},
turnAroundCars() {
if (this.store.stockList.length <= 1) return;
const isFirstTractionUnit = isTractionUnit(this.store.stockList[0].vehicleRef);
const sliceToSwap = isFirstTractionUnit
? this.store.stockList.slice(1)
: this.store.stockList.slice();
sliceToSwap.reverse();
if (isFirstTractionUnit) sliceToSwap.unshift(this.store.stockList[0]);
this.store.stockList = sliceToSwap;
},
downloadStock() {
if (this.store.stockList.length == 0) return alert(this.$t('stocklist.alert-empty'));
+1
View File
@@ -68,6 +68,7 @@
"action-copy": "COPY TO CLIPBOARD",
"action-reset": "RESET",
"action-shuffle": "SHUFFLE",
"action-switch": "TURN AROUND",
"action-bookmark": "BOOKMARK",
"mass": "Mass",
"mass-accepted": "accepted",
+1
View File
@@ -68,6 +68,7 @@
"action-copy": "SKOPIUJ DO SCHOWKA",
"action-reset": "ZRESETUJ",
"action-shuffle": "PRZETASUJ",
"action-switch": "ODWRÓĆ",
"action-bookmark": "ZAPISZ",
"mass": "Masa",
"mass-accepted": "dopuszczalna",