mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 21:38:13 +00:00
Dodano godzinę przystąpienia do dyżuru w widoku scenerii
This commit is contained in:
@@ -45,6 +45,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { URLs } from '@/scripts/utils/apiURLs';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
|
|
||||||
@@ -76,7 +77,7 @@ interface HistoryResultAPI {
|
|||||||
errorMessage?: any;
|
errorMessage?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
const API_URL = 'https://stacjownik-api-di22o.ondigitalocean.app/api/getSceneryHistory';
|
const API_URL = `${URLs.stacjownikAPI}/api/getSceneryHistory`;
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
data: () => ({
|
data: () => ({
|
||||||
|
|||||||
@@ -11,6 +11,10 @@
|
|||||||
<span class="dispatcher_name">{{ station.onlineInfo.dispatcherName }}</span>
|
<span class="dispatcher_name">{{ station.onlineInfo.dispatcherName }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<span class="status-badge" v-if="station.onlineInfo && onlineFrom > 0">
|
||||||
|
OD {{ new Date(onlineFrom).toLocaleTimeString('pl-PL', { hour: "2-digit", minute: "2-digit" }) }}
|
||||||
|
</span>
|
||||||
|
|
||||||
<span class="status-badge" v-if="station.onlineInfo" :class="station.onlineInfo.statusID">
|
<span class="status-badge" v-if="station.onlineInfo" :class="station.onlineInfo.statusID">
|
||||||
{{ $t(`status.${station.onlineInfo.statusID}`) }}
|
{{ $t(`status.${station.onlineInfo.statusID}`) }}
|
||||||
{{ station.onlineInfo.statusID == 'online' ? station.onlineInfo.statusTimeString : '' }}
|
{{ station.onlineInfo.statusID == 'online' ? station.onlineInfo.statusTimeString : '' }}
|
||||||
@@ -28,6 +32,16 @@ import { defineComponent } from 'vue';
|
|||||||
import styleMixin from '@/mixins/styleMixin';
|
import styleMixin from '@/mixins/styleMixin';
|
||||||
import Station from '@/scripts/interfaces/Station';
|
import Station from '@/scripts/interfaces/Station';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import { URLs } from '@/scripts/utils/apiURLs';
|
||||||
|
|
||||||
|
interface SceneryHistoryData {
|
||||||
|
response?: {
|
||||||
|
stationName: string;
|
||||||
|
currentDispatcher: string;
|
||||||
|
currentDispatcherId: number;
|
||||||
|
currentDispatcherFrom: number;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
mixins: [styleMixin],
|
mixins: [styleMixin],
|
||||||
@@ -39,13 +53,19 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
async mounted() {
|
async mounted() {
|
||||||
// const dispatcherInfo = await axios.get()
|
const dispatcherInfo: SceneryHistoryData = await (
|
||||||
|
await axios.get(`${URLs.stacjownikAPI}/api/getSceneryHistory?name=${this.station.name.replace(/ /g, '_')}&historyCount=0`)
|
||||||
|
).data;
|
||||||
|
|
||||||
|
this.onlineFrom = dispatcherInfo.response?.currentDispatcherFrom || -1;
|
||||||
},
|
},
|
||||||
|
|
||||||
data: () => ({
|
data: () => ({
|
||||||
icons: {
|
icons: {
|
||||||
spawn: require('@/assets/icon-spawn.svg'),
|
spawn: require('@/assets/icon-spawn.svg'),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onlineFrom: -1
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@@ -56,6 +76,8 @@ export default defineComponent({
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
|
flex-wrap: wrap;
|
||||||
|
|
||||||
.dispatcher {
|
.dispatcher {
|
||||||
font-size: 2em;
|
font-size: 2em;
|
||||||
|
|
||||||
@@ -79,6 +101,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
.status-badge {
|
.status-badge {
|
||||||
font-size: 1.2em;
|
font-size: 1.2em;
|
||||||
|
margin: 0.5em 0.25em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user