From 7fe7b67c29fc18594742a23375e77110de8b71c1 Mon Sep 17 00:00:00 2001 From: Billy Brawner Date: Thu, 30 Aug 2018 18:14:39 -0500 Subject: [PATCH] Add CategoryTypes --- src/app/add-edit-category/add-edit-category.component.html | 4 ++++ src/app/add-edit-category/add-edit-category.component.ts | 2 ++ src/app/budget-database.ts | 3 ++- src/app/category.ts | 2 ++ src/app/category.type.ts | 4 ++++ 5 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 src/app/category.type.ts diff --git a/src/app/add-edit-category/add-edit-category.component.html b/src/app/add-edit-category/add-edit-category.component.html index dccb537..aa85d25 100644 --- a/src/app/add-edit-category/add-edit-category.component.html +++ b/src/app/add-edit-category/add-edit-category.component.html @@ -21,6 +21,10 @@ + + Limit + Goal + diff --git a/src/app/add-edit-category/add-edit-category.component.ts b/src/app/add-edit-category/add-edit-category.component.ts index 0e3b43a..09f1909 100644 --- a/src/app/add-edit-category/add-edit-category.component.ts +++ b/src/app/add-edit-category/add-edit-category.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit, Input } from '@angular/core'; import { CategoryService } from '../category.service' import { Category } from '../category' +import { CategoryType } from '../category.type' import { Location } from '@angular/common'; @Component({ @@ -12,6 +13,7 @@ export class AddEditCategoryComponent implements OnInit { @Input() title: string; @Input() currentCategory: Category; + public categoryType = CategoryType; constructor( private categoryService: CategoryService, diff --git a/src/app/budget-database.ts b/src/app/budget-database.ts index fe8d61e..b409e76 100644 --- a/src/app/budget-database.ts +++ b/src/app/budget-database.ts @@ -15,7 +15,7 @@ export class BudgetDatabase extends Dexie { super('BudgetDatabase') this.version(1).stores({ transactions: `++id, title, description, amount, date, category, type`, - categories: `++id, name, amount, repeat, color` + categories: `++id, name, amount, repeat, color, type-` }) this.transactions.mapToClass(Transaction) this.categories.mapToClass(Category) @@ -38,4 +38,5 @@ export interface ICategory{ amount: number; repeat: string; color: string; + type: CategoryType; } diff --git a/src/app/category.ts b/src/app/category.ts index e694475..e7f31ff 100644 --- a/src/app/category.ts +++ b/src/app/category.ts @@ -1,4 +1,5 @@ import { ICategory } from './budget-database' +import { CategoryType } from './category.type' export class Category implements ICategory { id: number; @@ -6,4 +7,5 @@ export class Category implements ICategory { amount: number; repeat: string; color: string; + type: CategoryType = CategoryType.LIMIT; } diff --git a/src/app/category.type.ts b/src/app/category.type.ts new file mode 100644 index 0000000..ea10f02 --- /dev/null +++ b/src/app/category.type.ts @@ -0,0 +1,4 @@ +export enum CategoryType { + LIMIT, + GOAL +}