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,369 @@
/**
* 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;
}
.af-page {
min-height: calc(100vh - 68px);
background: #f0f4f8;
padding: 24px 28px;
display: flex;
flex-direction: column;
gap: 20px;
}
// ── Hero ──────────────────────────────────────────────────────────────────────
.af-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%;
}
&__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 5px;
}
&__stats {
display: flex;
gap: 14px;
align-items: center;
}
&__stat {
display: flex;
align-items: center;
gap: 5px;
font-size: 12.5px;
color: rgb(255 255 255 / 75%);
strong {
color: #fff;
font-weight: 700;
}
&--green strong {
color: #86efac;
}
&--red strong {
color: #fca5a5;
}
}
&__sep {
width: 1px;
height: 14px;
background: rgb(255 255 255 / 25%);
}
}
.af-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 ────────────────────────────────────────────────────────────────
.af-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;
}
}
}
// ── Progress card ──────────────────────────────────────────────────────────────
.af-progress-card {
background: #fff;
border: 1px solid #e2e8f0;
border-radius: 14px;
padding: 18px 22px;
box-shadow: 0 1px 4px rgb(0 0 0 / 6%);
&__top {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
}
&__label {
font-size: 11.5px;
font-weight: 600;
color: #64748b;
text-transform: uppercase;
letter-spacing: 0.08em;
}
&__fraction {
font-size: 13px;
font-weight: 700;
color: #16a34a;
}
}
.af-progress-bar {
height: 10px;
background: #e2e8f0;
border-radius: 999px;
overflow: hidden;
&__fill {
height: 100%;
background: linear-gradient(90deg, #16a34a, #22c55e);
border-radius: 999px;
transition: width 0.5s ease;
box-shadow: 0 0 8px rgb(34 197 94 / 35%);
}
}
// ── Facilities card ────────────────────────────────────────────────────────────
.af-fac-card {
background: #fff;
border: 1px solid #e2e8f0;
border-radius: 14px;
overflow: hidden;
box-shadow: 0 1px 4px rgb(0 0 0 / 6%);
&__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;
}
}
.af-pills {
display: flex;
flex-wrap: wrap;
gap: 10px;
padding: 20px 22px;
}
.af-pill {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 7px 15px;
border-radius: 999px;
font-size: 13px;
font-weight: 600;
border: 1.5px solid;
transition:
transform 0.15s,
box-shadow 0.15s;
cursor: default;
&__dot {
width: 7px;
height: 7px;
border-radius: 50%;
flex-shrink: 0;
}
&--on {
background: #f0fdf4;
border-color: #22c55e;
color: #15803d;
.af-pill__dot {
background: #22c55e;
box-shadow: 0 0 5px rgb(34 197 94 / 50%);
}
&:hover {
transform: translateY(-1px);
box-shadow: 0 4px 12px rgb(34 197 94 / 20%);
}
}
&--off {
background: #f8fafc;
border-color: #e2e8f0;
color: #94a3b8;
.af-pill__dot {
background: #cbd5e1;
}
}
}
// ── Stats row ─────────────────────────────────────────────────────────────────
.af-stats-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 14px;
}
.af-stat-card {
border-radius: 14px;
padding: 20px 24px;
display: flex;
align-items: center;
gap: 16px;
border: 1px solid;
box-shadow: 0 1px 4px rgb(0 0 0 / 6%);
&__icon {
width: 44px;
height: 44px;
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
font-size: 20px;
}
&__num {
font-size: 30px;
font-weight: 800;
line-height: 1;
display: block;
}
&__label {
font-size: 12px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.08em;
display: block;
margin-top: 3px;
opacity: 0.75;
}
&--green {
background: linear-gradient(135deg, #f0fdf4, #dcfce7);
border-color: #86efac;
color: #15803d;
.af-stat-card__icon {
background: #bbf7d0;
}
}
&--red {
background: linear-gradient(135deg, #f8fafc, #f1f5f9);
border-color: #cbd5e1;
color: #475569;
.af-stat-card__icon {
background: #e2e8f0;
}
}
}
@@ -0,0 +1,141 @@
/**
* 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-account-facilities',
standalone: true,
imports: [CommonModule],
styleUrl: './account-facilities.component.scss',
template: `
<div class="af-page">
<!-- Hero -->
<div class="af-hero">
<div class="af-hero__icon-wrap">
<svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8">
<rect x="1" y="4" width="22" height="16" rx="2" />
<line x1="1" y1="10" x2="23" y2="10" />
</svg>
</div>
<div class="af-hero__text">
<h1 class="af-hero__title">Account Facilities</h1>
@if (accountLoaded) {
<div class="af-hero__stats">
<span class="af-hero__stat af-hero__stat--green">
<strong>{{ activeCount }}</strong> Active
</span>
<span class="af-hero__sep"></span>
<span class="af-hero__stat af-hero__stat--red">
<strong>{{ facilities.length - activeCount }}</strong> Inactive
</span>
<span class="af-hero__sep"></span>
<span class="af-hero__stat">
<strong>{{ facilities.length }}</strong> Total
</span>
</div>
}
</div>
<button class="af-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="af-empty">
<div class="af-empty__icon">
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="#475569" stroke-width="1.3">
<rect x="1" y="4" width="22" height="16" rx="2" />
<line x1="1" y1="10" x2="23" y2="10" />
</svg>
</div>
<p class="af-empty__title">No Account Loaded</p>
<p class="af-empty__sub">Search an account on the Clerk Dashboard first.</p>
<button class="af-empty__btn" (click)="goBack()">Go to Dashboard</button>
</div>
} @else {
<!-- Progress bar -->
<div class="af-progress-card">
<div class="af-progress-card__top">
<span class="af-progress-card__label">Facility Coverage</span>
<span class="af-progress-card__fraction">{{ activeCount }} / {{ facilities.length }}</span>
</div>
<div class="af-progress-bar">
<div class="af-progress-bar__fill" [style.width.%]="(activeCount / facilities.length) * 100"></div>
</div>
</div>
<!-- Facilities pills -->
<div class="af-fac-card">
<div class="af-fac-card__header">
<svg width="13" height="13" 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>
All Facilities
</div>
<div class="af-pills">
@for (f of facilities; track f.label) {
<span class="af-pill" [class.af-pill--on]="f.active" [class.af-pill--off]="!f.active">
<span class="af-pill__dot"></span>
{{ f.label }}
</span>
}
</div>
</div>
<!-- Stats row -->
<div class="af-stats-row">
<div class="af-stat-card af-stat-card--green">
<div class="af-stat-card__icon">✓</div>
<div>
<span class="af-stat-card__num">{{ activeCount }}</span>
<span class="af-stat-card__label">Active</span>
</div>
</div>
<div class="af-stat-card af-stat-card--red">
<div class="af-stat-card__icon">✗</div>
<div>
<span class="af-stat-card__num">{{ facilities.length - activeCount }}</span>
<span class="af-stat-card__label">Inactive</span>
</div>
</div>
</div>
}
</div>
`
})
export class AccountFacilitiesComponent implements OnInit {
private clerkUiState = inject(ClerkUiStateService);
private router = inject(Router);
accountLoaded = false;
facilities: { label: string; active: boolean }[] = [];
get activeCount(): number {
return this.facilities.filter((f) => f.active).length;
}
ngOnInit(): void {
this.clerkUiState.state$.subscribe((s) => {
this.accountLoaded = s.accountLoaded;
this.facilities = s.facilities;
});
}
goBack(): void {
this.router.navigate(['/clerk/dashboard']);
}
}
@@ -0,0 +1,18 @@
/**
* 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 } from '@angular/core';
import { TransactionEntryComponent } from '../../cashier/transaction-entry/transaction-entry.component';
@Component({
selector: 'mifosx-clerk-dashboard',
standalone: true,
imports: [TransactionEntryComponent],
template: `<mifosx-transaction-entry></mifosx-transaction-entry>`
})
export class ClerkDashboardComponent {}
@@ -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']);
}
}
@@ -0,0 +1,373 @@
/**
* 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;
}
.si-page {
min-height: calc(100vh - 68px);
background: #f0f4f8;
padding: 24px 28px;
display: flex;
flex-direction: column;
gap: 20px;
}
// ── Hero ──────────────────────────────────────────────────────────────────────
.si-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 {
color: rgb(255 255 255 / 75%);
strong {
color: #fff;
}
}
}
.si-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 ────────────────────────────────────────────────────────────────
.si-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;
}
}
}
// ── Stats row ─────────────────────────────────────────────────────────────────
.si-stats-row {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 14px;
}
.si-stat {
border-radius: 14px;
padding: 18px 22px;
display: flex;
align-items: center;
gap: 14px;
border: 1px solid;
box-shadow: 0 1px 4px rgb(0 0 0 / 6%);
&__icon {
width: 42px;
height: 42px;
border-radius: 11px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
font-size: 18px;
font-weight: 700;
}
&__num {
font-size: 28px;
font-weight: 800;
line-height: 1;
display: block;
}
&__label {
font-size: 11.5px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.07em;
display: block;
margin-top: 3px;
opacity: 0.7;
}
&--blue {
background: linear-gradient(135deg, #eff6ff, #dbeafe);
border-color: #93c5fd;
color: #1d4ed8;
.si-stat__icon {
background: #bfdbfe;
}
}
&--green {
background: linear-gradient(135deg, #f0fdf4, #dcfce7);
border-color: #86efac;
color: #15803d;
.si-stat__icon {
background: #bbf7d0;
}
}
&--grey {
background: linear-gradient(135deg, #f8fafc, #f1f5f9);
border-color: #cbd5e1;
color: #475569;
.si-stat__icon {
background: #e2e8f0;
}
}
}
// ── Table card ─────────────────────────────────────────────────────────────────
.si-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;
}
}
.si-table-wrap {
overflow-x: auto;
}
.si-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;
}
}
.si-row {
&--active td {
background: #fafffe;
}
}
.si-cell--num {
color: #94a3b8;
font-size: 12px;
width: 40px;
}
.si-cell--name {
font-weight: 600;
color: #1e293b;
}
.si-cell--amt {
font-weight: 700;
color: #0f172a;
font-family: monospace;
}
.si-cell--ac {
font-family: monospace;
font-size: 12px;
color: #475569;
}
.si-badge {
display: inline-flex;
align-items: center;
padding: 3px 10px;
border-radius: 999px;
font-size: 11.5px;
font-weight: 700;
border: 1px solid;
&--active {
background: #f0fdf4;
border-color: #22c55e;
color: #15803d;
}
&--inactive {
background: #f8fafc;
border-color: #e2e8f0;
color: #94a3b8;
}
}
@@ -0,0 +1,196 @@
/**
* 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-standing-instructions',
standalone: true,
imports: [CommonModule],
styleUrl: './standing-instructions.component.scss',
template: `
<div class="si-page">
<!-- Hero -->
<div class="si-hero">
<div class="si-hero__icon-wrap">
<svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8">
<polyline points="17 1 21 5 17 9" />
<path d="M3 11V9a4 4 0 0 1 4-4h14" />
<polyline points="7 23 3 19 7 15" />
<path d="M21 13v2a4 4 0 0 1-4 4H3" />
</svg>
</div>
<div class="si-hero__text">
<h1 class="si-hero__title">Standing Instructions</h1>
@if (accountLoaded) {
<div class="si-hero__meta">
<span class="si-hero__ac">{{ accountNo }}</span>
@if (clientName) {
<span class="si-hero__sep"></span>
<span class="si-hero__name">{{ clientName }}</span>
}
<span class="si-hero__sep"></span>
<span class="si-hero__count">
<strong>{{ instructions.length }}</strong> instruction{{ instructions.length !== 1 ? 's' : '' }}
</span>
</div>
}
</div>
<button class="si-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="si-empty">
<div class="si-empty__icon">
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="#475569" stroke-width="1.3">
<polyline points="17 1 21 5 17 9" />
<path d="M3 11V9a4 4 0 0 1 4-4h14" />
<polyline points="7 23 3 19 7 15" />
<path d="M21 13v2a4 4 0 0 1-4 4H3" />
</svg>
</div>
<p class="si-empty__title">No Account Loaded</p>
<p class="si-empty__sub">Search an account on the Clerk Dashboard first.</p>
<button class="si-empty__btn" (click)="goBack()">Go to Dashboard</button>
</div>
} @else if (instructions.length === 0) {
<div class="si-empty">
<div class="si-empty__icon">
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="#475569" stroke-width="1.3">
<polyline points="17 1 21 5 17 9" />
<path d="M3 11V9a4 4 0 0 1 4-4h14" />
<polyline points="7 23 3 19 7 15" />
<path d="M21 13v2a4 4 0 0 1-4 4H3" />
</svg>
</div>
<p class="si-empty__title">No Standing Instructions</p>
<p class="si-empty__sub">This account has no standing instructions set up.</p>
</div>
} @else {
<!-- Stats row -->
<div class="si-stats-row">
<div class="si-stat si-stat--blue">
<div class="si-stat__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" />
<polyline points="7 23 3 19 7 15" />
<path d="M21 13v2a4 4 0 0 1-4 4H3" />
</svg>
</div>
<div>
<span class="si-stat__num">{{ instructions.length }}</span>
<span class="si-stat__label">Total</span>
</div>
</div>
<div class="si-stat si-stat--green">
<div class="si-stat__icon">&#10003;</div>
<div>
<span class="si-stat__num">{{ activeCount }}</span>
<span class="si-stat__label">Active</span>
</div>
</div>
<div class="si-stat si-stat--grey">
<div class="si-stat__icon">&#8212;</div>
<div>
<span class="si-stat__num">{{ instructions.length - activeCount }}</span>
<span class="si-stat__label">Inactive</span>
</div>
</div>
</div>
<!-- Instructions table -->
<div class="si-table-card">
<div class="si-table-card__header">
<svg width="13" height="13" 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" />
<polyline points="7 23 3 19 7 15" />
<path d="M21 13v2a4 4 0 0 1-4 4H3" />
</svg>
All Standing Instructions
</div>
<div class="si-table-wrap">
<table class="si-table">
<thead>
<tr>
<th>#</th>
<th>Name</th>
<th>Amount</th>
<th>From Account</th>
<th>To Account</th>
<th>Frequency</th>
<th>Valid Till</th>
<th>Status</th>
</tr>
</thead>
<tbody>
@for (si of instructions; track si.id) {
<tr class="si-row" [class.si-row--active]="si.status?.value === 'Active'">
<td class="si-cell--num">{{ $index + 1 }}</td>
<td class="si-cell--name">{{ si.name ?? '&#8212;' }}</td>
<td class="si-cell--amt">&#8377;{{ si.amount ?? 0 | number: '1.2-2' }}</td>
<td class="si-cell--ac">{{ si.fromAccountId ?? '&#8212;' }}</td>
<td class="si-cell--ac">{{ si.toAccountId ?? '&#8212;' }}</td>
<td>{{ si.recurrenceType?.value ?? si.instructionType?.value ?? '&#8212;' }}</td>
<td>{{ si.validTill ?? si.endDate ?? '&#8212;' }}</td>
<td>
<span
class="si-badge"
[class.si-badge--active]="si.status?.value === 'Active'"
[class.si-badge--inactive]="si.status?.value !== 'Active'"
>
{{ si.status?.value ?? '&#8212;' }}
</span>
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
}
</div>
`
})
export class StandingInstructionsComponent implements OnInit {
private clerkUiState = inject(ClerkUiStateService);
private router = inject(Router);
accountLoaded = false;
instructions: any[] = [];
accountNo = '';
clientName = '';
get activeCount(): number {
return this.instructions.filter((si) => si.status?.value === 'Active').length;
}
ngOnInit(): void {
const s = this.clerkUiState.snapshot;
this.accountLoaded = s.accountLoaded;
if (s.savedAccount) {
this.instructions = s.savedAccount.standingInstructions ?? [];
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']);
}
}
@@ -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">
&#8377;{{ neftRtgs | number: '1.2-2' }}
</span>
@if (neftRtgs > 200000) {
<span class="ta-aml-card__warn">Exceeds &#8377;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">
&#8377;{{ 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 ?? '&#8212;' }}
</span>
</td>
<td
class="ta-cell--amt"
[class.ta-cell--cr]="t.transactionType?.deposit"
[class.ta-cell--dr]="!t.transactionType?.deposit"
>
{{ t.transactionType?.deposit ? '+' : '&#8722;' }}&#8377;{{ t.amount ?? 0 | number: '1.2-2' }}
</td>
<td class="ta-cell--date">{{ t.date ?? '&#8212;' }}</td>
<td class="ta-cell--ref">{{ t.id ?? '&#8212;' }}</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']);
}
}