Add marriage management features: Implement endpoints for spending time with, gifting to, and reconciling with spouses in the FalukantController. Update UserHouse model to include household tension attributes. Enhance frontend components to manage marriage actions and display household tension details, including localization updates in multiple languages.
This commit is contained in:
@@ -7,6 +7,11 @@
|
||||
<span class="branch-kicker">Niederlassung</span>
|
||||
<h2>{{ $t('falukant.branch.title') }}</h2>
|
||||
<p>Produktion, Lager, Verkauf und Transport in einer spielweltbezogenen Steuerflaeche.</p>
|
||||
<div class="branch-hero__meta">
|
||||
<span class="branch-hero__badge">
|
||||
{{ $t('falukant.branch.currentCertificate') }}: {{ currentCertificate ?? '---' }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -398,11 +403,13 @@ export default {
|
||||
branchTaxes: null,
|
||||
branchTaxesLoading: false,
|
||||
branchTaxesError: null,
|
||||
currentCertificate: null,
|
||||
pendingBranchRefresh: null,
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapState(['socket', 'daemonSocket']),
|
||||
...mapState(['socket', 'daemonSocket', 'user']),
|
||||
freeVehiclesByType() {
|
||||
const grouped = {};
|
||||
for (const v of this.vehicles || []) {
|
||||
@@ -436,6 +443,7 @@ export default {
|
||||
await this.loadBranches();
|
||||
|
||||
const branchId = this.$route.params.branchId;
|
||||
await this.loadCurrentCertificate();
|
||||
await this.loadProducts();
|
||||
|
||||
if (branchId) {
|
||||
@@ -454,6 +462,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('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 }));
|
||||
this.socket.on('inventory_updated', (data) => this.handleEvent({ event: 'inventory_updated', ...data }));
|
||||
@@ -463,12 +472,17 @@ export default {
|
||||
},
|
||||
|
||||
beforeUnmount() {
|
||||
if (this.pendingBranchRefresh) {
|
||||
clearTimeout(this.pendingBranchRefresh);
|
||||
this.pendingBranchRefresh = null;
|
||||
}
|
||||
// Daemon WebSocket: Listener entfernen (der Socket selbst wird beim Logout geschlossen)
|
||||
if (this.daemonSocket) {
|
||||
this.daemonSocket.removeEventListener('message', this.handleDaemonMessage);
|
||||
}
|
||||
if (this.socket) {
|
||||
this.socket.off('falukantUpdateStatus');
|
||||
this.socket.off('falukantUpdateProductionCertificate');
|
||||
this.socket.off('falukantBranchUpdate');
|
||||
this.socket.off('transport_arrived');
|
||||
this.socket.off('inventory_updated');
|
||||
@@ -493,6 +507,34 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
matchesCurrentUser(eventData) {
|
||||
if (eventData?.user_id == null) {
|
||||
return true;
|
||||
}
|
||||
const currentIds = [this.user?.id, this.user?.hashedId]
|
||||
.filter(Boolean)
|
||||
.map((value) => String(value));
|
||||
return currentIds.includes(String(eventData.user_id));
|
||||
},
|
||||
queueBranchRefresh() {
|
||||
if (this.pendingBranchRefresh) {
|
||||
clearTimeout(this.pendingBranchRefresh);
|
||||
}
|
||||
this.pendingBranchRefresh = setTimeout(async () => {
|
||||
this.pendingBranchRefresh = null;
|
||||
this.$refs.statusBar?.fetchStatus();
|
||||
await this.loadCurrentCertificate();
|
||||
await this.loadProducts();
|
||||
this.$refs.productionSection?.loadProductions();
|
||||
this.$refs.productionSection?.loadStorage();
|
||||
this.$refs.storageSection?.loadStorageData();
|
||||
this.$refs.saleSection?.loadInventory();
|
||||
if (this.$refs.revenueSection) {
|
||||
this.$refs.revenueSection.products = this.products;
|
||||
this.$refs.revenueSection.refresh && this.$refs.revenueSection.refresh();
|
||||
}
|
||||
}, 120);
|
||||
},
|
||||
async loadBranches() {
|
||||
try {
|
||||
const result = await apiClient.get('/api/falukant/branches');
|
||||
@@ -512,6 +554,14 @@ export default {
|
||||
console.error('Error loading branches:', error);
|
||||
}
|
||||
},
|
||||
async loadCurrentCertificate() {
|
||||
try {
|
||||
const result = await apiClient.get('/api/falukant/user');
|
||||
this.currentCertificate = result.data?.certificate ?? null;
|
||||
} catch (error) {
|
||||
console.error('Error loading certificate:', error);
|
||||
}
|
||||
},
|
||||
|
||||
async loadProducts() {
|
||||
try {
|
||||
@@ -771,6 +821,9 @@ export default {
|
||||
},
|
||||
|
||||
handleEvent(eventData) {
|
||||
if (!this.matchesCurrentUser(eventData)) {
|
||||
return;
|
||||
}
|
||||
switch (eventData.event) {
|
||||
case 'production_ready':
|
||||
this.$refs.productionSection?.loadProductions();
|
||||
@@ -798,30 +851,12 @@ export default {
|
||||
this.$refs.productionSection?.loadStorage();
|
||||
break;
|
||||
case 'falukantUpdateStatus':
|
||||
case 'falukantUpdateProductionCertificate':
|
||||
case 'falukantBranchUpdate':
|
||||
if (this.$refs.statusBar) {
|
||||
this.$refs.statusBar.fetchStatus();
|
||||
}
|
||||
|
||||
if (this.$refs.productionSection) {
|
||||
this.$refs.productionSection.loadProductions();
|
||||
this.$refs.productionSection.loadStorage();
|
||||
}
|
||||
|
||||
if (this.$refs.storageSection) {
|
||||
this.$refs.storageSection.loadStorageData();
|
||||
}
|
||||
|
||||
if (this.$refs.saleSection) {
|
||||
this.$refs.saleSection.loadInventory();
|
||||
}
|
||||
this.queueBranchRefresh();
|
||||
break;
|
||||
case 'knowledge_update':
|
||||
this.loadProducts();
|
||||
if (this.$refs.revenueSection) {
|
||||
this.$refs.revenueSection.products = this.products;
|
||||
this.$refs.revenueSection.refresh && this.$refs.revenueSection.refresh();
|
||||
}
|
||||
this.queueBranchRefresh();
|
||||
break;
|
||||
case 'transport_arrived':
|
||||
// Leerer Transport angekommen - Fahrzeug wurde zurückgeholt
|
||||
@@ -1149,6 +1184,22 @@ export default {
|
||||
color: var(--color-text-secondary);
|
||||
}
|
||||
|
||||
.branch-hero__meta {
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.branch-hero__badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 6px 10px;
|
||||
border: 1px solid rgba(138, 84, 17, 0.16);
|
||||
border-radius: 999px;
|
||||
background: rgba(255, 255, 255, 0.7);
|
||||
color: #7a4b12;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.branch-tab-content {
|
||||
margin-top: 16px;
|
||||
padding: 18px;
|
||||
|
||||
Reference in New Issue
Block a user