mirror of
https://github.com/Spythere/pojazdownik.git
synced 2026-05-04 12:08:12 +00:00
chore: added additional cargo warnings
This commit is contained in:
@@ -2,31 +2,25 @@
|
|||||||
<div class="stock_warnings" v-if="hasAnyWarnings">
|
<div class="stock_warnings" v-if="hasAnyWarnings">
|
||||||
<div class="warning" v-if="locoNotSuitable">(!) {{ $t('stocklist.warning-not-suitable') }}</div>
|
<div class="warning" v-if="locoNotSuitable">(!) {{ $t('stocklist.warning-not-suitable') }}</div>
|
||||||
|
|
||||||
<div class="warning" v-if="lengthExceeded && store.isTrainPassenger">
|
<div class="warning" v-if="lengthExceeded && store.isTrainPassenger">(!) {{ $t('stocklist.warning-passenger-too-long') }}</div>
|
||||||
(!) {{ $t('stocklist.warning-passenger-too-long') }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="warning" v-if="lengthExceeded && !store.isTrainPassenger">
|
<div class="warning" v-if="lengthExceeded && !store.isTrainPassenger">(!) {{ $t('stocklist.warning-freight-too-long') }}</div>
|
||||||
(!) {{ $t('stocklist.warning-freight-too-long') }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="warning" v-if="teamOnlyVehicles.length > 0">
|
<div class="warning" v-if="teamOnlyVehicles.length > 0">
|
||||||
(!)
|
(!)
|
||||||
{{
|
{{ $t('stocklist.warning-team-only-vehicle', [teamOnlyVehicles.map((v) => v.vehicleRef.type).join(', ')]) }}
|
||||||
$t('stocklist.warning-team-only-vehicle', [
|
</div>
|
||||||
teamOnlyVehicles.map((v) => v.vehicleRef.type).join(', '),
|
|
||||||
])
|
<div class="warning" v-if="store.cargoWarnings.size > 0">
|
||||||
}}
|
{{ $t('cargo-warnings.title') }}
|
||||||
|
{{ [...store.cargoWarnings].map((v) => $t(`cargo-warnings.${v}`)).join('; ') }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="warning" v-if="weightExceeded">
|
<div class="warning" v-if="weightExceeded">
|
||||||
(!)
|
(!)
|
||||||
<i18n-t keypath="stocklist.warning-too-heavy">
|
<i18n-t keypath="stocklist.warning-too-heavy">
|
||||||
<template #href>
|
<template #href>
|
||||||
<a
|
<a target="_blank" href="https://docs.google.com/spreadsheets/d/1BvTU-U7huIaEheov22TrhTtROUM4MwVfdbq03GVAEM8">
|
||||||
target="_blank"
|
|
||||||
href="https://docs.google.com/spreadsheets/d/1BvTU-U7huIaEheov22TrhTtROUM4MwVfdbq03GVAEM8"
|
|
||||||
>
|
|
||||||
{{ $t('stocklist.acceptable-mass-docs') }}
|
{{ $t('stocklist.acceptable-mass-docs') }}
|
||||||
</a>
|
</a>
|
||||||
</template>
|
</template>
|
||||||
@@ -55,16 +49,11 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
hasAnyWarnings() {
|
hasAnyWarnings() {
|
||||||
return (
|
return this.weightExceeded || this.lengthExceeded || this.locoNotSuitable || this.teamOnlyVehicles;
|
||||||
this.weightExceeded || this.lengthExceeded || this.locoNotSuitable || this.teamOnlyVehicles
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
lengthExceeded() {
|
lengthExceeded() {
|
||||||
return (
|
return (this.store.totalLength > 350 && this.store.isTrainPassenger) || (this.store.totalLength > 650 && !this.store.isTrainPassenger);
|
||||||
(this.store.totalLength > 350 && this.store.isTrainPassenger) ||
|
|
||||||
(this.store.totalLength > 650 && !this.store.isTrainPassenger)
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
weightExceeded() {
|
weightExceeded() {
|
||||||
@@ -76,9 +65,7 @@ export default defineComponent({
|
|||||||
!this.store.isTrainPassenger &&
|
!this.store.isTrainPassenger &&
|
||||||
this.store.stockList.length > 1 &&
|
this.store.stockList.length > 1 &&
|
||||||
!this.store.stockList.every((stock) => isTractionUnit(stock.vehicleRef)) &&
|
!this.store.stockList.every((stock) => isTractionUnit(stock.vehicleRef)) &&
|
||||||
this.store.stockList.some(
|
this.store.stockList.some((stock) => isTractionUnit(stock.vehicleRef) && stock.vehicleRef.type.startsWith('EP'))
|
||||||
(stock) => isTractionUnit(stock.vehicleRef) && stock.vehicleRef.type.startsWith('EP')
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -325,5 +325,13 @@
|
|||||||
"418Vb_WIEBE": "loose cargo (sand, stone)",
|
"418Vb_WIEBE": "loose cargo (sand, stone)",
|
||||||
"418Vb_ZOS": "loose cargo (sand, stone)",
|
"418Vb_ZOS": "loose cargo (sand, stone)",
|
||||||
"418Vb_ZUE": "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)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -324,5 +324,13 @@
|
|||||||
"418Vb_WIEBE": "drobnica, ładunki sypkie (piasek, kamień)",
|
"418Vb_WIEBE": "drobnica, ładunki sypkie (piasek, kamień)",
|
||||||
"418Vb_ZOS": "drobnica, ładunki sypkie (piasek, kamień)",
|
"418Vb_ZOS": "drobnica, ładunki sypkie (piasek, kamień)",
|
||||||
"418Vb_ZUE": "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)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+5
-10
@@ -15,6 +15,7 @@ import { defineStore } from 'pinia';
|
|||||||
import {
|
import {
|
||||||
acceptableWeight,
|
acceptableWeight,
|
||||||
carDataList,
|
carDataList,
|
||||||
|
getCargoWarnings,
|
||||||
isTractionUnit,
|
isTractionUnit,
|
||||||
isTrainPassenger,
|
isTrainPassenger,
|
||||||
locoDataList,
|
locoDataList,
|
||||||
@@ -68,15 +69,13 @@ export const useStore = defineStore('store', {
|
|||||||
getters: {
|
getters: {
|
||||||
locoDataList: (state) => locoDataList(state.vehiclesData),
|
locoDataList: (state) => locoDataList(state.vehiclesData),
|
||||||
carDataList: (state) => carDataList(state.vehiclesData),
|
carDataList: (state) => carDataList(state.vehiclesData),
|
||||||
vehicleDataList: (state) => [
|
vehicleDataList: (state) => [...locoDataList(state.vehiclesData), ...carDataList(state.vehiclesData)],
|
||||||
...locoDataList(state.vehiclesData),
|
|
||||||
...carDataList(state.vehiclesData),
|
|
||||||
],
|
|
||||||
totalWeight: (state) => totalWeight(state.stockList),
|
totalWeight: (state) => totalWeight(state.stockList),
|
||||||
totalLength: (state) => totalLength(state.stockList),
|
totalLength: (state) => totalLength(state.stockList),
|
||||||
maxStockSpeed: (state) => maxStockSpeed(state.stockList),
|
maxStockSpeed: (state) => maxStockSpeed(state.stockList),
|
||||||
isTrainPassenger: (state) => isTrainPassenger(state.stockList),
|
isTrainPassenger: (state) => isTrainPassenger(state.stockList),
|
||||||
acceptableWeight: (state) => acceptableWeight(state.stockList),
|
acceptableWeight: (state) => acceptableWeight(state.stockList),
|
||||||
|
cargoWarnings: (state) => getCargoWarnings(state.stockList),
|
||||||
|
|
||||||
stockSupportsColdStart: (state) => stockSupportsColdStart(state.stockList),
|
stockSupportsColdStart: (state) => stockSupportsColdStart(state.stockList),
|
||||||
stockSupportsDoubleManning: (state) => stockSupportsDoubleManning(state.stockList),
|
stockSupportsDoubleManning: (state) => stockSupportsDoubleManning(state.stockList),
|
||||||
@@ -85,15 +84,11 @@ export const useStore = defineStore('store', {
|
|||||||
if (state.stockList.length == 0) return '';
|
if (state.stockList.length == 0) return '';
|
||||||
|
|
||||||
const coldStartActive = state.isColdStart && stockSupportsColdStart(state.stockList);
|
const coldStartActive = state.isColdStart && stockSupportsColdStart(state.stockList);
|
||||||
const doubleManningActive =
|
const doubleManningActive = state.isDoubleManned && stockSupportsDoubleManning(state.stockList);
|
||||||
state.isDoubleManned && stockSupportsDoubleManning(state.stockList);
|
|
||||||
|
|
||||||
return state.stockList
|
return state.stockList
|
||||||
.map((stock, i) => {
|
.map((stock, i) => {
|
||||||
let stockTypeStr =
|
let stockTypeStr = isTractionUnit(stock.vehicleRef) || !stock.cargo ? stock.vehicleRef.type : `${stock.vehicleRef.type}:${stock.cargo.id}`;
|
||||||
isTractionUnit(stock.vehicleRef) || !stock.cargo
|
|
||||||
? stock.vehicleRef.type
|
|
||||||
: `${stock.vehicleRef.type}:${stock.cargo.id}`;
|
|
||||||
|
|
||||||
if (i == 0 && (coldStartActive || doubleManningActive))
|
if (i == 0 && (coldStartActive || doubleManningActive))
|
||||||
return `${stockTypeStr},${coldStartActive ? 'c' : ''}${doubleManningActive ? 'd' : ''}`;
|
return `${stockTypeStr},${coldStartActive ? 'c' : ''}${doubleManningActive ? 'd' : ''}`;
|
||||||
|
|||||||
@@ -101,3 +101,17 @@ export function stockSupportsColdStart(stockList: IStock[]) {
|
|||||||
export function stockSupportsDoubleManning(stockList: IStock[]) {
|
export function stockSupportsDoubleManning(stockList: IStock[]) {
|
||||||
return stockList.length != 0 && isTractionUnit(stockList[0].vehicleRef) && stockList[0].vehicleRef.doubleManned;
|
return stockList.length != 0 && isTractionUnit(stockList[0].vehicleRef) && stockList[0].vehicleRef.doubleManned;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getCargoWarnings(stockList: IStock[]) {
|
||||||
|
let warnings: Set<string> = 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;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user