Skip to content

Commit

Permalink
format token display
Browse files Browse the repository at this point in the history
  • Loading branch information
beesaferoot committed Dec 11, 2024
1 parent 6c16fc0 commit 1dee06c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/frontend/src/modules/Meter/Transactions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
<md-table-cell
v-text="moneyFormat(token.transaction.amount)"
></md-table-cell>
<md-table-cell v-if="token.paid_for_type === 'token'">
Token {{ token.paid_for.token }}
<md-table-cell v-if="token.paid_for_type === 'App\\Models\\Token'">
Token ({{ formatToken(token.paid_for.token) }})
</md-table-cell>
<md-table-cell v-else>
{{ token.paid_for_type }}
Expand Down Expand Up @@ -92,6 +92,13 @@ export default {
this.transactions.tokens.length,
)
},
formatToken(token) {
// Ensure token is a string
const tokenStr = String(token);
// Format in the desired pattern
// return tokenStr.match(/.{1,4}/g).join('-'); // For "1234-1234-1234"
return tokenStr.match(/.{1,3}/g).join(' '); // For "123 412 341 234"
},
},
}
</script>
Expand Down

0 comments on commit 1dee06c

Please sign in to comment.