refactor: savings module (#1226)

See: #1196
This commit is contained in:
Karan Takalkar
2020-08-25 17:46:54 +05:30
committed by GitHub
parent f215e1aa96
commit efdd779aa9
30 changed files with 129 additions and 103 deletions
@@ -108,7 +108,6 @@ export class EditSavingsAccountComponent {
const monthDayFormat = 'dd MMMM';
const savingsAccount = {
...this.savingsAccount,
clientId: this.savingsAccountAndTemplate.clientId,
charges: this.savingsAccount.charges.map((charge: any) => ({
chargeId: charge.id,
amount: charge.amount,
@@ -121,6 +120,11 @@ export class EditSavingsAccountComponent {
monthDayFormat,
locale
};
if (this.savingsAccountAndTemplate.clientId) {
savingsAccount.clientId = this.savingsAccountAndTemplate.clientId;
} else {
savingsAccount.groupId = this.savingsAccountAndTemplate.groupId;
}
this.savingsService.updateSavingsAccount(this.savingsAccountAndTemplate.id, savingsAccount).subscribe((response: any) => {
this.router.navigate(['../'], { relativeTo: this.route });
});