Remove budgets prefix from paths
This commit is contained in:
parent
ce945b8391
commit
2c4df90d8d
9 changed files with 27 additions and 27 deletions
|
@ -22,13 +22,13 @@ const routes: Routes = [
|
|||
{ path: 'budgets/new', component: NewBudgetComponent },
|
||||
{ path: 'budgets/:id', component: BudgetDetailsComponent },
|
||||
{ path: 'budgets/:id/edit', component: EditBudgetComponent },
|
||||
{ path: 'budgets/:budgetId/transactions', component: TransactionsComponent },
|
||||
{ path: 'budgets/:budgetId/transactions/new', component: NewTransactionComponent },
|
||||
{ path: 'budgets/:budgetId/transactions/:id', component: TransactionDetailsComponent },
|
||||
{ path: 'budgets/:budgetId/categories', component: CategoriesComponent },
|
||||
{ path: 'budgets/:budgetId/categories/new', component: NewCategoryComponent },
|
||||
{ path: 'budgets/:budgetId/categories/:id', component: CategoryDetailsComponent },
|
||||
{ path: 'budgets/:budgetId/categories/:id/edit', component: EditCategoryComponent },
|
||||
{ path: 'transactions', component: TransactionsComponent },
|
||||
{ path: 'transactions/new', component: NewTransactionComponent },
|
||||
{ path: 'transactions/:id', component: TransactionDetailsComponent },
|
||||
{ path: 'categories', component: CategoriesComponent },
|
||||
{ path: 'categories/new', component: NewCategoryComponent },
|
||||
{ path: 'categories/:id', component: CategoryDetailsComponent },
|
||||
{ path: 'categories/:id/edit', component: EditCategoryComponent },
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
|
|
@ -8,14 +8,14 @@
|
|||
<app-category-breakdown [barChartLabels]="barChartLabels" [barChartData]="barChartData">
|
||||
</app-category-breakdown>
|
||||
<div class="transaction-navigation">
|
||||
<a mat-button routerLink="/budgets/{{ budget.id }}/transactions" *ngIf="budget">View Transactions</a>
|
||||
<a mat-button routerLink="/transactions" [queryParams]="{budgetIds: budget.id}" *ngIf="budget">View Transactions</a>
|
||||
</div>
|
||||
</mat-card>
|
||||
<mat-card class="dashboard-categories" [hidden]="!budget">
|
||||
<h3 class="categories">Income</h3>
|
||||
<a mat-button routerLink="/budgets/{{ budget.id }}/categories/new" class="view-all" *ngIf="budget">Add Category</a>
|
||||
<a mat-button routerLink="/categories/new" [queryParams]="{budgetId: budget.id}" class="view-all" *ngIf="budget">Add Category</a>
|
||||
<div class="no-categories" *ngIf="!income || income.length === 0">
|
||||
<a mat-button routerLink="/budgets/{{ budget.id }}/categories/new" *ngIf="budget">
|
||||
<a mat-button routerLink="/categories/new" [queryParams]="{budgetId: budget.id}" *ngIf="budget">
|
||||
<mat-icon>add</mat-icon>
|
||||
<p>Add categories to gain more insights into your income.</p>
|
||||
</a>
|
||||
|
@ -27,9 +27,9 @@
|
|||
</mat-card>
|
||||
<mat-card class="dashboard-categories" [hidden]="!budget">
|
||||
<h3 class="categories">Expenses</h3>
|
||||
<a mat-button routerLink="/budgets/{{ budget.id }}/categories/new" class="view-all" *ngIf="budget">Add Category</a>
|
||||
<a mat-button routerLink="/categories/new" [queryParams]="{budgetIds: budget.id, expense: true}" class="view-all" *ngIf="budget">Add Category</a>
|
||||
<div class="no-categories" *ngIf="!expenses || expenses.length === 0">
|
||||
<a mat-button routerLink="/budgets/{{ budget.id }}/categories/new" *ngIf="budget">
|
||||
<a mat-button routerLink="/categories/new" [queryParams]="{budgetIds: budget.id, expense: true}" *ngIf="budget">
|
||||
<mat-icon>add</mat-icon>
|
||||
<p>Add categories to gain more insights into your expenses.</p>
|
||||
</a>
|
||||
|
@ -40,6 +40,6 @@
|
|||
</div>
|
||||
</mat-card>
|
||||
</div>
|
||||
<a mat-fab routerLink="/budgets/{{ budget.id }}/transactions/new" *ngIf="budget">
|
||||
<a mat-fab routerLink="/transactions/new" [queryParams]="{budgetId: budget.id}" *ngIf="budget">
|
||||
<mat-icon aria-label="Add">add</mat-icon>
|
||||
</a>
|
|
@ -1,5 +1,5 @@
|
|||
<p class="category-description" *ngIf="category && category.description" [innerHtml]="category.description"></p>
|
||||
<app-transaction-list *ngIf="budgetId && category" [budgetId]="budgetId" [categoryId]="category.id"></app-transaction-list>
|
||||
<a mat-fab routerLink="/budgets/{{ budgetId }}/transactions/new">
|
||||
<app-transaction-list *ngIf="budgetId && category" [budgetIds]="[budgetId]" [categoryIds]="[category.id]"></app-transaction-list>
|
||||
<a mat-fab routerLink="/transactions/new" [queryParams]="{budgetId: budgetId}">
|
||||
<mat-icon aria-label="Add">add</mat-icon>
|
||||
</a>
|
|
@ -1,5 +1,5 @@
|
|||
<mat-nav-list class="categories">
|
||||
<a mat-list-item *ngFor="let category of categories" routerLink="/budgets/{{ budgetId }}/categories/{{ category.id }}">
|
||||
<a mat-list-item *ngFor="let category of categories" routerLink="/categories/{{ category.id }}">
|
||||
<p matLine class="category-list-title">
|
||||
<span>
|
||||
{{ category.title }}
|
||||
|
|
|
@ -17,7 +17,7 @@ export class NewTransactionComponent implements OnInit {
|
|||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.budgetId = this.route.snapshot.paramMap.get('budgetId');
|
||||
this.budgetId = this.route.snapshot.queryParamMap.get('budgetId');
|
||||
this.transaction = new Transaction();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<mat-nav-list *ngIf="transactions" class="transactions">
|
||||
<a mat-list-item *ngFor="let transaction of transactions"
|
||||
routerLink="/budgets/{{ budgetId }}/transactions/{{ transaction.id }}">
|
||||
routerLink="/transactions/{{ transaction.id }}">
|
||||
<div matLine class="list-row-one">
|
||||
<p>{{transaction.title}}</p>
|
||||
<p class="amount" [class.expense]="transaction.expense" [class.income]="!transaction.expense">
|
||||
|
|
|
@ -10,8 +10,8 @@ import { ActivatedRoute } from '@angular/router';
|
|||
})
|
||||
export class TransactionListComponent implements OnInit {
|
||||
|
||||
@Input() budgetId: string;
|
||||
@Input() categoryId?: string;
|
||||
@Input() budgetIds: string[];
|
||||
@Input() categoryIds?: string[];
|
||||
public transactions: Transaction[];
|
||||
|
||||
constructor(
|
||||
|
@ -52,7 +52,7 @@ export class TransactionListComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
|
||||
this.twigsService.getTransactions(this.budgetId, this.categoryId, null, from, to).subscribe(transactions => {
|
||||
this.twigsService.getTransactions(this.budgetIds.join(','), this.categoryIds.join(','), null, from, to).subscribe(transactions => {
|
||||
this.transactions = transactions;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<app-transaction-list [budgetId]="budgetId" [categoryId]="categoryId"></app-transaction-list>
|
||||
<a mat-fab routerLink="/budgets/{{ budgetId }}/transactions/new">
|
||||
<app-transaction-list [budgetIds]="budgetId" [categoryIds]="categoryId"></app-transaction-list>
|
||||
<a mat-fab routerLink="/transactions/new" [queryParams]="{budgetId: budgetId}">
|
||||
<mat-icon aria-label="Add">add</mat-icon>
|
||||
</a>
|
|
@ -9,8 +9,8 @@ import { ActivatedRoute } from '@angular/router';
|
|||
})
|
||||
export class TransactionsComponent implements OnInit {
|
||||
|
||||
budgetId: number;
|
||||
categoryId?: number;
|
||||
budgetId?: string;
|
||||
categoryId?: string;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
|
@ -18,8 +18,8 @@ export class TransactionsComponent implements OnInit {
|
|||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.budgetId = Number.parseInt(this.route.snapshot.paramMap.get('budgetId'));
|
||||
this.categoryId = Number.parseInt(this.route.snapshot.queryParamMap.get('categoryId'));
|
||||
this.budgetId = this.route.snapshot.queryParamMap.get('budgetIds');
|
||||
this.categoryId = this.route.snapshot.queryParamMap.get('categoryIds');
|
||||
this.app.setBackEnabled(true);
|
||||
this.app.setTitle('Transactions')
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue