Implement client username display in myextension: add getClientUsername method to retrieve usernames for clients and update the UI to show usernames instead of client IDs in the table.

This commit is contained in:
padreug 2025-06-18 17:06:54 +02:00
parent b615ed0504
commit 2bc9a00c47
2 changed files with 7 additions and 1 deletions

View file

@ -140,6 +140,11 @@ window.app = Vue.createApp({
return date.toLocaleDateString() + ' ' + date.toLocaleTimeString('en-US', { hour12: false }) return date.toLocaleDateString() + ' ' + date.toLocaleTimeString('en-US', { hour12: false })
}, },
getClientUsername(clientId) {
const client = this.dcaClients.find(c => c.id === clientId)
return client ? (client.username || client.user_id.substring(0, 8) + '...') : clientId
},
// Configuration Methods // Configuration Methods
async getLamassuConfig() { async getLamassuConfig() {

View file

@ -175,7 +175,8 @@
<template v-slot:body="props"> <template v-slot:body="props">
<q-tr :props="props"> <q-tr :props="props">
<q-td v-for="col in props.cols" :key="col.name" :props="props"> <q-td v-for="col in props.cols" :key="col.name" :props="props">
<div v-if="col.field == 'amount'">${ formatCurrency(col.value) }</div> <div v-if="col.field == 'client_id'">${ getClientUsername(col.value) }</div>
<div v-else-if="col.field == 'amount'">${ formatCurrency(col.value) }</div>
<div v-else-if="col.field == 'status'"> <div v-else-if="col.field == 'status'">
<q-badge :color="col.value === 'confirmed' ? 'green' : 'orange'"> <q-badge :color="col.value === 'confirmed' ? 'green' : 'orange'">
${ col.value } ${ col.value }