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:
co-authored by
Claude Sonnet 4.6
parent
f7d9259eb7
commit
40a436dabe
@@ -0,0 +1,395 @@
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
.ta-page {
|
||||
min-height: calc(100vh - 68px);
|
||||
background: #f0f4f8;
|
||||
padding: 24px 28px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
// ── Hero ──────────────────────────────────────────────────────────────────────
|
||||
|
||||
.ta-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%);
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
&__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%);
|
||||
}
|
||||
|
||||
&__count {
|
||||
strong {
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.ta-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 ──────────────────────────────────────────────────────────────────────
|
||||
|
||||
.ta-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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ── AML Compliance row ────────────────────────────────────────────────────────
|
||||
|
||||
.ta-aml-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.ta-aml-card {
|
||||
background: #fff;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 14px;
|
||||
padding: 18px 22px;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 14px;
|
||||
box-shadow: 0 1px 4px rgb(0 0 0 / 5%);
|
||||
transition: border-color 0.2s;
|
||||
|
||||
&--alert {
|
||||
border-color: #fca5a5;
|
||||
background: #fff5f5;
|
||||
}
|
||||
|
||||
&__icon {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
background: #f1f5f9;
|
||||
border-radius: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
color: #475569;
|
||||
}
|
||||
|
||||
&__body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
}
|
||||
|
||||
&__label {
|
||||
font-size: 11.5px;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.07em;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
&__val {
|
||||
font-size: 22px;
|
||||
font-weight: 800;
|
||||
color: #0f172a;
|
||||
font-family: monospace;
|
||||
|
||||
&--alert {
|
||||
color: #dc2626;
|
||||
}
|
||||
}
|
||||
|
||||
&__warn {
|
||||
font-size: 11px;
|
||||
color: #dc2626;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
// ── Table card ─────────────────────────────────────────────────────────────────
|
||||
|
||||
.ta-table-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;
|
||||
}
|
||||
}
|
||||
|
||||
.ta-badge {
|
||||
margin-left: 6px;
|
||||
background: #2563eb;
|
||||
color: #fff;
|
||||
font-size: 10.5px;
|
||||
font-weight: 700;
|
||||
padding: 2px 8px;
|
||||
border-radius: 999px;
|
||||
}
|
||||
|
||||
.ta-no-txn {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 40px 20px;
|
||||
color: #94a3b8;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.ta-table-wrap {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.ta-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 13px;
|
||||
|
||||
thead tr {
|
||||
background: #f8fafc;
|
||||
border-bottom: 2px solid #e2e8f0;
|
||||
}
|
||||
|
||||
th {
|
||||
padding: 10px 16px;
|
||||
text-align: left;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.07em;
|
||||
color: #64748b;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 12px 16px;
|
||||
border-bottom: 1px solid #f1f5f9;
|
||||
color: #334155;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
tbody tr:last-child td {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
tbody tr:hover td {
|
||||
background: #f8fafc;
|
||||
}
|
||||
}
|
||||
|
||||
.ta-row--cr {
|
||||
td {
|
||||
background: rgb(240 253 244 / 50%);
|
||||
}
|
||||
}
|
||||
|
||||
.ta-row--dr {
|
||||
td {
|
||||
background: rgb(255 245 245 / 50%);
|
||||
}
|
||||
}
|
||||
|
||||
.ta-cell--num {
|
||||
color: #94a3b8;
|
||||
font-size: 12px;
|
||||
width: 40px;
|
||||
}
|
||||
|
||||
.ta-cell--date {
|
||||
color: #64748b;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.ta-cell--ref {
|
||||
font-family: monospace;
|
||||
font-size: 12px;
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.ta-cell--amt {
|
||||
font-weight: 700;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
.ta-cell--cr {
|
||||
color: #16a34a;
|
||||
}
|
||||
|
||||
.ta-cell--dr {
|
||||
color: #dc2626;
|
||||
}
|
||||
|
||||
.ta-type-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 3px 10px;
|
||||
border-radius: 999px;
|
||||
font-size: 11.5px;
|
||||
font-weight: 700;
|
||||
border: 1px solid;
|
||||
|
||||
&--cr {
|
||||
background: #f0fdf4;
|
||||
border-color: #22c55e;
|
||||
color: #15803d;
|
||||
}
|
||||
|
||||
&--dr {
|
||||
background: #fff5f5;
|
||||
border-color: #fca5a5;
|
||||
color: #dc2626;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
/**
|
||||
* 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-today-activity',
|
||||
standalone: true,
|
||||
imports: [CommonModule],
|
||||
styleUrl: './today-activity.component.scss',
|
||||
template: `
|
||||
<div class="ta-page">
|
||||
<!-- Hero -->
|
||||
<div class="ta-hero">
|
||||
<div class="ta-hero__icon-wrap">
|
||||
<svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8">
|
||||
<rect x="3" y="4" width="18" height="18" rx="2" />
|
||||
<line x1="16" y1="2" x2="16" y2="6" />
|
||||
<line x1="8" y1="2" x2="8" y2="6" />
|
||||
<line x1="3" y1="10" x2="21" y2="10" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="ta-hero__text">
|
||||
<h1 class="ta-hero__title">Today's Activity</h1>
|
||||
@if (accountLoaded) {
|
||||
<div class="ta-hero__meta">
|
||||
<span class="ta-hero__ac">{{ accountNo }}</span>
|
||||
@if (clientName) {
|
||||
<span class="ta-hero__sep"></span>
|
||||
<span class="ta-hero__name">{{ clientName }}</span>
|
||||
}
|
||||
@if (transactions.length > 0) {
|
||||
<span class="ta-hero__sep"></span>
|
||||
<span class="ta-hero__count"
|
||||
><strong>{{ transactions.length }}</strong> txn today</span
|
||||
>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<button class="ta-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) {
|
||||
<div class="ta-empty">
|
||||
<div class="ta-empty__icon">
|
||||
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="#475569" stroke-width="1.3">
|
||||
<rect x="3" y="4" width="18" height="18" rx="2" />
|
||||
<line x1="16" y1="2" x2="16" y2="6" />
|
||||
<line x1="8" y1="2" x2="8" y2="6" />
|
||||
<line x1="3" y1="10" x2="21" y2="10" />
|
||||
</svg>
|
||||
</div>
|
||||
<p class="ta-empty__title">No Account Loaded</p>
|
||||
<p class="ta-empty__sub">Search an account on the Clerk Dashboard first.</p>
|
||||
<button class="ta-empty__btn" (click)="goBack()">Go to Dashboard</button>
|
||||
</div>
|
||||
} @else {
|
||||
<!-- AML Compliance cards -->
|
||||
<div class="ta-aml-row">
|
||||
<div class="ta-aml-card" [class.ta-aml-card--alert]="neftRtgs > 200000">
|
||||
<div class="ta-aml-card__icon">
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<polyline points="17 1 21 5 17 9" />
|
||||
<path d="M3 11V9a4 4 0 0 1 4-4h14" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="ta-aml-card__body">
|
||||
<span class="ta-aml-card__label">Today's NEFT / RTGS</span>
|
||||
<span class="ta-aml-card__val" [class.ta-aml-card__val--alert]="neftRtgs > 200000">
|
||||
₹{{ neftRtgs | number: '1.2-2' }}
|
||||
</span>
|
||||
@if (neftRtgs > 200000) {
|
||||
<span class="ta-aml-card__warn">Exceeds ₹2,00,000 limit</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="ta-aml-card" [class.ta-aml-card--alert]="chequeClearing > 0">
|
||||
<div class="ta-aml-card__icon">
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<rect x="1" y="4" width="22" height="16" rx="2" />
|
||||
<line x1="1" y1="10" x2="23" y2="10" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="ta-aml-card__body">
|
||||
<span class="ta-aml-card__label">Cheque In Clearing</span>
|
||||
<span class="ta-aml-card__val" [class.ta-aml-card__val--alert]="chequeClearing > 0">
|
||||
₹{{ chequeClearing | number: '1.2-2' }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Transactions table -->
|
||||
<div class="ta-table-card">
|
||||
<div class="ta-table-card__header">
|
||||
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<rect x="3" y="4" width="18" height="18" rx="2" />
|
||||
<line x1="16" y1="2" x2="16" y2="6" />
|
||||
<line x1="8" y1="2" x2="8" y2="6" />
|
||||
<line x1="3" y1="10" x2="21" y2="10" />
|
||||
</svg>
|
||||
Transactions Today
|
||||
@if (transactions.length > 0) {
|
||||
<span class="ta-badge">{{ transactions.length }}</span>
|
||||
}
|
||||
</div>
|
||||
@if (transactions.length === 0) {
|
||||
<div class="ta-no-txn">
|
||||
<svg width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="#cbd5e1" stroke-width="1.3">
|
||||
<rect x="3" y="4" width="18" height="18" rx="2" />
|
||||
<line x1="16" y1="2" x2="16" y2="6" />
|
||||
<line x1="8" y1="2" x2="8" y2="6" />
|
||||
<line x1="3" y1="10" x2="21" y2="10" />
|
||||
</svg>
|
||||
<span>No transactions today</span>
|
||||
</div>
|
||||
} @else {
|
||||
<div class="ta-table-wrap">
|
||||
<table class="ta-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Type</th>
|
||||
<th>Amount</th>
|
||||
<th>Date</th>
|
||||
<th>Reference</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (t of transactions; track t.id) {
|
||||
<tr
|
||||
[class.ta-row--cr]="t.transactionType?.deposit"
|
||||
[class.ta-row--dr]="!t.transactionType?.deposit"
|
||||
>
|
||||
<td class="ta-cell--num">{{ $index + 1 }}</td>
|
||||
<td>
|
||||
<span
|
||||
class="ta-type-badge"
|
||||
[class.ta-type-badge--cr]="t.transactionType?.deposit"
|
||||
[class.ta-type-badge--dr]="!t.transactionType?.deposit"
|
||||
>
|
||||
{{ t.transactionType?.value ?? '—' }}
|
||||
</span>
|
||||
</td>
|
||||
<td
|
||||
class="ta-cell--amt"
|
||||
[class.ta-cell--cr]="t.transactionType?.deposit"
|
||||
[class.ta-cell--dr]="!t.transactionType?.deposit"
|
||||
>
|
||||
{{ t.transactionType?.deposit ? '+' : '−' }}₹{{ t.amount ?? 0 | number: '1.2-2' }}
|
||||
</td>
|
||||
<td class="ta-cell--date">{{ t.date ?? '—' }}</td>
|
||||
<td class="ta-cell--ref">{{ t.id ?? '—' }}</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
`
|
||||
})
|
||||
export class TodayActivityComponent implements OnInit {
|
||||
private clerkUiState = inject(ClerkUiStateService);
|
||||
private router = inject(Router);
|
||||
|
||||
accountLoaded = false;
|
||||
transactions: any[] = [];
|
||||
neftRtgs = 0;
|
||||
chequeClearing = 0;
|
||||
accountNo = '';
|
||||
clientName = '';
|
||||
|
||||
ngOnInit(): void {
|
||||
const s = this.clerkUiState.snapshot;
|
||||
this.accountLoaded = s.accountLoaded;
|
||||
if (s.savedAccount) {
|
||||
this.transactions = s.savedAccount.todayTransactions ?? [];
|
||||
this.neftRtgs = s.savedAccount.sameDayNeftRtgs ?? 0;
|
||||
this.chequeClearing = s.savedAccount.sameDayChequeClearing ?? 0;
|
||||
this.accountNo = s.savedAccount.accountDetails?.accountNo ?? s.savedRow?.acNo ?? '';
|
||||
const cd = s.savedAccount.clientDetails;
|
||||
this.clientName = cd ? `${cd.firstname ?? ''} ${cd.lastname ?? ''}`.trim() : '';
|
||||
}
|
||||
}
|
||||
|
||||
goBack(): void {
|
||||
this.router.navigate(['/clerk/dashboard']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user