diff --git a/src/app/organization/offices/offices.component.ts b/src/app/organization/offices/offices.component.ts index 518b5bbd9..2f71d361f 100644 --- a/src/app/organization/offices/offices.component.ts +++ b/src/app/organization/offices/offices.component.ts @@ -262,8 +262,15 @@ export class OfficesComponent implements OnInit { ref.afterClosed().subscribe((response: any) => { if (!response?.delete) return; this.organizationService.deleteOffice(row.id).subscribe({ - next: () => { - this.showSuccess('Office Removed', `"${row.name}" has been deleted.`); + next: (response: any) => { + if (response?.rollbackTransaction) { + this.showSuccess( + 'Sent for Approval', + `Deleting "${row.name}" has been submitted and is awaiting checker approval.` + ); + } else { + this.showSuccess('Office Removed', `"${row.name}" has been deleted.`); + } this.refreshOffices(); }, error: (err: any) => { diff --git a/src/app/shares/create-shares-account/create-shares-account.component.ts b/src/app/shares/create-shares-account/create-shares-account.component.ts index 302754f98..694c36fbb 100644 --- a/src/app/shares/create-shares-account/create-shares-account.component.ts +++ b/src/app/shares/create-shares-account/create-shares-account.component.ts @@ -129,7 +129,16 @@ export class CreateSharesAccountComponent { const sharesAccount = { ...this.sharesAccount, clientId: this.sharesAccountTemplate.clientId, - charges: this.sharesAccount.charges.map((charge: any) => ({ chargeId: charge.id, amount: charge.amount })), + // A charge seeded from the product's own default template arrives as ShareAccountChargeData -- + // its `chargeId` field carries the real underlying charge id, `id` is null (it has no saved + // ShareAccountCharge row yet). A charge picked from this step's own "Charge" dropdown arrives as + // plain ChargeData instead, where `id` *is* the charge id. `charge.id` alone silently dropped the + // product-seeded case (chargeId ended up undefined and Angular's JSON.stringify just omits it), + // so an account created straight from the product defaults never actually got its charges saved. + charges: this.sharesAccount.charges.map((charge: any) => ({ + chargeId: charge.chargeId || charge.id, + amount: charge.amount + })), applicationDate: this.dateUtils.formatDate(this.sharesAccount.applicationDate, dateFormat), submittedDate: this.dateUtils.formatDate(this.sharesAccount.submittedDate, dateFormat), resolutionDate: this.dateUtils.formatDate(this.sharesAccount.resolutionDate, dateFormat), diff --git a/src/app/shares/edit-shares-account/edit-shares-account.component.ts b/src/app/shares/edit-shares-account/edit-shares-account.component.ts index 0c0d9cb2b..919e5a3ac 100644 --- a/src/app/shares/edit-shares-account/edit-shares-account.component.ts +++ b/src/app/shares/edit-shares-account/edit-shares-account.component.ts @@ -135,7 +135,13 @@ export class EditSharesAccountComponent { const sharesAccount = { ...this.sharesAccount, clientId: this.sharesAccountAndTemplate.clientId, - charges: this.sharesAccount.charges.map((charge: any) => ({ chargeId: charge.id, amount: charge.amount })), + // See create-shares-account.component.ts's submit() for why chargeId falls back to charge.id -- + // a product-default charge (ShareAccountChargeData) carries the real charge id in `chargeId`, + // not `id`; only a charge picked from this step's own dropdown (plain ChargeData) has it in `id`. + charges: this.sharesAccount.charges.map((charge: any) => ({ + chargeId: charge.chargeId || charge.id, + amount: charge.amount + })), applicationDate: this.dateUtils.formatDate(this.sharesAccount.applicationDate, dateFormat), submittedDate: this.dateUtils.formatDate(this.sharesAccount.submittedDate, dateFormat), resolutionDate: this.dateUtils.formatDate(this.sharesAccount.resolutionDate, dateFormat), diff --git a/src/app/shares/shares-account-stepper/shares-account-charges-step/shares-account-charges-step.component.ts b/src/app/shares/shares-account-stepper/shares-account-charges-step/shares-account-charges-step.component.ts index d5a89f5f5..a4af04a3a 100644 --- a/src/app/shares/shares-account-stepper/shares-account-charges-step/shares-account-charges-step.component.ts +++ b/src/app/shares/shares-account-stepper/shares-account-charges-step/shares-account-charges-step.component.ts @@ -104,6 +104,13 @@ export class SharesAccountChargesStepComponent implements OnInit, OnChanges { if (!this.isChargesPatched && this.sharesAccountTemplate.charges) { this.chargesDataSource = this.sharesAccountTemplate.charges; this.isChargesPatched = true; + // The account's real saved charges just landed (possibly an empty array, meaning the + // account genuinely has none). ngOnChanges fires again on the very same input-update cycle + // that triggered this subscription (currencyCode.patchValue is called from the terms step's + // own ngOnChanges, which runs before this component's) -- without this, its `pristine` guard + // would still be true and silently re-seed chargesDataSource from the product's *current* + // default template, overwriting the real state this just patched in. + this.pristine = false; } }); }