/** Angular Imports */ import { Injectable } from '@angular/core' ; import { HttpClient , HttpParams } from '@angular/common/http' ; /** rxjs Imports */ import { Observable } from 'rxjs' ; /** Custom Imports. */ import { SettingsService } from 'app/settings/settings.service' ; /**
 * Organization service.
 */ @ Injectable ( { providedIn : 'root' } ) export class OrganizationService { param { HttpClient } http constructor ( private http , private settingsService ) { } returns { Observable < any > } getProvisioningCriterias ( ) { return this . http . get ( '/provisioningcriteria' ) ; } returns { Observable < any > } getProvisioningCriteriaTemplate ( ) { return this . http . get ( '/provisioningcriteria/template' ) ; } param { string } provisioningId returns { Observable < any > } getProvisioningCriteria ( provisioningId , template = false ) { const httpParams = new HttpParams ( ) . set ( 'template' , template . toString ( ) ) ; return this . http . get ( `/provisioningcriteria/${ provisioningId }` , { params : httpParams } ) ; } param { any } criteriaData returns { Observable < any > } createProvisioningCriteria ( criteriaData ) { return this . http . post ( '/provisioningcriteria' , criteriaData ) ; } param { any } criteriaId param { any } criteriaData returns { Observable < any > } updateProvisioningCriteria ( criteriaId , criteriaData ) { return this . http . put ( `/provisioningcriteria/${ criteriaId }` , criteriaData ) ; } param { string } provisioningId returns { Observable < any > } deleteProvisioningCriteria ( criteriaId ) { return this . http . delete ( `/provisioningcriteria/${ criteriaId }` ) ; } returns { Observable < any > } getOffices ( ) { return this . http . get ( '/offices' ) ; } param { string } officeId returns { Observable < any > } getOfficeTemplate ( officeId ) { const httpParams = new HttpParams ( ) . set ( 'officeId' , officeId . toString ( ) ) ; return this . http . get ( `/loans/loanreassignment/template` , { params : httpParams } ) ; } param officerId param officeId getOfficerTemplate ( officerId , officeId ) { const httpParams = new HttpParams ( ) . set ( 'fromLoanOfficerId' , officerId . toString ( ) ) . set ( 'officeId' , officerId . toString ( ) ) ; return this . http . get ( '/loans/loanreassignment/template' , { params : httpParams } ) ; } param loanData returns { Observable < any > } createLoanReassignment ( loanData ) { return this . http . post ( '/loans/loanreassignment' , loanData ) ; } param { string } officeId param { boolean } template returns { Observable < any > } getOffice ( officeId , template = false ) { const httpParams = new HttpParams ( ) . set ( 'template' , template . toString ( ) ) ; return this . http . get ( `/offices/${ officeId }` , { params : httpParams } ) ; } param { any } office returns { Observable < any > } createOffice ( office ) { return this . http . post ( '/offices' , office ) ; } param { any } office param { string } officeId returns { Observable < any > } updateOffice ( officeId , office ) { return this . http . put ( `/offices/${ officeId }` , office ) ; } returns { Observable < any > } getOfficeDatatables ( ) { const httpParams = new HttpParams ( ) . set ( 'apptable' , 'm_office' ) ; return this . http . get ( `/datatables` , { params : httpParams } ) ; } param officeId param datatableName returns { Observable < any > } getOfficeDatatable ( officeId , datatableName ) { const httpParams = new HttpParams ( ) . set ( 'genericResultSet' , 'true' ) ; return this . http . get ( `/datatables/${ datatableName }/${ officeId }` , { params : httpParams } ) ; } param officeId param datatableName param data returns { Observable < any > } addOfficeDatatableEntry ( officeId , datatableName , data ) { const httpParams = new HttpParams ( ) . set ( 'genericResultSet' , 'true' ) ; return this . http . post ( `/datatables/${ datatableName }/${ officeId }` , data , { params : httpParams } ) ; } param officeId param datatableName param data returns { Observable < any > } editOfficeDatatableEntry ( officeId , datatableName , data ) { const httpParams = new HttpParams ( ) . set ( 'genericResultSet' , 'true' ) ; return this . http . put ( `/datatables/${ datatableName }/${ officeId }` , data , { params : httpParams } ) ; } param officeId param datatableName returns { Observable < any > } deleteDatatableContent ( officeId , datatableName ) { const httpParams = new HttpParams ( ) . set ( 'genericResultSet' , 'true' ) ; return this . http . delete ( `/datatables/${ datatableName }/${ officeId }` , { params : httpParams } ) ; } returns { Observable < any > } getEmployees ( ) { const httpParams = new HttpParams ( ) . set ( 'status' , 'all' ) ; return this . http . get ( '/staff' , { params : httpParams } ) ; } param { any } employee returns { Observable < any > } createEmployee ( employee ) { return this . http . post ( '/staff' , employee ) ; } param { string } employeeId param { boolean } template returns { Observable < any > } getEmployee ( employeeId , template = true ) { const httpParams = new HttpParams ( ) . set ( 'template' , template . toString ( ) ) ; return this . http . get ( `/staff/${ employeeId }` , { params : httpParams } ) ; } returns { Observable < any > } getCurrencies ( ) { return this . http . get ( '/currencies' ) ; } param { any [ ] } currencies returns { Observable < any > } updateCurrencies ( currencies ) { return this . http . put ( '/currencies' , { currencies } ) ; } returns { Observable < any > } getSmsCampaigns ( ) { return this . http . get ( '/smscampaigns' ) ; } param { string } smsCampaignId returns { Observable < any > } getSmsCampaign ( campaignId ) { return this . http . get ( `/smscampaigns/${ campaignId }` ) ; } param { any } campaign returns { Observable < any > } createSmsCampaign ( campaign ) { return this . http . post ( '/smscampaigns' , campaign ) ; } param { any } campaign returns { Observable < any > } updateSmsCampaign ( campaign , campaignId ) { return this . http . put ( `/smscampaigns/${ campaignId }` , campaign ) ; } param { any } campaign returns { Observable < any > } deleteSmsCampaign ( campaignId ) { return this . http . delete ( `/smscampaigns/${ campaignId }` ) ; } returns { Observable < any > } getSmsCampaignTemplate ( ) { return this . http . get ( '/smscampaigns/template' ) ; } param { string } campaignId param { any } data param { string } command returns { Observable < any > } executeSmsCampaignCommand ( campaignId , data , command ) { const httpParams = new HttpParams ( ) . set ( 'command' , command . toString ( ) ) ; return this . http . post ( `/smscampaigns/${ campaignId }` , data , { params : httpParams } ) ; } param { any } SMS returns { Observable < any > } getMessagebyStatus ( SMS ) { let httpParams = new HttpParams ( ) . set ( 'status' , SMS . status . toString ( ) ) . set ( 'locale' , SMS . locale ) . set ( 'dateFormat' , SMS . dateFormat ) ; httpParams = SMS . fromDate ? httpParams . set ( 'fromDate' , SMS . fromDate ) : httpParams ; httpParams = SMS . toDate ? httpParams . set ( 'toDate' , SMS . toDate ) : httpParams ; return this . http . get ( `/sms/${ SMS . id }/messageByStatus` , { params : httpParams } ) ; } returns { Observable < any > } getAdhocQueries ( ) { return this . http . get ( '/adhocquery' ) ; } param { string } adhocQueryId returns { Observable < any > } getAdhocQuery ( adhocQueryId ) { return this . http . get ( `/adhocquery/${ adhocQueryId }` ) ; } returns { Observable < any > } getAdhocQueryTemplate ( ) { return this . http . get ( `/adhocquery/template` ) ; } param { string } adhocQueryId returns { Observable < any > } getAdhocQueryAndTemplate ( adhocQueryId ) { const httpParams = new HttpParams ( ) . set ( 'template' , 'true' ) ; return this . http . get ( `/adhocquery/${ adhocQueryId }` , { params : httpParams } ) ; } param { any } adhocQuery returns { Observable < any > } createAdhocQuery ( adhocQuery ) { return this . http . post ( '/adhocquery' , adhocQuery ) ; } param { any } queryId param { any } adhocQuery returns { Observable < any > } updateAdhocQuery ( queryId , adhocQuery ) { return this . http . put ( `/adhocquery/${ queryId }` , adhocQuery ) ; } param { string } adhocQueryId returns { Observable < any > } deleteAdhocQuery ( adhocQueryId ) { return this . http . delete ( `/adhocquery/${ adhocQueryId }` ) ; } returns { Observable < any > } getTellers ( ) { return this . http . get ( '/tellers' ) ; } param { string } tellerId returns { Observable < any > } getTeller ( tellerId ) { return this . http . get ( `/tellers/${ tellerId }` ) ; } param { string } tellerId returns { Observable < any > } getCashiers ( tellerId ) { return this . http . get ( `/tellers/${ tellerId }/cashiers` ) ; } param { string } tellerId param { string } cashierId returns { Observable < any > } getCashier ( tellerId , cashierId ) { return this . http . get ( `/tellers/${ tellerId }/cashiers/${ cashierId }` ) ; } param { string } tellerId param { string } cashierId param { string } currencyCode returns { Observable < any > } getCashierSummaryAndTransactions ( tellerId , cashierId , currencyCode ) { const httpParams = new HttpParams ( ) . set ( 'currencyCode' , currencyCode ) ; return this . http . get ( `/tellers/${ tellerId }/cashiers/${ cashierId }/summaryandtransactions` , { params : httpParams } ) ; } param { string } tellerId param { string } cashierId returns { Observable < any > } getCashierTransactionTemplate ( tellerId , cashierId ) { return this . http . get ( `/tellers/${ tellerId }/cashiers/${ cashierId }/transactions/template` ) ; } param { string } tellerId param { any } cashier returns { Observable < any > } createCashier ( tellerId , cashier ) { return this . http . post ( `/tellers/${ tellerId }/cashiers` , cashier ) ; } param { string } tellerId param { string } cashierId returns { Observable < any > } deleteCashier ( tellerId , cashierId ) { return this . http . delete ( `/tellers/${ tellerId }/cashiers/${ cashierId }` ) ; } param { string } tellerId param { string } cashierId param { string } cashData returns { Observable < any > } settleCash ( tellerId , cashierId , cashData ) { const httpParams = new HttpParams ( ) . set ( 'command' , 'settle' ) ; return this . http . post ( `/tellers/${ tellerId }/cashiers/${ cashierId }/settle` , cashData , { params : httpParams } ) ; } param { string } tellerId param { string } cashierId param { string } cashData returns { Observable < any > } allocateCash ( tellerId , cashierId , cashData ) { const httpParams = new HttpParams ( ) . set ( 'command' , 'allocate' ) ; return this . http . post ( `/tellers/${ tellerId }/cashiers/${ cashierId }/allocate` , cashData , { params : httpParams } ) ; } param tellerId returns { Observable < any > } getCashierTemplate ( tellerId ) { return this . http . get ( `/tellers/${ tellerId }/cashiers/template` ) ; } param tellerId param cashierId param cashierData returns { Observable < any > } updateCashier ( tellerId , cashierId , cashierData ) { return this . http . put ( `/tellers/${ tellerId }/cashiers/${ cashierId }` , cashierData ) ; } param { string } tellerId returns { Observable < any > } deleteTeller ( tellerId ) { return this . http . delete ( `/tellers/${ tellerId }` ) ; } param { any } teller returns { Observable < any > } createTeller ( teller ) { return this . http . post ( '/tellers' , teller ) ; } returns { Observable < any > } getPaymentTypes ( ) { return this . http . get ( '/paymenttypes' ) ; } param { any } paymentType returns { Observable < any > } createPaymentType ( paymentType ) { return this . http . post ( '/paymenttypes' , paymentType ) ; } param { string } paymentTypeId returns { Observable < any > } deletePaymentType ( paymentTypeId ) { return this . http . delete ( `/paymenttypes/${ paymentTypeId }` ) ; } param { string } paymentTypeId returns { Observable < any > } getPaymentType ( paymentTypeId ) { return this . http . get ( `/paymenttypes/${ paymentTypeId }` ) ; } param { string } paymentTypeId returns { Observable < any > } updatePaymentType ( paymentTypeId , paymentType ) { return this . http . put ( `/paymenttypes/${ paymentTypeId }` , paymentType ) ; } returns { Observable < any > } getPasswordPreferencesTemplate ( ) { return this . http . get ( '/passwordpreferences/template' ) ; } param { any } passwordPreferences returns { Observable < any > } updatePasswordPreferences ( passwordPreferences ) { return this . http . put ( '/passwordpreferences' , passwordPreferences ) ; } param { number } offset param { number } limit returns { Observable < any > } getEntityDataTableChecks ( offset = 0 , limit = - 1 ) { const httpParams = new HttpParams ( ) . set ( 'offset' , offset . toString ( ) ) . set ( 'limit' , limit . toString ( ) ) ; return this . http . get ( '/entityDatatableChecks' , { params : httpParams } ) ; } /**
     * Get Entity Data Table Checks Template.
     */ getEntityDataTableChecksTemplate ( ) { return this . http . get ( '/entityDatatableChecks/template' ) ; } param entityData createEntityDataTableChecks ( entityData ) { return this . http . post ( '/entityDatatableChecks' , entityData ) ; } param { string } entityDataTableCheckId returns { Observable < any > } deleteEntityDataTableCheck ( entityDataTableCheckId ) { return this . http . delete ( `/entityDatatableChecks/${ entityDataTableCheckId }` ) ; } returns { Observable < any > } getWorkingDays ( ) { return this . http . get ( '/workingdays' ) ; } param { any } workingDays returns { Observable < any > } updateWorkingDays ( workingDays ) { return this . http . put ( '/workingdays' , workingDays ) ; } param { string } officeId returns { Observable < any > } getHolidays ( officeId ) { const httpParams = new HttpParams ( ) . set ( 'officeId' , officeId . toString ( ) ) ; return this . http . get ( '/holidays' , { params : httpParams } ) ; } param holidayId returns { Observable < any > } getHoliday ( holidayId ) { return this . http . get ( `/holidays/${ holidayId }` ) ; } returns { Observable < any > } getHolidayTemplate ( ) { return this . http . get ( '/holidays/template' ) ; } param holidayData returns { Observable < any > } createHoliday ( holidayData ) { return this . http . post ( '/holidays' , holidayData ) ; } param holidayId param holidayData returns { Observable < any > } updateHoliday ( holidayId , holidayData ) { return this . http . put ( `/holidays/${ holidayId }` , holidayData ) ; } param holidayId returns { Observable < any > } deleteHoliday ( holidayId ) { return this . http . delete ( `/holidays/${ holidayId }` ) ; } param holidayId returns { Observable < any > } activateHoliday ( holidayId ) { const httpParams = new HttpParams ( ) . set ( 'command' , 'activate' ) ; return this . http . post ( `/holidays/${ holidayId }` , null , { params : httpParams } ) ; } param { any } employeeId returns { Observable < any > } updateEmployee ( employeeId , employee ) { return this . http . put ( `/staff/${ employeeId }` , employee ) ; } param { string } tellerId returns { Observable < any > } updateTeller ( tellerId , teller ) { return this . http . put ( `/tellers/${ tellerId }` , teller ) ; } returns { Observable < any > } getFunds ( ) { return this . http . get ( '/funds' ) ; } param { any } fund returns { Observable < any > } createFund ( fund ) { return this . http . post ( '/funds' , fund ) ; } param { string } fundId param { any } fundData returns { Observable < any > } editFund ( fundId , fundData ) { return this . http . put ( `/funds/${ fundId }` , fundData ) ; } getStaff ( officeId ) { const httpParams = new HttpParams ( ) . set ( 'officeId' , officeId . toString ( ) ) ; return this . http . get ( '/staff' , { params : httpParams } ) ; } param { string } entity returns { Observable < any > } getImports ( entity ) { const httpParams = new HttpParams ( ) . set ( 'entityType' , entity ) ; return this . http . get ( '/imports' , { params : httpParams } ) ; } returns { Observable < any > } getAdvanceSearchTemplate ( ) { return this . http . get ( '/search/template' ) ; } returns { Observable < any > } retrieveAdvanceSearchResults ( queryObject ) { return this . http . post ( '/search/advance' , queryObject ) ; } returns { Observable < any > } getStandingInstructionTemplate ( ) { return this . http . get ( '/standinginstructions/template' ) ; } param { any } instruction returns { Observable < any > } getStandingInstructions ( instruction ) { let httpParams = new HttpParams ( ) ; for ( const key in instruction ) { if ( instruction [ key ] !== '' && instruction [ key ] !== null ) { httpParams = httpParams . set ( key , instruction [ key ] ) ; } } return this . http . get ( `/standinginstructionrunhistory` , { params : httpParams } ) ; } param urlSuffix param officeId param staffId param legalFormType returns { Observable < any > } getImportTemplate ( urlSuffix , officeId , staffId , legalFormType ) { let httpParams = new HttpParams ( ) . set ( 'tenantIdentifier' , 'default' ) . set ( 'locale' , this . settingsService . language . code ) . set ( 'dateFormat' , this . settingsService . dateFormat ) ; if ( officeId ) { httpParams = httpParams . set ( 'officeId' , officeId . toString ( ) ) ; } if ( staffId ) { httpParams = httpParams . set ( 'staffId' , staffId . toString ( ) ) ; } if ( legalFormType . length ) { httpParams = httpParams . set ( 'legalFormType' , legalFormType ) ; } return this . http . get ( `${ urlSuffix }/downloadtemplate` , { params : httpParams , responseType : 'arraybuffer' , observe : 'response' } ) ; } param { any } id returns { Observable < any > } getImportDocument ( id ) { const httpParams = new HttpParams ( ) . set ( 'importDocumentId' , id ) . set ( 'tenantIdentifier' , 'default' ) ; return this . http . get ( '/imports/downloadOutputTemplate' , { params : httpParams , responseType : 'arraybuffer' , observe : 'response' } ) ; } param { File } file param { string } urlSuffix param { string } legalFormType returns { Observable < any > } uploadImportDocument ( file , urlSuffix , legalFormType ) { let httpParams = new HttpParams ( ) ; if ( legalFormType . length ) { httpParams = httpParams . set ( 'legalFormType' , legalFormType ) ; } const formData = new FormData ( ) ; formData . append ( 'file' , file ) ; formData . append ( 'locale' , this . settingsService . language . code ) ; formData . append ( 'dateFormat' , this . settingsService . dateFormat ) ; return this . http . post ( `${ urlSuffix }/uploadtemplate` , formData , { params : httpParams } ) ; } }