diff --git a/src/components/StationsView/StationCard.vue b/src/components/StationsView/StationCard.vue
index f85edba..ef2ee5e 100644
--- a/src/components/StationsView/StationCard.vue
+++ b/src/components/StationsView/StationCard.vue
@@ -124,9 +124,9 @@
-
+
@@ -156,6 +160,7 @@ import { Getter } from "vuex-class";
import styleMixin from "@/mixins/styleMixin";
import Station from "@/scripts/interfaces/Station";
+import Train from "@/scripts/interfaces/Train";
import StationTimetable from "@/components/StationsView/StationTimetable.vue";
@@ -167,7 +172,6 @@ import StationTimetable from "@/components/StationsView/StationTimetable.vue";
export default class StationCard extends styleMixin {
@Prop() stationInfo!: Station;
@Prop() exit!: void;
- @Getter('getTrainList') trains;
cardMode: number = 0;
@@ -177,11 +181,34 @@ export default class StationCard extends styleMixin {
: `${this.stationInfo.dispatcherExp}`;
}
+ get computedScheduledTrains() {
+ return this.stationInfo.scheduledTrains.map(scheduledTrain => {
+ let stopStatus = "";
+ let stopLabel = "";
+
+ if (scheduledTrain.terminatesHere && scheduledTrain.confirmed) { stopStatus = "terminated"; stopLabel = "Skończył bieg" }
+ else if (!scheduledTrain.terminatesHere && scheduledTrain.confirmed) { stopStatus = "departed"; stopLabel = "Odprawiony" }
+ else if (scheduledTrain.currentStationName == this.stationInfo.stationName && !scheduledTrain.stopped) { stopStatus = "online"; stopLabel = "Na stacji" }
+ else if (scheduledTrain.currentStationName == this.stationInfo.stationName && scheduledTrain.stopped) { stopStatus = "stopped"; stopLabel = "Postój" }
+ else if (scheduledTrain.currentStationName != this.stationInfo.stationName) { stopStatus = "arriving"; stopLabel = "W drodze" }
+
+ return {
+ ...scheduledTrain,
+ stopStatus,
+ stopLabel
+ }
+ })
+ }
+
get computedStationTrains() {
- return this.stationInfo.stationTrains.map(stationTrain => ({
- ...stationTrain,
- timetableData: this.trains.find(train => train.timetableData && train.trainNo === stationTrain.trainNo)
- }))
+ return this.stationInfo.stationTrains.map(stationTrain => {
+ const scheduledData = this.computedScheduledTrains.find(scheduledTrain => scheduledTrain.trainNo === stationTrain.trainNo);
+
+ return {
+ ...stationTrain,
+ stopStatus: scheduledData?.stopStatus || "no-timetable"
+ }
+ })
}
}
@@ -401,6 +428,22 @@ export default class StationCard extends styleMixin {
pointer-events: none;
}
}
+
+ &.departed {
+ border: 1px solid lime;
+ }
+
+ &.stopped {
+ border: 1px solid #ffa600;
+ }
+
+ &.online {
+ border: 1px solid gold;
+ }
+
+ &.terminated {
+ border: 1px solid red;
+ }
}
}
}
diff --git a/src/components/StationsView/StationTimetable.vue b/src/components/StationsView/StationTimetable.vue
index cf612db..ba8c65b 100644
--- a/src/components/StationsView/StationTimetable.vue
+++ b/src/components/StationsView/StationTimetable.vue
@@ -2,7 +2,7 @@