Skip to content

Commit

Permalink
Charges with translations
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose Alberto Hernandez authored and alberto-art3ch committed Apr 27, 2024
1 parent 8ac82cc commit b380f7f
Show file tree
Hide file tree
Showing 56 changed files with 2,139 additions and 415 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h3>{{"labels.heading.Identities" | translate}}</h3>
</ng-container>

<ng-container matColumnDef="documentKey">
<th mat-header-cell *matHeaderCellDef> {{"labels.inputs.Key" | translate}} </th>
<th mat-header-cell *matHeaderCellDef> {{"labels.inputs.Document Key" | translate}} </th>
<td mat-cell *matCellDef="let identity"> {{identity.documentKey}} </td>
</ng-container>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.componen

/** Custom Services */
import { ClientsService } from '../../clients.service';
import { TranslateService } from '@ngx-translate/core';

/**
* Identities Tab Component
Expand Down Expand Up @@ -45,8 +46,9 @@ export class IdentitiesTabComponent {
* @param {ClientsService} clientService Clients Service
*/
constructor(private route: ActivatedRoute,
public dialog: MatDialog,
private clientService: ClientsService) {
private dialog: MatDialog,
private clientService: ClientsService,
private translateService: TranslateService) {
this.clientId = this.route.parent.snapshot.paramMap.get('clientId');
this.route.data.subscribe((data: { clientIdentities: any, clientIdentifierTemplate: any }) => {
this.clientIdentities = data.clientIdentities;
Expand All @@ -73,38 +75,41 @@ export class IdentitiesTabComponent {
const formfields: FormfieldBase[] = [
new SelectBase({
controlName: 'documentTypeId',
label: 'Document Type',
label: this.translateService.instant('labels.inputs.Document Type'),
value: '',
options: { label: 'name', value: 'id', data: this.clientIdentifierTemplate.allowedDocumentTypes },
required: true,
order: 1
}),
new SelectBase({
controlName: 'status',
label: 'Status',
label: this.translateService.instant('labels.inputs.Status'),
value: '2',
options: { label: 'value', value: 'value', data: [{ value: 'Active' }, { value: 'Inactive' }] },
options: { label: 'label', value: 'value', data: [
{ label: this.translateService.instant('labels.catalogs.Active'), value: 'Active' },
{ label: this.translateService.instant('labels.catalogs.Inactive'), value: 'Inactive' }
] },
required: true,
order: 2
}),
new InputBase({
controlName: 'documentKey',
label: 'Unique Id',
label: this.translateService.instant('labels.inputs.Document Key'),
value: '',
type: 'text',
required: true,
order: 3
}),
new InputBase({
controlName: 'description',
label: 'Description',
label: this.translateService.instant('labels.inputs.Description'),
value: '',
type: 'text',
order: 4
})
];
const data = {
title: 'Add Client Identifier',
title: this.translateService.instant('labels.heading.Add Client Identifier'),
formfields: formfields
};
const addIdentifierDialogRef = this.dialog.open(FormDialogComponent, { data });
Expand Down
6 changes: 3 additions & 3 deletions src/app/core/utils/accounting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ import { OptionData } from 'app/shared/models/option-data.model';
}

public getAccountRuleName(value: string): string {
if (value === 'ACCRUAL PERIODIC') {
if (['ACCRUAL PERIODIC', 'ACCRUAL (PERIODIC)'].includes(value)) {
return 'Accrual (periodic)';
} else if (value === 'ACCRUAL UPFRONT') {
} else if (['ACCRUAL UPFRONT', 'ACCRUAL (UPFRONT)'].includes(value)) {
return 'Accrual (upfront)';
} else if (value === 'CASH BASED') {
return 'Cash';
} else if (value === 'NONE') {
return 'None';
return 'NONE';
}
return '';
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/organization/tellers/cashiers/cashiers.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<ng-container matColumnDef="period">
<th mat-header-cell *matHeaderCellDef mat-sort-header> {{ 'labels.inputs.Period' | translate }} </th>
<td mat-cell *matCellDef="let cashier"> {{ cashier.startDate | dateFormat }} - {{ cashier.endDate | dateFormat }}</td>
<td mat-cell *matCellDef="let cashier"> {{ cashier.startDate | dateFormat }} - {{ cashier.endDate | dateFormat }}</td>
</ng-container>

<ng-container matColumnDef="staffName">
Expand All @@ -32,7 +32,7 @@

<ng-container matColumnDef="isFullDay">
<th mat-header-cell *matHeaderCellDef mat-sort-header> {{ 'labels.inputs.Full Day/Time' | translate }} </th>
<td mat-cell *matCellDef="let cashier"> {{ cashier.isFullDay ? 'Yes' : 'No' }} </td>
<td mat-cell *matCellDef="let cashier"> {{ cashier.isFullDay | yesNo }} </td>
</ng-container>

<ng-container matColumnDef="vaultActions">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div fxLayout="row" fxLayoutGap="1%" fxLayoutAlign="end" class="container m-b-20">
<button mat-raised-button color="accent" [routerLink]="['../allocate']" *mifosxHasPermission="'ALLOCATECASHIER_TELLER'">
<button mat-raised-button color="primary" [routerLink]="['../allocate']" *mifosxHasPermission="'ALLOCATECASHIER_TELLER'">
<fa-icon icon="arrow-up" class="m-r-10"></fa-icon>
{{ 'labels.buttons.Allocate Cash' | translate }}
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
</div>

<div fxFlex="50%" class="header">
{{'labels.inputs.Full Day?' | translate}}
{{'labels.inputs.Full Day/Time' | translate}}
</div>

<div fxFlex="50%">
Expand All @@ -69,8 +69,9 @@
</div>

</mat-card-content>

<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
<button type="button" mat-raised-button [routerLink]="['..']">{{"labels.buttons.Back" | translate}}</button>
<button type="button" color="primary" mat-raised-button [routerLink]="['..']">{{ "labels.buttons.Back" | translate}}</button>
</mat-card-actions>
</mat-card>

Expand Down
4 changes: 2 additions & 2 deletions src/app/pipes/format-number.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export class FormatNumberPipe implements PipeTransform {
private settingsService: SettingsService) {
}

transform(value: string | number, ...args: unknown[]): string {
transform(value: string | number, defaultValue: any): string {
if (!value) {
return '';
return defaultValue ? defaultValue : '';
}
const locale = this.settingsService.language.code;
const decimals = this.settingsService.decimals;
Expand Down
43 changes: 40 additions & 3 deletions src/app/pipes/pipes.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,50 @@ import { ExternalIdentifierPipe } from './external-identifier.pipe';
import { FormatNumberPipe } from './format-number.pipe';
import { YesnoPipe } from './yesno.pipe';
import { PrettyPrintPipe } from './pretty-print.pipe';
import { TranslateCatalogPipe } from './translate-catalog.pipe';

@NgModule({
imports: [
CommonModule
],
declarations: [StatusLookupPipe, AccountsFilterPipe, ChargesFilterPipe, ChargesPenaltyFilterPipe, FindPipe, UrlToStringPipe, DateFormatPipe, DatetimeFormatPipe, ExternalIdentifierPipe, FormatNumberPipe, YesnoPipe, PrettyPrintPipe ],
providers: [StatusLookupPipe, AccountsFilterPipe, ChargesFilterPipe, ChargesPenaltyFilterPipe, FindPipe, UrlToStringPipe, DateFormatPipe, DatetimeFormatPipe, ExternalIdentifierPipe, FormatNumberPipe, YesnoPipe, PrettyPrintPipe ],
exports: [StatusLookupPipe, AccountsFilterPipe, ChargesFilterPipe, ChargesPenaltyFilterPipe, FindPipe, UrlToStringPipe, DateFormatPipe, DatetimeFormatPipe, ExternalIdentifierPipe, FormatNumberPipe, YesnoPipe, PrettyPrintPipe ]
declarations: [StatusLookupPipe,
AccountsFilterPipe,
ChargesFilterPipe,
ChargesPenaltyFilterPipe,
FindPipe,
UrlToStringPipe,
DateFormatPipe,
DatetimeFormatPipe,
ExternalIdentifierPipe,
FormatNumberPipe,
YesnoPipe,
PrettyPrintPipe,
TranslateCatalogPipe],
providers: [StatusLookupPipe,
AccountsFilterPipe,
ChargesFilterPipe,
ChargesPenaltyFilterPipe,
FindPipe,
UrlToStringPipe,
DateFormatPipe,
DatetimeFormatPipe,
ExternalIdentifierPipe,
FormatNumberPipe,
YesnoPipe,
PrettyPrintPipe,
TranslateCatalogPipe],
exports: [StatusLookupPipe,
AccountsFilterPipe,
ChargesFilterPipe,
ChargesPenaltyFilterPipe,
FindPipe,
UrlToStringPipe,
DateFormatPipe,
DatetimeFormatPipe,
ExternalIdentifierPipe,
FormatNumberPipe,
YesnoPipe,
PrettyPrintPipe,
TranslateCatalogPipe]
})
export class PipesModule { }
15 changes: 15 additions & 0 deletions src/app/pipes/translate-catalog.pipe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Pipe, PipeTransform } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';

@Pipe({
name: 'translateCatalog'
})
export class TranslateCatalogPipe implements PipeTransform {

constructor(private translateService: TranslateService) { }

transform(attributeValue: any, suffix?: string): string {
return this.translateService.instant('labels.catalogs.' + attributeValue);
}

}
6 changes: 3 additions & 3 deletions src/app/products/charges/charges.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@

<ng-container matColumnDef="chargeAppliesTo">
<th mat-header-cell *matHeaderCellDef mat-sort-header> {{"labels.inputs.Applies To" | translate}} </th>
<td mat-cell *matCellDef="let charge"> {{ charge.chargeAppliesTo.value }} </td>
<td mat-cell *matCellDef="let charge"> {{ charge.chargeAppliesTo.value | translateCatalog }} </td>
</ng-container>

<ng-container matColumnDef="chargeTimeType">
<th mat-header-cell *matHeaderCellDef mat-sort-header> {{"labels.inputs.Time" | translate}} </th>
<td mat-cell *matCellDef="let charge"> {{ charge.chargeTimeType.value }} </td>
<td mat-cell *matCellDef="let charge"> {{ charge.chargeTimeType.value | translateCatalog }} </td>
</ng-container>

<ng-container matColumnDef="chargeCalculationType">
<th mat-header-cell *matHeaderCellDef mat-sort-header> {{"labels.inputs.Calculation" | translate}} </th>
<td mat-cell *matCellDef="let charge"> {{ charge.chargeCalculationType.value }} </td>
<td mat-cell *matCellDef="let charge"> {{ charge.chargeCalculationType.value | translateCatalog }} </td>
</ng-container>

<ng-container matColumnDef="amount">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<mat-select required formControlName="chargeAppliesTo">
<mat-option *ngFor="let chargeAppliesTo of chargesTemplateData.chargeAppliesToOptions"
[value]="chargeAppliesTo.id">
{{ chargeAppliesTo.value }}
{{ chargeAppliesTo.value | translateCatalog }}
</mat-option>
</mat-select>
<mat-error *ngIf="chargeForm.controls.chargeAppliesTo.hasError('required')">
Expand Down Expand Up @@ -50,7 +50,7 @@
<mat-label>{{"labels.inputs.Charge Time Type" | translate}}</mat-label>
<mat-select required formControlName="chargeTimeType">
<mat-option *ngFor="let chargeTimeType of chargeTimeTypeData" [value]="chargeTimeType.id">
{{ chargeTimeType.value }}
{{ chargeTimeType.value | translateCatalog }}
</mat-option>
</mat-select>
<mat-error *ngIf="chargeForm.controls.chargeTimeType.hasError('required')">
Expand All @@ -63,7 +63,7 @@
<mat-select required formControlName="chargeCalculationType">
<mat-option *ngFor="let chargeCalculationType of filteredChargeCalculationType()"
[value]="chargeCalculationType.id">
{{ chargeCalculationType.value }}
{{ chargeCalculationType.value | translateCatalog }}
</mat-option>
</mat-select>
<mat-error *ngIf="chargeForm.controls.chargeCalculationType.hasError('required')">
Expand All @@ -76,7 +76,7 @@
<mat-select required formControlName="chargePaymentMode">
<mat-option *ngFor="let chargePaymentMode of chargesTemplateData.chargePaymetModeOptions"
[value]="chargePaymentMode.id">
{{ chargePaymentMode.value }}
{{ chargePaymentMode.value | translateCatalog }}
</mat-option>
</mat-select>
<mat-error *ngIf="chargeForm.controls.chargePaymentMode.hasError('required')">
Expand Down Expand Up @@ -110,7 +110,7 @@
<mat-select required formControlName="feeFrequency">
<mat-option *ngFor="let feeFrequency of chargesTemplateData.feeFrequencyOptions"
[value]="feeFrequency.id">
{{ feeFrequency.value }}
{{ feeFrequency.value | translateCatalog }}
</mat-option>
</mat-select>
<mat-error *ngIf="chargeForm.controls.feeFrequency.hasError('required')">
Expand Down
10 changes: 5 additions & 5 deletions src/app/products/charges/edit-charge/edit-charge.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<mat-select required formControlName="chargeAppliesTo">
<mat-option *ngFor="let chargeAppliesTo of chargeData.chargeAppliesToOptions"
[value]="chargeAppliesTo.id">
{{ chargeAppliesTo.value }}
{{ chargeAppliesTo.value | translateCatalog }}
</mat-option>
</mat-select>
</mat-form-field>
Expand Down Expand Up @@ -47,7 +47,7 @@
<mat-label>{{"labels.inputs.Charge Time Type" | translate}}</mat-label>
<mat-select required formControlName="chargeTimeType">
<mat-option *ngFor="let chargeTime of chargeTimeTypeOptions" [value]="chargeTime.id">
{{ chargeTime.value }}
{{ chargeTime.value | translateCatalog }}
</mat-option>
</mat-select>
<mat-error *ngIf="chargeForm.controls.chargeTimeType.hasError('required')">
Expand All @@ -60,7 +60,7 @@
<mat-label>{{"labels.inputs.Charge Calculation" | translate}}</mat-label>
<mat-select required formControlName="chargeCalculationType">
<mat-option *ngFor="let chargeCalculation of chargeCalculationTypeOptions" [value]="chargeCalculation.id">
{{ chargeCalculation.value }}
{{ chargeCalculation.value | translateCatalog }}
</mat-option>
</mat-select>
<mat-error *ngIf="chargeForm.controls.chargeCalculationType.hasError('required')">
Expand All @@ -73,7 +73,7 @@
<mat-select required formControlName="chargePaymentMode">
<mat-option *ngFor="let chargePaymentMode of chargeData.chargePaymetModeOptions"
[value]="chargePaymentMode.id">
{{ chargePaymentMode.value }}
{{ chargePaymentMode.value | translateCatalog }}
</mat-option>
</mat-select>
<mat-error *ngIf="chargeForm.controls.chargePaymentMode.hasError('required')">
Expand Down Expand Up @@ -152,7 +152,7 @@
<mat-label>{{"labels.inputs.Charge Frequency" | translate}}</mat-label>
<mat-select required formControlName="feeFrequency">
<mat-option *ngFor="let chargeFrequency of chargeData.feeFrequencyOptions" [value]="chargeFrequency.id">
{{ chargeFrequency.value }}
{{ chargeFrequency.value | translateCatalog }}
</mat-option>
</mat-select>
<mat-error *ngIf="chargeForm.controls.feeFrequency.hasError('required')">
Expand Down
Loading

0 comments on commit b380f7f

Please sign in to comment.