refactor (df/locale): organization module (#1268)

See: #1213
This commit is contained in:
Benura Abeywardena
2020-11-12 19:36:37 +05:30
committed by GitHub
parent dbd34aaf42
commit 5f90bc00bd
26 changed files with 139 additions and 62 deletions
+8 -5
View File
@@ -5,6 +5,9 @@ import { HttpClient, HttpParams } from '@angular/common/http';
/** rxjs Imports */
import { Observable } from 'rxjs';
/** Custom Imports. */
import { SettingsService } from 'app/settings/settings.service';
/**
* Organization service.
*/
@@ -16,7 +19,7 @@ export class OrganizationService {
/**
* @param {HttpClient} http Http Client to send requests.
*/
constructor(private http: HttpClient) { }
constructor(private http: HttpClient, private settingsService: SettingsService) { }
/**
* @returns {Observable<any>} Loan Provisioning Criteria data
@@ -740,8 +743,8 @@ export class OrganizationService {
getImportTemplate(urlSuffix: string, officeId: any, staffId: any, legalFormType: string): Observable<any> {
let httpParams = new HttpParams()
.set('tenantIdentifier', 'default')
.set('locale', 'en')
.set('dateFormat', 'dd MMMM yyyy');
.set('locale', this.settingsService.language.code)
.set('dateFormat', this.settingsService.dateFormat);
if (officeId) {
httpParams = httpParams.set('officeId', officeId.toString());
}
@@ -778,8 +781,8 @@ export class OrganizationService {
}
const formData = new FormData();
formData.append('file', file);
formData.append('locale', 'en');
formData.append('datefFormat', 'dd MMMM yyyy');
formData.append('locale', this.settingsService.language.code);
formData.append('datefFormat', this.settingsService.dateFormat);
return this.http.post(`${urlSuffix}/uploadtemplate`, formData , { params: httpParams } );
}