+
-
- Future Installment Allocation Rule
-
-
- {{ installmentAllocation.name | translate }}
-
-
-
+
+ Transaction Type
+
+
+ {{ transactionTypeOption.name | translate }}
+
+
+
-
+
-
+
-
- | Order |
- {{ (rowIndex + 1) }} |
-
+
+ Order |
+ {{ (rowIndex + 1) }} |
+
-
- Transaction Type |
- {{ transactionType.name }} |
-
+
+ Payment Allocation |
+ {{ paymentAllocation.name }} |
+
-
-
-
+
+
+
+
+
+
+ Future Installment Allocation Rule
+
+
+ {{ installmentAllocation.name | translate }}
+
+
+
+
+
+
+
diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-payment-strategy-step/loan-product-payment-strategy-step.component.ts b/src/app/products/loan-products/loan-product-stepper/loan-product-payment-strategy-step/loan-product-payment-strategy-step.component.ts
index e808de3fd..a86d7cf57 100644
--- a/src/app/products/loan-products/loan-product-stepper/loan-product-payment-strategy-step/loan-product-payment-strategy-step.component.ts
+++ b/src/app/products/loan-products/loan-product-stepper/loan-product-payment-strategy-step/loan-product-payment-strategy-step.component.ts
@@ -3,23 +3,7 @@ import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angu
import { UntypedFormControl, Validators } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { MatTable } from '@angular/material/table';
-import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
-
-interface PaymentCode {
- name: string;
- code: string;
-}
-
-interface PaymentAllocationOrder {
- paymentAllocationRule: string;
- order: number;
-}
-
-export interface PaymentAllocation {
- transactionType: string;
- paymentAllocationOrder: PaymentAllocationOrder[];
- futureInstallmentAllocationRule: string;
-}
+import { FutureInstallmentAllocationRules, PaymentAllocation, PaymentAllocationOrder, PaymentAllocationTransactionType, PaymentAllocationTransactionTypes, PaymentAllocationTypes, PaymentCode } from './payment-allocation-model';
@Component({
selector: 'mifosx-loan-product-payment-strategy-step',
@@ -29,112 +13,64 @@ export interface PaymentAllocation {
export class LoanProductPaymentStrategyStepComponent implements OnInit {
@Input() loanProductsTemplate: any;
+ @Input() transactionType: PaymentAllocationTransactionType;
@Output() paymentAllocation = new EventEmitter
();
@Output() paymentAllocationChange = new EventEmitter();
- transactionTypesData: PaymentCode[] = [];
- transactionTypeOptions: PaymentCode[] = [];
+ paymentAllocationsData: PaymentCode[] = [];
installmentAllocationOptions: PaymentCode[] = [];
+ transactionTypeOptions: PaymentCode[] = [];
- transactionType = new UntypedFormControl('');
+ transactionTypeCtrl = new UntypedFormControl('');
futureInstallmentAllocationRule = new UntypedFormControl('', Validators.required);
@ViewChild('table') table: MatTable;
/** Columns to be displayed in the table. */
- displayedColumns: string[] = ['order', 'transactionName'];
+ displayedColumns: string[] = ['order', 'paymentAllocation'];
- constructor(private dialog: MatDialog) { }
+ constructor() { }
ngOnInit(): void {
- this.transactionTypesData = [];
+ this.paymentAllocationsData = [];
this.setOptions();
this.sendPaymentAllocation();
}
setOptions(): void {
- this.transactionTypeOptions = [
- { name: 'Past due penalty', code: 'PAST_DUE_PENALTY' },
- { name: 'Past due fee', code: 'PAST_DUE_FEE' },
- { name: 'Past due principal', code: 'PAST_DUE_PRINCIPAL' },
- { name: 'Past due interest', code: 'PAST_DUE_INTEREST' },
- { name: 'Due penalty', code: 'DUE_PENALTY' },
- { name: 'Due fee', code: 'DUE_FEE' },
- { name: 'Due principal', code: 'DUE_PRINCIPAL' },
- { name: 'Due interest', code: 'DUE_INTEREST' },
- { name: 'In advance penalty', code: 'IN_ADVANCE_PENALTY' },
- { name: 'In advance fee', code: 'IN_ADVANCE_FEE' },
- { name: 'In advance principal', code: 'IN_ADVANCE_PRINCIPAL' },
- { name: 'In advance interest', code: 'IN_ADVANCE_INTEREST' }
- ];
- this.transactionTypesData = this.transactionTypeOptions;
-
- this.installmentAllocationOptions = [
- { name: 'Next Installment', code: 'NEXT_INSTALLMENT' },
- { name: 'Last Installment', code: 'LAST_INSTALLMENT' },
- { name: 'Reamortization', code: 'REAMORTIZATION' }
- ];
-
- this.futureInstallmentAllocationRule.patchValue('NEXT_INSTALLMENT');
- }
-
- addTransactionType(): void {
- this.transactionTypeOptions.forEach((txType: PaymentCode) => {
- if (txType.code === this.transactionType.value) {
- this.transactionTypesData = [
- ...this.transactionTypesData,
- txType
- ];
- this.sendPaymentAllocation();
- this.removePaymentCode(txType);
- this.resetTransactionType();
- }
- });
- }
-
- removePaymentCode(txType: PaymentCode): void {
- this.transactionTypeOptions = this.transactionTypeOptions.filter(({ code }) => code !== txType.code);
- }
-
- resetTransactionType(): void {
- this.transactionType.patchValue('');
- this.transactionType.markAsUntouched();
- }
-
- removeTransactionType(index: number) {
- const transactionTypeName = this.transactionTypesData[index].name;
- const dialogRef = this.dialog.open(DeleteDialogComponent, {
- data: { deleteContext: transactionTypeName }
- });
- dialogRef.afterClosed().subscribe((response: any) => {
- if (response.delete) {
- this.transactionTypesData.splice(index, 1);
- this.transactionTypesData = this.transactionTypesData.concat([]);
- this.transactionTypesData = [...this.transactionTypesData];
- this.sendPaymentAllocation();
- }
- });
+ this.paymentAllocationsData = PaymentAllocationTypes.options;
+ this.transactionTypeOptions = PaymentAllocationTransactionTypes.options;
+ this.transactionTypeCtrl.patchValue(this.transactionTypeOptions[0].code);
+ if (this.transactionType) {
+ this.transactionTypeCtrl.patchValue(this.transactionType.code);
+ }
+ this.installmentAllocationOptions = FutureInstallmentAllocationRules.options;
+ this.futureInstallmentAllocationRule.patchValue(this.installmentAllocationOptions[0].code);
}
dropTable(event: CdkDragDrop) {
- const prevIndex = this.transactionTypesData.findIndex((d: any) => d === event.item.data);
- moveItemInArray(this.transactionTypesData, prevIndex, event.currentIndex);
- this.transactionTypesData = [...this.transactionTypesData];
+ const prevIndex = this.paymentAllocationsData.findIndex((d: any) => d === event.item.data);
+ moveItemInArray(this.paymentAllocationsData, prevIndex, event.currentIndex);
+ this.paymentAllocationsData = [...this.paymentAllocationsData];
this.table.renderRows();
this.sendPaymentAllocation();
this.paymentAllocationChange.emit(true);
}
sendPaymentAllocation(): void {
+ let transactionTypeVal = PaymentAllocationTransactionTypes.DEFAULT_TRANSACTION.code;
+ if (this.transactionType) {
+ transactionTypeVal = this.transactionType.code;
+ }
const paymentAllocationOrder: PaymentAllocationOrder[] = [];
- this.transactionTypesData.forEach((txType: PaymentCode, index: number) => {
+ this.paymentAllocationsData.forEach((txType: PaymentCode, index: number) => {
paymentAllocationOrder.push({ 'paymentAllocationRule': txType.code, order: (index + 1) });
});
const paymentAllocation: PaymentAllocation[] = [];
paymentAllocation.push({
'futureInstallmentAllocationRule': this.futureInstallmentAllocationRule.value,
- 'transactionType': 'DEFAULT',
+ 'transactionType': transactionTypeVal,
'paymentAllocationOrder': paymentAllocationOrder
});
diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-payment-strategy-step/payment-allocation-model.ts b/src/app/products/loan-products/loan-product-stepper/loan-product-payment-strategy-step/payment-allocation-model.ts
new file mode 100644
index 000000000..adbcdc650
--- /dev/null
+++ b/src/app/products/loan-products/loan-product-stepper/loan-product-payment-strategy-step/payment-allocation-model.ts
@@ -0,0 +1,53 @@
+export interface PaymentCode {
+ name: string;
+ code: string;
+}
+
+export interface PaymentAllocationOrder {
+ paymentAllocationRule: string;
+ order: number;
+}
+
+export interface PaymentAllocation {
+ transactionType: string;
+ paymentAllocationOrder: PaymentAllocationOrder[];
+ futureInstallmentAllocationRule: string;
+}
+
+export interface PaymentAllocationTransactionType {
+ name: string;
+ code: string;
+}
+
+export class PaymentAllocationTransactionTypes {
+ public static DEFAULT_TRANSACTION: PaymentAllocationTransactionType = { name: 'Default', code: 'DEFAULT' };
+
+ public static options: PaymentCode[] = [
+ this.DEFAULT_TRANSACTION
+ ];
+}
+
+export class PaymentAllocationTypes {
+ public static options: PaymentCode[] = [
+ { name: 'Past due penalty', code: 'PAST_DUE_PENALTY' },
+ { name: 'Past due fee', code: 'PAST_DUE_FEE' },
+ { name: 'Past due principal', code: 'PAST_DUE_PRINCIPAL' },
+ { name: 'Past due interest', code: 'PAST_DUE_INTEREST' },
+ { name: 'Due penalty', code: 'DUE_PENALTY' },
+ { name: 'Due fee', code: 'DUE_FEE' },
+ { name: 'Due principal', code: 'DUE_PRINCIPAL' },
+ { name: 'Due interest', code: 'DUE_INTEREST' },
+ { name: 'In advance penalty', code: 'IN_ADVANCE_PENALTY' },
+ { name: 'In advance fee', code: 'IN_ADVANCE_FEE' },
+ { name: 'In advance principal', code: 'IN_ADVANCE_PRINCIPAL' },
+ { name: 'In advance interest', code: 'IN_ADVANCE_INTEREST' }
+ ];
+}
+
+export class FutureInstallmentAllocationRules {
+ public static options: PaymentCode[] = [
+ { name: 'Next Installment', code: 'NEXT_INSTALLMENT' },
+ { name: 'Last Installment', code: 'LAST_INSTALLMENT' },
+ { name: 'Reamortization', code: 'REAMORTIZATION' }
+ ];
+}
diff --git a/src/app/shared/tabs/entity-datatable-tab/datatable-multi-row/datatable-multi-row.component.html b/src/app/shared/tabs/entity-datatable-tab/datatable-multi-row/datatable-multi-row.component.html
index f641f8402..1a2f5a25b 100644
--- a/src/app/shared/tabs/entity-datatable-tab/datatable-multi-row/datatable-multi-row.component.html
+++ b/src/app/shared/tabs/entity-datatable-tab/datatable-multi-row/datatable-multi-row.component.html
@@ -37,7 +37,7 @@
0">
- {{datatableColumn}} |
+ {{ getInputName(datatableColumn) }} |
{{ formatValue(data, datatableColumn) }}
|
diff --git a/src/app/shared/tabs/entity-datatable-tab/datatable-multi-row/datatable-multi-row.component.ts b/src/app/shared/tabs/entity-datatable-tab/datatable-multi-row/datatable-multi-row.component.ts
index a4789a714..068d74f1c 100644
--- a/src/app/shared/tabs/entity-datatable-tab/datatable-multi-row/datatable-multi-row.component.ts
+++ b/src/app/shared/tabs/entity-datatable-tab/datatable-multi-row/datatable-multi-row.component.ts
@@ -256,4 +256,8 @@ export class DatatableMultiRowComponent implements OnInit, OnDestroy, OnChanges
return '';
}
+ getInputName(attr: string): string {
+ return this.datatables.getName(attr);
+ }
+
}
diff --git a/src/app/users/users-routing.module.ts b/src/app/users/users-routing.module.ts
index 11b903692..2e3f66560 100644
--- a/src/app/users/users-routing.module.ts
+++ b/src/app/users/users-routing.module.ts
@@ -23,7 +23,7 @@ import { UserResolver } from './user.resolver';
const routes: Routes = [
Route.withShell([
{
- path: 'users',
+ path: 'appusers',
data: { title: extract('Users'), breadcrumb: 'Users' },
children: [
{
diff --git a/src/app/users/users.service.ts b/src/app/users/users.service.ts
index 6aed811f8..1eaf6b6f7 100644
--- a/src/app/users/users.service.ts
+++ b/src/app/users/users.service.ts
@@ -22,7 +22,7 @@ export class UsersService {
* @returns {Observable} Users data
*/
getUsers(): Observable {
- return this.http.get('/users');
+ return this.http.get(`/users`);
}
/**
diff --git a/src/assets/styles/_colours.scss b/src/assets/styles/_colours.scss
index 6ed6d7f9c..085f09e0b 100644
--- a/src/assets/styles/_colours.scss
+++ b/src/assets/styles/_colours.scss
@@ -88,3 +88,7 @@ $error-log: #ffa726;
color: $status-inactive;
text-align: center;
}
+
+.cdk-drag-placeholder {
+ background: $peter-river;
+}