build: Use prettier for typescript
Stop ignoring .ts files in prettier and fix existing issues.
This commit is contained in:
@@ -8,9 +8,8 @@ describe('AccountNumberComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ AccountNumberComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [AccountNumberComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -17,11 +17,11 @@ export class AccountNumberComponent implements OnInit {
|
||||
displayL = false;
|
||||
displayR = true;
|
||||
|
||||
constructor(private clipboard: Clipboard) { }
|
||||
constructor(private clipboard: Clipboard) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.displayL = (this.display === 'left');
|
||||
this.displayR = (this.display === 'right');
|
||||
this.displayL = this.display === 'left';
|
||||
this.displayR = this.display === 'right';
|
||||
}
|
||||
|
||||
copyValue(): void {
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('GlAccountDisplayComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ GlAccountDisplayComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [GlAccountDisplayComponent]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(GlAccountDisplayComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
@@ -7,19 +7,22 @@ import { GLAccount } from 'app/shared/models/general.model';
|
||||
styleUrls: ['./gl-account-display.component.scss']
|
||||
})
|
||||
export class GlAccountDisplayComponent {
|
||||
|
||||
@Input() glAccount: GLAccount | null = null;
|
||||
@Input() accountTitle: string | null = null;
|
||||
@Input() withTitle = '50%';
|
||||
@Input() withAccount = '50%';
|
||||
|
||||
constructor() { }
|
||||
constructor() {}
|
||||
|
||||
glAccountValue(): string {
|
||||
if (this.glAccount) {
|
||||
return '(' + this.glAccount.glCode + ') ' + (this.glAccount.nameDecorated ? this.glAccount.nameDecorated : this.glAccount.name);
|
||||
return (
|
||||
'(' +
|
||||
this.glAccount.glCode +
|
||||
') ' +
|
||||
(this.glAccount.nameDecorated ? this.glAccount.nameDecorated : this.glAccount.name)
|
||||
);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('GlAccountSelectorComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ GlAccountSelectorComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [GlAccountSelectorComponent]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(GlAccountSelectorComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
@@ -11,7 +11,6 @@ import { takeUntil } from 'rxjs/operators';
|
||||
styleUrls: ['./gl-account-selector.component.scss']
|
||||
})
|
||||
export class GlAccountSelectorComponent implements OnInit, OnChanges, OnDestroy {
|
||||
|
||||
@Input() inputFormControl: UntypedFormControl;
|
||||
@Input() glAccountList: GLAccount[] = [];
|
||||
@Input() required = false;
|
||||
@@ -29,15 +28,13 @@ export class GlAccountSelectorComponent implements OnInit, OnChanges, OnDestroy
|
||||
placeHolderLabel = '';
|
||||
noEntriesFoundLabel = '';
|
||||
|
||||
constructor(private translateService: TranslateService) { }
|
||||
constructor(private translateService: TranslateService) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
// listen for search field value changes
|
||||
this.filterFormCtrl.valueChanges
|
||||
.pipe(takeUntil(this._onDestroy))
|
||||
.subscribe(() => {
|
||||
this.searchGLAccount();
|
||||
});
|
||||
this.filterFormCtrl.valueChanges.pipe(takeUntil(this._onDestroy)).subscribe(() => {
|
||||
this.searchGLAccount();
|
||||
});
|
||||
|
||||
this.placeHolderLabel = this.translateService.instant('labels.inputs.Filter');
|
||||
this.noEntriesFoundLabel = this.translateService.instant('labels.text.No data found');
|
||||
@@ -59,13 +56,14 @@ export class GlAccountSelectorComponent implements OnInit, OnChanges, OnDestroy
|
||||
const search: string = this.filterFormCtrl.value.toLowerCase();
|
||||
|
||||
if (!search) {
|
||||
this.glAccountData.next(this.glAccountList.slice());
|
||||
this.glAccountData.next(this.glAccountList.slice());
|
||||
} else {
|
||||
this.glAccountData.next(this.glAccountList.filter((option: GLAccount) => {
|
||||
return option.name.toLowerCase().indexOf(search) >= 0 || option.glCode.toLowerCase().indexOf(search) >= 0;
|
||||
}));
|
||||
this.glAccountData.next(
|
||||
this.glAccountList.filter((option: GLAccount) => {
|
||||
return option.name.toLowerCase().indexOf(search) >= 0 || option.glCode.toLowerCase().indexOf(search) >= 0;
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('ViewJournalEntryTransactionComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ViewJournalEntryTransactionComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewJournalEntryTransactionComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+39
-19
@@ -15,7 +15,6 @@ import { Location } from '@angular/common';
|
||||
styleUrls: ['./view-journal-entry-transaction.component.scss']
|
||||
})
|
||||
export class ViewJournalEntryTransactionComponent implements OnInit {
|
||||
|
||||
title: string;
|
||||
journalEntriesData: any[];
|
||||
/** Transaction data. */
|
||||
@@ -23,7 +22,14 @@ export class ViewJournalEntryTransactionComponent implements OnInit {
|
||||
/** Transaction ID. */
|
||||
transactionId: string;
|
||||
/** Columns to be displayed in transaction table. */
|
||||
displayedColumns: string[] = ['id', 'glAccountType', 'glAccountCode', 'glAccountName', 'debit', 'credit'];
|
||||
displayedColumns: string[] = [
|
||||
'id',
|
||||
'glAccountType',
|
||||
'glAccountCode',
|
||||
'glAccountName',
|
||||
'debit',
|
||||
'credit'
|
||||
];
|
||||
/** Data source for transaction table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -40,17 +46,19 @@ export class ViewJournalEntryTransactionComponent implements OnInit {
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {MatDialog} dialog Dialog reference.
|
||||
*/
|
||||
constructor(private accountingService: AccountingService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
public dialog: MatDialog,
|
||||
private location: Location) { }
|
||||
constructor(
|
||||
private accountingService: AccountingService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
public dialog: MatDialog,
|
||||
private location: Location
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Retrieves the transaction data from `resolve` and sets the transaction table.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { title: string, transaction: any, transferJournalEntryData: any }) => {
|
||||
this.route.data.subscribe((data: { title: string; transaction: any; transferJournalEntryData: any }) => {
|
||||
this.title = data.title;
|
||||
this.isJournalEntryLoaded = false;
|
||||
if (this.isViewTransaction()) {
|
||||
@@ -68,11 +76,11 @@ export class ViewJournalEntryTransactionComponent implements OnInit {
|
||||
}
|
||||
|
||||
isViewTransaction(): boolean {
|
||||
return (this.title === 'View Transaction');
|
||||
return this.title === 'View Transaction';
|
||||
}
|
||||
|
||||
isViewTransfer(): boolean {
|
||||
return (this.title === 'View Transfer');
|
||||
return this.title === 'View Transfer';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -85,10 +93,14 @@ export class ViewJournalEntryTransactionComponent implements OnInit {
|
||||
this.dataSource = new MatTableDataSource(this.transaction.pageItems);
|
||||
this.dataSource.sortingDataAccessor = (transaction: any, property: any) => {
|
||||
switch (property) {
|
||||
case 'glAccountType': return transaction.glAccountType.value;
|
||||
case 'debit': return transaction.amount;
|
||||
case 'credit': return transaction.amount;
|
||||
default: return transaction[property];
|
||||
case 'glAccountType':
|
||||
return transaction.glAccountType.value;
|
||||
case 'debit':
|
||||
return transaction.amount;
|
||||
case 'credit':
|
||||
return transaction.amount;
|
||||
default:
|
||||
return transaction[property];
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -116,12 +128,20 @@ export class ViewJournalEntryTransactionComponent implements OnInit {
|
||||
});
|
||||
revertTransactionDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.revert) {
|
||||
this.accountingService.revertTransaction(this.transactionId, response.comments).subscribe((reversedTransaction: any) => {
|
||||
this.dataSource.data[0].reversed = true;
|
||||
this.revertTransaction(reversedTransaction.transactionId);
|
||||
});
|
||||
this.accountingService
|
||||
.revertTransaction(this.transactionId, response.comments)
|
||||
.subscribe((reversedTransaction: any) => {
|
||||
this.dataSource.data[0].reversed = true;
|
||||
this.revertTransaction(reversedTransaction.transactionId);
|
||||
});
|
||||
} else if (response.redirect) {
|
||||
this.router.navigate(['../', transactionId], { relativeTo: this.route });
|
||||
this.router.navigate(
|
||||
[
|
||||
'../',
|
||||
transactionId
|
||||
],
|
||||
{ relativeTo: this.route }
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ViewJournalEntryComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewJournalEntryComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewJournalEntryComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -11,16 +11,16 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
styleUrls: ['./view-journal-entry.component.scss']
|
||||
})
|
||||
export class ViewJournalEntryComponent {
|
||||
|
||||
existsPaymentDetails = false;
|
||||
/**
|
||||
* @param {MatDialogRef} dialogRef Component reference to dialog.
|
||||
* @param {any} data Provides journal entry.
|
||||
*/
|
||||
constructor(public dialogRef: MatDialogRef<ViewJournalEntryComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) {
|
||||
|
||||
this.existsPaymentDetails = (data.journalEntry.transactionDetails != null && data.journalEntry.transactionDetails.paymentDetails != null);
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<ViewJournalEntryComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any
|
||||
) {
|
||||
this.existsPaymentDetails =
|
||||
data.journalEntry.transactionDetails != null && data.journalEntry.transactionDetails.paymentDetails != null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('ViewSavingsAccountingDetailsComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ViewSavingsAccountingDetailsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewSavingsAccountingDetailsComponent]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(ViewSavingsAccountingDetailsComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
+1
-3
@@ -8,11 +8,10 @@ import { OptionData } from 'app/shared/models/option-data.model';
|
||||
styleUrls: ['./view-savings-accounting-details.component.scss']
|
||||
})
|
||||
export class ViewSavingsAccountingDetailsComponent {
|
||||
|
||||
@Input() accountingRule: OptionData;
|
||||
@Input() accountingMappings: any[] = [];
|
||||
|
||||
constructor(private accounting: Accounting) { }
|
||||
constructor(private accounting: Accounting) {}
|
||||
|
||||
isCashOrAccrualAccounting(): boolean {
|
||||
if (this.accountingRule) {
|
||||
@@ -31,5 +30,4 @@ export class ViewSavingsAccountingDetailsComponent {
|
||||
getAccountingRuleName(value: string): string {
|
||||
return this.accounting.getAccountRuleName(value.toUpperCase());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('CancelDialogComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CancelDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CancelDialogComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -11,11 +11,11 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
styleUrls: ['./cancel-dialog.component.scss']
|
||||
})
|
||||
export class CancelDialogComponent {
|
||||
|
||||
/**
|
||||
* @param {MatDialogRef} dialogRef Component reference to dialog.
|
||||
*/
|
||||
constructor(public dialogRef: MatDialogRef<CancelDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<CancelDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any
|
||||
) {}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ChangePasswordDialogComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ChangePasswordDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ChangePasswordDialogComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -14,7 +14,6 @@ import { PasswordsUtility } from 'app/core/utils/passwords-utility';
|
||||
styleUrls: ['./change-password-dialog.component.scss']
|
||||
})
|
||||
export class ChangePasswordDialogComponent implements OnInit {
|
||||
|
||||
/** Change Password Form */
|
||||
changePasswordForm: any;
|
||||
|
||||
@@ -22,10 +21,12 @@ export class ChangePasswordDialogComponent implements OnInit {
|
||||
* @param {MatDialogRef} dialogRef Component reference to dialog.
|
||||
* @param {any} data Provides any data.
|
||||
*/
|
||||
constructor(public dialogRef: MatDialogRef<ChangePasswordDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private passwordsUtility: PasswordsUtility) { }
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<ChangePasswordDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private passwordsUtility: PasswordsUtility
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.createChangePasswordForm();
|
||||
@@ -34,8 +35,16 @@ export class ChangePasswordDialogComponent implements OnInit {
|
||||
/** Change Password form */
|
||||
createChangePasswordForm() {
|
||||
this.changePasswordForm = this.formBuilder.group({
|
||||
'password': ['', this.passwordsUtility.getPasswordValidators()],
|
||||
'repeatPassword': ['', [Validators.required, this.confirmPassword('password')]]
|
||||
password: [
|
||||
'',
|
||||
this.passwordsUtility.getPasswordValidators()
|
||||
],
|
||||
repeatPassword: [
|
||||
'',
|
||||
[
|
||||
Validators.required,
|
||||
this.confirmPassword('password')]
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -44,19 +53,18 @@ export class ChangePasswordDialogComponent implements OnInit {
|
||||
* @param controlNameToCompare Form Control Name to be compared.
|
||||
*/
|
||||
confirmPassword(controlNameToCompare: string): ValidatorFn {
|
||||
return (c: AbstractControl): ValidationErrors|null => {
|
||||
if (c.value == null || c.value.length === 0) {
|
||||
return null;
|
||||
}
|
||||
const controlToCompare = c.root.get(controlNameToCompare);
|
||||
if (controlToCompare) {
|
||||
const subscription: Subscription = controlToCompare.valueChanges.subscribe(() => {
|
||||
c.updateValueAndValidity();
|
||||
subscription.unsubscribe();
|
||||
});
|
||||
}
|
||||
return controlToCompare && controlToCompare.value !== c.value ? {'notequal': true} : null;
|
||||
return (c: AbstractControl): ValidationErrors | null => {
|
||||
if (c.value == null || c.value.length === 0) {
|
||||
return null;
|
||||
}
|
||||
const controlToCompare = c.root.get(controlNameToCompare);
|
||||
if (controlToCompare) {
|
||||
const subscription: Subscription = controlToCompare.valueChanges.subscribe(() => {
|
||||
c.updateValueAndValidity();
|
||||
subscription.unsubscribe();
|
||||
});
|
||||
}
|
||||
return controlToCompare && controlToCompare.value !== c.value ? { notequal: true } : null;
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { NestedTreeControl } from '@angular/cdk/tree';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class TreeControlService {
|
||||
constructor() { }
|
||||
constructor() {}
|
||||
|
||||
toggleExpandCollapse(nestedTreeControl: NestedTreeControl<any>, isTreeExpanded: boolean) {
|
||||
if (isTreeExpanded) {
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ConfirmationDialogComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ConfirmationDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ConfirmationDialogComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -13,15 +13,16 @@ import { Dialogs } from 'app/core/dialogs/dialogs';
|
||||
styleUrls: ['./confirmation-dialog.component.scss']
|
||||
})
|
||||
export class ConfirmationDialogComponent implements OnInit {
|
||||
|
||||
color: string;
|
||||
/**
|
||||
* @param {MatDialogRef} dialogRef Component reference to dialog.
|
||||
* @param {any} data Provides a deleteContext.
|
||||
*/
|
||||
constructor(public dialogRef: MatDialogRef<ConfirmationDialogComponent>,
|
||||
private dialogs: Dialogs,
|
||||
@Inject(MAT_DIALOG_DATA) public data: DialogData) { }
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<ConfirmationDialogComponent>,
|
||||
private dialogs: Dialogs,
|
||||
@Inject(MAT_DIALOG_DATA) public data: DialogData
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.setColor();
|
||||
@@ -30,5 +31,4 @@ export class ConfirmationDialogComponent implements OnInit {
|
||||
setColor() {
|
||||
this.color = this.dialogs.setColor(this.data.type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('DeleteDialogComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DeleteDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [DeleteDialogComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -11,12 +11,12 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
styleUrls: ['./delete-dialog.component.scss']
|
||||
})
|
||||
export class DeleteDialogComponent {
|
||||
|
||||
/**
|
||||
* @param {MatDialogRef} dialogRef Component reference to dialog.
|
||||
* @param {any} data Provides a deleteContext.
|
||||
*/
|
||||
constructor(public dialogRef: MatDialogRef<DeleteDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<DeleteDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any
|
||||
) {}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('DisableDialogComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DisableDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [DisableDialogComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -11,12 +11,12 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
styleUrls: ['./disable-dialog.component.scss']
|
||||
})
|
||||
export class DisableDialogComponent {
|
||||
|
||||
/**
|
||||
* @param {MatDialogRef} dialogRef Component reference to dialog.
|
||||
* @param {any} data Provides a disableContext.
|
||||
*/
|
||||
constructor(public dialogRef: MatDialogRef<DisableDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<DisableDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any
|
||||
) {}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('DropdownComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ DropdownComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [DropdownComponent]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(DropdownComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
@@ -8,14 +8,13 @@ import { TranslateService } from '@ngx-translate/core';
|
||||
styleUrls: ['./dropdown.component.scss']
|
||||
})
|
||||
export class DropdownComponent {
|
||||
|
||||
@Input() placeHolderText: string;
|
||||
@Input() labelText: string;
|
||||
@Input() selectOptions: any[] = [];
|
||||
@Input() controlSelect: UntypedFormControl;
|
||||
@Input() required: boolean;
|
||||
|
||||
constructor(private translateService: TranslateService) { }
|
||||
constructor(private translateService: TranslateService) {}
|
||||
|
||||
getPlaceHolderText(): string {
|
||||
return this.placeHolderText ? this.translateService.instant('labels.inputs.' + this.placeHolderText) : '';
|
||||
@@ -28,5 +27,4 @@ export class DropdownComponent {
|
||||
clearProperty() {
|
||||
this.controlSelect.patchValue('');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('EnableDialogComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EnableDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EnableDialogComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -11,12 +11,12 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
styleUrls: ['./enable-dialog.component.scss']
|
||||
})
|
||||
export class EnableDialogComponent {
|
||||
|
||||
/**
|
||||
* @param {MatDialogRef} dialogRef Component reference to dialog.
|
||||
* @param {any} data Provides a enableContext.
|
||||
*/
|
||||
constructor(public dialogRef: MatDialogRef<EnableDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<EnableDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any
|
||||
) {}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('EntityNameComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ EntityNameComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EntityNameComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -7,7 +7,6 @@ import { Clipboard } from '@angular/cdk/clipboard';
|
||||
styleUrls: ['./entity-name.component.scss']
|
||||
})
|
||||
export class EntityNameComponent implements OnInit {
|
||||
|
||||
@Input() entityName: string;
|
||||
@Input() display = 'right';
|
||||
|
||||
@@ -15,11 +14,11 @@ export class EntityNameComponent implements OnInit {
|
||||
displayL = false;
|
||||
displayR = true;
|
||||
|
||||
constructor(private clipboard: Clipboard) { }
|
||||
constructor(private clipboard: Clipboard) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.displayL = (this.display === 'left');
|
||||
this.displayR = (this.display === 'right');
|
||||
this.displayL = this.display === 'left';
|
||||
this.displayR = this.display === 'right';
|
||||
}
|
||||
|
||||
copyValue(): void {
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ErrorDialogComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ErrorDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ErrorDialogComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -8,15 +8,15 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
styleUrls: ['./error-dialog.component.scss']
|
||||
})
|
||||
export class ErrorDialogComponent {
|
||||
|
||||
showAsCode = false;
|
||||
/**
|
||||
* @param {MatDialogRef} dialogRef Component reference to dialog.
|
||||
* @param {any} data Provides any data.
|
||||
*/
|
||||
constructor(public dialogRef: MatDialogRef<ErrorDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: string) {
|
||||
this.showAsCode = (data.startsWith('<pre><code>'));
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<ErrorDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: string
|
||||
) {
|
||||
this.showAsCode = data.startsWith('<pre><code>');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ExternalIdentifierComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ExternalIdentifierComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ExternalIdentifierComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -17,20 +17,22 @@ export class ExternalIdentifierComponent implements OnInit {
|
||||
displayR = true;
|
||||
emptyValue = false;
|
||||
|
||||
constructor(private clipboard: Clipboard,
|
||||
private alertService: AlertService) { }
|
||||
constructor(
|
||||
private clipboard: Clipboard,
|
||||
private alertService: AlertService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.emptyValue = (!this.externalId || this.externalId === '');
|
||||
this.displayL = (this.display === 'left');
|
||||
this.displayR = (this.display === 'right');
|
||||
this.emptyValue = !this.externalId || this.externalId === '';
|
||||
this.displayL = this.display === 'left';
|
||||
this.displayR = this.display === 'right';
|
||||
}
|
||||
|
||||
isLongValue(): boolean {
|
||||
if (this.externalId == null) {
|
||||
return false;
|
||||
}
|
||||
return (this.externalId.length > 15);
|
||||
return this.externalId.length > 15;
|
||||
}
|
||||
|
||||
showValue() {
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('FileUploadComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FileUploadComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [FileUploadComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -10,7 +10,6 @@ import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core';
|
||||
styleUrls: ['./file-upload.component.scss']
|
||||
})
|
||||
export class FileUploadComponent implements OnInit {
|
||||
|
||||
/** Form field flex dimension */
|
||||
@Input() flex: any;
|
||||
@Input() acceptFilter: string;
|
||||
@@ -18,7 +17,7 @@ export class FileUploadComponent implements OnInit {
|
||||
/** Selected file name */
|
||||
fileName: File;
|
||||
|
||||
constructor() { }
|
||||
constructor() {}
|
||||
|
||||
ngOnInit() {
|
||||
if (!this.acceptFilter) {
|
||||
@@ -33,5 +32,4 @@ export class FileUploadComponent implements OnInit {
|
||||
onFileSelect($event: any) {
|
||||
this.fileName = $event.target.files[0].name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('FooterComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FooterComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [FooterComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -21,7 +21,6 @@ import { Subscription } from 'rxjs';
|
||||
styleUrls: ['./footer.component.scss']
|
||||
})
|
||||
export class FooterComponent implements OnInit, OnDestroy {
|
||||
|
||||
/** Mifos X version. */
|
||||
versions: any = {
|
||||
mifos: environment.version,
|
||||
@@ -44,13 +43,15 @@ export class FooterComponent implements OnInit, OnDestroy {
|
||||
|
||||
displayBackEndInfo = true;
|
||||
|
||||
constructor(private systemService: SystemService,
|
||||
constructor(
|
||||
private systemService: SystemService,
|
||||
private settingsService: SettingsService,
|
||||
private authenticationService: AuthenticationService,
|
||||
private alertService: AlertService,
|
||||
private dateUtils: Dates,
|
||||
private versionService: VersionService) {
|
||||
this.displayBackEndInfo = (environment.displayBackEndInfo === 'true');
|
||||
private versionService: VersionService
|
||||
) {
|
||||
this.displayBackEndInfo = environment.displayBackEndInfo === 'true';
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -58,7 +59,7 @@ export class FooterComponent implements OnInit, OnDestroy {
|
||||
this.alert$ = this.alertService.alertEvent.subscribe((alertEvent: Alert) => {
|
||||
const alertType = alertEvent.type;
|
||||
if (alertType === SettingsService.businessDateType + ' Set Config') {
|
||||
this.isBusinessDateEnabled = (alertEvent.message === 'enabled') ? true : false;
|
||||
this.isBusinessDateEnabled = alertEvent.message === 'enabled' ? true : false;
|
||||
this.isBusinessDateDefined = false;
|
||||
if (this.isBusinessDateEnabled) {
|
||||
this.setBusinessDate();
|
||||
@@ -68,7 +69,9 @@ export class FooterComponent implements OnInit, OnDestroy {
|
||||
this.setBusinessDate();
|
||||
}
|
||||
} else if (alertType === 'Authentication Start') {
|
||||
this.timer = setTimeout(() => { this.getConfigurations(); }, 60000);
|
||||
this.timer = setTimeout(() => {
|
||||
this.getConfigurations();
|
||||
}, 60000);
|
||||
}
|
||||
});
|
||||
this.getConfigurations();
|
||||
@@ -94,15 +97,18 @@ export class FooterComponent implements OnInit, OnDestroy {
|
||||
*/
|
||||
getConfigurations(): void {
|
||||
if (this.authenticationService.isAuthenticated()) {
|
||||
this.systemService.getConfigurationByName(SettingsService.businessDateConfigName)
|
||||
.subscribe((configurationData: any) => {
|
||||
this.isBusinessDateEnabled = configurationData.enabled;
|
||||
this.settingsService.setBusinessDateConfig(configurationData.enabled);
|
||||
if (this.isBusinessDateEnabled) {
|
||||
this.setBusinessDate();
|
||||
this.timer = setTimeout(() => { this.getConfigurations(); }, 60000);
|
||||
}
|
||||
});
|
||||
this.systemService
|
||||
.getConfigurationByName(SettingsService.businessDateConfigName)
|
||||
.subscribe((configurationData: any) => {
|
||||
this.isBusinessDateEnabled = configurationData.enabled;
|
||||
this.settingsService.setBusinessDateConfig(configurationData.enabled);
|
||||
if (this.isBusinessDateEnabled) {
|
||||
this.setBusinessDate();
|
||||
this.timer = setTimeout(() => {
|
||||
this.getConfigurations();
|
||||
}, 60000);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
clearTimeout(this.timer);
|
||||
}
|
||||
@@ -112,10 +118,11 @@ export class FooterComponent implements OnInit, OnDestroy {
|
||||
* Get the Business Date data
|
||||
*/
|
||||
setBusinessDate(): void {
|
||||
this.systemService.getBusinessDate(SettingsService.businessDateType)
|
||||
.subscribe((data: any) => {
|
||||
this.systemService.getBusinessDate(SettingsService.businessDateType).subscribe((data: any) => {
|
||||
this.businessDate = new Date(data.date);
|
||||
this.settingsService.setBusinessDate(this.dateUtils.formatDate(this.businessDate, SettingsService.businessDateFormat));
|
||||
this.settingsService.setBusinessDate(
|
||||
this.dateUtils.formatDate(this.businessDate, SettingsService.businessDateFormat)
|
||||
);
|
||||
this.isBusinessDateDefined = true;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('FormDialogComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FormDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [FormDialogComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -14,14 +14,13 @@ const layoutGap = 2;
|
||||
styleUrls: ['./form-dialog.component.scss']
|
||||
})
|
||||
export class FormDialogComponent implements OnInit {
|
||||
|
||||
layout: {
|
||||
columns: number,
|
||||
columnWidth?: number,
|
||||
flex?: number,
|
||||
gap?: number,
|
||||
cancelButtonText?: string,
|
||||
addButtonText?: string
|
||||
columns: number;
|
||||
columnWidth?: number;
|
||||
flex?: number;
|
||||
gap?: number;
|
||||
cancelButtonText?: string;
|
||||
addButtonText?: string;
|
||||
} = {
|
||||
columns: 1,
|
||||
columnWidth: 400,
|
||||
@@ -34,15 +33,19 @@ export class FormDialogComponent implements OnInit {
|
||||
formfields: FormfieldBase[];
|
||||
pristine: boolean;
|
||||
|
||||
constructor(public dialogRef: MatDialogRef<FormDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
private formGroupService: FormGroupService) {
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<FormDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
private formGroupService: FormGroupService
|
||||
) {
|
||||
this.dialogRef.disableClose = data.disableClose !== undefined ? data.disableClose : true;
|
||||
this.formfields = data.formfields.sort((formfieldA: FormfieldBase, formfieldB: FormfieldBase) => formfieldA.order - formfieldB.order);
|
||||
this.formfields = data.formfields.sort(
|
||||
(formfieldA: FormfieldBase, formfieldB: FormfieldBase) => formfieldA.order - formfieldB.order
|
||||
);
|
||||
this.pristine = data.pristine !== undefined ? data.pristine : true;
|
||||
this.layout = { ...this.layout, ...data.layout };
|
||||
this.layout.gap = this.layout.columns > 1 ? layoutGap : 0;
|
||||
this.layout.flex = (this.layout.flex / this.layout.columns) - this.layout.gap;
|
||||
this.layout.flex = this.layout.flex / this.layout.columns - this.layout.gap;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -52,5 +55,4 @@ export class FormDialogComponent implements OnInit {
|
||||
this.form.markAsDirty();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,17 +7,17 @@ import { FormfieldBase } from './formfield/model/formfield-base';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class FormGroupService {
|
||||
|
||||
constructor() { }
|
||||
constructor() {}
|
||||
|
||||
createFormGroup(formfields: FormfieldBase[]) {
|
||||
const group: any = {};
|
||||
|
||||
formfields.forEach(formfield => {
|
||||
group[formfield.controlName] = formfield.required ? new UntypedFormControl(formfield.value, Validators.required) : new UntypedFormControl(formfield.value);
|
||||
formfields.forEach((formfield) => {
|
||||
group[formfield.controlName] = formfield.required
|
||||
? new UntypedFormControl(formfield.value, Validators.required)
|
||||
: new UntypedFormControl(formfield.value);
|
||||
});
|
||||
|
||||
return new UntypedFormGroup(group);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('FormfieldComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FormfieldComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [FormfieldComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -9,10 +9,8 @@ import { FormfieldBase } from './model/formfield-base';
|
||||
styleUrls: ['./formfield.component.scss']
|
||||
})
|
||||
export class FormfieldComponent {
|
||||
|
||||
@Input() form: UntypedFormGroup;
|
||||
@Input() formfield: FormfieldBase;
|
||||
|
||||
constructor() { }
|
||||
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { FormfieldBase } from './formfield-base';
|
||||
|
||||
export class CheckboxBase extends FormfieldBase {
|
||||
controlType = 'checkbox';
|
||||
|
||||
constructor(options: any) {
|
||||
super(options);
|
||||
}
|
||||
controlType = 'checkbox';
|
||||
|
||||
constructor(options: any) {
|
||||
super(options);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { FormfieldBase } from './formfield-base';
|
||||
|
||||
export class DatepickerBase extends FormfieldBase {
|
||||
|
||||
controlType = 'datepicker';
|
||||
minDate: Date;
|
||||
maxDate: Date;
|
||||
@@ -11,5 +10,4 @@ export class DatepickerBase extends FormfieldBase {
|
||||
this.minDate = options['minDate'] || new Date(2000, 0, 1);
|
||||
this.maxDate = options['maxDate'] || new Date();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { FormfieldBase } from './formfield-base';
|
||||
|
||||
export class DateTimepickerBase extends FormfieldBase {
|
||||
|
||||
controlType = 'datetimepicker';
|
||||
minDate: Date;
|
||||
maxDate: Date;
|
||||
@@ -11,5 +10,4 @@ export class DateTimepickerBase extends FormfieldBase {
|
||||
this.minDate = options['minDate'] || new Date(2000, 0, 1);
|
||||
this.maxDate = options['maxDate'] || new Date();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
export class FormfieldBase {
|
||||
|
||||
controlType: string;
|
||||
controlName: string;
|
||||
label: string;
|
||||
@@ -7,20 +6,21 @@ export class FormfieldBase {
|
||||
required: boolean;
|
||||
order: number;
|
||||
|
||||
constructor(options: {
|
||||
controlType?: string,
|
||||
controlName?: string,
|
||||
label?: string,
|
||||
value?: any,
|
||||
required?: boolean,
|
||||
order?: number
|
||||
} = {}) {
|
||||
this.controlType = options.controlType || '';
|
||||
this.controlName = options.controlName || '';
|
||||
this.label = options.label || '';
|
||||
this.value = options.value === undefined ? '' : options.value;
|
||||
this.required = !!options.required;
|
||||
this.order = options.order === undefined ? 1 : options.order;
|
||||
constructor(
|
||||
options: {
|
||||
controlType?: string;
|
||||
controlName?: string;
|
||||
label?: string;
|
||||
value?: any;
|
||||
required?: boolean;
|
||||
order?: number;
|
||||
} = {}
|
||||
) {
|
||||
this.controlType = options.controlType || '';
|
||||
this.controlName = options.controlName || '';
|
||||
this.label = options.label || '';
|
||||
this.value = options.value === undefined ? '' : options.value;
|
||||
this.required = !!options.required;
|
||||
this.order = options.order === undefined ? 1 : options.order;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { FormfieldBase } from './formfield-base';
|
||||
|
||||
export class InputBase extends FormfieldBase {
|
||||
|
||||
controlType = 'input';
|
||||
type: string;
|
||||
|
||||
@@ -9,5 +8,4 @@ export class InputBase extends FormfieldBase {
|
||||
super(options);
|
||||
this.type = options['type'] || 'text';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
import { FormfieldBase } from './formfield-base';
|
||||
|
||||
export class SelectBase extends FormfieldBase {
|
||||
|
||||
controlType = 'select';
|
||||
options: {
|
||||
label: string,
|
||||
value: string,
|
||||
data: {}[]
|
||||
label: string;
|
||||
value: string;
|
||||
data: {}[];
|
||||
};
|
||||
|
||||
constructor(options: {} = {}) {
|
||||
super(options);
|
||||
this.options = options['options'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -123,7 +123,6 @@ import {
|
||||
exports: [FontAwesomeModule]
|
||||
})
|
||||
export class IconsModule {
|
||||
|
||||
constructor(library: FaIconLibrary) {
|
||||
library.addIcons(
|
||||
faAnchor,
|
||||
@@ -239,5 +238,4 @@ export class IconsModule {
|
||||
faTableCells
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('InputAmountComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ InputAmountComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [InputAmountComponent]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(InputAmountComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
@@ -8,7 +8,6 @@ import { UntypedFormControl } from '@angular/forms';
|
||||
styleUrls: ['./input-amount.component.scss']
|
||||
})
|
||||
export class InputAmountComponent {
|
||||
|
||||
@Input() isRequired = false;
|
||||
@Input() currency: Currency;
|
||||
@Input() inputLabel: string;
|
||||
@@ -16,10 +15,10 @@ export class InputAmountComponent {
|
||||
|
||||
displayHint = false;
|
||||
|
||||
constructor() { }
|
||||
constructor() {}
|
||||
|
||||
numberOnly(event: any): boolean {
|
||||
const charCode = (event.which) ? event.which : event.keyCode;
|
||||
const charCode = event.which ? event.which : event.keyCode;
|
||||
if (charCode === 46) {
|
||||
if (!(this.inputFormControl.value.indexOf('.') > -1)) {
|
||||
return true;
|
||||
@@ -38,5 +37,4 @@ export class InputAmountComponent {
|
||||
inputFocus(): void {
|
||||
this.displayHint = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('KeyboardShortcutsDialogComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ KeyboardShortcutsDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [KeyboardShortcutsDialogComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -11,18 +11,16 @@ import { KeyboardShortcutsConfiguration } from '../../keyboards-shortcut-config'
|
||||
styleUrls: ['./keyboard-shortcuts-dialog.component.scss']
|
||||
})
|
||||
export class KeyboardShortcutsDialogComponent implements OnInit {
|
||||
|
||||
buttonConfig: KeyboardShortcutsConfiguration;
|
||||
|
||||
/**
|
||||
* @param {MatDialogRef} dialogRef Component reference to dialog.
|
||||
* @param {any} data Provides a deleteContext.
|
||||
*/
|
||||
constructor(public dialogRef: MatDialogRef<KeyboardShortcutsDialogComponent>) { }
|
||||
constructor(public dialogRef: MatDialogRef<KeyboardShortcutsDialogComponent>) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.dialogRef.updateSize(`800px`);
|
||||
this.buttonConfig = new KeyboardShortcutsConfiguration();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('LanguageSelectorComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ LanguageSelectorComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [LanguageSelectorComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -18,7 +18,6 @@ import { SettingsService } from 'app/settings/settings.service';
|
||||
styleUrls: ['./language-selector.component.scss']
|
||||
})
|
||||
export class LanguageSelectorComponent {
|
||||
|
||||
/** Language selector form control. */
|
||||
languageSelector = new UntypedFormControl();
|
||||
|
||||
@@ -26,8 +25,10 @@ export class LanguageSelectorComponent {
|
||||
* Sets the language of the application in the selector on initial setup.
|
||||
* @param {TranslateService} translateService Translate Service.
|
||||
*/
|
||||
constructor(private translateService: TranslateService,
|
||||
private settingsService: SettingsService) {
|
||||
constructor(
|
||||
private translateService: TranslateService,
|
||||
private settingsService: SettingsService
|
||||
) {
|
||||
this.languageSelector.setValue(this.currentLanguage);
|
||||
}
|
||||
|
||||
@@ -35,7 +36,7 @@ export class LanguageSelectorComponent {
|
||||
* Sets a new language to be used by the application.
|
||||
* @param {string} language New language.
|
||||
*/
|
||||
setLanguage() {
|
||||
setLanguage() {
|
||||
this.translateService.use(this.languageSelector.value);
|
||||
this.settingsService.setLanguage({ name: '', code: this.languageSelector.value.substring(0, 2) });
|
||||
}
|
||||
@@ -55,5 +56,4 @@ export class LanguageSelectorComponent {
|
||||
get languages(): string[] {
|
||||
return this.translateService.getLangs();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<span (mouseenter)="mouseEnter()" (mouseleave)="mouseLeave()" *ngIf="!emptyValue">
|
||||
<span class="m-l-3" *ngIf="isLongValue()" (click)="showValue()"><fa-icon icon="eye" size="sm" [title]="textValue"></fa-icon></span>
|
||||
<span class="m-l-3" *ngIf="isLongValue()" (click)="showValue()"
|
||||
><fa-icon icon="eye" size="sm" [title]="textValue"></fa-icon
|
||||
></span>
|
||||
<span class="m-l-5" *ngIf="isLongValue()" (click)="showValue()">{{ textValue | truncateText: printChars }}...</span>
|
||||
<span class="m-l-5" *ngIf="!isLongValue()" (click)="showValue()">{{ textValue }}</span>
|
||||
</span>
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('LongTextComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ LongTextComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [LongTextComponent]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(LongTextComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
@@ -16,10 +16,10 @@ export class LongTextComponent implements OnInit {
|
||||
|
||||
printChars = 30;
|
||||
|
||||
constructor() { }
|
||||
constructor() {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.emptyValue = (!this.textValue || this.textValue === '');
|
||||
this.emptyValue = !this.textValue || this.textValue === '';
|
||||
this.printChars = this.chars;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ export class LongTextComponent implements OnInit {
|
||||
if (this.textValue == null) {
|
||||
return false;
|
||||
}
|
||||
return (this.textValue.length > 25);
|
||||
return this.textValue.length > 25;
|
||||
}
|
||||
|
||||
showValue() {
|
||||
|
||||
@@ -84,7 +84,7 @@ import { NgxMatSelectSearchModule } from 'ngx-mat-select-search';
|
||||
MatToolbarModule,
|
||||
MatTooltipModule,
|
||||
MatTreeModule,
|
||||
MatBadgeModule,
|
||||
MatBadgeModule
|
||||
],
|
||||
providers: [
|
||||
{
|
||||
@@ -100,4 +100,4 @@ import { NgxMatSelectSearchModule } from 'ngx-mat-select-search';
|
||||
}
|
||||
]
|
||||
})
|
||||
export class MaterialModule { }
|
||||
export class MaterialModule {}
|
||||
|
||||
@@ -1,48 +1,48 @@
|
||||
import { OptionData } from './option-data.model';
|
||||
|
||||
export interface Currency {
|
||||
code: string;
|
||||
name: string;
|
||||
code: string;
|
||||
name: string;
|
||||
decimalPlaces?: number;
|
||||
inMultiplesOf?: number;
|
||||
displaySymbol?: string;
|
||||
nameCode?: string;
|
||||
displayLabel?: string;
|
||||
nameCode?: string;
|
||||
displayLabel?: string;
|
||||
}
|
||||
|
||||
export interface GLAccount {
|
||||
id: number;
|
||||
name: string;
|
||||
glCode: string;
|
||||
description: string;
|
||||
nameDecorated?: string;
|
||||
disabled: boolean;
|
||||
manualEntriesAllowed: boolean;
|
||||
type: OptionData;
|
||||
usage: OptionData;
|
||||
parentId?: number;
|
||||
id: number;
|
||||
name: string;
|
||||
glCode: string;
|
||||
description: string;
|
||||
nameDecorated?: string;
|
||||
disabled: boolean;
|
||||
manualEntriesAllowed: boolean;
|
||||
type: OptionData;
|
||||
usage: OptionData;
|
||||
parentId?: number;
|
||||
}
|
||||
|
||||
export interface AccountingMapping {
|
||||
id: number;
|
||||
name: string;
|
||||
id: number;
|
||||
name: string;
|
||||
glCode: string;
|
||||
}
|
||||
|
||||
export interface ChargeToIncomeAccountMapping {
|
||||
charge: Charge;
|
||||
incomeAccount: AccountingMapping;
|
||||
charge: Charge;
|
||||
incomeAccount: AccountingMapping;
|
||||
}
|
||||
|
||||
export interface PaymentChannelToFundSourceMapping {
|
||||
paymentType: PaymentType;
|
||||
paymentType: PaymentType;
|
||||
fundSourceAccount: AccountingMapping;
|
||||
}
|
||||
|
||||
export interface ChargeOffReasonToExpenseAccountMapping {
|
||||
chargeOffReasonCodeValueId?: number;
|
||||
expenseAccountId? : number;
|
||||
chargeOffReasonCodeValue?: ChargeOffReasonCodeValue;
|
||||
expenseAccountId?: number;
|
||||
chargeOffReasonCodeValue?: ChargeOffReasonCodeValue;
|
||||
expenseAccount?: AccountingMapping;
|
||||
}
|
||||
|
||||
@@ -56,34 +56,34 @@ export interface ChargeOffReasonCodeValue {
|
||||
}
|
||||
|
||||
export interface PaymentType {
|
||||
id: number;
|
||||
name: string;
|
||||
id: number;
|
||||
name: string;
|
||||
isSystemDefined: boolean;
|
||||
}
|
||||
|
||||
export interface PaymentTypeOption {
|
||||
id: number;
|
||||
name: string;
|
||||
description: string;
|
||||
isCashPayment: boolean;
|
||||
id: number;
|
||||
name: string;
|
||||
description: string;
|
||||
isCashPayment: boolean;
|
||||
isSystemDefined: boolean;
|
||||
position: number;
|
||||
position: number;
|
||||
}
|
||||
|
||||
export interface Charge {
|
||||
id: number;
|
||||
name: string;
|
||||
active?: boolean;
|
||||
penalty: boolean;
|
||||
freeWithdrawal?: boolean;
|
||||
id: number;
|
||||
name: string;
|
||||
active?: boolean;
|
||||
penalty: boolean;
|
||||
freeWithdrawal?: boolean;
|
||||
freeWithdrawalChargeFrequency?: number;
|
||||
restartFrequency?: number;
|
||||
restartFrequencyEnum?: number;
|
||||
isPaymentType?: boolean;
|
||||
currency?: Currency;
|
||||
amount?: number;
|
||||
chargeTimeType?: OptionData;
|
||||
chargeAppliesTo?: OptionData;
|
||||
chargeCalculationType?: OptionData;
|
||||
chargePaymentMode?: OptionData;
|
||||
restartFrequency?: number;
|
||||
restartFrequencyEnum?: number;
|
||||
isPaymentType?: boolean;
|
||||
currency?: Currency;
|
||||
amount?: number;
|
||||
chargeTimeType?: OptionData;
|
||||
chargeAppliesTo?: OptionData;
|
||||
chargeCalculationType?: OptionData;
|
||||
chargePaymentMode?: OptionData;
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('NotificationsTrayComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ NotificationsTrayComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [NotificationsTrayComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -34,24 +34,25 @@ export class NotificationsTrayComponent implements OnInit, OnDestroy {
|
||||
* Shares, Savings, Deposits, Loans routes inaccessible because of dependency on entity ID.
|
||||
*/
|
||||
routeMap: any = {
|
||||
'client' : '/clients/',
|
||||
'group' : '/groups/',
|
||||
'loan': '/loans-accounts/',
|
||||
'center' : '/centers/',
|
||||
'shareAccount' : '/shares-accounts/',
|
||||
'fixedDeposit' : '/fixed-deposits-accounts/',
|
||||
'recurringDepositAccount': '/recurring-deposits-accounts/',
|
||||
'savingsAccount' : '/savings-accounts/',
|
||||
'shareProduct': '/products/share-products/',
|
||||
'loanProduct' : '/products/loan-products/'
|
||||
client: '/clients/',
|
||||
group: '/groups/',
|
||||
loan: '/loans-accounts/',
|
||||
center: '/centers/',
|
||||
shareAccount: '/shares-accounts/',
|
||||
fixedDeposit: '/fixed-deposits-accounts/',
|
||||
recurringDepositAccount: '/recurring-deposits-accounts/',
|
||||
savingsAccount: '/savings-accounts/',
|
||||
shareProduct: '/products/share-products/',
|
||||
loanProduct: '/products/loan-products/'
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {NotificationsService} notificationsService Notifications Service
|
||||
*/
|
||||
constructor(public notificationsService: NotificationsService) {
|
||||
forkJoin([this.notificationsService.getNotifications(true, 9), this.notificationsService.getNotifications(false, 9)])
|
||||
.subscribe((response: any[]) => {
|
||||
forkJoin([
|
||||
this.notificationsService.getNotifications(true, 9),
|
||||
this.notificationsService.getNotifications(false, 9)]).subscribe((response: any[]) => {
|
||||
this.readNotifications = response[0].pageItems;
|
||||
this.unreadNotifications = response[1].pageItems;
|
||||
this.setNotifications();
|
||||
@@ -83,7 +84,9 @@ export class NotificationsTrayComponent implements OnInit, OnDestroy {
|
||||
this.setNotifications();
|
||||
});
|
||||
// this.mockNotifications(); // Uncomment for Testing.
|
||||
this.timer = setTimeout(() => { this.fetchUnreadNotifications(); }, this.waitTime * 1000);
|
||||
this.timer = setTimeout(() => {
|
||||
this.fetchUnreadNotifications();
|
||||
}, this.waitTime * 1000);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,5 +110,4 @@ export class NotificationsTrayComponent implements OnInit, OnDestroy {
|
||||
this.setNotifications();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('SearchToolComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ SearchToolComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [SearchToolComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -15,16 +15,15 @@ import { UntypedFormControl } from '@angular/forms';
|
||||
trigger('fadeInOut', [
|
||||
transition(':enter', [
|
||||
style({ opacity: 0 }),
|
||||
animate(500, style({ opacity: 1 }))
|
||||
]),
|
||||
animate(500, style({ opacity: 1 }))]),
|
||||
transition(':leave', [
|
||||
animate(500, style({ opacity: 0 }))
|
||||
])
|
||||
animate(500, style({ opacity: 0 }))])
|
||||
|
||||
])
|
||||
|
||||
]
|
||||
})
|
||||
export class SearchToolComponent {
|
||||
|
||||
/** Query Form Control */
|
||||
query = new UntypedFormControl('');
|
||||
/** Resource Form Control */
|
||||
@@ -57,7 +56,7 @@ export class SearchToolComponent {
|
||||
{
|
||||
name: 'Loans',
|
||||
value: 'loans'
|
||||
},
|
||||
}
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -84,5 +83,4 @@ export class SearchToolComponent {
|
||||
};
|
||||
this.router.navigate(['/search'], { queryParams: queryParams });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ServerSelectorComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ServerSelectorComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ServerSelectorComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -14,9 +14,7 @@ import { SettingsService } from 'app/settings/settings.service';
|
||||
templateUrl: './server-selector.component.html',
|
||||
styleUrls: ['./server-selector.component.scss']
|
||||
})
|
||||
|
||||
export class ServerSelectorComponent implements OnInit {
|
||||
|
||||
/** Input server. */
|
||||
form: any;
|
||||
|
||||
@@ -24,7 +22,7 @@ export class ServerSelectorComponent implements OnInit {
|
||||
servers: string[];
|
||||
|
||||
/** Server Setting */
|
||||
serverSelector = new UntypedFormControl('');
|
||||
serverSelector = new UntypedFormControl('');
|
||||
|
||||
/** Server list to show */
|
||||
existMoreThanOneServer = false;
|
||||
@@ -32,20 +30,25 @@ export class ServerSelectorComponent implements OnInit {
|
||||
/**
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
constructor(private settingsService: SettingsService,
|
||||
constructor(
|
||||
private settingsService: SettingsService,
|
||||
public dialog: MatDialog,
|
||||
private formBuilder: UntypedFormBuilder) { }
|
||||
private formBuilder: UntypedFormBuilder
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.servers = this.settingsService.servers;
|
||||
this.existMoreThanOneServer = (this.servers && this.servers.length > 1);
|
||||
this.existMoreThanOneServer = this.servers && this.servers.length > 1;
|
||||
if (!this.existMoreThanOneServer) {
|
||||
this.settingsService.setServer(this.servers[0]);
|
||||
} else {
|
||||
this.existMoreThanOneServer = true;
|
||||
this.serverSelector.patchValue(this.settingsService.server);
|
||||
this.form = this.formBuilder.group({
|
||||
'url': ['', [Validators.required]],
|
||||
url: [
|
||||
'',
|
||||
[Validators.required]
|
||||
]
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -57,7 +60,6 @@ export class ServerSelectorComponent implements OnInit {
|
||||
this.settingsService.setServer(this.serverSelector.value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add new server to the list.
|
||||
*/
|
||||
@@ -69,5 +71,4 @@ export class ServerSelectorComponent implements OnInit {
|
||||
this.settingsService.setServers(servers);
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -144,4 +144,4 @@ import { InputAmountComponent } from './input-amount/input-amount.component';
|
||||
InputAmountComponent
|
||||
]
|
||||
})
|
||||
export class SharedModule { }
|
||||
export class SharedModule {}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('StepperButtonsComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ StepperButtonsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [StepperButtonsComponent]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(StepperButtonsComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
@@ -6,10 +6,8 @@ import { Component, Input, OnInit } from '@angular/core';
|
||||
styleUrls: ['./stepper-buttons.component.scss']
|
||||
})
|
||||
export class StepperButtonsComponent {
|
||||
|
||||
@Input() disablePrevious = false;
|
||||
@Input() disableNext = false;
|
||||
|
||||
constructor() { }
|
||||
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('SvgIconComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ SvgIconComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [SvgIconComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -11,6 +11,5 @@ export class SvgIconComponent {
|
||||
@Input() iconClass: string;
|
||||
@Input() iconWidth: string;
|
||||
|
||||
constructor() { }
|
||||
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('DatatableMultiRowComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ DatatableMultiRowComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [DatatableMultiRowComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+32
-23
@@ -22,7 +22,6 @@ import * as _ from 'lodash';
|
||||
styleUrls: ['./datatable-multi-row.component.scss']
|
||||
})
|
||||
export class DatatableMultiRowComponent implements OnInit, OnDestroy, OnChanges {
|
||||
|
||||
SELECT_NAME_FIELD = 'select';
|
||||
/** Data Object */
|
||||
@Input() dataObject: any;
|
||||
@@ -55,15 +54,17 @@ export class DatatableMultiRowComponent implements OnInit, OnDestroy, OnChanges
|
||||
* @param {MatDialog} dialog Mat Dialog.
|
||||
* @param {Datatables} datatables Datatable utils
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private dateUtils: Dates,
|
||||
private systemService: SystemService,
|
||||
private settingsService: SettingsService,
|
||||
private dialog: MatDialog,
|
||||
private datatables: Datatables,
|
||||
private dateFormat: DateFormatPipe,
|
||||
private dateTimeFormat: DatetimeFormatPipe,
|
||||
private numberFormat: DecimalPipe) { }
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private dateUtils: Dates,
|
||||
private systemService: SystemService,
|
||||
private settingsService: SettingsService,
|
||||
private dialog: MatDialog,
|
||||
private datatables: Datatables,
|
||||
private dateFormat: DateFormatPipe,
|
||||
private dateTimeFormat: DatetimeFormatPipe,
|
||||
private numberFormat: DecimalPipe
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Fetches data table name from route params.
|
||||
@@ -117,7 +118,7 @@ export class DatatableMultiRowComponent implements OnInit, OnDestroy, OnChanges
|
||||
}
|
||||
this.isSelected = false;
|
||||
this.isLoading = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,7 +128,11 @@ export class DatatableMultiRowComponent implements OnInit, OnDestroy, OnChanges
|
||||
let dataTableEntryObject: any = { locale: this.settingsService.language.code };
|
||||
const dateTransformColumns: string[] = [];
|
||||
const columns = this.datatables.filterSystemColumns(this.dataObject.columnHeaders);
|
||||
const formfields: FormfieldBase[] = this.datatables.getFormfields(columns, dateTransformColumns, dataTableEntryObject);
|
||||
const formfields: FormfieldBase[] = this.datatables.getFormfields(
|
||||
columns,
|
||||
dateTransformColumns,
|
||||
dataTableEntryObject
|
||||
);
|
||||
const data = {
|
||||
title: 'Add ' + this.datatableName + ' for ' + this.entityType,
|
||||
formfields: formfields
|
||||
@@ -136,12 +141,17 @@ export class DatatableMultiRowComponent implements OnInit, OnDestroy, OnChanges
|
||||
addDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.data) {
|
||||
dateTransformColumns.forEach((column) => {
|
||||
response.data.value[column] = this.dateUtils.formatDate(response.data.value[column], dataTableEntryObject.dateFormat);
|
||||
response.data.value[column] = this.dateUtils.formatDate(
|
||||
response.data.value[column],
|
||||
dataTableEntryObject.dateFormat
|
||||
);
|
||||
});
|
||||
dataTableEntryObject = { ...response.data.value, ...dataTableEntryObject };
|
||||
this.systemService.addEntityDatatableEntry(this.entityId, this.datatableName, dataTableEntryObject).subscribe((result: any) => {
|
||||
this.getData();
|
||||
});
|
||||
this.systemService
|
||||
.addEntityDatatableEntry(this.entityId, this.datatableName, dataTableEntryObject)
|
||||
.subscribe((result: any) => {
|
||||
this.getData();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -179,14 +189,14 @@ export class DatatableMultiRowComponent implements OnInit, OnDestroy, OnChanges
|
||||
this.datatableData.splice(index, 1);
|
||||
this.dataTableRef.renderRows();
|
||||
this.selection = new SelectionModel(true, []);
|
||||
this.isSelected = (this.selection.selected.length > 0);
|
||||
this.isSelected = this.selection.selected.length > 0;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.selection = new SelectionModel(true, []);
|
||||
this.isSelected = (this.selection.selected.length > 0);
|
||||
this.isSelected = this.selection.selected.length > 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -219,11 +229,11 @@ export class DatatableMultiRowComponent implements OnInit, OnDestroy, OnChanges
|
||||
/** Whether the number of selected elements matches the total number of rows. */
|
||||
isAllSelected() {
|
||||
const numSelected = this.selection.selected;
|
||||
return (this.datatableData.length === numSelected);
|
||||
return this.datatableData.length === numSelected;
|
||||
}
|
||||
|
||||
isAnySelected() {
|
||||
return (this.selection.selected && this.selection.selected.length > 0);
|
||||
return this.selection.selected && this.selection.selected.length > 0;
|
||||
}
|
||||
|
||||
/** Selects all rows if they are not all selected; otherwise clear selection. */
|
||||
@@ -233,12 +243,12 @@ export class DatatableMultiRowComponent implements OnInit, OnDestroy, OnChanges
|
||||
} else {
|
||||
this.selection = new SelectionModel(true, []);
|
||||
}
|
||||
this.isSelected = (this.selection.selected.length > 0);
|
||||
this.isSelected = this.selection.selected.length > 0;
|
||||
}
|
||||
|
||||
itemToggle(data: any): void {
|
||||
this.selection.toggle(data);
|
||||
this.isSelected = (this.selection.selected.length > 0);
|
||||
this.isSelected = this.selection.selected.length > 0;
|
||||
}
|
||||
|
||||
/** The label for the checkbox on the passed row */
|
||||
@@ -259,5 +269,4 @@ export class DatatableMultiRowComponent implements OnInit, OnDestroy, OnChanges
|
||||
getInputName(attr: string): string {
|
||||
return this.datatables.getName(attr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('DatatableSingleRowComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ DatatableSingleRowComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [DatatableSingleRowComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+49
-26
@@ -15,7 +15,6 @@ import { SystemService } from 'app/system/system.service';
|
||||
styleUrls: ['./datatable-single-row.component.scss']
|
||||
})
|
||||
export class DatatableSingleRowComponent implements OnInit {
|
||||
|
||||
@Input() dataObject: any;
|
||||
@Input() entityId: string;
|
||||
@Input() entityType: string;
|
||||
@@ -28,12 +27,14 @@ export class DatatableSingleRowComponent implements OnInit {
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
* @param {Datatables} datatables Datatable utils
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private dateUtils: Dates,
|
||||
private dialog: MatDialog,
|
||||
private settingsService: SettingsService,
|
||||
private datatables: Datatables,
|
||||
private systemService: SystemService) { }
|
||||
private systemService: SystemService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.params.subscribe((routeParams: any) => {
|
||||
@@ -47,7 +48,11 @@ export class DatatableSingleRowComponent implements OnInit {
|
||||
};
|
||||
const dateTransformColumns: string[] = [];
|
||||
const columns = this.datatables.filterSystemColumns(this.dataObject.columnHeaders);
|
||||
const formfields: FormfieldBase[] = this.datatables.getFormfields(columns, dateTransformColumns, dataTableEntryObject);
|
||||
const formfields: FormfieldBase[] = this.datatables.getFormfields(
|
||||
columns,
|
||||
dateTransformColumns,
|
||||
dataTableEntryObject
|
||||
);
|
||||
const data = {
|
||||
title: 'Add ' + this.datatableName + ' for ' + this.entityType,
|
||||
formfields: formfields
|
||||
@@ -56,14 +61,19 @@ export class DatatableSingleRowComponent implements OnInit {
|
||||
addDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.data) {
|
||||
dateTransformColumns.forEach((column) => {
|
||||
response.data.value[column] = this.dateUtils.formatDate(response.data.value[column], dataTableEntryObject.dateFormat);
|
||||
response.data.value[column] = this.dateUtils.formatDate(
|
||||
response.data.value[column],
|
||||
dataTableEntryObject.dateFormat
|
||||
);
|
||||
});
|
||||
dataTableEntryObject = { ...response.data.value, ...dataTableEntryObject };
|
||||
this.systemService.addEntityDatatableEntry(this.entityId, this.datatableName, dataTableEntryObject).subscribe(() => {
|
||||
this.systemService.getEntityDatatable(this.entityId, this.datatableName).subscribe((dataObject: any) => {
|
||||
this.dataObject = dataObject;
|
||||
this.systemService
|
||||
.addEntityDatatableEntry(this.entityId, this.datatableName, dataTableEntryObject)
|
||||
.subscribe(() => {
|
||||
this.systemService.getEntityDatatable(this.entityId, this.datatableName).subscribe((dataObject: any) => {
|
||||
this.dataObject = dataObject;
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -74,34 +84,49 @@ export class DatatableSingleRowComponent implements OnInit {
|
||||
};
|
||||
const dateTransformColumns: string[] = [];
|
||||
const columns = this.datatables.filterSystemColumns(this.dataObject.columnHeaders);
|
||||
let formfields: FormfieldBase[] = this.datatables.getFormfields(columns, dateTransformColumns, dataTableEntryObject);
|
||||
let formfields: FormfieldBase[] = this.datatables.getFormfields(
|
||||
columns,
|
||||
dateTransformColumns,
|
||||
dataTableEntryObject
|
||||
);
|
||||
formfields = formfields.map((formfield: FormfieldBase, index: number) => {
|
||||
if (formfield.controlType === 'datepicker') {
|
||||
formfield.value = (this.dataObject.data[0].row[columns[index].idx]) ? this.dateUtils.parseDate(this.dataObject.data[0].row[columns[index].idx]) : '';
|
||||
formfield.value = this.dataObject.data[0].row[columns[index].idx]
|
||||
? this.dateUtils.parseDate(this.dataObject.data[0].row[columns[index].idx])
|
||||
: '';
|
||||
} else if (formfield.controlType === 'datetimepicker') {
|
||||
formfield.value = (this.dataObject.data[0].row[columns[index].idx]) ? this.dateUtils.parseDatetime(this.dataObject.data[0].row[columns[index].idx]) : '';
|
||||
formfield.value = this.dataObject.data[0].row[columns[index].idx]
|
||||
? this.dateUtils.parseDatetime(this.dataObject.data[0].row[columns[index].idx])
|
||||
: '';
|
||||
} else {
|
||||
formfield.value = (this.dataObject.data[0].row[columns[index].idx]) ? this.dataObject.data[0].row[columns[index].idx] : '';
|
||||
formfield.value = this.dataObject.data[0].row[columns[index].idx]
|
||||
? this.dataObject.data[0].row[columns[index].idx]
|
||||
: '';
|
||||
}
|
||||
return formfield;
|
||||
});
|
||||
const data = {
|
||||
title: 'Edit ' + this.datatableName + ' for ' + this.entityType,
|
||||
formfields: formfields,
|
||||
layout: {addButtonText: 'Save'}
|
||||
layout: { addButtonText: 'Save' }
|
||||
};
|
||||
const editDialogRef = this.dialog.open(FormDialogComponent, { data, width: '50rem' });
|
||||
editDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.data) {
|
||||
dateTransformColumns.forEach((column) => {
|
||||
response.data.value[column] = this.dateUtils.formatDate(response.data.value[column], dataTableEntryObject.dateFormat);
|
||||
response.data.value[column] = this.dateUtils.formatDate(
|
||||
response.data.value[column],
|
||||
dataTableEntryObject.dateFormat
|
||||
);
|
||||
});
|
||||
dataTableEntryObject = { ...response.data.value, ...dataTableEntryObject };
|
||||
this.systemService.editEntityDatatableEntry(this.entityId, this.datatableName, dataTableEntryObject).subscribe(() => {
|
||||
this.systemService.getEntityDatatable(this.entityId, this.datatableName).subscribe((dataObject: any) => {
|
||||
this.dataObject = dataObject;
|
||||
this.systemService
|
||||
.editEntityDatatableEntry(this.entityId, this.datatableName, dataTableEntryObject)
|
||||
.subscribe(() => {
|
||||
this.systemService.getEntityDatatable(this.entityId, this.datatableName).subscribe((dataObject: any) => {
|
||||
this.dataObject = dataObject;
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -112,13 +137,12 @@ export class DatatableSingleRowComponent implements OnInit {
|
||||
});
|
||||
deleteDataTableDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
this.systemService.deleteDatatableContent(this.entityId, this.datatableName)
|
||||
.subscribe(() => {
|
||||
this.systemService.getEntityDatatable(this.entityId, this.datatableName).subscribe((dataObject: any) => {
|
||||
this.dataObject = dataObject;
|
||||
});
|
||||
this.systemService.deleteDatatableContent(this.entityId, this.datatableName).subscribe(() => {
|
||||
this.systemService.getEntityDatatable(this.entityId, this.datatableName).subscribe((dataObject: any) => {
|
||||
this.dataObject = dataObject;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -167,5 +191,4 @@ export class DatatableSingleRowComponent implements OnInit {
|
||||
openSite(siteUrl: string) {
|
||||
window.open(siteUrl, '_blank');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('EntityDatatableTabComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ EntityDatatableTabComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EntityDatatableTabComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -6,12 +6,10 @@ import { Component, Input } from '@angular/core';
|
||||
styleUrls: ['./entity-datatable-tab.component.scss']
|
||||
})
|
||||
export class EntityDatatableTabComponent {
|
||||
|
||||
@Input() multiRowDatatableFlag = false;
|
||||
@Input() entityDatatable: any;
|
||||
@Input() entityType: string;
|
||||
@Input() entityId: string;
|
||||
|
||||
constructor() { }
|
||||
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('EntityDocumentsTabComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ EntityDocumentsTabComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EntityDocumentsTabComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -32,7 +32,12 @@ export class EntityDocumentsTabComponent implements OnInit {
|
||||
choice: boolean;
|
||||
|
||||
/** Columns to be displayed in loan documents table. */
|
||||
displayedColumns: string[] = ['name', 'description', 'filename', 'actions'];
|
||||
displayedColumns: string[] = [
|
||||
'name',
|
||||
'description',
|
||||
'filename',
|
||||
'actions'
|
||||
];
|
||||
/** Data source for loan documents table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -48,10 +53,12 @@ export class EntityDocumentsTabComponent implements OnInit {
|
||||
* @param {LoansService} loansService Loan Account services.
|
||||
* @param {ClientsService} clientsService Client services.
|
||||
*/
|
||||
constructor(public dialog: MatDialog,
|
||||
constructor(
|
||||
public dialog: MatDialog,
|
||||
private savingsService: SavingsService,
|
||||
private loansService: LoansService,
|
||||
private clientsService: ClientsService) { }
|
||||
private clientsService: ClientsService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.dataSource = new MatTableDataSource(this.entityDocuments);
|
||||
@@ -69,7 +76,7 @@ export class EntityDocumentsTabComponent implements OnInit {
|
||||
});
|
||||
uploadDocumentDialogRef.afterClosed().subscribe((dialogResponse: any) => {
|
||||
if (dialogResponse) {
|
||||
const formData: FormData = new FormData;
|
||||
const formData: FormData = new FormData();
|
||||
formData.append('name', dialogResponse.fileName);
|
||||
formData.append('file', dialogResponse.file);
|
||||
formData.append('description', dialogResponse.description);
|
||||
@@ -104,5 +111,4 @@ export class EntityDocumentsTabComponent implements OnInit {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('EntityNotesTabComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ EntityNotesTabComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EntityNotesTabComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -14,7 +14,6 @@ import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.componen
|
||||
styleUrls: ['./entity-notes-tab.component.scss']
|
||||
})
|
||||
export class EntityNotesTabComponent implements OnInit {
|
||||
|
||||
@ViewChild('formRef', { static: true }) formRef: any;
|
||||
|
||||
@Input() entityId: string;
|
||||
@@ -26,12 +25,14 @@ export class EntityNotesTabComponent implements OnInit {
|
||||
|
||||
noteForm: UntypedFormGroup;
|
||||
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private savingsService: SavingsService,
|
||||
private loansService: LoansService,
|
||||
private clientsService: ClientsService,
|
||||
private groupsService: GroupsService,
|
||||
private dialog: MatDialog) { }
|
||||
private dialog: MatDialog
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.createNoteForm();
|
||||
@@ -39,7 +40,10 @@ export class EntityNotesTabComponent implements OnInit {
|
||||
|
||||
createNoteForm() {
|
||||
this.noteForm = this.formBuilder.group({
|
||||
'note': ['', Validators.required]
|
||||
note: [
|
||||
'',
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -50,19 +54,22 @@ export class EntityNotesTabComponent implements OnInit {
|
||||
|
||||
editNote(noteId: string, noteContent: string, index: number) {
|
||||
const editNoteDialogRef = this.dialog.open(FormDialogComponent, {
|
||||
data: { formfields: [{
|
||||
controlName: 'note',
|
||||
required: true,
|
||||
value: noteContent,
|
||||
controlType: 'input',
|
||||
label: 'Note'
|
||||
}],
|
||||
layout: {
|
||||
columns: 1,
|
||||
addButtonText: 'Confirm'
|
||||
},
|
||||
title: 'Edit Note'
|
||||
}
|
||||
data: {
|
||||
formfields: [
|
||||
{
|
||||
controlName: 'note',
|
||||
required: true,
|
||||
value: noteContent,
|
||||
controlType: 'input',
|
||||
label: 'Note'
|
||||
}
|
||||
],
|
||||
layout: {
|
||||
columns: 1,
|
||||
addButtonText: 'Confirm'
|
||||
},
|
||||
title: 'Edit Note'
|
||||
}
|
||||
});
|
||||
editNoteDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.data && response.data.value.note !== noteContent) {
|
||||
@@ -81,5 +88,4 @@ export class EntityNotesTabComponent implements OnInit {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('TenantSelectorComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ TenantSelectorComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [TenantSelectorComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -8,7 +8,6 @@ import { SettingsService } from 'app/settings/settings.service';
|
||||
styleUrls: ['./tenant-selector.component.scss']
|
||||
})
|
||||
export class TenantSelectorComponent implements OnInit {
|
||||
|
||||
/** Tenant selector form control. */
|
||||
tenantSelector = new UntypedFormControl();
|
||||
|
||||
@@ -16,7 +15,7 @@ export class TenantSelectorComponent implements OnInit {
|
||||
* Sets the Tenant Identifier of the application in the selector on initial setup.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
*/
|
||||
constructor(private settingsService: SettingsService) { }
|
||||
constructor(private settingsService: SettingsService) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.tenantSelector.setValue(this.settingsService.tenantIdentifier);
|
||||
@@ -35,7 +34,6 @@ export class TenantSelectorComponent implements OnInit {
|
||||
}
|
||||
|
||||
allowSelection(): boolean {
|
||||
return (this.tenants.length > 1);
|
||||
return this.tenants.length > 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,11 +8,10 @@ import { Injectable } from '@angular/core';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ThemeManagerService {
|
||||
|
||||
/** Stylesheet class for the theme of the application. */
|
||||
private themeManagerClass = 'theme-manager';
|
||||
|
||||
constructor() { }
|
||||
constructor() {}
|
||||
|
||||
/**
|
||||
* Sets a new theme for the application.
|
||||
@@ -56,5 +55,4 @@ export class ThemeManagerService {
|
||||
document.head.appendChild(linkElement);
|
||||
return linkElement;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ThemePickerComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ThemePickerComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ThemePickerComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -19,7 +19,6 @@ import { ThemeStorageService } from './theme-storage.service';
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class ThemePickerComponent implements OnInit {
|
||||
|
||||
/** Default theme for the application. */
|
||||
currentTheme: Theme = {
|
||||
href: 'denim-yellowgreen.css',
|
||||
@@ -41,7 +40,7 @@ export class ThemePickerComponent implements OnInit {
|
||||
href: 'indigo-pink.css',
|
||||
primary: '#3F51B5',
|
||||
accent: '#E91E63',
|
||||
isDark: false,
|
||||
isDark: false
|
||||
},
|
||||
{
|
||||
href: 'deeppurple-amber.css',
|
||||
@@ -66,7 +65,7 @@ export class ThemePickerComponent implements OnInit {
|
||||
/**
|
||||
* @param {ThemeStorageService} themeStorageService Theme Storage Service.
|
||||
*/
|
||||
constructor(public themeStorageService: ThemeStorageService) { }
|
||||
constructor(public themeStorageService: ThemeStorageService) {}
|
||||
|
||||
/**
|
||||
* Initializes the theme for the application.
|
||||
@@ -86,5 +85,4 @@ export class ThemePickerComponent implements OnInit {
|
||||
this.currentTheme = theme;
|
||||
this.themeStorageService.installTheme(theme);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/** Angular Imports */
|
||||
import {Injectable, EventEmitter} from '@angular/core';
|
||||
import { Injectable, EventEmitter } from '@angular/core';
|
||||
|
||||
/** Custom Model */
|
||||
import { Theme } from './theme.model';
|
||||
@@ -14,7 +14,6 @@ import { ThemeManagerService } from './theme-manager.service';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ThemeStorageService {
|
||||
|
||||
/** Key to store current theme of application in local storage. */
|
||||
private themeStorageKey = 'mifosXTheme';
|
||||
/** Theme update event. */
|
||||
@@ -63,5 +62,4 @@ export class ThemeStorageService {
|
||||
}
|
||||
this.storeTheme(theme);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ThemeToggleComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ThemeToggleComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ThemeToggleComponent]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(ThemeToggleComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
@@ -8,18 +8,19 @@ import { SettingsService } from 'app/settings/settings.service';
|
||||
styleUrls: ['./theme-toggle.component.scss']
|
||||
})
|
||||
export class ThemeToggleComponent implements OnInit, OnChanges {
|
||||
|
||||
darkModeOn: boolean;
|
||||
|
||||
constructor(private themingService: ThemingService,
|
||||
private settingsService: SettingsService) { }
|
||||
constructor(
|
||||
private themingService: ThemingService,
|
||||
private settingsService: SettingsService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.darkModeOn = (this.settingsService.themeDarkEnabled === 'true');
|
||||
this.darkModeOn = this.settingsService.themeDarkEnabled === 'true';
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
this.darkModeOn = (this.settingsService.themeDarkEnabled === 'true');
|
||||
this.darkModeOn = this.settingsService.themeDarkEnabled === 'true';
|
||||
}
|
||||
|
||||
toggleTheme() {
|
||||
@@ -27,5 +28,4 @@ export class ThemeToggleComponent implements OnInit, OnChanges {
|
||||
this.settingsService.setThemeDarkEnabled(this.darkModeOn ? 'true' : 'false');
|
||||
this.themingService.setDarkMode(this.darkModeOn);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,20 +7,21 @@ import { BehaviorSubject } from 'rxjs';
|
||||
export class ThemingService {
|
||||
private darkModeOn = false;
|
||||
|
||||
themes = ['dark-theme', 'light-theme']; // <- list all themes in this array
|
||||
themes = [
|
||||
'dark-theme',
|
||||
'light-theme'
|
||||
]; // <- list all themes in this array
|
||||
theme = new BehaviorSubject('light-theme'); // <- initial theme
|
||||
|
||||
constructor(private ref: ApplicationRef) {
|
||||
// Initially check if dark mode is enabled on system
|
||||
this.darkModeOn =
|
||||
window.matchMedia &&
|
||||
window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||
this.darkModeOn = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||
|
||||
// If dark mode is enabled then directly switch to the dark-theme
|
||||
this.setDarkMode(this.darkModeOn);
|
||||
|
||||
// Watch for changes of the preference
|
||||
window.matchMedia('(prefers-color-scheme: dark)').addListener(e => {
|
||||
window.matchMedia('(prefers-color-scheme: dark)').addListener((e) => {
|
||||
const turnOn = e.matches;
|
||||
this.theme.next(turnOn ? 'dark-theme' : 'light-theme');
|
||||
|
||||
@@ -30,9 +31,7 @@ export class ThemingService {
|
||||
}
|
||||
|
||||
isDarkMode(): boolean {
|
||||
this.darkModeOn =
|
||||
window.matchMedia &&
|
||||
window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||
this.darkModeOn = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||
return this.darkModeOn;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,5 +12,3 @@ export interface PaymentDetail {
|
||||
receiptNumber: string;
|
||||
bankNumber: string;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('TransactionPaymentDetailComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ TransactionPaymentDetailComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [TransactionPaymentDetailComponent]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(TransactionPaymentDetailComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { PaymentDetail } from './payment-detail-model';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-transaction-payment-detail',
|
||||
templateUrl: './transaction-payment-detail.component.html',
|
||||
styleUrls: ['./transaction-payment-detail.component.scss']
|
||||
})
|
||||
export class TransactionPaymentDetailComponent {
|
||||
|
||||
@Input() paymentDetailData: PaymentDetail;
|
||||
|
||||
constructor() {}
|
||||
@@ -24,7 +22,6 @@ export class TransactionPaymentDetailComponent {
|
||||
}
|
||||
|
||||
isNotNullOrEmpty(value: any): boolean {
|
||||
return (value !== null && value !== '');
|
||||
return value !== null && value !== '';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { AbstractControl, ValidatorFn } from '@angular/forms';
|
||||
|
||||
export function rangeValidator(min: number, max: number): ValidatorFn {
|
||||
|
||||
return (control: AbstractControl): { [key: string]: boolean } | null => {
|
||||
if (control.value !== undefined && (isNaN(control.value) || control.value < min || control.value > max)) {
|
||||
return { 'range': true };
|
||||
return { range: true };
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user