feat(clerk): add dedicated nav pages, state restore, and fullscreen ESC fix

- Add ClerkUiStateService with full account state save/restore (no double network call on back navigation)
- Add Photo & Signature, Standing Instructions, Today's Activity as dedicated nav pages
- Remove photo/signature, standing instructions, linked accounts, today's activity panels from main dashboard
- Add ESC key to exit fullscreen; clicking Clerk nav immediately restores fullscreen without re-navigating
- Compact clerk dashboard UI with reduced font sizes and padding throughout
- Add CashierOnlyGuard for route protection

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jaanu423
2026-06-09 12:49:06 +05:30
co-authored by Claude Sonnet 4.6
parent f7d9259eb7
commit 40a436dabe
20 changed files with 3708 additions and 1020 deletions
@@ -0,0 +1,341 @@
/**
* 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/.
*/
:host {
display: block;
}
.ps-page {
min-height: calc(100vh - 68px);
background: #f0f4f8;
padding: 24px 28px;
display: flex;
flex-direction: column;
gap: 20px;
}
// ── Hero ──────────────────────────────────────────────────────────────────────
.ps-hero {
display: flex;
align-items: center;
gap: 18px;
background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 40%, #2563eb 100%);
border-radius: 16px;
padding: 22px 28px;
color: #fff;
box-shadow: 0 8px 32px rgb(37 99 235 / 35%);
position: relative;
overflow: hidden;
&::before {
content: '';
position: absolute;
top: -40px;
right: -40px;
width: 200px;
height: 200px;
background: rgb(255 255 255 / 5%);
border-radius: 50%;
pointer-events: none;
}
&__icon-wrap {
width: 56px;
height: 56px;
background: rgb(255 255 255 / 15%);
border: 1px solid rgb(255 255 255 / 25%);
border-radius: 14px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
backdrop-filter: blur(8px);
}
&__text {
flex: 1;
}
&__title {
font-size: 22px;
font-weight: 800;
letter-spacing: -0.01em;
margin: 0 0 6px;
}
&__meta {
display: flex;
align-items: center;
gap: 10px;
font-size: 12.5px;
color: rgb(255 255 255 / 75%);
}
&__ac {
font-weight: 700;
color: #bfdbfe;
font-family: monospace;
font-size: 13px;
}
&__sep {
width: 1px;
height: 13px;
background: rgb(255 255 255 / 30%);
}
&__name {
color: rgb(255 255 255 / 85%);
}
}
.ps-back-btn {
display: inline-flex;
align-items: center;
gap: 7px;
padding: 10px 20px;
background: rgb(255 255 255 / 12%);
border: 1px solid rgb(255 255 255 / 25%);
border-radius: 10px;
color: #fff;
font-size: 12.5px;
font-weight: 600;
cursor: pointer;
transition: all 0.2s;
white-space: nowrap;
backdrop-filter: blur(8px);
&:hover {
background: rgb(255 255 255 / 22%);
transform: translateX(-2px);
}
}
// ── Empty state ────────────────────────────────────────────────────────────────
.ps-empty {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 14px;
padding: 60px 20px;
&__icon {
width: 88px;
height: 88px;
background: #e2e8f0;
border: 1px solid #cbd5e1;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
&__title {
font-size: 18px;
font-weight: 700;
color: #1e293b;
margin: 6px 0 0;
}
&__sub {
font-size: 13.5px;
color: #64748b;
text-align: center;
margin: 0;
}
&__btn {
margin-top: 10px;
padding: 10px 24px;
background: #2563eb;
border: none;
border-radius: 10px;
color: #fff;
font-size: 13px;
font-weight: 600;
cursor: pointer;
transition: background 0.15s;
&:hover {
background: #1d4ed8;
}
}
}
// ── Cards row ─────────────────────────────────────────────────────────────────
.ps-cards-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
@media (width <= 680px) {
grid-template-columns: 1fr;
}
}
.ps-card {
background: #fff;
border: 1px solid #e2e8f0;
border-radius: 16px;
overflow: hidden;
box-shadow: 0 2px 8px rgb(0 0 0 / 7%);
&__header {
display: flex;
align-items: center;
gap: 9px;
padding: 12px 22px;
background: #1e293b;
color: #94a3b8;
font-size: 11.5px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.08em;
}
&__body {
padding: 28px;
display: flex;
align-items: center;
justify-content: center;
min-height: 280px;
&--sig {
background: repeating-linear-gradient(-45deg, #f8fafc, #f8fafc 4px, #fff 4px, #fff 12px);
}
}
}
// ── Image display ──────────────────────────────────────────────────────────────
.ps-img-wrap {
position: relative;
cursor: zoom-in;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 4px 20px rgb(0 0 0 / 12%);
max-width: 240px;
max-height: 240px;
&--sig {
max-width: 320px;
max-height: 160px;
background: #fff;
padding: 12px;
border: 1.5px solid #e2e8f0;
}
&:hover .ps-img__overlay {
opacity: 1;
}
}
.ps-img {
display: block;
width: 240px;
height: 240px;
object-fit: cover;
&--sig {
width: 100%;
height: 140px;
object-fit: contain;
}
}
.ps-img__overlay {
position: absolute;
inset: 0;
background: rgb(15 23 42 / 55%);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 6px;
color: #fff;
font-size: 12px;
font-weight: 600;
opacity: 0;
transition: opacity 0.2s;
backdrop-filter: blur(2px);
}
.ps-no-img {
display: flex;
flex-direction: column;
align-items: center;
gap: 12px;
color: #94a3b8;
font-size: 13px;
font-weight: 500;
}
// ── Lightbox ──────────────────────────────────────────────────────────────────
.ps-lightbox {
position: fixed;
inset: 0;
background: rgb(2 6 23 / 82%);
z-index: 10000;
display: flex;
align-items: center;
justify-content: center;
backdrop-filter: blur(6px);
&__inner {
background: #fff;
border-radius: 16px;
overflow: hidden;
max-width: 90vw;
max-height: 90vh;
display: flex;
flex-direction: column;
box-shadow: 0 24px 80px rgb(0 0 0 / 50%);
}
&__bar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 18px;
background: #1e293b;
color: #94a3b8;
font-size: 12px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.06em;
}
&__close {
background: none;
border: none;
color: #94a3b8;
font-size: 16px;
cursor: pointer;
padding: 2px 6px;
border-radius: 4px;
line-height: 1;
transition: color 0.15s;
&:hover {
color: #fff;
}
}
&__img {
display: block;
max-width: 90vw;
max-height: calc(90vh - 48px);
object-fit: contain;
}
}
@@ -0,0 +1,187 @@
/**
* 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 } from '@angular/common';
import { Router } from '@angular/router';
import { ClerkUiStateService } from '../../cashier/clerk-ui-state.service';
@Component({
selector: 'mifosx-photo-signature',
standalone: true,
imports: [CommonModule],
styleUrl: './photo-signature.component.scss',
template: `
<div class="ps-page">
<!-- Hero -->
<div class="ps-hero">
<div class="ps-hero__icon-wrap">
<svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8">
<circle cx="12" cy="8" r="4" />
<path d="M4 20c0-4 3.6-7 8-7s8 3 8 7" />
</svg>
</div>
<div class="ps-hero__text">
<h1 class="ps-hero__title">Photo &amp; Signature</h1>
@if (accountLoaded) {
<div class="ps-hero__meta">
<span class="ps-hero__ac">{{ accountNo }}</span>
@if (clientName) {
<span class="ps-hero__sep"></span>
<span class="ps-hero__name">{{ clientName }}</span>
}
</div>
}
</div>
<button class="ps-back-btn" (click)="goBack()">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
<polyline points="15 18 9 12 15 6" />
</svg>
Back to Dashboard
</button>
</div>
@if (!accountLoaded) {
<!-- Empty state -->
<div class="ps-empty">
<div class="ps-empty__icon">
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="#475569" stroke-width="1.3">
<circle cx="12" cy="8" r="4" />
<path d="M4 20c0-4 3.6-7 8-7s8 3 8 7" />
</svg>
</div>
<p class="ps-empty__title">No Account Loaded</p>
<p class="ps-empty__sub">Search an account on the Clerk Dashboard first.</p>
<button class="ps-empty__btn" (click)="goBack()">Go to Dashboard</button>
</div>
} @else {
<div class="ps-cards-row">
<!-- Photo card -->
<div class="ps-card">
<div class="ps-card__header">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="3" y="3" width="18" height="18" rx="2" />
<circle cx="8.5" cy="8.5" r="1.5" />
<polyline points="21 15 16 10 5 21" />
</svg>
Client Photo
</div>
<div class="ps-card__body">
@if (photoUrl) {
<div class="ps-img-wrap" (click)="preview(photoUrl, 'Client Photo')">
<img [src]="photoUrl" alt="Client Photo" class="ps-img" />
<div class="ps-img__overlay">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="11" cy="11" r="8" />
<line x1="21" y1="21" x2="16.65" y2="16.65" />
<line x1="11" y1="8" x2="11" y2="14" />
<line x1="8" y1="11" x2="14" y2="11" />
</svg>
Click to enlarge
</div>
</div>
} @else {
<div class="ps-no-img">
<svg width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="#cbd5e1" stroke-width="1.2">
<circle cx="12" cy="8" r="4" />
<path d="M4 20c0-4 3.6-7 8-7s8 3 8 7" />
</svg>
<span>No photo on file</span>
</div>
}
</div>
</div>
<!-- Signature card -->
<div class="ps-card">
<div class="ps-card__header">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z" />
</svg>
Signature
</div>
<div class="ps-card__body ps-card__body--sig">
@if (signatureUrl) {
<div class="ps-img-wrap ps-img-wrap--sig" (click)="preview(signatureUrl, 'Signature')">
<img [src]="signatureUrl" alt="Signature" class="ps-img ps-img--sig" />
<div class="ps-img__overlay">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="11" cy="11" r="8" />
<line x1="21" y1="21" x2="16.65" y2="16.65" />
<line x1="11" y1="8" x2="11" y2="14" />
<line x1="8" y1="11" x2="14" y2="11" />
</svg>
Click to enlarge
</div>
</div>
} @else {
<div class="ps-no-img">
<svg width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="#cbd5e1" stroke-width="1.2">
<path d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z" />
</svg>
<span>No signature on file</span>
</div>
}
</div>
</div>
</div>
}
</div>
<!-- Lightbox preview -->
@if (previewSrc) {
<div class="ps-lightbox" (click)="closePreview()">
<div class="ps-lightbox__inner" (click)="$event.stopPropagation()">
<div class="ps-lightbox__bar">
<span>{{ previewLabel }}</span>
<button class="ps-lightbox__close" (click)="closePreview()">✕</button>
</div>
<img [src]="previewSrc" [alt]="previewLabel" class="ps-lightbox__img" />
</div>
</div>
}
`
})
export class PhotoSignatureComponent implements OnInit {
private clerkUiState = inject(ClerkUiStateService);
private router = inject(Router);
accountLoaded = false;
photoUrl: string | null = null;
signatureUrl: string | null = null;
accountNo = '';
clientName = '';
previewSrc: string | null = null;
previewLabel = '';
ngOnInit(): void {
const s = this.clerkUiState.snapshot;
this.accountLoaded = s.accountLoaded;
if (s.savedAccount) {
this.photoUrl = s.savedAccount.clientPhotoUrl;
this.signatureUrl = s.savedAccount.signatureUrl;
this.accountNo = s.savedAccount.accountDetails?.accountNo ?? s.savedRow?.acNo ?? '';
const cd = s.savedAccount.clientDetails;
this.clientName = cd ? `${cd.firstname ?? ''} ${cd.lastname ?? ''}`.trim() : '';
}
}
preview(src: string, label: string): void {
this.previewSrc = src;
this.previewLabel = label;
}
closePreview(): void {
this.previewSrc = null;
}
goBack(): void {
this.router.navigate(['/clerk/dashboard']);
}
}