diff --git a/src/app/current-accounts/common-resolvers/current-account-actions.resolver.ts b/src/app/current-accounts/common-resolvers/current-account-actions.resolver.ts index 9197404d6..fbc813881 100644 --- a/src/app/current-accounts/common-resolvers/current-account-actions.resolver.ts +++ b/src/app/current-accounts/common-resolvers/current-account-actions.resolver.ts @@ -69,6 +69,7 @@ export class CurrentAccountActionsResolver { this.currentAccountsService.getCurrentAccountTransactionTemplateResource(currentAccountId), this.currentAccountsService.getCurrentAccountData(currentAccountId) ]); + case 'Activate': case 'Apply Annual Fees': return this.currentAccountsService.getCurrentAccountData(currentAccountId); default: diff --git a/src/app/current-accounts/current-account-actions/activate-current-account/activate-current-account.component.html b/src/app/current-accounts/current-account-actions/activate-current-account/activate-current-account.component.html index 19abc5fdc..7b9e69031 100644 --- a/src/app/current-accounts/current-account-actions/activate-current-account/activate-current-account.component.html +++ b/src/app/current-accounts/current-account-actions/activate-current-account/activate-current-account.component.html @@ -30,6 +30,18 @@ } + + + Opening Balance + + ₹  + @if (minRequiredOpeningBalance) { + Minimum required: ₹{{ minRequiredOpeningBalance }} + } + @if (activateCurrentAccountForm.controls.openingBalance.hasError('min')) { + Opening balance must be at least ₹{{ minRequiredOpeningBalance ?? 0 }} + } + diff --git a/src/app/current-accounts/current-account-actions/activate-current-account/activate-current-account.component.ts b/src/app/current-accounts/current-account-actions/activate-current-account/activate-current-account.component.ts index ae85c6d92..98701b637 100644 --- a/src/app/current-accounts/current-account-actions/activate-current-account/activate-current-account.component.ts +++ b/src/app/current-accounts/current-account-actions/activate-current-account/activate-current-account.component.ts @@ -7,7 +7,7 @@ */ /** Angular Imports */ -import { Component, OnInit, inject } from '@angular/core'; +import { Component, OnInit, Input, inject } from '@angular/core'; import { UntypedFormGroup, UntypedFormBuilder, Validators, ReactiveFormsModule } from '@angular/forms'; import { ActivatedRoute, Router, RouterLink } from '@angular/router'; import { Dates } from 'app/core/utils/dates'; @@ -36,6 +36,8 @@ export class ActivateCurrentAccountComponent implements OnInit { private router = inject(Router); private settingsService = inject(SettingsService); + @Input() minRequiredOpeningBalance: number | null = null; + /** Minimum date allowed. */ minDate = new Date(2000, 0, 1); /** Maximum date allowed. */ @@ -69,10 +71,18 @@ export class ActivateCurrentAccountComponent implements OnInit { * Creates the activate current account form. */ createActivateCurrentAccountForm() { + const minBalance = this.minRequiredOpeningBalance ?? 0; this.activateCurrentAccountForm = this.formBuilder.group({ activatedOnDate: [ '', Validators.required + ], + openingBalance: [ + minBalance, + [ + Validators.required, + Validators.min(minBalance) + ] ] }); } diff --git a/src/app/current-accounts/current-account-actions/current-account-actions.component.html b/src/app/current-accounts/current-account-actions/current-account-actions.component.html index b1442a445..b89775310 100644 --- a/src/app/current-accounts/current-account-actions/current-account-actions.component.html +++ b/src/app/current-accounts/current-account-actions/current-account-actions.component.html @@ -13,7 +13,9 @@ } @if (actions['Activate']) { - + } @if (actions['Undo Approval']) { diff --git a/src/app/current-accounts/current-account-actions/current-account-actions.component.ts b/src/app/current-accounts/current-account-actions/current-account-actions.component.ts index ac9d3bbc3..7cd7c51be 100644 --- a/src/app/current-accounts/current-account-actions/current-account-actions.component.ts +++ b/src/app/current-accounts/current-account-actions/current-account-actions.component.ts @@ -102,10 +102,13 @@ export class CurrentAccountActionsComponent { /** * @param {ActivatedRoute} route Activated Route */ + accountData: any; + constructor() { this.route.data.subscribe((data: { currentAccountActionData: any }) => { if (data.currentAccountActionData) { this.currency = data.currentAccountActionData.currency; + this.accountData = data.currentAccountActionData; } }); const name = this.route.snapshot.params['name'] as string; diff --git a/src/app/current-accounts/current-account-view/charges-tab/charges-tab.component.html b/src/app/current-accounts/current-account-view/charges-tab/charges-tab.component.html index b9d8150c5..e13ff2c12 100644 --- a/src/app/current-accounts/current-account-view/charges-tab/charges-tab.component.html +++ b/src/app/current-accounts/current-account-view/charges-tab/charges-tab.component.html @@ -43,44 +43,46 @@ {{ 'labels.inputs.Due As Of' | translate }} - {{ charge.dueDate | dateFormat }} + {{ charge.chargeDueDate | dateFormat }} {{ 'labels.inputs.Repeats On (M/d)' | translate }} - {{ charge.feeOnMonthDay ? charge.feeOnMonthDay.join('/') : '' }} + + {{ charge.feeOnMonthDay ? charge.feeOnMonthDay.month + '/' + charge.feeOnMonthDay.day : '' }} + {{ 'labels.inputs.Calculation Type' | translate }} - {{ charge.chargeCalculationType.value | translateKey: 'catalogs' }} + {{ charge.chargeCalculationType?.value | translateKey: 'catalogs' }} {{ 'labels.inputs.Due' | translate }} - {{ charge.amount | currency: charge.currency.code : 'symbol-narrow' : '1.2-2' }} + {{ charge.amount | currency: currentAccountData.currency.code : 'symbol-narrow' : '1.2-2' }} {{ 'labels.inputs.Paid' | translate }} - {{ charge.amountPaid | currency: charge.currency.code : 'symbol-narrow' : '1.2-2' }} + {{ charge.amountPaid | currency: currentAccountData.currency.code : 'symbol-narrow' : '1.2-2' }} {{ 'labels.inputs.Waived' | translate }} - {{ charge.amountWaived | currency: charge.currency.code : 'symbol-narrow' : '1.2-2' }} + {{ charge.amountWaived | currency: currentAccountData.currency.code : 'symbol-narrow' : '1.2-2' }} {{ 'labels.inputs.Outstanding' | translate }} - {{ charge.amountOutstanding | currency: charge.currency.code : 'symbol-narrow' : '1.2-2' }} + {{ charge.amountOutstanding | currency: currentAccountData.currency.code : 'symbol-narrow' : '1.2-2' }} diff --git a/src/app/current-accounts/current-account-view/current-account-view.component.ts b/src/app/current-accounts/current-account-view/current-account-view.component.ts index 67746577e..f6b6522a2 100644 --- a/src/app/current-accounts/current-account-view/current-account-view.component.ts +++ b/src/app/current-accounts/current-account-view/current-account-view.component.ts @@ -127,7 +127,7 @@ export class CurrentAccountViewComponent implements OnInit { */ setConditionalButtons() { const status = this.currentAccountData.status.value; - this.isActive = status === 'Active'; + this.isActive = status === 'Active' || status === 'active'; const subStatus = this.currentAccountData.subStatus; this.buttonConfig = new CurrentAccountButtonsConfiguration(status, subStatus); if (this.currentAccountData.clientId) { diff --git a/src/app/current-accounts/current-account-view/current-accounts-buttons.config.ts b/src/app/current-accounts/current-account-view/current-accounts-buttons.config.ts index 8c56acba3..e72cc8c0b 100644 --- a/src/app/current-accounts/current-account-view/current-accounts-buttons.config.ts +++ b/src/app/current-accounts/current-account-view/current-accounts-buttons.config.ts @@ -109,6 +109,7 @@ export class CurrentAccountButtonsConfiguration { ]; } break; + case 'Submitted and Pending Approval': case 'Submitted and pending approval': this.buttonsArray = [ { @@ -165,6 +166,7 @@ export class CurrentAccountButtonsConfiguration { } ]; break; + case 'Submitted and Pending Approval': case 'Submitted and pending approval': this.optionArray = [ { diff --git a/src/app/current-accounts/current-account-view/passbook-tab/passbook-tab.component.html b/src/app/current-accounts/current-account-view/passbook-tab/passbook-tab.component.html index 8b4a9dbbd..913e893d7 100644 --- a/src/app/current-accounts/current-account-view/passbook-tab/passbook-tab.component.html +++ b/src/app/current-accounts/current-account-view/passbook-tab/passbook-tab.component.html @@ -24,13 +24,7 @@ - @@ -137,7 +131,11 @@ } @else {
info_outline - {{ 'labels.text.No transactions found for the selected date range.' | translate }} + {{ + isFiltered + ? ('labels.text.No transactions found for the selected date range.' | translate) + : 'No transactions found.' + }}
} diff --git a/src/app/current-accounts/current-account-view/passbook-tab/passbook-tab.component.ts b/src/app/current-accounts/current-account-view/passbook-tab/passbook-tab.component.ts index 4c84c1205..71517bdfd 100644 --- a/src/app/current-accounts/current-account-view/passbook-tab/passbook-tab.component.ts +++ b/src/app/current-accounts/current-account-view/passbook-tab/passbook-tab.component.ts @@ -9,7 +9,7 @@ /** Angular Imports */ import { Component, OnInit, OnDestroy, inject, ElementRef, ViewChild } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; -import { UntypedFormBuilder, Validators } from '@angular/forms'; +import { UntypedFormBuilder } from '@angular/forms'; import { CurrencyPipe } from '@angular/common'; import { Subject, takeUntil } from 'rxjs'; @@ -84,19 +84,31 @@ export class PassbookTabComponent implements OnInit, OnDestroy { this.accountBalance = account.summary?.accountBalance || 0; this.availableBalance = account.summary?.availableBalance || 0; this.activatedOnDate = account.timeline?.activatedOnDate || null; - this.allTransactions = account.transactions || []; + this.allTransactions = this.computeRunningBalances(account.transactions || []); this.filteredTransactions = [...this.allTransactions]; }); this.dateRangeForm = this.formBuilder.group({ - fromDate: [ - '', - Validators.required - ], - toDate: [ - '', - Validators.required - ] + fromDate: [''], + toDate: [''] + }); + } + + private computeRunningBalances(transactions: CurrentAccountTransaction[]): CurrentAccountTransaction[] { + let balance = 0; + return transactions.map((txn) => { + if (txn.runningBalance != null) { + balance = txn.runningBalance; + } else { + const amount = txn.amount || 0; + if (this.isDebit(txn.transactionType)) { + balance = balance - amount; + } else { + balance = balance + amount; + } + txn = { ...txn, runningBalance: balance }; + } + return txn; }); } @@ -113,14 +125,15 @@ export class PassbookTabComponent implements OnInit, OnDestroy { const fromDate = this.dateRangeForm.value.fromDate; const toDate = this.dateRangeForm.value.toDate; - if (!fromDate || !toDate) return; - - const from = new Date(fromDate).getTime(); - const to = new Date(toDate).getTime(); - this.filteredTransactions = this.allTransactions.filter((txn: CurrentAccountTransaction) => { const txnDate = this.getTransactionDateAsTime(txn.date); - return txnDate >= from && txnDate <= to; + if (fromDate && new Date(fromDate).getTime() > txnDate) return false; + if (toDate) { + const toEnd = new Date(toDate); + toEnd.setHours(23, 59, 59, 999); + if (toEnd.getTime() < txnDate) return false; + } + return true; }); this.isFiltered = true; } diff --git a/src/app/pipes/datetime-format.pipe.ts b/src/app/pipes/datetime-format.pipe.ts index 9bdfb346f..ef17414d2 100644 --- a/src/app/pipes/datetime-format.pipe.ts +++ b/src/app/pipes/datetime-format.pipe.ts @@ -46,7 +46,8 @@ export class DatetimeFormatPipe implements PipeTransform, OnDestroy { d, hh, mm, - ss + ss, + ms ] = value as number[]; if (hh != null) { dateVal = moment({ @@ -55,7 +56,8 @@ export class DatetimeFormatPipe implements PipeTransform, OnDestroy { date: d, hour: hh, minute: mm ?? 0, - second: ss ?? 0 + second: ss ?? 0, + millisecond: ms != null ? Math.floor(ms / 1000000) : 0 }); } else { dateVal = moment({ year: y, month: (m ?? 1) - 1, date: d }); diff --git a/src/app/savings/common-resolvers/savings-account-actions.resolver.ts b/src/app/savings/common-resolvers/savings-account-actions.resolver.ts index cf73ca141..40182f2ff 100644 --- a/src/app/savings/common-resolvers/savings-account-actions.resolver.ts +++ b/src/app/savings/common-resolvers/savings-account-actions.resolver.ts @@ -69,6 +69,7 @@ export class SavingsAccountActionsResolver { this.savingsService.getSavingsTransactionTemplateResource(savingAccountId), this.savingsService.getSavingsAccountData(savingAccountId) ]); + case 'Activate': case 'Apply Annual Fees': return this.savingsService.getSavingsAccountData(savingAccountId); default: diff --git a/src/app/savings/saving-account-actions/activate-savings-account/activate-savings-account.component.html b/src/app/savings/saving-account-actions/activate-savings-account/activate-savings-account.component.html index 816484318..f27a3a11e 100644 --- a/src/app/savings/saving-account-actions/activate-savings-account/activate-savings-account.component.html +++ b/src/app/savings/saving-account-actions/activate-savings-account/activate-savings-account.component.html @@ -30,6 +30,18 @@ } + + + Opening Balance + + ₹  + @if (minRequiredOpeningBalance) { + Minimum required: ₹{{ minRequiredOpeningBalance }} + } + @if (activateSavingsAccountForm.controls.openingBalance.hasError('min')) { + Opening balance must be at least ₹{{ minRequiredOpeningBalance ?? 0 }} + } + diff --git a/src/app/savings/saving-account-actions/activate-savings-account/activate-savings-account.component.ts b/src/app/savings/saving-account-actions/activate-savings-account/activate-savings-account.component.ts index d1aec32da..2130afe2e 100644 --- a/src/app/savings/saving-account-actions/activate-savings-account/activate-savings-account.component.ts +++ b/src/app/savings/saving-account-actions/activate-savings-account/activate-savings-account.component.ts @@ -7,7 +7,7 @@ */ /** Angular Imports */ -import { Component, OnInit, inject } from '@angular/core'; +import { Component, OnInit, Input, inject } from '@angular/core'; import { UntypedFormGroup, UntypedFormBuilder, Validators, ReactiveFormsModule } from '@angular/forms'; import { ActivatedRoute, Router, RouterLink } from '@angular/router'; import { Dates } from 'app/core/utils/dates'; @@ -36,6 +36,8 @@ export class ActivateSavingsAccountComponent implements OnInit { private router = inject(Router); private settingsService = inject(SettingsService); + @Input() minRequiredOpeningBalance: number | null = null; + /** Minimum date allowed. */ minDate = new Date(2000, 0, 1); /** Maximum date allowed. */ @@ -69,10 +71,18 @@ export class ActivateSavingsAccountComponent implements OnInit { * Creates the activate savings account form. */ createActivateSavingsAccountForm() { + const minBalance = this.minRequiredOpeningBalance ?? 0; this.activateSavingsAccountForm = this.formBuilder.group({ activatedOnDate: [ '', Validators.required + ], + openingBalance: [ + minBalance, + [ + Validators.required, + Validators.min(minBalance) + ] ] }); } @@ -89,11 +99,14 @@ export class ActivateSavingsAccountComponent implements OnInit { if (activateSavingsAccountFormData.activatedOnDate instanceof Date) { activateSavingsAccountFormData.activatedOnDate = this.dateUtils.formatDate(prevActivatedOnDate, dateFormat); } - const data = { + const data: any = { ...activateSavingsAccountFormData, dateFormat, locale }; + if (data.openingBalance === 0 || data.openingBalance === null) { + delete data.openingBalance; + } this.savingsService.executeSavingsAccountCommand(this.accountId, 'activate', data).subscribe(() => { this.router.navigate(['../../transactions'], { relativeTo: this.route }); }); diff --git a/src/app/savings/saving-account-actions/saving-account-actions.component.html b/src/app/savings/saving-account-actions/saving-account-actions.component.html index aaf4f6fc4..45d3df9ca 100644 --- a/src/app/savings/saving-account-actions/saving-account-actions.component.html +++ b/src/app/savings/saving-account-actions/saving-account-actions.component.html @@ -13,7 +13,9 @@ } @if (actions['Activate']) { - + } @if (actions['Undo Approval']) { diff --git a/src/app/savings/saving-account-actions/saving-account-actions.component.ts b/src/app/savings/saving-account-actions/saving-account-actions.component.ts index 4b1ab3f14..d958e094d 100644 --- a/src/app/savings/saving-account-actions/saving-account-actions.component.ts +++ b/src/app/savings/saving-account-actions/saving-account-actions.component.ts @@ -102,10 +102,13 @@ export class SavingAccountActionsComponent { /** * @param {ActivatedRoute} route Activated Route */ + accountData: any; + constructor() { this.route.data.subscribe((data: { savingsAccountActionData: any }) => { if (data.savingsAccountActionData) { this.currency = data.savingsAccountActionData.currency; + this.accountData = data.savingsAccountActionData; } }); const name = this.route.snapshot.params['name'] as string; diff --git a/src/app/savings/savings-account-view/charges-tab/charges-tab.component.html b/src/app/savings/savings-account-view/charges-tab/charges-tab.component.html index 5fc50c22d..04635716a 100644 --- a/src/app/savings/savings-account-view/charges-tab/charges-tab.component.html +++ b/src/app/savings/savings-account-view/charges-tab/charges-tab.component.html @@ -48,7 +48,15 @@ {{ 'labels.inputs.Repeats On (M/d)' | translate }} - {{ charge.feeOnMonthDay ? charge.feeOnMonthDay.join('/') : '' }} + + {{ + charge.feeOnMonthDay + ? charge.feeOnMonthDay.join + ? charge.feeOnMonthDay.join('/') + : charge.feeOnMonthDay + : '' + }} + diff --git a/src/app/savings/savings-account-view/passbook-tab/passbook-tab.component.html b/src/app/savings/savings-account-view/passbook-tab/passbook-tab.component.html index ebff3db15..ee2fe2d98 100644 --- a/src/app/savings/savings-account-view/passbook-tab/passbook-tab.component.html +++ b/src/app/savings/savings-account-view/passbook-tab/passbook-tab.component.html @@ -7,8 +7,8 @@ -->
- -
+ +
{{ 'labels.inputs.From Date' | translate }} @@ -46,106 +46,151 @@
- -
-
-

{{ 'labels.heading.Savings Account Passbook' | translate }}

-

{{ productName }}

-
- - -
-
-
{{ 'labels.inputs.Account Number' | translate }}
-
{{ accountNo }}
+ +
+ +
+
+
+ account_balance +
+
+
LincPay Co-operative Bank Ltd.
+
Account Statement
+
-
-
{{ 'labels.inputs.Account Holder' | translate }}
-
{{ clientName }}
-
-
-
{{ 'labels.inputs.Savings Product' | translate }}
-
{{ productName }}
-
-
-
{{ 'labels.inputs.Opening Date' | translate }}
-
{{ activatedOnDate | dateFormat }}
-
-
-
{{ 'labels.inputs.Status' | translate }}
-
{{ status }}
-
-
-
{{ 'labels.inputs.Interest Rate' | translate }}
-
{{ interestRate }}%
+
+
STATEMENT OF ACCOUNT
+
As on: {{ maxDate | dateFormat }}
- -
-
- {{ 'labels.inputs.Current Balance' | translate }}: - {{ accountBalance | currency: currency?.code : 'symbol-narrow' : '1.2-2' }} + +