feat(investment): show sent-for-approval message on investment actions
This commit is contained in:
@@ -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();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user