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

View File

@@ -231,6 +231,11 @@
"statusMode": { "statusMode": {
"one_of": "At least one status condition", "one_of": "At least one status condition",
"two_of": "At least two status conditions" "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": { "summary": {

View File

@@ -215,6 +215,16 @@
"statusMode": { "statusMode": {
"one_of": "Mindestens eine Statusbedingung", "one_of": "Mindestens eine Statusbedingung",
"two_of": "Mindestens zwei Statusbedingungen" "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": { "summary": {

View File

@@ -221,6 +221,11 @@
"statusMode": { "statusMode": {
"one_of": "At least one status condition", "one_of": "At least one status condition",
"two_of": "At least two status conditions" "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": { "summary": {

View File

@@ -214,6 +214,11 @@
"statusMode": { "statusMode": {
"one_of": "Al menos una condición de estatus", "one_of": "Al menos una condición de estatus",
"two_of": "Al menos dos condiciones 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": { "summary": {

View File

@@ -214,6 +214,11 @@
"statusMode": { "statusMode": {
"one_of": "Au moins une condition de statut", "one_of": "Au moins une condition de statut",
"two_of": "Au moins deux conditions 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": { "summary": {

View File

@@ -204,7 +204,7 @@
:class="{ 'is-met': option.met }" :class="{ 'is-met': option.met }"
> >
{{ certificateRequirementLabel(option.type) }}: {{ certificateRequirementLabel(option.type) }}:
{{ formatCertificateRequirement(option.current, option.required) }} {{ certificateStatusOptionLabel(option) }}
</li> </li>
</ul> </ul>
</article> </article>
@@ -796,6 +796,63 @@ export default {
certificateStatusRequirementLabel(mode) { certificateStatusRequirementLabel(mode) {
return this.$t(`falukant.overview.certificate.statusMode.${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() { async fetchPotentialHeirs() {
this.loadingHeirs = true; this.loadingHeirs = true;
try { try {