feat(admin): implement pregnancy and birth management features
Some checks failed
Deploy to production / deploy (push) Failing after 2m6s

- Added new admin functionalities to force pregnancy, clear pregnancy, and trigger birth for characters.
- Introduced corresponding routes and controller methods in adminRouter and adminController.
- Enhanced the FalukantCharacter model to include pregnancy-related fields.
- Created database migration for adding pregnancy columns to the character table.
- Updated frontend views and internationalization files to support new pregnancy and birth management features.
- Improved user feedback and error handling for these new actions.
This commit is contained in:
Torsten Schulz (local)
2026-03-30 13:44:43 +02:00
parent b2591da428
commit c52d4b60f9
18 changed files with 628 additions and 160 deletions

View File

@@ -11,6 +11,14 @@
</div>
</section>
<section
v-if="pregnancy"
class="family-pregnancy surface-card"
>
<strong>{{ $t('falukant.family.pregnancy.banner') }}</strong>
<p>{{ $t('falukant.family.pregnancy.dueHint') }}: {{ formatPregnancyDue(pregnancy.dueAt) }}</p>
</section>
<section
v-if="debtorsPrison.active"
class="family-debt-warning surface-card"
@@ -407,6 +415,7 @@ export default {
active: false,
inDebtorsPrison: false
},
pregnancy: null,
selectedChild: null,
pendingFamilyRefresh: null
}
@@ -563,11 +572,24 @@ export default {
active: false,
inDebtorsPrison: false
};
this.pregnancy = response.data.pregnancy || null;
} catch (error) {
console.error('Error loading family data:', error);
}
},
formatPregnancyDue(iso) {
if (!iso) return '—';
try {
return new Date(iso).toLocaleString(this.$i18n?.locale || undefined, {
dateStyle: 'medium',
timeStyle: 'short',
});
} catch (_) {
return String(iso);
}
},
async spendTimeWithSpouse() {
try {
await apiClient.post('/api/falukant/family/marriage/spend-time');
@@ -904,6 +926,18 @@ export default {
color: var(--color-text-secondary);
}
.family-pregnancy {
margin-bottom: 16px;
padding: 16px 18px;
border: 1px solid rgba(120, 140, 200, 0.35);
background: linear-gradient(180deg, rgba(235, 240, 255, 0.95), rgba(248, 250, 255, 0.98));
}
.family-pregnancy p {
margin: 6px 0 0;
color: var(--color-text-secondary);
}
.family-debt-warning {
margin-bottom: 16px;
padding: 16px 18px;