diff --git a/angular.json b/angular.json
index 3fd3ac7..565b3bc 100644
--- a/angular.json
+++ b/angular.json
@@ -38,8 +38,7 @@
"node_modules/datatables.net/js/jquery.dataTables.js",
"node_modules/bootstrap/dist/js/bootstrap.js",
"node_modules/block-syncer/dist/worker_ondemand.js"
- ],
- "webWorkerTsConfig": "tsconfig.worker.json"
+ ]
},
"configurations": {
"production": {
@@ -139,4 +138,4 @@
}
},
"defaultProject": "cic-staff-client"
-}
\ No newline at end of file
+}
diff --git a/package-lock.json b/package-lock.json
index 6fdbffb..2dfbf62 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1647,19 +1647,19 @@
}
},
"@ethereumjs/common": {
- "version": "2.0.0-beta.2",
- "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.0.0-beta.2.tgz",
- "integrity": "sha512-DdzcV2iTKsfhFihR2boXEdTDqufpbHonPqp7fORsKTv9FRo5dkM8V9SF03RphSsZzYWg+KXd+eX1hYcpUjherw==",
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.0.0.tgz",
+ "integrity": "sha512-yL0zA7Xwgz8IFHKW0VoXGjdZDVxUJg8BQ/muMHvYPW7zHJNNC80gQmvLH+MpvIg1TCXZkFXxrpYRAyCElSm+aw==",
"requires": {
"crc-32": "^1.2.0"
}
},
"@ethereumjs/tx": {
- "version": "3.0.0-beta.2",
- "resolved": "https://registry.npmjs.org/@ethereumjs/tx/-/tx-3.0.0-beta.2.tgz",
- "integrity": "sha512-NZLIVXp/OcwkhP4Z4AC742kjInMPwvixKexlQFjAWoughp+/5JZESRb171mvLQAKI4aqY9bYicadtTwCdsMuZQ==",
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/@ethereumjs/tx/-/tx-3.0.0.tgz",
+ "integrity": "sha512-H9tfy6qgYxPXvt1TSObfVmVjlF43OoQqoPQ3PJsG2JiuqaMHj5ettV1pGFEC3FamENDBkl6vD6niQEvIlXv/VQ==",
"requires": {
- "@ethereumjs/common": "2.0.0-beta.2",
+ "@ethereumjs/common": "^2.0.0",
"ethereumjs-util": "^7.0.7"
},
"dependencies": {
@@ -4376,16 +4376,16 @@
"integrity": "sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg=="
},
"yargs": {
- "version": "16.1.0",
- "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.1.0.tgz",
- "integrity": "sha512-upWFJOmDdHN0syLuESuvXDmrRcWd1QafJolHskzaw79uZa7/x53gxQKiR07W59GWY1tFhhU/Th9DrtSfpS782g==",
+ "version": "16.1.1",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.1.1.tgz",
+ "integrity": "sha512-hAD1RcFP/wfgfxgMVswPE+z3tlPFtxG8/yWUrG2i17sTWGCGqWnxKcLTF4cUKDUK8fzokwsmO9H0TDkRbMHy8w==",
"requires": {
"cliui": "^7.0.2",
"escalade": "^3.1.1",
"get-caller-file": "^2.0.5",
"require-directory": "^2.1.1",
"string-width": "^4.2.0",
- "y18n": "^5.0.2",
+ "y18n": "^5.0.5",
"yargs-parser": "^20.2.2"
}
},
@@ -9877,9 +9877,9 @@
},
"dependencies": {
"debug": {
- "version": "3.2.6",
- "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
- "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
+ "version": "3.2.7",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
+ "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"requires": {
"ms": "^2.1.1"
}
@@ -11111,9 +11111,9 @@
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
},
"pg": {
- "version": "8.5.0",
- "resolved": "https://registry.npmjs.org/pg/-/pg-8.5.0.tgz",
- "integrity": "sha512-h+KHEwce67pAQilZhMCpCx1RC7rR1US7mdjwvKzHRaRxKQxbbFtv5UlwjzqILQ1dwhK+RVGqOVcahE/2KOcaeA==",
+ "version": "8.5.1",
+ "resolved": "https://registry.npmjs.org/pg/-/pg-8.5.1.tgz",
+ "integrity": "sha512-9wm3yX9lCfjvA98ybCyw2pADUivyNWT/yIP4ZcDVpMN0og70BUWYEGXPCTAQdGTAqnytfRADb7NERrY1qxhIqw==",
"requires": {
"buffer-writer": "2.0.0",
"packet-reader": "1.0.0",
diff --git a/package.json b/package.json
index 3098a4c..10e77fd 100644
--- a/package.json
+++ b/package.json
@@ -27,7 +27,7 @@
"bootstrap": "^4.5.3",
"chart.js": "^2.9.4",
"cic-client": "^0.0.3",
- "cic-client-meta": "^0.0.5",
+ "cic-client-meta": "0.0.5",
"datatables.net": "^1.10.22",
"datatables.net-dt": "^1.10.22",
"jquery": "^3.5.1",
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 29bae05..b37ab7d 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -1,5 +1,6 @@
import {Component, HostListener, OnInit} from '@angular/core';
import {BlockSyncService, TransactionService} from './_services';
+import {User} from 'cic-client-meta';
@Component({
selector: 'app-root',
@@ -49,6 +50,6 @@ export class AppComponent implements OnInit {
@HostListener('window:cic_convert', ['$event'])
cicConvert(event: CustomEvent): void {
const conversion = event.detail.tx;
- this.transactionService.setConversion(conversion);
+ this.transactionService.setConversion(conversion, 100);
}
}
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 951435d..aab6a09 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -8,6 +8,7 @@ import {SharedModule} from './shared/shared.module';
import {HttpClientModule} from '@angular/common/http';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import {MatTableModule} from '@angular/material/table';
+import {MockBackendProvider} from './_helpers';
@NgModule({
declarations: [
@@ -22,7 +23,9 @@ import {MatTableModule} from '@angular/material/table';
BrowserAnimationsModule,
MatTableModule
],
- providers: [],
+ providers: [
+ MockBackendProvider
+ ],
bootstrap: [AppComponent]
})
export class AppModule { }
diff --git a/src/app/pages/accounts/account-details/account-details.component.html b/src/app/pages/accounts/account-details/account-details.component.html
index 6bfcf15..10df82b 100644
--- a/src/app/pages/accounts/account-details/account-details.component.html
+++ b/src/app/pages/accounts/account-details/account-details.component.html
@@ -9,25 +9,42 @@
-
+
+
- portrait
{{account?.name}}
-
Balance: {{account?.balance}} RCU
-
Created: {{account?.created}}
-
Address: {{account?.address}}
+
Balance: {{account?.balance}} RCU
+
Created: {{account?.created}}
+
Address: {{account?.address}}
-
-
+
+
+
+ Loading...
+
+
+ Loading...
+
+
+ Loading...
+
+
+
@@ -37,26 +54,8 @@
STATUS
- Unapproved
- Approved
-
-
-
-
-
-
- Payment Cycle Start Date :
-
-
-
-
-
-
- PAYMENT CYCLE
-
- Weekly
- Daily
- Monthly
+ Unapproved
+ Approved
@@ -88,6 +87,17 @@
+
+
+ USER TOKEN:
+
+ RESERVE
+ ERNIE
+ BERT
+
+
+
+
Failed Pin Attempts:
@@ -116,7 +126,7 @@
BUSINESS CATEGORY:
-
+
Food/Water
Fuel/Energy
Education
@@ -126,26 +136,58 @@
Transport
Farming/Labour
Savings Group
- Other
+ Savings Group
-
+
+ User Location:
+
+
-
+
+ LOCATION:
+
+
+
+
+
+ {{village}}
+
+
+
+
+
+
-
+
+ Referred By:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+ Filter
+
+ search
+
+
+
+
+
+ View
+
+
+
+
+
+
+ Sender
+ {{transaction.sender?.vcard.fn}}
+
+
+
+ Sender Location
+ {{account.location}}
+
+
+
+ Recipient
+ {{transaction.recipient?.vcard.fn}}
+
+
+
+ Recipient Location
+ {{account.location}}
+
+
+
+ Token
+
+ {{transaction.token.name}}
+ {{transaction.destinationToken.name}}
+
+
+
+
+ Value
+
+ {{transaction.value | tokenRatio}}
+ {{transaction.toValue | tokenRatio}}
+
+
+
+
+ Created
+ {{transaction.tx.timestamp | date}}
+
+
+
+ TYPE
+
+ {{transaction.type}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Filter
+
+ search
+
+
+
+
+
+ NAME
+ {{user.name}}
+
+
+
+ PHONE NUMBER
+ {{user.phone}}
+
+
+
+ CREATED
+ {{user.created}}
+
+
+
+ BALANCE
+ {{user.balance}}
+
+
+
+ TYPE
+ {{user.type}}
+
+
+
+ STATUS
+
+ {{user.status}}
+ {{user.status}}
+
+
+
+
+ LOCATION
+ {{user.location}}
+
+
+
+ FAILED PIN ATTEMPTS
+ {{user.failedPinAttempts}}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/pages/accounts/account-details/account-details.component.ts b/src/app/pages/accounts/account-details/account-details.component.ts
index dec70e8..3df2a7e 100644
--- a/src/app/pages/accounts/account-details/account-details.component.ts
+++ b/src/app/pages/accounts/account-details/account-details.component.ts
@@ -1,47 +1,85 @@
-import {AfterViewInit, Component, OnInit, ViewChild} from '@angular/core';
+import {Component, OnInit, ViewChild} from '@angular/core';
import {MatTableDataSource} from '@angular/material/table';
-import {Transaction} from '../../../_models';
+import {Transaction, User} from '../../../_models';
import {SelectionModel} from '@angular/cdk/collections';
import {MatPaginator} from '@angular/material/paginator';
import {MatSort} from '@angular/material/sort';
-import {TransactionService, UserService} from '../../../_services';
-import {ActivatedRoute, Params} from '@angular/router';
+import {LocationService, TransactionService, UserService} from '../../../_services';
+import {ActivatedRoute, Params, Router} from '@angular/router';
+import {first} from 'rxjs/operators';
@Component({
selector: 'app-account-details',
templateUrl: './account-details.component.html',
styleUrls: ['./account-details.component.scss']
})
-export class AccountDetailsComponent implements OnInit, AfterViewInit {
- dataSource: MatTableDataSource;
- displayedColumns = ['sender', 'recipient', 'token', 'value', 'view', 'select'];
+export class AccountDetailsComponent implements OnInit {
+ transactionsDataSource: MatTableDataSource;
+ transactionsDisplayedColumns = ['view', 'sender', 'senderLocation', 'recipient', 'recipientLocation', 'token', 'value', 'created', 'type'];
+ @ViewChild('TransactionTablePaginator', {static: true}) transactionTablePaginator: MatPaginator;
+ @ViewChild('TransactionTableSort', {static: true}) transactionTableSort: MatSort;
+
+ userDataSource: MatTableDataSource;
+ userDisplayedColumns = ['name', 'phone', 'created', 'balance', 'type', 'status', 'location', 'failedPinAttempts'];
+ @ViewChild('UserTablePaginator', {static: true}) userTablePaginator: MatPaginator;
+ @ViewChild('UserTableSort', {static: true}) userTableSort: MatSort;
+
+ historyDataSource: MatTableDataSource;
+ historyDisplayedColumns = ['user', 'action', 'staff', 'timestamp'];
+ @ViewChild('HistoryTablePaginator', {static: true}) historyTablePaginator: MatPaginator;
+ @ViewChild('HistoryTableSort', {static: true}) historyTableSort: MatSort;
+
+ account: any;
+ accounts: any[] = [];
+ accountsType = 'all';
initialSelection = [];
allowMultiSelect = true;
selection: SelectionModel;
date: string;
time: number;
isDisbursing = false;
- transaction: Transaction;
- account: any;
-
- @ViewChild(MatPaginator) paginator: MatPaginator;
- @ViewChild(MatSort) sort: MatSort;
+ locations: any;
+ transaction: any;
+ transactions: any[];
+ transactionsType = 'all';
constructor(
+ private locationService: LocationService,
private transactionService: TransactionService,
private userService: UserService,
- private route: ActivatedRoute
+ private route: ActivatedRoute,
+ private router: Router
) {
this.route.paramMap.subscribe((params: Params) => {
- this.account = this.userService.getUserById(params.get('id'));
+ this.userService.getAccountById(params.get('id')).pipe(first()).subscribe(account => {
+ this.account = account;
+ this.userService.getHistoryByUser(this.account?.id).pipe(first()).subscribe(history => {
+ this.historyDataSource = new MatTableDataSource(history);
+ this.historyDataSource.paginator = this.historyTablePaginator;
+ this.historyDataSource.sort = this.historyTableSort;
+ });
+ });
+ });
+ this.userService.getAccounts();
+ this.locationService.getLocations();
+ this.locationService.locationsSubject.subscribe(locations => {
+ this.locations = locations;
});
}
ngOnInit(): void {
+ this.userService.accountsSubject.subscribe(accounts => {
+ this.userDataSource = new MatTableDataSource(accounts);
+ this.userDataSource.paginator = this.userTablePaginator;
+ this.userDataSource.sort = this.userTableSort;
+ this.accounts = accounts;
+ });
+
this.transactionService.transactionsSubject.subscribe(transactions => {
- this.dataSource = new MatTableDataSource(transactions);
- this.dataSource.paginator = this.paginator;
- this.dataSource.sort = this.sort;
+ this.transactionsDataSource = new MatTableDataSource(transactions);
+ this.transactionsDataSource.paginator = this.transactionTablePaginator;
+ this.transactionsDataSource.sort = this.transactionTableSort;
+ this.transactions = transactions;
});
this.selection = new SelectionModel(this.allowMultiSelect, this.initialSelection);
@@ -49,30 +87,60 @@ export class AccountDetailsComponent implements OnInit, AfterViewInit {
this.date = `${d.getDate()}/${d.getMonth()}/${d.getFullYear()}`;
}
- ngAfterViewInit(): void {
- this.dataSource.paginator = this.paginator;
- this.dataSource.sort = this.sort;
- }
-
addTransfer(): void {
this.isDisbursing = !this.isDisbursing;
}
- isAllSelected(): boolean {
- const numSelected = this.selection.selected.length;
- const numRows = this.dataSource.data.length;
- return numSelected === numRows;
+ doTransactionFilter(value: string): void {
+ this.transactionsDataSource.filter = value.trim().toLocaleLowerCase();
}
- masterToggle(): void {
- this.isAllSelected() ? this.selection.clear() : this.dataSource.data.forEach(row => this.selection.select(row));
+ doUserFilter(value: string): void {
+ this.userDataSource.filter = value.trim().toLocaleLowerCase();
}
- doFilter(value: string): void {
- this.dataSource.filter = value.trim().toLocaleLowerCase();
+ doHistoryFilter(value: string): void {
+ this.historyDataSource.filter = value.trim().toLocaleLowerCase();
}
viewTransaction(transaction): void {
this.transaction = transaction;
}
+
+ viewAccount(account): void {
+ (function smoothscroll(): void {
+ const currentScroll = document.documentElement.scrollTop || document.body.scrollTop;
+ if (currentScroll > 0) {
+ window.requestAnimationFrame(smoothscroll);
+ window.scrollTo(0, currentScroll - (currentScroll / 8));
+ }
+ })();
+ window.scrollTo(0, 0);
+ document.body.scrollTop = document.documentElement.scrollTop = 0;
+ this.router.navigateByUrl(`/accounts/${account.id}`);
+ }
+
+ saveInfo(): void {}
+
+ filterAccounts(): void {
+ if (this.accountsType === 'all') {
+ this.userService.accountsSubject.subscribe(accounts => {
+ this.userDataSource.data = accounts;
+ this.accounts = accounts;
+ });
+ } else {
+ this.userDataSource.data = this.accounts.filter(account => account.type === this.accountsType);
+ }
+ }
+
+ filterTransactions(): void {
+ if (this.transactionsType === 'all') {
+ this.transactionService.transactionsSubject.subscribe(transactions => {
+ this.transactionsDataSource.data = transactions;
+ this.transactions = transactions;
+ });
+ } else {
+ this.transactionsDataSource.data = this.transactions.filter(transaction => transaction.type === this.transactionsType);
+ }
+ }
}
diff --git a/src/app/pages/accounts/accounts.component.html b/src/app/pages/accounts/accounts.component.html
index 1599410..255c838 100644
--- a/src/app/pages/accounts/accounts.component.html
+++ b/src/app/pages/accounts/accounts.component.html
@@ -10,7 +10,12 @@
-
+
diff --git a/src/app/pages/accounts/create-account/create-account.component.ts b/src/app/pages/accounts/create-account/create-account.component.ts
index ebca636..a46193c 100644
--- a/src/app/pages/accounts/create-account/create-account.component.ts
+++ b/src/app/pages/accounts/create-account/create-account.component.ts
@@ -1,4 +1,5 @@
import { Component, OnInit } from '@angular/core';
+import {Router} from '@angular/router';
@Component({
selector: 'app-create-account',
@@ -7,9 +8,14 @@ import { Component, OnInit } from '@angular/core';
})
export class CreateAccountComponent implements OnInit {
- constructor() { }
+ constructor(
+ private router: Router
+ ) { }
ngOnInit(): void {
}
+ onSubmit(): void {
+ this.router.navigateByUrl(`/accounts`);
+ }
}
diff --git a/src/app/pages/accounts/disbursement/disbursement.component.html b/src/app/pages/accounts/disbursement/disbursement.component.html
index 0925c91..b059d8a 100644
--- a/src/app/pages/accounts/disbursement/disbursement.component.html
+++ b/src/app/pages/accounts/disbursement/disbursement.component.html
@@ -1,12 +1,15 @@
diff --git a/src/app/pages/admin/admin.component.html b/src/app/pages/admin/admin.component.html
index 173015c..6f6ae09 100644
--- a/src/app/pages/admin/admin.component.html
+++ b/src/app/pages/admin/admin.component.html
@@ -10,6 +10,12 @@