/** * Copyright since 2025 Mifos Initiative * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** Angular Imports */ import { Component, inject } from '@angular/core'; import { MatDialogRef, MAT_DIALOG_DATA, MatDialogTitle, MatDialogContent, MatDialogActions, MatDialogClose } from '@angular/material/dialog'; import { CdkScrollable } from '@angular/cdk/scrolling'; import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; /** * Delete signature dialog component. */ @Component({ selector: 'mifosx-delete-signature-dialog', templateUrl: './delete-signature-dialog.component.html', styleUrls: ['./delete-signature-dialog.component.scss'], imports: [ ...STANDALONE_SHARED_IMPORTS, MatDialogTitle, CdkScrollable, MatDialogContent, MatDialogActions, MatDialogClose ] }) export class DeleteSignatureDialogComponent { dialogRef = inject>(MatDialogRef); data = inject(MAT_DIALOG_DATA); /** Id of client signature in documents */ signatureId: any; /** * @param {MatDialogRef} dialogRef Component reference to dialog. * @param {any} data Documents data */ constructor() { // Multiple 'clientSignature' documents can exist for clients who re-cropped/replaced their // signature before uploads became single-slot, so pick the highest id (latest) rather than // the first unordered match. const signature = this.data .filter((document: any) => document.name === 'clientSignature') .sort((a: any, b: any) => b.id - a.id)[0] || {}; this.signatureId = signature.id; } }