Implement debtors prison features across the application: Enhance FalukantController to include debtors prison logic in various service methods. Update FalukantService to manage debtors prison state and integrate it into user data retrieval. Modify frontend components, including DashboardWidget, StatusBar, and BankView, to display debtors prison status and warnings. Add localization for debtors prison messages in English, German, and Spanish, ensuring clarity in user notifications and actions.

This commit is contained in:
Torsten Schulz (local)
2026-03-23 11:59:59 +01:00
parent f2343098d2
commit 9b88a98a20
19 changed files with 1643 additions and 102 deletions

View File

@@ -15,9 +15,28 @@
</div>
</section>
<section
v-if="debtorsPrison.active"
class="branch-debt-warning surface-card"
:class="{ 'is-prison': debtorsPrison.inDebtorsPrison }"
>
<strong>
{{ debtorsPrison.inDebtorsPrison
? $t('falukant.bank.debtorsPrison.titlePrison')
: $t('falukant.bank.debtorsPrison.titleWarning') }}
</strong>
<p>
{{ debtorsPrison.inDebtorsPrison
? $t('falukant.branch.debtorsPrison.branchLocked')
: $t('falukant.branch.debtorsPrison.branchRisk') }}
</p>
</section>
<BranchSelection
:branches="branches"
:selectedBranch="selectedBranch"
:blocked="debtorsPrison.inDebtorsPrison"
:blocked-reason="debtorsPrison.inDebtorsPrison ? $t('falukant.branch.debtorsPrison.selectionBlocked') : ''"
@branchSelected="onBranchSelected"
@createBranch="createBranch"
@upgradeBranch="upgradeBranch"
@@ -404,6 +423,10 @@ export default {
branchTaxesLoading: false,
branchTaxesError: null,
currentCertificate: null,
debtorsPrison: {
active: false,
inDebtorsPrison: false
},
pendingBranchRefresh: null,
};
},
@@ -462,6 +485,7 @@ export default {
// Live-Socket-Events (Backend Socket.io)
if (this.socket) {
this.socket.on('falukantUpdateStatus', (data) => this.handleEvent({ event: 'falukantUpdateStatus', ...data }));
this.socket.on('falukantUpdateDebt', (data) => this.handleEvent({ event: 'falukantUpdateDebt', ...data }));
this.socket.on('falukantUpdateProductionCertificate', (data) => this.handleEvent({ event: 'falukantUpdateProductionCertificate', ...data }));
this.socket.on('falukantBranchUpdate', (data) => this.handleEvent({ event: 'falukantBranchUpdate', ...data }));
this.socket.on('transport_arrived', (data) => this.handleEvent({ event: 'transport_arrived', ...data }));
@@ -482,6 +506,7 @@ export default {
}
if (this.socket) {
this.socket.off('falukantUpdateStatus');
this.socket.off('falukantUpdateDebt');
this.socket.off('falukantUpdateProductionCertificate');
this.socket.off('falukantBranchUpdate');
this.socket.off('transport_arrived');
@@ -558,6 +583,10 @@ export default {
try {
const result = await apiClient.get('/api/falukant/user');
this.currentCertificate = result.data?.certificate ?? null;
this.debtorsPrison = result.data?.debtorsPrison || {
active: false,
inDebtorsPrison: false
};
} catch (error) {
console.error('Error loading certificate:', error);
}
@@ -678,6 +707,10 @@ export default {
},
async createBranch() {
if (this.debtorsPrison.inDebtorsPrison) {
showError(this, this.$t('falukant.branch.debtorsPrison.selectionBlocked'));
return;
}
await this.loadBranches();
// Nach dem Anlegen eines neuen Branches automatisch den
// zuletzt/neu erstellten Branch auswählen.
@@ -694,6 +727,10 @@ export default {
async upgradeBranch() {
if (!this.selectedBranch) return;
if (this.debtorsPrison.inDebtorsPrison) {
showError(this, this.$t('falukant.branch.debtorsPrison.selectionBlocked'));
return;
}
try {
await apiClient.post('/api/falukant/branches/upgrade', {
branchId: this.selectedBranch.id,
@@ -851,6 +888,7 @@ export default {
this.$refs.productionSection?.loadStorage();
break;
case 'falukantUpdateStatus':
case 'falukantUpdateDebt':
case 'falukantUpdateProductionCertificate':
case 'falukantBranchUpdate':
this.queueBranchRefresh();
@@ -1184,6 +1222,23 @@ export default {
color: var(--color-text-secondary);
}
.branch-debt-warning {
margin-bottom: 16px;
padding: 16px 18px;
border: 1px solid rgba(180, 120, 40, 0.32);
background: linear-gradient(180deg, rgba(255, 244, 223, 0.95), rgba(255, 250, 239, 0.98));
}
.branch-debt-warning.is-prison {
border-color: rgba(146, 57, 40, 0.4);
background: linear-gradient(180deg, rgba(255, 232, 225, 0.96), rgba(255, 245, 241, 0.98));
}
.branch-debt-warning p {
margin: 6px 0 0;
color: var(--color-text-secondary);
}
.branch-hero__meta {
margin-top: 12px;
}