diff --git a/src/app/products/products-routing.module.ts b/src/app/products/products-routing.module.ts index 3ce2315f1..47d504a86 100644 --- a/src/app/products/products-routing.module.ts +++ b/src/app/products/products-routing.module.ts @@ -20,6 +20,7 @@ import { ViewSavingProductComponent } from './saving-products/view-saving-produc import { EditSavingProductComponent } from './saving-products/edit-saving-product/edit-saving-product.component'; import { ShareProductsComponent } from './share-products/share-products.component'; import { CreateShareProductComponent } from './share-products/create-share-product/create-share-product.component'; +import { ViewShareProductComponent } from './share-products/view-share-product/view-share-product.component'; import { ManageTaxConfigurationsComponent } from './manage-tax-configurations/manage-tax-configurations.component'; import { RecurringDepositProductsComponent } from './recurring-deposit-products/recurring-deposit-products.component'; import { ChargesComponent } from './charges/charges.component'; @@ -38,6 +39,7 @@ import { SavingProductResolver } from './saving-products/saving-product.resolver import { SavingProductAndTemplateResolver } from './saving-products/edit-saving-product/saving-product-and-template.resolver'; import { ShareProductsResolver } from './share-products/share-products.resolver'; import { ShareProductsTemplateResolver } from './share-products/share-products-template.resolver'; +import { ShareProductResolver } from './share-products/share-product-resolver'; import { RecurringDepositProductsResolver } from './recurring-deposit-products/recurring-deposit-products.resolver'; import { ChargesResolver } from './charges/charges.resolver'; import { FixedDepositProductsResolver } from './fixed-deposit-products/fixed-deposit-products.resolver'; @@ -157,6 +159,19 @@ const routes: Routes = [ resolve: { shareProductsTemplate: ShareProductsTemplateResolver } + }, + { + path: ':id', + data: { title: extract('View Share Product'), routeParamBreadcrumb: 'id' }, + children: [ + { + path: '', + component: ViewShareProductComponent, + resolve: { + shareProduct: ShareProductResolver + }, + }, + ] } ] }, @@ -234,6 +249,7 @@ const routes: Routes = [ SavingProductAndTemplateResolver, ShareProductsResolver, ShareProductsTemplateResolver, + ShareProductResolver, RecurringDepositProductsResolver, ChargesResolver, FixedDepositProductsResolver, diff --git a/src/app/products/products.module.ts b/src/app/products/products.module.ts index 789fbe5df..fc8fb5310 100644 --- a/src/app/products/products.module.ts +++ b/src/app/products/products.module.ts @@ -47,6 +47,7 @@ import { ShareProductChargesStepComponent } from './share-products/share-product import { ShareProductAccountingStepComponent } from './share-products/share-product-stepper/share-product-accounting-step/share-product-accounting-step.component'; import { ShareProductPreviewStepComponent } from './share-products/share-product-stepper/share-product-preview-step/share-product-preview-step.component'; import { CreateShareProductComponent } from './share-products/create-share-product/create-share-product.component'; +import { ViewShareProductComponent } from './share-products/view-share-product/view-share-product.component'; /** * Products Module @@ -98,7 +99,8 @@ import { CreateShareProductComponent } from './share-products/create-share-produ ShareProductChargesStepComponent, ShareProductAccountingStepComponent, ShareProductPreviewStepComponent, - CreateShareProductComponent + CreateShareProductComponent, + ViewShareProductComponent ], entryComponents: [ ], diff --git a/src/app/products/products.service.ts b/src/app/products/products.service.ts index c26c95a29..0c536645b 100644 --- a/src/app/products/products.service.ts +++ b/src/app/products/products.service.ts @@ -81,6 +81,10 @@ export class ProductsService { return this.http.get('/products/share/template'); } + getShareProduct(shareProductId: string): Observable { + return this.http.get(`/products/share/${shareProductId}`); + } + /** * @returns {Observable} Recurring deposit products data */ diff --git a/src/app/products/share-products/share-product-resolver.ts b/src/app/products/share-products/share-product-resolver.ts new file mode 100644 index 000000000..3628c7f31 --- /dev/null +++ b/src/app/products/share-products/share-product-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 Product data resolver. + */ +@Injectable() +export class ShareProductResolver implements Resolve { + + /** + * @param {ProductsService} productsService Products service. + */ + constructor(private productsService: ProductsService) {} + + /** + * Returns the share product data. + * @returns {Observable} + */ + resolve(route: ActivatedRouteSnapshot): Observable { + const id = route.paramMap.get('id'); + return this.productsService.getShareProduct(id); + } + +} diff --git a/src/app/products/share-products/share-product-stepper/share-product-preview-step/share-product-preview-step.component.html b/src/app/products/share-products/share-product-stepper/share-product-preview-step/share-product-preview-step.component.html index ec8bf95e2..a3d19adaa 100644 --- a/src/app/products/share-products/share-product-stepper/share-product-preview-step/share-product-preview-step.component.html +++ b/src/app/products/share-products/share-product-stepper/share-product-preview-step/share-product-preview-step.component.html @@ -182,10 +182,10 @@ {{ shareProduct.shareSuspenseId | find:shareProductsTemplate.accountingMappingOptions.liabilityAccountOptions:'id':'name' }} -

Expenses

+

Share Equity

- Share Equity: + Equity: {{ shareProduct.shareEquityId | find:shareProductsTemplate.accountingMappingOptions.equityAccountOptions:'id':'name' }}
diff --git a/src/app/products/share-products/share-products.component.html b/src/app/products/share-products/share-products.component.html index 2cf8d7b57..f2d59c210 100644 --- a/src/app/products/share-products/share-products.component.html +++ b/src/app/products/share-products/share-products.component.html @@ -34,7 +34,7 @@ - + diff --git a/src/app/products/share-products/share-products.component.scss b/src/app/products/share-products/share-products.component.scss index 1922e7ffa..24edb63bb 100644 --- a/src/app/products/share-products/share-products.component.scss +++ b/src/app/products/share-products/share-products.component.scss @@ -1,3 +1,7 @@ table { width: 100%; + + .select-row:hover { + cursor: pointer; + } } 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 new file mode 100644 index 000000000..dcf77581f --- /dev/null +++ b/src/app/products/share-products/view-share-product/view-share-product.component.html @@ -0,0 +1,224 @@ +
+ + +
+ +
+ + + + + +
+ +

{{ 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' }} +
+ +
+ +

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 }} +
+ +
+ +
+ +
+ +
+ +
diff --git a/src/app/products/share-products/view-share-product/view-share-product.component.scss b/src/app/products/share-products/view-share-product/view-share-product.component.scss new file mode 100644 index 000000000..a9f4fce2a --- /dev/null +++ b/src/app/products/share-products/view-share-product/view-share-product.component.scss @@ -0,0 +1,24 @@ +table { + width: 100%; +} + +.mat-elevation-z1 { + margin: 1em 0 1.5em 0; +} + +h2, h3, h4 { + margin: 0; + font-weight: 500; +} + +span { + margin: 0.5em 0; +} + +.mat-card .mat-divider-horizontal.mat-divider-inset { + margin: 0 0 0.5em 0; +} + +.margin-t { + margin-top: 1em; +} diff --git a/src/app/products/share-products/view-share-product/view-share-product.component.spec.ts b/src/app/products/share-products/view-share-product/view-share-product.component.spec.ts new file mode 100644 index 000000000..b8c588060 --- /dev/null +++ b/src/app/products/share-products/view-share-product/view-share-product.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ViewShareProductComponent } from './view-share-product.component'; + +describe('ViewShareProductComponent', () => { + let component: ViewShareProductComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ViewShareProductComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ViewShareProductComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/products/share-products/view-share-product/view-share-product.component.ts b/src/app/products/share-products/view-share-product/view-share-product.component.ts new file mode 100644 index 000000000..8d4e49585 --- /dev/null +++ b/src/app/products/share-products/view-share-product/view-share-product.component.ts @@ -0,0 +1,25 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; + +@Component({ + selector: 'mifosx-view-share-product', + templateUrl: './view-share-product.component.html', + styleUrls: ['./view-share-product.component.scss'] +}) +export class ViewShareProductComponent implements OnInit { + + shareProduct: any; + + marketPriceDisplayedColumns: string[] = ['fromDate', 'shareValue']; + chargesDisplayedColumns: string[] = ['name', 'chargeCalculationType', 'amount', 'chargeTimeType']; + + constructor(private route: ActivatedRoute) { + this.route.data.subscribe((data: { shareProduct: any }) => { + this.shareProduct = data.shareProduct; + }); + } + + ngOnInit() { + } + +}