refactor (df/locale): system transfer module (#1305)
This commit is contained in:
@@ -11,6 +11,7 @@ import { AuditTrailsDataSource } from './audit-trail.datasource';
|
|||||||
|
|
||||||
/** Custom Services */
|
/** Custom Services */
|
||||||
import { SystemService } from '../system.service';
|
import { SystemService } from '../system.service';
|
||||||
|
import { SettingsService } from 'app/settings/settings.service';
|
||||||
|
|
||||||
/** rxjs Imports */
|
/** rxjs Imports */
|
||||||
import { merge } from 'rxjs';
|
import { merge } from 'rxjs';
|
||||||
@@ -90,11 +91,11 @@ export class AuditTrailsComponent implements OnInit, AfterViewInit {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'dateFormat',
|
type: 'dateFormat',
|
||||||
value: 'yyyy-MM-dd'
|
value: this.settingsService.dateFormat
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'locale',
|
type: 'locale',
|
||||||
value: 'en'
|
value: this.settingsService.language.code
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
/** User form control. */
|
/** User form control. */
|
||||||
@@ -130,7 +131,8 @@ export class AuditTrailsComponent implements OnInit, AfterViewInit {
|
|||||||
*/
|
*/
|
||||||
constructor(private route: ActivatedRoute,
|
constructor(private route: ActivatedRoute,
|
||||||
private systemService: SystemService,
|
private systemService: SystemService,
|
||||||
private datePipe: DatePipe) {
|
private datePipe: DatePipe,
|
||||||
|
private settingsService: SettingsService) {
|
||||||
this.route.data.subscribe((data: { auditTrailSearchTemplate: any }) => {
|
this.route.data.subscribe((data: { auditTrailSearchTemplate: any }) => {
|
||||||
this.auditTrailSearchTemplateData = data.auditTrailSearchTemplate;
|
this.auditTrailSearchTemplateData = data.auditTrailSearchTemplate;
|
||||||
});
|
});
|
||||||
@@ -382,7 +384,7 @@ export class AuditTrailsComponent implements OnInit, AfterViewInit {
|
|||||||
* Generates the CSV file of Audit Trails Data.
|
* Generates the CSV file of Audit Trails Data.
|
||||||
*/
|
*/
|
||||||
downloadCSV() {
|
downloadCSV() {
|
||||||
const dateFormat = 'yyyy-MM-dd';
|
const dateFormat = this.settingsService.dateFormat;
|
||||||
const replacer = (key: any, value: any) => value === undefined ? '' : value;
|
const replacer = (key: any, value: any) => value === undefined ? '' : value;
|
||||||
const header = ['ID', 'Resource ID', 'Status', 'Office', 'Made On', 'Maker', 'Checked On', 'Checker', 'Entity', 'Action', 'Client'];
|
const header = ['ID', 'Resource ID', 'Status', 'Office', 'Made On', 'Maker', 'Checked On', 'Checker', 'Entity', 'Action', 'Client'];
|
||||||
const headerCode = ['id', 'resourceId', 'processingResult', 'officeName', 'madeOnDate', 'maker', 'checkedOnDate', 'checker', 'entityName', 'actionName', 'clientName'];
|
const headerCode = ['id', 'resourceId', 'processingResult', 'officeName', 'madeOnDate', 'maker', 'checkedOnDate', 'checker', 'entityName', 'actionName', 'clientName'];
|
||||||
@@ -411,7 +413,7 @@ export class AuditTrailsComponent implements OnInit, AfterViewInit {
|
|||||||
* @param {any} timestamp Timestamp from which date is to be extracted.
|
* @param {any} timestamp Timestamp from which date is to be extracted.
|
||||||
*/
|
*/
|
||||||
private getDate(timestamp: any) {
|
private getDate(timestamp: any) {
|
||||||
const dateFormat = 'yyyy-MM-dd';
|
const dateFormat = this.settingsService.dateFormat;
|
||||||
return this.datePipe.transform(timestamp, dateFormat);
|
return this.datePipe.transform(timestamp, dateFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { DatePipe } from '@angular/common';
|
|||||||
/** Custom Services */
|
/** Custom Services */
|
||||||
import { SystemService } from 'app/system/system.service';
|
import { SystemService } from 'app/system/system.service';
|
||||||
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
||||||
|
import { SettingsService } from 'app/settings/settings.service';
|
||||||
|
|
||||||
/** Custom Components */
|
/** Custom Components */
|
||||||
import { DeleteDialogComponent } from '../../shared/delete-dialog/delete-dialog.component';
|
import { DeleteDialogComponent } from '../../shared/delete-dialog/delete-dialog.component';
|
||||||
@@ -82,7 +83,8 @@ export class EntityToEntityMappingComponent implements OnInit {
|
|||||||
private formBuilder: FormBuilder,
|
private formBuilder: FormBuilder,
|
||||||
private systemService: SystemService,
|
private systemService: SystemService,
|
||||||
private datePipe: DatePipe,
|
private datePipe: DatePipe,
|
||||||
private dialog: MatDialog) {
|
private dialog: MatDialog,
|
||||||
|
private settingsService: SettingsService) {
|
||||||
this.route.data.subscribe((data: { entityMappings: any }) => {
|
this.route.data.subscribe((data: { entityMappings: any }) => {
|
||||||
this.entityMappings = data.entityMappings;
|
this.entityMappings = data.entityMappings;
|
||||||
});
|
});
|
||||||
@@ -313,7 +315,7 @@ export class EntityToEntityMappingComponent implements OnInit {
|
|||||||
if (addMappingForm.value.toId === '') {
|
if (addMappingForm.value.toId === '') {
|
||||||
addMappingForm.value.toId = undefined;
|
addMappingForm.value.toId = undefined;
|
||||||
}
|
}
|
||||||
const dateFormat = 'dd MMMM yyyy';
|
const dateFormat = this.settingsService.dateFormat;
|
||||||
|
|
||||||
const startDate: Date = addMappingForm.value.startDate;
|
const startDate: Date = addMappingForm.value.startDate;
|
||||||
const endDate: Date = addMappingForm.value.endDate;
|
const endDate: Date = addMappingForm.value.endDate;
|
||||||
@@ -324,7 +326,7 @@ export class EntityToEntityMappingComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
const newMappingData = addMappingForm.value;
|
const newMappingData = addMappingForm.value;
|
||||||
newMappingData.dateFormat = dateFormat;
|
newMappingData.dateFormat = dateFormat;
|
||||||
newMappingData.locale = 'en';
|
newMappingData.locale = this.settingsService.language.code;
|
||||||
this.systemService.createMapping(this.relId, newMappingData).subscribe((response: any) => {
|
this.systemService.createMapping(this.relId, newMappingData).subscribe((response: any) => {
|
||||||
this.showFilteredData();
|
this.showFilteredData();
|
||||||
});
|
});
|
||||||
@@ -335,7 +337,7 @@ export class EntityToEntityMappingComponent implements OnInit {
|
|||||||
* @param editMappingForm Edit Mapping Form Id
|
* @param editMappingForm Edit Mapping Form Id
|
||||||
*/
|
*/
|
||||||
submitEdit(editMappingForm: any) {
|
submitEdit(editMappingForm: any) {
|
||||||
const dateFormat = 'dd MMMM yyyy';
|
const dateFormat = this.settingsService.dateFormat;
|
||||||
|
|
||||||
const startDate: Date = editMappingForm.value.startDate;
|
const startDate: Date = editMappingForm.value.startDate;
|
||||||
const endDate: Date = editMappingForm.value.endDate;
|
const endDate: Date = editMappingForm.value.endDate;
|
||||||
@@ -346,7 +348,7 @@ export class EntityToEntityMappingComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
const newMappingData = editMappingForm.value;
|
const newMappingData = editMappingForm.value;
|
||||||
newMappingData.dateFormat = dateFormat;
|
newMappingData.dateFormat = dateFormat;
|
||||||
newMappingData.locale = 'en';
|
newMappingData.locale = this.settingsService.language.code;
|
||||||
this.systemService.editMapping(this.mapIdToEdit, newMappingData).subscribe((response: any) => {
|
this.systemService.editMapping(this.mapIdToEdit, newMappingData).subscribe((response: any) => {
|
||||||
this.showFilteredData();
|
this.showFilteredData();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user