feat: add income categories to budget management
This commit is contained in:
@@ -451,6 +451,11 @@
|
||||
"catHealth": "الصحة",
|
||||
"catEducation": "التعليم",
|
||||
"catMisc": "متنوع",
|
||||
"catEarnedIncome": "دخل العمل",
|
||||
"catInvestmentIncome": "دخل الاستثمار",
|
||||
"catTransferGiftIncome": "التحويلات والهدايا",
|
||||
"catGovernmentBenefits": "المزايا الاجتماعية",
|
||||
"catOtherIncome": "دخل آخر",
|
||||
"loadingIndicator": "جارٍ التحميل…"
|
||||
},
|
||||
"settings": {
|
||||
|
||||
@@ -451,6 +451,11 @@
|
||||
"catHealth": "Gesundheit",
|
||||
"catEducation": "Bildung",
|
||||
"catMisc": "Sonstiges",
|
||||
"catEarnedIncome": "Erwerbseinkommen",
|
||||
"catInvestmentIncome": "Kapitalerträge",
|
||||
"catTransferGiftIncome": "Geschenke & Transfers",
|
||||
"catGovernmentBenefits": "Sozialleistungen",
|
||||
"catOtherIncome": "Sonstiges Einkommen",
|
||||
"loadingIndicator": "Lade…"
|
||||
},
|
||||
"settings": {
|
||||
|
||||
@@ -451,6 +451,11 @@
|
||||
"catHealth": "Υγεία",
|
||||
"catEducation": "Εκπαίδευση",
|
||||
"catMisc": "Διάφορα",
|
||||
"catEarnedIncome": "Εισόδημα από εργασία",
|
||||
"catInvestmentIncome": "Επενδυτικό εισόδημα",
|
||||
"catTransferGiftIncome": "Μεταφορές και δώρα",
|
||||
"catGovernmentBenefits": "Κοινωνικές παροχές",
|
||||
"catOtherIncome": "Άλλο εισόδημα",
|
||||
"loadingIndicator": "Φόρτωση…"
|
||||
},
|
||||
"settings": {
|
||||
|
||||
@@ -451,6 +451,11 @@
|
||||
"catHealth": "Health",
|
||||
"catEducation": "Education",
|
||||
"catMisc": "Miscellaneous",
|
||||
"catEarnedIncome": "Earned Income",
|
||||
"catInvestmentIncome": "Investment Income",
|
||||
"catTransferGiftIncome": "Transfer & Gift Income",
|
||||
"catGovernmentBenefits": "Government & Social Benefits",
|
||||
"catOtherIncome": "Other Income",
|
||||
"loadingIndicator": "Loading…"
|
||||
},
|
||||
"settings": {
|
||||
|
||||
@@ -451,6 +451,11 @@
|
||||
"catHealth": "Salud",
|
||||
"catEducation": "Educación",
|
||||
"catMisc": "Otros",
|
||||
"catEarnedIncome": "Ingresos del Trabajo",
|
||||
"catInvestmentIncome": "Ingresos de Inversión",
|
||||
"catTransferGiftIncome": "Transferencias y Regalos",
|
||||
"catGovernmentBenefits": "Prestaciones Sociales",
|
||||
"catOtherIncome": "Otros Ingresos",
|
||||
"loadingIndicator": "Cargando…"
|
||||
},
|
||||
"settings": {
|
||||
|
||||
@@ -451,6 +451,11 @@
|
||||
"catHealth": "Santé",
|
||||
"catEducation": "Éducation",
|
||||
"catMisc": "Divers",
|
||||
"catEarnedIncome": "Revenus du Travail",
|
||||
"catInvestmentIncome": "Revenus d'Investissement",
|
||||
"catTransferGiftIncome": "Transferts et Cadeaux",
|
||||
"catGovernmentBenefits": "Allocations Sociales",
|
||||
"catOtherIncome": "Autres Revenus",
|
||||
"loadingIndicator": "Chargement…"
|
||||
},
|
||||
"settings": {
|
||||
|
||||
@@ -451,6 +451,11 @@
|
||||
"catHealth": "स्वास्थ्य",
|
||||
"catEducation": "शिक्षा",
|
||||
"catMisc": "विविध",
|
||||
"catEarnedIncome": "कमाई आय",
|
||||
"catInvestmentIncome": "निवेश आय",
|
||||
"catTransferGiftIncome": "स्थानांतरण और उपहार",
|
||||
"catGovernmentBenefits": "सामाजिक लाभ",
|
||||
"catOtherIncome": "अन्य आय",
|
||||
"loadingIndicator": "लोड हो रहा है…"
|
||||
},
|
||||
"settings": {
|
||||
|
||||
@@ -451,6 +451,11 @@
|
||||
"catHealth": "Salute",
|
||||
"catEducation": "Istruzione",
|
||||
"catMisc": "Varie",
|
||||
"catEarnedIncome": "Reddito da Lavoro",
|
||||
"catInvestmentIncome": "Reddito da Investimenti",
|
||||
"catTransferGiftIncome": "Trasferimenti e Regali",
|
||||
"catGovernmentBenefits": "Prestazioni Sociali",
|
||||
"catOtherIncome": "Altro Reddito",
|
||||
"loadingIndicator": "Caricamento…"
|
||||
},
|
||||
"settings": {
|
||||
|
||||
@@ -451,6 +451,11 @@
|
||||
"catHealth": "医療",
|
||||
"catEducation": "教育",
|
||||
"catMisc": "その他",
|
||||
"catEarnedIncome": "給与・報酬",
|
||||
"catInvestmentIncome": "投資収入",
|
||||
"catTransferGiftIncome": "譲渡・贈与",
|
||||
"catGovernmentBenefits": "社会保障給付",
|
||||
"catOtherIncome": "その他の収入",
|
||||
"loadingIndicator": "読み込み中…"
|
||||
},
|
||||
"settings": {
|
||||
|
||||
@@ -451,6 +451,11 @@
|
||||
"catHealth": "Saúde",
|
||||
"catEducation": "Educação",
|
||||
"catMisc": "Outros",
|
||||
"catEarnedIncome": "Renda do Trabalho",
|
||||
"catInvestmentIncome": "Renda de Investimento",
|
||||
"catTransferGiftIncome": "Transferências e Presentes",
|
||||
"catGovernmentBenefits": "Benefícios Sociais",
|
||||
"catOtherIncome": "Outras Rendas",
|
||||
"loadingIndicator": "Carregando…"
|
||||
},
|
||||
"settings": {
|
||||
|
||||
@@ -451,6 +451,11 @@
|
||||
"catHealth": "Здоровье",
|
||||
"catEducation": "Образование",
|
||||
"catMisc": "Разное",
|
||||
"catEarnedIncome": "Трудовой доход",
|
||||
"catInvestmentIncome": "Инвестиционный доход",
|
||||
"catTransferGiftIncome": "Переводы и подарки",
|
||||
"catGovernmentBenefits": "Социальные пособия",
|
||||
"catOtherIncome": "Прочие доходы",
|
||||
"loadingIndicator": "Загрузка…"
|
||||
},
|
||||
"settings": {
|
||||
|
||||
@@ -451,6 +451,11 @@
|
||||
"catHealth": "Hälsa",
|
||||
"catEducation": "Utbildning",
|
||||
"catMisc": "Diverse",
|
||||
"catEarnedIncome": "Arbetsinkomst",
|
||||
"catInvestmentIncome": "Investeringsinkomst",
|
||||
"catTransferGiftIncome": "Överföringar och gåvor",
|
||||
"catGovernmentBenefits": "Socialförmåner",
|
||||
"catOtherIncome": "Övrig inkomst",
|
||||
"loadingIndicator": "Laddar…"
|
||||
},
|
||||
"settings": {
|
||||
|
||||
@@ -451,6 +451,11 @@
|
||||
"catHealth": "Sağlık",
|
||||
"catEducation": "Eğitim",
|
||||
"catMisc": "Diğer",
|
||||
"catEarnedIncome": "Kazanç Geliri",
|
||||
"catInvestmentIncome": "Yatırım Geliri",
|
||||
"catTransferGiftIncome": "Transferler ve Hediyeler",
|
||||
"catGovernmentBenefits": "Sosyal Yardımlar",
|
||||
"catOtherIncome": "Diğer Gelir",
|
||||
"loadingIndicator": "Yükleniyor…"
|
||||
},
|
||||
"settings": {
|
||||
|
||||
@@ -451,6 +451,11 @@
|
||||
"catHealth": "Здоров'я",
|
||||
"catEducation": "Освіта",
|
||||
"catMisc": "Різне",
|
||||
"catEarnedIncome": "Трудовий дохід",
|
||||
"catInvestmentIncome": "Інвестиційний дохід",
|
||||
"catTransferGiftIncome": "Переводи та подарунки",
|
||||
"catGovernmentBenefits": "Соціальні виплати",
|
||||
"catOtherIncome": "Інші доходи",
|
||||
"loadingIndicator": "Завантаження…"
|
||||
},
|
||||
"settings": {
|
||||
@@ -619,5 +624,4 @@
|
||||
"pendingBadgeTitle": "{{count}} нагадування",
|
||||
"pendingBadgeTitlePlural": "{{count}} нагадувань"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -451,6 +451,11 @@
|
||||
"catHealth": "健康",
|
||||
"catEducation": "教育",
|
||||
"catMisc": "其他",
|
||||
"catEarnedIncome": "劳动收入",
|
||||
"catInvestmentIncome": "投资收入",
|
||||
"catTransferGiftIncome": "转账和礼物",
|
||||
"catGovernmentBenefits": "社会福利",
|
||||
"catOtherIncome": "其他收入",
|
||||
"loadingIndicator": "加载中…"
|
||||
},
|
||||
"settings": {
|
||||
|
||||
+31
-3
@@ -15,12 +15,20 @@ import { esc } from '/utils/html.js';
|
||||
// Konstanten
|
||||
// --------------------------------------------------------
|
||||
|
||||
const CATEGORIES = [
|
||||
const EXPENSE_CATEGORIES = [
|
||||
'Lebensmittel', 'Miete', 'Versicherung', 'Mobilität',
|
||||
'Freizeit', 'Kleidung', 'Gesundheit', 'Bildung', 'Sonstiges',
|
||||
];
|
||||
|
||||
const INCOME_CATEGORIES = [
|
||||
'Erwerbseinkommen', 'Kapitalerträge', 'Geschenke & Transfers',
|
||||
'Sozialleistungen', 'Sonstiges Einkommen',
|
||||
];
|
||||
|
||||
const CATEGORIES = [...EXPENSE_CATEGORIES, ...INCOME_CATEGORIES];
|
||||
|
||||
const CATEGORY_LABELS = () => ({
|
||||
// Expense categories
|
||||
'Lebensmittel': t('budget.catFood'),
|
||||
'Miete': t('budget.catRent'),
|
||||
'Versicherung': t('budget.catInsurance'),
|
||||
@@ -30,6 +38,12 @@ const CATEGORY_LABELS = () => ({
|
||||
'Gesundheit': t('budget.catHealth'),
|
||||
'Bildung': t('budget.catEducation'),
|
||||
'Sonstiges': t('budget.catMisc'),
|
||||
// Income categories
|
||||
'Erwerbseinkommen': t('budget.catEarnedIncome'),
|
||||
'Kapitalerträge': t('budget.catInvestmentIncome'),
|
||||
'Geschenke & Transfers': t('budget.catTransferGiftIncome'),
|
||||
'Sozialleistungen': t('budget.catGovernmentBenefits'),
|
||||
'Sonstiges Einkommen': t('budget.catOtherIncome'),
|
||||
});
|
||||
|
||||
function getMonthName(monthIndex) {
|
||||
@@ -345,8 +359,9 @@ function openBudgetModal({ mode, entry = null }) {
|
||||
const isExpense = isEdit ? entry.amount < 0 : true;
|
||||
const absAmount = isEdit ? Math.abs(entry.amount).toFixed(2) : '';
|
||||
|
||||
const catLabels = CATEGORY_LABELS();
|
||||
const catOpts = CATEGORIES.map((c) =>
|
||||
const catLabels = CATEGORY_LABELS();
|
||||
const initialCats = isExpense ? EXPENSE_CATEGORIES : INCOME_CATEGORIES;
|
||||
const catOpts = initialCats.map((c) =>
|
||||
`<option value="${c}" ${isEdit && entry.category === c ? 'selected' : ''}>${catLabels[c] || c}</option>`
|
||||
).join('');
|
||||
|
||||
@@ -407,15 +422,28 @@ function openBudgetModal({ mode, entry = null }) {
|
||||
onSave(panel) {
|
||||
let currentType = isExpense ? 'expense' : 'income';
|
||||
|
||||
const updateCategoryOptions = () => {
|
||||
const catLabels = CATEGORY_LABELS();
|
||||
const cats = currentType === 'income' ? INCOME_CATEGORIES : EXPENSE_CATEGORIES;
|
||||
const catSelect = panel.querySelector('#bm-category');
|
||||
const currentValue = catSelect.value;
|
||||
|
||||
catSelect.innerHTML = cats.map((c) =>
|
||||
`<option value="${c}" ${currentValue === c ? 'selected' : ''}>${catLabels[c] || c}</option>`
|
||||
).join('');
|
||||
};
|
||||
|
||||
panel.querySelector('#type-expense').addEventListener('click', () => {
|
||||
currentType = 'expense';
|
||||
panel.querySelector('#type-expense').classList.add('amount-type-btn--active');
|
||||
panel.querySelector('#type-income').classList.remove('amount-type-btn--active');
|
||||
updateCategoryOptions();
|
||||
});
|
||||
panel.querySelector('#type-income').addEventListener('click', () => {
|
||||
currentType = 'income';
|
||||
panel.querySelector('#type-income').classList.add('amount-type-btn--active');
|
||||
panel.querySelector('#type-expense').classList.remove('amount-type-btn--active');
|
||||
updateCategoryOptions();
|
||||
});
|
||||
|
||||
panel.querySelector('#bm-cancel').addEventListener('click', closeModal);
|
||||
|
||||
Reference in New Issue
Block a user