feat(FalukantService, OverviewView): enhance church office information retrieval and UI display
All checks were successful
Deploy to production / deploy (push) Successful in 1m51s

- Refactored the `getHighestChurchOfficeInfo` method to utilize a new approach for retrieving the highest church office, improving accuracy and performance.
- Updated the `OverviewView` to format and display the highest political and church office names instead of raw rank values, enhancing user experience and clarity.
- Introduced a new method `formatCertificateHighestOffice` for better localization and presentation of office titles in the UI.
This commit is contained in:
Torsten Schulz (local)
2026-04-17 17:17:17 +02:00
parent afbea926a2
commit 39dcdd7fb3
2 changed files with 62 additions and 41 deletions

View File

@@ -155,11 +155,11 @@
</div>
<div class="detail-list__item">
<span>{{ $t('falukant.overview.certificate.factor.highestPoliticalOfficeRank') }}</span>
<strong>{{ certificateProgress.currentValues.highestPoliticalOfficeRank }}</strong>
<strong>{{ formatCertificateHighestOffice('political') }}</strong>
</div>
<div class="detail-list__item">
<span>{{ $t('falukant.overview.certificate.factor.highestChurchOfficeRank') }}</span>
<strong>{{ certificateProgress.currentValues.highestChurchOfficeRank }}</strong>
<strong>{{ formatCertificateHighestOffice('church') }}</strong>
</div>
<div class="detail-list__item">
<span>{{ $t('falukant.overview.certificate.factor.nobilityLevel') }}</span>
@@ -752,6 +752,24 @@ export default {
maximumFractionDigits: digits,
}).format(value);
},
/** Höchstes politisches/kirchliches Amt als übersetzter Amtsname statt Rohzahl (z. B. 1,00). */
formatCertificateHighestOffice(kind) {
const cv = this.certificateProgress?.currentValues;
if (!cv) return '---';
const name = kind === 'church' ? cv.highestChurchOfficeName : cv.highestPoliticalOfficeName;
const rankKey = kind === 'church' ? 'highestChurchOfficeRank' : 'highestPoliticalOfficeRank';
const rank = Math.round(Number(cv[rankKey] ?? 0));
const baseKey = kind === 'church' ? 'falukant.church.offices' : 'falukant.politics.offices';
if (!name && rank <= 0) {
return this.$t('falukant.nobility.none');
}
if (name) {
return this.$te(`${baseKey}.${name}`)
? this.$t(`${baseKey}.${name}`)
: name;
}
return String(rank);
},
formatCertificateRequirement(current, required) {
const currentDigits = typeof current === 'number' && !Number.isInteger(current) ? 1 : 0;
const requiredDigits = typeof required === 'number' && !Number.isInteger(required) ? 1 : 0;