|
@@ -6,6 +6,7 @@ import * as _ from 'underscore'
|
|
|
import {BankService, DemurrageInfo} from "../bank/bank.service";
|
|
|
import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from "@angular/material/dialog";
|
|
|
import {AppComponent} from "../app.component";
|
|
|
+import {OrgInfo, OrgService} from "../org/org.service";
|
|
|
|
|
|
@Component({
|
|
|
selector: 'person-page',
|
|
@@ -16,14 +17,16 @@ export class PersonPageComponent implements OnInit {
|
|
|
|
|
|
accounts: AccountInfo[] = []
|
|
|
events: AccountEvent[] = []
|
|
|
+ orgs: OrgInfo[] = []
|
|
|
demurrage: DemurrageInfo
|
|
|
|
|
|
- constructor(private app: AppComponent, private personService: PersonService, private accountService: AccountService, private bankService: BankService, private httpClient: HttpClient, private matDialog: MatDialog) {
|
|
|
+ constructor(private app: AppComponent, private orgService: OrgService, private personService: PersonService, private accountService: AccountService, private bankService: BankService, private httpClient: HttpClient, private matDialog: MatDialog) {
|
|
|
app.setTitle("ЛИЧНЫЙ КАБИНЕТ")
|
|
|
}
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
this.personService.getCurrentPerson().subscribe(person => {
|
|
|
+ this.orgService.getOrgsInfo(person.auth.id).subscribe(orgs => this.orgs = orgs);
|
|
|
this.accountService.getAccountsInfo(person.auth.id).subscribe(accounts => {
|
|
|
this.accounts = accounts
|
|
|
let accountIds = accounts.map(e => e.id)
|
|
@@ -57,6 +60,13 @@ export class PersonPageComponent implements OnInit {
|
|
|
return this.accounts.map(a => a.overall).reduce((total, x) => total + x, 0)
|
|
|
}
|
|
|
|
|
|
+ addPrivate() {
|
|
|
+ this.personService.getCurrentPerson().subscribe(person => this.orgService.addPrivateToPerson(person.auth.id).subscribe(res => this.ngOnInit()))
|
|
|
+ }
|
|
|
+
|
|
|
+ joinPrivate() {
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
showDebitDialog(account: AccountInfo) {
|
|
|
this.personService.getCurrentPerson().subscribe(person => {
|