mirror of
https://github.com/Spythere/station-manager-2.0.git
synced 2026-05-03 13:38:13 +00:00
chore: table cell highlight on hover; added vehicle removal confirmation
This commit is contained in:
@@ -23,9 +23,11 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="row in vehiclesTableComp" :key="row.vehicleRef.id">
|
<tr v-for="row in vehiclesTableComp" :key="row.vehicleRef.id">
|
||||||
<td>{{ row.vehicleRef.id }}</td>
|
<td>{{ row.vehicleRef.id }}</td>
|
||||||
|
|
||||||
<td class="editable" @click="editRowPrimitive(row, VehicleEditRowKey.NAME)">
|
<td class="editable" @click="editRowPrimitive(row, VehicleEditRowKey.NAME)">
|
||||||
{{ row.vehicleRef.name }}
|
{{ row.vehicleRef.name }}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="editable" @click="editRowPrimitive(row, VehicleEditRowKey.TYPE)">
|
<td class="editable" @click="editRowPrimitive(row, VehicleEditRowKey.TYPE)">
|
||||||
{{ row.vehicleRef.type }}
|
{{ row.vehicleRef.type }}
|
||||||
</td>
|
</td>
|
||||||
@@ -34,7 +36,8 @@
|
|||||||
{{ row.vehicleRef.cabinName }}
|
{{ row.vehicleRef.cabinName }}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="editable">{{ row.vehicleRef.group.name }}</td>
|
<td class="editable"></td>
|
||||||
|
|
||||||
<td class="editable" @click="editRowRestrictions(row, VehicleEditRestrictionKey.SPONSOR_ONLY)">
|
<td class="editable" @click="editRowRestrictions(row, VehicleEditRestrictionKey.SPONSOR_ONLY)">
|
||||||
<span v-if="row.vehicleRef.restrictions?.sponsorOnly !== undefined">
|
<span v-if="row.vehicleRef.restrictions?.sponsorOnly !== undefined">
|
||||||
{{ new Date(row.vehicleRef.restrictions.sponsorOnly).toLocaleString() }}
|
{{ new Date(row.vehicleRef.restrictions.sponsorOnly).toLocaleString() }}
|
||||||
@@ -42,6 +45,7 @@
|
|||||||
|
|
||||||
<span v-else>❌</span>
|
<span v-else>❌</span>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="editable" @click="editRowRestrictions(row, VehicleEditRestrictionKey.TEAM_ONLY)">
|
<td class="editable" @click="editRowRestrictions(row, VehicleEditRestrictionKey.TEAM_ONLY)">
|
||||||
<span v-if="row.vehicleRef.restrictions?.teamOnly !== undefined">
|
<span v-if="row.vehicleRef.restrictions?.teamOnly !== undefined">
|
||||||
{{ row.vehicleRef.restrictions.teamOnly ? '✅' : '❌' }}
|
{{ row.vehicleRef.restrictions.teamOnly ? '✅' : '❌' }}
|
||||||
@@ -49,10 +53,12 @@
|
|||||||
|
|
||||||
<span v-else>❌</span>
|
<span v-else>❌</span>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="editable" @click="editRowPrimitive(row, VehicleEditRowKey.HIDDEN)">
|
<td class="editable" @click="editRowPrimitive(row, VehicleEditRowKey.HIDDEN)">
|
||||||
{{ row.vehicleRef.hidden ? '✅' : '❌' }}
|
{{ row.vehicleRef.hidden ? '✅' : '❌' }}
|
||||||
</td>
|
</td>
|
||||||
<td @click="removeVehicle(row.vehicleRef.id)"><img src="/icon-trash.svg" alt="remove" /></td>
|
|
||||||
|
<td class="editable" @click="removeVehicle(row.vehicleRef.id)"><img src="/icon-trash.svg" alt="remove" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -63,6 +69,7 @@
|
|||||||
import { computed, ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import { useVehiclesStore } from '../../stores/vehicles.store';
|
import { useVehiclesStore } from '../../stores/vehicles.store';
|
||||||
import { IVehicleTableRow, VehicleEditRestrictionKey, VehicleEditRowKey } from '../../types/vehicles.types';
|
import { IVehicleTableRow, VehicleEditRestrictionKey, VehicleEditRowKey } from '../../types/vehicles.types';
|
||||||
|
import VehicleGroupsTable from './VehicleGroupsTable.vue';
|
||||||
|
|
||||||
const vehiclesStore = useVehiclesStore();
|
const vehiclesStore = useVehiclesStore();
|
||||||
const vehicleSearchInput = ref('');
|
const vehicleSearchInput = ref('');
|
||||||
@@ -158,6 +165,10 @@ async function addVehicleRow() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function removeVehicle(id: number) {
|
async function removeVehicle(id: number) {
|
||||||
|
const confirmRemove = confirm('Czy na pewno chcesz usunąć ten pojazd?');
|
||||||
|
|
||||||
|
if (!confirmRemove) return;
|
||||||
|
|
||||||
const removedVehicleData = await vehiclesStore.removeVehicle(id);
|
const removedVehicleData = await vehiclesStore.removeVehicle(id);
|
||||||
|
|
||||||
if (removedVehicleData) {
|
if (removedVehicleData) {
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ table tr:nth-child(even) {
|
|||||||
background-color: #334756;
|
background-color: #334756;
|
||||||
}
|
}
|
||||||
|
|
||||||
table tr:hover {
|
table tr td.editable:hover {
|
||||||
background-color: #1a293b;
|
background-color: #1a293b;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user