feat(FalukantService, OverviewView): enhance church office information retrieval and UI display
All checks were successful
Deploy to production / deploy (push) Successful in 1m51s
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user