merege code this branch /feature/UI-DSC-MFA
This commit is contained in:
+7
-1
@@ -298,9 +298,15 @@
|
||||
<mat-label>Relationship</mat-label>
|
||||
<mat-select required formControlName="relationshipId">
|
||||
@for (rel of data.options.relationshipIdOptions; track rel) {
|
||||
<mat-option [value]="rel.id">{{ rel.name }}</mat-option>
|
||||
<mat-option [value]="rel.id" [disabled]="disabledRelationshipIds.has(rel.id)">
|
||||
{{ rel.name }}
|
||||
@if (disabledRelationshipIds.has(rel.id)) {
|
||||
<span class="fm-rel-taken">· already added</span>
|
||||
}
|
||||
</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
<mat-hint>Father, Mother and Spouse can only be added once.</mat-hint>
|
||||
</mat-form-field>
|
||||
|
||||
@if (entryMode === 'manual') {
|
||||
|
||||
+8
@@ -28,6 +28,14 @@
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
/* Suffix shown next to disabled relationship options (Father/Mother/Spouse already added). */
|
||||
.fm-rel-taken {
|
||||
margin-left: 4px;
|
||||
font-size: 11px;
|
||||
font-style: italic;
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.fm-mode-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
|
||||
+36
@@ -86,6 +86,42 @@ export class ClientFamilyMemberDialogComponent implements OnInit {
|
||||
return rel?.name?.toUpperCase() === 'SPOUSE';
|
||||
}
|
||||
|
||||
/**
|
||||
* Relationships that may appear at most once per client. Names compared
|
||||
* case-insensitively against the option list returned by the backend.
|
||||
*/
|
||||
private static readonly UNIQUE_RELATIONSHIPS = new Set([
|
||||
'FATHER',
|
||||
'MOTHER',
|
||||
'SPOUSE'
|
||||
]);
|
||||
|
||||
/**
|
||||
* Set of relationshipId values that are already taken by another family
|
||||
* member and should therefore be disabled in the dropdown. The member
|
||||
* currently being edited is excluded so its existing relationship stays
|
||||
* selectable. Empty set in Add mode when no unique relations exist yet.
|
||||
*/
|
||||
get disabledRelationshipIds(): Set<number> {
|
||||
const disabled = new Set<number>();
|
||||
const existing = this.data?.existingMembers || [];
|
||||
const options = this.data?.options?.relationshipIdOptions || [];
|
||||
if (!existing.length || !options.length) return disabled;
|
||||
const editingId = this.data?.context === 'Edit' ? this.data?.member?.id : undefined;
|
||||
for (const m of existing) {
|
||||
// Skip the member being edited so it can keep its current selection.
|
||||
if (editingId && m.id === editingId) continue;
|
||||
const relId = typeof m.relationshipId === 'object' ? m.relationshipId?.id : m.relationshipId;
|
||||
if (relId == null) continue;
|
||||
const rel = options.find((r: any) => r.id === relId);
|
||||
const name = (rel?.name || '').toUpperCase();
|
||||
if (ClientFamilyMemberDialogComponent.UNIQUE_RELATIONSHIPS.has(name)) {
|
||||
disabled.add(relId);
|
||||
}
|
||||
}
|
||||
return disabled;
|
||||
}
|
||||
|
||||
/** Whether dialog is in View-only mode */
|
||||
get isViewMode(): boolean {
|
||||
return this.data.context === 'View';
|
||||
|
||||
+17
-3
@@ -132,7 +132,11 @@ export class ClientFamilyMembersStepComponent implements OnInit {
|
||||
|
||||
addFamilyMember() {
|
||||
const ref = this.dialog.open(ClientFamilyMemberDialogComponent, {
|
||||
data: { context: 'Add', options: this.clientTemplate.familyMemberOptions },
|
||||
data: {
|
||||
context: 'Add',
|
||||
options: this.clientTemplate.familyMemberOptions,
|
||||
existingMembers: this.clientFamilyMembers
|
||||
},
|
||||
width: '640px',
|
||||
maxWidth: '95vw',
|
||||
panelClass: 'fm-dialog-panel'
|
||||
@@ -146,7 +150,12 @@ export class ClientFamilyMembersStepComponent implements OnInit {
|
||||
|
||||
viewFamilyMember(member: any) {
|
||||
this.dialog.open(ClientFamilyMemberDialogComponent, {
|
||||
data: { context: 'View', member, options: this.clientTemplate.familyMemberOptions },
|
||||
data: {
|
||||
context: 'View',
|
||||
member,
|
||||
options: this.clientTemplate.familyMemberOptions,
|
||||
existingMembers: this.clientFamilyMembers
|
||||
},
|
||||
width: '640px',
|
||||
maxWidth: '95vw',
|
||||
panelClass: 'fm-dialog-panel'
|
||||
@@ -155,7 +164,12 @@ export class ClientFamilyMembersStepComponent implements OnInit {
|
||||
|
||||
editFamilyMember(member: any, index: number) {
|
||||
const ref = this.dialog.open(ClientFamilyMemberDialogComponent, {
|
||||
data: { context: 'Edit', member, options: this.clientTemplate.familyMemberOptions },
|
||||
data: {
|
||||
context: 'Edit',
|
||||
member,
|
||||
options: this.clientTemplate.familyMemberOptions,
|
||||
existingMembers: this.clientFamilyMembers
|
||||
},
|
||||
width: '640px',
|
||||
maxWidth: '95vw',
|
||||
panelClass: 'fm-dialog-panel'
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
* Unassign staff dialog component.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-unassign-staff-dialog',
|
||||
selector: 'mifosx-clients-unassign-staff-dialog',
|
||||
templateUrl: './unassign-staff-dialog.component.html',
|
||||
styleUrls: ['./unassign-staff-dialog.component.scss'],
|
||||
imports: [
|
||||
|
||||
@@ -22,7 +22,7 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
* Notes Tab Component
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-notes-tab',
|
||||
selector: 'mifosx-clients-notes-tab',
|
||||
templateUrl: './notes-tab.component.html',
|
||||
styleUrls: ['./notes-tab.component.scss'],
|
||||
imports: [
|
||||
|
||||
Reference in New Issue
Block a user