refractor(df/locale):shares module (#1300)

This commit is contained in:
Abhishek Kumar
2021-08-08 13:19:47 +05:30
committed by GitHub
parent 88ee1b4fcd
commit 18ab9cf128
10 changed files with 62 additions and 30 deletions
@@ -6,6 +6,7 @@ import { ActivatedRoute, Router } from '@angular/router';
/** Custom Services */
import { SharesService } from 'app/shares/shares.service';
import { SettingsService } from 'app/settings/settings.service';
/**
* Redeem Shares Component
@@ -35,12 +36,14 @@ export class RedeemSharesComponent implements OnInit {
* @param {DatePipe} datePipe Date Pipe
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
* @param {SettingsService} settingsService Settings Service.
*/
constructor(private formBuilder: FormBuilder,
private sharesService: SharesService,
private datePipe: DatePipe,
private route: ActivatedRoute,
private router: Router) {
private router: Router,
private settingsService: SettingsService) {
this.accountId = this.route.parent.snapshot.params['shareAccountId'];
this.route.data.subscribe((data: { shareAccountActionData: any }) => {
this.sharesAccountData = data.shareAccountActionData;
@@ -74,8 +77,8 @@ export class RedeemSharesComponent implements OnInit {
*/
submit() {
// TODO: Update once language and date settings are setup
const locale = 'en';
const dateFormat = 'dd MMMM yyyy';
const locale = this.settingsService.language.code;
const dateFormat = this.settingsService.dateFormat;
const prevRequestedDate: Date = this.redeemSharesForm.value.requestedDate;
this.redeemSharesForm.patchValue({
requestedDate: this.datePipe.transform(prevRequestedDate, dateFormat),