Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 1 addition & 17 deletions scripts/template-text-baseline.json
Original file line number Diff line number Diff line change
@@ -1,17 +1 @@
{
"src/app/features/accounting/accounting-closure-form.component.ts": 2,
"src/app/features/accounting/accounting-rule-form.component.ts": 13,
"src/app/features/accounting/charges/charge-form.component.ts": 3,
"src/app/features/accounting/financial-activity-mapping-form.component.ts": 2,
"src/app/features/accounting/journal-entry-form.component.ts": 5,
"src/app/features/campaigns/email-messages/email-messages.component.ts": 1,
"src/app/features/campaigns/sms-campaigns/sms-campaign-form.component.ts": 1,
"src/app/features/fintech/asset-owner-view/asset-owner-view.component.ts": 2,
"src/app/features/interop/interop-transfers.component.ts": 1,
"src/app/features/loans/point-in-time/loans-point-in-time.component.ts": 5,
"src/app/features/loans/rescheduling/reschedule-form.component.ts": 10,
"src/app/features/products/savings-account-view.component.ts": 10,
"src/app/features/security/audit-logs/audit-logs-list.component.ts": 7,
"src/app/features/settings/working-days.component.ts": 4,
"src/app/features/transfers/standing-instruction-form.component.ts": 2
}
{}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { Router } from '@angular/router';
import { of, throwError } from 'rxjs';
import { provideTranslateTesting } from '../../testing/i18n-testing';
import { provideNoopAnimations } from '@angular/platform-browser/animations';
import { expectLookedUp } from '../../testing/translated-text';

describe('AccountingClosureFormComponent', () => {
let component: AccountingClosureFormComponent;
Expand Down Expand Up @@ -104,4 +105,11 @@ describe('AccountingClosureFormComponent', () => {
expect(closureApiSpy.create).not.toHaveBeenCalled();
expect(component.isSaving()).toBe(false);
});

it('renders its heading and date label through the translation adapter', () => {
expectLookedUp(fixture.nativeElement, [
'ACCOUNTING_CLOSURES.CLOSE_ACCOUNTING_PERIOD',
'ACCOUNTING_CLOSURES.CLOSING_DATE',
]);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { Component, OnInit, inject, signal } from '@angular/core';

import { Router } from '@angular/router';
import { FormsModule } from '@angular/forms';
import { ACCOUNTING_CLOSURE_API, OFFICE_API } from '../../core/adapters';
import { ACCOUNTING_CLOSURE_API, OFFICE_API, TranslatePipe } from '../../core/adapters';
import type { Office } from '../../core/adapters';
import { HelpIconComponent } from '../../shared';
import {
Expand Down Expand Up @@ -51,6 +51,7 @@ import { createPickersReady } from '../../shared/utils/pickers-ready';
standalone: true,
imports: [
FormsModule,
TranslatePipe,
HelpIconComponent,
IonButton,
IonSpinner,
Expand All @@ -72,7 +73,7 @@ import { createPickersReady } from '../../shared/utils/pickers-ready';
<ion-card>
<ion-card-header>
<ion-card-title>
Close Accounting Period
{{ 'ACCOUNTING_CLOSURES.CLOSE_ACCOUNTING_PERIOD' | appTranslate }}
<app-help-icon [helpTextKey]="'HELP.ACCOUNTING_CLOSURES_DESC'"></app-help-icon>
</ion-card-title>
</ion-card-header>
Expand All @@ -98,7 +99,9 @@ import { createPickersReady } from '../../shared/utils/pickers-ready';

<!-- Closing Date -->
<ion-item fill="outline">
<ion-label position="stacked">Closing Date</ion-label>
<ion-label position="stacked">{{
'ACCOUNTING_CLOSURES.CLOSING_DATE' | appTranslate
}}</ion-label>
@if (pickersReady()) {
<ion-datetime-button datetime="closingDate-picker"></ion-datetime-button>
}
Expand Down
77 changes: 77 additions & 0 deletions src/app/features/accounting/accounting-rule-form.component.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { provideHttpClient } from '@angular/common/http';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { provideNoopAnimations } from '@angular/platform-browser/animations';
import { provideRouter } from '@angular/router';
import { provideTranslateTesting } from '../../testing/i18n-testing';
import { expectLookedUp } from '../../testing/translated-text';
import { AccountingRuleFormComponent } from './accounting-rule-form.component';

describe('AccountingRuleFormComponent', () => {
let fixture: ComponentFixture<AccountingRuleFormComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [AccountingRuleFormComponent],
providers: [
...provideTranslateTesting(),
provideNoopAnimations(),
provideHttpClient(),
provideHttpClientTesting(),
provideRouter([]),
],
}).compileComponents();

fixture = TestBed.createComponent(AccountingRuleFormComponent);
fixture.detectChanges();
});

it('renders its headings and labels through the translation adapter', () => {
expectLookedUp(fixture.nativeElement, [
'ACCOUNTING_RULES.NAME',
'ACCOUNTING_RULES.DEBIT_DETAILS',
'ACCOUNTING_RULES.CREDIT_DETAILS',
'ACCOUNTING_RULES.FIXED_ACCOUNT',
'ACCOUNTING_RULES.ACCOUNT_TAGS',
'ACCOUNTING_RULES.ACCOUNT_TO_DEBIT',
'ACCOUNTING_RULES.ACCOUNT_TO_CREDIT',
'ACCOUNTING_RULES.ALLOW_MULTIPLE_DEBIT_ENTRIES',
'ACCOUNTING_RULES.ALLOW_MULTIPLE_CREDIT_ENTRIES',
]);
});

it('labels the tag selectors once tags are chosen over a fixed account', () => {
// Choose "Account Tags" the way a user does, so the view is marked for check.
const groups = (fixture.nativeElement as HTMLElement).querySelectorAll('ion-radio-group');
expect(groups).toHaveLength(2);
groups.forEach((group) => {
(group as HTMLElement & { value: string }).value = 'tags';
group.dispatchEvent(new CustomEvent('ionChange'));
});
fixture.detectChanges();

expectLookedUp(fixture.nativeElement, [
'ACCOUNTING_RULES.DEBIT_TAGS',
'ACCOUNTING_RULES.CREDIT_TAGS',
]);
});
});
54 changes: 36 additions & 18 deletions src/app/features/accounting/accounting-rule-form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { RouterModule, Router, ActivatedRoute } from '@angular/router';
import { ReactiveFormsModule, FormBuilder, FormGroup, Validators } from '@angular/forms';
import { Observable } from 'rxjs';
import { AccountingRulesService } from '../../api/api/accountingRules.service';
import { TranslatePipe } from '../../core/adapters';
import {
IonButton,
IonCheckbox,
Expand All @@ -42,6 +43,7 @@ import {
imports: [
RouterModule,
ReactiveFormsModule,
TranslatePipe,
IonButton,
IonInput,
IonTextarea,
Expand All @@ -59,8 +61,12 @@ import {

<form [formGroup]="ruleForm" (ngSubmit)="onSubmit()">
<ion-item fill="outline" class="full-width">
<ion-label position="stacked">Rule Name</ion-label>
<ion-input aria-label="Rule Name" formControlName="name" required></ion-input>
<ion-label position="stacked">{{ 'ACCOUNTING_RULES.NAME' | appTranslate }}</ion-label>
<ion-input
[attr.aria-label]="'ACCOUNTING_RULES.NAME' | appTranslate"
formControlName="name"
required
></ion-input>
</ion-item>

<ion-item fill="outline" class="full-width">
Expand All @@ -75,17 +81,21 @@ import {
</ion-item>

<div class="section">
<h3>Debit Details</h3>
<h3>{{ 'ACCOUNTING_RULES.DEBIT_DETAILS' | appTranslate }}</h3>
<ion-radio-group formControlName="debitRuleType" class="radio-group">
<ion-radio value="fixedAccount">Fixed Account</ion-radio>
<ion-radio value="tags">Account Tags</ion-radio>
<ion-radio value="fixedAccount">{{
'ACCOUNTING_RULES.FIXED_ACCOUNT' | appTranslate
}}</ion-radio>
<ion-radio value="tags">{{ 'ACCOUNTING_RULES.ACCOUNT_TAGS' | appTranslate }}</ion-radio>
</ion-radio-group>

@if (ruleForm.get('debitRuleType')?.value === 'fixedAccount') {
<ion-item fill="outline" class="full-width">
<ion-label position="stacked">Account to Debit</ion-label>
<ion-label position="stacked">{{
'ACCOUNTING_RULES.ACCOUNT_TO_DEBIT' | appTranslate
}}</ion-label>
<ion-select
aria-label="Account to Debit"
[attr.aria-label]="'ACCOUNTING_RULES.ACCOUNT_TO_DEBIT' | appTranslate"
interface="popover"
formControlName="accountToDebit"
>
Expand All @@ -100,9 +110,11 @@ import {

@if (ruleForm.get('debitRuleType')?.value === 'tags') {
<ion-item fill="outline" class="full-width">
<ion-label position="stacked">Debit Tags</ion-label>
<ion-label position="stacked">{{
'ACCOUNTING_RULES.DEBIT_TAGS' | appTranslate
}}</ion-label>
<ion-select
aria-label="Debit Tags"
[attr.aria-label]="'ACCOUNTING_RULES.DEBIT_TAGS' | appTranslate"
interface="popover"
formControlName="debitTags"
multiple
Expand All @@ -117,22 +129,26 @@ import {
}

<ion-checkbox formControlName="allowMultipleDebitEntries">
Allow Multiple Debit Entries
{{ 'ACCOUNTING_RULES.ALLOW_MULTIPLE_DEBIT_ENTRIES' | appTranslate }}
</ion-checkbox>
</div>

<div class="section">
<h3>Credit Details</h3>
<h3>{{ 'ACCOUNTING_RULES.CREDIT_DETAILS' | appTranslate }}</h3>
<ion-radio-group formControlName="creditRuleType" class="radio-group">
<ion-radio value="fixedAccount">Fixed Account</ion-radio>
<ion-radio value="tags">Account Tags</ion-radio>
<ion-radio value="fixedAccount">{{
'ACCOUNTING_RULES.FIXED_ACCOUNT' | appTranslate
}}</ion-radio>
<ion-radio value="tags">{{ 'ACCOUNTING_RULES.ACCOUNT_TAGS' | appTranslate }}</ion-radio>
</ion-radio-group>

@if (ruleForm.get('creditRuleType')?.value === 'fixedAccount') {
<ion-item fill="outline" class="full-width">
<ion-label position="stacked">Account to Credit</ion-label>
<ion-label position="stacked">{{
'ACCOUNTING_RULES.ACCOUNT_TO_CREDIT' | appTranslate
}}</ion-label>
<ion-select
aria-label="Account to Credit"
[attr.aria-label]="'ACCOUNTING_RULES.ACCOUNT_TO_CREDIT' | appTranslate"
interface="popover"
formControlName="accountToCredit"
>
Expand All @@ -147,9 +163,11 @@ import {

@if (ruleForm.get('creditRuleType')?.value === 'tags') {
<ion-item fill="outline" class="full-width">
<ion-label position="stacked">Credit Tags</ion-label>
<ion-label position="stacked">{{
'ACCOUNTING_RULES.CREDIT_TAGS' | appTranslate
}}</ion-label>
<ion-select
aria-label="Credit Tags"
[attr.aria-label]="'ACCOUNTING_RULES.CREDIT_TAGS' | appTranslate"
interface="popover"
formControlName="creditTags"
multiple
Expand All @@ -164,7 +182,7 @@ import {
}

<ion-checkbox formControlName="allowMultipleCreditEntries">
Allow Multiple Credit Entries
{{ 'ACCOUNTING_RULES.ALLOW_MULTIPLE_CREDIT_ENTRIES' | appTranslate }}
</ion-checkbox>
</div>

Expand Down
55 changes: 55 additions & 0 deletions src/app/features/accounting/charges/charge-form.component.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { provideHttpClient } from '@angular/common/http';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { provideNoopAnimations } from '@angular/platform-browser/animations';
import { provideRouter } from '@angular/router';
import { provideTranslateTesting } from '../../../testing/i18n-testing';
import { expectLookedUp } from '../../../testing/translated-text';
import { ChargeFormComponent } from './charge-form.component';

describe('ChargeFormComponent', () => {
let fixture: ComponentFixture<ChargeFormComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ChargeFormComponent],
providers: [
...provideTranslateTesting(),
provideNoopAnimations(),
provideHttpClient(),
provideHttpClientTesting(),
provideRouter([]),
],
}).compileComponents();

fixture = TestBed.createComponent(ChargeFormComponent);
fixture.detectChanges();
});

it('renders its field labels through the translation adapter', () => {
expectLookedUp(fixture.nativeElement, [
'CHARGES.APPLIES_TO',
'CHARGES.TIME_TYPE',
'CHARGES.CALCULATION_TYPE',
]);
});
});
14 changes: 8 additions & 6 deletions src/app/features/accounting/charges/charge-form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ import {

<!-- Charge Applies To -->
<ion-item fill="outline">
<ion-label position="stacked">Applies To</ion-label>
<ion-label position="stacked">{{ 'CHARGES.APPLIES_TO' | translate }}</ion-label>
<ion-select
aria-label="Applies To"
[attr.aria-label]="'CHARGES.APPLIES_TO' | translate"
interface="popover"
name="chargeAppliesTo"
[(ngModel)]="charge().chargeAppliesTo"
Expand Down Expand Up @@ -132,9 +132,9 @@ import {

<!-- Charge Time Type -->
<ion-item fill="outline">
<ion-label position="stacked">Charge Time Type</ion-label>
<ion-label position="stacked">{{ 'CHARGES.TIME_TYPE' | translate }}</ion-label>
<ion-select
aria-label="Charge Time Type"
[attr.aria-label]="'CHARGES.TIME_TYPE' | translate"
interface="popover"
name="chargeTimeType"
[(ngModel)]="charge().chargeTimeType"
Expand All @@ -150,9 +150,11 @@ import {

<!-- Charge Calculation Type -->
<ion-item fill="outline">
<ion-label position="stacked">Calculation Type</ion-label>
<ion-label position="stacked">{{
'CHARGES.CALCULATION_TYPE' | translate
}}</ion-label>
<ion-select
aria-label="Calculation Type"
[attr.aria-label]="'CHARGES.CALCULATION_TYPE' | translate"
interface="popover"
name="chargeCalculationType"
[(ngModel)]="charge().chargeCalculationType"
Expand Down
Loading
Loading