feat(falukant): enhance relationship state handling and director updates
All checks were successful
Deploy to production / deploy (push) Successful in 2m58s

- Updated FalukantService to return user information alongside relationship state for improved context in relationship management.
- Modified DirectorInfo component to trigger a refresh when a new director is hired, ensuring up-to-date information.
- Added socket event handling for 'directorchanged' in BranchView to manage director updates effectively, enhancing real-time responsiveness in the application.
This commit is contained in:
Torsten Schulz (local)
2026-03-31 12:09:55 +02:00
parent 3187a6e7b0
commit b1990334b9
3 changed files with 7 additions and 3 deletions

View File

@@ -3876,7 +3876,7 @@ class FalukantService extends BaseService {
throw { status: 400, message: 'relationshipId is required' }; throw { status: 400, message: 'relationshipId is required' };
} }
const { state } = await this.getOwnedLoverRelationState(hashedUserId, parsedRelationshipId); const { user, state } = await this.getOwnedLoverRelationState(hashedUserId, parsedRelationshipId);
const updateData = { acknowledged: true }; const updateData = { acknowledged: true };
if (state.loverRole === 'secret_affair' || !state.loverRole) { if (state.loverRole === 'secret_affair' || !state.loverRole) {
updateData.loverRole = 'lover'; updateData.loverRole = 'lover';
@@ -3897,7 +3897,7 @@ class FalukantService extends BaseService {
throw { status: 400, message: 'relationshipId is required' }; throw { status: 400, message: 'relationshipId is required' };
} }
const { state } = await this.getOwnedLoverRelationState(hashedUserId, parsedRelationshipId); const { user, state } = await this.getOwnedLoverRelationState(hashedUserId, parsedRelationshipId);
await state.update({ await state.update({
active: false, active: false,
acknowledged: false acknowledged: false

View File

@@ -178,7 +178,7 @@
</div> </div>
</div> </div>
</div> </div>
<NewDirectorDialog ref="newDirectorDialog" /> <NewDirectorDialog ref="newDirectorDialog" @directorHired="loadDirector" />
</template> </template>
<script> <script>

View File

@@ -552,6 +552,7 @@ export default {
this.socket.on('falukantBranchUpdate', (data) => this.handleEvent({ event: 'falukantBranchUpdate', ...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('transport_arrived', (data) => this.handleEvent({ event: 'transport_arrived', ...data }));
this.socket.on('inventory_updated', (data) => this.handleEvent({ event: 'inventory_updated', ...data })); this.socket.on('inventory_updated', (data) => this.handleEvent({ event: 'inventory_updated', ...data }));
this.socket.on('directorchanged', (data) => this.handleEvent({ event: 'directorchanged', ...(data || {}) }));
} }
// Load taxes for the initially selected branch (if any) // Load taxes for the initially selected branch (if any)
await this.loadBranchTaxes(); await this.loadBranchTaxes();
@@ -573,6 +574,7 @@ export default {
this.socket.off('falukantBranchUpdate'); this.socket.off('falukantBranchUpdate');
this.socket.off('transport_arrived'); this.socket.off('transport_arrived');
this.socket.off('inventory_updated'); this.socket.off('inventory_updated');
this.socket.off('directorchanged');
} }
}, },
@@ -631,6 +633,7 @@ export default {
this.$refs.revenueSection.products = this.products; this.$refs.revenueSection.products = this.products;
this.$refs.revenueSection.refresh && this.$refs.revenueSection.refresh(); this.$refs.revenueSection.refresh && this.$refs.revenueSection.refresh();
} }
this.$refs.directorInfo?.refresh?.();
}, 120); }, 120);
}, },
async loadBranches() { async loadBranches() {
@@ -950,6 +953,7 @@ export default {
this.$refs.revenueSection?.refresh(); this.$refs.revenueSection?.refresh();
break; break;
case 'director_death': case 'director_death':
case 'directorchanged':
this.$refs.directorInfo?.loadDirector(); this.$refs.directorInfo?.loadDirector();
break; break;
case 'production_started': case 'production_started':