feat(closing-entries): view closure component
Add view closure component to view accounting closure.
This commit is contained in:
@@ -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' }
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -129,4 +129,8 @@ export class AccountingService {
|
||||
return this.http.post('/glclosures', accountingClosure);
|
||||
}
|
||||
|
||||
getAccountingClosure(accountingClosureId: number) {
|
||||
return this.http.get(`/glclosures/${accountingClosureId}`);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;" [routerLink]="['/accounting/closing-entries/view', row.id]"></tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
@@ -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]);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
<div fxLayout="row" fxLayoutAlign="end" fxLayoutGap="2%" fxLayout.lt-md="column" class="container m-b-20">
|
||||
<button mat-raised-button color="warn" (click)="deleteAccountingClosure()">
|
||||
<mat-icon>delete</mat-icon> Delete
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="container" *ngIf="accountingClosure">
|
||||
|
||||
<mat-card>
|
||||
|
||||
<mat-card-content>
|
||||
|
||||
<div fxLayout="row wrap" class="content">
|
||||
|
||||
<div fxFlex="50%" class="header">
|
||||
Office
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ accountingClosure.officeName }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="header">
|
||||
Closure Date
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ accountingClosure.closingDate }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="header">
|
||||
Closed By
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ accountingClosure.createdByUsername }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="header">
|
||||
Updated By
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ accountingClosure.lastUpdatedByUsername }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="header">
|
||||
Updated On
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ accountingClosure.lastUpdatedDate }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="header">
|
||||
Closure Creation Date
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ accountingClosure.createdDate }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="header">
|
||||
Comments
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ accountingClosure.comments }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</mat-card-content>
|
||||
|
||||
</mat-card>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,14 @@
|
||||
.container {
|
||||
max-width: 37rem;
|
||||
}
|
||||
|
||||
.content {
|
||||
div {
|
||||
margin: 1rem 0;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.header {
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
@@ -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<ViewClosureComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewClosureComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ViewClosureComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user