feat(investment): show sent-for-approval message on investment actions

This commit is contained in:
2026-10-27 17:21:33 +05:30
parent d26cb89c5a
commit ad0a1a0b1d
4 changed files with 121 additions and 29 deletions
@@ -23,7 +23,9 @@ import {
InvestmentGlAccount,
InvestmentPartyDto,
InvestmentService,
apiErrorMessage
apiErrorMessage,
awaitingApproval,
sentForApproval
} from '../investment.service';
type FdTab = 'holdings' | 'purchase' | 'closure' | 'interest';
@@ -266,9 +268,13 @@ export class FdInvestmentComponent implements OnInit {
this.investmentService
.setDepositBase({ asOnDate: asOn, totalDeposits: this.baseAmount, locale: 'en', dateFormat: 'dd-MM-yyyy' })
.subscribe({
next: () => {
next: (res) => {
this.savingBase = false;
this.toast(`Total deposits as on ${asOn} saved.`);
this.toast(
awaitingApproval(res)
? sentForApproval(`Total deposits as on ${asOn}`)
: `Total deposits as on ${asOn} saved.`
);
this.refreshQuote();
},
error: (err) => {
@@ -319,7 +325,9 @@ export class FdInvestmentComponent implements OnInit {
next: (res) => {
this.saving = false;
this.toast(
`FD ${res.changes?.dealNo ?? ''} placed — voucher ${res.changes?.voucherNo ?? res.resourceIdentifier ?? ''}.`
awaitingApproval(res)
? sentForApproval(`FD of ₹${f.amount} with certificate ${f.certNo.trim()}`)
: `FD ${res.changes?.dealNo ?? ''} placed — voucher ${res.changes?.voucherNo ?? res.resourceIdentifier ?? ''}.`
);
this.form = this.blankForm();
this.quote = null;
@@ -394,7 +402,11 @@ export class FdInvestmentComponent implements OnInit {
this.investmentService.postFdInterest(fdId, body).subscribe({
next: (res) => {
this.postingInterest = false;
this.toast(`${this.lineLabel(r.lineType)} of ${r.intDate} posted — voucher ${res.resourceIdentifier ?? ''}.`);
this.toast(
awaitingApproval(res)
? sentForApproval(`${this.lineLabel(r.lineType)} of ${r.intDate} voucher`)
: `${this.lineLabel(r.lineType)} of ${r.intDate} posted — voucher ${res.resourceIdentifier ?? ''}.`
);
this.loadSchedule();
},
error: (err) => {
@@ -552,7 +564,12 @@ export class FdInvestmentComponent implements OnInit {
: c.type === 'PREMATURE'
? 'closed'
: 'matured';
this.toast(`FD ${f.dealNo} ${what} — voucher ${res.changes?.voucherNo ?? res.resourceIdentifier ?? ''}.`);
const action = c.type === 'RENEWAL' ? 'Renewal' : c.type === 'PREMATURE' ? 'Premature closure' : 'Maturity';
this.toast(
awaitingApproval(res)
? sentForApproval(`${action} of FD ${f.dealNo}`)
: `FD ${f.dealNo} ${what} — voucher ${res.changes?.voucherNo ?? res.resourceIdentifier ?? ''}.`
);
this.closure = this.blankClosure();
this.closureQuote = null;
this.loadFds();