mirror of
https://github.com/Spythere/pojazdownik.git
synced 2026-05-03 05:18:10 +00:00
feat: turning around rolling stock
This commit is contained in:
@@ -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'));
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user