save saving ui update and current account update priview section
This commit is contained in:
+20
-3
@@ -135,20 +135,37 @@ export class CreateCurrentAccountComponent {
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const monthDayFormat = 'dd MMMM';
|
||||
const currentAccount = {
|
||||
...this.currentAccount,
|
||||
const details = this.currentAccount;
|
||||
|
||||
const currentAccount: any = {
|
||||
...details,
|
||||
...this.currentAccountCurrencyStep.currencyStepData,
|
||||
...(this.currentAccountDigitalStep?.currentAccountDigital ?? {}),
|
||||
charges: [],
|
||||
submittedOnDate: this.dateUtils.formatDate(this.currentAccount.submittedOnDate, dateFormat),
|
||||
submittedOnDate: this.dateUtils.formatDate(details.submittedOnDate, dateFormat),
|
||||
dateFormat,
|
||||
monthDayFormat,
|
||||
locale
|
||||
};
|
||||
|
||||
if (details.establishmentDate) {
|
||||
currentAccount.establishmentDate = this.dateUtils.formatDate(details.establishmentDate, dateFormat);
|
||||
}
|
||||
if (details.startOperationDate) {
|
||||
currentAccount.startOperationDate = this.dateUtils.formatDate(details.startOperationDate, dateFormat);
|
||||
}
|
||||
|
||||
// strip UI-only flags not needed by backend
|
||||
delete currentAccount.isNonIndividualClient;
|
||||
|
||||
if (this.currentAccountTemplate.clientId) {
|
||||
currentAccount.clientId = this.currentAccountTemplate.clientId;
|
||||
} else {
|
||||
currentAccount.groupId = this.currentAccountTemplate.groupId;
|
||||
}
|
||||
|
||||
console.log('Current Account Payload:', JSON.stringify(currentAccount, null, 2));
|
||||
|
||||
this.currentAccountsService.createCurrentAccount(currentAccount).subscribe((response: any) => {
|
||||
this.router.navigate(
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user