Refactor navigation and enhance director information display
- Removed the directors section from the navigation menu for a cleaner interface. - Updated the FalukantService to include additional attributes for directors, such as knowledges and region. - Enhanced the DirectorInfo component to display detailed information, including knowledge and income management features. - Implemented tab navigation in BranchView for better organization of director, inventory, production, and storage sections. - Updated localization files to reflect changes in navigation and tab labels.
This commit is contained in:
@@ -117,10 +117,6 @@ const menuStructure = {
|
||||
visible: ["hasfalukantaccount"],
|
||||
path: "/falukant/branch"
|
||||
},
|
||||
directors: {
|
||||
visible: ["hasfalukantaccount"],
|
||||
path: "/falukant/directors"
|
||||
},
|
||||
family: {
|
||||
visible: ["hasfalukantaccount"],
|
||||
path: "/falukant/family"
|
||||
|
||||
@@ -1160,23 +1160,45 @@ class FalukantService extends BaseService {
|
||||
{
|
||||
model: FalukantCharacter,
|
||||
as: 'character',
|
||||
attributes: ['firstName', 'lastName', 'birthdate', 'titleOfNobility', 'gender'],
|
||||
// Wichtige Felder explizit auswählen, damit die Joins auf Titel,
|
||||
// Namen und Region im äußeren Select funktionieren.
|
||||
attributes: ['id', 'birthdate', 'gender', 'titleOfNobility', 'firstName', 'lastName', 'regionId'],
|
||||
where: {
|
||||
regionId: branch.regionId,
|
||||
},
|
||||
include: [
|
||||
{
|
||||
model: TitleOfNobility,
|
||||
as: 'nobleTitle'
|
||||
as: 'nobleTitle',
|
||||
attributes: ['labelTr', 'level']
|
||||
},
|
||||
{
|
||||
model: FalukantPredefineFirstname,
|
||||
as: 'definedFirstName'
|
||||
as: 'definedFirstName',
|
||||
attributes: ['name']
|
||||
},
|
||||
{
|
||||
model: FalukantPredefineLastname,
|
||||
as: 'definedLastName'
|
||||
as: 'definedLastName',
|
||||
attributes: ['name']
|
||||
},
|
||||
{
|
||||
model: Knowledge,
|
||||
as: 'knowledges',
|
||||
attributes: ['productId', 'knowledge'],
|
||||
include: [
|
||||
{
|
||||
model: ProductType,
|
||||
as: 'productType',
|
||||
attributes: ['labelTr'],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
model: RegionData,
|
||||
as: 'region',
|
||||
attributes: ['name']
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
@@ -1185,6 +1207,16 @@ class FalukantService extends BaseService {
|
||||
return null;
|
||||
}
|
||||
const age = Math.floor((Date.now() - new Date(director.character.birthdate)) / (24 * 60 * 60 * 1000));
|
||||
|
||||
// wishedIncome analog zu getAllDirectors() berechnen
|
||||
const knowledges = director.character.knowledges || [];
|
||||
const avgKnowledge = knowledges.length
|
||||
? knowledges.reduce((sum, k) => sum + k.knowledge, 0) / knowledges.length
|
||||
: 0;
|
||||
const wishedIncome = Math.round(
|
||||
director.character.nobleTitle.level * Math.pow(1.231, avgKnowledge / 1.5)
|
||||
);
|
||||
|
||||
return {
|
||||
director: {
|
||||
id: director.id,
|
||||
@@ -1193,12 +1225,18 @@ class FalukantService extends BaseService {
|
||||
title: director.character.nobleTitle.labelTr,
|
||||
age,
|
||||
gender: director.character.gender,
|
||||
nobleTitle: director.character.nobleTitle,
|
||||
definedFirstName: director.character.definedFirstName,
|
||||
definedLastName: director.character.definedLastName,
|
||||
knowledges: director.character.knowledges,
|
||||
},
|
||||
income: director.income,
|
||||
satisfaction: director.satisfaction,
|
||||
mayProduce: director.mayProduce,
|
||||
maySell: director.maySell,
|
||||
mayStartTransport: director.mayStartTransport,
|
||||
region: director.character.region?.name || null,
|
||||
wishedIncome,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user