/** * 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/. */ /** Angular Imports */ import { Injectable, inject } from '@angular/core'; import { HttpClient, HttpParams } from '@angular/common/http'; /** rxjs Imports */ import { Observable } from 'rxjs'; /** * Home Service */ @Injectable({ providedIn: 'root' }) export class HomeService { private http = inject(HttpClient); /** * @param {number} officeId Office Id. * @returns {Observable} */ getCollectedAmount(officeId: number): Observable { const httpParams = new HttpParams().set('R_officeId', officeId.toString()).set('genericResultSet', 'false'); return this.http.get('/runreports/Demand Vs Collection', { params: httpParams }); } /** * @param {number} officeId Office Id. * @returns {Observable} */ getDisbursedAmount(officeId: number): Observable { const httpParams = new HttpParams().set('R_officeId', officeId.toString()).set('genericResultSet', 'false'); return this.http.get('/runreports/Disbursal Vs Awaitingdisbursal', { params: httpParams }); } /** * @param {number} officeId Office Id. * @returns {Observable} */ getClientTrendsByDay(officeId: number): Observable { const httpParams = new HttpParams().set('R_officeId', officeId.toString()).set('genericResultSet', 'false'); return this.http.get('/runreports/ClientTrendsByDay', { params: httpParams }); } /** * @param {number} officeId Office Id. * @returns {Observable} */ getClientTrendsByWeek(officeId: number): Observable { const httpParams = new HttpParams().set('R_officeId', officeId.toString()).set('genericResultSet', 'false'); return this.http.get('/runreports/ClientTrendsByWeek', { params: httpParams }); } /** * @param {number} officeId Office Id. * @returns {Observable} */ getClientTrendsByMonth(officeId: number): Observable { const httpParams = new HttpParams().set('R_officeId', officeId.toString()).set('genericResultSet', 'false'); return this.http.get('/runreports/ClientTrendsByMonth', { params: httpParams }); } /** * @param {number} officeId Office Id. * @returns {Observable} */ getLoanTrendsByDay(officeId: number): Observable { const httpParams = new HttpParams().set('R_officeId', officeId.toString()).set('genericResultSet', 'false'); return this.http.get('/runreports/LoanTrendsByDay', { params: httpParams }); } /** * @param {number} officeId Office Id. * @returns {Observable} */ getLoanTrendsByWeek(officeId: number): Observable { const httpParams = new HttpParams().set('R_officeId', officeId.toString()).set('genericResultSet', 'false'); return this.http.get('/runreports/LoanTrendsByWeek', { params: httpParams }); } /** * @param {number} officeId Office Id. * @returns {Observable} */ getLoanTrendsByMonth(officeId: number): Observable { const httpParams = new HttpParams().set('R_officeId', officeId.toString()).set('genericResultSet', 'false'); return this.http.get('/runreports/LoanTrendsByMonth', { params: httpParams }); } }