diff --git a/src/app/accounting/accounting-routing.module.ts b/src/app/accounting/accounting-routing.module.ts index 980396ba5..9085722e1 100644 --- a/src/app/accounting/accounting-routing.module.ts +++ b/src/app/accounting/accounting-routing.module.ts @@ -23,6 +23,7 @@ import { EditGlAccountComponent } from './chart-of-accounts/edit-gl-account/edit import { ClosingEntriesComponent } from './closing-entries/closing-entries.component'; import { CreateClosureComponent } from './closing-entries/create-closure/create-closure.component'; +import { ViewClosureComponent } from './closing-entries/view-closure/view-closure.component'; const routes: Routes = [ Route.withShell([ @@ -142,6 +143,11 @@ const routes: Routes = [ path: 'create', component: CreateClosureComponent, data: { title: extract('Create Accounting Closure'), breadcrumb: 'Create' } + }, + { + path: 'view/:id', + component: ViewClosureComponent, + data: { title: extract('View Accounting Closure'), routeParamBreadcrumb: 'id' } } ] } diff --git a/src/app/accounting/accounting.module.ts b/src/app/accounting/accounting.module.ts index 5a812e1ba..6279c5e93 100644 --- a/src/app/accounting/accounting.module.ts +++ b/src/app/accounting/accounting.module.ts @@ -22,6 +22,7 @@ import { ViewGlAccountComponent } from './chart-of-accounts/view-gl-account/view import { EditGlAccountComponent } from './chart-of-accounts/edit-gl-account/edit-gl-account.component'; import { ClosingEntriesComponent } from './closing-entries/closing-entries.component'; import { CreateClosureComponent } from './closing-entries/create-closure/create-closure.component'; +import { ViewClosureComponent } from './closing-entries/view-closure/view-closure.component'; @NgModule({ imports: [ @@ -48,7 +49,8 @@ import { CreateClosureComponent } from './closing-entries/create-closure/create- ViewGlAccountComponent, EditGlAccountComponent, ClosingEntriesComponent, - CreateClosureComponent + CreateClosureComponent, + ViewClosureComponent ], entryComponents: [ RevertTransactionComponent, diff --git a/src/app/accounting/accounting.service.ts b/src/app/accounting/accounting.service.ts index 0c9eff787..2a9ac90b0 100644 --- a/src/app/accounting/accounting.service.ts +++ b/src/app/accounting/accounting.service.ts @@ -129,4 +129,8 @@ export class AccountingService { return this.http.post('/glclosures', accountingClosure); } + getAccountingClosure(accountingClosureId: number) { + return this.http.get(`/glclosures/${accountingClosureId}`); + } + } diff --git a/src/app/accounting/closing-entries/closing-entries.component.html b/src/app/accounting/closing-entries/closing-entries.component.html index 7d887986e..2b5040553 100644 --- a/src/app/accounting/closing-entries/closing-entries.component.html +++ b/src/app/accounting/closing-entries/closing-entries.component.html @@ -44,7 +44,7 @@ - + diff --git a/src/app/accounting/closing-entries/create-closure/create-closure.component.ts b/src/app/accounting/closing-entries/create-closure/create-closure.component.ts index 3eb78e59a..6b5127707 100644 --- a/src/app/accounting/closing-entries/create-closure/create-closure.component.ts +++ b/src/app/accounting/closing-entries/create-closure/create-closure.component.ts @@ -1,5 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { Router } from '@angular/router'; import { AccountingService } from '../../accounting.service'; @@ -18,7 +19,8 @@ export class CreateClosureComponent implements OnInit { officeData: any; constructor(private formBuilder: FormBuilder, - private accountingService: AccountingService) { } + private accountingService: AccountingService, + private router: Router) { } ngOnInit() { this.createAccountingClosureForm(); @@ -45,8 +47,8 @@ export class CreateClosureComponent implements OnInit { accountingClosure.locale = 'en'; accountingClosure.dateFormat = 'dd MMMM yyyy'; accountingClosure.closingDate = '4 August 2018'; - this.accountingService.createAccountingClosure(accountingClosure).subscribe(response => { - console.log(response); + this.accountingService.createAccountingClosure(accountingClosure).subscribe((response: any) => { + this.router.navigate(['/accounting/closing-entries/view', response.resourceId]); }); } diff --git a/src/app/accounting/closing-entries/view-closure/view-closure.component.html b/src/app/accounting/closing-entries/view-closure/view-closure.component.html new file mode 100644 index 000000000..d8fb23f1b --- /dev/null +++ b/src/app/accounting/closing-entries/view-closure/view-closure.component.html @@ -0,0 +1,77 @@ +
+ +
+ +
+ + + + + +
+ +
+ Office +
+ +
+ {{ accountingClosure.officeName }} +
+ +
+ Closure Date +
+ +
+ {{ accountingClosure.closingDate }} +
+ +
+ Closed By +
+ +
+ {{ accountingClosure.createdByUsername }} +
+ +
+ Updated By +
+ +
+ {{ accountingClosure.lastUpdatedByUsername }} +
+ +
+ Updated On +
+ +
+ {{ accountingClosure.lastUpdatedDate }} +
+ +
+ Closure Creation Date +
+ +
+ {{ accountingClosure.createdDate }} +
+ +
+ Comments +
+ +
+ {{ accountingClosure.comments }} +
+ +
+ +
+ +
+ +
diff --git a/src/app/accounting/closing-entries/view-closure/view-closure.component.scss b/src/app/accounting/closing-entries/view-closure/view-closure.component.scss new file mode 100644 index 000000000..98c6e0c98 --- /dev/null +++ b/src/app/accounting/closing-entries/view-closure/view-closure.component.scss @@ -0,0 +1,14 @@ +.container { + max-width: 37rem; +} + +.content { + div { + margin: 1rem 0; + word-wrap: break-word; + } + + .header { + font-weight: 500; + } +} diff --git a/src/app/accounting/closing-entries/view-closure/view-closure.component.spec.ts b/src/app/accounting/closing-entries/view-closure/view-closure.component.spec.ts new file mode 100644 index 000000000..9bd70a587 --- /dev/null +++ b/src/app/accounting/closing-entries/view-closure/view-closure.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ViewClosureComponent } from './view-closure.component'; + +describe('ViewClosureComponent', () => { + let component: ViewClosureComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ViewClosureComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ViewClosureComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/accounting/closing-entries/view-closure/view-closure.component.ts b/src/app/accounting/closing-entries/view-closure/view-closure.component.ts new file mode 100644 index 000000000..081f1dab4 --- /dev/null +++ b/src/app/accounting/closing-entries/view-closure/view-closure.component.ts @@ -0,0 +1,31 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; + +import { AccountingService } from '../../accounting.service'; + +@Component({ + selector: 'mifosx-view-closure', + templateUrl: './view-closure.component.html', + styleUrls: ['./view-closure.component.scss'] +}) +export class ViewClosureComponent implements OnInit { + + accountingClosureId: number; + accountingClosure: any; + + constructor(private accountingService: AccountingService, + private route: ActivatedRoute) { } + + ngOnInit() { + this.accountingClosureId = Number(this.route.snapshot.paramMap.get('id')); + this.getAccountingClosure(); + } + + getAccountingClosure() { + this.accountingService.getAccountingClosure(this.accountingClosureId) + .subscribe((accountingClosure: any) => { + this.accountingClosure = accountingClosure; + }); + } + +}