feat: view financial activity mapping component
Add view financial activity mapping component.
This commit is contained in:
@@ -9,6 +9,7 @@ import { CreateJournalEntryComponent } from './create-journal-entry/create-journ
|
||||
import { SearchJournalEntryComponent } from './search-journal-entry/search-journal-entry.component';
|
||||
import { FinancialActivityMappingsComponent } from './financial-activity-mappings/financial-activity-mappings.component';
|
||||
import { CreateFinancialActivityMappingComponent } from './financial-activity-mappings/create-financial-activity-mapping/create-financial-activity-mapping.component';
|
||||
import { ViewFinancialActivityMappingComponent } from './financial-activity-mappings/view-financial-activity-mapping/view-financial-activity-mapping.component';
|
||||
|
||||
const routes: Routes = [
|
||||
Route.withShell([
|
||||
@@ -58,6 +59,11 @@ const routes: Routes = [
|
||||
path: 'create',
|
||||
component: CreateFinancialActivityMappingComponent,
|
||||
data: { title: extract('Create Financial Activity Mapping'), breadcrumb: 'Create' },
|
||||
},
|
||||
{
|
||||
path: 'view/:id',
|
||||
component: ViewFinancialActivityMappingComponent,
|
||||
data: {title: extract('View Financial Activity Mapping'), routeParamBreadcrumb: 'id' }
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import { CreateJournalEntryComponent } from './create-journal-entry/create-journ
|
||||
import { SearchJournalEntryComponent } from './search-journal-entry/search-journal-entry.component';
|
||||
import { FinancialActivityMappingsComponent } from './financial-activity-mappings/financial-activity-mappings.component';
|
||||
import { CreateFinancialActivityMappingComponent } from './financial-activity-mappings/create-financial-activity-mapping/create-financial-activity-mapping.component';
|
||||
import { ViewFinancialActivityMappingComponent } from './financial-activity-mappings/view-financial-activity-mapping/view-financial-activity-mapping.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -31,7 +32,8 @@ import { CreateFinancialActivityMappingComponent } from './financial-activity-ma
|
||||
CreateJournalEntryComponent,
|
||||
SearchJournalEntryComponent,
|
||||
FinancialActivityMappingsComponent,
|
||||
CreateFinancialActivityMappingComponent
|
||||
CreateFinancialActivityMappingComponent,
|
||||
ViewFinancialActivityMappingComponent
|
||||
],
|
||||
entryComponents: [
|
||||
RevertTransactionComponent,
|
||||
|
||||
@@ -83,4 +83,8 @@ export class AccountingService {
|
||||
return this.http.post('/financialactivityaccounts', financialActivityAccount);
|
||||
}
|
||||
|
||||
getFinancialActivityAccount(financialActivityAccountId: number) {
|
||||
return this.http.get(`/financialactivityaccounts/${financialActivityAccountId}`);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
.container {
|
||||
width: 37rem;
|
||||
max-width: 37rem;
|
||||
}
|
||||
|
||||
+5
-3
@@ -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';
|
||||
|
||||
@@ -16,7 +17,8 @@ export class CreateFinancialActivityMappingComponent implements OnInit {
|
||||
financialActivityData: any;
|
||||
|
||||
constructor(private formBuider: FormBuilder,
|
||||
private accountingService: AccountingService) { }
|
||||
private accountingService: AccountingService,
|
||||
private router: Router) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.createFinancialActivityMappingForm();
|
||||
@@ -57,8 +59,8 @@ export class CreateFinancialActivityMappingComponent implements OnInit {
|
||||
|
||||
submit() {
|
||||
this.accountingService.createFinancialActivityAccount(this.financialActivityMappingForm.value)
|
||||
.subscribe(response => {
|
||||
console.log(response);
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['/accounting/financial-activity-mappings/view', response.resourceId]);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -24,7 +24,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/financial-activity-mappings/view', row.id]"></tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<div fxLayout="row" fxLayoutAlign="end" fxLayoutGap="2%" class="container m-b-20">
|
||||
<button mat-raised-button color="primary">
|
||||
<mat-icon>edit</mat-icon> Edit
|
||||
</button>
|
||||
<button mat-raised-button color="warn">
|
||||
<mat-icon>delete</mat-icon> Delete
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
|
||||
<mat-card>
|
||||
|
||||
<mat-card-content>
|
||||
|
||||
<div fxLayout="row wrap" class="content">
|
||||
|
||||
<div fxFlex="50%" class="header">
|
||||
Financial Activity
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ financialActivityAccountData?.financialActivityData.name }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="header">
|
||||
Account Name
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ financialActivityAccountData?.glAccountData.name }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</mat-card-content>
|
||||
|
||||
</mat-card>
|
||||
|
||||
</div>
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
.container {
|
||||
max-width: 37rem;
|
||||
}
|
||||
|
||||
.content {
|
||||
div {
|
||||
margin: 1rem 0;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.header {
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ViewFinancialActivityMappingComponent } from './view-financial-activity-mapping.component';
|
||||
|
||||
describe('ViewFinancialActivityMappingComponent', () => {
|
||||
let component: ViewFinancialActivityMappingComponent;
|
||||
let fixture: ComponentFixture<ViewFinancialActivityMappingComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewFinancialActivityMappingComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ViewFinancialActivityMappingComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { AccountingService } from '../../accounting.service';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-view-financial-activity-mapping',
|
||||
templateUrl: './view-financial-activity-mapping.component.html',
|
||||
styleUrls: ['./view-financial-activity-mapping.component.scss']
|
||||
})
|
||||
export class ViewFinancialActivityMappingComponent implements OnInit {
|
||||
|
||||
financialActivityAccountId: any;
|
||||
financialActivityAccountData: any;
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private accountingService: AccountingService) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.financialActivityAccountId = this.route.snapshot.paramMap.get('id');
|
||||
this.getFinancialActivityAccount();
|
||||
}
|
||||
|
||||
getFinancialActivityAccount() {
|
||||
this.accountingService.getFinancialActivityAccount(this.financialActivityAccountId)
|
||||
.subscribe((financialActivityAccountData: any) => {
|
||||
this.financialActivityAccountData = financialActivityAccountData;
|
||||
console.log(financialActivityAccountData);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user