/** Angular Imports */ import { Injectable } from '@angular/core' ; import { HttpClient , HttpParams } from '@angular/common/http' ; /** rxjs Imports */ import { Observable } from 'rxjs' ; /**
 * Clients service.
 */ @ Injectable ( { providedIn : 'root' } ) export class CentersService { param { HttpClient } http constructor ( private http ) { } param { any } filterBy param { string } orderBy param { string } sortOrder param { number } offset param { number } limit returns { Observable < any > } getCenters ( filterBy , orderBy , sortOrder , offset , limit ) { let httpParams = new HttpParams ( ) . set ( 'offset' , offset . toString ( ) ) . set ( 'limit' , limit . toString ( ) ) . set ( 'sortOrder' , sortOrder ) . set ( 'orderBy' , orderBy ) . set ( 'paged' , 'true' ) ; filterBy . forEach ( function ( filter ) { if ( filter . value ) { console . log ( filter . value ) ; httpParams = httpParams . set ( filter . type , filter . value ) ; } } ) ; return this . http . get ( '/centers' , { params : httpParams } ) ; } param { any } center returns { Observable < any > } createCenter ( center ) { return this . http . post ( '/centers' , center ) ; } param { number } officeId returns { Observable < any > } getStaff ( officeId ) { const httpParams = new HttpParams ( ) . set ( 'officeId' , officeId . toString ( ) ) . set ( 'staffInSelectedOfficeOnly' , 'true' ) ; return this . http . get ( '/centers/template' , { params : httpParams } ) ; } param centerId returns { Observable < any > } getCenterData ( centerId ) { const httpParams = new HttpParams ( ) . set ( 'associations' , 'groupMembers,collectionMeetingCalendar' ) ; return this . http . get ( `/centers/${ centerId }` , { params : httpParams } ) ; } param centerId returns { Observable < any > } getCenterSummary ( centerId ) { const httpParams = new HttpParams ( ) . set ( 'R_groupId' , centerId ) . set ( 'genericResultSet' , 'false' ) ; return this . http . get ( `/runreports/GroupSummaryCounts` , { params : httpParams } ) ; } param centerId returns { Observable < any > } getSavingsAccountDetails ( centerId ) { return this . http . get ( `/centers/${ centerId }/accounts` ) ; } param centerId returns getCenterNotes ( centerId ) { return this . http . get ( `/groups/${ centerId }/notes` ) ; } param centerId param noteData returns { Observable < any > } createCenterNote ( centerId , noteData ) { return this . http . post ( `/groups/${ centerId }/notes` , noteData ) ; } param centerId param noteId param noteData editCenterNote ( centerId , noteId , noteData ) { return this . http . put ( `/groups/${ centerId }/notes/${ noteId }` , noteData ) ; } param centerId param noteId deleteCenterNote ( centerId , noteId ) { return this . http . delete ( `/groups/${ centerId }/notes/${ noteId }` ) ; } /**
     * Get Center Datatables
     */ getcenterDatatables ( ) { const httpParams = new HttpParams ( ) . set ( 'apptable' , 'm_center' ) ; return this . http . get ( `/datatables` , { params : httpParams } ) ; } param centerId param datatableName getCenterDatatable ( centerId , datatableName ) { const httpParams = new HttpParams ( ) . set ( 'genericResultSet' , 'true' ) ; return this . http . get ( `/datatables/${ datatableName }/${ centerId }` , { params : httpParams } ) ; } param centerId param datatableName param data returns { Observable < any > } addCenterDatatableEntry ( centerId , datatableName , data ) { const httpParams = new HttpParams ( ) . set ( 'genericResultSet' , 'true' ) ; return this . http . post ( `/datatables/${ datatableName }/${ centerId }` , data , { params : httpParams } ) ; } param centerId param datatableName param data returns { Observable < any > } editCenterDatatableEntry ( centerId , datatableName , data ) { const httpParams = new HttpParams ( ) . set ( 'genericResultSet' , 'true' ) ; return this . http . put ( `/datatables/${ datatableName }/${ centerId }` , data , { params : httpParams } ) ; } param centerId param datatableName returns { Observable < any > } deleteDatatableContent ( centerId , datatableName ) { const httpParams = new HttpParams ( ) . set ( 'genericResultSet' , 'true' ) ; return this . http . delete ( `/datatables/${ datatableName }/${ centerId }` , { params : httpParams } ) ; } param { string } centerId param { string } command param { any } data returns { Observable < any > } executeCenterActionCommand ( centerId , command , data ) { const httpParams = new HttpParams ( ) . set ( 'command' , command ) ; return this . http . post ( `/centers/${ centerId }` , data , { params : httpParams } ) ; } param { string } centerId param { string } command param { any } data returns { Observable < any > } executeGroupActionCommand ( centerId , command , data ) { const httpParams = new HttpParams ( ) . set ( 'command' , command ) ; return this . http . post ( `/groups/${ centerId }` , data , { params : httpParams } ) ; } param centerId returns { Observable < any > } getGroupStaffData ( centerId ) { const httpParams = new HttpParams ( ) . set ( 'groupOrCenter' , 'centers' ) . set ( 'staffInSelectedOfficeOnly' , 'true' ) . set ( 'template' , 'true' ) ; return this . http . get ( `/groups/${ centerId }` , { params : httpParams } ) ; } deleteCenter ( centerId ) { return this . http . delete ( `/centers/${ centerId }` ) ; } getCentersData ( centerId , associations , template ? ) { let httpParams = new HttpParams ( ) . set ( 'associations' , associations ) ; httpParams = template ? httpParams . set ( 'template' , template ) : httpParams ; return this . http . get ( `/centers/${ centerId }` , { params : httpParams } ) ; } getMeetingsTemplate ( centerId , calendarId ) { const httpParams = new HttpParams ( ) . set ( 'calenderId' , calendarId ) ; return this . http . get ( `/centers/${ centerId }/meetings/template` ) ; } assignCenterAttendance ( centerId , calendarId , data ) { const httpParams = new HttpParams ( ) . set ( 'calenderId' , calendarId ) ; return this . http . post ( `/centers/${ centerId }/meetings` , data , { params : httpParams } ) ; } getCalendarTemplate ( centerId ) { return this . http . get ( `/centers/${ centerId }/calendars/template` ) ; } createCenterMeeting ( centerId , data ) { return this . http . post ( `/centers/${ centerId }/calendars` , data ) ; } getCalendarAndTemplate ( centerId , calendarId ) { const httpParams = new HttpParams ( ) . set ( 'template' , 'true' ) ; return this . http . get ( `/centers/${ centerId }/calendars/${ calendarId }` , { params : httpParams } ) ; } updateCenterMeeting ( centerId , data , calendarId ) { return this . http . put ( `/centers/${ centerId }/calendars/${ calendarId }` , data ) ; } param { any } reportName param { object } centerId returns { Observable < any > } getStaffAssignmentHistoryData ( reportName , centerId , tenantIdentifier , locale ) { const httpParams = new HttpParams ( ) . set ( 'tenantIdentifier' , tenantIdentifier ) . set ( 'locale' , locale ) . set ( 'R_centerId' , centerId ) ; return this . http . get ( `/runreports/${ reportName }` , { responseType : 'arraybuffer' , observe : 'response' , params : httpParams } ) ; } param centerId returns { Observable < any > } getCenterAndTemplateData ( centerId ) { const httpParams = new HttpParams ( ) . set ( 'staffInSelectedOfficeOnly' , 'true' ) . set ( 'template' , 'true' ) ; return this . http . get ( `/centers/${ centerId }` , { params : httpParams } ) ; } param centerId param data returns { Observable < any > } executeEditCenter ( centerId , data ) { return this . http . put ( `/groups/${ centerId }` , data ) ; } }