/** * 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 { FormsModule } from '@angular/forms'; import { MatDialogRef, MAT_DIALOG_DATA, MatDialogContent, MatDialogActions } from '@angular/material/dialog'; import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; import { FaIconComponent } from '@fortawesome/angular-fontawesome'; export interface MarkEntryDialogData { disposition: 'WHITELIST' | 'ESCALATE'; journalEntryId: number; transactionId: string; amount: number; glAccountName: string; transactionDate: string; } /** * Captures the reviewer's reason before a ledger entry is marked. * * Notes are not optional on an escalation: the Principal Officer picks the case up * with nothing else to go on, and an STR filed on an unexplained referral is not * defensible. A whitelist may be recorded without them. */ @Component({ selector: 'mifosx-mark-entry-dialog', templateUrl: './mark-entry-dialog.component.html', styleUrls: ['./mark-entry-dialog.component.scss'], imports: [ ...STANDALONE_SHARED_IMPORTS, FormsModule, FaIconComponent, MatDialogContent, MatDialogActions ] }) export class MarkEntryDialogComponent { dialogRef = inject>(MatDialogRef); data = inject(MAT_DIALOG_DATA); notes = ''; get isEscalation(): boolean { return this.data.disposition === 'ESCALATE'; } get canSubmit(): boolean { return !this.isEscalation || this.notes.trim().length > 0; } confirm(): void { if (this.canSubmit) { this.dialogRef.close(this.notes.trim()); } } }