add default category and default category frontend ui

This commit is contained in:
MaysWind
2020-12-01 01:06:35 +08:00
parent d165eb4d34
commit a6c3f2fe48
8 changed files with 840 additions and 34 deletions
+449
View File
@@ -0,0 +1,449 @@
const defaultExpenseCategories = [
{
name: 'Food & Drink',
categoryIconId: '1',
color: 'ff6b22',
subCategories: [
{
name: 'Food',
categoryIconId: '2',
color: 'ff6b22'
},
{
name: 'Drink',
categoryIconId: '30',
color: 'ff6b22'
},
{
name: 'Fruit & Snack',
categoryIconId: '70',
color: 'ff6b22'
}
]
},
{
name: 'Clothing & Appearance',
categoryIconId: '100',
color: '673ab7',
subCategories: [
{
name: 'Clothing',
categoryIconId: '110',
color: '673ab7'
},
{
name: 'Jewelry',
categoryIconId: '170',
color: '673ab7'
},
{
name: 'Cosmetic',
categoryIconId: '180',
color: '673ab7'
},
{
name: 'Hair Cuts & Salon',
categoryIconId: '190',
color: '673ab7'
}
]
},
{
name: 'Housing & Houseware',
categoryIconId: '200',
color: '000000',
subCategories: [
{
name: 'Houseware',
categoryIconId: '210',
color: '000000'
},
{
name: 'Electronics',
categoryIconId: '230',
color: '000000'
},
{
name: 'Repairs & Maintenance',
categoryIconId: '250',
color: '000000'
},
{
name: 'Housekeeping Services',
categoryIconId: '260',
color: '000000'
},
{
name: 'Utilities Expense',
categoryIconId: '270',
color: '000000'
},
{
name: 'Rent & Mortgage',
categoryIconId: '290',
color: '000000'
}
]
},
{
name: 'Transportation',
categoryIconId: '300',
color: '009688',
subCategories: [
{
name: 'Public Transit',
categoryIconId: '310',
color: '009688'
},
{
name: 'Taxi & Car Rental',
categoryIconId: '320',
color: '009688'
},
{
name: 'Personal Car Expense',
categoryIconId: '330',
color: '009688'
},
{
name: 'Train Tickets',
categoryIconId: '370',
color: '009688'
},
{
name: 'Airline Tickets',
categoryIconId: '390',
color: '009688'
}
]
},
{
name: 'Communication',
categoryIconId: '400',
color: '2196f3',
subCategories: [
{
name: 'Telephone Bill',
categoryIconId: '420',
color: '2196f3'
},
{
name: 'Internet Bill',
categoryIconId: '430',
color: '2196f3'
},
{
name: 'Express Fee',
categoryIconId: '480',
color: '2196f3'
}
]
},
{
name: 'Entertainment',
categoryIconId: '500',
color: 'ff2d55',
subCategories: [
{
name: 'Sports & Fitness',
categoryIconId: '510',
color: 'ff2d55'
},
{
name: 'Party Expense',
categoryIconId: '540',
color: 'ff2d55'
},
{
name: 'Movies & Shows',
categoryIconId: '550',
color: 'ff2d55'
},
{
name: 'Toys & Games',
categoryIconId: '560',
color: 'ff2d55'
},
{
name: 'Subscriptions',
categoryIconId: '570',
color: 'ff2d55'
},
{
name: 'Pet Expense',
categoryIconId: '580',
color: 'ff2d55'
},
{
name: 'Travelling',
categoryIconId: '590',
color: 'ff2d55'
}
]
},
{
name: 'Education & Studying',
categoryIconId: '600',
color: 'cddc39',
subCategories: [
{
name: 'Books & Newspaper & Magazines',
categoryIconId: '610',
color: 'cddc39'
},
{
name: 'Training Courses',
categoryIconId: '660',
color: 'cddc39'
},
{
name: 'Certification & Examination',
categoryIconId: '680',
color: 'cddc39'
}
]
},
{
name: 'Gifts & Donations',
categoryIconId: '700',
color: '4cd964',
subCategories: [
{
name: 'Gifts',
categoryIconId: '710',
color: '4cd964'
},
{
name: 'Donations',
categoryIconId: '780',
color: '4cd964'
}
]
},
{
name: 'Medical & Healthcare',
categoryIconId: '800',
color: 'ff3b30',
subCategories: [
{
name: 'Diagnosis & Treatment',
categoryIconId: '840',
color: 'ff3b30'
},
{
name: 'Medications',
categoryIconId: '860',
color: 'ff3b30'
},
{
name: 'Medical Devices',
categoryIconId: '890',
color: 'ff3b30'
}
]
},
{
name: 'Finance & Insurance',
categoryIconId: '900',
color: 'ff9500',
subCategories: [
{
name: 'Tax Expense',
categoryIconId: '910',
color: 'ff9500'
},
{
name: 'Service Charge',
categoryIconId: '930',
color: 'ff9500'
},
{
name: 'Insurance Expense',
categoryIconId: '950',
color: 'ff9500'
},
{
name: 'Interest Expense',
categoryIconId: '970',
color: 'ff9500'
},
{
name: 'Compensation & Fine',
categoryIconId: '990',
color: 'ff9500'
}
]
},
{
name: 'Miscellaneous',
categoryIconId: '1000',
color: '8e8e93',
subCategories: [
{
name: 'Other Expense',
categoryIconId: '1010',
color: '8e8e93'
}
]
}
];
const defaultIncomeCategories = [
{
name: 'Occupational Earnings',
categoryIconId: '2000',
color: 'ff6b22',
subCategories: [
{
name: 'Salary Income',
categoryIconId: '2010',
color: 'ff6b22'
},
{
name: 'Bonus Income',
categoryIconId: '2020',
color: 'ff6b22'
},
{
name: 'Overtime Pay',
categoryIconId: '231',
color: 'ff6b22'
},
{
name: 'Side Job Income',
categoryIconId: '2080',
color: 'ff6b22'
}
]
},
{
name: 'Finance & Investment',
categoryIconId: '900',
color: 'ff9500',
subCategories: [
{
name: 'Investment Income',
categoryIconId: '2100',
color: 'ff9500'
},
{
name: 'Rental Income',
categoryIconId: '290',
color: 'ff9500'
},
{
name: 'Interest Income',
categoryIconId: '970',
color: 'ff9500'
}
]
},
{
name: 'Miscellaneous',
categoryIconId: '1000',
color: '8e8e93',
subCategories: [
{
name: 'Gift & Lucky Money',
categoryIconId: '710',
color: '8e8e93'
},
{
name: 'Winnings Income',
categoryIconId: '564',
color: '8e8e93'
},
{
name: 'Windfall',
categoryIconId: '5200',
color: '8e8e93'
},
{
name: 'Other Income',
categoryIconId: '3010',
color: '8e8e93'
}
]
}
];
const defaultTransferCategories = [
{
name: 'General Transfer',
categoryIconId: '4000',
color: 'ff6b22',
subCategories: [
{
name: 'Bank Transfer',
categoryIconId: '900',
color: 'ff6b22'
},
{
name: 'Credit Card Repayment',
categoryIconId: '980',
color: 'ff6b22'
},
{
name: 'Deposits & Withdrawals',
categoryIconId: '981',
color: 'ff6b22'
}
]
},
{
name: 'Loan & Debt',
categoryIconId: '950',
color: 'ff9500',
subCategories: [
{
name: 'Borrowing Money',
categoryIconId: '910',
color: 'ff9500'
},
{
name: 'Lending Money',
categoryIconId: '290',
color: 'ff9500'
},
{
name: 'Repayment',
categoryIconId: '930',
color: 'ff9500'
},
{
name: 'Debt Collection',
categoryIconId: '5030',
color: 'ff9500'
}
]
},
{
name: 'Miscellaneous',
categoryIconId: '1000',
color: '8e8e93',
subCategories: [
{
name: 'Out-of-Pocket Expense',
categoryIconId: '2010',
color: '8e8e93'
},
{
name: 'Reimbursement',
categoryIconId: '920',
color: '8e8e93'
},
{
name: 'Other Transfer',
categoryIconId: '4900',
color: '8e8e93'
}
]
}
];
export default {
defaultExpenseCategories: defaultExpenseCategories,
defaultIncomeCategories: defaultIncomeCategories,
defaultTransferCategories: defaultTransferCategories,
};
+93 -34
View File
@@ -237,6 +237,9 @@ const allCategoryIcons = {
'170': {
icon: 'las la-gem'
},
'171': {
icon: 'las la-ring'
},
'180': {
icon: 'las la-spray-can'
},
@@ -299,7 +302,7 @@ const allCategoryIcons = {
icon: 'las la-tint'
},
'271': {
icon: 'las la-burn'
icon: 'las la-fire'
},
'290': {
icon: 'las la-file-invoice'
@@ -497,6 +500,9 @@ const allCategoryIcons = {
icon: 'las la-dice-d6'
},
'564': {
icon: 'las la-dice'
},
'565': {
icon: 'las la-chess'
},
'570': {
@@ -521,18 +527,21 @@ const allCategoryIcons = {
icon: 'las la-swimming-pool'
},
'592': {
icon: 'las la-hot-tub'
icon: 'las la-parachute-box'
},
'593': {
icon: 'las la-monument'
icon: 'las la-hot-tub'
},
'594': {
icon: 'las la-mountain'
icon: 'las la-monument'
},
'595': {
icon: 'las la-campground'
icon: 'las la-mountain'
},
'596': {
icon: 'las la-campground'
},
'597': {
icon: 'las la-hotel'
},
'599': {
@@ -613,6 +622,9 @@ const allCategoryIcons = {
'870': {
icon: 'las la-x-ray'
},
'880': {
icon: 'las la-glasses'
},
'890': {
icon: 'las la-thermometer'
},
@@ -641,9 +653,6 @@ const allCategoryIcons = {
'950': {
icon: 'las la-file-invoice-dollar'
},
'951': {
icon: 'las la-file-invoice'
},
'960': {
icon: 'las la-clipboard-check'
},
@@ -653,6 +662,9 @@ const allCategoryIcons = {
'980': {
icon: 'las la-credit-card'
},
'981': {
icon: 'las la-piggy-bank'
},
'990': {
icon: 'las la-gavel'
},
@@ -663,80 +675,127 @@ const allCategoryIcons = {
'1010': {
icon: 'las la-minus-circle'
},
'1020': {
// 2000 - 2099 : Income - Occupational Earnings
'2000': {
icon: 'las la-suitcase'
},
'2010': {
icon: 'las la-wallet'
},
'2020': {
icon: 'las la-trophy'
},
'2021': {
icon: 'las la-medal'
},
'2080': {
icon: 'las la-user-clock'
},
// 2000 - 2099 : Income - Finance & Investment
'2100': {
icon: 'las la-chart-area'
},
'2101': {
icon: 'las la-chart-line'
},
// 3000 - 3999 : Income - Miscellaneous
'3010': {
icon: 'las la-plus-circle'
},
// 4000 - 4099 : Transfer
'4000': {
icon: 'las la-exchange-alt'
},
'4900': {
icon: 'las la-arrow-circle-right'
},
// 5000 - 5999 : Miscellaneous
'5000': {
icon: 'las la-star'
},
'1030': {
'5010': {
icon: 'las la-magic'
},
'5020': {
icon: 'las la-infinity'
},
'5030': {
icon: 'las la-clipboard-list'
},
'5040': {
icon: 'las la-trash-alt'
},
'1040': {
'5050': {
icon: 'las la-weight-hanging'
},
'1100': {
'5100': {
icon: 'las la-shopping-bag'
},
'1101': {
'5101': {
icon: 'las la-shopping-basket'
},
'1102': {
'5102': {
icon: 'las la-shopping-cart'
},
// 5000 - 9999 : Brands
'5000': {
'5200': {
icon: 'las la-money-bill-wave-alt'
},
// 6000 - 9999 : Brands
'6000': {
icon: 'lab la-amazon'
},
'5001': {
'6001': {
icon: 'lab la-ebay'
},
'5100': {
'6100': {
icon: 'lab la-app-store'
},
'5101': {
'6101': {
icon: 'lab la-google-play'
},
'5200': {
'6200': {
icon: 'lab la-windows'
},
'5300': {
'6300': {
icon: 'lab la-kickstarter'
},
'5400': {
'6400': {
icon: 'lab la-uber'
},
'5500': {
'6500': {
icon: 'lab la-fedex'
},
'5501': {
'6501': {
icon: 'lab la-ups'
},
'5502': {
'6502': {
icon: 'lab la-usps'
},
'5503': {
'6503': {
icon: 'lab la-dhl'
},
'6000': {
'7000': {
icon: 'lab la-playstation'
},
'6001': {
'7001': {
icon: 'lab la-xbox'
},
'6100': {
'7100': {
icon: 'lab la-steam'
},
'6200': {
'7200': {
icon: 'lab la-youtube'
},
'6300': {
'7300': {
icon: 'lab la-spotify'
},
'6301': {
'7301': {
icon: 'lab la-itunes'
},
'7000': {
'8000': {
icon: 'lab la-evernote'
},
'8000': {
'8100': {
icon: 'lab la-adobe'
},
'9000': {
+86
View File
@@ -177,6 +177,87 @@ export default {
'ZMW': 'Zambian kwacha',
'ZWL': 'Zimbabwean dollar',
},
'category': {
'Food & Drink': 'Food & Drink',
'Food': 'Food',
'Drink': 'Drink',
'Fruit & Snack': 'Fruit & Snack',
'Clothing & Appearance': 'Clothing & Appearance',
'Clothing': 'Clothing',
'Jewelry': 'Jewelry',
'Cosmetic': 'Cosmetic',
'Hair Cuts & Salon': 'Hair Cuts & Salon',
'Housing & Houseware': 'Housing & Houseware',
'Houseware': 'Houseware',
'Electronics': 'Electronics',
'Repairs & Maintenance': 'Repairs & Maintenance',
'Housekeeping Services': 'Housekeeping Services',
'Utilities Expense': 'Utilities Expense',
'Rent & Mortgage': 'Rent & Mortgage',
'Transportation': 'Transportation',
'Public Transit': 'Public Transit',
'Taxi & Car Rental': 'Taxi & Car Rental',
'Personal Car Expense': 'Personal Car Expense',
'Train Tickets': 'Train Tickets',
'Airline Tickets': 'Airline Tickets',
'Communication': 'Communication',
'Telephone Bill': 'Telephone Bill',
'Internet Bill': 'Internet Bill',
'Express Fee': 'Express Fee',
'Entertainment': 'Entertainment',
'Sports & Fitness': 'Sports & Fitness',
'Party Expense': 'Party Expense',
'Movies & Shows': 'Movies & Shows',
'Toys & Games': 'Toys & Games',
'Subscriptions': 'Subscriptions',
'Pet Expense': 'Pet Expense',
'Travelling': 'Travelling',
'Education & Studying': 'Education & Studying',
'Books & Newspaper & Magazines': 'Books & Newspaper & Magazines',
'Training Courses': 'Training Courses',
'Certification & Examination': 'Certification & Examination',
'Gifts & Donations': 'Gifts & Donations',
'Gifts': 'Gifts',
'Donations': 'Donations',
'Medical & Healthcare': 'Medical & Healthcare',
'Diagnosis & Treatment': 'Diagnosis & Treatment',
'Medications': 'Medications',
'Medical Devices': 'Medical Devices',
'Finance & Insurance': 'Finance & Insurance',
'Tax Expense': 'Tax Expense',
'Service Charge': 'Service Charge',
'Insurance Expense': 'Insurance Expense',
'Interest Expense': 'Interest Expense',
'Compensation & Fine': 'Compensation & Fine',
'Miscellaneous': 'Miscellaneous',
'Other Expense': 'Other Expense',
'Occupational Earnings': 'Occupational Earnings',
'Salary Income': 'Salary Income',
'Bonus Income': 'Bonus Income',
'Overtime Pay': 'Overtime Pay',
'Side Job Income': 'Side Job Income',
'Finance & Investment': 'Finance & Investment',
'Investment Income': 'Investment Income',
'Rental Income': 'Rental Income',
'Interest Income': 'Interest Income',
'Gift & Lucky Money': 'Gift & Lucky Money',
'Winnings Income': 'Winnings Income',
'Windfall': 'Windfall',
'Other Income': 'Other Income',
'Transfer Category': 'Transfer Category',
'General Transfer': 'General Transfer',
'Bank Transfer': 'Bank Transfer',
'Credit Card Repayment': 'Credit Card Repayment',
'Deposits & Withdrawals': 'Deposits & Withdrawals',
'Loan & Debt': 'Loan & Debt',
'Borrowing Money': 'Borrowing Money',
'Lending Money': 'Lending Money',
'Repayment': 'Repayment',
'Debt Collection': 'Debt Collection',
'Out-of-Pocket Expense': 'Out-of-Pocket Expense',
'Reimbursement': 'Reimbursement',
'Other Transfer': 'Other Transfer',
},
'error': {
'system error': 'System Error',
'api not found': 'Failed to request api',
@@ -402,6 +483,9 @@ export default {
'Other Device': 'Other Device',
'Unknown Device': 'Unknown Device',
'Transaction Categories': 'Transaction Categories',
'Expense Categories': 'Expense Categories',
'Income Categories': 'Income Categories',
'Transfer Categories': 'Transfer Categories',
'Expense Primary Categories': 'Expense Primary Categories',
'Income Primary Categories': 'Income Primary Categories',
'Transfer Primary Categories': 'Transfer Primary Categories',
@@ -411,6 +495,8 @@ export default {
'Transfer Secondary Categories': 'Transfer Secondary Categories',
'Transaction Secondary Categories': 'Transaction Secondary Categories',
'No available category': 'No available category',
'Add Default Categories': 'Add Default Categories',
'Default Categories': 'Default Categories',
'Unable to get category list': 'Unable to get category list',
'Unable to move category': 'Unable to move category',
'Unable to hide this category': 'Unable to hide this category',
+86
View File
@@ -177,6 +177,87 @@ export default {
'ZMW': '赞比亚克瓦查',
'ZWL': '津巴布韦元',
},
'category': {
'Food & Drink': '食品饮料',
'Food': '食品',
'Drink': '饮料',
'Fruit & Snack': '水果零食',
'Clothing & Appearance': '服饰外貌',
'Clothing': '衣服',
'Jewelry': '饰品',
'Cosmetic': '化妆品',
'Hair Cuts & Salon': '美容美发',
'Housing & Houseware': '住宅家居',
'Houseware': '家居用品',
'Electronics': '电子产品',
'Repairs & Maintenance': '维修保养',
'Housekeeping Services': '家政服务',
'Utilities Expense': '水电煤气',
'Rent & Mortgage': '租金贷款',
'Transportation': '交通出行',
'Public Transit': '公共交通',
'Taxi & Car Rental': '打车租车',
'Personal Car Expense': '私家车费用',
'Train Tickets': '火车票',
'Airline Tickets': '飞机票',
'Communication': '交流通讯',
'Telephone Bill': '电话费',
'Internet Bill': '上网费',
'Express Fee': '快递费',
'Entertainment': '休闲娱乐',
'Sports & Fitness': '运动健身',
'Party Expense': '聚会支出',
'Movies & Shows': '电影演出',
'Toys & Games': '玩具游戏',
'Subscriptions': '会员订阅',
'Pet Expense': '宠物花费',
'Travelling': '旅游度假',
'Education & Studying': '教育学习',
'Books & Newspaper & Magazines': '书报杂志',
'Training Courses': '培训课程',
'Certification & Examination': '认证考试',
'Gifts & Donations': '礼物捐赠',
'Gifts': '礼物',
'Donations': '捐赠',
'Medical & Healthcare': '医疗健康',
'Diagnosis & Treatment': '检查治疗',
'Medications': '药品',
'Medical Devices': '医疗器械',
'Finance & Insurance': '金融保险',
'Tax Expense': '税费支出',
'Service Charge': '手续费',
'Insurance Expense': '保险支出',
'Interest Expense': '利息支出',
'Compensation & Fine': '赔偿罚款',
'Miscellaneous': '其他杂项',
'Other Expense': '其他支出',
'Occupational Earnings': '职业收入',
'Salary Income': '工资收入',
'Bonus Income': '奖金收入',
'Overtime Pay': '加班收入',
'Side Job Income': '兼职收入',
'Finance & Investment': '金融投资',
'Investment Income': '投资收入',
'Rental Income': '租金收入',
'Interest Income': '利息收入',
'Gift & Lucky Money': '礼品红包',
'Winnings Income': '中奖收入',
'Windfall': '意外收入',
'Other Income': '其他收入',
'Transfer Category': '转账分类',
'General Transfer': '一般转账',
'Bank Transfer': '银行转账',
'Credit Card Repayment': '信用卡还款',
'Deposits & Withdrawals': '存款取款',
'Loan & Debt': '贷款债务',
'Borrowing Money': '借入',
'Lending Money': '借出',
'Repayment': '还款',
'Debt Collection': '收债',
'Out-of-Pocket Expense': '垫付支出',
'Reimbursement': '报销',
'Other Transfer': '其他转账',
},
'error': {
'system error': '系统错误',
'api not found': '接口调用失败',
@@ -402,6 +483,9 @@ export default {
'Other Device': '其他设备',
'Unknown Device': '未知设备',
'Transaction Categories': '交易分类',
'Expense Categories': '支出分类',
'Income Categories': '收入分类',
'Transfer Categories': '转账分类',
'Expense Primary Categories': '支出一级分类',
'Income Primary Categories': '收入一级分类',
'Transfer Primary Categories': '转账一级分类',
@@ -411,6 +495,8 @@ export default {
'Transfer Secondary Categories': '转账二级分类',
'Transaction Secondary Categories': '交易二级分类',
'No available category': '没有可用的分类',
'Add Default Categories': '添加默认分类',
'Default Categories': '默认分类',
'Unable to get category list': '无法获取分类列表',
'Unable to move category': '无法移动分类',
'Unable to hide this category': '无法隐藏该分类',
+2
View File
@@ -20,6 +20,7 @@ import currency from './consts/currency.js';
import colors from './consts/color.js';
import icons from './consts/icon.js';
import account from './consts/account.js';
import category from './consts/category.js';
import licenses from './consts/licenses.js';
import version from './lib/version.js';
import logger from './lib/logger.js';
@@ -54,6 +55,7 @@ Vue.prototype.$constants = {
colors: colors,
icons: icons,
account: account,
category: category,
};
Vue.prototype.$utilities = utils;
+6
View File
@@ -25,6 +25,7 @@ import SessionListPage from "../views/mobile/users/SessionList.vue";
import CategoryAllPage from "../views/mobile/categories/CategoryAll.vue";
import CategoryListPage from "../views/mobile/categories/CategoryList.vue";
import CategoryEditPage from "../views/mobile/categories/CategoryEdit.vue";
import CategoryDefaultPage from "../views/mobile/categories/CategoryDefault.vue";
function checkLogin(to, from, resolve, reject) {
const router = this;
@@ -204,6 +205,11 @@ const routes = [
component: CategoryEditPage,
beforeEnter: checkLogin
},
{
path: '/category/default',
component: CategoryDefaultPage,
beforeEnter: checkLogin
},
{
path: '(.*)',
redirect: '/'
@@ -0,0 +1,115 @@
<template>
<f7-page>
<f7-navbar>
<f7-nav-left :back-link="$t('Back')"></f7-nav-left>
<f7-nav-title :title="$t('Default Categories')"></f7-nav-title>
<f7-nav-right>
<f7-link :text="$t('Save')" :class="{ 'disabled': saving }" @click="save"></f7-link>
</f7-nav-right>
</f7-navbar>
<f7-card v-for="categoryInfo in allCategories" :key="categoryInfo.type">
<f7-card-header>
<small :style="{ opacity: 0.6 }">
<span>{{ categoryInfo.type | categoryTypeName | t }}</span>
</small>
</f7-card-header>
<f7-card-content class="no-safe-areas" :padding="false">
<f7-list>
<f7-list-item v-for="(category, idx) in categoryInfo.categories"
:key="idx"
:accordion-item="!!category.subCategories.length"
:title="$t('category.' + category.name)">
<f7-icon slot="media"
:icon="category.categoryIconId | categoryIcon"
:style="{ color: '#' + category.color }">
</f7-icon>
<f7-accordion-content v-if="category.subCategories.length" class="padding-left">
<f7-list>
<f7-list-item v-for="(subCategory, subIdx) in category.subCategories"
:key="subIdx"
:title="$t('category.' + subCategory.name)">
<f7-icon slot="media"
:icon="subCategory.categoryIconId | categoryIcon"
:style="{ color: '#' + subCategory.color }">
</f7-icon>
</f7-list-item>
</f7-list>
</f7-accordion-content>
</f7-list-item>
</f7-list>
</f7-card-content>
</f7-card>
</f7-page>
</template>
<script>
export default {
data() {
return {
categoryType: '',
allCategories: [],
saving: false
};
},
created() {
const self = this;
const query = self.$f7route.query;
const router = self.$f7router;
if (query.type !== '0' && query.type !== '1' && query.type !== '2' && query.type !== '3') {
self.$toast('Parameter Invalid');
router.back();
return;
}
self.categoryType = query.type;
if (query.type === '0') {
for (let i = 1; i <= 3; i++) {
self.allCategories.push({
type: i.toString(),
categories: self.$utilities.copyArrayTo(self.getDefaultCategories(i.toString()), [])
});
}
} else {
self.allCategories.push({
type: self.categoryType,
categories: self.$utilities.copyArrayTo(self.getDefaultCategories(self.categoryType), [])
});
}
},
methods: {
getDefaultCategories(categoryType) {
switch (categoryType) {
case '1':
return this.$constants.category.defaultExpenseCategories;
case '2':
return this.$constants.category.defaultIncomeCategories;
case '3':
return this.$constants.category.defaultTransferCategories;
default:
return [];
}
},
save() {
}
},
filters: {
categoryTypeName(categoryType) {
switch (categoryType) {
case '1':
return 'Expense Categories';
case '2':
return 'Income Categories';
case '3':
return 'Transfer Categories';
default:
return 'Transaction Categories';
}
}
}
};
</script>
@@ -27,6 +27,9 @@
<f7-card-content class="no-safe-areas" :padding="false">
<f7-list v-if="noAvailableCategory">
<f7-list-item :title="$t('No available category')"></f7-list-item>
<f7-list-button v-if="hasSubCategories"
:title="$t('Add Default Categories')"
:href="'/category/default?type=' + categoryType"></f7-list-button>
</f7-list>
<f7-list sortable :sortable-enabled="sortable" @sortable:sort="onSort">