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
@@ -6,6 +6,7 @@ import { DatePipe } from '@angular/common';
/** Custom Services. */
import { OrganizationService } from '../organization.service';
import { SettingsService } from 'app/settings/settings.service';
/**
* Bulk Loan Reassignment component.
@@ -40,11 +41,14 @@ export class BulkLoanReassignmnetComponent implements OnInit {
* Get Office data from `resolver`.
* @param {FormBuilder} formBuilder Form Builder.
* @param {ActivatedRoute} route Activated Route.
* @param {OrganizationService} organizationSevice Organization Service.
* @param {SettingsService} settingsService Settings Service.
* @param {Router} router Router.
*/
constructor(private formBuilder: FormBuilder,
private route: ActivatedRoute,
private organizationSevice: OrganizationService,
private settingsService: SettingsService,
private datePipe: DatePipe,
private router: Router) {
this.route.data.subscribe((data: { offices: any} ) => {
@@ -109,13 +113,13 @@ export class BulkLoanReassignmnetComponent implements OnInit {
* Submits bulk loan reassignment form.
*/
submit() {
const dateFormat = 'yyyy-MM-dd';
const dateFormat = this.settingsService.dateFormat;
const assignmentDate = this.bulkLoanForm.value.assignmentDate;
this.bulkLoanForm.patchValue({
assignmentDate: this.datePipe.transform(assignmentDate, dateFormat)
});
const bulkForm = this.bulkLoanForm.value;
bulkForm.locale = 'en';
bulkForm.locale = this.settingsService.language.code;
bulkForm.dateFormat = dateFormat;
bulkForm.loans = this.loans;
this.organizationSevice.createLoanReassignment(bulkForm).subscribe((response: any) => {