mirror of
https://github.com/Spythere/genera-tor.git
synced 2026-05-02 21:18:12 +00:00
chore: order picker regions
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="order-train-picker">
|
<div class="order-train-picker">
|
||||||
<div class="options">
|
<div class="options">
|
||||||
<label for="dispatcher-select">
|
<div class="options-top">
|
||||||
<select
|
<select
|
||||||
name="dispatcher-select"
|
name="dispatcher-select"
|
||||||
id="dispatcher-select"
|
id="dispatcher-select"
|
||||||
v-model="selectedSceneryId"
|
v-model="selectedSceneryId"
|
||||||
@change="selectSceneryOption"
|
@change="selectOption"
|
||||||
>
|
>
|
||||||
<option :value="null" disabled>Sceneria</option>
|
<option :value="null" disabled>Sceneria</option>
|
||||||
<option
|
<option
|
||||||
@@ -14,26 +14,41 @@
|
|||||||
:value="`${scenery.stationName}|${scenery.stationHash}|${scenery.dispatcherName}|${scenery.region}`"
|
:value="`${scenery.stationName}|${scenery.stationHash}|${scenery.dispatcherName}|${scenery.region}`"
|
||||||
:key="scenery.dispatcherName + scenery.stationName"
|
:key="scenery.dispatcherName + scenery.stationName"
|
||||||
>
|
>
|
||||||
{{ scenery.stationName }} • {{ scenery.dispatcherName }} [{{
|
{{ scenery.stationName }} • {{ scenery.dispatcherName }}
|
||||||
getRegionNameById(scenery.region)
|
|
||||||
}}]
|
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
|
||||||
|
|
||||||
<label for="checkpoint-select">
|
|
||||||
<select
|
<select
|
||||||
name="checkpoint-select"
|
name="region-select"
|
||||||
id="checkpoint-select"
|
id="region-select"
|
||||||
v-model="selectedCheckpointName"
|
v-model="selectedRegion"
|
||||||
:disabled="!selectedScenery"
|
@change="selectOption"
|
||||||
>
|
>
|
||||||
<option :value="null" disabled>Posterunek</option>
|
<option :value="null" disabled>Region</option>
|
||||||
<option :value="cp" v-for="cp in checkpointNameList" :key="cp">
|
<option v-for="region in regions" :value="region" :key="region">
|
||||||
{{ cp }}
|
{{ getRegionNameById(region) }}
|
||||||
</option>
|
</option>
|
||||||
|
<!-- <option
|
||||||
|
v-for="scenery in filteredSceneries"
|
||||||
|
:value="`${scenery.stationName}|${scenery.stationHash}|${scenery.dispatcherName}|${scenery.region}`"
|
||||||
|
:key="scenery.dispatcherName + scenery.stationName"
|
||||||
|
>
|
||||||
|
|
||||||
|
</option> -->
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</div>
|
||||||
|
|
||||||
|
<select
|
||||||
|
name="checkpoint-select"
|
||||||
|
id="checkpoint-select"
|
||||||
|
v-model="selectedCheckpointName"
|
||||||
|
:disabled="!selectedScenery"
|
||||||
|
>
|
||||||
|
<option :value="null" disabled>Posterunek</option>
|
||||||
|
<option :value="cp" v-for="cp in checkpointNameList" :key="cp">
|
||||||
|
{{ cp }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
<label for="fill-checkpoint" class="g-checkbox">
|
<label for="fill-checkpoint" class="g-checkbox">
|
||||||
<input
|
<input
|
||||||
@@ -111,11 +126,14 @@ export default defineComponent({
|
|||||||
|
|
||||||
selectedSceneryId: null as string | null,
|
selectedSceneryId: null as string | null,
|
||||||
selectedCheckpointName: null as string | null,
|
selectedCheckpointName: null as string | null,
|
||||||
|
selectedRegion: 'eu',
|
||||||
|
|
||||||
fillCheckpointName: false,
|
fillCheckpointName: false,
|
||||||
|
|
||||||
refreshInterval: -1,
|
refreshInterval: -1,
|
||||||
store: useStore()
|
store: useStore(),
|
||||||
|
|
||||||
|
regions: ['eu', 'cae', 'usw', 'us', 'ru']
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -148,13 +166,14 @@ export default defineComponent({
|
|||||||
return this.activeData?.activeSceneries?.find(
|
return this.activeData?.activeSceneries?.find(
|
||||||
(scenery) =>
|
(scenery) =>
|
||||||
this.selectedSceneryId ==
|
this.selectedSceneryId ==
|
||||||
`${scenery.stationName}|${scenery.stationHash}|${scenery.dispatcherName}|${scenery.region}`
|
`${scenery.stationName}|${scenery.stationHash}|${scenery.dispatcherName}|${scenery.region}` &&
|
||||||
|
this.selectedRegion == scenery.region
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
filteredSceneries() {
|
filteredSceneries() {
|
||||||
return this.activeData?.activeSceneries
|
return this.activeData?.activeSceneries
|
||||||
?.filter((s) => s.isOnline)
|
?.filter((s) => s.isOnline && s.region == this.selectedRegion)
|
||||||
.sort((s1, s2) => s1.stationName.localeCompare(s2.stationName));
|
.sort((s1, s2) => s1.stationName.localeCompare(s2.stationName));
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -180,7 +199,7 @@ export default defineComponent({
|
|||||||
(t) =>
|
(t) =>
|
||||||
(t.currentStationName == scenery.stationName &&
|
(t.currentStationName == scenery.stationName &&
|
||||||
t.region == scenery.region &&
|
t.region == scenery.region &&
|
||||||
(t.online || t.lastSeen < Date.now() - 60000)) ||
|
(t.online || t.lastSeen >= Date.now() - 60000)) ||
|
||||||
t.timetable?.path.includes(`${scenery.stationName} ${scenery.stationHash}.sc`)
|
t.timetable?.path.includes(`${scenery.stationName} ${scenery.stationHash}.sc`)
|
||||||
)
|
)
|
||||||
.sort((t1, t2) => {
|
.sort((t1, t2) => {
|
||||||
@@ -208,7 +227,7 @@ export default defineComponent({
|
|||||||
this.activeData = data;
|
this.activeData = data;
|
||||||
},
|
},
|
||||||
|
|
||||||
selectSceneryOption() {
|
selectOption() {
|
||||||
this.selectedCheckpointName =
|
this.selectedCheckpointName =
|
||||||
this.checkpointNameList.length == 0 ? null : this.checkpointNameList[0];
|
this.checkpointNameList.length == 0 ? null : this.checkpointNameList[0];
|
||||||
},
|
},
|
||||||
@@ -257,11 +276,6 @@ export default defineComponent({
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
gap: 0.5em;
|
gap: 0.5em;
|
||||||
|
|
||||||
label {
|
|
||||||
width: 100%;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
select {
|
select {
|
||||||
background-color: $bgColDarker;
|
background-color: $bgColDarker;
|
||||||
|
|
||||||
@@ -274,6 +288,13 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.options-top {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 3fr auto;
|
||||||
|
gap: 0.5em;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
margin-top: 1em;
|
margin-top: 1em;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
@@ -69,8 +69,8 @@ button.g-button {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
color: white;
|
color: white;
|
||||||
transition:
|
transition:
|
||||||
color 100ms ease-in-out,
|
color 100ms ease-in,
|
||||||
background-color 100ms ease-in-out;
|
background-color 100ms ease-in;
|
||||||
|
|
||||||
&.action {
|
&.action {
|
||||||
background-color: $bgColDarker;
|
background-color: $bgColDarker;
|
||||||
@@ -149,6 +149,10 @@ select {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
option[disabled] {
|
||||||
|
color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
// List style
|
// List style
|
||||||
ul {
|
ul {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user