fix
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
// angular
|
||||
import { Component } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
// libs
|
||||
import Swal from 'sweetalert2';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
|
||||
// app
|
||||
import { AccountCategoryService } from '../../services/account.category.service';
|
||||
import { ApiRoutes } from '../../api-routes';
|
||||
import { AccountCategoryModel } from '../../model/account.category.model';
|
||||
import { SettingsAccountAddComponent } from '../settings/account/add.account.component';
|
||||
import { SettingsAccountEditComponent } from '../settings/account/edit.account.component';
|
||||
import { AccountModel } from '../../model/account.model';
|
||||
import { AccountDetailedModel } from '../../model/account.detailed.model';
|
||||
import { AccountMotionModel } from '../../model/account.motion';
|
||||
|
||||
@Component({
|
||||
templateUrl: './account.component.html',
|
||||
styleUrls: ['./account.component.scss'],
|
||||
})
|
||||
export class AccountComponent {
|
||||
public accounts?: AccountDetailedModel[];
|
||||
public motions?: AccountMotionModel[];
|
||||
public newMotion: AccountMotionModel;
|
||||
|
||||
constructor(
|
||||
private httpClient: HttpClient,
|
||||
private dialogModel: MatDialog,
|
||||
private activatedRoute: ActivatedRoute
|
||||
) {
|
||||
this.newMotion = {
|
||||
date: new Date(),
|
||||
};
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.activatedRoute.params.subscribe(params => {
|
||||
this.httpClient
|
||||
.get<AccountDetailedModel[]>(ApiRoutes.Accounts + "?category=" + params['id'])
|
||||
.subscribe(data => {
|
||||
this.accounts = data;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/*private loadAccounts() {
|
||||
}*/
|
||||
|
||||
/*private loadCategories() {
|
||||
this.accountCategoryService
|
||||
.getCategories()
|
||||
.subscribe(x => {
|
||||
this.accountCategories = x;
|
||||
this.loadAccounts();
|
||||
});
|
||||
}*/
|
||||
|
||||
/*public accountInCategory(category?: AccountCategoryModel) {
|
||||
if (this.accounts) {
|
||||
return this.accounts.filter(acc => (!category && (!acc.categories || acc.categories.length === 0)) || (category && acc.categories && acc.categories.filter(cat => cat.id === category.id).length > 0));
|
||||
}
|
||||
return null;
|
||||
}*/
|
||||
|
||||
/*public add() {
|
||||
this.dialogModel.open(SettingsAccountAddComponent, {
|
||||
width: '640px',
|
||||
disableClose: true,
|
||||
data: this.accounts,
|
||||
}).afterClosed().subscribe(x => {
|
||||
if (x && x.refresh) {
|
||||
this.loadAccounts();
|
||||
}
|
||||
});
|
||||
}*/
|
||||
|
||||
/*public edit(account: AccountModel) {
|
||||
this.dialogModel.open(SettingsAccountEditComponent, {
|
||||
width: '640px',
|
||||
disableClose: true,
|
||||
data: account,
|
||||
}).afterClosed().subscribe(x => {
|
||||
if (x && x.refresh) {
|
||||
this.loadAccounts();
|
||||
}
|
||||
});
|
||||
}*/
|
||||
}
|
||||
Reference in New Issue
Block a user