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
@@ -5,6 +5,7 @@ import { Router, ActivatedRoute } from '@angular/router';
/** Custom Services */
import { OrganizationService } from '../organization.service';
import { SettingsService } from 'app/settings/settings.service';
/** Recurrence default value. */
const recurrenceDefaultValue = 'FREQ=WEEKLY;INTERVAL=1;BYDAY=';
@@ -41,11 +42,13 @@ export class WorkingDaysComponent implements OnInit {
* @param {FormBuilder} formBuilder Form Builder.
* @param {ActivatedRoute} route Activated Route.
* @param {OrganizationService} organizationService Organization Service.
* @param {SettingsService} settingsService Settings Service.
* @param {Router} router Router for navigation.
*/
constructor(private formBuilder: FormBuilder,
private route: ActivatedRoute,
private organizationService: OrganizationService,
private settingsService: SettingsService,
private router: Router) {
this.route.data.subscribe((data: { workingDays: any }) => {
this.workingDaysData = data.workingDays;
@@ -103,7 +106,7 @@ export class WorkingDaysComponent implements OnInit {
submit() {
const workingDays = this.workingDaysForm.value;
// TODO: Update once language and date settings are setup
workingDays.locale = 'en';
workingDays.locale = this.settingsService.language.code;
let recurrence = recurrenceDefaultValue;
for (let i = 0; i < this.weekDays.length; i++) {
if (workingDays.recurrence[i]) {