@@ -31,6 +31,7 @@ export class CreateOfficeComponent implements OnInit {
|
||||
* Retrieves the offices data from `resolve`.
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {OrganizationService} organizationService Organization Service.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {DatePipe} datePipe Date Pipe to format date.
|
||||
|
||||
@@ -6,6 +6,7 @@ import { DatePipe } from '@angular/common';
|
||||
|
||||
/** Custom Services */
|
||||
import { OrganizationService } from 'app/organization/organization.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
/**
|
||||
* Edit Office component.
|
||||
@@ -29,6 +30,7 @@ export class EditOfficeComponent implements OnInit {
|
||||
/**
|
||||
* Retrieves the charge data from `resolve`.
|
||||
* @param {ProductsService} organizationService Organization Service.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
@@ -36,6 +38,7 @@ export class EditOfficeComponent implements OnInit {
|
||||
* @param {DatePipe} datepipe Convert Date.
|
||||
*/
|
||||
constructor(private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private formBuilder: FormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
@@ -68,12 +71,12 @@ export class EditOfficeComponent implements OnInit {
|
||||
*/
|
||||
submit() {
|
||||
const openedOn: Date = this.officeForm.value.openingDate;
|
||||
const dateFormat = 'yyyy-MM-dd';
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
this.officeForm.patchValue({
|
||||
openingDate: this.datepipe.transform(openedOn, dateFormat)
|
||||
});
|
||||
const office = this.officeForm.value;
|
||||
office.locale = 'en';
|
||||
office.locale = this.settingsService.language.code;
|
||||
office.dateFormat = dateFormat;
|
||||
this.organizationService.updateOffice(this.officeData.id, office).subscribe((response: any) => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
|
||||
+5
-2
@@ -18,6 +18,7 @@ import { DatepickerBase } from 'app/shared/form-dialog/formfield/model/datepicke
|
||||
|
||||
/** Custom Services */
|
||||
import { OrganizationService } from '../../../../organization.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
/**
|
||||
* Office Multi Row Data Tables
|
||||
@@ -51,11 +52,13 @@ export class MultiRowComponent implements OnInit, OnChanges {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {DatePipe} datePipe Date Pipe.
|
||||
* @param {OrganizationService} organizationService Organization Service.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
* @param {MatDialog} dialog Mat Dialog.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private datePipe: DatePipe,
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private dialog: MatDialog) {
|
||||
this.officeId = this.route.parent.parent.snapshot.paramMap.get('id');
|
||||
}
|
||||
@@ -85,7 +88,7 @@ export class MultiRowComponent implements OnInit, OnChanges {
|
||||
* Adds a new row to the given multi row data table.
|
||||
*/
|
||||
add() {
|
||||
let dataTableEntryObject: any = { locale: 'en' };
|
||||
let dataTableEntryObject: any = { locale: this.settingsService.language.code };
|
||||
const dateTransformColumns: string[] = [];
|
||||
const columns = this.dataObject.columnHeaders.filter((column: any) => {
|
||||
return ((column.columnName !== 'id') && (column.columnName !== 'office_id'));
|
||||
@@ -118,7 +121,7 @@ export class MultiRowComponent implements OnInit, OnChanges {
|
||||
});
|
||||
case 'DATE': {
|
||||
dateTransformColumns.push(column.columnName);
|
||||
dataTableEntryObject.dateFormat = 'yyyy-MM-dd';
|
||||
dataTableEntryObject.dateFormat = this.settingsService.dateFormat;
|
||||
return new DatepickerBase({
|
||||
controlName: column.columnName,
|
||||
label: column.columnName,
|
||||
|
||||
+7
-4
@@ -17,6 +17,7 @@ import { CheckboxBase } from 'app/shared/form-dialog/formfield/model/checkbox-ba
|
||||
|
||||
/** Custom Services */
|
||||
import { OrganizationService } from '../../../../organization.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
/**
|
||||
* Offices Single Row Data Tables
|
||||
@@ -41,12 +42,14 @@ export class SingleRowComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {DatePipe} datePipe Date Pipe.
|
||||
* @param {OrganizationService} organizationService Organization Service.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
* @param {MatDialog} dialog Mat Dialog.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private datePipe: DatePipe,
|
||||
private dialog: MatDialog,
|
||||
private organizationService: OrganizationService) {
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService ) {
|
||||
this.officeId = this.route.parent.parent.snapshot.paramMap.get('id');
|
||||
}
|
||||
|
||||
@@ -64,7 +67,7 @@ export class SingleRowComponent implements OnInit {
|
||||
* Creates a new instance of the given single row data table.
|
||||
*/
|
||||
add() {
|
||||
let dataTableEntryObject: any = { locale: 'en' };
|
||||
let dataTableEntryObject: any = { locale: this.settingsService.language.code };
|
||||
const dateTransformColumns: string[] = [];
|
||||
const columns = this.dataObject.columnHeaders.filter((column: any) => {
|
||||
return ((column.columnName !== 'id') && (column.columnName !== 'office_id'));
|
||||
@@ -94,7 +97,7 @@ export class SingleRowComponent implements OnInit {
|
||||
* Edits the current instance of single row data table.
|
||||
*/
|
||||
edit() {
|
||||
let dataTableEntryObject: any = { locale: 'en' };
|
||||
let dataTableEntryObject: any = { locale: this.settingsService.language.code };
|
||||
const dateTransformColumns: string[] = [];
|
||||
const columns = this.dataObject.columnHeaders.filter((column: any) => {
|
||||
return ((column.columnName !== 'id') && (column.columnName !== 'office_id'));
|
||||
@@ -179,7 +182,7 @@ export class SingleRowComponent implements OnInit {
|
||||
});
|
||||
case 'DATE': {
|
||||
dateTransformColumns.push(column.columnName);
|
||||
dataTableEntryObject.dateFormat = 'yyyy-MM-dd';
|
||||
dataTableEntryObject.dateFormat = this.settingsService.dateFormat;
|
||||
return new DatepickerBase({
|
||||
controlName: column.columnName,
|
||||
label: column.columnName,
|
||||
|
||||
Reference in New Issue
Block a user