feat(overview): enhance certificate status display with current and minimum values
This commit is contained in:
@@ -204,7 +204,7 @@
|
||||
:class="{ 'is-met': option.met }"
|
||||
>
|
||||
{{ certificateRequirementLabel(option.type) }}:
|
||||
{{ formatCertificateRequirement(option.current, option.required) }}
|
||||
{{ certificateStatusOptionLabel(option) }}
|
||||
</li>
|
||||
</ul>
|
||||
</article>
|
||||
@@ -796,6 +796,63 @@ export default {
|
||||
certificateStatusRequirementLabel(mode) {
|
||||
return this.$t(`falukant.overview.certificate.statusMode.${mode}`);
|
||||
},
|
||||
certificateStatusOptionLabel(option) {
|
||||
return this.$t('falukant.overview.certificate.statusValue.currentAndMinimum', {
|
||||
current: this.certificateStatusValueLabel(option.type, option.current),
|
||||
minimum: this.certificateMinimumStatusValueLabel(option.type, option.required),
|
||||
});
|
||||
},
|
||||
certificateStatusValueLabel(type, value) {
|
||||
const currentValues = this.certificateProgress?.currentValues || {};
|
||||
if (type === 'officePoints') {
|
||||
const officeName = currentValues.highestOfficeName;
|
||||
if (officeName) {
|
||||
const politicalKey = `falukant.politics.offices.${officeName}`;
|
||||
const churchKey = `falukant.church.offices.${officeName}`;
|
||||
if (this.$te(politicalKey)) return this.$t(politicalKey);
|
||||
if (this.$te(churchKey)) return this.$t(churchKey);
|
||||
return officeName;
|
||||
}
|
||||
return this.$t('falukant.overview.certificate.statusValue.office.none');
|
||||
}
|
||||
if (type === 'nobilityPoints') {
|
||||
const title = currentValues.nobilityTitleLabel;
|
||||
if (title) {
|
||||
const gender = this.falukantUser?.character?.gender || 'male';
|
||||
const key = `falukant.titles.${gender}.${title}`;
|
||||
return this.$te(key) ? this.$t(key) : title;
|
||||
}
|
||||
}
|
||||
if (type === 'housePoints') {
|
||||
return this.certificateHouseStatusLabel(currentValues.housePosition, currentValues.houseLabel);
|
||||
}
|
||||
return this.formatCertificateValue(value);
|
||||
},
|
||||
certificateMinimumStatusValueLabel(type, required) {
|
||||
if (type === 'officePoints') {
|
||||
return this.$t('falukant.overview.certificate.statusValue.office.minimum', { rank: required });
|
||||
}
|
||||
if (type === 'nobilityPoints') {
|
||||
const gender = this.falukantUser?.character?.gender || 'male';
|
||||
const titleLevels = ['noncivil', 'civil', 'sir', 'townlord', 'by', 'landlord'];
|
||||
const title = titleLevels[Number(required)] || null;
|
||||
const key = title ? `falukant.titles.${gender}.${title}` : null;
|
||||
return key && this.$te(key) ? this.$t(key) : this.formatCertificateValue(required);
|
||||
}
|
||||
if (type === 'housePoints') {
|
||||
const minimumPositionByPoints = { 1: 2, 2: 4, 3: 6, 4: 8, 5: 10 };
|
||||
return this.certificateHouseStatusLabel(minimumPositionByPoints[Number(required)] || 0);
|
||||
}
|
||||
return this.formatCertificateValue(required);
|
||||
},
|
||||
certificateHouseStatusLabel(position, fallbackLabel = null) {
|
||||
const value = Number(position || 0);
|
||||
if (!value) return this.$t('falukant.overview.certificate.statusValue.house.none');
|
||||
const key = `falukant.nobility.advance.housePosition.${value}`;
|
||||
return this.$te(key)
|
||||
? this.$t(key)
|
||||
: (fallbackLabel || this.$t('falukant.nobility.advance.housePosition.fallback', { level: value }));
|
||||
},
|
||||
async fetchPotentialHeirs() {
|
||||
this.loadingHeirs = true;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user