/** * 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 { Injectable, inject } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; /** * HTTP service for the Bank Manager's Dividend Dashboard — members with a locked (3-year) * share dividend who also have an overdue loan EMI, with an action to apply the locked dividend * towards that EMI. */ @Injectable({ providedIn: 'root' }) export class DividendDashboardService { private http = inject(HttpClient); getDashboard(): Observable { return this.http.get('/clerk/dividend-dashboard'); } applyToLoan(lockId: number, loanId: number, amount: number): Observable { return this.http.post(`/clerk/dividend-dashboard/${lockId}/apply-to-loan`, { loanId, amount: String(amount) }); } getSummary(): Observable { return this.http.get('/clerk/dividend-dashboard/summary'); } getDeclarations(): Observable { return this.http.get('/clerk/dividend-dashboard/declarations'); } getLocks(status?: string): Observable { const params = status && status !== 'ALL' ? { status } : {}; return this.http.get('/clerk/dividend-dashboard/locks', { params }); } }