Client-stepper: pre-fill existing KYC/address proofs in edit, fix identifier saves
Edit-mode now shows the previously selected KYC document type + uploaded file thumbnail
(loads from /clients/{id}/identifiers + /client_identifiers/{id}/documents). Same for
address proof on the India address step. Closes the gap where editing a client showed
an empty file picker even when proof had been uploaded on create.
Identifier-save hardened across all three callsites (create-client, edit-client,
identities-tab.createIdentifierWithDocs) - the KYC chip picker proofId is a CODE
string ('AADHAAR'), but backend ClientIdentifierRequest.documentTypeId is Long, which
Spring rejects with HttpMessageNotReadableException -> 400. resolveDocumentTypeId
helper looks up the code against /kyc/proof-types?type=id and substitutes the numeric
CodeValue id before posting. Skips silently for constitution-specific non-individual
docs that have no CodeValue mapping.
KYC payload normalises panNumber / enterprisePan / gstinNumber / cinNumber via
toUpperCase + whitespace strip so user-typed lowercase or trailing spaces don't trip
the backend regex (validation.msg.CLIENTKYC.panNumber.does.not.match.regexp).
State name match in client-address save now normalises both sides (lowercase, collapse
underscores + spaces) so legacy MADHYA_PRADESH resolves to 'Madhya Pradesh' returned
by api.postalpincode.in. Backed by tenant migration 0297.
Identities-tab resolver flattened - was returning identifiers before the per-row
forkJoin(getClientIdentificationDocuments) completed, so the view rendered empty
documents arrays. Now uses switchMap + forkJoin so the resolver awaits completion.
Also bundles concurrent work-in-progress on letter-mgmt, organization, users,
bank-calendar, shell, nominee/notes/identifier dialogs, and theming.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
325228c514
commit
83ea57ccf0
@@ -0,0 +1,149 @@
|
||||
<!--
|
||||
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/.
|
||||
-->
|
||||
|
||||
<div class="udd-root">
|
||||
<div class="udd-head">
|
||||
<div class="udd-head__left">
|
||||
<fa-icon icon="user-circle" class="udd-head__ic"></fa-icon>
|
||||
<div>
|
||||
<h2 class="udd-head__title">User Details</h2>
|
||||
<div class="udd-head__sub">Read-only summary of this user's profile</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="udd-x" (click)="close()" matTooltip="Close">
|
||||
<fa-icon icon="times"></fa-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@if (loading) {
|
||||
<div class="udd-loading">
|
||||
<fa-icon icon="spinner" class="fa-spin"></fa-icon>
|
||||
Loading…
|
||||
</div>
|
||||
} @else if (error) {
|
||||
<div class="udd-error">
|
||||
<fa-icon icon="exclamation-triangle"></fa-icon>
|
||||
{{ error }}
|
||||
</div>
|
||||
} @else if (user) {
|
||||
<div class="udd-body">
|
||||
<!-- Identity card -->
|
||||
<div class="udd-id-card" [class.self]="user.isSelfServiceUser">
|
||||
<span class="udd-avatar">{{ initials }}</span>
|
||||
<div class="udd-id-card__txt">
|
||||
<div class="udd-id-card__name">{{ fullName }}</div>
|
||||
<div class="udd-id-card__meta">
|
||||
<span class="mono">@{{ user.username }}</span>
|
||||
<span class="dot">·</span>
|
||||
<span>{{ user.officeName }}</span>
|
||||
@if (user.isSelfServiceUser) {
|
||||
<span class="udd-pill self">Self-Service</span>
|
||||
} @else {
|
||||
<span class="udd-pill staff">Staff</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Contact -->
|
||||
<div class="udd-section">
|
||||
<div class="udd-section__title">Contact</div>
|
||||
<div class="udd-grid">
|
||||
<div>
|
||||
<div class="udd-key">Email</div>
|
||||
<div class="udd-val mono">{{ user.email || '—' }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="udd-key">Mobile</div>
|
||||
<div class="udd-val mono">
|
||||
@if (user.mobileNo) {
|
||||
+91 {{ user.mobileNo }}
|
||||
} @else {
|
||||
—
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Office & Staff -->
|
||||
<div class="udd-section">
|
||||
<div class="udd-section__title">Office & Staff</div>
|
||||
<div class="udd-grid">
|
||||
<div>
|
||||
<div class="udd-key">Office</div>
|
||||
<div class="udd-val">{{ user.officeName || '—' }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="udd-key">Linked Staff</div>
|
||||
<div class="udd-val">{{ user.staff?.displayName || user.staffDisplayName || '—' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Roles -->
|
||||
<div class="udd-section">
|
||||
<div class="udd-section__title">Roles ({{ roleNames.length }})</div>
|
||||
@if (roleNames.length) {
|
||||
<div class="udd-roles">
|
||||
@for (r of roleNames; track r) {
|
||||
<span class="udd-role">{{ r }}</span>
|
||||
}
|
||||
</div>
|
||||
} @else {
|
||||
<div class="udd-val muted">No roles assigned.</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<!-- Security -->
|
||||
<div class="udd-section">
|
||||
<div class="udd-section__title">Security</div>
|
||||
<div class="udd-grid">
|
||||
<div>
|
||||
<div class="udd-key">Password Policy</div>
|
||||
<div class="udd-val">
|
||||
@if (user.passwordNeverExpires) {
|
||||
<fa-icon icon="check-circle" class="udd-ic ok"></fa-icon>
|
||||
Never expires
|
||||
} @else {
|
||||
<fa-icon icon="clock" class="udd-ic warn"></fa-icon>
|
||||
Expires per policy
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="udd-key">Last Password Change</div>
|
||||
<div class="udd-val">
|
||||
@if (lastPasswordUpdate) {
|
||||
{{ lastPasswordUpdate | date: 'd MMM y' }}
|
||||
} @else {
|
||||
—
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="udd-actions">
|
||||
<button class="udd-btn ghost" (click)="close()">Close</button>
|
||||
<button class="udd-btn ghost warn" (click)="close('delete')" *mifosxHasPermission="'DELETE_USER'">
|
||||
<fa-icon icon="trash"></fa-icon>
|
||||
Delete
|
||||
</button>
|
||||
<button class="udd-btn ghost" (click)="close('change-password')">
|
||||
<fa-icon icon="key"></fa-icon>
|
||||
Change Password
|
||||
</button>
|
||||
<button class="udd-btn primary" (click)="close('edit')" *mifosxHasPermission="'UPDATE_USER'">
|
||||
<fa-icon icon="pencil-alt"></fa-icon>
|
||||
Edit User
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -0,0 +1,331 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
$navy: #0d1b2a;
|
||||
$blue: #1e88e5;
|
||||
$blue-d: #1e40af;
|
||||
$green: #10b981;
|
||||
$red: #ef4444;
|
||||
$amber: #f59e0b;
|
||||
$purple: #7c3aed;
|
||||
|
||||
:host {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.udd-root {
|
||||
background: #fff;
|
||||
width: 640px;
|
||||
max-width: 96vw;
|
||||
max-height: 90vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.udd-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 14px 20px;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
|
||||
|
||||
&__left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
&__ic {
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 10px;
|
||||
background: linear-gradient(135deg, $blue 0%, $purple 100%);
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
box-shadow: 0 2px 6px -2px rgb(29 78 216 / 35%);
|
||||
}
|
||||
|
||||
&__title {
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
font-weight: 800;
|
||||
color: $navy;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
&__sub {
|
||||
margin-top: 2px;
|
||||
font-size: 11.5px;
|
||||
color: #64748b;
|
||||
}
|
||||
}
|
||||
|
||||
.udd-x {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 999px;
|
||||
border: 1px solid #e2e8f0;
|
||||
background: #fff;
|
||||
color: #64748b;
|
||||
cursor: pointer;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
&:hover {
|
||||
background: #fef2f2;
|
||||
color: $red;
|
||||
border-color: #fecaca;
|
||||
}
|
||||
}
|
||||
|
||||
.udd-loading,
|
||||
.udd-error {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 32px 24px;
|
||||
color: #64748b;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.udd-error {
|
||||
color: $red;
|
||||
}
|
||||
|
||||
.udd-body {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 16px 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.udd-id-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
padding: 14px 16px;
|
||||
border-radius: 12px;
|
||||
background: linear-gradient(135deg, #eff6ff 0%, #fff 100%);
|
||||
border: 1px solid #bfdbfe;
|
||||
|
||||
&.self {
|
||||
background: linear-gradient(135deg, #ecfdf5 0%, #fff 100%);
|
||||
border-color: #a7f3d0;
|
||||
}
|
||||
|
||||
&__name {
|
||||
font-size: 16px;
|
||||
font-weight: 800;
|
||||
color: $navy;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
&__meta {
|
||||
margin-top: 3px;
|
||||
font-size: 11.5px;
|
||||
color: #64748b;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
|
||||
.udd-avatar {
|
||||
width: 52px;
|
||||
height: 52px;
|
||||
border-radius: 50%;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: linear-gradient(135deg, $blue 0%, $purple 100%);
|
||||
color: #fff;
|
||||
font-weight: 800;
|
||||
font-size: 16px;
|
||||
flex-shrink: 0;
|
||||
box-shadow: 0 3px 6px -2px rgb(29 78 216 / 35%);
|
||||
}
|
||||
|
||||
.udd-pill {
|
||||
padding: 2px 9px;
|
||||
border-radius: 999px;
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
|
||||
&.staff {
|
||||
background: #ede9fe;
|
||||
color: $purple;
|
||||
}
|
||||
|
||||
&.self {
|
||||
background: #ecfdf5;
|
||||
color: $green;
|
||||
}
|
||||
}
|
||||
|
||||
.mono {
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||
}
|
||||
|
||||
.dot {
|
||||
color: #cbd5e1;
|
||||
}
|
||||
|
||||
.udd-section {
|
||||
background: #f8fafc;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 10px;
|
||||
padding: 12px 14px;
|
||||
|
||||
&__title {
|
||||
font-size: 10.5px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.06em;
|
||||
font-weight: 700;
|
||||
color: $blue-d;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.udd-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 10px 14px;
|
||||
}
|
||||
|
||||
.udd-key {
|
||||
font-size: 10.5px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
color: #64748b;
|
||||
font-weight: 600;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.udd-val {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: $navy;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
word-break: break-word;
|
||||
|
||||
&.muted {
|
||||
color: #94a3b8;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.udd-ic {
|
||||
font-size: 11px;
|
||||
|
||||
&.ok {
|
||||
color: $green;
|
||||
}
|
||||
|
||||
&.warn {
|
||||
color: $amber;
|
||||
}
|
||||
}
|
||||
|
||||
.udd-roles {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.udd-role {
|
||||
display: inline-block;
|
||||
padding: 3px 10px;
|
||||
background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
|
||||
color: #5b21b6;
|
||||
border-radius: 999px;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.udd-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
padding: 14px 20px;
|
||||
border-top: 1px solid #e2e8f0;
|
||||
background: #fafbfc;
|
||||
}
|
||||
|
||||
.udd-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
height: 36px;
|
||||
padding: 0 14px;
|
||||
border-radius: 8px;
|
||||
font-size: 12.5px;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s;
|
||||
border: 1px solid transparent;
|
||||
|
||||
fa-icon {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
&.ghost {
|
||||
background: #fff;
|
||||
border-color: #d0d5dd;
|
||||
color: #475569;
|
||||
|
||||
&:hover {
|
||||
background: #f8fafc;
|
||||
border-color: #94a3b8;
|
||||
color: $navy;
|
||||
}
|
||||
|
||||
&.warn {
|
||||
color: $red;
|
||||
border-color: #fecaca;
|
||||
|
||||
&:hover {
|
||||
background: #fef2f2;
|
||||
border-color: $red;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.primary {
|
||||
background: linear-gradient(135deg, $blue 0%, $blue-d 100%);
|
||||
border-color: $blue-d;
|
||||
color: #fff;
|
||||
box-shadow: 0 2px 6px -2px rgb(30 64 175 / 35%);
|
||||
|
||||
&:hover {
|
||||
box-shadow: 0 4px 12px -3px rgb(30 64 175 / 45%);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (width <= 600px) {
|
||||
.udd-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.udd-actions {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
/**
|
||||
* 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, OnInit, inject } from '@angular/core';
|
||||
import { CommonModule, DatePipe } from '@angular/common';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { MatTooltip } from '@angular/material/tooltip';
|
||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
import { UsersService } from '../users.service';
|
||||
|
||||
export interface UserDetailsDialogData {
|
||||
userId: string | number;
|
||||
}
|
||||
|
||||
export type UserDetailsDialogResult = 'edit' | 'delete' | 'change-password' | undefined;
|
||||
|
||||
/**
|
||||
* Read-only "View User" dialog.
|
||||
*
|
||||
* Loads the full user record by id and renders the standard identity / office
|
||||
* / roles / security fields with a footer that lets the caller fast-track to
|
||||
* Edit / Delete / Change Password without leaving the list view.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-user-details-dialog',
|
||||
templateUrl: './user-details-dialog.component.html',
|
||||
styleUrls: ['./user-details-dialog.component.scss'],
|
||||
imports: [
|
||||
...STANDALONE_SHARED_IMPORTS,
|
||||
CommonModule,
|
||||
DatePipe,
|
||||
FaIconComponent,
|
||||
MatTooltip
|
||||
]
|
||||
})
|
||||
export class UserDetailsDialogComponent implements OnInit {
|
||||
private usersService = inject(UsersService);
|
||||
public dialogRef = inject(MatDialogRef<UserDetailsDialogComponent, UserDetailsDialogResult>);
|
||||
public data = inject<UserDetailsDialogData>(MAT_DIALOG_DATA);
|
||||
|
||||
user: any = null;
|
||||
loading = true;
|
||||
error: string | null = null;
|
||||
|
||||
ngOnInit(): void {
|
||||
this.usersService.getUser(String(this.data.userId)).subscribe({
|
||||
next: (u: any) => {
|
||||
this.user = u;
|
||||
this.loading = false;
|
||||
},
|
||||
error: () => {
|
||||
this.loading = false;
|
||||
this.error = 'Could not load this user.';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get fullName(): string {
|
||||
const fn = (this.user?.firstname || '').trim();
|
||||
const ln = (this.user?.lastname || '').trim();
|
||||
return (
|
||||
[
|
||||
fn,
|
||||
ln
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(' ') ||
|
||||
this.user?.username ||
|
||||
''
|
||||
);
|
||||
}
|
||||
|
||||
get initials(): string {
|
||||
if (!this.user) return '?';
|
||||
const a = (this.user.firstname || this.user.username || '').charAt(0);
|
||||
const b = (this.user.lastname || '').charAt(0);
|
||||
return `${a}${b}`.toUpperCase() || '?';
|
||||
}
|
||||
|
||||
get roleNames(): string[] {
|
||||
return (this.user?.selectedRoles || []).map((r: any) => r.name);
|
||||
}
|
||||
|
||||
/** Last-password-update can come as ISO string or backend array. Normalise. */
|
||||
get lastPasswordUpdate(): string | null {
|
||||
const raw = this.user?.lastTimePasswordUpdated;
|
||||
if (!raw) return null;
|
||||
if (Array.isArray(raw) && raw.length >= 3) {
|
||||
const dt = new Date(raw[0], raw[1] - 1, raw[2]);
|
||||
return dt.toISOString();
|
||||
}
|
||||
return String(raw);
|
||||
}
|
||||
|
||||
close(result?: UserDetailsDialogResult): void {
|
||||
this.dialogRef.close(result);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user