refactor: update routing paths in app.vue, enhance AnnualBudget component layout, and streamline dashboard and budget pages for improved user experience
This commit is contained in:
parent
09d8794d72
commit
864a81065c
23 changed files with 3211 additions and 1978 deletions
|
|
@ -431,13 +431,16 @@ export const useBudgetStore = defineStore(
|
|||
console.log("Current revenue items:", budgetWorksheet.value.revenue.length);
|
||||
console.log("Current expense items:", budgetWorksheet.value.expenses.length);
|
||||
|
||||
// Check if we have actual budget data (not just initialized flag)
|
||||
if (isInitialized.value && (budgetWorksheet.value.revenue.length > 0 || budgetWorksheet.value.expenses.length > 0)) {
|
||||
console.log("Already initialized with data, skipping...");
|
||||
// Check if we have actual budget data - prioritize preserving user data
|
||||
const hasUserData = budgetWorksheet.value.revenue.length > 0 || budgetWorksheet.value.expenses.length > 0;
|
||||
|
||||
if (hasUserData) {
|
||||
console.log("Budget data already exists with user changes, preserving...");
|
||||
isInitialized.value = true; // Mark as initialized to prevent future overwrites
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("Initializing budget from wizard data...");
|
||||
console.log("No existing budget data found, initializing from wizard data...");
|
||||
|
||||
try {
|
||||
// Use the new coopBuilder store instead of the old stores
|
||||
|
|
@ -449,7 +452,7 @@ export const useBudgetStore = defineStore(
|
|||
console.log("- Equal wage:", coopStore.equalHourlyWage || "No wage set");
|
||||
console.log("- Overhead costs:", coopStore.overheadCosts.length, coopStore.overheadCosts);
|
||||
|
||||
// Clear existing data
|
||||
// Only clear data if we're truly initializing from scratch
|
||||
budgetWorksheet.value.revenue = [];
|
||||
budgetWorksheet.value.expenses = [];
|
||||
|
||||
|
|
@ -851,13 +854,22 @@ export const useBudgetStore = defineStore(
|
|||
}
|
||||
|
||||
function updateMonthlyValue(category, itemId, monthKey, value) {
|
||||
console.log('updateMonthlyValue called:', { category, itemId, monthKey, value });
|
||||
const items = budgetWorksheet.value[category];
|
||||
const item = items.find((i) => i.id === itemId);
|
||||
if (item) {
|
||||
if (!item.monthlyValues) {
|
||||
item.monthlyValues = {};
|
||||
}
|
||||
item.monthlyValues[monthKey] = Number(value) || 0;
|
||||
const numericValue = Number(value) || 0;
|
||||
|
||||
// Update directly - Pinia's reactivity will handle persistence
|
||||
item.monthlyValues[monthKey] = numericValue;
|
||||
|
||||
console.log('Updated item.monthlyValues:', item.monthlyValues);
|
||||
console.log('Item updated:', item.name);
|
||||
} else {
|
||||
console.error('Item not found:', { category, itemId, availableItems: items.map(i => ({id: i.id, name: i.name})) });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue