mirror of
https://github.com/Spythere/pojazdownik.git
synced 2026-05-03 05:18:10 +00:00
26 lines
760 B
TypeScript
26 lines
760 B
TypeScript
import { useStore } from '../store';
|
|
|
|
export function getCurrentStockFileName() {
|
|
const store = useStore();
|
|
|
|
let fileName = '';
|
|
|
|
if (store.chosenStorageStockName.trim() != '') {
|
|
return store.chosenStorageStockName;
|
|
}
|
|
|
|
const currentStockString = store.stockList.map((s) => s.vehicleRef.type).join(';');
|
|
|
|
const currentRealComp = store.realCompositionList.find((rc) => rc.stockString == currentStockString);
|
|
|
|
// Append real composition to the name if chosen
|
|
if (currentRealComp != undefined) {
|
|
fileName += `${currentRealComp.stockId} `;
|
|
}
|
|
|
|
// Append default props
|
|
fileName += `${store.stockList[0].vehicleRef.type} ${(store.totalWeight / 1000).toFixed(1)}t; ${store.totalLength}m; vmax ${store.maxStockSpeed}`;
|
|
|
|
return fileName;
|
|
}
|