Skip to content

Commit

Permalink
entitytoentitymappingtranslation
Browse files Browse the repository at this point in the history
  • Loading branch information
Omar-Nabil authored and alberto-art3ch committed Jun 9, 2024
1 parent 02bf124 commit 83f9a0e
Show file tree
Hide file tree
Showing 16 changed files with 136 additions and 94 deletions.
11 changes: 7 additions & 4 deletions src/app/system/codes/view-code/view-code.component.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/** Angular Imports */
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { UntypedFormGroup, UntypedFormBuilder, Validators, UntypedFormArray } from '@angular/forms';
import { UntypedFormArray, UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Router } from '@angular/router';

/** Custom Services */
import { SystemService } from 'app/system/system.service';

/** Custom Components */
import { TranslateService } from '@ngx-translate/core';
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';

/**
Expand Down Expand Up @@ -36,12 +37,14 @@ export class ViewCodeComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {FormBuilder} formBuilder Form Builder.
* @param {MatDialog} dialog Dialog reference.
* @param {TranslateService} translateService Translate Service.
*/
constructor(private route: ActivatedRoute,
private systemService: SystemService,
private router: Router,
private formBuilder: UntypedFormBuilder,
private dialog: MatDialog) {
private dialog: MatDialog,
private translateService: TranslateService) {
this.route.data.subscribe((data: { code: any, codeValues: any }) => {
this.codeData = data.code;
this.codeValuesData = data.codeValues;
Expand Down Expand Up @@ -147,7 +150,7 @@ export class ViewCodeComponent implements OnInit {
*/
delete() {
const deleteCodeDialogRef = this.dialog.open(DeleteDialogComponent, {
data: { deleteContext: `code ${this.codeData.name}` }
data: { deleteContext: this.translateService.instant('labels.inputs.Code') + ' ' + this.codeData.name}
});
deleteCodeDialogRef.afterClosed().subscribe((response: any) => {
if (response.delete) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
<mat-card>

<form [formGroup]="filterPreferenceForm" (ngSubmit)="showFilteredData()">
<mat-card-title> {{firstMappingEntity}} {{'labels.text.access to' | translate}} {{secondMappingEntity}} </mat-card-title>
<mat-card-title> {{firstMappingEntity| translateKey:'inputs'}} {{'labels.text.access to' | translate}} {{secondMappingEntity | translateKey:'text'}} </mat-card-title>
<mat-card-content>

<div fxLayout="row" fxLayoutAlign="space-evenly center">

<mat-form-field>
<mat-label>{{firstMappingEntity}}</mat-label>
<mat-label>{{firstMappingEntity | translateKey:'inputs'}}</mat-label>
<mat-select required formControlName="mappingFirstParamId">
<mat-option [value]="0">
{{'labels.inputs.All' | translate}}
Expand All @@ -49,12 +49,12 @@
</mat-option>
</mat-select>
<mat-error *ngIf="filterPreferenceForm.controls.mappingFirstParamId.hasError('required')">
{{firstMappingEntity}} {{ "labels.commons.is" | translate}} <strong>{{ "labels.commons.required" | translate}}</strong>
{{firstMappingEntity | translateKey:'inputs'}} {{ "labels.commons.is" | translate}} <strong>{{ "labels.commons.required" | translate}}</strong>
</mat-error>
</mat-form-field>

<mat-form-field>
<mat-label>{{secondMappingEntity}}</mat-label>
<mat-label>{{secondMappingEntity | translateKey:'text'}}</mat-label>
<mat-select required formControlName="mappingSecondParamId">
<mat-option [value]="0">
{{'labels.inputs.All' | translate}}
Expand All @@ -64,7 +64,7 @@
</mat-option>
</mat-select>
<mat-error *ngIf="filterPreferenceForm.controls.mappingSecondParamId.hasError('required')">
{{secondMappingEntity}} {{ "labels.commons.is" | translate}} <strong>{{ "labels.commons.required" | translate}}</strong>
{{secondMappingEntity | translateKey:'text'}} {{ "labels.commons.is" | translate}} <strong>{{ "labels.commons.required" | translate}}</strong>
</mat-error>
</mat-form-field>

Expand All @@ -82,12 +82,12 @@
<div>
<table mat-table [dataSource]="entityMappingsListData">
<ng-container matColumnDef="fromentity">
<th mat-header-cell *matHeaderCellDef> {{firstMappingEntity}} </th>
<th mat-header-cell *matHeaderCellDef> {{firstMappingEntity | translateKey:'inputs'}} </th>
<td mat-cell *matCellDef="let listdata"> {{ listdata.fromEntity }} </td>
</ng-container>

<ng-container matColumnDef="toentity">
<th mat-header-cell *matHeaderCellDef> {{secondMappingEntity}} </th>
<th mat-header-cell *matHeaderCellDef> {{secondMappingEntity | translateKey:'text'}} </th>
<td mat-cell *matCellDef="let listdata"> {{ listdata.toEntity }} </td>
</ng-container>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@ import { MatTableDataSource } from '@angular/material/table';
import { ActivatedRoute } from '@angular/router';

/** Custom Services */
import { SystemService } from 'app/system/system.service';
import { UntypedFormGroup, UntypedFormBuilder, Validators } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
import { SettingsService } from 'app/settings/settings.service';
import { SystemService } from 'app/system/system.service';

/** Custom Components */
import { DeleteDialogComponent } from '../../shared/delete-dialog/delete-dialog.component';
import { TranslateService } from '@ngx-translate/core';
import { Dates } from 'app/core/utils/dates';
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
import { DatepickerBase } from 'app/shared/form-dialog/formfield/model/datepicker-base';
import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base';
import { SelectBase } from 'app/shared/form-dialog/formfield/model/select-base';
import { DatepickerBase } from 'app/shared/form-dialog/formfield/model/datepicker-base';
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
import { Dates } from 'app/core/utils/dates';
import { DeleteDialogComponent } from '../../shared/delete-dialog/delete-dialog.component';

/**
* Entity to Entity Mapping Component
Expand Down Expand Up @@ -78,13 +79,15 @@ export class EntityToEntityMappingComponent implements OnInit {
/**
* Retrieves the codes data from `resolve`.
* @param {ActivatedRoute} route Activated Route.
* @param {TranslateService} translateService Translate Service.
*/
constructor(private route: ActivatedRoute,
private formBuilder: UntypedFormBuilder,
private systemService: SystemService,
private dateUtils: Dates,
private dialog: MatDialog,
private settingsService: SettingsService) {
private formBuilder: UntypedFormBuilder,
private systemService: SystemService,
private dateUtils: Dates,
private dialog: MatDialog,
private settingsService: SettingsService,
private translateService: TranslateService) {
this.route.data.subscribe((data: { entityMappings: any }) => {
this.entityMappings = data.entityMappings;
});
Expand Down Expand Up @@ -215,31 +218,31 @@ export class EntityToEntityMappingComponent implements OnInit {
const formfields: FormfieldBase[] = [
new SelectBase({
controlName: 'fromId',
label: this.firstMappingEntity,
label: this.translateService.instant(`labels.inputs.${this.firstMappingEntity}`),
options: { label: 'name', value: 'id', data: this.firstEntityData },
required: true
}),
new SelectBase({
controlName: 'toId',
label: this.secondMappingEntity,
label: this.translateService.instant(`labels.text.${this.secondMappingEntity}`),
options: { label: 'name', value: 'id', data: this.secondEntityData },
required: true
}),
new DatepickerBase({
controlName: 'startDate',
label: 'Start Date',
label: this.translateService.instant('labels.inputs.Start Date'),
type: 'date',
required: false
}),
new DatepickerBase({
controlName: 'endDate',
label: 'End Date',
label: this.translateService.instant('labels.inputs.End Date'),
type: 'date',
required: false
})
];
const data = {
title: 'Add Entity to Entity Mapping',
title: this.translateService.instant('labels.buttons.Add') +' '+this.translateService.instant('labels.heading.Entity to Entity Mapping'),
layout: { addButtonText: 'Confirm' },
formfields: formfields
};
Expand All @@ -266,31 +269,31 @@ export class EntityToEntityMappingComponent implements OnInit {
const formfields: FormfieldBase[] = [
new SelectBase({
controlName: 'fromId',
label: this.firstMappingEntity,
label: this.translateService.instant(`labels.inputs.${this.firstMappingEntity}`),
options: { label: 'name', value: 'id', data: this.firstEntityData },
required: true
}),
new SelectBase({
controlName: 'toId',
label: this.secondMappingEntity,
label: this.translateService.instant(`labels.text.${this.secondMappingEntity}`),
options: { label: 'name', value: 'id', data: this.secondEntityData },
required: true
}),
new DatepickerBase({
controlName: 'startDate',
label: 'Start Date',
label: this.translateService.instant('labels.inputs.Start Date'),
type: 'date',
required: false
}),
new DatepickerBase({
controlName: 'endDate',
label: 'End Date',
label: this.translateService.instant('labels.inputs.End Date'),
type: 'date',
required: false
})
];
const data = {
title: 'Edit Entity to Entity Mapping',
title: this.translateService.instant('labels.buttons.Edit') +' '+this.translateService.instant('labels.heading.Entity to Entity Mapping'),
layout: { addButtonText: 'Confirm' },
formfields: formfields
};
Expand Down Expand Up @@ -358,7 +361,7 @@ export class EntityToEntityMappingComponent implements OnInit {
*/
delete(id: number) {
const deleteNoteDialogRef = this.dialog.open(DeleteDialogComponent, {
data: { deleteContext: `Mapping id: ${id}` }
data: { deleteContext: this.translateService.instant('labels.inputs.Mapping id') + ' ' + id }
});
deleteNoteDialogRef.afterClosed().subscribe((response: any) => {
if (response.delete) {
Expand Down
Loading

0 comments on commit 83f9a0e

Please sign in to comment.