Dodanie funkcjonalności aktywnych rj dla stacji (W.I.P.)

This commit is contained in:
2020-08-26 00:44:53 +02:00
parent 520a1083dc
commit 355f92d3cd
10 changed files with 467 additions and 772 deletions
@@ -152,55 +152,6 @@ export default class StationCard extends styleMixin {
? "L"
: `${this.stationInfo.dispatcherExp}`;
}
// toLocaleDate(timestamp: number) {
// return new Date(timestamp).toLocaleDateString("pl-PL", {
// hour: "2-digit",
// minute: "2-digit",
// });
// }
// get computedHistory() {
// return this.history.sort((a, b) => {
// if (a.occupiedFrom < b.occupiedFrom) return 1;
// else return -1;
// });
// }
// async loadHistory() {
// const historyRef = await db
// .collection("history")
// .doc(this.stationInfo.stationName)
// .collection("dispatcherHistory")
// .get();
// this.history = historyRef.docs
// .filter((doc) => doc.data().occupiedTo != 0)
// .map((doc) => {
// const occupiedFrom = doc.data().occupiedFrom;
// const occupiedTo = doc.data().occupiedTo;
// const sameDay =
// new Date(occupiedFrom).getDate() == new Date(occupiedTo).getDate();
// return {
// occupiedFrom,
// occupiedTo,
// dispatcher:
// doc.data().currentDispatcherName || doc.data().dispatcherName,
// sameDay,
// };
// });
// }
// @Watch("stationInfo")
// async onStationChange(val: any, oldVal: any) {
// this.loadHistory();
// }
// created() {
// this.loadHistory();
// }
}
</script>
+21 -2
View File
@@ -51,7 +51,7 @@
<span
v-if="station.online"
:style="calculateExpStyle(station.dispatcherExp)"
>{{station.dispatcherExp < 2 ? 'L' : station.dispatcherExp}}</span>
>{{2 > station.dispatcherExp ? 'L' : station.dispatcherExp}}</span>
</td>
<td
class="item-users"
@@ -118,7 +118,10 @@
>{{station.routes.oneWay.noCatenary}}</span>
</td>
<!-- <td class="item-tracks oneway"></td> -->
<td
class="active-timetables"
@click="() => showScheduledTrains(station)"
>{{station.scheduledTrains.length}}</td>
</tr>
</table>
</div>
@@ -129,7 +132,11 @@
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { Getter } from "vuex-class";
import Station from "@/scripts/interfaces/Station";
import Train from "@/scripts/interfaces/Train";
import styleMixin from "@/mixins/styleMixin";
import Options from "@/components/StationsView/Options.vue";
@@ -144,6 +151,9 @@ export default class StationTable extends styleMixin {
@Prop() readonly stations!: Station[];
@Prop() readonly setFocusedStation!: () => void;
@Getter("trainsDataList") trains!: Train[];
@Getter("trainsDataState") state!: number;
icons: { ascSVG; descSVG } = { ascSVG, descSVG };
sorterActive: { index: number; dir: number } = { index: 0, dir: 1 };
@@ -156,6 +166,7 @@ export default class StationTable extends styleMixin {
["Maszyniści"],
["Informacje", "ogólne"],
["Szlaki", "2tor | 1tor"],
["Aktywne RJ"],
];
changeSorter(index: number) {
@@ -168,6 +179,14 @@ export default class StationTable extends styleMixin {
this.sorterActive.index = index;
}
get test() {
return this.trains;
}
showScheduledTrains(station) {
console.log(station.scheduledTrains);
}
get computedStations() {
const dir: number = this.sorterActive.dir;