add missed trnaslation for client-stepper file inside clients modlue

This commit is contained in:
Omar-Nabil
2024-07-31 07:17:59 -06:00
committed by Jose Alberto Hernandez
parent d9bf7a4676
commit 656537a0bc
17 changed files with 191 additions and 24 deletions
@@ -8,8 +8,9 @@ import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base';
import { SelectBase } from 'app/shared/form-dialog/formfield/model/select-base';
/** Custom Dialogs */
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
import { TranslateService } from '@ngx-translate/core';
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
/**
* Client Address Step Component
@@ -31,8 +32,10 @@ export class ClientAddressStepComponent {
/**
* @param {MatDialog} dialog Mat Dialog
* @param {TranslateService} translateService Translate Service.
*/
constructor(private dialog: MatDialog) {
constructor(private dialog: MatDialog,
private translateService: TranslateService) {
this.clientAddressData = [];
}
@@ -41,7 +44,7 @@ export class ClientAddressStepComponent {
*/
addAddress() {
const data = {
title: 'Add Client Address',
title: this.translateService.instant('labels.buttons.Add') + ' ' + this.translateService.instant('labels.catalogs.Client') + ' ' + this.translateService.instant('labels.heading.Address'),
formfields: this.getAddressFormFields()
};
const addAddressDialogRef = this.dialog.open(FormDialogComponent, { data, width: '50rem' });
@@ -131,9 +134,14 @@ export class ClientAddressStepComponent {
*/
getAddressFormFields(address?: any) {
let formfields: FormfieldBase[] = [];
for (let index = 0; index < this.clientTemplate.address[0].addressTypeIdOptions.length; index++) {
this.clientTemplate.address[0].addressTypeIdOptions[index].name = this.translateService.instant(`labels.catalogs.${this.clientTemplate.address[0].addressTypeIdOptions[index].name}`)
}
formfields.push(this.isFieldEnabled('addressType') ? new SelectBase({
controlName: 'addressTypeId',
label: 'Address Type',
label: this.translateService.instant('labels.inputs.Address Type'),
value: address ? address.addressTypeId : '',
options: { label: 'name', value: 'id', data: this.clientTemplate.address[0].addressTypeIdOptions },
order: 1,
@@ -141,7 +149,7 @@ export class ClientAddressStepComponent {
}) : null);
formfields.push(this.isFieldEnabled('street') ? new InputBase({
controlName: 'street',
label: 'Street',
label: this.translateService.instant('labels.inputs.Street'),
value: address ? address.street : '',
type: 'text',
required: true,
@@ -149,63 +157,63 @@ export class ClientAddressStepComponent {
}) : null);
formfields.push(this.isFieldEnabled('addressLine1') ? new InputBase({
controlName: 'addressLine1',
label: 'Address Line 1',
label: this.translateService.instant('labels.inputs.Address Line') + ' 1',
value: address ? address.addressLine1 : '',
type: 'text',
order: 3
}) : null);
formfields.push(this.isFieldEnabled('addressLine2') ? new InputBase({
controlName: 'addressLine2',
label: 'Address Line 2',
label: this.translateService.instant('labels.inputs.Address Line') + ' 2',
value: address ? address.addressLine2 : '',
type: 'text',
order: 4
}) : null);
formfields.push(this.isFieldEnabled('addressLine3') ? new InputBase({
controlName: 'addressLine3',
label: 'Address Line 3',
label: this.translateService.instant('labels.inputs.Address Line') + ' 3',
value: address ? address.addressLine3 : '',
type: 'text',
order: 5
}) : null);
formfields.push(this.isFieldEnabled('townVillage') ? new InputBase({
controlName: 'townVillage',
label: 'Town / Village',
label: this.translateService.instant('labels.inputs.Town / Village'),
value: address ? address.townVillage : '',
type: 'text',
order: 6
}) : null);
formfields.push(this.isFieldEnabled('city') ? new InputBase({
controlName: 'city',
label: 'City',
label: this.translateService.instant('labels.inputs.City'),
value: address ? address.city : '',
type: 'text',
order: 7
}) : null);
formfields.push(this.isFieldEnabled('stateProvinceId') ? new SelectBase({
controlName: 'stateProvinceId',
label: 'State / Province',
label: this.translateService.instant('labels.inputs.State / Province'),
value: address ? address.stateProvinceId : '',
options: { label: 'name', value: 'id', data: this.clientTemplate.address[0].stateProvinceIdOptions },
order: 8
}) : null);
formfields.push(this.isFieldEnabled('countyDistrict') ? new InputBase({
controlName: 'countryDistrict',
label: 'Country District',
label: this.translateService.instant('labels.inputs.Country District'),
value: address ? address.countyDistrict : '',
type: 'text',
order: 11
}) : null);
formfields.push(this.isFieldEnabled('countryId') ? new SelectBase({
controlName: 'countryId',
label: 'Country',
label: this.translateService.instant('labels.inputs.Country'),
value: address ? address.countryId : '',
options: { label: 'name', value: 'id', data: this.clientTemplate.address[0].countryIdOptions },
order: 10
}) : null);
formfields.push(this.isFieldEnabled('postalCode') ? new InputBase({
controlName: 'postalCode',
label: 'Postal Code',
label: this.translateService.instant('labels.inputs.Postal Code'),
value: address ? address.postalCode : '',
type: 'text',
order: 11
@@ -44,7 +44,7 @@
<mat-label>{{"labels.inputs.Relationship" | translate}}</mat-label>
<mat-select formControlName="relationshipId" required>
<mat-option *ngFor="let relation of data.options.relationshipIdOptions" [value]="relation.id">
{{ relation.name }}
{{ relation.name | translateKey:'catalogs' }}
</mat-option>
</mat-select>
<mat-error *ngIf="familyMemberForm.controls.relationshipId.hasError('required')">
@@ -56,7 +56,7 @@
<mat-label>{{"labels.inputs.Gender" | translate}}</mat-label>
<mat-select formControlName="genderId" required>
<mat-option *ngFor="let gender of data.options.genderIdOptions" [value]="gender.id">
{{ gender.name }}
{{ gender.name | translateKey:'catalogs' }}
</mat-option>
</mat-select>
<mat-error *ngIf="familyMemberForm.controls.genderId.hasError('required')">
@@ -68,7 +68,7 @@
<mat-label>{{"labels.inputs.Profession" | translate}}</mat-label>
<mat-select formControlName="professionId">
<mat-option *ngFor="let profession of data.options.professionIdOptions" [value]="profession.id">
{{ profession.name }}
{{ profession.name | translateKey:'catalogs' }}
</mat-option>
</mat-select>
</mat-form-field>
@@ -78,7 +78,7 @@
<mat-select formControlName="maritalStatusId">
<mat-option *ngFor="let maritalStatus of data.options.maritalStatusIdOptions"
[value]="maritalStatus.id">
{{ maritalStatus.name }}
{{ maritalStatus.name | translateKey:'catalogs' }}
</mat-option>
</mat-select>
</mat-form-field>
@@ -3,6 +3,7 @@ import { Component, Input } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
/** Custom Components */
import { TranslateService } from '@ngx-translate/core';
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
import { ClientFamilyMemberDialogComponent } from './client-family-member-dialog/client-family-member-dialog.component';
@@ -23,8 +24,10 @@ export class ClientFamilyMembersStepComponent {
/**
* @param {MatDialog} dialog Mat Dialog
* @param {TranslateService} translateService Translate Service.
*/
constructor(public dialog: MatDialog) { }
constructor(public dialog: MatDialog,
private translateService: TranslateService) { }
/**
* Adds a family member.
@@ -32,7 +35,7 @@ export class ClientFamilyMembersStepComponent {
addFamilyMember() {
const addFamilyMemberDialogRef = this.dialog.open(ClientFamilyMemberDialogComponent, {
data: {
context: 'Add',
context: this.translateService.instant('labels.buttons.Add'),
options: this.clientTemplate.familyMemberOptions,
},
width: '50rem'
@@ -18,7 +18,7 @@
<mat-label>{{"labels.inputs.Legal Form" | translate}}</mat-label>
<mat-select required formControlName="legalFormId">
<mat-option *ngFor="let legalForm of legalFormOptions" [value]="legalForm.id">
{{ legalForm.value }}
{{ legalForm.value | translateKey:'inputs'}}
</mat-option>
</mat-select>
</mat-form-field>
@@ -122,7 +122,7 @@
<mat-label>{{"labels.inputs.Gender" | translate}}</mat-label>
<mat-select formControlName="genderId">
<mat-option *ngFor="let gender of genderOptions" [value]="gender.id">
{{ gender.name }}
{{ gender.name | translateKey:'catalogs' }}
</mat-option>
</mat-select>
</mat-form-field>
@@ -159,7 +159,7 @@
<mat-label>{{"labels.inputs.Client Type" | translate}}</mat-label>
<mat-select formControlName="clientTypeId">
<mat-option *ngFor="let clientType of clientTypeOptions" [value]="clientType.id">
{{ clientType.name }}
{{ clientType.name | translateKey:'catalogs' }}
</mat-option>
</mat-select>
</mat-form-field>
@@ -85,7 +85,7 @@
</div>
<div fxFlexFill>
<span fxFlex="40%">{{"labels.inputs.Is Staff" | translate}}?</span>
<span fxFlex="40%">{{"labels.inputs.Is staff" | translate}}?</span>
<span fxFlex="60%">{{ client.isStaff | yesNo }}</span>
</div>