Skip to content
Open
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
22 changes: 22 additions & 0 deletions e2e/client-accounts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,25 @@ test('empty account tabs offer the matching creation action', async ({ page }, t
await loanAction.click();
await expect(page).toHaveURL('/loans/create?clientId=2001');
});

test('the client page links to its charges, its collateral and a new share account', async ({
page,
}) => {
await signIn(page);
await mockClient(page);

await page.goto(CLIENT_URL);
await page.locator('#clientActionsMenu-trigger').click();
await page.getByTestId('client-charges-action').click();
await expect(page).toHaveURL(`/clients/${CLIENT_ID}/charges`);

await page.goto(CLIENT_URL);
await page.locator('#clientActionsMenu-trigger').click();
await page.getByTestId('client-collateral-action').click();
await expect(page).toHaveURL(`/clients/${CLIENT_ID}/collaterals`);

await page.goto(CLIENT_URL);
await page.locator('#createMenu-trigger').click();
await page.getByTestId('client-create-share-account').click();
await expect(page).toHaveURL(`/products/shares/create?clientId=${CLIENT_ID}`);
});
22 changes: 22 additions & 0 deletions src/app/features/clients/client-view.component.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,28 @@ describe('ClientViewComponent', () => {
});
});

describe('client screens reachable from the page', () => {
it('opens the client charges', () => {
component.onViewCharges();

expect(routerSpy.navigate).toHaveBeenCalledWith(['/clients', 123, 'charges']);
});

it('opens the client collateral', () => {
component.onViewCollateral();

expect(routerSpy.navigate).toHaveBeenCalledWith(['/clients', 123, 'collaterals']);
});

it('opens a new share account pre-filled with the client', () => {
component.onCreateShare();

expect(routerSpy.navigate).toHaveBeenCalledWith(['/products/shares/create'], {
queryParams: { clientId: 123 },
});
});
});

describe('teardown', () => {
it('dismisses popovers when destroyed', () => {
const withPopovers = component as unknown as {
Expand Down
41 changes: 41 additions & 0 deletions src/app/features/clients/client-view.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ export type ClientTab = (typeof CLIENT_TAB)[keyof typeof CLIENT_TAB];
'ASSIGNSTAFF_CLIENT',
'UNASSIGNSTAFF_CLIENT',
'UPDATESAVINGSACCOUNT_CLIENT',
'READ_CLIENTCHARGE',
]"
>
<ion-icon name="settings-outline"></ion-icon>
Expand Down Expand Up @@ -442,6 +443,23 @@ export type ClientTab = (typeof CLIENT_TAB)[keyof typeof CLIENT_TAB];
<ion-label>{{ 'ACTIONS.UNDO_WITHDRAW_CLIENT' | appTranslate }}</ion-label>
</ion-item>
}
<ion-item
button
(click)="onViewCharges()"
data-testid="client-charges-action"
appRequiresPermission="READ_CLIENTCHARGE"
>
<ion-icon slot="start" name="receipt-outline"></ion-icon>
<ion-label>{{ 'CLIENT_CHARGES.TITLE' | appTranslate }}</ion-label>
</ion-item>
<ion-item
button
(click)="onViewCollateral()"
data-testid="client-collateral-action"
>
<ion-icon slot="start" name="shield-checkmark-outline"></ion-icon>
<ion-label>{{ 'CLIENT_COLLATERAL.TITLE' | appTranslate }}</ion-label>
</ion-item>
</ion-list>
</ng-template>
</ion-popover>
Expand Down Expand Up @@ -482,6 +500,15 @@ export type ClientTab = (typeof CLIENT_TAB)[keyof typeof CLIENT_TAB];
<ion-icon slot="start" name="refresh-circle-outline"></ion-icon>
<ion-label>{{ 'ACTIONS.RECURRING_DEPOSIT' | appTranslate }}</ion-label>
</ion-item>
<ion-item
button
(click)="onCreateShare()"
data-testid="client-create-share-account"
appRequiresPermission="CREATE_SHAREACCOUNT"
>
<ion-icon slot="start" name="pie-chart-outline"></ion-icon>
<ion-label>{{ 'ACTIONS.SHARE_ACCOUNT' | appTranslate }}</ion-label>
</ion-item>
</ion-list>
</ng-template>
</ion-popover>
Expand Down Expand Up @@ -1615,6 +1642,20 @@ export class ClientViewComponent implements OnInit, OnDestroy {
});
}

onCreateShare() {
this.router.navigate(['/products/shares/create'], {
queryParams: { clientId: this.clientId() },
});
}

onViewCharges() {
this.router.navigate(['/clients', this.clientId(), 'charges']);
}

onViewCollateral() {
this.router.navigate(['/clients', this.clientId(), 'collaterals']);
}

onSavingsTransaction(accountId: number, command: string) {
this.router.navigate([`/products/savings-accounts/${accountId}/transactions/${command}`]);
}
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@
"PREMATURE_CLOSE": "Close before maturity",
"REACTIVATE_CLIENT": "Reactivate Client",
"RECURRING_DEPOSIT": "Recurring Deposit",
"SHARE_ACCOUNT": "Share Account",
"REJECT": "Reject",
"REJECTION_DATE": "Rejection Date",
"REJECTION_REASON": "Rejection Reason",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@
"PREMATURE_CLOSE": "Clôturer avant l'échéance",
"REACTIVATE_CLIENT": "Réactiver le client",
"RECURRING_DEPOSIT": "Dépôt périodique",
"SHARE_ACCOUNT": "Compte de parts sociales",
"REJECT": "Rejeter",
"REJECTION_DATE": "Date de rejet",
"REJECTION_REASON": "Motif du rejet",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@
"PREMATURE_CLOSE": "परिपक्वता से पहले बंद करें",
"REACTIVATE_CLIENT": "ग्राहक को पुनः सक्रिय करें",
"RECURRING_DEPOSIT": "आवर्ती जमा",
"SHARE_ACCOUNT": "शेयर खाता",
"REJECT": "अस्वीकार करें",
"REJECTION_DATE": "अस्वीकृति तिथि",
"REJECTION_REASON": "अस्वीकृति का कारण",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@
"SAVINGS_ACCOUNT": "예금 계좌",
"FIXED_DEPOSIT": "정기 예금",
"RECURRING_DEPOSIT": "적금",
"SHARE_ACCOUNT": "출자금 계좌",
"APPROVE_ACCOUNT": "계좌 승인",
"ACTIVATE_ACCOUNT": "계좌 활성화",
"CLOSE_ACCOUNT": "계좌 종료",
Expand Down
Loading