diff --git a/src/app/accounting/accounting-routing.module.ts b/src/app/accounting/accounting-routing.module.ts
index efa8d5f0d..46065b4b5 100644
--- a/src/app/accounting/accounting-routing.module.ts
+++ b/src/app/accounting/accounting-routing.module.ts
@@ -27,6 +27,8 @@ import { ViewClosureComponent } from './closing-entries/view-closure/view-closur
import { EditClosureComponent } from './closing-entries/edit-closure/edit-closure.component';
import { AccountingRulesComponent } from './accounting-rules/accounting-rules.component';
import { CreateRuleComponent } from './accounting-rules/create-rule/create-rule.component';
+import { ViewRuleComponent } from './accounting-rules/view-rule/view-rule.component';
+import { ViewAccountingRuleResolver } from './accounting-rules/view-rule/view-rule.resolver';
const routes: Routes = [
Route.withShell([
@@ -176,6 +178,14 @@ const routes: Routes = [
path: 'create',
component: CreateRuleComponent,
data: { title: extract('Create Accounting Rule'), breadcrumb: 'Create' }
+ },
+ {
+ path: 'view/:id',
+ component: ViewRuleComponent,
+ data: { title: extract('View Accounting Rule'), routeResolveBreadcrumb: ['accountingRule', 'name'] },
+ resolve: {
+ accountingRule: ViewAccountingRuleResolver
+ }
}
]
}
@@ -189,7 +199,8 @@ const routes: Routes = [
exports: [RouterModule],
providers: [
ChartOfAccountsResolver,
- ViewGlAccountResolver
+ ViewGlAccountResolver,
+ ViewAccountingRuleResolver
]
})
export class AccountingRoutingModule { }
diff --git a/src/app/accounting/accounting-rules/create-rule/create-rule.component.ts b/src/app/accounting/accounting-rules/create-rule/create-rule.component.ts
index 66617d138..cee1fb9a9 100644
--- a/src/app/accounting/accounting-rules/create-rule/create-rule.component.ts
+++ b/src/app/accounting/accounting-rules/create-rule/create-rule.component.ts
@@ -1,5 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { FormGroup, FormBuilder, Validators, ValidatorFn, ValidationErrors } from '@angular/forms';
+import { Router } from '@angular/router';
import { AccountingService } from '../../accounting.service';
@@ -25,7 +26,8 @@ export class CreateRuleComponent implements OnInit {
creditTagData: any;
constructor(private formBuilder: FormBuilder,
- private accountingService: AccountingService) { }
+ private accountingService: AccountingService,
+ private router: Router) { }
ngOnInit() {
this.createAccountingRulesForm();
@@ -82,7 +84,7 @@ export class CreateRuleComponent implements OnInit {
delete accountingRule.debitRuleType;
delete accountingRule.creditRuleType;
this.accountingService.createAccountingRule(accountingRule).subscribe((response: any) => {
- console.log(response);
+ this.router.navigate(['/accounting/accounting-rules/view', response.resourceId]);
});
}
diff --git a/src/app/accounting/accounting-rules/view-rule/view-rule.component.html b/src/app/accounting/accounting-rules/view-rule/view-rule.component.html
new file mode 100644
index 000000000..eb1bdfa3a
--- /dev/null
+++ b/src/app/accounting/accounting-rules/view-rule/view-rule.component.html
@@ -0,0 +1,112 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ accountingRule.officeName }}
+
+
+
+
+
+ {{ accountingRule.description }}
+
+
+
+
+
+ {{ accountingRule.allowMultipleDebitEntries }}
+
+
+
+
+
+ {{ accountingRule.allowMultipleCreditEntries }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ debitTag.tag.name }}
+
+
+
+
+
+
+ {{ debitAccount.name + ' (' + debitAccount.glCode + ')' }}
+
+
+
+
+
+
+ {{ creditTag.tag.name }}
+
+
+
+
+
+
+ {{ creditAccount.name + ' (' + creditAccount.glCode + ')' }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/accounting/accounting-rules/view-rule/view-rule.component.scss b/src/app/accounting/accounting-rules/view-rule/view-rule.component.scss
new file mode 100644
index 000000000..e8dff44e8
--- /dev/null
+++ b/src/app/accounting/accounting-rules/view-rule/view-rule.component.scss
@@ -0,0 +1,10 @@
+.content {
+ div {
+ margin: 1rem 0;
+ word-wrap: break-word;
+ }
+
+ .header {
+ font-weight: 500;
+ }
+}
diff --git a/src/app/accounting/accounting-rules/view-rule/view-rule.component.spec.ts b/src/app/accounting/accounting-rules/view-rule/view-rule.component.spec.ts
new file mode 100644
index 000000000..80b237050
--- /dev/null
+++ b/src/app/accounting/accounting-rules/view-rule/view-rule.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { ViewRuleComponent } from './view-rule.component';
+
+describe('ViewRuleComponent', () => {
+ let component: ViewRuleComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ ViewRuleComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(ViewRuleComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/accounting/accounting-rules/view-rule/view-rule.component.ts b/src/app/accounting/accounting-rules/view-rule/view-rule.component.ts
new file mode 100644
index 000000000..6ee4bf069
--- /dev/null
+++ b/src/app/accounting/accounting-rules/view-rule/view-rule.component.ts
@@ -0,0 +1,22 @@
+import { Component, OnInit } from '@angular/core';
+import { ActivatedRoute } from '@angular/router';
+
+@Component({
+ selector: 'mifosx-view-rule',
+ templateUrl: './view-rule.component.html',
+ styleUrls: ['./view-rule.component.scss']
+})
+export class ViewRuleComponent implements OnInit {
+
+ accountingRule: any;
+
+ constructor(private route: ActivatedRoute) {
+ this.route.data.subscribe((data: { accountingRule: any }) => {
+ this.accountingRule = data.accountingRule;
+ });
+ }
+
+ ngOnInit() {
+ }
+
+}
diff --git a/src/app/accounting/accounting-rules/view-rule/view-rule.resolver.ts b/src/app/accounting/accounting-rules/view-rule/view-rule.resolver.ts
new file mode 100644
index 000000000..139ca9771
--- /dev/null
+++ b/src/app/accounting/accounting-rules/view-rule/view-rule.resolver.ts
@@ -0,0 +1,19 @@
+import { Injectable } from '@angular/core';
+import { Resolve, ActivatedRouteSnapshot } from '@angular/router';
+
+import { Observable } from 'rxjs';
+
+import { AccountingService } from '../../accounting.service';
+
+@Injectable()
+export class ViewAccountingRuleResolver implements Resolve