Merge branch 'dashboard-improvements' of billy/budget into master
This commit is contained in:
commit
28b4caae71
15 changed files with 62 additions and 54 deletions
2
Jenkinsfile
vendored
2
Jenkinsfile
vendored
|
@ -40,7 +40,7 @@ pipeline {
|
||||||
}
|
}
|
||||||
stage('Deploy to Dev') {
|
stage('Deploy to Dev') {
|
||||||
steps {
|
steps {
|
||||||
sh 'rm /var/www/html/*'
|
sh 'rm -rf /var/www/html/*'
|
||||||
sh 'cp -rv dist/budget/* /var/www/html/'
|
sh 'cp -rv dist/budget/* /var/www/html/'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<mat-toolbar>
|
<mat-toolbar>
|
||||||
<span>
|
<span>
|
||||||
<a (click)="goBack()">
|
<a mat-button (click)="goBack()">
|
||||||
<mat-icon>arrow_back</mat-icon>
|
<mat-icon>arrow_back</mat-icon>
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
{{ title }}
|
{{ title }}
|
||||||
</span>
|
</span>
|
||||||
<span class="action-item">
|
<span class="action-item">
|
||||||
<a (click)="save()">Save</a>
|
<a mat-button (click)="save()">Save</a>
|
||||||
</span>
|
</span>
|
||||||
</mat-toolbar>
|
</mat-toolbar>
|
||||||
<div *ngIf="!currentCategory">
|
<div *ngIf="!currentCategory">
|
||||||
|
@ -21,10 +21,6 @@
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<input matInput type="number" [(ngModel)]="currentCategory.amount" placeholder="Amount" required>
|
<input matInput type="number" [(ngModel)]="currentCategory.amount" placeholder="Amount" required>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-radio-group [(ngModel)]="currentCategory.type">
|
|
||||||
<mat-radio-button [value]="categoryType.LIMIT">Limit</mat-radio-button>
|
|
||||||
<mat-radio-button [value]="categoryType.GOAL">Goal</mat-radio-button>
|
|
||||||
</mat-radio-group>
|
|
||||||
<!--
|
<!--
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<input type="color" matInput [(ngModel)]="currentCategory.color" placeholder="Color">
|
<input type="color" matInput [(ngModel)]="currentCategory.color" placeholder="Color">
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { Component, OnInit, Input } from '@angular/core';
|
import { Component, OnInit, Input } from '@angular/core';
|
||||||
import { CategoryService } from '../category.service'
|
import { CategoryService } from '../category.service'
|
||||||
import { Category } from '../category'
|
import { Category } from '../category'
|
||||||
import { CategoryType } from '../category.type'
|
|
||||||
import { Location } from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -13,7 +12,6 @@ export class AddEditCategoryComponent implements OnInit {
|
||||||
|
|
||||||
@Input() title: string;
|
@Input() title: string;
|
||||||
@Input() currentCategory: Category;
|
@Input() currentCategory: Category;
|
||||||
public categoryType = CategoryType;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private categoryService: CategoryService,
|
private categoryService: CategoryService,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<mat-toolbar>
|
<mat-toolbar>
|
||||||
<span>
|
<span>
|
||||||
<a (click)="goBack()">
|
<a mat-button (click)="goBack()">
|
||||||
<mat-icon>arrow_back</mat-icon>
|
<mat-icon>arrow_back</mat-icon>
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
{{ title }}
|
{{ title }}
|
||||||
</span>
|
</span>
|
||||||
<span class="action-item">
|
<span class="action-item">
|
||||||
<a (click)="save()">Save</a>
|
<a mat-button (click)="save()">Save</a>
|
||||||
</span>
|
</span>
|
||||||
</mat-toolbar>
|
</mat-toolbar>
|
||||||
<div *ngIf="!currentTransaction">
|
<div *ngIf="!currentTransaction">
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import Dexie from 'dexie';
|
import Dexie from 'dexie';
|
||||||
import { Category } from './category'
|
import { Category } from './category'
|
||||||
import { CategoryType } from './category.type';
|
|
||||||
import { Transaction } from './transaction'
|
import { Transaction } from './transaction'
|
||||||
import { TransactionType } from './transaction.type';
|
import { TransactionType } from './transaction.type';
|
||||||
|
|
||||||
|
@ -15,8 +14,16 @@ export class BudgetDatabase extends Dexie {
|
||||||
constructor () {
|
constructor () {
|
||||||
super('BudgetDatabase')
|
super('BudgetDatabase')
|
||||||
this.version(1).stores({
|
this.version(1).stores({
|
||||||
|
transactions: `++id, title, description, amount, date, category, type`,
|
||||||
|
categories: `++id, name, amount, repeat, color`
|
||||||
|
})
|
||||||
|
this.version(2).stores({
|
||||||
transactions: `++id, title, description, amount, date, category_id, type`,
|
transactions: `++id, title, description, amount, date, category_id, type`,
|
||||||
categories: `++id, name, amount, repeat, color, type-`
|
categories: `++id, name, amount, repeat, color, type`
|
||||||
|
})
|
||||||
|
this.version(3).stores({
|
||||||
|
transactions: `++id, title, description, amount, date, category_id, type`,
|
||||||
|
categories: `++id, name, amount, repeat, color`
|
||||||
})
|
})
|
||||||
this.transactions.mapToClass(Transaction)
|
this.transactions.mapToClass(Transaction)
|
||||||
this.categories.mapToClass(Category)
|
this.categories.mapToClass(Category)
|
||||||
|
@ -39,5 +46,4 @@ export interface ICategory{
|
||||||
amount: number;
|
amount: number;
|
||||||
repeat: string;
|
repeat: string;
|
||||||
color: string;
|
color: string;
|
||||||
type: CategoryType;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<mat-toolbar>
|
<mat-toolbar>
|
||||||
<span>
|
<span>
|
||||||
<a (click)="goBack()">
|
<a mat-button (click)="goBack()">
|
||||||
<mat-icon>arrow_back</mat-icon>
|
<mat-icon>arrow_back</mat-icon>
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -13,6 +13,6 @@
|
||||||
{{ getCategoryRemainingBalance(category) | currency }} remaining
|
{{ getCategoryRemainingBalance(category) | currency }} remaining
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<mat-progress-bar matLine mode="determinate" #categoryProgress [attr.id]="'cat-' + category.id" value="{{ getCategoryCompletion(category) }}"></mat-progress-bar>
|
<mat-progress-bar matLine color="accent" mode="determinate" #categoryProgress [attr.id]="'cat-' + category.id" value="{{ getCategoryCompletion(category) }}"></mat-progress-bar>
|
||||||
</a>
|
</a>
|
||||||
</mat-nav-list>
|
</mat-nav-list>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { Component, OnInit, Input } from '@angular/core';
|
import { Component, OnInit, Input } from '@angular/core';
|
||||||
import { Category } from '../category'
|
import { Category } from '../category'
|
||||||
import { CategoryType } from '../category.type'
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-category-list',
|
selector: 'app-category-list',
|
||||||
|
@ -53,14 +52,13 @@ export class CategoryListComponent implements OnInit {
|
||||||
categoryBalance = 0
|
categoryBalance = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
if (category.type === CategoryType.LIMIT) {
|
// Invert the negative/positive values for calculating progress
|
||||||
// If the category is a limit, then a negative balance needs to be turned into positive
|
// since the limit for a category is saved as a positive but the
|
||||||
// and vice-versa for the completion to be properly calculated
|
// balance is used in the calculation.
|
||||||
if (categoryBalance < 0) {
|
if (categoryBalance < 0) {
|
||||||
categoryBalance = Math.abs(categoryBalance)
|
categoryBalance = Math.abs(categoryBalance)
|
||||||
} else {
|
} else {
|
||||||
categoryBalance -= (categoryBalance * 2)
|
categoryBalance -= (categoryBalance * 2)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return categoryBalance / category.amount * 100;
|
return categoryBalance / category.amount * 100;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { ICategory } from './budget-database'
|
import { ICategory } from './budget-database'
|
||||||
import { CategoryType } from './category.type'
|
|
||||||
|
|
||||||
export class Category implements ICategory {
|
export class Category implements ICategory {
|
||||||
id: number;
|
id: number;
|
||||||
|
@ -7,5 +6,4 @@ export class Category implements ICategory {
|
||||||
amount: number;
|
amount: number;
|
||||||
repeat: string;
|
repeat: string;
|
||||||
color: string;
|
color: string;
|
||||||
type: CategoryType = CategoryType.LIMIT;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
export enum CategoryType {
|
|
||||||
LIMIT,
|
|
||||||
GOAL
|
|
||||||
}
|
|
|
@ -35,11 +35,13 @@
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dashboard-primary a {
|
.dashboard-primary div {
|
||||||
bottom: 1em;
|
bottom: 0.5em;
|
||||||
right: 1em;
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
left: 0.5em;
|
||||||
|
right: 0.5em;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
text-align: right;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.dashboard .no-categories {
|
.dashboard .no-categories {
|
||||||
|
@ -55,7 +57,6 @@
|
||||||
|
|
||||||
a.view-all {
|
a.view-all {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 1em;
|
right: 0.5em;
|
||||||
top: 1em;
|
top: 0.5em;
|
||||||
font-size: 1em;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,15 +8,19 @@
|
||||||
<div class="dashboard">
|
<div class="dashboard">
|
||||||
<div class="dashboard-primary">
|
<div class="dashboard-primary">
|
||||||
<h2 class="balance">
|
<h2 class="balance">
|
||||||
Current Balance: <span [ngClass]="{'income': balance > 0, 'expense': balance < 0}" >{{ balance | currency }}</span>
|
Current Balance: <br />
|
||||||
|
<span [ngClass]="{'income': balance > 0, 'expense': balance < 0}" >{{ balance | currency }}</span>
|
||||||
</h2>
|
</h2>
|
||||||
<a routerLink="/transactions">View Transactions >></a>
|
<div class="transaction-navigation">
|
||||||
|
<a mat-button routerLink="/transactions/new">Add Transaction</a>
|
||||||
|
<a mat-button routerLink="/transactions">View Transactions</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="dashboard-categories">
|
<div class="dashboard-categories">
|
||||||
<h3 class="categories">Categories</h3>
|
<h3 class="categories">Categories</h3>
|
||||||
<a routerLink="/categories" class="view-all" *ngIf="categories">View All</a>
|
<a mat-button routerLink="/categories" class="view-all" *ngIf="categories">View All</a>
|
||||||
<div class="no-categories" *ngIf="!categories">
|
<div class="no-categories" *ngIf="!categories || categories.length === 0">
|
||||||
<a routerLink="/categories/new">
|
<a mat-button routerLink="/categories/new">
|
||||||
<mat-icon>add</mat-icon>
|
<mat-icon>add</mat-icon>
|
||||||
<p>Add categories to get more insights into your income and expenses.</p>
|
<p>Add categories to get more insights into your income and expenses.</p>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -22,6 +22,7 @@ export class DashboardComponent implements OnInit {
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.balance = 0;
|
||||||
this.getBalance();
|
this.getBalance();
|
||||||
this.getTransactions();
|
this.getTransactions();
|
||||||
this.getCategories();
|
this.getCategories();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<mat-toolbar>
|
<mat-toolbar>
|
||||||
<span>
|
<span>
|
||||||
<a (click)="goBack()">
|
<a mat-button (click)="goBack()">
|
||||||
<mat-icon>arrow_back</mat-icon>
|
<mat-icon>arrow_back</mat-icon>
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -24,25 +24,35 @@ a.mat-fab {
|
||||||
|
|
||||||
mat-toolbar {
|
mat-toolbar {
|
||||||
box-shadow: 0px 3px 3px 1px #212121;
|
box-shadow: 0px 3px 3px 1px #212121;
|
||||||
display: flex;
|
}
|
||||||
justify-content: space-between;
|
|
||||||
|
mat-toolbar.mat-toolbar-row, mat-toolbar.mat-toolbar-single-row {
|
||||||
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
mat-toolbar span {
|
mat-toolbar span {
|
||||||
display: inline-block;
|
display: flex;
|
||||||
min-width: 24px;
|
width: 33%;;
|
||||||
}
|
}
|
||||||
|
|
||||||
mat-toolbar a {
|
mat-toolbar span:nth-child(1) {
|
||||||
padding: 1em 0;
|
justify-content: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
mat-toolbar span:nth-child(1) > a {
|
mat-toolbar span:nth-child(2) {
|
||||||
padding-left: 0;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
mat-toolbar span:nth-child(3) > a {
|
mat-toolbar span:nth-child(3) {
|
||||||
padding-right: 0;
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
mat-toolbar a.mat-button {
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
mat-toolbar a.mat-button .mat-icon {
|
||||||
|
vertical-align: text-top;
|
||||||
}
|
}
|
||||||
|
|
||||||
mat-toolbar mat-icon {
|
mat-toolbar mat-icon {
|
||||||
|
|
Loading…
Reference in a new issue