feat(overview): enhance certificate status display with current and minimum values

This commit is contained in:
Torsten Schulz (local)
2026-08-18 07:34:32 +02:00
parent 57869c9559
commit 5f7e1b6033
7 changed files with 94 additions and 1 deletions

View File

@@ -3096,6 +3096,9 @@ class FalukantService extends BaseService {
const highestPoliticalOfficeRank = Number(highestPoliticalOffice?.rank || 0);
const highestChurchOfficeRank = Number(highestChurchOffice?.rank || 0);
const highestOfficeRank = Math.max(highestPoliticalOfficeRank, highestChurchOfficeRank);
const highestOfficeName = highestPoliticalOfficeRank >= highestChurchOfficeRank
? highestPoliticalOffice?.name ?? null
: highestChurchOffice?.name ?? null;
const nobilityLevel = Number(title?.level || 0);
const knowledgePoints = getKnowledgePoints(avgKnowledge);
@@ -3129,9 +3132,12 @@ class FalukantService extends BaseService {
highestPoliticalOfficeName: highestPoliticalOffice?.name ?? null,
highestChurchOfficeName: highestChurchOffice?.name ?? null,
highestOfficeRank,
highestOfficeName,
nobilityLevel,
nobilityTitleLabel: title?.labelTr ?? null,
reputation,
housePosition,
houseLabel: house?.houseType?.labelTr ?? null,
knowledgePoints,
productionPoints,
officePoints,

View File

@@ -231,6 +231,11 @@
"statusMode": {
"one_of": "At least one status condition",
"two_of": "At least two status conditions"
},
"statusValue": {
"currentAndMinimum": "{current} (minimum: {minimum})",
"office": { "none": "walay katungdanan", "minimum": "katungdanan nga ranggo {rank} o mas taas" },
"house": { "none": "walay balay" }
}
},
"summary": {

View File

@@ -215,6 +215,16 @@
"statusMode": {
"one_of": "Mindestens eine Statusbedingung",
"two_of": "Mindestens zwei Statusbedingungen"
},
"statusValue": {
"currentAndMinimum": "{current} (mindestens: {minimum})",
"office": {
"none": "kein Amt",
"minimum": "ein Amt ab Rang {rank}"
},
"house": {
"none": "kein Haus"
}
}
},
"summary": {

View File

@@ -221,6 +221,11 @@
"statusMode": {
"one_of": "At least one status condition",
"two_of": "At least two status conditions"
},
"statusValue": {
"currentAndMinimum": "{current} (minimum: {minimum})",
"office": { "none": "no office", "minimum": "an office of rank {rank} or higher" },
"house": { "none": "no house" }
}
},
"summary": {

View File

@@ -214,6 +214,11 @@
"statusMode": {
"one_of": "Al menos una condición de estatus",
"two_of": "Al menos dos condiciones de estatus"
},
"statusValue": {
"currentAndMinimum": "{current} (mínimo: {minimum})",
"office": { "none": "sin cargo", "minimum": "un cargo de rango {rank} o superior" },
"house": { "none": "sin casa" }
}
},
"summary": {

View File

@@ -214,6 +214,11 @@
"statusMode": {
"one_of": "Au moins une condition de statut",
"two_of": "Au moins deux conditions de statut"
},
"statusValue": {
"currentAndMinimum": "{current} (minimum : {minimum})",
"office": { "none": "aucune fonction", "minimum": "une fonction de rang {rank} ou supérieur" },
"house": { "none": "aucune maison" }
}
},
"summary": {

View File

@@ -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 {