editing and maintenance and user suggestions
* every user has a right of a username and a display name and has the right to change it * System information page now shows information about database user count, char count, and database schema version * more maintenance lists * show the right values in columns and fields * move similar from inside of frontend component functions to utility js when used multiple times * display help on mouse over * add more than one believe to character * make char name editable with better char info in headline * GiT Gifttoleranz value not calculated correctly * Bump backend to 0.2.3, frontend to 0.2.2
This commit is contained in:
@@ -62,7 +62,7 @@
|
||||
<td>{{ dtaItem.beschreibung || '-' }}</td>
|
||||
<td>{{ formatQuelle(dtaItem) }}</td>
|
||||
<td><input type="checkbox" :checked="dtaItem.personal_item" disabled /></td>
|
||||
<td>{{ dtaItem.system || 'midgard' }}</td>
|
||||
<td>{{ getSystemCodeById(dtaItem.game_system_id, dtaItem.system || 'midgard') }}</td>
|
||||
<td>
|
||||
<button @click="startEdit(index)">Edit</button>
|
||||
</td>
|
||||
@@ -115,7 +115,12 @@
|
||||
</div>
|
||||
<div class="edit-field">
|
||||
<label>{{ $t('equipment.system') }}:</label>
|
||||
<input v-model="editedItem.system" style="width:100px;" />
|
||||
<select v-model.number="selectedSystemId" style="width:140px;">
|
||||
<option value="">-</option>
|
||||
<option v-for="system in systemOptions" :key="system.id" :value="system.id">
|
||||
{{ system.label }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -180,6 +185,13 @@
|
||||
|
||||
<script>
|
||||
import API from '../../utils/api'
|
||||
import {
|
||||
findSystemIdByCode,
|
||||
getSourceCode,
|
||||
getSystemCodeById,
|
||||
loadGameSystems as fetchGameSystems,
|
||||
buildSystemOptions,
|
||||
} from '../../utils/maintenanceGameSystems'
|
||||
export default {
|
||||
name: "EquipmentView",
|
||||
props: {
|
||||
@@ -202,11 +214,16 @@ export default {
|
||||
filterPersonalItem: '',
|
||||
filterQuelle: '',
|
||||
enhancedEquipment: [],
|
||||
availableSources: []
|
||||
availableSources: [],
|
||||
gameSystems: [],
|
||||
selectedSystemId: null
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
await this.loadEnhancedEquipment()
|
||||
await Promise.all([
|
||||
this.loadGameSystems(),
|
||||
this.loadEnhancedEquipment()
|
||||
])
|
||||
},
|
||||
computed: {
|
||||
availableQuellen() {
|
||||
@@ -266,9 +283,19 @@ export default {
|
||||
? aValue.localeCompare(bValue)
|
||||
: bValue.localeCompare(aValue);
|
||||
});
|
||||
},
|
||||
systemOptions() {
|
||||
return buildSystemOptions(this.gameSystems)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async loadGameSystems() {
|
||||
try {
|
||||
this.gameSystems = await fetchGameSystems()
|
||||
} catch (error) {
|
||||
console.error('Failed to load game systems:', error)
|
||||
}
|
||||
},
|
||||
async loadEnhancedEquipment() {
|
||||
try {
|
||||
const response = await API.get('/api/maintenance/equipment-enhanced')
|
||||
@@ -284,17 +311,21 @@ export default {
|
||||
...equipment,
|
||||
sourceCode: this.getSourceCode(equipment.source_id)
|
||||
}
|
||||
this.selectedSystemId = equipment.game_system_id ?? this.findSystemIdByCode(equipment.system)
|
||||
this.editingIndex = index
|
||||
},
|
||||
async saveEdit(index) {
|
||||
try {
|
||||
// Find source ID from code
|
||||
const source = this.availableSources.find(s => s.code === this.editedItem.sourceCode)
|
||||
const selectedSystem = this.gameSystems.find(gs => gs.id === this.selectedSystemId)
|
||||
|
||||
const updateData = {
|
||||
...this.editedItem,
|
||||
source_id: source ? source.id : null,
|
||||
page_number: this.editedItem.page_number || 0
|
||||
page_number: this.editedItem.page_number || 0,
|
||||
system: selectedSystem ? selectedSystem.code : (this.editedItem.system || ''),
|
||||
game_system_id: selectedSystem ? selectedSystem.id : (this.editedItem.game_system_id ?? null)
|
||||
}
|
||||
|
||||
const response = await API.put(
|
||||
@@ -310,6 +341,7 @@ export default {
|
||||
|
||||
this.editingIndex = -1
|
||||
this.editedItem = null
|
||||
this.selectedSystemId = null
|
||||
} catch (error) {
|
||||
console.error('Failed to save equipment:', error)
|
||||
alert('Failed to save equipment: ' + (error.response?.data?.error || error.message))
|
||||
@@ -318,6 +350,10 @@ export default {
|
||||
cancelEdit() {
|
||||
this.editingIndex = -1;
|
||||
this.editedItem = null;
|
||||
this.selectedSystemId = null;
|
||||
},
|
||||
findSystemIdByCode(code) {
|
||||
return findSystemIdByCode(this.gameSystems, code)
|
||||
},
|
||||
sortBy(field) {
|
||||
if (this.sortField === field) {
|
||||
@@ -343,15 +379,16 @@ export default {
|
||||
return equipment.quelle || '-'
|
||||
},
|
||||
getSourceCode(sourceId) {
|
||||
if (!sourceId || !this.availableSources.length) return ''
|
||||
const source = this.availableSources.find(s => s.id === sourceId)
|
||||
return source ? source.code : ''
|
||||
return getSourceCode(this.availableSources, sourceId)
|
||||
},
|
||||
clearFilters() {
|
||||
this.searchTerm = ''
|
||||
this.filterPersonalItem = ''
|
||||
this.filterQuelle = ''
|
||||
},
|
||||
getSystemCodeById(systemId, fallback = '') {
|
||||
return getSystemCodeById(this.gameSystems, systemId, fallback)
|
||||
},
|
||||
async handleEquipmentUpdate({ index, equipment }) {
|
||||
try {
|
||||
const response = await API.put(
|
||||
|
||||
Reference in New Issue
Block a user