/** 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 ClientsService { param { HttpClient } http constructor ( private http ) { } getFilteredClients ( orderBy , sortOrder , orphansOnly , displayName , officeId ? ) { let httpParams = new HttpParams ( ) . set ( 'displayName' , displayName ) . set ( 'orphansOnly' , orphansOnly . toString ( ) ) . set ( 'sortOrder' , sortOrder ) . set ( 'orderBy' , orderBy ) ; if ( officeId ) { httpParams = httpParams . set ( 'officeId' , officeId ) ; } return this . http . get ( '/clients' , { params : httpParams } ) ; } getClients ( orderBy , sortOrder , offset , limit ) { const httpParams = new HttpParams ( ) . set ( 'offset' , offset . toString ( ) ) . set ( 'limit' , limit . toString ( ) ) . set ( 'sortOrder' , sortOrder ) . set ( 'orderBy' , orderBy ) ; return this . http . get ( '/clients' , { params : httpParams } ) ; } getClientTemplate ( ) { return this . http . get ( '/clients/template' ) ; } getClientData ( clientId ) { return this . http . get ( `/clients/${ clientId }` ) ; } createClient ( client ) { return this . http . post ( `/clients` , client ) ; } updateClient ( clientId , client ) { return this . http . put ( `/clients/${ clientId }` , client ) ; } deleteClient ( clientId ) { return this . http . delete ( `/clients/${ clientId }` ) ; } getClientDataAndTemplate ( clientId ) { const httpParams = new HttpParams ( ) . set ( 'template' , 'true' ) . set ( 'staffInSelectedOfficeOnly' , 'true' ) ; return this . http . get ( `/clients/${ clientId }` , { params : httpParams } ) ; } getClientDatatables ( ) { const httpParams = new HttpParams ( ) . set ( 'apptable' , 'm_client' ) ; return this . http . get ( `/datatables` , { params : httpParams } ) ; } getClientDatatable ( clientId , datatableName ) { const httpParams = new HttpParams ( ) . set ( 'genericResultSet' , 'true' ) ; return this . http . get ( `/datatables/${ datatableName }/${ clientId }` , { params : httpParams } ) ; } addClientDatatableEntry ( clientId , datatableName , data ) { const httpParams = new HttpParams ( ) . set ( 'genericResultSet' , 'true' ) ; return this . http . post ( `/datatables/${ datatableName }/${ clientId }` , data , { params : httpParams } ) ; } editClientDatatableEntry ( clientId , datatableName , data ) { const httpParams = new HttpParams ( ) . set ( 'genericResultSet' , 'true' ) ; return this . http . put ( `/datatables/${ datatableName }/${ clientId }` , data , { params : httpParams } ) ; } deleteDatatableContent ( clientId , datatableName ) { const httpParams = new HttpParams ( ) . set ( 'genericResultSet' , 'true' ) ; return this . http . delete ( `/datatables/${ datatableName }/${ clientId }` , { params : httpParams } ) ; } getClientAccountData ( clientId ) { return this . http . get ( `/clients/${ clientId }/accounts` ) ; } getClientChargesData ( clientId ) { const httpParams = new HttpParams ( ) . set ( 'pendingPayment' , 'true' ) ; return this . http . get ( `/clients/${ clientId }/charges` , { params : httpParams } ) ; } getSelectedChargeData ( clientId , chargeId ) { const httpParams = new HttpParams ( ) . set ( 'associations' , 'all' ) ; return this . http . get ( `/clients/${ clientId }/charges/${ chargeId }` , { params : httpParams } ) ; } param chargeData waiveClientCharge ( chargeData ) { const httpParams = new HttpParams ( ) . set ( 'command' , 'waive' ) ; return this . http . post ( `/clients/${ chargeData . clientId }/charges/${ chargeData . resourceType }` , chargeData , { params : httpParams } ) ; } getAllClientCharges ( clientId ) { return this . http . get ( `/clients/${ clientId }/charges` ) ; } param transactionData undoTransaction ( transactionData ) { return this . http . post ( `/clients/${ transactionData . clientId }/transactions/${ transactionData . transactionId }?command=undo` , transactionData ) ; } param clientId param chargeId deleteCharge ( clientId , chargeId ) { return this . http . delete ( `/clients/${ clientId }/charges/${ chargeId }?associations=all` ) ; } getClientTransactionPay ( clientId , chargeId ) { return this . http . get ( `/clients/${ clientId }/charges/${ chargeId }` ) ; } param clientId param chargeId param payment payClientCharge ( clientId , chargeId , payment ) { const httpParams = new HttpParams ( ) . set ( 'command' , 'paycharge' ) ; return this . http . post ( `/clients/${ clientId }/charges/${ chargeId }?command=paycharge` , payment , { params : httpParams } ) ; } getClientSummary ( clientId ) { const httpParams = new HttpParams ( ) . set ( 'R_clientId' , clientId ) . set ( 'genericResultSet' , 'false' ) ; return this . http . get ( `/runreports/ClientSummary` , { params : httpParams } ) ; } getClientProfileImage ( clientId ) { const httpParams = new HttpParams ( ) . set ( 'maxHeight' , '150' ) ; return this . http . skipErrorHandler ( ) . get ( `/clients/${ clientId }/images` , { params : httpParams , responseType : 'text' } ) ; } uploadClientProfileImage ( clientId , image ) { const formData = new FormData ( ) ; formData . append ( 'file' , image ) ; formData . append ( 'filename' , 'file' ) ; return this . http . post ( `/clients/${ clientId }/images` , formData ) ; } uploadCapturedClientProfileImage ( clientId , imageURL ) { return this . http . post ( `/clients/${ clientId }/images` , imageURL ) ; } deleteClientProfileImage ( clientId ) { return this . http . delete ( `/clients/${ clientId }/images` ) ; } uploadClientSignatureImage ( clientId , signature ) { const formData = new FormData ( ) ; formData . append ( 'file' , signature ) ; formData . append ( 'filename' , signature . name ) ; return this . http . post ( `/clients/${ clientId }/images` , formData ) ; } getClientSignatureImage ( clientId , documentId ) { const httpParams = new HttpParams ( ) . set ( 'tenantIdentifier' , 'default' ) ; return this . http . get ( `/clients/${ clientId }/documents/${ documentId }/attachment` , { params : httpParams , responseType : 'blob' } ) ; } getClientFamilyMembers ( clientId ) { return this . http . get ( `/clients/${ clientId }/familymembers` ) ; } getClientFamilyMember ( clientId , familyMemberId ) { return this . http . get ( `/clients/${ clientId }/familymembers/${ familyMemberId }` ) ; } addFamilyMember ( clientId , familyMemberData ) { return this . http . post ( `/clients/${ clientId }/familymembers` , familyMemberData ) ; } editFamilyMember ( clientId , familyMemberId , familyMemberData ) { return this . http . put ( `/clients/${ clientId }/familymembers/${ familyMemberId }` , familyMemberData ) ; } deleteFamilyMember ( clientId , familyMemberId ) { return this . http . delete ( `/clients/${ clientId }/familymembers/${ familyMemberId }` ) ; } getClientIdentifiers ( clientId ) { return this . http . get ( `/clients/${ clientId }/identifiers` ) ; } getClientIdentifierTemplate ( clientId ) { return this . http . get ( `/clients/${ clientId }/identifiers/template` ) ; } addClientIdentifier ( clientId , identifierData ) { return this . http . post ( `/clients/${ clientId }/identifiers` , identifierData ) ; } deleteClientIdentifier ( clientId , identifierId ) { return this . http . delete ( `/clients/${ clientId }/identifiers/${ identifierId }` ) ; } getClientIdentificationDocuments ( documentId ) { return this . http . get ( `/client_identifiers/${ documentId }/documents` ) ; } downloadClientIdentificationDocument ( parentEntityId , documentId ) { return this . http . get ( `/client_identifiers/${ parentEntityId }/documents/${ documentId }/attachment` , { responseType : 'blob' } ) ; } uploadClientIdentifierDocument ( identifierId , documentData ) { return this . http . post ( `/client_identifiers/${ identifierId }/documents` , documentData ) ; } getClientDocuments ( clientId ) { return this . http . get ( `/clients/${ clientId }/documents` ) ; } downloadClientDocument ( parentEntityId , documentId ) { return this . http . get ( `/clients/${ parentEntityId }/documents/${ documentId }/attachment` , { responseType : 'blob' } ) ; } uploadClientDocument ( clientId , documentData ) { return this . http . post ( `/clients/${ clientId }/documents` , documentData ) ; } deleteClientDocument ( parentEntityId , documentId ) { return this . http . delete ( `/clients/${ parentEntityId }/documents/${ documentId }` ) ; } getClientNotes ( clientId ) { return this . http . get ( `/clients/${ clientId }/notes` ) ; } createClientNote ( clientId , noteData ) { return this . http . post ( `/clients/${ clientId }/notes` , noteData ) ; } editClientNote ( clientId , noteId , noteData ) { return this . http . put ( `/clients/${ clientId }/notes/${ noteId }` , noteData ) ; } deleteClientNote ( clientId , noteId ) { return this . http . delete ( `/clients/${ clientId }/notes/${ noteId }` ) ; } getAddressFieldConfiguration ( ) { return this . http . get ( `/fieldconfiguration/ADDRESS` ) ; } getClientAddressData ( clientId ) { return this . http . get ( `/client/${ clientId }/addresses` ) ; } getClientAddressTemplate ( ) { return this . http . get ( `/client/addresses/template` ) ; } createClientAddress ( clientId , addressTypeId , addressData ) { return this . http . post ( `/client/${ clientId }/addresses?type=${ addressTypeId }` , addressData ) ; } editClientAddress ( clientId , addressTypeId , addressData ) { return this . http . put ( `/client/${ clientId }/addresses?type=${ addressTypeId }` , addressData ) ; } executeClientCommand ( clientId , command , data ) { const httpParams = new HttpParams ( ) . set ( 'command' , command ) ; return this . http . post ( `/clients/${ clientId }` , data , { params : httpParams } ) ; } getClientCommandTemplate ( command ) { const httpParams = new HttpParams ( ) . set ( 'commandParam' , command ) ; return this . http . get ( `/clients/template` , { params : httpParams } ) ; } getClientTransferProposalDate ( clientId ) { return this . http . get ( `/clients/${ clientId }/transferproposaldate` ) ; } getClientChargeTemplate ( clientId ) { return this . http . get ( `/clients/${ clientId }/charges/template` ) ; } getChargeAndTemplate ( chargeId ) { const httpParams = new HttpParams ( ) . set ( 'template' , 'true' ) ; return this . http . get ( `/charges/${ chargeId }` , { params : httpParams } ) ; } createClientCharge ( clientId , charge ) { return this . http . post ( `/clients/${ clientId }/charges` , charge ) ; } getClientReportTemplates ( ) { const httpParams = new HttpParams ( ) . set ( 'entityId' , '0' ) . set ( 'typeId' , '0' ) ; return this . http . get ( '/templates' , { params : httpParams } ) ; } retrieveClientReportTemplate ( templateId , clientId ) { const httpParams = new HttpParams ( ) . set ( 'clientId' , clientId ) ; return this . http . post ( `/templates/${ templateId }` , { } , { params : httpParams , responseType : 'text' } ) ; } returns { Observable < any > } getOffices ( ) { return this . http . get ( '/offices' ) ; } param clientId getSurveys ( clientId ) { return this . http . get ( `/surveys/scorecards/clients/${ clientId }` ) ; } /**
     * returns the list of survey types and questions
     */ getAllSurveysType ( ) { return this . http . get ( '/surveys' ) ; } param surveyId param surveyData createNewSurvey ( surveyId , surveyData ) { return this . http . post ( `/surveys/scorecards/${ surveyId }` , surveyData ) ; } param userData createSelfServiceUser ( userData ) { return this . http . post ( `/users` , userData ) ; } }