diff --git a/src/app/clients/clients-routing.module.ts b/src/app/clients/clients-routing.module.ts index 9e3de6735..5da1a44a3 100644 --- a/src/app/clients/clients-routing.module.ts +++ b/src/app/clients/clients-routing.module.ts @@ -177,6 +177,10 @@ const routes: Routes = [ path: 'savingsaccounts', loadChildren: '../savings/savings.module#SavingsModule' }, + { + path: 'sharesaccounts', + loadChildren: '../shares/shares.module#SharesModule' + }, ] } ] diff --git a/src/app/clients/clients-view/general-tab/general-tab.component.html b/src/app/clients/clients-view/general-tab/general-tab.component.html index 62e427624..a9a7cf91e 100644 --- a/src/app/clients/clients-view/general-tab/general-tab.component.html +++ b/src/app/clients/clients-view/general-tab/general-tab.component.html @@ -318,7 +318,7 @@ - + diff --git a/src/app/shares/common-resolvers/share-account-view.resolver.ts b/src/app/shares/common-resolvers/share-account-view.resolver.ts new file mode 100644 index 000000000..67021b64a --- /dev/null +++ b/src/app/shares/common-resolvers/share-account-view.resolver.ts @@ -0,0 +1,32 @@ +/** Angular Imports */ +import { Injectable } from '@angular/core'; +import { Resolve, ActivatedRouteSnapshot } from '@angular/router'; + +/** rxjs Imports */ +import { Observable } from 'rxjs'; + +/** Custom Services */ +import { SharesService } from '../shares.service'; + +/** + * Shares Account data resolver. + */ +@Injectable() +export class SharesAccountViewResolver implements Resolve { + + /** + * @param {SharesService} SharesService Shares service. + */ + constructor(private sharesService: SharesService) { } + + /** + * Returns the Shares Account data. + * @param {ActivatedRouteSnapshot} route Route Snapshot + * @returns {Observable} + */ + resolve(route: ActivatedRouteSnapshot): Observable { + const shareAccountId = route.paramMap.get('shareAccountId'); + return this.sharesService.getSharesAccountData(shareAccountId); + } + +} diff --git a/src/app/shares/shares-account-view/charges-tab/charges-tab.component.html b/src/app/shares/shares-account-view/charges-tab/charges-tab.component.html new file mode 100644 index 000000000..51aec2e82 --- /dev/null +++ b/src/app/shares/shares-account-view/charges-tab/charges-tab.component.html @@ -0,0 +1,58 @@ +
+ +
+

All Charges

+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name {{ charge.name }} Fee/Penalty {{ charge.penalty === true ? 'Penalty' : 'Fee' }} Payment Due At {{ charge.chargeTimeType.value }} Calculation Type {{charge.chargeCalculationType.value}} Due {{charge.currency.displaySymbol}} {{charge.amount}} Paid {{charge.currency.displaySymbol}} {{charge.amountPaid}} Waived {{charge.currency.displaySymbol}} {{charge.amountWaived}} Outstanding {{charge.currency.displaySymbol}} {{charge.amountOutstanding}}
+ + + + diff --git a/src/app/shares/shares-account-view/charges-tab/charges-tab.component.scss b/src/app/shares/shares-account-view/charges-tab/charges-tab.component.scss new file mode 100644 index 000000000..be9328c80 --- /dev/null +++ b/src/app/shares/shares-account-view/charges-tab/charges-tab.component.scss @@ -0,0 +1,10 @@ +.tab-container { + padding: 1%; + margin: 1%; + h3 { + margin:1% auto; + } + table { + width: 100%; + } +} diff --git a/src/app/shares/shares-account-view/charges-tab/charges-tab.component.spec.ts b/src/app/shares/shares-account-view/charges-tab/charges-tab.component.spec.ts new file mode 100644 index 000000000..1ef118215 --- /dev/null +++ b/src/app/shares/shares-account-view/charges-tab/charges-tab.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ChargesTabComponent } from './charges-tab.component'; + +describe('ChargesTabComponent', () => { + let component: ChargesTabComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ChargesTabComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ChargesTabComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/shares/shares-account-view/charges-tab/charges-tab.component.ts b/src/app/shares/shares-account-view/charges-tab/charges-tab.component.ts new file mode 100644 index 000000000..1201fd6a1 --- /dev/null +++ b/src/app/shares/shares-account-view/charges-tab/charges-tab.component.ts @@ -0,0 +1,50 @@ +/** Angular Imports */ +import { Component, OnInit } from '@angular/core'; +import { MatTableDataSource } from '@angular/material'; +import { ActivatedRoute } from '@angular/router'; + +/** + * Charges Tab Component + */ +@Component({ + selector: 'mifosx-charges-tab', + templateUrl: './charges-tab.component.html', + styleUrls: ['./charges-tab.component.scss'] +}) +export class ChargesTabComponent implements OnInit { + + /** Shares Account Data */ + sharesAccountData: any; + /** Charges Data */ + chargesData: any[]; + /** Data source for charges table. */ + dataSource: MatTableDataSource; + /** Columns to be displayed in charges table. */ + displayedColumns: string[] = [ + 'name', + 'feeOrPenalty', + 'paymentDueAt', + 'calculationType', + 'due', + 'paid', + 'waived', + 'outstanding', + ]; + + /** + * Retrieves shares account aata from `resolve`. + * @param {ActivatedRoute} route Activated Route. + */ + constructor(private route: ActivatedRoute) { + this.route.parent.data.subscribe((data: { sharesAccountData: any }) => { + this.sharesAccountData = data.sharesAccountData; + this.chargesData = this.sharesAccountData.charges; + }); + } + + ngOnInit() { + const activeCharges = this.chargesData ? this.chargesData.filter(charge => charge.isActive) : []; + this.dataSource = new MatTableDataSource(activeCharges); + } + +} diff --git a/src/app/shares/shares-account-view/dividends-tab/dividends-tab.component.html b/src/app/shares/shares-account-view/dividends-tab/dividends-tab.component.html new file mode 100644 index 000000000..aa3d6faa2 --- /dev/null +++ b/src/app/shares/shares-account-view/dividends-tab/dividends-tab.component.html @@ -0,0 +1,38 @@ +
+ +
+

All Dividends

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Transaction Date {{dividend.postedDate | date}} Amount {{shareAccountData.currency.displaySymbol}} {{dividend.amount}} Transaction Reference {{dividend.savingsTransactionId}} status {{dividend.status.value}}
+ +
+ +
diff --git a/src/app/shares/shares-account-view/dividends-tab/dividends-tab.component.scss b/src/app/shares/shares-account-view/dividends-tab/dividends-tab.component.scss new file mode 100644 index 000000000..be9328c80 --- /dev/null +++ b/src/app/shares/shares-account-view/dividends-tab/dividends-tab.component.scss @@ -0,0 +1,10 @@ +.tab-container { + padding: 1%; + margin: 1%; + h3 { + margin:1% auto; + } + table { + width: 100%; + } +} diff --git a/src/app/shares/shares-account-view/dividends-tab/dividends-tab.component.spec.ts b/src/app/shares/shares-account-view/dividends-tab/dividends-tab.component.spec.ts new file mode 100644 index 000000000..0d82e4718 --- /dev/null +++ b/src/app/shares/shares-account-view/dividends-tab/dividends-tab.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { DividendsTabComponent } from './dividends-tab.component'; + +describe('DividendsTabComponent', () => { + let component: DividendsTabComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ DividendsTabComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(DividendsTabComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/shares/shares-account-view/dividends-tab/dividends-tab.component.ts b/src/app/shares/shares-account-view/dividends-tab/dividends-tab.component.ts new file mode 100644 index 000000000..bea385a72 --- /dev/null +++ b/src/app/shares/shares-account-view/dividends-tab/dividends-tab.component.ts @@ -0,0 +1,45 @@ +/** Angular Imports */ +import { Component, OnInit } from '@angular/core'; +import { MatTableDataSource } from '@angular/material'; +import { ActivatedRoute } from '@angular/router'; + +/** + * Dividends Tab Component. + */ +@Component({ + selector: 'mifosx-dividends-tab', + templateUrl: './dividends-tab.component.html', + styleUrls: ['./dividends-tab.component.scss'] +}) +export class DividendsTabComponent implements OnInit { + + /** Shares Account Data */ + shareAccountData: any; + /** Dividends Data */ + dividendsData: any; + /** Data source for dividends table. */ + dataSource: MatTableDataSource; + /** Columns to be displayed in dividends table. */ + displayedColumns: string[] = [ + 'transactionDate', + 'amount', + 'transactionReference', + 'status' + ]; + + /** + * Retrieves shares account data from `resolve`. + * @param {ActivatedRoute} route Activated Route. + */ + constructor(private route: ActivatedRoute) { + this.route.parent.data.subscribe((data: { sharesAccountData: any }) => { + this.shareAccountData = data.sharesAccountData; + this.dividendsData = this.shareAccountData.dividends; + }); + } + + ngOnInit() { + this.dataSource = new MatTableDataSource(this.dividendsData); + } + +} diff --git a/src/app/shares/shares-account-view/shares-account-view.component-theme.scss b/src/app/shares/shares-account-view/shares-account-view.component-theme.scss new file mode 100644 index 000000000..9d6eb1052 --- /dev/null +++ b/src/app/shares/shares-account-view/shares-account-view.component-theme.scss @@ -0,0 +1,16 @@ +@import "~@angular/material/theming"; + +@mixin shares-account-view-component-theme($theme) { + $primary: map-get($theme, primary); + mifosx-shares-account-view { + .shares-account-card { + .header { + background-color: mat-color($primary, 500); + } + .table-headers { + background-color: mat-color($primary, 500); + color: mat-contrast($primary, 500); + } + } + } +} diff --git a/src/app/shares/shares-account-view/shares-account-view.component.html b/src/app/shares/shares-account-view/shares-account-view.component.html new file mode 100644 index 000000000..63652e1f0 --- /dev/null +++ b/src/app/shares/shares-account-view/shares-account-view.component.html @@ -0,0 +1,119 @@ + diff --git a/src/app/shares/shares-account-view/shares-account-view.component.scss b/src/app/shares/shares-account-view/shares-account-view.component.scss new file mode 100644 index 000000000..6f6c669de --- /dev/null +++ b/src/app/shares/shares-account-view/shares-account-view.component.scss @@ -0,0 +1,53 @@ +.shares-account-card { + margin: 0 auto; + max-width: 80rem; + width: 90%; + padding: 0; + .header { + padding: 1%; + .header-title-group { + .account-card-title { + color: white; + width: 90%; + p { + color: white; + } + } + } + .profile-image-container { + margin: 1%; + .profile-image { + object-fit: cover; + border-radius: 20px; + } + } + .account-actions { + align-self: flex-end; + margin: 0 1%; + i { + margin-bottom: 2px; + margin-right: 4px; + } + } + } + .navigation-tabs { + background-color: #f2f2f2; + overflow: auto; + } + .content { + .shares-account-tables { + padding: 1%; + margin: 1%; + .table-headers { + margin: 0; + padding: 6px; + } + td { + padding: 3px; + } + } + } + i, img:hover { + cursor: pointer; + } +} diff --git a/src/app/shares/shares-account-view/shares-account-view.component.spec.ts b/src/app/shares/shares-account-view/shares-account-view.component.spec.ts new file mode 100644 index 000000000..f65036d2e --- /dev/null +++ b/src/app/shares/shares-account-view/shares-account-view.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SharesAccountViewComponent } from './shares-account-view.component'; + +describe('SharesAccountViewComponent', () => { + let component: SharesAccountViewComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ SharesAccountViewComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SharesAccountViewComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/shares/shares-account-view/shares-account-view.component.ts b/src/app/shares/shares-account-view/shares-account-view.component.ts new file mode 100644 index 000000000..621bab13e --- /dev/null +++ b/src/app/shares/shares-account-view/shares-account-view.component.ts @@ -0,0 +1,69 @@ +/** Angular Imports */ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; + +/** Custom Buttons Configuration */ +import { SharesButtonsConfiguration } from './shares-buttons.config'; + +/** + * Shares Account View + */ +@Component({ + selector: 'mifosx-shares-account-view', + templateUrl: './shares-account-view.component.html', + styleUrls: ['./shares-account-view.component.scss'] +}) +export class SharesAccountViewComponent implements OnInit { + + /** Shares Account Data */ + sharesAccountData: any; + /** Button Configurations */ + buttonConfig: SharesButtonsConfiguration; + + /** + * Fetches shares account data from `resolve` + * @param {ActivatedRoute} route Activated Route + */ + constructor(private route: ActivatedRoute) { + this.route.data.subscribe((data: { sharesAccountData: any }) => { + this.sharesAccountData = data.sharesAccountData; + }); + } + + ngOnInit() { + this.setConditionalButtons(); + } + + /** + * Adds options to button config. conditionaly. + */ + setConditionalButtons() { + const status = this.sharesAccountData.status.value; + this.buttonConfig = new SharesButtonsConfiguration(status); + if (this.sharesAccountData.charges) { + const charges: any[] = this.sharesAccountData.charges; + charges.forEach((charge: any) => { + if (charge.name === 'Annual fee - INR') { + this.buttonConfig.addOption({ + name: 'Apply Anuual Fees', + taskPermissionName: 'APPLYANNUALFEE_SAVINGSACCOUNT' + }); + } + }); + } + if (status === 'Active') { + const purchasedShares: any[] = this.sharesAccountData.purchasedShares; + let sharesPendingForApproval = false; + purchasedShares.forEach((share: any) => { + if (share.status.code === 'purchasedSharesStatusType.applied' && share.type.code === 'purchasedSharesType.purchased') { + sharesPendingForApproval = true; + } + }); + if (!sharesPendingForApproval) { + this.buttonConfig.removeButton('Approve Additional Shares'); + this.buttonConfig.removeButton('Reject Additional Shares'); + } + } + } + +} diff --git a/src/app/shares/shares-account-view/shares-buttons.config.ts b/src/app/shares/shares-account-view/shares-buttons.config.ts new file mode 100644 index 000000000..a20faa70f --- /dev/null +++ b/src/app/shares/shares-account-view/shares-buttons.config.ts @@ -0,0 +1,127 @@ +/** Shares Account Buttons Configuration */ +export class SharesButtonsConfiguration { + + optionArray: { + name: string, + taskPermissionName: string, + action?: Function + }[]; + + buttonsArray: { + name: string, + icon: string, + taskPermissionName: string, + action?: Function + }[]; + + constructor(status: string) { + this.setOptions(status); + this.setButtons(status); + } + + get singleButtons() { + return this.buttonsArray; + } + + get options() { + return this.optionArray; + } + + setButtons(status: string) { + switch (status) { + case 'Active': + this.buttonsArray = [ + { + name: 'Apply Additional Shares', + icon: 'fa fa-arrow-right', + taskPermissionName: 'APPLYADDITIONAL_SHAREACCOUNT' + }, + { + name: 'Approve Additional Shares', + icon: 'fa fa-arrow-right', + taskPermissionName: 'APPROVEADDITIONAL_SHAREACCOUNT' + }, + { + name: 'Reject Additional Shares', + icon: 'fa fa-arrow-right', + taskPermissionName: 'REJECTADDITIONAL_SHAREACCOUNT' + }, + { + name: 'Redeem Shares', + icon: 'fa fa-arrow-left', + taskPermissionName: 'WITHDRAW_SAVINGSACCOUNT' + } + ]; + break; + case 'Submitted and pending approval': + this.buttonsArray = [ + { + name: 'Modify Application', + icon: 'fa fa-pencil ', + taskPermissionName: 'UPDATE_SHAREACCOUNT' + }, + { + name: 'Approve', + icon: 'fa fa-check', + taskPermissionName: 'APPROVE_SHAREACCOUNT' + } + ]; + break; + case 'Approved': + this.buttonsArray = [ + { + name: 'Undo Approval', + icon: 'fa fa-undo', + taskPermissionName: 'APPROVALUNDO_SHAREACCOUNT' + }, + { + name: 'Activate', + icon: 'fa fa-check', + taskPermissionName: 'ACTIVATE_SHAREACCOUNT' + } + ]; + break; + default: + this.buttonsArray = []; + } + } + + setOptions(status: string) { + switch (status) { + case 'Active': + this.optionArray = [ + { + name: 'Close', + taskPermissionName: 'CLOSE_SHAREACCOUNT' + } + ]; + break; + case 'Submitted and pending approval': + this.optionArray = [ + { + name: 'Reject', + taskPermissionName: 'REJECT_SHAREACCOUNT' + }, + { + name: 'Delete', + taskPermissionName: 'DELETE_SHAREACCOUNT' + } + ]; + break; + case 'Approved': + default: + this.optionArray = []; + } + } + + addOption(option: {name: string, taskPermissionName: string}) { + this.optionArray.push(option); + } + + removeButton(name: string) { + const buttonNames = this.buttonsArray.map(entry => entry.name); + const index = buttonNames.indexOf(name); + this.buttonsArray.splice(index, 1); + } + +} diff --git a/src/app/shares/shares-account-view/transactions-tab/transactions-tab.component.html b/src/app/shares/shares-account-view/transactions-tab/transactions-tab.component.html new file mode 100644 index 000000000..c9286d4f6 --- /dev/null +++ b/src/app/shares/shares-account-view/transactions-tab/transactions-tab.component.html @@ -0,0 +1,48 @@ +
+ +
+

All Transactions

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Transaction Date {{transaction.purchasedDate | date}} Transaction Type {{transaction.type.value}} {{transaction.type.value !== "Charge Payment" ? ('(' + transaction.status.value + ')') : ''}} Total Shares {{transaction.numberOfShares}} Purhcased/Redeemed Price {{shareAccountData.currency.displaySymbol}} {{transaction.purchasedPrice}} Charge Amount {{shareAccountData.currency.displaySymbol}} {{transaction.type.value === "Charge Payment" ? transaction.amount : transaction.chargeAmount}} Amount Recieved/Returned {{shareAccountData.currency.displaySymbol}} {{transaction.amount}}
+ +
+ +
diff --git a/src/app/shares/shares-account-view/transactions-tab/transactions-tab.component.scss b/src/app/shares/shares-account-view/transactions-tab/transactions-tab.component.scss new file mode 100644 index 000000000..be9328c80 --- /dev/null +++ b/src/app/shares/shares-account-view/transactions-tab/transactions-tab.component.scss @@ -0,0 +1,10 @@ +.tab-container { + padding: 1%; + margin: 1%; + h3 { + margin:1% auto; + } + table { + width: 100%; + } +} diff --git a/src/app/shares/shares-account-view/transactions-tab/transactions-tab.component.spec.ts b/src/app/shares/shares-account-view/transactions-tab/transactions-tab.component.spec.ts new file mode 100644 index 000000000..a67fc2279 --- /dev/null +++ b/src/app/shares/shares-account-view/transactions-tab/transactions-tab.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TransactionsTabComponent } from './transactions-tab.component'; + +describe('TransactionsTabComponent', () => { + let component: TransactionsTabComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ TransactionsTabComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(TransactionsTabComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/shares/shares-account-view/transactions-tab/transactions-tab.component.ts b/src/app/shares/shares-account-view/transactions-tab/transactions-tab.component.ts new file mode 100644 index 000000000..985a175f6 --- /dev/null +++ b/src/app/shares/shares-account-view/transactions-tab/transactions-tab.component.ts @@ -0,0 +1,47 @@ +/** Angular Imports */ +import { Component, OnInit } from '@angular/core'; +import { MatTableDataSource } from '@angular/material'; +import { ActivatedRoute } from '@angular/router'; + +/** + * Transactions Tab Component. + */ +@Component({ + selector: 'mifosx-transactions-tab', + templateUrl: './transactions-tab.component.html', + styleUrls: ['./transactions-tab.component.scss'] +}) +export class TransactionsTabComponent implements OnInit { + + /** Shares Account Data */ + shareAccountData: any; + /** Transactions Data */ + transactionsData: any; + /** Data source for transactions table. */ + dataSource: MatTableDataSource; + /** Columns to be displayed in transactions table. */ + displayedColumns: string[] = [ + 'transactionDate', + 'transactionType', + 'totalShares', + 'purchasedOrRedeemedPrice', + 'chargeAmount', + 'amountRecievedOrReturned' + ]; + + /** + * Retrieves shares account data from `resolve`. + * @param {ActivatedRoute} route Activated Route. + */ + constructor(private route: ActivatedRoute) { + this.route.parent.data.subscribe((data: { sharesAccountData: any }) => { + this.shareAccountData = data.sharesAccountData; + this.transactionsData = this.shareAccountData.purchasedShares; + }); + } + + ngOnInit() { + this.dataSource = new MatTableDataSource(this.transactionsData); + } + +} diff --git a/src/app/shares/shares-routing.module.ts b/src/app/shares/shares-routing.module.ts new file mode 100644 index 000000000..69c9605b2 --- /dev/null +++ b/src/app/shares/shares-routing.module.ts @@ -0,0 +1,58 @@ +/** Angular Imports */ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +/** Translation Imports */ +import { extract } from '../core/i18n/i18n.service'; + +/** Custom Components */ +import { SharesAccountViewComponent } from './shares-account-view/shares-account-view.component'; +import { TransactionsTabComponent } from './shares-account-view/transactions-tab/transactions-tab.component'; +import { ChargesTabComponent } from './shares-account-view/charges-tab/charges-tab.component'; +import { DividendsTabComponent } from './shares-account-view/dividends-tab/dividends-tab.component'; + +/** Custom Resolvers */ +import { SharesAccountViewResolver } from './common-resolvers/share-account-view.resolver'; + +const routes: Routes = [ + { + path: '', + data: { title: extract('Shares'), breadcrumb: 'Shares', routeParamBreadcrumb: false }, + children: [ + { + path: ':shareAccountId', + data: { title: extract('Shares Account View'), routeParamBreadcrumb: 'shareAccountId' }, + component: SharesAccountViewComponent, + resolve: { + sharesAccountData: SharesAccountViewResolver + }, + children: [ + { + path: 'transactions', + component: TransactionsTabComponent, + data: { title: extract('Shares Account Transactions'), breadcrumb: 'Transactions', routeParamBreadcrumb: false } + }, + { + path: 'charges', + component: ChargesTabComponent, + data: { title: extract('Shares Account Charges'), breadcrumb: 'Charges', routeParamBreadcrumb: false } + }, + { + path: 'dividends', + component: DividendsTabComponent, + data: { title: extract('Shares Account Dividends'), breadcrumb: 'Dividends', routeParamBreadcrumb: false } + } + ] + } + ] + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], + providers: [ + SharesAccountViewResolver + ] +}) +export class SharesRoutingModule { } diff --git a/src/app/shares/shares.module.ts b/src/app/shares/shares.module.ts new file mode 100644 index 000000000..e8839b245 --- /dev/null +++ b/src/app/shares/shares.module.ts @@ -0,0 +1,35 @@ +/** Angular Imports */ +import { NgModule } from '@angular/core'; +import { DatePipe } from '@angular/common'; + +/** Custom Modules */ +import { SharesRoutingModule } from './shares-routing.module'; +import { SharedModule } from 'app/shared/shared.module'; +import { PipesModule } from '../pipes/pipes.module'; +import { DirectivesModule } from '../directives/directives.module'; +import { SharesAccountViewComponent } from './shares-account-view/shares-account-view.component'; +import { TransactionsTabComponent } from './shares-account-view/transactions-tab/transactions-tab.component'; +import { DividendsTabComponent } from './shares-account-view/dividends-tab/dividends-tab.component'; +import { ChargesTabComponent } from './shares-account-view/charges-tab/charges-tab.component'; + +/** + * Shares Module + * + * All components related to Shares functions should be declared here. + */ +@NgModule({ + imports: [ + SharedModule, + PipesModule, + DirectivesModule, + SharesRoutingModule + ], + declarations: [ + SharesAccountViewComponent, + TransactionsTabComponent, + DividendsTabComponent, + ChargesTabComponent + ], + providers: [DatePipe] +}) +export class SharesModule { } diff --git a/src/app/shares/shares.service.spec.ts b/src/app/shares/shares.service.spec.ts new file mode 100644 index 000000000..ee99018ae --- /dev/null +++ b/src/app/shares/shares.service.spec.ts @@ -0,0 +1,12 @@ +import { TestBed } from '@angular/core/testing'; + +import { SharesService } from './shares.service'; + +describe('SharesService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: SharesService = TestBed.get(SharesService); + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/shares/shares.service.ts b/src/app/shares/shares.service.ts new file mode 100644 index 000000000..1e267e0ab --- /dev/null +++ b/src/app/shares/shares.service.ts @@ -0,0 +1,26 @@ +/** Angular Imports */ +import { Injectable } from '@angular/core'; +import { HttpClient, HttpParams } from '@angular/common/http'; + +/** rxjs Imports */ +import { Observable } from 'rxjs'; + +/** + * Shares Service. + */ +@Injectable({ + providedIn: 'root' +}) +export class SharesService { + + constructor(private http: HttpClient) {} + + /** + * @param accountId Shares Account Id of account to get data for. + * @returns {Observable} Shares data. + */ + getSharesAccountData(accountId: string): Observable { + return this.http.get(`/accounts/share/${accountId}`); + } + +} diff --git a/src/assets/images/shares_account_placeholder.png b/src/assets/images/shares_account_placeholder.png new file mode 100644 index 000000000..66ac30151 Binary files /dev/null and b/src/assets/images/shares_account_placeholder.png differ diff --git a/src/theme/custom/denim-yellowgreen.scss b/src/theme/custom/denim-yellowgreen.scss index 21610548f..c85fd0ed9 100644 --- a/src/theme/custom/denim-yellowgreen.scss +++ b/src/theme/custom/denim-yellowgreen.scss @@ -6,6 +6,7 @@ @import '../../app/home/dashboard/dashboard.component-theme.scss'; @import '../../app/loans/loans-view/loans-view.component-theme.scss'; @import '../../app/savings/savings-account-view/savings-account-view.component-theme.scss'; +@import '../../app/shares/shares-account-view/shares-account-view.component-theme.scss'; // Custom material palette $mat-denim: ( @@ -57,3 +58,4 @@ $mifosx-app-theme: mat-light-theme($mifosx-app-primary, $mifosx-app-accent, $mif @include dashboard-component-theme($mifosx-app-theme); @include loans-view-component-theme($mifosx-app-theme); @include savings-account-view-component-theme($mifosx-app-theme); +@include shares-account-view-component-theme($mifosx-app-theme); diff --git a/src/theme/custom/pictonblue-yellowgreen.scss b/src/theme/custom/pictonblue-yellowgreen.scss index c5cff6de2..1934afb8a 100644 --- a/src/theme/custom/pictonblue-yellowgreen.scss +++ b/src/theme/custom/pictonblue-yellowgreen.scss @@ -6,6 +6,7 @@ @import '../../app/home/dashboard/dashboard.component-theme.scss'; @import '../../app/loans/loans-view/loans-view.component-theme.scss'; @import '../../app/savings/savings-account-view/savings-account-view.component-theme.scss'; +@import '../../app/shares/shares-account-view/shares-account-view.component-theme.scss'; // Custom material palette $mat-picton-blue: ( @@ -57,3 +58,4 @@ $mifosx-app-theme: mat-light-theme($mifosx-app-primary, $mifosx-app-accent, $mif @include dashboard-component-theme($mifosx-app-theme); @include loans-view-component-theme($mifosx-app-theme); @include savings-account-view-component-theme($mifosx-app-theme); +@include shares-account-view-component-theme($mifosx-app-theme);