Files
cbsnexora/src/app/cfcfrms/components/status-badge/status-badge.component.ts
T

82 lines
2.0 KiB
TypeScript

/**
* 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/.
*/
import { Component, Input } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ComplaintStatus } from '../../models/cfcfrms.models';
@Component({
selector: 'mifosx-cfcfrms-status-badge',
standalone: true,
imports: [CommonModule],
template: `
<span class="status-badge" [ngClass]="'status-' + (status | lowercase)">
{{ statusLabel }}
</span>
`,
styles: [
`
.status-badge {
display: inline-block;
padding: 4px 12px;
border-radius: 16px;
font-size: 12px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
white-space: nowrap;
}
.status-received {
background: #dbeafe;
color: #1e40af;
}
.status-under_review {
background: #fef3c7;
color: #92400e;
}
.status-lien_marked {
background: #fef9c3;
color: #854d0e;
}
.status-debit_frozen {
background: #fee2e2;
color: #991b1b;
}
.status-funds_moved {
background: #ede9fe;
color: #5b21b6;
}
.status-resolved {
background: #d1fae5;
color: #065f46;
}
.status-rejected {
background: #f3f4f6;
color: #374151;
}
`
]
})
export class StatusBadgeComponent {
@Input() status: ComplaintStatus;
private readonly labels: Record<ComplaintStatus, string> = {
RECEIVED: 'Received',
UNDER_REVIEW: 'Under Review',
LIEN_MARKED: 'Lien Marked',
DEBIT_FROZEN: 'Debit Frozen',
FUNDS_MOVED: 'Funds Moved',
RESOLVED: 'Resolved',
REJECTED: 'Rejected'
};
get statusLabel(): string {
return this.labels[this.status] || this.status;
}
}