mirror of
https://github.com/Spythere/station-manager-2.0.git
synced 2026-05-03 05:28:13 +00:00
refactor: revamped vehicle manager adjusted for new API, improved file structure
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
<template>
|
||||
<div class="table-search-box">
|
||||
<input type="text" placeholder="Wyszukaj grupę..." v-model="vehicleGroupSearchValue" />
|
||||
<button @click="addVehicleGroupRow()">DODAJ NOWY POJAZD</button>
|
||||
</div>
|
||||
|
||||
<div class="table-wrapper">
|
||||
<table class="vehicle-manager-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td style="width: 50px">#</td>
|
||||
<td style="width: 200px">Nazwa</td>
|
||||
<td style="width: 80px">Długość</td>
|
||||
<td style="width: 80px">Masa</td>
|
||||
<td style="width: 100px">Prędkość</td>
|
||||
<td style="width: 100px">Prędkość lok.</td>
|
||||
<td style="width: 100px">Prędkość ładown.</td>
|
||||
<td style="width: 100px">Pojazdy</td>
|
||||
<td style="width: 80px">Zimny start</td>
|
||||
<td style="width: 80px">Podwójna obsada</td>
|
||||
<td style="width: 200px">Prędkości wg masy</td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr v-for="row in vehicleGroupsTableComp" :key="row.vehicleGroupRef.id">
|
||||
<td>{{ row.vehicleGroupRef.id }}</td>
|
||||
<td class="editable">
|
||||
{{ row.vehicleGroupRef.name }}
|
||||
</td>
|
||||
<td class="editable">
|
||||
{{ row.vehicleGroupRef.length }}
|
||||
</td>
|
||||
<td class="editable">
|
||||
{{ row.vehicleGroupRef.weight }}
|
||||
</td>
|
||||
<td class="editable">
|
||||
{{ row.vehicleGroupRef.speed }}
|
||||
</td>
|
||||
<td class="editable">
|
||||
{{ row.vehicleGroupRef.speedLoco }}
|
||||
</td>
|
||||
<td class="editable">
|
||||
{{ row.vehicleGroupRef.speedLoaded }}
|
||||
</td>
|
||||
<td class="editable">
|
||||
{{ row.vehicleGroupRef._count.vehicles }}
|
||||
</td>
|
||||
<td class="editable">
|
||||
{{ row.vehicleGroupRef.locoProps?.coldStart ? '✅' : '❌' }}
|
||||
</td>
|
||||
<td class="editable">
|
||||
{{ row.vehicleGroupRef.locoProps?.doubleManned ? '✅' : '❌' }}
|
||||
</td>
|
||||
<td class="editable">
|
||||
{{ row.vehicleGroupRef.massSpeeds ? 'WPISANE' : 'BRAK' }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { useVehiclesStore } from '../../stores/vehicles.store';
|
||||
|
||||
const vehiclesStore = useVehiclesStore();
|
||||
const vehicleGroupSearchValue = ref('');
|
||||
|
||||
const vehicleGroupsTableComp = computed(() => {
|
||||
return vehiclesStore.vehicleGroupsTable
|
||||
.filter((row) =>
|
||||
row.vehicleGroupRef.name.toLowerCase().startsWith(vehicleGroupSearchValue.value.trim().toLowerCase()),
|
||||
)
|
||||
.sort((r1, r2) => {
|
||||
return r1.vehicleGroupRef.id - r2.vehicleGroupRef.id;
|
||||
});
|
||||
});
|
||||
|
||||
function addVehicleGroupRow() {}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
Reference in New Issue
Block a user