Implement organization maker-checker workflows
This commit is contained in:
@@ -143,11 +143,25 @@ export class BranchProfileComponent implements OnInit {
|
||||
.subscribe((res: any) => {
|
||||
this.saving = false;
|
||||
if (!res) return;
|
||||
if (res.rollbackTransaction) {
|
||||
// Parked for checker approval - the branch profile has not actually changed yet.
|
||||
this.successMsg = 'Branch profile update has been submitted for approval.';
|
||||
this.form.markAsPristine();
|
||||
return;
|
||||
}
|
||||
this.successMsg = 'Branch profile saved.';
|
||||
this.form.markAsPristine();
|
||||
this.lastUpdated = res.updatedByUsername ? { by: res.updatedByUsername, at: res.updatedAt } : null;
|
||||
const idx = this.offices.findIndex((o) => o.officeId === this.selectedOfficeId);
|
||||
if (idx >= 0) this.offices[idx] = res;
|
||||
// The response is now a CommandProcessingResult, not the updated row (the write goes through
|
||||
// the command pipeline) - reload the saved row from the server instead of patching state from
|
||||
// this response.
|
||||
this.organizationService.getBranchProfile(this.selectedOfficeId!).subscribe((updated: any) => {
|
||||
if (!updated) return;
|
||||
this.lastUpdated = updated.updatedByUsername
|
||||
? { by: updated.updatedByUsername, at: updated.updatedAt }
|
||||
: null;
|
||||
const idx = this.offices.findIndex((o) => o.officeId === this.selectedOfficeId);
|
||||
if (idx >= 0) this.offices[idx] = updated;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user