diff --git a/src/app/products/products-routing.module.ts b/src/app/products/products-routing.module.ts index 46852724d..7ae2b9ab7 100644 --- a/src/app/products/products-routing.module.ts +++ b/src/app/products/products-routing.module.ts @@ -40,6 +40,7 @@ import { ViewTaxComponentComponent } from './manage-tax-components/view-tax-comp import { CreateTaxComponentComponent } from './manage-tax-components/create-tax-component/create-tax-component.component'; import { EditTaxComponentComponent } from './manage-tax-components/edit-tax-component/edit-tax-component.component'; import { ViewTaxGroupComponent } from './manage-tax-groups/view-tax-group/view-tax-group.component'; +import { ShareProductsDividendsComponent } from './share-products/dividends-share-product/dividends.components'; /** Custom Resolvers */ import { LoanProductsResolver } from './loan-products/loan-products.resolver'; @@ -70,6 +71,7 @@ import { TaxComponentTemplateResolver } from './manage-tax-components/tax-compon import { EditChargeComponent } from './charges/edit-charge/edit-charge.component'; import { ChargesTemplateResolver } from './charges/charges-template.resolver'; import { TaxGroupResolver } from './manage-tax-groups/tax-group.resolver'; +import { DividendsResolver } from './share-products/dividends-share-product/dividends.resolver'; /** Products Routes */ const routes: Routes = [ @@ -203,6 +205,14 @@ const routes: Routes = [ resolve: { shareProductAndTemplate: ShareProductAndTemplateResolver } + }, + { + path: 'dividends', + data: { title: extract('Share Products Dividends'), breadcrumb: 'Dividends', routeParamBreadcrumb: false}, + component: ShareProductsDividendsComponent, + resolve: { + dividends: DividendsResolver + } } ] } @@ -452,7 +462,8 @@ const routes: Routes = [ FloatingRatesResolver, TaxComponentTemplateResolver, EditTaxComponentComponent, - TaxGroupResolver + TaxGroupResolver, + DividendsResolver ] }) export class ProductsRoutingModule { } diff --git a/src/app/products/products.module.ts b/src/app/products/products.module.ts index e02ffef2b..a01ef1c95 100644 --- a/src/app/products/products.module.ts +++ b/src/app/products/products.module.ts @@ -74,6 +74,7 @@ import { EditChargeComponent } from './charges/edit-charge/edit-charge.component import { MatFormFieldModule, MatSelectModule, MatOptionModule } from '@angular/material'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { ViewTaxGroupComponent } from './manage-tax-groups/view-tax-group/view-tax-group.component'; +import { ShareProductsDividendsComponent } from './share-products/dividends-share-product/dividends.components'; /** * Products Module @@ -151,7 +152,8 @@ import { ViewTaxGroupComponent } from './manage-tax-groups/view-tax-group/view-t CreateTaxComponentComponent, EditTaxComponentComponent, EditChargeComponent, - ViewTaxGroupComponent + ViewTaxGroupComponent, + ShareProductsDividendsComponent ], entryComponents: [ FloatingRatePeriodDialogComponent diff --git a/src/app/products/products.service.ts b/src/app/products/products.service.ts index 1cac6f0e1..e483978df 100644 --- a/src/app/products/products.service.ts +++ b/src/app/products/products.service.ts @@ -90,6 +90,10 @@ export class ProductsService { return this.http.put(`/products/share/${shareProductId}`, shareProduct); } + getDividends(shareProductId: string): Observable { + return this.http.get(`/shareproduct/${shareProductId}/dividend`); + } + /** * @returns {Observable} Recurring deposit products data */ diff --git a/src/app/products/share-products/dividends-share-product/dividends.component.html b/src/app/products/share-products/dividends-share-product/dividends.component.html new file mode 100644 index 000000000..c7316b90a --- /dev/null +++ b/src/app/products/share-products/dividends-share-product/dividends.component.html @@ -0,0 +1,55 @@ +
+ +
+ +
+ +
+ + Filter + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name {{ dividend.productData.name }} Dividend Period Start Date {{ dividend.dividendPeriodStartDate | date }} Dividend Period End Date {{ dividend.dividendPeriodEndDate | date }} Amount {{ dividend.amount }} Status {{ dividend.status.value }}
+ + + +
+ +
diff --git a/src/app/products/share-products/dividends-share-product/dividends.component.scss b/src/app/products/share-products/dividends-share-product/dividends.component.scss new file mode 100644 index 000000000..cf711a1c8 --- /dev/null +++ b/src/app/products/share-products/dividends-share-product/dividends.component.scss @@ -0,0 +1,7 @@ +table { + width: 100%; + + .select-row:hover { + cursor: pointer; + } +} diff --git a/src/app/products/share-products/dividends-share-product/dividends.component.spec.ts b/src/app/products/share-products/dividends-share-product/dividends.component.spec.ts new file mode 100644 index 000000000..1ac1c2264 --- /dev/null +++ b/src/app/products/share-products/dividends-share-product/dividends.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ShareProductsDividendsComponent } from './dividends.components'; + +describe('ShareProductsComponent', () => { + let component: ShareProductsDividendsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ShareProductsDividendsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ShareProductsDividendsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/products/share-products/dividends-share-product/dividends.components.ts b/src/app/products/share-products/dividends-share-product/dividends.components.ts new file mode 100644 index 000000000..d419f0154 --- /dev/null +++ b/src/app/products/share-products/dividends-share-product/dividends.components.ts @@ -0,0 +1,62 @@ + /** Angular Imports */ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { MatPaginator, MatSort, MatTableDataSource } from '@angular/material'; +import { ActivatedRoute } from '@angular/router'; + +/** + * Dividends component. + */ +@Component({ + selector: 'mifosx-dividends-share-product', + templateUrl: './dividends.component.html', + styleUrls: ['./dividends.component.scss'] +}) +export class ShareProductsDividendsComponent implements OnInit { + + /** Dividends data. */ + dividendData: any; + /** Columns to be displayed in dividends table. */ + displayedColumns: string[] = ['name', 'dividendPeriodStartDate', 'dividendPeriodEndDate', 'amount', 'status']; + /** Data source for accounting rules table. */ + dataSource: MatTableDataSource; + + /** Paginator for dividends table. */ + @ViewChild(MatPaginator) paginator: MatPaginator; + /** Sorter for dividends table. */ + @ViewChild(MatSort) sort: MatSort; + + /** + * Retrieves the dividends data from `resolve`. + * @param {ActivatedRoute} route Activated Route. + */ + constructor(private route: ActivatedRoute) { + this.route.data.subscribe((data: {dividends: any}) => { + this.dividendData = data.dividends.pageItems; + }); + } + + /** + * Sets the dividends table. + */ + ngOnInit() { + this.setDividends(); + } + + /** + * Initializes the data source, paginator and sorter for dividends table. + */ + setDividends() { + this.dataSource = new MatTableDataSource(this.dividendData); + this.dataSource.paginator = this.paginator; + this.dataSource.sort = this.sort; + } + + /** + * Filters data in dividends table based on passed value. + * @param {string} filterValue Value to filter data. + */ + applyFilter(filterValue: string) { + this.dataSource.filter = filterValue.trim().toLowerCase(); + } + +} diff --git a/src/app/products/share-products/dividends-share-product/dividends.resolver.ts b/src/app/products/share-products/dividends-share-product/dividends.resolver.ts new file mode 100644 index 000000000..bf85eba6a --- /dev/null +++ b/src/app/products/share-products/dividends-share-product/dividends.resolver.ts @@ -0,0 +1,31 @@ +/** Angular Imports */ +import { Injectable } from '@angular/core'; +import { Resolve, ActivatedRouteSnapshot } from '@angular/router'; + +/** rxjs Imports */ +import { Observable } from 'rxjs'; + +/** Custom Services */ +import { ProductsService } from '../../products.service'; + +/** + * Share products data resolver. + */ +@Injectable() +export class DividendsResolver implements Resolve { + + /** + * @param {ProductsService} productsService Products service. + */ + constructor(private productsService: ProductsService) {} + + /** + * Returns the share products data. + * @returns {Observable} + */ + resolve(route: ActivatedRouteSnapshot): Observable { + const id = route.paramMap.get('id'); + return this.productsService.getDividends(id); + } + +} diff --git a/src/app/products/share-products/view-share-product/view-share-product.component.html b/src/app/products/share-products/view-share-product/view-share-product.component.html index c4f4a7b62..dd18b98fa 100644 --- a/src/app/products/share-products/view-share-product/view-share-product.component.html +++ b/src/app/products/share-products/view-share-product/view-share-product.component.html @@ -3,7 +3,7 @@    Edit - @@ -18,85 +18,85 @@

{{ shareProduct.name }}

- + - +

Details

- + - +
Short Name: {{ shareProduct.shortName }}
- +
Description: {{ shareProduct.description }}
- +

Currency

- + - +
Currency: {{ shareProduct.currency.name }}
- +
Decimal Places: {{ shareProduct.currency.decimalPlaces }}
- +
Currency in multiples of: {{ shareProduct.currency.inMultiplesOf }}
- +

Terms

- + - +
Total Number of Shares: {{ shareProduct.totalShares }}
- +
Shares to be Issued: {{ shareProduct.totalSharesIssued }}
- +
Nominal/Unit Price: {{ shareProduct.unitPrice }}
- +
Capital Value: {{ shareProduct.shareCapital }}
- +

Settings

- + - +
Shares per Client: {{ shareProduct.nominalShares + ' (Min: ' + (shareProduct.minimumShares ? shareProduct.minimumShares : shareProduct.nominalShares) + ', Max: ' + (shareProduct.maximumShares ? shareProduct.maximumShares : shareProduct.nominalShares) + ')' }}
- +
Minimum Active Period: {{ shareProduct.minimumActivePeriod + ' ' + shareProduct.minimumActivePeriodForDividendsTypeEnum.value }}
- +
Lock-in Period: {{ shareProduct.lockinPeriod + ' ' + shareProduct.lockPeriodTypeEnum.value }}
- +
Allow dividends for inactive clients: {{ shareProduct.allowDividendCalculationForInactiveClients ? 'Yes' : 'No' }} @@ -105,117 +105,117 @@

Market Price Periods

- + - + - + - + - + - +
From Date {{ marketPrice.fromDate | date }} Nominal/Unit Price {{ marketPrice.shareValue }}
- -
- + +
+
- +

Charges

- + - + - + - + - + - + - + - +
Name {{ charge.name + ', ' + charge.currency.displaySymbol }} Type {{ charge.chargeCalculationType.value }} Amount {{ charge.amount }} Collected On {{ charge.chargeTimeType.value }}
- +
- +

Accounting

- + - +
Type: {{ shareProduct.accountingRule.value }}
- +
- +

Assets

- +
Share reference: {{ shareProduct.accountingMappings.shareReferenceId.name }}
- +

Liabilities

- +
Share suspense control: {{ shareProduct.accountingMappings.shareSuspenseId.name }}

Share Equity

- +
Equity: {{ shareProduct.accountingMappings.shareEquityId.name }}
- +

Income

- +
Income from fees: {{ shareProduct.accountingMappings.incomeFromFeeAccountId.name }}
- +
- -
+ +