feat: reuse savings datatables in view fixed deposit page (#960)
See: #863, #864
This commit is contained in:
+4
@@ -0,0 +1,4 @@
|
||||
<div>
|
||||
<mifosx-multi-row *ngIf="multiRowDatatableFlag" [dataObject]="savingsDatatable"></mifosx-multi-row>
|
||||
<mifosx-single-row *ngIf="!multiRowDatatableFlag" [dataObject]="savingsDatatable"></mifosx-single-row>
|
||||
</div>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DatatableTabsComponent } from './datatable-tabs.component';
|
||||
|
||||
describe('DatatableTabsComponent', () => {
|
||||
let component: DatatableTabsComponent;
|
||||
let fixture: ComponentFixture<DatatableTabsComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DatatableTabsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DatatableTabsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/** Angular Imports */
|
||||
import { Component } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
/**
|
||||
* Savings Datatable Tabs Component
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-datatable-tabs',
|
||||
templateUrl: './datatable-tabs.component.html',
|
||||
styleUrls: ['./datatable-tabs.component.scss']
|
||||
})
|
||||
export class DatatableTabsComponent {
|
||||
|
||||
/** Savings Datatable */
|
||||
savingsDatatable: any;
|
||||
/** Multi Row Datatable Flag */
|
||||
multiRowDatatableFlag: boolean;
|
||||
|
||||
/**
|
||||
* Fetches Savings and datatables data from `resolve`
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute) {
|
||||
this.route.data.subscribe((data: { savingsDatatable: any }) => {
|
||||
this.savingsDatatable = data.savingsDatatable;
|
||||
this.multiRowDatatableFlag = this.savingsDatatable.columnHeaders[0].columnName === 'id' ? true : false;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<div class="tab-container mat-typography">
|
||||
|
||||
<div fxLayout="row" fxLayoutAlign="start">
|
||||
<div class="m-b-10">
|
||||
<h3>{{datatableName}}</h3>
|
||||
</div>
|
||||
<div class="action-button m-b-5" fxLayoutGap="10px">
|
||||
<span *mifosxHasPermission="'CREATE_' + datatableName">
|
||||
<button mat-raised-button color="primary" (click)="add()">
|
||||
<fa-icon icon="plus"></fa-icon> Add
|
||||
</button>
|
||||
</span>
|
||||
<span *mifosxHasPermission="'DELETE_' + datatableName">
|
||||
<button class="delete-button" mat-raised-button color="warn" (click)="delete()" *ngIf="showDeleteBotton">
|
||||
<fa-icon icon="trash"></fa-icon> Delete All
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table #dataTable mat-table [hidden]="!datatableData[0]" [dataSource]="datatableData" class="mat-elevation-z1 m-b-25">
|
||||
|
||||
<ng-container *ngFor="let datatableColumn of datatableColumns;let i = index" [matColumnDef]="datatableColumn">
|
||||
<th mat-header-cell *matHeaderCellDef> {{datatableColumn}} </th>
|
||||
<td mat-cell *matCellDef="let data"> {{data.row[i]}} </td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="datatableColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: datatableColumns;"></tr>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
.tab-container {
|
||||
padding: 1%;
|
||||
margin: 1%;
|
||||
.action-button{
|
||||
margin-left: auto;
|
||||
}
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MultiRowComponent } from './multi-row.component';
|
||||
|
||||
describe('MultiRowComponent', () => {
|
||||
let component: MultiRowComponent;
|
||||
let fixture: ComponentFixture<MultiRowComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ MultiRowComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(MultiRowComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+184
@@ -0,0 +1,184 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnChanges, OnInit, Input, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { MatTable } from '@angular/material/table';
|
||||
import { MatDialog } from '@angular/material';
|
||||
import { DatePipe } from '@angular/common';
|
||||
|
||||
/** Custom Dialogs */
|
||||
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
|
||||
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
|
||||
|
||||
/** Custom Models */
|
||||
import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base';
|
||||
import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base';
|
||||
import { SelectBase } from 'app/shared/form-dialog/formfield/model/select-base';
|
||||
import { CheckboxBase } from 'app/shared/form-dialog/formfield/model/checkbox-base';
|
||||
import { DatepickerBase } from 'app/shared/form-dialog/formfield/model/datepicker-base';
|
||||
|
||||
/** Custom Services */
|
||||
import { SavingsService } from 'app/savings/savings.service';
|
||||
|
||||
/**
|
||||
* Savings Account Multi Row Data Tables
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-multi-row',
|
||||
templateUrl: './multi-row.component.html',
|
||||
styleUrls: ['./multi-row.component.scss']
|
||||
})
|
||||
export class MultiRowComponent implements OnInit, OnChanges {
|
||||
|
||||
/** Data Object */
|
||||
@Input() dataObject: any;
|
||||
|
||||
/** Data Table Name */
|
||||
datatableName: string;
|
||||
/** Data Table Columns */
|
||||
datatableColumns: string[] = [];
|
||||
/** Data Table Data */
|
||||
datatableData: any;
|
||||
/** Account Id */
|
||||
accountId: string;
|
||||
/** Toggle button visibility */
|
||||
showDeleteBotton: boolean;
|
||||
|
||||
/** Data Table Reference */
|
||||
@ViewChild('dataTable') dataTableRef: MatTable<Element>;
|
||||
|
||||
/**
|
||||
* Fetches savings account Id from parent route params.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {DatePipe} datePipe Date Pipe.
|
||||
* @param {SavingsService} savingsService Savingss Service.
|
||||
* @param {MatDialog} dialog Mat Dialog.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private datePipe: DatePipe,
|
||||
private savingsService: SavingsService,
|
||||
private dialog: MatDialog) {
|
||||
this.accountId = this.route.parent.parent.snapshot.paramMap.get('fixedDepositAccountId');
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates related variables on changes to dataObject.
|
||||
*/
|
||||
ngOnChanges() {
|
||||
this.datatableColumns = this.dataObject.columnHeaders.map((columnHeader: any) => {
|
||||
return columnHeader.columnName;
|
||||
});
|
||||
this.datatableData = this.dataObject.data;
|
||||
this.showDeleteBotton = this.datatableData[0] ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches data table name from route params.
|
||||
* subscription is required due to asynchronicity.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.route.params.subscribe((routeParams: any) => {
|
||||
this.datatableName = routeParams.datatableName;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new row to the given multi row data table.
|
||||
*/
|
||||
add() {
|
||||
let dataTableEntryObject: any = { locale: 'en' };
|
||||
const dateTransformColumns: string[] = [];
|
||||
const columns = this.dataObject.columnHeaders.filter((column: any) => {
|
||||
return ((column.columnName !== 'id') && (column.columnName !== 'savings_account_id'));
|
||||
});
|
||||
const formfields: FormfieldBase[] = columns.map((column: any) => {
|
||||
switch (column.columnDisplayType) {
|
||||
case 'INTEGER':
|
||||
case 'STRING':
|
||||
case 'DECIMAL':
|
||||
case 'TEXT': return new InputBase({
|
||||
controlName: column.columnName,
|
||||
label: column.columnName,
|
||||
value: '',
|
||||
type: (column.columnDisplayType === 'INTEGER' || column.columnDisplayType === 'DECIMAL') ? 'number' : 'text',
|
||||
required: (column.isColumnNullable) ? false : true
|
||||
});
|
||||
case 'BOOLEAN': return new CheckboxBase({
|
||||
controlName: column.columnName,
|
||||
label: column.columnName,
|
||||
value: '',
|
||||
type: 'checkbox',
|
||||
required: (column.isColumnNullable) ? false : true
|
||||
});
|
||||
case 'CODELOOKUP': return new SelectBase({
|
||||
controlName: column.columnName,
|
||||
label: column.columnName,
|
||||
value: '',
|
||||
options: { label: 'value', value: 'id', data: column.columnValues },
|
||||
required: (column.isColumnNullable) ? false : true
|
||||
});
|
||||
case 'DATE': {
|
||||
dateTransformColumns.push(column.columnName);
|
||||
dataTableEntryObject.dateFormat = 'yyyy-MM-dd';
|
||||
return new DatepickerBase({
|
||||
controlName: column.columnName,
|
||||
label: column.columnName,
|
||||
value: '',
|
||||
type: 'date',
|
||||
required: (column.isColumnNullable) ? false : true
|
||||
});
|
||||
}
|
||||
case 'DATETIME': {
|
||||
dateTransformColumns.push(column.columnName);
|
||||
dataTableEntryObject.dateFormat = 'yyyy-MM-dd HH:mm';
|
||||
return new DatepickerBase({
|
||||
controlName: column.columnName,
|
||||
label: column.columnName,
|
||||
value: '',
|
||||
type: 'datetime-local',
|
||||
required: (column.isColumnNullable) ? false : true
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
const data = {
|
||||
title: 'Add ' + this.datatableName,
|
||||
formfields: formfields
|
||||
};
|
||||
const addDialogRef = this.dialog.open(FormDialogComponent, { data });
|
||||
addDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.data) {
|
||||
dateTransformColumns.forEach((column) => {
|
||||
response.data.value[column] = this.datePipe.transform(response.data.value[column], dataTableEntryObject.dateFormat);
|
||||
});
|
||||
dataTableEntryObject = { ...response.data.value, ...dataTableEntryObject };
|
||||
this.savingsService.addSavingsDatatableEntry(this.accountId, this.datatableName, dataTableEntryObject).subscribe(() => {
|
||||
this.savingsService.getSavingsDatatable(this.accountId, this.datatableName).subscribe((dataObject: any) => {
|
||||
this.datatableData = dataObject.data;
|
||||
this.dataTableRef.renderRows();
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows of the given multi row data table.
|
||||
*/
|
||||
delete() {
|
||||
const deleteDataTableDialogRef = this.dialog.open(DeleteDialogComponent, {
|
||||
data: { deleteContext: `the contents of ${this.datatableName}` }
|
||||
});
|
||||
deleteDataTableDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
this.savingsService.deleteDatatableContent(this.accountId, this.datatableName).subscribe(() => {
|
||||
this.savingsService.getSavingsDatatable(this.accountId, this.datatableName).subscribe((dataObject: any) => {
|
||||
this.datatableData = dataObject.data;
|
||||
this.showDeleteBotton = false;
|
||||
this.dataTableRef.renderRows();
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
<div class="tab-container mat-typography">
|
||||
|
||||
<h3>{{datatableName}}</h3>
|
||||
|
||||
<div fxLayout="row" fxLayoutAlign="flex-end">
|
||||
<span *mifosxHasPermission="'CREATE_' + datatableName">
|
||||
<button mat-raised-button color="primary" (click)="add()" *ngIf="!dataObject.data[0]">
|
||||
<fa-icon icon="plus"></fa-icon> Add
|
||||
</button>
|
||||
</span>
|
||||
<span *mifosxHasPermission="'UPDATE_' + datatableName">
|
||||
<button mat-raised-button color="primary" (click)="edit()" *ngIf="dataObject.data[0]">
|
||||
<fa-icon icon="edit"></fa-icon> Edit
|
||||
</button>
|
||||
</span>
|
||||
<span *mifosxHasPermission="'DELETE_' + datatableName" class="delete-button">
|
||||
<button mat-raised-button color="warn" (click)="delete()" *ngIf="dataObject.data[0]">
|
||||
<fa-icon icon="trash"></fa-icon> Delete
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<mat-list role="list" *ngIf="dataObject.data[0]">
|
||||
<mat-list-item role="listitem" *ngFor="let columnHeader of dataObject.columnHeaders;let i = index">
|
||||
{{columnHeader.columnName}} : {{dataObject.data[0].row[i]}}
|
||||
</mat-list-item>
|
||||
</mat-list>
|
||||
|
||||
</div>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
.tab-container {
|
||||
padding: 1%;
|
||||
margin: 1%;
|
||||
.delete-button {
|
||||
margin-left: 1%;
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SingleRowComponent } from './single-row.component';
|
||||
|
||||
describe('SingleRowComponent', () => {
|
||||
let component: SingleRowComponent;
|
||||
let fixture: ComponentFixture<SingleRowComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ SingleRowComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SingleRowComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+207
@@ -0,0 +1,207 @@
|
||||
/** Angular Imports */
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { MatDialog } from '@angular/material';
|
||||
import { DatePipe } from '@angular/common';
|
||||
|
||||
/** Custom Components */
|
||||
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
|
||||
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
|
||||
|
||||
/** Custom Models */
|
||||
import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base';
|
||||
import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base';
|
||||
import { DatepickerBase } from 'app/shared/form-dialog/formfield/model/datepicker-base';
|
||||
import { SelectBase } from 'app/shared/form-dialog/formfield/model/select-base';
|
||||
import { CheckboxBase } from 'app/shared/form-dialog/formfield/model/checkbox-base';
|
||||
|
||||
/** Custom Services */
|
||||
import { SavingsService } from 'app/savings/savings.service';
|
||||
|
||||
|
||||
/**
|
||||
* Savings Account Single Row Data Tables
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-single-row',
|
||||
templateUrl: './single-row.component.html',
|
||||
styleUrls: ['./single-row.component.scss']
|
||||
})
|
||||
export class SingleRowComponent implements OnInit {
|
||||
|
||||
/** Data Object */
|
||||
@Input() dataObject: any;
|
||||
|
||||
/** Data Table Name */
|
||||
datatableName: string;
|
||||
/** Account Id */
|
||||
accountId: string;
|
||||
|
||||
/**
|
||||
* Fetches savings account Id from parent route params.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {DatePipe} datePipe Date Pipe.
|
||||
* @param {SavingsService} savingsService Savingss Service.
|
||||
* @param {MatDialog} dialog Mat Dialog.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private datePipe: DatePipe,
|
||||
private dialog: MatDialog,
|
||||
private savingsService: SavingsService) {
|
||||
this.accountId = this.route.parent.parent.snapshot.paramMap.get('fixedDepositAccountId');
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches data table name from route params.
|
||||
* subscription is required due to asynchronicity.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.route.params.subscribe((routeParams: any) => {
|
||||
this.datatableName = routeParams.datatableName;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of the given single row data table.
|
||||
*/
|
||||
add() {
|
||||
let dataTableEntryObject: any = { locale: 'en' };
|
||||
const dateTransformColumns: string[] = [];
|
||||
const columns = this.dataObject.columnHeaders.filter((column: any) => {
|
||||
return ((column.columnName !== 'id') && (column.columnName !== 'savings_account_id'));
|
||||
});
|
||||
const formfields: FormfieldBase[] = this.getFormfields(columns, dateTransformColumns, dataTableEntryObject);
|
||||
const data = {
|
||||
title: 'Add ' + this.datatableName,
|
||||
formfields: formfields
|
||||
};
|
||||
const addDialogRef = this.dialog.open(FormDialogComponent, { data });
|
||||
addDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.data) {
|
||||
dateTransformColumns.forEach((column) => {
|
||||
response.data.value[column] = this.datePipe.transform(response.data.value[column], dataTableEntryObject.dateFormat);
|
||||
});
|
||||
dataTableEntryObject = { ...response.data.value, ...dataTableEntryObject };
|
||||
this.savingsService.addSavingsDatatableEntry(this.accountId, this.datatableName, dataTableEntryObject).subscribe(() => {
|
||||
this.savingsService.getSavingsDatatable(this.accountId, this.datatableName).subscribe((dataObject: any) => {
|
||||
this.dataObject = dataObject;
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Edits the current instance of single row data table.
|
||||
*/
|
||||
edit() {
|
||||
let dataTableEntryObject: any = { locale: 'en' };
|
||||
const dateTransformColumns: string[] = [];
|
||||
const columns = this.dataObject.columnHeaders.filter((column: any) => {
|
||||
return ((column.columnName !== 'id') && (column.columnName !== 'savings_account_id'));
|
||||
});
|
||||
let formfields: FormfieldBase[] = this.getFormfields(columns, dateTransformColumns, dataTableEntryObject);
|
||||
formfields = formfields.map((formfield: FormfieldBase, index: number) => {
|
||||
formfield.value = (this.dataObject.data[0].row[index + 1]) ? this.dataObject.data[0].row[index + 1] : '';
|
||||
return formfield;
|
||||
});
|
||||
const data = {
|
||||
title: 'Edit ' + this.datatableName,
|
||||
layout: { addButtonText: 'Confirm' },
|
||||
formfields: formfields
|
||||
};
|
||||
const editDialogRef = this.dialog.open(FormDialogComponent, { data });
|
||||
editDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.data) {
|
||||
dateTransformColumns.forEach((column) => {
|
||||
response.data.value[column] = this.datePipe.transform(response.data.value[column], dataTableEntryObject.dateFormat);
|
||||
});
|
||||
dataTableEntryObject = { ...response.data.value, ...dataTableEntryObject };
|
||||
this.savingsService.editSavingsDatatableEntry(this.accountId, this.datatableName, dataTableEntryObject).subscribe(() => {
|
||||
this.savingsService.getSavingsDatatable(this.accountId, this.datatableName).subscribe((dataObject: any) => {
|
||||
this.dataObject = dataObject;
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the current instance of single row data table.
|
||||
*/
|
||||
delete() {
|
||||
const deleteDataTableDialogRef = this.dialog.open(DeleteDialogComponent, {
|
||||
data: { deleteContext: `the contents of ${this.datatableName}` }
|
||||
});
|
||||
deleteDataTableDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
this.savingsService.deleteDatatableContent(this.accountId, this.datatableName)
|
||||
.subscribe(() => {
|
||||
this.savingsService.getSavingsDatatable(this.accountId, this.datatableName).subscribe((dataObject: any) => {
|
||||
this.dataObject = dataObject;
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps API response to data table form fields.
|
||||
* @param {any} columns Data Table Columns.
|
||||
* @param {string[]} dateTransformColumns Columns transformed with date pipe.
|
||||
* @param {any} dataTableEntryObject Additional data table details.
|
||||
*/
|
||||
getFormfields(columns: any, dateTransformColumns: string[], dataTableEntryObject: any) {
|
||||
return columns.map((column: any) => {
|
||||
switch (column.columnDisplayType) {
|
||||
case 'INTEGER':
|
||||
case 'STRING':
|
||||
case 'DECIMAL':
|
||||
case 'TEXT': return new InputBase({
|
||||
controlName: column.columnName,
|
||||
label: column.columnName,
|
||||
value: '',
|
||||
type: (column.columnDisplayType === 'INTEGER' || column.columnDisplayType === 'DECIMAL') ? 'number' : 'text',
|
||||
required: (column.isColumnNullable) ? false : true
|
||||
});
|
||||
case 'BOOLEAN': return new CheckboxBase({
|
||||
controlName: column.columnName,
|
||||
label: column.columnName,
|
||||
value: '',
|
||||
type: 'checkbox',
|
||||
required: (column.isColumnNullable) ? false : true
|
||||
});
|
||||
case 'CODELOOKUP': return new SelectBase({
|
||||
controlName: column.columnName,
|
||||
label: column.columnName,
|
||||
value: '',
|
||||
options: { label: 'value', value: 'id', data: column.columnValues },
|
||||
required: (column.isColumnNullable) ? false : true
|
||||
});
|
||||
case 'DATE': {
|
||||
dateTransformColumns.push(column.columnName);
|
||||
dataTableEntryObject.dateFormat = 'yyyy-MM-dd';
|
||||
return new DatepickerBase({
|
||||
controlName: column.columnName,
|
||||
label: column.columnName,
|
||||
value: '',
|
||||
type: 'date',
|
||||
required: (column.isColumnNullable) ? false : true
|
||||
});
|
||||
}
|
||||
case 'DATETIME': {
|
||||
dateTransformColumns.push(column.columnName);
|
||||
dataTableEntryObject.dateFormat = 'yyyy-MM-dd HH:mm';
|
||||
return new DatepickerBase({
|
||||
controlName: column.columnName,
|
||||
label: column.columnName,
|
||||
value: '',
|
||||
type: 'datetime-local',
|
||||
required: (column.isColumnNullable) ? false : true
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
+7
@@ -191,6 +191,13 @@
|
||||
[active]="standingInstructions.isActive" *ngIf="fixedDepositsAccountData.clientId">
|
||||
Standing Instructions
|
||||
</a>
|
||||
<ng-container *ngFor="let savingsDatatable of savingsDatatables">
|
||||
<a mat-tab-link *mifosxHasPermission="'READ_' + savingsDatatable.registeredTableName"
|
||||
[routerLink]="['./datatables',savingsDatatable.registeredTableName]"
|
||||
routerLinkActive #datatable="routerLinkActive" [active]="datatable.isActive">
|
||||
{{savingsDatatable.registeredTableName}}
|
||||
</a>
|
||||
</ng-container>
|
||||
</nav>
|
||||
|
||||
<router-outlet></router-outlet>
|
||||
|
||||
+4
-1
@@ -15,6 +15,8 @@ export class FixedDepositAccountViewComponent implements OnInit {
|
||||
|
||||
/** Fixed Deposits Account Data */
|
||||
fixedDepositsAccountData: any;
|
||||
/** Savings Data Tables */
|
||||
savingsDatatables: any;
|
||||
/** Button Configurations */
|
||||
buttonConfig: FixedDepositsButtonsConfiguration;
|
||||
|
||||
@@ -23,8 +25,9 @@ export class FixedDepositAccountViewComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
*/
|
||||
constructor(private route: ActivatedRoute) {
|
||||
this.route.data.subscribe((data: { fixedDepositsAccountData: any }) => {
|
||||
this.route.data.subscribe((data: { fixedDepositsAccountData: any, savingsDatatables: any }) => {
|
||||
this.fixedDepositsAccountData = data.fixedDepositsAccountData;
|
||||
this.savingsDatatables = data.savingsDatatables;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -11,9 +11,12 @@ import { InterestRateChartTabComponent } from './fixed-deposit-account-view/inte
|
||||
import { TransactionsTabComponent } from './fixed-deposit-account-view/transactions-tab/transactions-tab.component';
|
||||
import { ChargesTabComponent } from './fixed-deposit-account-view/charges-tab/charges-tab.component';
|
||||
import { StandingInstructionsTabComponent } from './fixed-deposit-account-view/standing-instructions-tab/standing-instructions-tab.component';
|
||||
import { DatatableTabsComponent } from './fixed-deposit-account-view/datatable-tabs/datatable-tabs.component';
|
||||
|
||||
/** Custom Resolvers */
|
||||
import { FixedDepositsAccountViewResolver } from '../fixed-deposits/common-resolvers/fixed-deposit-account-view.resolver';
|
||||
import { SavingsDatatableResolver } from 'app/savings/common-resolvers/savings-datatable.resolver';
|
||||
import { SavingsDatatablesResolver } from 'app/savings/common-resolvers/savings-datatables.resolver';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
@@ -24,7 +27,7 @@ const routes: Routes = [
|
||||
path: ':fixedDepositAccountId',
|
||||
data: { title: extract('Fixed Deposit Account View'), routeParamBreadcrumb: 'fixedDepositAccountId' },
|
||||
resolve: {
|
||||
|
||||
savingsDatatables: SavingsDatatablesResolver
|
||||
},
|
||||
children: [
|
||||
{
|
||||
@@ -53,6 +56,19 @@ const routes: Routes = [
|
||||
path: 'standing-instructions',
|
||||
component: StandingInstructionsTabComponent,
|
||||
data: { title: extract('Fixed Deposit Account Standing Instructions'), breadcrumb: 'Standing Instructions', routeParamBreadcrumb: false }
|
||||
},
|
||||
{
|
||||
path: 'datatables',
|
||||
children: [
|
||||
{
|
||||
path: ':datatableName',
|
||||
component: DatatableTabsComponent,
|
||||
data: { title: extract('View Data Table'), routeParamBreadcrumb: 'datatableName' },
|
||||
resolve: {
|
||||
savingsDatatable: SavingsDatatableResolver
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -66,7 +82,9 @@ const routes: Routes = [
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
providers: [
|
||||
FixedDepositsAccountViewResolver
|
||||
FixedDepositsAccountViewResolver,
|
||||
SavingsDatatableResolver,
|
||||
SavingsDatatablesResolver
|
||||
]
|
||||
})
|
||||
export class FixedDepositsRoutingModule { }
|
||||
|
||||
@@ -14,6 +14,9 @@ import { TransactionsTabComponent } from './fixed-deposit-account-view/transacti
|
||||
import { ChargesTabComponent } from './fixed-deposit-account-view/charges-tab/charges-tab.component';
|
||||
import { StandingInstructionsTabComponent } from './fixed-deposit-account-view/standing-instructions-tab/standing-instructions-tab.component';
|
||||
import { InterestRateChartTabComponent } from './fixed-deposit-account-view/interest-rate-chart-tab/interest-rate-chart-tab.component';
|
||||
import { DatatableTabsComponent } from './fixed-deposit-account-view/datatable-tabs/datatable-tabs.component';
|
||||
import { MultiRowComponent } from './fixed-deposit-account-view/datatable-tabs/multi-row/multi-row.component';
|
||||
import { SingleRowComponent } from './fixed-deposit-account-view/datatable-tabs/single-row/single-row.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
@@ -21,7 +24,10 @@ import { InterestRateChartTabComponent } from './fixed-deposit-account-view/inte
|
||||
TransactionsTabComponent,
|
||||
ChargesTabComponent,
|
||||
StandingInstructionsTabComponent,
|
||||
InterestRateChartTabComponent
|
||||
InterestRateChartTabComponent,
|
||||
DatatableTabsComponent,
|
||||
MultiRowComponent,
|
||||
SingleRowComponent
|
||||
],
|
||||
imports: [
|
||||
SharedModule,
|
||||
|
||||
@@ -24,7 +24,7 @@ export class SavingsDatatableResolver implements Resolve<Object> {
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||
const accountId = route.parent.parent.paramMap.get('savingAccountId');
|
||||
const accountId = route.parent.parent.paramMap.get('savingAccountId') || route.parent.parent.paramMap.get('fixedDepositAccountId');
|
||||
const datatableName = route.paramMap.get('datatableName');
|
||||
return this.savingsService.getSavingsDatatable(accountId, datatableName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user