refactor (df/locale): loans module (#1264)

See: #1213
This commit is contained in:
Shubhankar Bhadra
2020-10-25 13:06:23 +05:30
committed by GitHub
parent 2b5341aa2c
commit 9d438b140e
26 changed files with 179 additions and 84 deletions
@@ -5,6 +5,9 @@ import { Router, ActivatedRoute } from '@angular/router';
import { LoansService } from 'app/loans/loans.service';
import { DatePipe } from '@angular/common';
/** Custom Services */
import { SettingsService } from 'app/settings/settings.service';
@Component({
selector: 'mifosx-loans-account-close',
templateUrl: './loans-account-close.component.html',
@@ -28,12 +31,14 @@ export class LoansAccountCloseComponent implements OnInit {
* @param {LoansService} systemService Loan Service.
* @param {ActivatedRoute} route Activated Route.
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: FormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
private datePipe: DatePipe) {
private datePipe: DatePipe,
private settingsService: SettingsService) {
this.loanId = this.route.parent.snapshot.params['loanId'];
}
@@ -60,12 +65,12 @@ export class LoansAccountCloseComponent implements OnInit {
*/
submit() {
const transactionDate = this.closeLoanForm.value.transactionDate;
const dateFormat = 'yyyy-MM-dd';
const dateFormat = this.settingsService.dateFormat;
this.closeLoanForm.patchValue({
transactionDate: this.datePipe.transform(transactionDate, dateFormat)
});
const closeForm = this.closeLoanForm.value;
closeForm.locale = 'en';
closeForm.locale = this.settingsService.language.code;
closeForm.dateFormat = dateFormat;
this.loanService.submitLoanActionButton(this.loanId, closeForm, 'close')
.subscribe((response: any) => {