diff --git a/src/components/tabs/stock-list/StockWarnings.vue b/src/components/tabs/stock-list/StockWarnings.vue
index 817d8aa..d00be8c 100644
--- a/src/components/tabs/stock-list/StockWarnings.vue
+++ b/src/components/tabs/stock-list/StockWarnings.vue
@@ -2,31 +2,25 @@
(!) {{ $t('stocklist.warning-not-suitable') }}
-
- (!) {{ $t('stocklist.warning-passenger-too-long') }}
-
+
(!) {{ $t('stocklist.warning-passenger-too-long') }}
-
- (!) {{ $t('stocklist.warning-freight-too-long') }}
-
+
(!) {{ $t('stocklist.warning-freight-too-long') }}
(!)
- {{
- $t('stocklist.warning-team-only-vehicle', [
- teamOnlyVehicles.map((v) => v.vehicleRef.type).join(', '),
- ])
- }}
+ {{ $t('stocklist.warning-team-only-vehicle', [teamOnlyVehicles.map((v) => v.vehicleRef.type).join(', ')]) }}
+
+
+
+ {{ $t('cargo-warnings.title') }}
+ {{ [...store.cargoWarnings].map((v) => $t(`cargo-warnings.${v}`)).join('; ') }}
(!)
-
+
{{ $t('stocklist.acceptable-mass-docs') }}
@@ -55,16 +49,11 @@ export default defineComponent({
},
hasAnyWarnings() {
- return (
- this.weightExceeded || this.lengthExceeded || this.locoNotSuitable || this.teamOnlyVehicles
- );
+ return this.weightExceeded || this.lengthExceeded || this.locoNotSuitable || this.teamOnlyVehicles;
},
lengthExceeded() {
- return (
- (this.store.totalLength > 350 && this.store.isTrainPassenger) ||
- (this.store.totalLength > 650 && !this.store.isTrainPassenger)
- );
+ return (this.store.totalLength > 350 && this.store.isTrainPassenger) || (this.store.totalLength > 650 && !this.store.isTrainPassenger);
},
weightExceeded() {
@@ -76,9 +65,7 @@ export default defineComponent({
!this.store.isTrainPassenger &&
this.store.stockList.length > 1 &&
!this.store.stockList.every((stock) => isTractionUnit(stock.vehicleRef)) &&
- this.store.stockList.some(
- (stock) => isTractionUnit(stock.vehicleRef) && stock.vehicleRef.type.startsWith('EP')
- )
+ this.store.stockList.some((stock) => isTractionUnit(stock.vehicleRef) && stock.vehicleRef.type.startsWith('EP'))
);
},
},
diff --git a/src/locales/en.json b/src/locales/en.json
index 60270ff..93ce4b2 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -325,5 +325,13 @@
"418Vb_WIEBE": "loose cargo (sand, stone)",
"418Vb_ZOS": "loose cargo (sand, stone)",
"418Vb_ZUE": "loose cargo (sand, stone)"
+ },
+ "cargo-warnings": {
+ "title": "Cargo warnings:",
+ "warning_wt_20_pn": "PN: exceeded gauge (Innofreight - C45)",
+ "warning_un1965_twr": "TWR: LPG (UN 1965)",
+ "warning_un1965_tn": "TN: LPG - empty tank (UN 1965)",
+ "warning_un1202_twr": "TWR: diesel fuel (UN 1202)",
+ "warning_un1202_tn": "TN: diesel fuel - empty tank (UN 1202)"
}
}
\ No newline at end of file
diff --git a/src/locales/pl.json b/src/locales/pl.json
index a1914f7..8f65fa5 100644
--- a/src/locales/pl.json
+++ b/src/locales/pl.json
@@ -324,5 +324,13 @@
"418Vb_WIEBE": "drobnica, ładunki sypkie (piasek, kamień)",
"418Vb_ZOS": "drobnica, ładunki sypkie (piasek, kamień)",
"418Vb_ZUE": "drobnica, ładunki sypkie (piasek, kamień)"
+ },
+ "cargo-warnings": {
+ "title": "Uwagi przewozowe:",
+ "warning_wt_20_pn": "PN: przekroczona skrajnia (Innofreight - C45)",
+ "warning_un1965_twr": "TWR: gazy węglowodorowe skroplone (UN 1965)",
+ "warning_un1965_tn": "TN: gazy węglowodorowe skroplone - puste cysterny (UN 1965)",
+ "warning_un1202_twr": "TWR: olej napędowy (UN 1202)",
+ "warning_un1202_tn": "TN: olej napędowy - puste cysterny (UN 1202)"
}
}
\ No newline at end of file
diff --git a/src/store.ts b/src/store.ts
index 7863190..9bfaed3 100644
--- a/src/store.ts
+++ b/src/store.ts
@@ -15,6 +15,7 @@ import { defineStore } from 'pinia';
import {
acceptableWeight,
carDataList,
+ getCargoWarnings,
isTractionUnit,
isTrainPassenger,
locoDataList,
@@ -68,15 +69,13 @@ export const useStore = defineStore('store', {
getters: {
locoDataList: (state) => locoDataList(state.vehiclesData),
carDataList: (state) => carDataList(state.vehiclesData),
- vehicleDataList: (state) => [
- ...locoDataList(state.vehiclesData),
- ...carDataList(state.vehiclesData),
- ],
+ vehicleDataList: (state) => [...locoDataList(state.vehiclesData), ...carDataList(state.vehiclesData)],
totalWeight: (state) => totalWeight(state.stockList),
totalLength: (state) => totalLength(state.stockList),
maxStockSpeed: (state) => maxStockSpeed(state.stockList),
isTrainPassenger: (state) => isTrainPassenger(state.stockList),
acceptableWeight: (state) => acceptableWeight(state.stockList),
+ cargoWarnings: (state) => getCargoWarnings(state.stockList),
stockSupportsColdStart: (state) => stockSupportsColdStart(state.stockList),
stockSupportsDoubleManning: (state) => stockSupportsDoubleManning(state.stockList),
@@ -85,15 +84,11 @@ export const useStore = defineStore('store', {
if (state.stockList.length == 0) return '';
const coldStartActive = state.isColdStart && stockSupportsColdStart(state.stockList);
- const doubleManningActive =
- state.isDoubleManned && stockSupportsDoubleManning(state.stockList);
+ const doubleManningActive = state.isDoubleManned && stockSupportsDoubleManning(state.stockList);
return state.stockList
.map((stock, i) => {
- let stockTypeStr =
- isTractionUnit(stock.vehicleRef) || !stock.cargo
- ? stock.vehicleRef.type
- : `${stock.vehicleRef.type}:${stock.cargo.id}`;
+ let stockTypeStr = isTractionUnit(stock.vehicleRef) || !stock.cargo ? stock.vehicleRef.type : `${stock.vehicleRef.type}:${stock.cargo.id}`;
if (i == 0 && (coldStartActive || doubleManningActive))
return `${stockTypeStr},${coldStartActive ? 'c' : ''}${doubleManningActive ? 'd' : ''}`;
diff --git a/src/utils/vehicleUtils.ts b/src/utils/vehicleUtils.ts
index 5915910..c0defeb 100644
--- a/src/utils/vehicleUtils.ts
+++ b/src/utils/vehicleUtils.ts
@@ -101,3 +101,17 @@ export function stockSupportsColdStart(stockList: IStock[]) {
export function stockSupportsDoubleManning(stockList: IStock[]) {
return stockList.length != 0 && isTractionUnit(stockList[0].vehicleRef) && stockList[0].vehicleRef.doubleManned;
}
+
+export function getCargoWarnings(stockList: IStock[]) {
+ let warnings: Set = new Set();
+
+ stockList.forEach((stockVehicle) => {
+ if (stockVehicle.vehicleRef.group == 'wagon-freight') {
+ if (stockVehicle.cargo && stockVehicle.cargo.id.startsWith('wt_20')) warnings.add('warning_wt_20_pn');
+ else if (stockVehicle.vehicleRef.type.startsWith('WB117')) warnings.add(stockVehicle.cargo ? 'warning_un1965_twr' : 'warning_un1965_tn');
+ else if (stockVehicle.vehicleRef.type.startsWith('445Rb')) warnings.add(stockVehicle.cargo ? 'warning_un1202_twr' : 'warning_un1202_tn');
+ }
+ });
+
+ return warnings;
+}