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
@@ -40,7 +40,14 @@ import {
periodBetween
} from '../investment-data';
import { exportWorkbook, ExportSheetSpec } from '../investment-export';
import { InvestmentGlAccount, InvestmentService, apiErrorMessage, toDailyScriptRate } from '../investment.service';
import {
InvestmentGlAccount,
InvestmentService,
apiErrorMessage,
awaitingApproval,
sentForApproval,
toDailyScriptRate
} from '../investment.service';
type MasterTab =
| 'party'
@@ -250,7 +257,11 @@ export class InvestmentMastersComponent implements OnInit {
request.subscribe({
next: (res) => {
this.saving = false;
this.toast(`Party ${res.resourceIdentifier ?? f.partyCode} ${f.id ? 'updated' : 'saved'}.`);
this.toast(
awaitingApproval(res)
? sentForApproval(f.id ? `Change to party ${f.partyCode}` : `New party ${f.partyName ?? ''}`)
: `Party ${res.resourceIdentifier ?? f.partyCode} ${f.id ? 'updated' : 'saved'}.`
);
this.partyForm = {};
this.reloadMasters();
},
@@ -283,8 +294,10 @@ export class InvestmentMastersComponent implements OnInit {
return;
}
this.investmentService.deleteParty(f.id).subscribe({
next: () => {
this.toast(`Party ${f.partyCode} dropped.`);
next: (res) => {
this.toast(
awaitingApproval(res) ? sentForApproval(`Drop of party ${f.partyCode}`) : `Party ${f.partyCode} dropped.`
);
this.partyForm = {};
this.reloadMasters();
},
@@ -400,7 +413,11 @@ export class InvestmentMastersComponent implements OnInit {
request.subscribe({
next: (res) => {
this.saving = false;
this.toast(`Script ${res.resourceIdentifier ?? f.scriptCode} ${f.id ? 'updated' : 'saved'}.`);
this.toast(
awaitingApproval(res)
? sentForApproval(f.id ? `Change to script ${f.scriptCode}` : `New script ${f.scriptName ?? ''}`)
: `Script ${res.resourceIdentifier ?? f.scriptCode} ${f.id ? 'updated' : 'saved'}.`
);
this.scriptForm = {};
this.reloadMasters();
},