EMP-55: Full move to new table2, remove old table code (#406)
Some checks are pending
Main / Deploy (push) Waiting to run
Main / Notify (push) Blocked by required conditions

This commit is contained in:
Rinat Arsaev 2024-10-25 17:37:44 +07:00 committed by GitHub
parent 9e3b6d5ae8
commit 04109ad673
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
77 changed files with 721 additions and 1048 deletions

8
package-lock.json generated
View File

@ -26,7 +26,7 @@
"@vality/fistful-proto": "2.0.1-88e69a5.0", "@vality/fistful-proto": "2.0.1-88e69a5.0",
"@vality/machinegun-proto": "1.0.1-3decc8f.0", "@vality/machinegun-proto": "1.0.1-3decc8f.0",
"@vality/magista-proto": "2.0.2-ec1bdb9.0", "@vality/magista-proto": "2.0.2-ec1bdb9.0",
"@vality/ng-core": "18.4.1-pr-78-9131f9a.0", "@vality/ng-core": "18.4.1-pr-79-ca9078d.0",
"@vality/ng-thrift": "18.0.1-pr-13-bdb6d51.0", "@vality/ng-thrift": "18.0.1-pr-13-bdb6d51.0",
"@vality/repairer-proto": "2.0.2-07b73e9.0", "@vality/repairer-proto": "2.0.2-07b73e9.0",
"@vality/scrooge-proto": "0.1.1-9ce7fc6.0", "@vality/scrooge-proto": "0.1.1-9ce7fc6.0",
@ -5969,9 +5969,9 @@
"integrity": "sha512-XWF7qM/CARRAey0scGVhfGU6jNq+UdlGE2mg3jn4eIFDuIWQJqsT+Bah300RBUrl+XgFsmj95C6HWRfeA5Q8kw==" "integrity": "sha512-XWF7qM/CARRAey0scGVhfGU6jNq+UdlGE2mg3jn4eIFDuIWQJqsT+Bah300RBUrl+XgFsmj95C6HWRfeA5Q8kw=="
}, },
"node_modules/@vality/ng-core": { "node_modules/@vality/ng-core": {
"version": "18.4.1-pr-78-9131f9a.0", "version": "18.4.1-pr-79-ca9078d.0",
"resolved": "https://registry.npmjs.org/@vality/ng-core/-/ng-core-18.4.1-pr-78-9131f9a.0.tgz", "resolved": "https://registry.npmjs.org/@vality/ng-core/-/ng-core-18.4.1-pr-79-ca9078d.0.tgz",
"integrity": "sha512-qmTGnGe+pBWlIQ+cX64pt2aLWdoLM6M2Apc180dQQrLca4VBHB4Oh8yo7vvv/sxws1DLXEzWutgNzi9/bRdtZQ==", "integrity": "sha512-/+GE2QUDUYj8hSZfZijBQAZcb1IBi6TLlTCCAxItDkAG2jVHhcDeW+8fgpchZZKbsFQFyhUHFsU+qttDuvnfDQ==",
"dependencies": { "dependencies": {
"@angular/material-date-fns-adapter": "^18.2.2", "@angular/material-date-fns-adapter": "^18.2.2",
"@ng-matero/extensions": "^18.2.0", "@ng-matero/extensions": "^18.2.0",

View File

@ -35,7 +35,7 @@
"@vality/fistful-proto": "2.0.1-88e69a5.0", "@vality/fistful-proto": "2.0.1-88e69a5.0",
"@vality/machinegun-proto": "1.0.1-3decc8f.0", "@vality/machinegun-proto": "1.0.1-3decc8f.0",
"@vality/magista-proto": "2.0.2-ec1bdb9.0", "@vality/magista-proto": "2.0.2-ec1bdb9.0",
"@vality/ng-core": "18.4.1-pr-78-9131f9a.0", "@vality/ng-core": "18.4.1-pr-79-ca9078d.0",
"@vality/ng-thrift": "18.0.1-pr-13-bdb6d51.0", "@vality/ng-thrift": "18.0.1-pr-13-bdb6d51.0",
"@vality/repairer-proto": "2.0.2-07b73e9.0", "@vality/repairer-proto": "2.0.2-07b73e9.0",
"@vality/scrooge-proto": "0.1.1-9ce7fc6.0", "@vality/scrooge-proto": "0.1.1-9ce7fc6.0",

View File

@ -8,13 +8,18 @@ import { MemoizeExpiring } from 'typescript-memoize';
import { PartyManagementService } from '@cc/app/api/payment-processing'; import { PartyManagementService } from '@cc/app/api/payment-processing';
import { createDsl, FistfulStatisticsService } from '../../fistful-stat';
@Injectable({ @Injectable({
providedIn: 'root', providedIn: 'root',
}) })
export class PartiesStoreService { export class PartiesStoreService {
progress$ = new BehaviorSubject(0); progress$ = new BehaviorSubject(0);
constructor(private partyManagementService: PartyManagementService) {} constructor(
private partyManagementService: PartyManagementService,
private fistfulStatisticsService: FistfulStatisticsService,
) {}
@MemoizeExpiring(5 * 60_000) @MemoizeExpiring(5 * 60_000)
get(partyId: PartyID) { get(partyId: PartyID) {
@ -34,8 +39,14 @@ export class PartiesStoreService {
@MemoizeExpiring(5 * 60_000) @MemoizeExpiring(5 * 60_000)
getWallet(walletId: WalletID, partyId: PartyID) { getWallet(walletId: WalletID, partyId: PartyID) {
return this.get(partyId).pipe( // return this.get(partyId).pipe(
map((p) => p.wallets.get(walletId)), // map((p) => p.wallets.get(walletId)),
// progressTo(this.progress$),
// shareReplay({ refCount: true, bufferSize: 1 }),
// );
// TODO: We get it from fistful because wallets are not returned in the party object
return this.getWallets(partyId).pipe(
map((wallets) => wallets.find((w) => w.id === walletId)),
progressTo(this.progress$), progressTo(this.progress$),
shareReplay({ refCount: true, bufferSize: 1 }), shareReplay({ refCount: true, bufferSize: 1 }),
); );
@ -57,4 +68,15 @@ export class PartiesStoreService {
map(([party, shop]) => party.contracts.get(shop.contract_id)), map(([party, shop]) => party.contracts.get(shop.contract_id)),
); );
} }
@MemoizeExpiring(5 * 60_000)
private getWallets(partyId: PartyID) {
return this.fistfulStatisticsService
.GetWallets({ dsl: createDsl({ wallets: { party_id: partyId } }) })
.pipe(
map(({ data }) => data.wallets),
progressTo(this.progress$),
shareReplay({ refCount: true, bufferSize: 1 }),
);
}
} }

View File

@ -1,4 +1,4 @@
<v-table2 <v-table
[columns]="columns" [columns]="columns"
[data]="data" [data]="data"
[hasMore]="hasMore" [hasMore]="hasMore"
@ -7,4 +7,4 @@
(update)="update.emit($event)" (update)="update.emit($event)"
> >
<v-table-actions><ng-content></ng-content></v-table-actions> <v-table-actions><ng-content></ng-content></v-table-actions>
</v-table2> </v-table>

View File

@ -1,11 +1,11 @@
import { Component, Input, Output, EventEmitter, booleanAttribute, input } from '@angular/core'; import { Component, Input, Output, EventEmitter, booleanAttribute, input } from '@angular/core';
import { toObservable } from '@angular/core/rxjs-interop'; import { toObservable } from '@angular/core/rxjs-interop';
import { Claim } from '@vality/domain-proto/claim_management'; import { Claim } from '@vality/domain-proto/claim_management';
import { Column2, LoadOptions, createMenuColumn } from '@vality/ng-core'; import { Column, createMenuColumn, LoadOptions } from '@vality/ng-core';
import { getUnionKey } from '@vality/ng-thrift'; import { getUnionKey } from '@vality/ng-thrift';
import startCase from 'lodash-es/startCase'; import { startCase } from 'lodash-es';
import { createPartyColumn } from '@cc/app/shared/utils/table2'; import { createPartyColumn } from '@cc/app/shared';
@Component({ @Component({
selector: 'cc-claims-table', selector: 'cc-claims-table',
@ -21,21 +21,23 @@ export class ClaimsTableComponent {
@Output() update = new EventEmitter<LoadOptions>(); @Output() update = new EventEmitter<LoadOptions>();
@Output() more = new EventEmitter<void>(); @Output() more = new EventEmitter<void>();
columns: Column2<Claim>[] = [ columns: Column<Claim>[] = [
{ field: 'id', cell: (d) => ({ link: () => `/party/${d.party_id}/claim/${d.id}` }) }, { field: 'id', cell: (d) => ({ link: () => `/party/${d.party_id}/claim/${d.id}` }) },
createPartyColumn((d) => ({ id: d.party_id }), { hidden: toObservable(this.noParty) }), createPartyColumn((d) => ({ id: d.party_id }), { hidden: toObservable(this.noParty) }),
{ {
field: 'status', field: 'status',
cell: (d) => ({ cell: (d) => ({
value: startCase(getUnionKey(d.status)), value: startCase(getUnionKey(d.status)),
tags: { color: (
{
pending: 'pending', pending: 'pending',
review: 'pending', review: 'pending',
pending_acceptance: 'pending', pending_acceptance: 'pending',
accepted: 'success', accepted: 'success',
denied: 'warn', denied: 'warn',
revoked: 'neutral', revoked: 'neutral',
}, } as const
)[getUnionKey(d.status)],
}), }),
}, },
{ field: 'revision' }, { field: 'revision' },

View File

@ -1,6 +1,6 @@
<div style="display: flex; flex-direction: column; gap: 24px"> <div style="display: flex; flex-direction: column; gap: 24px">
<h1 class="mat-headline-5">Reverts</h1> <h1 class="mat-headline-5">Reverts</h1>
<v-table2 <v-table
[columns]="columns" [columns]="columns"
[data]="reverts$ | async" [data]="reverts$ | async"
[hasMore]="hasMore$ | async" [hasMore]="hasMore$ | async"
@ -18,5 +18,5 @@
Create revert Create revert
</button> </button>
</v-table-actions> </v-table-actions>
</v-table2> </v-table>
</div> </div>

View File

@ -1,11 +1,11 @@
import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core'; import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
import { DepositStatus, StatDeposit, StatDepositRevert } from '@vality/fistful-proto/fistful_stat'; import { DepositStatus, StatDeposit, StatDepositRevert } from '@vality/fistful-proto/fistful_stat';
import { DialogService, UpdateOptions, Column2 } from '@vality/ng-core'; import { DialogService, UpdateOptions, Column } from '@vality/ng-core';
import { getUnionKey } from '@vality/ng-thrift'; import { getUnionKey } from '@vality/ng-thrift';
import startCase from 'lodash-es/startCase'; import startCase from 'lodash-es/startCase';
import { filter } from 'rxjs/operators'; import { filter } from 'rxjs/operators';
import { createCurrencyColumn } from '@cc/app/shared/utils/table2'; import { createCurrencyColumn } from '@cc/app/shared';
import { CreateRevertDialogComponent } from './create-revert-dialog/create-revert-dialog.component'; import { CreateRevertDialogComponent } from './create-revert-dialog/create-revert-dialog.component';
import { FetchRevertsService } from './services/fetch-reverts/fetch-reverts.service'; import { FetchRevertsService } from './services/fetch-reverts/fetch-reverts.service';
@ -23,7 +23,7 @@ export class RevertsComponent implements OnInit {
reverts$ = this.fetchRevertsService.result$; reverts$ = this.fetchRevertsService.result$;
hasMore$ = this.fetchRevertsService.hasMore$; hasMore$ = this.fetchRevertsService.hasMore$;
isLoading$ = this.fetchRevertsService.isLoading$; isLoading$ = this.fetchRevertsService.isLoading$;
columns: Column2<StatDepositRevert>[] = [ columns: Column<StatDepositRevert>[] = [
{ field: 'id' }, { field: 'id' },
{ {
field: 'status', field: 'status',

View File

@ -22,7 +22,7 @@
<cc-merchant-field formControlName="party_id"></cc-merchant-field> <cc-merchant-field formControlName="party_id"></cc-merchant-field>
</ng-template> </ng-template>
</v-filters> </v-filters>
<v-table2 <v-table
[columns]="columns" [columns]="columns"
[data]="deposits$ | async" [data]="deposits$ | async"
[hasMore]="hasMore$ | async" [hasMore]="hasMore$ | async"
@ -34,5 +34,5 @@
<button mat-raised-button (click)="createByFile()">Create by file</button> <button mat-raised-button (click)="createByFile()">Create by file</button>
<button color="primary" mat-raised-button (click)="createDeposit()">Create</button> <button color="primary" mat-raised-button (click)="createDeposit()">Create</button>
</v-table-actions> </v-table-actions>
</v-table2> </v-table>
</cc-page-layout> </cc-page-layout>

View File

@ -16,7 +16,7 @@ import {
debounceTimeWithFirst, debounceTimeWithFirst,
getValueChanges, getValueChanges,
countChanged, countChanged,
Column2, Column,
getEnumKey, getEnumKey,
createMenuColumn, createMenuColumn,
} from '@vality/ng-core'; } from '@vality/ng-core';
@ -25,7 +25,7 @@ import { endOfDay } from 'date-fns';
import startCase from 'lodash-es/startCase'; import startCase from 'lodash-es/startCase';
import { filter, map, shareReplay } from 'rxjs/operators'; import { filter, map, shareReplay } from 'rxjs/operators';
import { createCurrencyColumn } from '@cc/app/shared/utils/table2'; import { createCurrencyColumn } from '@cc/app/shared';
import { QueryDsl } from '../../api/fistful-stat'; import { QueryDsl } from '../../api/fistful-stat';
import { DATE_RANGE_DAYS, DEBOUNCE_TIME_MS } from '../../tokens'; import { DATE_RANGE_DAYS, DEBOUNCE_TIME_MS } from '../../tokens';
@ -53,7 +53,7 @@ export class DepositsComponent implements OnInit {
deposits$ = this.fetchDepositsService.result$; deposits$ = this.fetchDepositsService.result$;
hasMore$ = this.fetchDepositsService.hasMore$; hasMore$ = this.fetchDepositsService.hasMore$;
isLoading$ = this.fetchDepositsService.isLoading$; isLoading$ = this.fetchDepositsService.isLoading$;
columns: Column2<StatDeposit>[] = [ columns: Column<StatDeposit>[] = [
{ {
field: 'id', field: 'id',
cell: (d) => ({ cell: (d) => ({

View File

@ -1,5 +1,4 @@
<v-table2 <v-table
[(sort)]="sort"
[columns]="columns" [columns]="columns"
[data]="objects$ | async" [data]="objects$ | async"
[progress]="isLoading$ | async" [progress]="isLoading$ | async"
@ -17,4 +16,4 @@
style="overflow: auto" style="overflow: auto"
></v-select-field> ></v-select-field>
</v-table-inputs> </v-table-inputs>
</v-table2> </v-table>

View File

@ -11,7 +11,7 @@ import {
ActionsModule, ActionsModule,
DialogService, DialogService,
getValueChanges, getValueChanges,
Column2, Column,
createMenuColumn, createMenuColumn,
} from '@vality/ng-core'; } from '@vality/ng-core';
import sortBy from 'lodash-es/sortBy'; import sortBy from 'lodash-es/sortBy';
@ -76,7 +76,7 @@ export class DomainObjectsTableComponent implements OnInit {
map(([objects, types]) => objects.filter((o) => types.includes(o.type))), map(([objects, types]) => objects.filter((o) => types.includes(o.type))),
shareReplay({ refCount: true, bufferSize: 1 }), shareReplay({ refCount: true, bufferSize: 1 }),
); );
columns: Column2<DomainObjectData>[] = [ columns: Column<DomainObjectData>[] = [
{ {
field: 'id', field: 'id',
cell: (d) => ({ value: getDomainObjectDetails(d.obj).id }), cell: (d) => ({ value: getDomainObjectDetails(d.obj).id }),
@ -140,7 +140,6 @@ export class DomainObjectsTableComponent implements OnInit {
), ),
); );
isLoading$ = this.domainStoreService.isLoading$; isLoading$ = this.domainStoreService.isLoading$;
sort = { active: 'id', direction: 'asc' };
constructor( constructor(
private domainStoreService: DomainStoreService, private domainStoreService: DomainStoreService,

View File

@ -1,5 +1,5 @@
import { Component, input } from '@angular/core'; import { Component, input } from '@angular/core';
import { Column2, getEnumKey, TableModule } from '@vality/ng-core'; import { Column, getEnumKey, TableModule } from '@vality/ng-core';
import { repairer } from '@vality/repairer-proto'; import { repairer } from '@vality/repairer-proto';
import { StatusHistory } from '@vality/repairer-proto/repairer'; import { StatusHistory } from '@vality/repairer-proto/repairer';
import { startCase } from 'lodash-es'; import { startCase } from 'lodash-es';
@ -9,7 +9,7 @@ import { SidenavInfoModule } from '@cc/app/shared/components/sidenav-info';
@Component({ @Component({
standalone: true, standalone: true,
template: `<cc-card title="Machine #{{ id() }} Status History" template: `<cc-card title="Machine #{{ id() }} Status History"
><v-table2 [columns]="columns" [data]="history()"></v-table2 ><v-table [columns]="columns" [data]="history()"></v-table
></cc-card>`, ></cc-card>`,
imports: [TableModule, SidenavInfoModule], imports: [TableModule, SidenavInfoModule],
}) })
@ -17,7 +17,7 @@ export class MachineStatusHistoryCardComponent {
history = input<StatusHistory[]>([]); history = input<StatusHistory[]>([]);
id = input<string>(''); id = input<string>('');
columns: Column2<StatusHistory>[] = [ columns: Column<StatusHistory>[] = [
{ field: 'changed_at', cell: { type: 'datetime' } }, { field: 'changed_at', cell: { type: 'datetime' } },
{ {
field: 'status', field: 'status',

View File

@ -33,7 +33,7 @@
</ng-template> </ng-template>
</v-filters> </v-filters>
<v-table2 <v-table
[columns]="columns" [columns]="columns"
[data]="machines$ | async" [data]="machines$ | async"
[hasMore]="hasMore$ | async" [hasMore]="hasMore$ | async"
@ -61,5 +61,5 @@
Simple repair Simple repair
</button> </button>
</v-table-actions> </v-table-actions>
</v-table2> </v-table>
</cc-page-layout> </cc-page-layout>

View File

@ -17,7 +17,7 @@ import {
debounceTimeWithFirst, debounceTimeWithFirst,
FetchOptions, FetchOptions,
getEnumKey, getEnumKey,
Column2, Column,
} from '@vality/ng-core'; } from '@vality/ng-core';
import { repairer } from '@vality/repairer-proto'; import { repairer } from '@vality/repairer-proto';
import { Namespace, ProviderID, RepairStatus, Machine } from '@vality/repairer-proto/repairer'; import { Namespace, ProviderID, RepairStatus, Machine } from '@vality/repairer-proto/repairer';
@ -27,8 +27,8 @@ import startCase from 'lodash-es/startCase';
import { BehaviorSubject } from 'rxjs'; import { BehaviorSubject } from 'rxjs';
import { filter, switchMap, map, shareReplay } from 'rxjs/operators'; import { filter, switchMap, map, shareReplay } from 'rxjs/operators';
import { createDomainObjectColumn } from '@cc/app/shared';
import { SidenavInfoService } from '@cc/app/shared/components/sidenav-info'; import { SidenavInfoService } from '@cc/app/shared/components/sidenav-info';
import { createDomainObjectColumn } from '@cc/app/shared/utils/table2';
import { RepairManagementService } from '../../api/repairer'; import { RepairManagementService } from '../../api/repairer';
import { DATE_RANGE_DAYS, DEBOUNCE_TIME_MS } from '../../tokens'; import { DATE_RANGE_DAYS, DEBOUNCE_TIME_MS } from '../../tokens';
@ -65,12 +65,12 @@ export class MachinesComponent implements OnInit {
}); });
selected$ = new BehaviorSubject<Machine[]>([]); selected$ = new BehaviorSubject<Machine[]>([]);
status = repairer.RepairStatus; status = repairer.RepairStatus;
columns: Column2<Machine>[] = [ columns: Column<Machine>[] = [
{ field: 'id', sticky: 'start' }, { field: 'id', sticky: 'start' },
{ header: 'Namespace', field: 'ns' }, { header: 'Namespace', field: 'ns' },
{ field: 'created_at', cell: { type: 'datetime' } }, { field: 'created_at', cell: { type: 'datetime' } },
createDomainObjectColumn((d) => ({ ref: { terminal: { id: Number(d.provider_id) } } }), { createDomainObjectColumn((d) => ({ ref: { provider: { id: Number(d.provider_id) } } }), {
header: 'Terminal', header: 'Provider',
}), }),
{ {
field: 'status', field: 'status',

View File

@ -1,4 +1,4 @@
<cc-page-layout [progress]="isLoading$ | async" title="Refunds"> <cc-page-layout [progress]="isLoading$ | async" fullHeight title="Refunds">
<cc-refunds-table <cc-refunds-table
[invoiceID]="(payment$ | async).invoice_id" [invoiceID]="(payment$ | async).invoice_id"
[partyID]="(payment$ | async).owner_id" [partyID]="(payment$ | async).owner_id"

View File

@ -4,8 +4,9 @@ import { Column, UpdateOptions } from '@vality/ng-core';
import { getUnionKey } from '@vality/ng-thrift'; import { getUnionKey } from '@vality/ng-thrift';
import startCase from 'lodash-es/startCase'; import startCase from 'lodash-es/startCase';
import { createCurrencyColumn } from '@cc/app/shared';
import { Refund } from '../../../api/fistful-stat'; import { Refund } from '../../../api/fistful-stat';
import { createCurrencyColumn } from '../../../shared';
import { FetchRefundsService } from './services/fetch-refunds.service'; import { FetchRefundsService } from './services/fetch-refunds.service';
@ -26,26 +27,24 @@ export class RefundsTableComponent implements OnInit {
refunds$ = this.fetchRefundsService.result$; refunds$ = this.fetchRefundsService.result$;
columns: Column<Refund>[] = [ columns: Column<Refund>[] = [
{ field: 'created_at', type: 'datetime' }, { field: 'created_at', cell: { type: 'datetime' } },
{ {
field: 'status', field: 'status',
type: 'tag', cell: (d) => ({
formatter: (d) => getUnionKey(d.status), value: startCase(getUnionKey(d.status)),
typeParameters: { color: (
label: (d) => startCase(getUnionKey(d.status)), {
tags: { pending: 'pending',
pending: { color: 'pending' }, succeeded: 'success',
succeeded: { color: 'success' }, failed: 'warn',
failed: { color: 'warn' }, } as const
)[getUnionKey(d.status)],
}),
}, },
}, createCurrencyColumn((d) => ({ amount: d.amount, code: d.currency_symbolic_code }), {
}, header: 'Amount',
createCurrencyColumn( }),
'amount', { field: 'reason' },
(d) => d.amount,
(d) => d.currency_symbolic_code,
),
'reason',
]; ];
constructor(private fetchRefundsService: FetchRefundsService) {} constructor(private fetchRefundsService: FetchRefundsService) {}

View File

@ -1,4 +1,4 @@
<v-table2 <v-table
[columns]="columns" [columns]="columns"
[data]="data" [data]="data"
[hasMore]="hasMore" [hasMore]="hasMore"
@ -12,4 +12,4 @@
<v-table-actions> <v-table-actions>
<ng-content></ng-content> <ng-content></ng-content>
</v-table-actions> </v-table-actions>
</v-table2> </v-table>

View File

@ -1,19 +1,17 @@
import { Component, Input, Output, EventEmitter } from '@angular/core'; import { Component, Input, Output, EventEmitter } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { StatPayment } from '@vality/magista-proto/magista'; import { StatPayment } from '@vality/magista-proto/magista';
import { LoadOptions, Column2, createMenuColumn } from '@vality/ng-core'; import { LoadOptions, Column, createMenuColumn } from '@vality/ng-core';
import { getUnionKey } from '@vality/ng-thrift'; import { getUnionKey } from '@vality/ng-thrift';
import startCase from 'lodash-es/startCase'; import startCase from 'lodash-es/startCase';
import { AmountCurrencyService } from '@cc/app/shared/services';
import { createFailureColumn } from '../../../../shared';
import { import {
createPartyColumn, createPartyColumn,
createShopColumn, createShopColumn,
createDomainObjectColumn, createDomainObjectColumn,
createCurrencyColumn, createCurrencyColumn,
} from '../../../../shared/utils/table2'; createFailureColumn,
} from '@cc/app/shared';
@Component({ @Component({
selector: 'cc-payments-table', selector: 'cc-payments-table',
@ -29,7 +27,7 @@ export class PaymentsTableComponent {
@Output() update = new EventEmitter<LoadOptions>(); @Output() update = new EventEmitter<LoadOptions>();
@Output() more = new EventEmitter<void>(); @Output() more = new EventEmitter<void>();
columns: Column2<StatPayment>[] = [ columns: Column<StatPayment>[] = [
{ {
field: 'id', field: 'id',
cell: (d) => ({ cell: (d) => ({
@ -89,10 +87,7 @@ export class PaymentsTableComponent {
})), })),
]; ];
constructor( constructor(private router: Router) {}
private amountCurrencyService: AmountCurrencyService,
private router: Router,
) {}
private toDetails(data: StatPayment) { private toDetails(data: StatPayment) {
return void this.router.navigate([ return void this.router.navigate([

View File

@ -1,13 +1,14 @@
<cc-page-layout <cc-page-layout
[progress]="isLoading$ | async" [progress]="isLoading$ | async"
[title]="(routingRulesTypeService.routingRulesType$ | async | titlecase) + ' Routing Rules'" [title]="(routingRulesTypeService.routingRulesType$ | async | titlecase) + ' Routing Rules'"
fullHeight
> >
<cc-page-layout-actions> <cc-page-layout-actions>
<button color="primary" mat-raised-button (click)="attachNewRuleset()">Add</button> <button color="primary" mat-raised-button (click)="attachNewRuleset()">Add</button>
</cc-page-layout-actions> </cc-page-layout-actions>
<cc-routing-rules-list <cc-routing-rules-list
[data]="data$ | async" [data]="data$ | async"
[displayedColumns]="displayedColumns" [displayedColumns]="columns"
[progress]="isLoading$ | async" [progress]="isLoading$ | async"
(toDetails)="navigateToPartyRuleset($event.parentRefId, $event.delegateIdx)" (toDetails)="navigateToPartyRuleset($event.parentRefId, $event.delegateIdx)"
></cc-routing-rules-list> ></cc-routing-rules-list>

View File

@ -1,17 +1,22 @@
import { ChangeDetectionStrategy, Component, DestroyRef } from '@angular/core'; import { ChangeDetectionStrategy, Component, DestroyRef } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { DialogService, NotifyLogService } from '@vality/ng-core'; import { Column, DialogService, NotifyLogService } from '@vality/ng-core';
import { first, map, catchError } from 'rxjs/operators'; import { first, map, catchError } from 'rxjs/operators';
import { DomainStoreService } from '@cc/app/api/domain-config'; import { DomainStoreService } from '@cc/app/api/domain-config';
import { RoutingRulesType } from '@cc/app/sections/routing-rules/types/routing-rules-type'; import { RoutingRulesType } from '@cc/app/sections/routing-rules/types/routing-rules-type';
import { createDomainObjectColumn } from '@cc/app/shared';
import { RoutingRulesListItem } from '../routing-rules-list';
import { RoutingRulesTypeService } from '../routing-rules-type.service'; import { RoutingRulesTypeService } from '../routing-rules-type.service';
import { RoutingRulesService } from '../services/routing-rules'; import { RoutingRulesService } from '../services/routing-rules';
import { AttachNewRulesetDialogComponent } from './attach-new-ruleset-dialog'; import { AttachNewRulesetDialogComponent } from './attach-new-ruleset-dialog';
import { PartyDelegateRulesetsService } from './party-delegate-rulesets.service'; import {
DelegateWithPaymentInstitution,
PartyDelegateRulesetsService,
} from './party-delegate-rulesets.service';
@Component({ @Component({
selector: 'cc-party-delegate-rulesets', selector: 'cc-party-delegate-rulesets',
@ -20,31 +25,37 @@ import { PartyDelegateRulesetsService } from './party-delegate-rulesets.service'
providers: [PartyDelegateRulesetsService, RoutingRulesTypeService], providers: [PartyDelegateRulesetsService, RoutingRulesTypeService],
}) })
export class PartyDelegateRulesetsComponent { export class PartyDelegateRulesetsComponent {
displayedColumns = [ columns: Column<RoutingRulesListItem<DelegateWithPaymentInstitution>>[] = [
{ key: 'partyDelegate', name: 'Party delegate' }, {
{ key: 'paymentInstitution', name: 'Payment institution' }, field: 'partyDelegate',
{ key: 'mainRuleset', name: 'Main ruleset' }, cell: (d) => ({
value: d.item.partyDelegate?.description || `#${d.item.partyDelegate?.ruleset?.id}`,
description: d.item.partyDelegate?.ruleset?.id,
click: () => this.navigateToPartyRuleset(d.parentRefId, d.delegateIdx),
}),
},
createDomainObjectColumn(
(d) => ({
ref: { payment_institution: d.item.paymentInstitution.ref },
}),
{ header: 'Payment Institution' },
),
createDomainObjectColumn(
(d) => ({
ref: { routing_rules: d.item.mainRoutingRule.ref },
}),
{ header: 'Main Ruleset' },
),
]; ];
isLoading$ = this.domainStoreService.isLoading$; isLoading$ = this.domainStoreService.isLoading$;
data$ = this.partyDelegateRulesetsService.getDelegatesWithPaymentInstitution().pipe( data$ = this.partyDelegateRulesetsService.getDelegatesWithPaymentInstitution().pipe(
map((rules) => map((rules): RoutingRulesListItem<DelegateWithPaymentInstitution>[] =>
rules.map(({ mainRoutingRule, partyDelegate, paymentInstitution }) => ({ rules.map((item) => ({
parentRefId: mainRoutingRule?.ref?.id, parentRefId: item.mainRoutingRule?.ref?.id,
delegateIdx: mainRoutingRule?.data?.decisions?.delegates?.findIndex( delegateIdx: item.mainRoutingRule?.data?.decisions?.delegates?.findIndex(
(d) => d === partyDelegate, (d) => d === item.partyDelegate,
), ),
paymentInstitution: { item,
text: paymentInstitution?.data?.name,
caption: paymentInstitution?.ref?.id,
},
mainRuleset: {
text: mainRoutingRule?.data?.name,
caption: mainRoutingRule?.ref?.id,
},
partyDelegate: {
text: partyDelegate?.description,
caption: partyDelegate?.ruleset?.id,
},
})), })),
), ),
); );

View File

@ -7,6 +7,7 @@
'/routing-rules/' + '/routing-rules/' +
(routingRulesTypeService.routingRulesType$ | async) (routingRulesTypeService.routingRulesType$ | async)
]" ]"
fullHeight
title="Party Routing Rules" title="Party Routing Rules"
(idLinkClick)="openRefId()" (idLinkClick)="openRefId()"
> >

View File

@ -1,15 +1,23 @@
import { Component, DestroyRef } from '@angular/core'; import { Component, DestroyRef } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { DialogService, DialogResponseStatus, compareDifferentTypes } from '@vality/ng-core'; import { RoutingDelegate } from '@vality/domain-proto/domain';
import {
DialogService,
DialogResponseStatus,
compareDifferentTypes,
Column,
} from '@vality/ng-core';
import { combineLatest } from 'rxjs'; import { combineLatest } from 'rxjs';
import { filter, map, shareReplay, startWith, switchMap, take } from 'rxjs/operators'; import { filter, map, shareReplay, startWith, switchMap, take } from 'rxjs/operators';
import { DomainStoreService } from '@cc/app/api/domain-config'; import { DomainStoreService } from '@cc/app/api/domain-config';
import { createShopColumn, createWalletColumn } from '@cc/app/shared';
import { SidenavInfoService } from '../../../shared/components/sidenav-info'; import { SidenavInfoService } from '../../../shared/components/sidenav-info';
import { DomainObjectCardComponent } from '../../../shared/components/thrift-api-crud'; import { DomainObjectCardComponent } from '../../../shared/components/thrift-api-crud';
import { PartyDelegateRulesetsService } from '../party-delegate-rulesets'; import { PartyDelegateRulesetsService } from '../party-delegate-rulesets';
import { RoutingRulesListItem } from '../routing-rules-list';
import { RoutingRulesTypeService } from '../routing-rules-type.service'; import { RoutingRulesTypeService } from '../routing-rules-type.service';
import { AddPartyRoutingRuleDialogComponent } from './add-party-routing-rule-dialog'; import { AddPartyRoutingRuleDialogComponent } from './add-party-routing-rule-dialog';
@ -27,65 +35,69 @@ export class PartyRoutingRulesetComponent {
partyID$ = this.partyRoutingRulesetService.partyID$; partyID$ = this.partyRoutingRulesetService.partyID$;
isLoading$ = this.domainStoreService.isLoading$; isLoading$ = this.domainStoreService.isLoading$;
shopsDisplayedColumns = [ shopsDisplayedColumns: Column<RoutingRulesListItem<RoutingDelegate>>[] = [
{ key: 'id', name: 'Delegate (Ruleset Ref ID)' }, {
{ key: 'shop', name: 'Shop' }, field: 'id',
header: 'Delegate (Ruleset Ref ID)',
cell: (d) => ({
value: d.item?.description || `#${d.item?.ruleset?.id}`,
description: d.item?.ruleset?.id,
click: () => this.navigateToDelegate(d.parentRefId, d.delegateIdx),
}),
},
createShopColumn((d) =>
this.partyRoutingRulesetService.partyID$.pipe(
map((partyId) => ({
shopId: d.item?.allowed?.condition?.party?.definition?.shop_is,
partyId,
})),
),
),
]; ];
walletsDisplayedColumns = [ walletsDisplayedColumns: Column<RoutingRulesListItem<RoutingDelegate>>[] = [
{ key: 'id', name: 'Delegate (Ruleset Ref ID)' }, {
{ key: 'wallet', name: 'Wallet' }, field: 'id',
header: 'Delegate (Ruleset Ref ID)',
cell: (d) => ({
value: d.item?.description || `#${d.item?.ruleset?.id}`,
description: d.item?.ruleset?.id,
click: () => this.navigateToDelegate(d.parentRefId, d.delegateIdx),
}),
},
createWalletColumn((d) =>
this.partyRoutingRulesetService.partyID$.pipe(
map((partyId) => ({
id: d.item?.allowed?.condition?.party?.definition?.wallet_is,
partyId,
})),
),
),
]; ];
shopsData$ = combineLatest([ shopsData$ = this.partyRuleset$.pipe(
this.partyRuleset$, filter(Boolean),
this.partyRoutingRulesetService.shops$.pipe(startWith([])), map((ruleset): RoutingRulesListItem<RoutingDelegate>[] =>
]).pipe(
filter(([r]) => !!r),
map(([ruleset, shops]) =>
ruleset.data.decisions.delegates ruleset.data.decisions.delegates
.filter((d) => d?.allowed?.condition?.party?.definition?.shop_is) .filter((d) => d?.allowed?.condition?.party?.definition?.shop_is)
.map((delegate, delegateIdx) => { .map((delegate, delegateIdx) => ({
const shopId = delegate?.allowed?.condition?.party?.definition?.shop_is;
return {
parentRefId: ruleset.ref.id, parentRefId: ruleset.ref.id,
delegateIdx, delegateIdx,
id: { item: delegate,
text: delegate?.description, })),
caption: delegate?.ruleset?.id,
},
shop: {
text: shops?.find((s) => s?.id === shopId)?.details?.name,
caption: shopId,
},
};
}),
), ),
startWith([]), startWith([]),
takeUntilDestroyed(this.destroyRef), takeUntilDestroyed(this.destroyRef),
shareReplay(1), shareReplay(1),
); );
walletsData$ = combineLatest([ walletsData$ = this.partyRuleset$.pipe(
this.partyRuleset$, filter(Boolean),
this.partyRoutingRulesetService.wallets$.pipe(startWith([])), map((ruleset): RoutingRulesListItem<RoutingDelegate>[] =>
]).pipe(
filter(([r]) => !!r),
map(([ruleset, wallets]) =>
ruleset.data.decisions.delegates ruleset.data.decisions.delegates
.filter((d) => d?.allowed?.condition?.party?.definition?.wallet_is) .filter((d) => d?.allowed?.condition?.party?.definition?.wallet_is)
.map((delegate, delegateIdx) => { .map((delegate, delegateIdx) => ({
const walletId = delegate?.allowed?.condition?.party?.definition?.wallet_is;
return {
parentRefId: ruleset.ref.id, parentRefId: ruleset.ref.id,
delegateIdx, delegateIdx,
id: { item: delegate,
text: delegate?.description, })),
caption: delegate?.ruleset?.id,
},
wallet: {
text: wallets?.find((w) => w?.id === walletId)?.name,
caption: walletId,
},
};
}),
), ),
startWith([]), startWith([]),
takeUntilDestroyed(this.destroyRef), takeUntilDestroyed(this.destroyRef),

View File

@ -1,8 +1,7 @@
<v-table <v-table
[columns]="columns" [columns]="columns()"
[data]="data" [data]="data"
[progress]="progress" [progress]="progress"
[size]="100"
name="routingRulesList" name="routingRulesList"
noActions standaloneFilter
></v-table> ></v-table>

View File

@ -4,9 +4,12 @@ import {
EventEmitter, EventEmitter,
Input, Input,
Output, Output,
OnChanges,
booleanAttribute, booleanAttribute,
DestroyRef, DestroyRef,
input,
computed,
runInInjectionContext,
Injector,
} from '@angular/core'; } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
@ -14,10 +17,9 @@ import {
DialogResponseStatus, DialogResponseStatus,
DialogService, DialogService,
ConfirmDialogComponent, ConfirmDialogComponent,
Column,
createOperationColumn,
ComponentChanges,
NotifyLogService, NotifyLogService,
Column,
createMenuColumn,
} from '@vality/ng-core'; } from '@vality/ng-core';
import { filter, switchMap, catchError } from 'rxjs/operators'; import { filter, switchMap, catchError } from 'rxjs/operators';
@ -30,62 +32,27 @@ type DelegateId = {
delegateIdx: number; delegateIdx: number;
}; };
export type RoutingRulesListItem<T> = DelegateId & { item: T };
@Component({ @Component({
selector: 'cc-routing-rules-list', selector: 'cc-routing-rules-list',
templateUrl: 'routing-rules-list.component.html', templateUrl: 'routing-rules-list.component.html',
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
}) })
export class RoutingRulesListComponent< export class RoutingRulesListComponent<T> {
T extends { [N in PropertyKey]: unknown } & DelegateId = {
[N in PropertyKey]: unknown;
} & DelegateId,
> implements OnChanges
{
@Input() data: T[]; @Input() data: T[];
@Input() displayedColumns: { key: keyof T; name: string }[]; displayedColumns = input<Column<RoutingRulesListItem<T>>[]>([]);
@Input({ transform: booleanAttribute }) progress: boolean = false; @Input({ transform: booleanAttribute }) progress: boolean = false;
@Output() toDetails = new EventEmitter<DelegateId>(); @Output() toDetails = new EventEmitter<DelegateId>();
columns: Column<T>[] = []; columns = computed<Column<RoutingRulesListItem<T>>[]>(() =>
runInInjectionContext(this.injector, () => [
constructor( ...this.displayedColumns(),
private dialogService: DialogService, createMenuColumn((d) => ({
private log: NotifyLogService, items: [
private routingRulesService: RoutingRulesService,
private route: ActivatedRoute,
private destroyRef: DestroyRef,
) {}
ngOnChanges(changes: ComponentChanges<RoutingRulesListComponent<T>>) {
if (changes.displayedColumns) {
this.columns = [
...this.displayedColumns.map(
(c, idx): Column<T> => ({
field: `${c.key as string}.text`,
formatter:
idx === 0
? (d) => {
const v = d?.[c.key] as { caption: string; text: string };
return v?.text || `#${v?.caption}`;
}
: undefined,
click:
idx === 0
? (d) =>
this.toDetails.emit({
parentRefId: d?.parentRefId,
delegateIdx: d?.delegateIdx,
})
: undefined,
header: c.name,
description: `${c.key as string}.caption`,
}),
),
createOperationColumn([
{ {
label: 'Details', label: 'Details',
click: (d) => click: () =>
this.toDetails.emit({ this.toDetails.emit({
parentRefId: d?.parentRefId, parentRefId: d?.parentRefId,
delegateIdx: d?.delegateIdx, delegateIdx: d?.delegateIdx,
@ -93,24 +60,33 @@ export class RoutingRulesListComponent<
}, },
{ {
label: 'Change delegate ruleset', label: 'Change delegate ruleset',
click: (d) => this.changeDelegateRuleset(d), click: () => this.changeDelegateRuleset(d),
}, },
{ {
label: 'Change main ruleset', label: 'Change main ruleset',
click: (d) => this.changeTarget(d), click: () => this.changeTarget(d),
}, },
{ {
label: 'Clone delegate ruleset', label: 'Clone delegate ruleset',
click: (d) => this.cloneDelegateRuleset(d), click: () => this.cloneDelegateRuleset(d),
}, },
{ {
label: 'Delete', label: 'Delete',
click: (d) => this.delete(d), click: () => this.delete(d),
}, },
],
})),
]), ]),
]; );
}
} constructor(
private dialogService: DialogService,
private log: NotifyLogService,
private routingRulesService: RoutingRulesService,
private route: ActivatedRoute,
private destroyRef: DestroyRef,
private injector: Injector,
) {}
changeDelegateRuleset(delegateId: DelegateId) { changeDelegateRuleset(delegateId: DelegateId) {
this.dialogService this.dialogService

View File

@ -9,20 +9,19 @@
'/' + '/' +
(partyRulesetRefID$ | async) (partyRulesetRefID$ | async)
]" ]"
fullHeight
(idLinkClick)="openRefId()" (idLinkClick)="openRefId()"
> >
<cc-page-layout-actions> <cc-page-layout-actions>
<button color="primary" mat-raised-button (click)="addRule()">Add</button> <button color="primary" mat-raised-button (click)="addRule()">Add</button>
</cc-page-layout-actions> </cc-page-layout-actions>
<v-table <v-table
[(sort)]="sort"
[columns]="columns" [columns]="columns"
[data]="(candidates$ | async) || []" [data]="(candidates$ | async) || []"
[progress]="isLoading$ | async" [progress]="isLoading$ | async"
[rowDragDrop]="['priority']" [rowDragDrop]="['priority']"
[size]="100" standaloneFilter
[sort]="{ active: 'priority', direction: 'desc' }"
noActions
sortOnFront
(rowDropped)="drop($event)" (rowDropped)="drop($event)"
></v-table> ></v-table>
</cc-page-layout> </cc-page-layout>

View File

@ -1,5 +1,6 @@
import { Component, DestroyRef } from '@angular/core'; import { Component, DestroyRef } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { Sort } from '@angular/material/sort';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { RoutingCandidate } from '@vality/domain-proto/domain'; import { RoutingCandidate } from '@vality/domain-proto/domain';
import { Predicate } from '@vality/domain-proto/internal/domain'; import { Predicate } from '@vality/domain-proto/internal/domain';
@ -7,10 +8,10 @@ import {
DialogResponseStatus, DialogResponseStatus,
DialogService, DialogService,
NotifyLogService, NotifyLogService,
Column,
createOperationColumn,
DragDrop, DragDrop,
correctPriorities, correctPriorities,
Column,
createMenuColumn,
} from '@vality/ng-core'; } from '@vality/ng-core';
import { toJson, getUnionKey } from '@vality/ng-thrift'; import { toJson, getUnionKey } from '@vality/ng-thrift';
import cloneDeep from 'lodash-es/cloneDeep'; import cloneDeep from 'lodash-es/cloneDeep';
@ -19,16 +20,15 @@ import { first, map, switchMap, withLatestFrom, take } from 'rxjs/operators';
import { DomainStoreService } from '@cc/app/api/domain-config'; import { DomainStoreService } from '@cc/app/api/domain-config';
import { RoutingRulesType } from '@cc/app/sections/routing-rules/types/routing-rules-type'; import { RoutingRulesType } from '@cc/app/sections/routing-rules/types/routing-rules-type';
import { createDomainObjectColumn, createPredicateColumn } from '@cc/app/shared';
import { import {
DomainThriftFormDialogComponent, DomainThriftFormDialogComponent,
DomainObjectCardComponent, DomainObjectCardComponent,
UpdateThriftDialogComponent, UpdateThriftDialogComponent,
} from '@cc/app/shared/components/thrift-api-crud'; } from '@cc/app/shared/components/thrift-api-crud';
import { createPredicateColumn } from '../../../shared';
import { CandidateCardComponent } from '../../../shared/components/candidate-card/candidate-card.component'; import { CandidateCardComponent } from '../../../shared/components/candidate-card/candidate-card.component';
import { SidenavInfoService } from '../../../shared/components/sidenav-info'; import { SidenavInfoService } from '../../../shared/components/sidenav-info';
import { createTerminalColumn } from '../../../shared/utils/table/create-terminal-column';
import { RoutingRulesService } from '../services/routing-rules'; import { RoutingRulesService } from '../services/routing-rules';
import { RoutingRulesetService } from './routing-ruleset.service'; import { RoutingRulesetService } from './routing-ruleset.service';
@ -60,39 +60,52 @@ export class RoutingRulesetComponent {
candidates$ = this.routingRulesetService.ruleset$.pipe(map((r) => r.data.decisions.candidates)); candidates$ = this.routingRulesetService.ruleset$.pipe(map((r) => r.data.decisions.candidates));
isLoading$ = this.domainStoreService.isLoading$; isLoading$ = this.domainStoreService.isLoading$;
columns: Column<RoutingCandidate>[] = [ columns: Column<RoutingCandidate>[] = [
{ field: 'priority', sortable: true }, { field: 'priority' },
{ {
field: 'candidate', field: 'candidate',
description: 'description', cell: (d) =>
sortable: true, this.getCandidateIdx(d).pipe(
formatter: (d) => this.getCandidateIdx(d).pipe(map((idx) => `#${idx + 1}`)), map((idx) => ({
click: (d) => { value: `#${idx + 1}`,
combineLatest([this.getCandidateIdx(d), this.routingRulesetService.ruleset$]) description: d.description,
.pipe(takeUntilDestroyed(this.destroyRef)) click: () => {
.subscribe(([idx, ruleset]) => { this.routingRulesetService.ruleset$
.pipe(first())
.subscribe((ruleset) => {
this.sidenavInfoService.toggle(CandidateCardComponent, { this.sidenavInfoService.toggle(CandidateCardComponent, {
idx, idx,
ref: ruleset.ref, ref: ruleset.ref,
}); });
}); });
}, },
})),
),
}, },
createTerminalColumn((d) => d.terminal.id), createDomainObjectColumn((d) => ({ ref: { terminal: d.terminal } }), {
createPredicateColumn('global_allow', (d) => header: 'Terminal',
}),
createPredicateColumn(
(d) =>
combineLatest([ combineLatest([
this.domainStoreService.getObjects('terminal'), this.domainStoreService.getObjects('terminal'),
this.routingRulesType$, this.routingRulesType$,
]).pipe( ]).pipe(
map(([terminals, type]) => { map(([terminals, type]) => {
const terms = terminals.find((t) => t.ref.id === d.terminal.id).data?.terms; const terms = terminals.find((t) => t.ref.id === d.terminal.id).data?.terms;
return type === RoutingRulesType.Payment return {
predicate:
type === RoutingRulesType.Payment
? terms?.payments?.global_allow ? terms?.payments?.global_allow
: terms?.wallet?.withdrawals?.global_allow; : terms?.wallet?.withdrawals?.global_allow,
};
}), }),
), ),
{ header: 'Global Allow' },
), ),
createPredicateColumn('allowed', (d) => d.allowed, { createPredicateColumn((d) => ({ predicate: d.allowed }), {
click: (d) => { header: 'Allowed',
cell: (d) => ({
click: () => {
this.getCandidateIdx(d) this.getCandidateIdx(d)
.pipe(takeUntilDestroyed(this.destroyRef)) .pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((idx) => { .subscribe((idx) => {
@ -100,16 +113,20 @@ export class RoutingRulesetComponent {
}); });
}, },
}), }),
{ field: 'weight', sortable: true }, }),
{ field: 'weight' },
{ {
field: 'pin', field: 'pin',
formatter: (d) => JSON.stringify(toJson(d.pin?.features)), cell: (d) => ({
hide: true, value: JSON.stringify(toJson(d.pin?.features)),
}),
hidden: true,
}, },
createOperationColumn<RoutingCandidate>([ createMenuColumn((d) => ({
items: [
{ {
label: 'Edit', label: 'Edit',
click: (d) => { click: () => {
this.getCandidateIdx(d) this.getCandidateIdx(d)
.pipe(takeUntilDestroyed(this.destroyRef)) .pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((idx) => { .subscribe((idx) => {
@ -119,7 +136,7 @@ export class RoutingRulesetComponent {
}, },
{ {
label: 'Duplicate', label: 'Duplicate',
click: (d) => { click: () => {
this.getCandidateIdx(d) this.getCandidateIdx(d)
.pipe(takeUntilDestroyed(this.destroyRef)) .pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((idx) => { .subscribe((idx) => {
@ -128,8 +145,8 @@ export class RoutingRulesetComponent {
}, },
}, },
{ {
label: (d) => (togglePredicate(d.allowed).prevAllowed ? 'Deny' : 'Allow'), label: togglePredicate(d.allowed).prevAllowed ? 'Deny' : 'Allow',
click: (d) => { click: () => {
this.getCandidateIdx(d) this.getCandidateIdx(d)
.pipe(takeUntilDestroyed(this.destroyRef)) .pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((idx) => { .subscribe((idx) => {
@ -139,7 +156,7 @@ export class RoutingRulesetComponent {
}, },
{ {
label: 'Remove', label: 'Remove',
click: (d) => { click: () => {
this.getCandidateIdx(d) this.getCandidateIdx(d)
.pipe(takeUntilDestroyed(this.destroyRef)) .pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((idx) => { .subscribe((idx) => {
@ -147,8 +164,10 @@ export class RoutingRulesetComponent {
}); });
}, },
}, },
]), ],
})),
]; ];
sort: Sort = { active: 'priority', direction: 'desc' };
constructor( constructor(
private dialog: DialogService, private dialog: DialogService,

View File

@ -1,11 +1,11 @@
<cc-page-layout title="Merchants"> <cc-page-layout fullHeight title="Merchants">
<v-table <v-table
[columns]="columns" [columns]="columns"
[data]="parties$ | async" [data]="parties$ | async"
[filter]="initSearchParams$ | async" [filter]="initSearchParams$ | async"
[progress]="inProgress$ | async" [progress]="inProgress$ | async"
externalFilter externalFilter
noActions standaloneFilter
(filterChange)="searchParamsUpdated($event)" (filterChange)="searchParamsUpdated($event)"
(update)="reload($event)" (update)="reload($event)"
></v-table> ></v-table>

View File

@ -1,7 +1,13 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { Party } from '@vality/deanonimus-proto/deanonimus'; import { Party } from '@vality/deanonimus-proto/deanonimus';
import { Column, createOperationColumn, QueryParamsService, UpdateOptions } from '@vality/ng-core'; import {
Column,
createMenuColumn,
DebounceTime,
QueryParamsService,
UpdateOptions,
} from '@vality/ng-core';
import { getUnionKey } from '@vality/ng-thrift'; import { getUnionKey } from '@vality/ng-thrift';
import startCase from 'lodash-es/startCase'; import startCase from 'lodash-es/startCase';
import { map } from 'rxjs/operators'; import { map } from 'rxjs/operators';
@ -21,44 +27,44 @@ export class SearchPartiesComponent {
{ field: 'id' }, { field: 'id' },
{ {
field: 'email', field: 'email',
link: (party) => `/party/${party.id}`, cell: (party) => ({ link: () => `/party/${party.id}` }),
}, },
{ {
field: 'blocking', field: 'blocking',
type: 'tag', cell: (party) => ({
formatter: (party) => getUnionKey(party.blocking), value: startCase(getUnionKey(party.blocking)),
typeParameters: { color: (
label: (party) => startCase(getUnionKey(party.blocking)), {
tags: { blocked: 'warn',
blocked: { color: 'warn' }, unblocked: 'success',
unblocked: { color: 'success' }, } as const
}, )[getUnionKey(party.blocking)],
}, }),
}, },
{ {
field: 'suspension', field: 'suspension',
type: 'tag', cell: (party) => ({
formatter: (party) => getUnionKey(party.suspension), value: startCase(getUnionKey(party.suspension)),
typeParameters: { color: (
label: (party) => startCase(getUnionKey(party.suspension)), {
tags: { suspended: 'warn',
suspended: { color: 'warn' }, active: 'success',
active: { color: 'success' }, } as const
}, )[getUnionKey(party.suspension)],
}, }),
}, },
{ {
field: 'shops', field: 'shops',
formatter: (party) => party.shops.size, cell: (party) => ({ value: party.shops.size }),
}, },
createOperationColumn([ createMenuColumn((party) => ({
items: [
{ {
label: 'Details', label: 'Details',
click: (party) => { click: () => this.router.navigate([`/party/${party.id}`]),
this.router.navigate([`/party/${party.id}`]);
}, },
}, ],
]), })),
]; ];
constructor( constructor(
@ -67,6 +73,7 @@ export class SearchPartiesComponent {
private router: Router, private router: Router,
) {} ) {}
@DebounceTime()
searchParamsUpdated(filter: string) { searchParamsUpdated(filter: string) {
void this.qp.set({ text: filter }); void this.qp.set({ text: filter });
this.fetchPartiesService.load(filter); this.fetchPartiesService.load(filter);

View File

@ -1,6 +1,6 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { SearchShopHit } from '@vality/deanonimus-proto/deanonimus'; import { SearchShopHit } from '@vality/deanonimus-proto/deanonimus';
import { Column, progressTo, NotifyLogService } from '@vality/ng-core'; import { progressTo, NotifyLogService } from '@vality/ng-core';
import { BehaviorSubject, defer, of, combineLatest, Subject, Observable } from 'rxjs'; import { BehaviorSubject, defer, of, combineLatest, Subject, Observable } from 'rxjs';
import { import {
switchMap, switchMap,
@ -43,7 +43,6 @@ export class ShopsComponent {
), ),
shareReplay({ refCount: true, bufferSize: 1 }), shareReplay({ refCount: true, bufferSize: 1 }),
); );
columns: Column<SearchShopHit>[] = [{ field: 'shop.details.name', description: 'shop.id' }];
progress$ = new BehaviorSubject(0); progress$ = new BehaviorSubject(0);
private updateShops$ = new BehaviorSubject<void>(undefined); private updateShops$ = new BehaviorSubject<void>(undefined);

View File

@ -2,11 +2,10 @@
<cc-page-layout-actions> <cc-page-layout-actions>
<button color="primary" mat-raised-button (click)="create()">Create</button> <button color="primary" mat-raised-button (click)="create()">Create</button>
</cc-page-layout-actions> </cc-page-layout-actions>
<v-table2 <v-table
[(sort)]="sort"
[columns]="columns" [columns]="columns"
[data]="sources$ | async" [data]="sources$ | async"
[progress]="!!(progress$ | async)" [progress]="!!(progress$ | async)"
standaloneFilter standaloneFilter
></v-table2> ></v-table>
</cc-page-layout> </cc-page-layout>

View File

@ -1,7 +1,6 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { Sort } from '@angular/material/sort';
import { Source } from '@vality/fistful-proto/internal/source'; import { Source } from '@vality/fistful-proto/internal/source';
import { DialogService, Column2 } from '@vality/ng-core'; import { DialogService, Column } from '@vality/ng-core';
import { CreateSourceComponent } from './create-source/create-source.component'; import { CreateSourceComponent } from './create-source/create-source.component';
import { FetchSourcesService } from './fetch-sources.service'; import { FetchSourcesService } from './fetch-sources.service';
@ -12,14 +11,13 @@ import { FetchSourcesService } from './fetch-sources.service';
export class SourcesComponent { export class SourcesComponent {
sources$ = this.fetchSourcesService.sources$; sources$ = this.fetchSourcesService.sources$;
progress$ = this.fetchSourcesService.progress$; progress$ = this.fetchSourcesService.progress$;
columns: Column2<Source>[] = [ columns: Column<Source>[] = [
{ field: 'id' }, { field: 'id' },
{ field: 'name' }, { field: 'name' },
{ field: 'identity' }, { field: 'identity' },
{ field: 'currency_symbolic_code' }, { field: 'currency_symbolic_code' },
{ field: 'created_at', cell: { type: 'datetime' } }, { field: 'created_at', cell: { type: 'datetime' } },
]; ];
sort: Sort = { direction: 'asc', active: 'name' };
constructor( constructor(
private fetchSourcesService: FetchSourcesService, private fetchSourcesService: FetchSourcesService,

View File

@ -2,13 +2,12 @@
<cc-page-layout-actions> <cc-page-layout-actions>
<button color="primary" mat-raised-button (click)="create()">Create</button> <button color="primary" mat-raised-button (click)="create()">Create</button>
</cc-page-layout-actions> </cc-page-layout-actions>
<v-table2 <v-table
[(sort)]="sort"
[columns]="columns" [columns]="columns"
[data]="data$ | async" [data]="data$ | async"
[progress]="progress$ | async" [progress]="progress$ | async"
name="terminals" name="terminals"
standaloneFilter standaloneFilter
(update)="update()" (update)="update()"
></v-table2> ></v-table>
</cc-page-layout> </cc-page-layout>

View File

@ -1,9 +1,14 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { Sort } from '@angular/material/sort';
import { TerminalObject } from '@vality/domain-proto/domain'; import { TerminalObject } from '@vality/domain-proto/domain';
import { DialogService, Column2 } from '@vality/ng-core'; import { DialogService, Column } from '@vality/ng-core';
import { map } from 'rxjs/operators'; import { map } from 'rxjs/operators';
import {
createCurrencyColumn,
createPredicateColumn,
createDomainObjectColumn,
} from '@cc/app/shared';
import { DomainStoreService } from '../../api/domain-config'; import { DomainStoreService } from '../../api/domain-config';
import { AccountBalancesStoreService } from '../../api/terminal-balance'; import { AccountBalancesStoreService } from '../../api/terminal-balance';
import { SidenavInfoService } from '../../shared/components/sidenav-info'; import { SidenavInfoService } from '../../shared/components/sidenav-info';
@ -14,11 +19,6 @@ import {
CreateDomainObjectDialogComponent, CreateDomainObjectDialogComponent,
getDomainObjectDetails, getDomainObjectDetails,
} from '../../shared/components/thrift-api-crud'; } from '../../shared/components/thrift-api-crud';
import {
createCurrencyColumn,
createPredicateColumn,
createDomainObjectColumn,
} from '../../shared/utils/table2';
import { getTerminalShopWalletDelegates } from './utils/get-terminal-shop-wallet-delegates'; import { getTerminalShopWalletDelegates } from './utils/get-terminal-shop-wallet-delegates';
@ -27,7 +27,7 @@ import { getTerminalShopWalletDelegates } from './utils/get-terminal-shop-wallet
templateUrl: './terminals.component.html', templateUrl: './terminals.component.html',
}) })
export class TerminalsComponent { export class TerminalsComponent {
columns: Column2<TerminalObject>[] = [ columns: Column<TerminalObject>[] = [
{ field: 'ref.id', sticky: 'start' }, { field: 'ref.id', sticky: 'start' },
{ {
field: 'data.name', field: 'data.name',
@ -112,7 +112,6 @@ export class TerminalsComponent {
]; ];
data$ = this.domainStoreService.getObjects('terminal'); data$ = this.domainStoreService.getObjects('terminal');
progress$ = this.domainStoreService.isLoading$; progress$ = this.domainStoreService.isLoading$;
sort: Sort = { active: 'data.name', direction: 'asc' };
constructor( constructor(
private domainStoreService: DomainStoreService, private domainStoreService: DomainStoreService,

View File

@ -1,3 +1,3 @@
<cc-card [title]="'Term Sets History'"> <cc-card [title]="'Term Sets History'">
<v-table2 [columns]="columns" [treeData]="historyData()"></v-table2> <v-table [columns]="columns" [treeData]="historyData()"></v-table>
</cc-card> </cc-card>

View File

@ -1,12 +1,13 @@
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { Component, input, computed } from '@angular/core'; import { Component, input, computed } from '@angular/core';
import { MatTooltip } from '@angular/material/tooltip'; import { MatTooltip } from '@angular/material/tooltip';
import { TableModule, VSelectPipe, Column2 } from '@vality/ng-core'; import { TableModule, VSelectPipe, Column } from '@vality/ng-core';
import type { TermSetHistory, ShopTermSet } from '@vality/dominator-proto/internal/dominator'; import type { TermSetHistory, ShopTermSet } from '@vality/dominator-proto/internal/dominator';
import { createDomainObjectColumn } from '@cc/app/shared';
import { SidenavInfoModule } from '../../../../shared/components/sidenav-info'; import { SidenavInfoModule } from '../../../../shared/components/sidenav-info';
import { createDomainObjectColumn } from '../../../../shared/utils/table2';
import { getFlatDecisions } from '../../utils/get-flat-decisions'; import { getFlatDecisions } from '../../utils/get-flat-decisions';
import { import {
getShopCashFlowSelectors, getShopCashFlowSelectors,
@ -36,7 +37,7 @@ export class ShopsTermSetHistoryCardComponent {
})), })),
); );
columns: Column2<TermSetHistory>[] = [ columns: Column<TermSetHistory>[] = [
{ field: 'applied_at', cell: { type: 'datetime' } }, { field: 'applied_at', cell: { type: 'datetime' } },
createDomainObjectColumn((d) => ({ ref: { term_set_hierarchy: d?.term_set?.ref } }), { createDomainObjectColumn((d) => ({ ref: { term_set_hierarchy: d?.term_set?.ref } }), {
header: 'Term Set', header: 'Term Set',

View File

@ -16,7 +16,7 @@
</ng-template> </ng-template>
</v-filters> </v-filters>
<v-table2 <v-table
[columns]="columns" [columns]="columns"
[hasMore]="hasMore$ | async" [hasMore]="hasMore$ | async"
[maxSize]="250" [maxSize]="250"
@ -24,5 +24,5 @@
[treeData]="terms$ | async" [treeData]="terms$ | async"
(more)="more()" (more)="more()"
(update)="update($event)" (update)="update($event)"
></v-table2> ></v-table>
</cc-page-layout> </cc-page-layout>

View File

@ -23,24 +23,24 @@ import {
TableModule, TableModule,
UpdateOptions, UpdateOptions,
VSelectPipe, VSelectPipe,
Column2, Column,
cachedHeadMap, cachedHeadMap,
} from '@vality/ng-core'; } from '@vality/ng-core';
import { map, shareReplay } from 'rxjs/operators'; import { map, shareReplay } from 'rxjs/operators';
import { Overwrite } from 'utility-types'; import { Overwrite } from 'utility-types';
import {
createShopColumn,
createPartyColumn,
createContractColumn,
createDomainObjectColumn,
} from '@cc/app/shared';
import { CurrencyFieldComponent } from '@cc/app/shared/components/currency-field'; import { CurrencyFieldComponent } from '@cc/app/shared/components/currency-field';
import { MerchantFieldModule } from '@cc/app/shared/components/merchant-field'; import { MerchantFieldModule } from '@cc/app/shared/components/merchant-field';
import { SidenavInfoService } from '@cc/app/shared/components/sidenav-info'; import { SidenavInfoService } from '@cc/app/shared/components/sidenav-info';
import { DEBOUNCE_TIME_MS } from '@cc/app/tokens'; import { DEBOUNCE_TIME_MS } from '@cc/app/tokens';
import { PageLayoutModule, ShopFieldModule } from '../../../../shared'; import { PageLayoutModule, ShopFieldModule } from '../../../../shared';
import {
createShopColumn,
createPartyColumn,
createContractColumn,
createDomainObjectColumn,
} from '../../../../shared/utils/table2';
import { getFlatDecisions, FlatDecision } from '../../utils/get-flat-decisions'; import { getFlatDecisions, FlatDecision } from '../../utils/get-flat-decisions';
import { ShopsTermSetHistoryCardComponent } from '../shops-term-set-history-card'; import { ShopsTermSetHistoryCardComponent } from '../shops-term-set-history-card';
@ -101,7 +101,7 @@ export class ShopsTermsComponent implements OnInit {
); );
hasMore$ = this.shopsTermsService.hasMore$; hasMore$ = this.shopsTermsService.hasMore$;
isLoading$ = this.shopsTermsService.isLoading$; isLoading$ = this.shopsTermsService.isLoading$;
columns: Column2<ShopTermSet, FlatDecision>[] = [ columns: Column<ShopTermSet, FlatDecision>[] = [
createShopColumn( createShopColumn(
(d) => ({ (d) => ({
shopId: d.shop_id, shopId: d.shop_id,

View File

@ -5,7 +5,7 @@ import {
ShopID, ShopID,
TermSetHierarchyObject, TermSetHierarchyObject,
} from '@vality/domain-proto/internal/domain'; } from '@vality/domain-proto/internal/domain';
import { Column2 } from '@vality/ng-core'; import { Column } from '@vality/ng-core';
import { formatCashVolumes } from '../../../../../shared'; import { formatCashVolumes } from '../../../../../shared';
import { createFeesColumns } from '../../../utils/create-fees-columns'; import { createFeesColumns } from '../../../utils/create-fees-columns';
@ -57,4 +57,4 @@ export const SHOP_FEES_COLUMNS = [
}), }),
}, },
BASE_SHOP_FEES_COLUMNS.at(-1), BASE_SHOP_FEES_COLUMNS.at(-1),
] satisfies Column2<object, FlatDecision>[]; ] satisfies Column<object, FlatDecision>[];

View File

@ -1,3 +1,3 @@
<cc-card [title]="'Term Sets History'"> <cc-card [title]="'Term Sets History'">
<v-table2 [columns]="columns" [treeData]="historyData()"></v-table2> <v-table [columns]="columns" [treeData]="historyData()"></v-table>
</cc-card> </cc-card>

View File

@ -1,7 +1,7 @@
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { Component, input, computed } from '@angular/core'; import { Component, input, computed } from '@angular/core';
import { MatTooltip } from '@angular/material/tooltip'; import { MatTooltip } from '@angular/material/tooltip';
import { TableModule, VSelectPipe, Column2 } from '@vality/ng-core'; import { TableModule, VSelectPipe, Column } from '@vality/ng-core';
import type { import type {
TerminalTermSet, TerminalTermSet,
@ -29,7 +29,7 @@ export class TerminalsTermSetHistoryCardComponent {
), ),
); );
columns: Column2<ProvisionTermSetHistory>[] = [ columns: Column<ProvisionTermSetHistory>[] = [
{ field: 'applied_at', cell: { type: 'datetime' } }, { field: 'applied_at', cell: { type: 'datetime' } },
...TERMINAL_FEES_COLUMNS, ...TERMINAL_FEES_COLUMNS,
]; ];

View File

@ -10,12 +10,12 @@
</ng-template> </ng-template>
</v-filters> </v-filters>
<v-table2 <v-table
[columns]="columns" [columns]="columns"
[hasMore]="hasMore$ | async" [hasMore]="hasMore$ | async"
[progress]="isLoading$ | async" [progress]="isLoading$ | async"
[treeData]="terms$ | async" [treeData]="terms$ | async"
(more)="more()" (more)="more()"
(update)="update($event)" (update)="update($event)"
></v-table2> ></v-table>
</cc-page-layout> </cc-page-layout>

View File

@ -10,7 +10,7 @@ import {
} from '@vality/dominator-proto/internal/dominator'; } from '@vality/dominator-proto/internal/dominator';
import { import {
clean, clean,
Column2, Column,
countChanged, countChanged,
createControls, createControls,
debounceTimeWithFirst, debounceTimeWithFirst,
@ -30,10 +30,9 @@ import { Overwrite } from 'utility-types';
import type { ProviderRef, TerminalRef } from '@vality/dominator-proto/internal/proto/domain'; import type { ProviderRef, TerminalRef } from '@vality/dominator-proto/internal/proto/domain';
import { PageLayoutModule } from '@cc/app/shared'; import { PageLayoutModule, createDomainObjectColumn } from '@cc/app/shared';
import { CurrencyFieldComponent } from '@cc/app/shared/components/currency-field'; import { CurrencyFieldComponent } from '@cc/app/shared/components/currency-field';
import { MerchantFieldModule } from '@cc/app/shared/components/merchant-field'; import { MerchantFieldModule } from '@cc/app/shared/components/merchant-field';
import { createDomainObjectColumn } from '@cc/app/shared/utils/table2/create-domain-object-column';
import { DEBOUNCE_TIME_MS } from '@cc/app/tokens'; import { DEBOUNCE_TIME_MS } from '@cc/app/tokens';
import { SidenavInfoService } from '../../../../shared/components/sidenav-info'; import { SidenavInfoService } from '../../../../shared/components/sidenav-info';
@ -80,7 +79,7 @@ export class TerminalsTermsComponent implements OnInit {
); );
hasMore$ = this.terminalsTermsService.hasMore$; hasMore$ = this.terminalsTermsService.hasMore$;
isLoading$ = this.terminalsTermsService.isLoading$; isLoading$ = this.terminalsTermsService.isLoading$;
columns: Column2<TerminalTermSet>[] = [ columns: Column<TerminalTermSet>[] = [
createDomainObjectColumn((d) => ({ ref: { terminal: d.terminal_id } }), { createDomainObjectColumn((d) => ({ ref: { terminal: d.terminal_id } }), {
header: 'Terminal', header: 'Terminal',
sticky: 'start', sticky: 'start',

View File

@ -1,5 +1,5 @@
import { ProvisionTermSet, CashFlowPosting } from '@vality/domain-proto/internal/domain'; import { ProvisionTermSet, CashFlowPosting } from '@vality/domain-proto/internal/domain';
import { Column2, TreeDataItem } from '@vality/ng-core'; import { Column, TreeDataItem } from '@vality/ng-core';
import { createFeesColumns } from '../../../utils/create-fees-columns'; import { createFeesColumns } from '../../../utils/create-fees-columns';
import { FlatDecision, getFlatDecisions } from '../../../utils/get-flat-decisions'; import { FlatDecision, getFlatDecisions } from '../../../utils/get-flat-decisions';
@ -55,4 +55,4 @@ export const TERMINAL_FEES_COLUMNS = [
feeFilter: isWithdrawalFee, feeFilter: isWithdrawalFee,
selectFlatDecision: (d) => d.withdrawal, selectFlatDecision: (d) => d.withdrawal,
}), }),
] satisfies Column2<object, TerminalChild>[]; ] satisfies Column<object, TerminalChild>[];

View File

@ -1,3 +1,3 @@
<cc-card [title]="'Term Sets History'"> <cc-card [title]="'Term Sets History'">
<v-table2 [columns]="columns" [treeData]="historyData()"></v-table2> <v-table [columns]="columns" [treeData]="historyData()"></v-table>
</cc-card> </cc-card>

View File

@ -1,12 +1,13 @@
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { Component, input, computed } from '@angular/core'; import { Component, input, computed } from '@angular/core';
import { MatTooltip } from '@angular/material/tooltip'; import { MatTooltip } from '@angular/material/tooltip';
import { TableModule, VSelectPipe, Column2 } from '@vality/ng-core'; import { TableModule, VSelectPipe, Column } from '@vality/ng-core';
import type { TermSetHistory, WalletTermSet } from '@vality/dominator-proto/internal/dominator'; import type { TermSetHistory, WalletTermSet } from '@vality/dominator-proto/internal/dominator';
import { createDomainObjectColumn } from '@cc/app/shared';
import { SidenavInfoModule } from '../../../../shared/components/sidenav-info'; import { SidenavInfoModule } from '../../../../shared/components/sidenav-info';
import { createDomainObjectColumn } from '../../../../shared/utils/table2';
import { getFlatDecisions } from '../../utils/get-flat-decisions'; import { getFlatDecisions } from '../../utils/get-flat-decisions';
import { import {
WALLET_FEES_COLUMNS, WALLET_FEES_COLUMNS,
@ -36,7 +37,7 @@ export class WalletsTermSetHistoryCardComponent {
})), })),
); );
columns: Column2<TermSetHistory>[] = [ columns: Column<TermSetHistory>[] = [
{ field: 'applied_at', cell: { type: 'datetime' } }, { field: 'applied_at', cell: { type: 'datetime' } },
createDomainObjectColumn((d) => ({ ref: { term_set_hierarchy: d?.term_set?.ref } }), { createDomainObjectColumn((d) => ({ ref: { term_set_hierarchy: d?.term_set?.ref } }), {
header: 'Term Set', header: 'Term Set',

View File

@ -13,7 +13,7 @@
</ng-template> </ng-template>
</v-filters> </v-filters>
<v-table2 <v-table
[columns]="columns" [columns]="columns"
[hasMore]="hasMore$ | async" [hasMore]="hasMore$ | async"
[maxSize]="250" [maxSize]="250"
@ -21,5 +21,5 @@
[treeData]="terms$ | async" [treeData]="terms$ | async"
(more)="more()" (more)="more()"
(update)="update($event)" (update)="update($event)"
></v-table2> ></v-table>
</cc-page-layout> </cc-page-layout>

View File

@ -26,21 +26,22 @@ import {
TableModule, TableModule,
UpdateOptions, UpdateOptions,
VSelectPipe, VSelectPipe,
Column2, Column,
cachedHeadMap, cachedHeadMap,
} from '@vality/ng-core'; } from '@vality/ng-core';
import { map, shareReplay } from 'rxjs/operators'; import { map, shareReplay } from 'rxjs/operators';
import { Overwrite } from 'utility-types'; import { Overwrite } from 'utility-types';
import { PageLayoutModule, WalletFieldModule } from '@cc/app/shared';
import { CurrencyFieldComponent } from '@cc/app/shared/components/currency-field';
import { MerchantFieldModule } from '@cc/app/shared/components/merchant-field';
import { SidenavInfoService } from '@cc/app/shared/components/sidenav-info';
import { import {
PageLayoutModule,
WalletFieldModule,
createDomainObjectColumn, createDomainObjectColumn,
createPartyColumn, createPartyColumn,
createWalletColumn, createWalletColumn,
} from '@cc/app/shared/utils/table2'; } from '@cc/app/shared';
import { CurrencyFieldComponent } from '@cc/app/shared/components/currency-field';
import { MerchantFieldModule } from '@cc/app/shared/components/merchant-field';
import { SidenavInfoService } from '@cc/app/shared/components/sidenav-info';
import { DEBOUNCE_TIME_MS } from '@cc/app/tokens'; import { DEBOUNCE_TIME_MS } from '@cc/app/tokens';
import { FlatDecision, getFlatDecisions } from '../../utils/get-flat-decisions'; import { FlatDecision, getFlatDecisions } from '../../utils/get-flat-decisions';
@ -104,7 +105,7 @@ export class WalletsTermsComponent implements OnInit {
); );
hasMore$ = this.walletsTermsService.hasMore$; hasMore$ = this.walletsTermsService.hasMore$;
isLoading$ = this.walletsTermsService.isLoading$; isLoading$ = this.walletsTermsService.isLoading$;
columns: Column2<WalletTermSet, FlatDecision>[] = [ columns: Column<WalletTermSet, FlatDecision>[] = [
createWalletColumn((d) => ({ id: d.wallet_id, name: d.wallet_name, partyId: d.owner_id }), { createWalletColumn((d) => ({ id: d.wallet_id, name: d.wallet_name, partyId: d.owner_id }), {
sticky: 'start', sticky: 'start',
}), }),

View File

@ -1,5 +1,5 @@
import { CashFlowPosting } from '@vality/domain-proto/internal/domain'; import { CashFlowPosting } from '@vality/domain-proto/internal/domain';
import { Column2 } from '@vality/ng-core'; import { Column } from '@vality/ng-core';
import { getCashVolumeParts, formatCashVolumes } from '../../../shared'; import { getCashVolumeParts, formatCashVolumes } from '../../../shared';
@ -20,7 +20,7 @@ export function createFeesColumns<T extends object>({
conditionLabel?: string; conditionLabel?: string;
feeFilter?: (v: CashFlowPosting) => boolean; feeFilter?: (v: CashFlowPosting) => boolean;
otherFilter?: (v: CashFlowPosting) => boolean; otherFilter?: (v: CashFlowPosting) => boolean;
} = {}): Column2<object, T>[] { } = {}): Column<object, T>[] {
function getFeeCashVolumeParts(d: T) { function getFeeCashVolumeParts(d: T) {
const decision = selectFlatDecision(d); const decision = selectFlatDecision(d);
return decision return decision

View File

@ -29,7 +29,7 @@
} }
@if (isFilterTable$ | async) { @if (isFilterTable$ | async) {
<v-table2 <v-table
[columns]="filterColumns" [columns]="filterColumns"
[data]="filterWallets$ | async" [data]="filterWallets$ | async"
[hasMore]="filterHasMore$ | async" [hasMore]="filterHasMore$ | async"
@ -37,9 +37,9 @@
name="filterWallets" name="filterWallets"
(more)="filterMore()" (more)="filterMore()"
(update)="filterSearch($event)" (update)="filterSearch($event)"
></v-table2> ></v-table>
} @else { } @else {
<v-table2 <v-table
[columns]="fullTextSearchColumns" [columns]="fullTextSearchColumns"
[data]="fullTextSearchWallets$ | async" [data]="fullTextSearchWallets$ | async"
[progress]="fullTextSearchLoading$ | async" [progress]="fullTextSearchLoading$ | async"
@ -48,6 +48,6 @@
standaloneFilter standaloneFilter
(filterChange)="fullTextSearch($event)" (filterChange)="fullTextSearch($event)"
(update)="fullTextSearchReload()" (update)="fullTextSearchReload()"
></v-table2> ></v-table>
} }
</cc-page-layout> </cc-page-layout>

View File

@ -13,7 +13,7 @@ import {
getValueChanges, getValueChanges,
countChanged, countChanged,
debounceTimeWithFirst, debounceTimeWithFirst,
Column2, Column,
DebounceTime, DebounceTime,
} from '@vality/ng-core'; } from '@vality/ng-core';
import isNil from 'lodash-es/isNil'; import isNil from 'lodash-es/isNil';
@ -23,9 +23,9 @@ import { MemoizeExpiring } from 'typescript-memoize';
import { WalletParams } from '@cc/app/api/fistful-stat/query-dsl/types/wallet'; import { WalletParams } from '@cc/app/api/fistful-stat/query-dsl/types/wallet';
import { ManagementService } from '@cc/app/api/wallet'; import { ManagementService } from '@cc/app/api/wallet';
import { createCurrencyColumn, createPartyColumn } from '@cc/app/shared';
import { IdentityManagementService } from '../../api/identity'; import { IdentityManagementService } from '../../api/identity';
import { createCurrencyColumn, createPartyColumn } from '../../shared/utils/table2';
import { DEBOUNCE_TIME_MS } from '../../tokens'; import { DEBOUNCE_TIME_MS } from '../../tokens';
import { PartyStoreService } from '../party'; import { PartyStoreService } from '../party';
@ -47,7 +47,7 @@ export class WalletsComponent implements OnInit {
fullTextSearchWallets$ = this.fetchWalletsTextService.result$; fullTextSearchWallets$ = this.fetchWalletsTextService.result$;
fullTextSearchLoading$ = this.fetchWalletsTextService.isLoading$; fullTextSearchLoading$ = this.fetchWalletsTextService.isLoading$;
filterColumns: Column2<StatWallet>[] = [ filterColumns: Column<StatWallet>[] = [
{ field: 'id' }, { field: 'id' },
{ field: 'name' }, { field: 'name' },
{ field: 'currency_symbolic_code' }, { field: 'currency_symbolic_code' },
@ -92,7 +92,7 @@ export class WalletsComponent implements OnInit {
{ hidden: this.partyStoreService.party$.pipe(map((p) => !p)) }, { hidden: this.partyStoreService.party$.pipe(map((p) => !p)) },
), ),
]; ];
fullTextSearchColumns: Column2<SearchWalletHit>[] = [ fullTextSearchColumns: Column<SearchWalletHit>[] = [
{ field: 'wallet.id' }, { field: 'wallet.id' },
{ field: 'wallet.name' }, { field: 'wallet.name' },
createPartyColumn((d) => ({ createPartyColumn((d) => ({

View File

@ -24,7 +24,7 @@
</ng-template> </ng-template>
</v-filters> </v-filters>
<v-table2 <v-table
[(rowSelected)]="selected" [(rowSelected)]="selected"
[columns]="columns" [columns]="columns"
[data]="withdrawals$ | async" [data]="withdrawals$ | async"
@ -47,5 +47,5 @@
Create adjustments Create adjustments
</button> </button>
</v-table-actions> </v-table-actions>
</v-table2> </v-table>
</cc-page-layout> </cc-page-layout>

View File

@ -17,7 +17,7 @@ import {
getValueChanges, getValueChanges,
countChanged, countChanged,
debounceTimeWithFirst, debounceTimeWithFirst,
Column2, Column,
} from '@vality/ng-core'; } from '@vality/ng-core';
import { getUnionKey } from '@vality/ng-thrift'; import { getUnionKey } from '@vality/ng-thrift';
import { endOfDay } from 'date-fns'; import { endOfDay } from 'date-fns';
@ -25,10 +25,10 @@ import startCase from 'lodash-es/startCase';
import { map, shareReplay } from 'rxjs/operators'; import { map, shareReplay } from 'rxjs/operators';
import { WithdrawalParams } from '@cc/app/api/fistful-stat'; import { WithdrawalParams } from '@cc/app/api/fistful-stat';
import { createDomainObjectColumn, createCurrencyColumn } from '@cc/app/shared';
import { createFailureColumn } from '../../shared'; import { createFailureColumn } from '../../shared';
import { FailMachinesDialogComponent, Type } from '../../shared/components/fail-machines-dialog'; import { FailMachinesDialogComponent, Type } from '../../shared/components/fail-machines-dialog';
import { createDomainObjectColumn, createCurrencyColumn } from '../../shared/utils/table2';
import { DATE_RANGE_DAYS, DEBOUNCE_TIME_MS } from '../../tokens'; import { DATE_RANGE_DAYS, DEBOUNCE_TIME_MS } from '../../tokens';
import { CreateAdjustmentDialogComponent } from './components/create-adjustment-dialog/create-adjustment-dialog.component'; import { CreateAdjustmentDialogComponent } from './components/create-adjustment-dialog/create-adjustment-dialog.component';
@ -70,7 +70,7 @@ export class WithdrawalsComponent implements OnInit {
withdrawals$ = this.fetchWithdrawalsService.result$; withdrawals$ = this.fetchWithdrawalsService.result$;
inProgress$ = this.fetchWithdrawalsService.isLoading$; inProgress$ = this.fetchWithdrawalsService.isLoading$;
hasMore$ = this.fetchWithdrawalsService.hasMore$; hasMore$ = this.fetchWithdrawalsService.hasMore$;
columns: Column2<StatWithdrawal>[] = [ columns: Column<StatWithdrawal>[] = [
{ field: 'id', sticky: 'start' }, { field: 'id', sticky: 'start' },
{ field: 'external_id' }, { field: 'external_id' },
{ field: 'created_at', cell: { type: 'datetime' } }, { field: 'created_at', cell: { type: 'datetime' } },

View File

@ -1,4 +1,4 @@
<v-table2 <v-table
[(rowSelected)]="selected" [(rowSelected)]="selected"
[columns]="columns" [columns]="columns"
[data]="data" [data]="data"
@ -14,4 +14,4 @@
</button> </button>
<ng-content></ng-content> <ng-content></ng-content>
</v-table-actions> </v-table-actions>
</v-table2> </v-table>

View File

@ -14,7 +14,7 @@ import { MatButtonModule } from '@angular/material/button';
import { StatChargeback } from '@vality/magista-proto/magista'; import { StatChargeback } from '@vality/magista-proto/magista';
import { import {
LoadOptions, LoadOptions,
Column2, Column,
TableModule, TableModule,
DialogService, DialogService,
createMenuColumn, createMenuColumn,
@ -24,7 +24,8 @@ import { getUnionKey } from '@vality/ng-thrift';
import startCase from 'lodash-es/startCase'; import startCase from 'lodash-es/startCase';
import { filter } from 'rxjs'; import { filter } from 'rxjs';
import { createCurrencyColumn, createPartyColumn, createShopColumn } from '../../utils/table2'; import { createCurrencyColumn, createPartyColumn, createShopColumn } from '@cc/app/shared';
import { ChangeChargebacksStatusDialogComponent } from '../change-chargebacks-status-dialog'; import { ChangeChargebacksStatusDialogComponent } from '../change-chargebacks-status-dialog';
@Component({ @Component({
@ -44,7 +45,7 @@ export class ChargebacksTableComponent {
@Output() update = new EventEmitter<LoadOptions>(); @Output() update = new EventEmitter<LoadOptions>();
@Output() more = new EventEmitter<void>(); @Output() more = new EventEmitter<void>();
columns: Column2<StatChargeback>[] = [ columns: Column<StatChargeback>[] = [
{ field: 'chargeback_id', header: 'Id' }, { field: 'chargeback_id', header: 'Id' },
{ {
field: 'chargeback_reason', field: 'chargeback_reason',

View File

@ -1,5 +1,4 @@
<v-table2 <v-table
[(sort)]="sort"
[columns]="columns" [columns]="columns"
[data]="shops()" [data]="shops()"
[externalFilter]="filterChange.observed" [externalFilter]="filterChange.observed"
@ -8,4 +7,4 @@
standaloneFilter standaloneFilter
(filterChange)="filterChange.emit($event)" (filterChange)="filterChange.emit($event)"
(update)="update.emit()" (update)="update.emit()"
></v-table2> ></v-table>

View File

@ -10,7 +10,6 @@ import {
} from '@angular/core'; } from '@angular/core';
import { toObservable } from '@angular/core/rxjs-interop'; import { toObservable } from '@angular/core/rxjs-interop';
import { MatCardModule } from '@angular/material/card'; import { MatCardModule } from '@angular/material/card';
import { Sort } from '@angular/material/sort';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { Shop, Party, PartyID, RoutingRulesetRef } from '@vality/domain-proto/domain'; import { Shop, Party, PartyID, RoutingRulesetRef } from '@vality/domain-proto/domain';
import { import {
@ -20,7 +19,7 @@ import {
NotifyLogService, NotifyLogService,
ConfirmDialogComponent, ConfirmDialogComponent,
DialogResponseStatus, DialogResponseStatus,
Column2, Column,
createMenuColumn, createMenuColumn,
} from '@vality/ng-core'; } from '@vality/ng-core';
import { getUnionKey } from '@vality/ng-thrift'; import { getUnionKey } from '@vality/ng-thrift';
@ -30,6 +29,8 @@ import { map, switchMap, combineLatest, of } from 'rxjs';
import { filter, shareReplay, startWith, take, first } from 'rxjs/operators'; import { filter, shareReplay, startWith, take, first } from 'rxjs/operators';
import { MemoizeExpiring } from 'typescript-memoize'; import { MemoizeExpiring } from 'typescript-memoize';
import { createPartyColumn } from '@cc/app/shared';
import { DomainStoreService } from '../../../api/domain-config'; import { DomainStoreService } from '../../../api/domain-config';
import { PartyManagementService } from '../../../api/payment-processing'; import { PartyManagementService } from '../../../api/payment-processing';
import { import {
@ -37,7 +38,6 @@ import {
DelegateWithPaymentInstitution, DelegateWithPaymentInstitution,
} from '../../../sections/routing-rules/party-delegate-rulesets'; } from '../../../sections/routing-rules/party-delegate-rulesets';
import { RoutingRulesType } from '../../../sections/routing-rules/types/routing-rules-type'; import { RoutingRulesType } from '../../../sections/routing-rules/types/routing-rules-type';
import { createPartyColumn } from '../../utils/table2';
import { ShopCardComponent } from '../shop-card/shop-card.component'; import { ShopCardComponent } from '../shop-card/shop-card.component';
import { ShopContractCardComponent } from '../shop-contract-card/shop-contract-card.component'; import { ShopContractCardComponent } from '../shop-contract-card/shop-contract-card.component';
import { SidenavInfoService } from '../sidenav-info'; import { SidenavInfoService } from '../sidenav-info';
@ -76,7 +76,7 @@ export class ShopsTableComponent {
noPartyColumn = input(false, { transform: booleanAttribute }); noPartyColumn = input(false, { transform: booleanAttribute });
columns: Column2<ShopParty>[] = [ columns: Column<ShopParty>[] = [
{ {
field: 'shop.id', field: 'shop.id',
}, },
@ -201,7 +201,6 @@ export class ShopsTableComponent {
), ),
), ),
]; ];
sort: Sort = { active: 'shop.details.name', direction: 'asc' };
constructor( constructor(
private sidenavInfoService: SidenavInfoService, private sidenavInfoService: SidenavInfoService,

View File

@ -1,3 +1,3 @@
<cc-card title="Terminal #{{ terminalId() }} balances"> <cc-card title="Terminal #{{ terminalId() }} balances">
<v-table2 [(sort)]="sort" [columns]="columns" [data]="balances$ | async"></v-table2> <v-table [columns]="columns" [data]="balances$ | async"></v-table>
</cc-card> </cc-card>

View File

@ -1,14 +1,14 @@
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { Component, input } from '@angular/core'; import { Component, input } from '@angular/core';
import { toObservable } from '@angular/core/rxjs-interop'; import { toObservable } from '@angular/core/rxjs-interop';
import { Sort } from '@angular/material/sort'; import { TableModule, Column } from '@vality/ng-core';
import { TableModule, Column2 } from '@vality/ng-core';
import { AccountBalance } from '@vality/scrooge-proto/internal/account_balance'; import { AccountBalance } from '@vality/scrooge-proto/internal/account_balance';
import { combineLatest } from 'rxjs'; import { combineLatest } from 'rxjs';
import { switchMap, shareReplay } from 'rxjs/operators'; import { switchMap, shareReplay } from 'rxjs/operators';
import { createCurrencyColumn } from '@cc/app/shared';
import { AccountBalancesStoreService } from '../../../api/terminal-balance'; import { AccountBalancesStoreService } from '../../../api/terminal-balance';
import { createCurrencyColumn } from '../../utils/table2';
import { CardComponent } from '../sidenav-info/components/card/card.component'; import { CardComponent } from '../sidenav-info/components/card/card.component';
import { DomainThriftViewerComponent } from '../thrift-api-crud'; import { DomainThriftViewerComponent } from '../thrift-api-crud';
@ -21,7 +21,7 @@ import { DomainThriftViewerComponent } from '../thrift-api-crud';
export class TerminalBalancesCardComponent { export class TerminalBalancesCardComponent {
terminalId = input<number>(); terminalId = input<number>();
providerId = input<number>(); providerId = input<number>();
columns: Column2<AccountBalance>[] = [ columns: Column<AccountBalance>[] = [
{ field: 'account_id' }, { field: 'account_id' },
createCurrencyColumn((d) => ({ code: d.balance.currency_code, amount: d.balance.amount }), { createCurrencyColumn((d) => ({ code: d.balance.currency_code, amount: d.balance.amount }), {
header: 'Balance', header: 'Balance',
@ -35,7 +35,6 @@ export class TerminalBalancesCardComponent {
), ),
shareReplay({ refCount: true, bufferSize: 1 }), shareReplay({ refCount: true, bufferSize: 1 }),
); );
sort: Sort = { active: 'account_id', direction: 'asc' };
constructor(private accountBalancesStoreService: AccountBalancesStoreService) {} constructor(private accountBalancesStoreService: AccountBalancesStoreService) {}
} }

View File

@ -7,13 +7,14 @@ import startCase from 'lodash-es/startCase';
import { ReplaySubject, defer, switchMap } from 'rxjs'; import { ReplaySubject, defer, switchMap } from 'rxjs';
import { map, shareReplay } from 'rxjs/operators'; import { map, shareReplay } from 'rxjs/operators';
import { createPartyColumn, createPredicateColumn } from '@cc/app/shared';
import { DomainStoreService } from '../../../api/domain-config'; import { DomainStoreService } from '../../../api/domain-config';
import { PartiesStoreService } from '../../../api/payment-processing'; import { PartiesStoreService } from '../../../api/payment-processing';
import { import {
getTerminalShopWalletDelegates, getTerminalShopWalletDelegates,
TerminalShopWalletDelegate, TerminalShopWalletDelegate,
} from '../../../sections/terminals/utils/get-terminal-shop-wallet-delegates'; } from '../../../sections/terminals/utils/get-terminal-shop-wallet-delegates';
import { createPredicateColumn } from '../../utils';
import { SidenavInfoService } from '../sidenav-info'; import { SidenavInfoService } from '../sidenav-info';
import { CardComponent } from '../sidenav-info/components/card/card.component'; import { CardComponent } from '../sidenav-info/components/card/card.component';
import { DomainThriftViewerComponent, DomainObjectCardComponent } from '../thrift-api-crud'; import { DomainThriftViewerComponent, DomainObjectCardComponent } from '../thrift-api-crud';
@ -32,48 +33,45 @@ export class TerminalDelegatesCardComponent implements OnChanges {
{ {
header: 'Routing Rule', header: 'Routing Rule',
field: 'terminalRule.data.name', field: 'terminalRule.data.name',
description: 'terminalRule.ref.id', cell: (d) => ({
click: (d) => { description: d.terminalRule.ref.id,
click: () => {
this.sidenavInfoService.toggle(DomainObjectCardComponent, { this.sidenavInfoService.toggle(DomainObjectCardComponent, {
ref: { routing_rules: { id: d.terminalRule.ref.id } }, ref: { routing_rules: { id: d.terminalRule.ref.id } },
}); });
}, },
}),
}, },
{ {
header: 'Ruleset', header: 'Ruleset',
field: 'rule.data.name', field: 'rule.data.name',
description: 'rule.ref.id', cell: (d) => ({
click: (d) => { description: d.rule.ref.id,
click: () => {
this.sidenavInfoService.toggle(DomainObjectCardComponent, { this.sidenavInfoService.toggle(DomainObjectCardComponent, {
ref: { routing_rules: { id: d.rule.ref.id } }, ref: { routing_rules: { id: d.rule.ref.id } },
}); });
}, },
}),
}, },
createPredicateColumn('allowed', (d) => d.candidates[0].allowed), createPredicateColumn((d) => ({ predicate: d.candidates[0].allowed }), {
{ header: 'Allowed',
field: 'party', }),
formatter: (d) => createPartyColumn((d) => ({ id: d.delegate.allowed.condition?.party?.id })),
this.partiesStoreService
.get(d.delegate.allowed.condition?.party?.id)
.pipe(map((p) => p.contact_info.registration_email)),
description: (d) => d.delegate.allowed.condition?.party?.id,
link: (d) => `/party/${d.delegate.allowed.condition.party.id}`,
},
{ {
field: 'type', field: 'type',
formatter: (d) => cell: (d) => ({
startCase( value: startCase(
getUnionKey(d.delegate.allowed.condition?.party?.definition).slice(0, -3), getUnionKey(d.delegate.allowed.condition?.party?.definition).slice(0, -3),
), ),
}),
}, },
{ {
field: 'definition', field: 'definition',
formatter: (d) => cell: (d) =>
this.partiesStoreService this.partiesStoreService.get(d.delegate.allowed.condition?.party?.id).pipe(
.get(d.delegate.allowed.condition?.party?.id) map((p) => ({
.pipe( value:
map(
(p) =>
(getUnionKey(d.delegate.allowed.condition?.party?.definition) === (getUnionKey(d.delegate.allowed.condition?.party?.definition) ===
'shop_is' 'shop_is'
? p.shops.get( ? p.shops.get(
@ -86,18 +84,18 @@ export class TerminalDelegatesCardComponent implements OnChanges {
d.delegate.allowed.condition?.party?.definition, d.delegate.allowed.condition?.party?.definition,
), ),
)?.name) ?? )?.name) ??
`#${getUnionValue( `#${getUnionValue(d.delegate.allowed.condition?.party?.definition)}`,
d.delegate.allowed.condition?.party?.definition,
)}`, description: getUnionValue(d.delegate.allowed.condition?.party?.definition),
), link: () =>
),
description: (d) => getUnionValue(d.delegate.allowed.condition?.party?.definition),
link: (d) =>
`/party/${d.delegate.allowed.condition.party.id}/routing-rules/${ `/party/${d.delegate.allowed.condition.party.id}/routing-rules/${
getUnionKey(d.delegate.allowed.condition?.party?.definition) === 'shop_is' getUnionKey(d.delegate.allowed.condition?.party?.definition) ===
'shop_is'
? 'payment' ? 'payment'
: 'withdrawal' : 'withdrawal'
}/${d.rule.ref.id}/delegate/${d.delegate.ruleset.id}`, }/${d.rule.ref.id}/delegate/${d.delegate.ruleset.id}`,
})),
),
}, },
]; ];
terminalObj$ = defer(() => this.ref$).pipe( terminalObj$ = defer(() => this.ref$).pipe(

View File

@ -1,35 +1,18 @@
import { inject } from '@angular/core'; import { inject } from '@angular/core';
import { ContractID, PartyID, ShopID } from '@vality/domain-proto/domain'; import { createColumn } from '@vality/ng-core';
import { Column, PossiblyAsync, getPossiblyAsyncObservable } from '@vality/ng-core';
import { combineLatest } from 'rxjs';
import { take } from 'rxjs/operators';
import { ShopContractCardComponent } from '../../components/shop-contract-card/shop-contract-card.component'; import { ContractCardComponent } from '../../components/contract-card/contract-card.component';
import { SidenavInfoService } from '../../components/sidenav-info'; import { SidenavInfoService } from '../../components/sidenav-info';
export function createContractColumn<T extends object>( export const createContractColumn = createColumn(
selectContractId: (d: T) => PossiblyAsync<ContractID>, ({ id, partyId }: { id: string; partyId: string }) => {
selectPartyId: (d: T) => PossiblyAsync<PartyID>,
selectShopId: (d: T) => PossiblyAsync<ShopID>,
): Column<T> {
const sidenavInfoService = inject(SidenavInfoService); const sidenavInfoService = inject(SidenavInfoService);
return { return {
field: 'contract', value: id,
header: 'Contract', click: () => {
formatter: selectContractId, sidenavInfoService.toggle(ContractCardComponent, { id, partyId });
click: (d) => {
combineLatest([
getPossiblyAsyncObservable(selectPartyId(d)),
getPossiblyAsyncObservable(selectShopId(d)),
])
.pipe(take(1))
.subscribe(([partyId, id]) => {
sidenavInfoService.toggle(ShopContractCardComponent, {
partyId,
id,
});
});
}, },
}; };
} },
{ header: 'Contract' },
);

View File

@ -1,95 +1,71 @@
import { getCurrencySymbol } from '@angular/common';
import { inject, LOCALE_ID } from '@angular/core'; import { inject, LOCALE_ID } from '@angular/core';
import { import { createColumn, formatCurrency } from '@vality/ng-core';
CurrencyColumn, import { groupBy, uniq } from 'lodash-es';
PossiblyAsync, import { of, combineLatest } from 'rxjs';
getPossiblyAsyncObservable, import { map, startWith } from 'rxjs/operators';
Column,
switchCombineWith,
formatCurrency,
} from '@vality/ng-core';
import isNil from 'lodash-es/isNil';
import { combineLatest, switchMap, of, forkJoin, Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { DomainStoreService } from '../../../api/domain-config';
import { AmountCurrencyService } from '../../services'; import { AmountCurrencyService } from '../../services';
export function createCurrencyColumn<T extends object>( interface CurrencyValue {
field: CurrencyColumn<T>['field'], amount: number;
selectAmount: (d: T) => PossiblyAsync<number>, code: string;
selectSymbolicCode: (d: T) => PossiblyAsync<string>,
params: Partial<CurrencyColumn<T>> = {},
): CurrencyColumn<T> {
const amountCurrencyService = inject(AmountCurrencyService);
return {
field,
type: 'currency',
formatter: (d: T) =>
combineLatest([
getPossiblyAsyncObservable(selectAmount(d)),
getPossiblyAsyncObservable(selectSymbolicCode(d)),
]).pipe(
switchMap(([amount, code]) =>
isNil(amount) ? of(undefined) : amountCurrencyService.toMajor(amount, code),
),
),
typeParameters: {
currencyCode: (d: T) => getPossiblyAsyncObservable(selectSymbolicCode(d)),
exponent: (d: T) =>
getPossiblyAsyncObservable(selectSymbolicCode(d)).pipe(
switchMap((code) => amountCurrencyService.getCurrency(code)),
map((c) => c?.exponent),
),
},
...params,
};
} }
export function createCurrenciesColumn<T extends object>( function formatCurrencyValue(value: CurrencyValue) {
field: CurrencyColumn<T>['field'],
selectAmountSymbolicCode: (d: T) => PossiblyAsync<{ amount: number; symbolicCode: string }[]>,
params: Partial<CurrencyColumn<T>> = {},
): Column<T> {
const amountCurrencyService = inject(AmountCurrencyService); const amountCurrencyService = inject(AmountCurrencyService);
const localeId = inject(LOCALE_ID); const locale = inject(LOCALE_ID);
return amountCurrencyService.getCurrency(value.code).pipe(
map((currencyObj) =>
formatCurrency(value.amount, value.code, 'long', locale, currencyObj?.exponent),
),
startWith(
(value.amount === 0 ? '0' : '…') +
' ' +
getCurrencySymbol(value.code, 'narrow', locale),
),
);
}
function getBalancesList(amountCodes$: Observable<{ amount: number; symbolicCode: string }[]>) { function formatCurrencyValues(values: CurrencyValue[], separator = ' | ') {
return amountCodes$.pipe( return combineLatest(values.map(formatCurrencyValue)).pipe(map((v) => v.join(separator)));
switchCombineWith((amountCodes) => }
!amountCodes?.length
? ([] as Observable<number[]>[]) export const createCurrencyColumn = createColumn(
: [ (currencyValue: CurrencyValue | { values: CurrencyValue[]; isSum?: boolean }) => {
forkJoin( const isSum = 'isSum' in currencyValue ? currencyValue.isSum : false;
amountCodes.map((a) => const currencyValues = ('values' in currencyValue ? currencyValue.values : [currencyValue])
amountCurrencyService.toMajor(a.amount, a.symbolicCode), .filter(Boolean)
), .sort((a, b) => b.amount - a.amount);
), if (!currencyValues?.length) {
], return of(undefined);
), }
map(([amountCodes, majorAmounts]) => const currencyValuesByCode = groupBy(currencyValues, 'code');
amountCodes let currencyValuesByCodeList = uniq(currencyValues.map((v) => v.code)).map(
.map((a, idx) => (code) => currencyValuesByCode[code],
formatCurrency( );
majorAmounts[idx], if (isSum) {
a.symbolicCode, currencyValuesByCodeList = currencyValuesByCodeList.map((g) =>
undefined, g.reduce(
localeId, (sum, v) => {
undefined, sum[0].amount += v.amount;
true, return sum;
), },
) [{ code: g[0].code, amount: 0 }],
.join(' / '),
), ),
); );
} }
const domainStoreService = inject(DomainStoreService);
const getAmountCodes = (d: T) => return combineLatest([
getPossiblyAsyncObservable(selectAmountSymbolicCode(d)).pipe( combineLatest(currencyValuesByCodeList.map((g) => formatCurrencyValues(g))),
map((amountCodes) => (amountCodes || []).sort((a, b) => b.amount - a.amount)), domainStoreService.isLoading$,
]).pipe(
map(([currencyValueStrings, inProgress]) => ({
value: currencyValueStrings[0],
description: currencyValueStrings.slice(1).join('; '),
inProgress,
})),
); );
return { },
field, );
formatter: (d: T) => getBalancesList(getAmountCodes(d).pipe(map((a) => a?.slice?.(0, 1)))),
description: (d: T) => getBalancesList(getAmountCodes(d).pipe(map((a) => a?.slice?.(1)))),
...params,
} as Column<T>;
}

View File

@ -1,42 +1,37 @@
import { inject } from '@angular/core'; import { inject } from '@angular/core';
import { Reference } from '@vality/domain-proto/domain'; import { Reference } from '@vality/domain-proto/internal/domain';
import { PossiblyAsync, getPossiblyAsyncObservable, type ColumnObject } from '@vality/ng-core'; import { createColumn } from '@vality/ng-core';
import startCase from 'lodash-es/startCase'; import { getUnionValue, getUnionKey } from '@vality/ng-thrift';
import { map, switchMap, first } from 'rxjs/operators'; import { map, startWith } from 'rxjs/operators';
import { ValuesType } from 'utility-types';
import { DomainStoreService } from '../../../api/domain-config'; import { DomainStoreService } from '../../../api/domain-config';
import { SidenavInfoService } from '../../components/sidenav-info'; import { SidenavInfoService } from '../../components/sidenav-info';
import { import {
getDomainObjectDetails,
DomainObjectCardComponent, DomainObjectCardComponent,
getDomainObjectDetails,
} from '../../components/thrift-api-crud'; } from '../../components/thrift-api-crud';
export function createDomainObjectColumn<T extends object>( export const createDomainObjectColumn = createColumn(({ ref }: { ref: Reference }) => {
objectKey: keyof Reference, const sourceObj = {
selectDomainObjectRef: (d: T) => PossiblyAsync<ValuesType<Reference>>, [getUnionKey(ref)]: { ref: getUnionValue(ref), data: {} },
params: Partial<ColumnObject<T>> = {}, };
): ColumnObject<T> { return inject(DomainStoreService)
const domainStoreService = inject(DomainStoreService); .getObject(ref)
const sidenavInfoService = inject(SidenavInfoService); .pipe(
const getObjectRef = (d: T) => map((obj) => ({
getPossiblyAsyncObservable(selectDomainObjectRef(d)).pipe( value: getDomainObjectDetails(obj).label || '',
map((ref): Reference => ({ [objectKey]: ref })), description: getDomainObjectDetails(obj).id || '',
); click: () => {
const getObject = (d: T) => inject(SidenavInfoService).toggle(DomainObjectCardComponent, { ref });
getObjectRef(d).pipe(switchMap((ref) => domainStoreService.getObject(ref)));
return {
field: `domain_object_${objectKey}`,
header: startCase(objectKey),
description: (d) => getObject(d).pipe(map((o) => getDomainObjectDetails(o)?.id)),
formatter: (d) => getObject(d).pipe(map((o) => getDomainObjectDetails(o)?.label)),
click: (d) => {
getObjectRef(d)
.pipe(first())
.subscribe((ref) => {
sidenavInfoService.toggle(DomainObjectCardComponent, { ref });
});
}, },
...params, })),
} as ColumnObject<T>; startWith({
} value: getDomainObjectDetails(sourceObj).label || '',
description: getDomainObjectDetails(sourceObj).id || '',
click: () => {
inject(SidenavInfoService).toggle(DomainObjectCardComponent, { ref });
},
inProgress: true,
}),
);
});

View File

@ -1,49 +1,32 @@
import { inject } from '@angular/core'; import { inject } from '@angular/core';
import { Router } from '@angular/router'; import { createColumn } from '@vality/ng-core';
import { PossiblyAsync, ColumnObject, getPossiblyAsyncObservable } from '@vality/ng-core';
import get from 'lodash-es/get';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { switchMap, map, take } from 'rxjs/operators'; import { map, startWith } from 'rxjs/operators';
import { PartiesStoreService } from '../../../api/payment-processing'; import { PartiesStoreService } from '../../../api/payment-processing';
export function createPartyColumn<T extends object>( export const createPartyColumn = createColumn(
field: ColumnObject<T>['field'], ({ id, ...params }: { id: string; partyName?: string }) => {
selectPartyId?: (d: T) => PossiblyAsync<string>, const partyName$ =
selectPartyEmail?: (d: T) => PossiblyAsync<string>, 'partyName' in params
params: Partial<ColumnObject<T>> = {}, ? of(params.partyName)
): ColumnObject<T> { : inject(PartiesStoreService)
const partiesStoreService = inject(PartiesStoreService); .get(id)
const router = inject(Router); .pipe(map((party) => party.contact_info.registration_email));
if (!selectPartyId) { const partyCell = {
selectPartyId = (d) => get(d, field); description: id,
} link: () => `/party/${id}`,
if (!selectPartyEmail) { };
selectPartyEmail = (d: T) => return partyName$.pipe(
getPossiblyAsyncObservable(selectPartyId(d)).pipe( map((partyName) => ({
switchMap((partyId) => ...partyCell,
partyId value: partyName,
? partiesStoreService.get(partyId) })),
: of({ contact_info: { registration_email: '' } }), startWith({
), ...partyCell,
map((p) => p.contact_info.registration_email), inProgress: true,
}),
); );
}
return {
field,
header: 'Party',
description: selectPartyId,
formatter: selectPartyEmail,
click: (d) => {
getPossiblyAsyncObservable(selectPartyId(d))
.pipe(
take(1),
map((id) => `/party/${id}`),
)
.subscribe((url) => {
void router.navigate([url]);
});
}, },
...params, { header: 'Party' },
} as ColumnObject<T>; );
}

View File

@ -1,35 +1,18 @@
import { Predicate } from '@vality/domain-proto/domain'; import { Predicate } from '@vality/domain-proto/domain';
import { import { createColumn } from '@vality/ng-core';
ColumnObject,
TagColumn,
PossiblyAsync,
getPossiblyAsyncObservable,
} from '@vality/ng-core';
import { map } from 'rxjs/operators';
import { formatPredicate } from './format-predicate'; import { formatPredicate } from '.';
export function createPredicateColumn<T extends object>( export const createPredicateColumn = createColumn(
field: ColumnObject<T>['field'], ({ predicate }: { predicate: Predicate }) => {
select: (d: T) => PossiblyAsync<Predicate>, const value = formatPredicate(predicate);
params: Partial<ColumnObject<T>> = {},
): TagColumn<T> {
const formatter = (d: T) =>
getPossiblyAsyncObservable(select(d)).pipe(map((predicate) => formatPredicate(predicate)));
return { return {
field, value,
formatter, color: {
type: 'tag', True: 'success',
sortable: true, False: 'warn',
typeParameters: { }[value],
label: formatter, };
tags: {
/* eslint-disable @typescript-eslint/naming-convention */
True: { color: 'success' },
False: { color: 'warn' },
/* eslint-enable @typescript-eslint/naming-convention */
}, },
}, { header: 'Predicate' },
...params, );
} as TagColumn<T>;
}

View File

@ -1,52 +1,37 @@
import { inject } from '@angular/core'; import { inject } from '@angular/core';
import { PossiblyAsync, ColumnObject, getPossiblyAsyncObservable } from '@vality/ng-core'; import { createColumn } from '@vality/ng-core';
import get from 'lodash-es/get'; import { of } from 'rxjs';
import { combineLatest } from 'rxjs'; import { map, startWith } from 'rxjs/operators';
import { map, switchMap, take } from 'rxjs/operators';
import { PartiesStoreService } from '../../../api/payment-processing'; import { PartiesStoreService } from '../../../api/payment-processing';
import { ShopCardComponent } from '../../components/shop-card/shop-card.component'; import { ShopCardComponent } from '../../components/shop-card/shop-card.component';
import { SidenavInfoService } from '../../components/sidenav-info'; import { SidenavInfoService } from '../../components/sidenav-info';
export function createShopColumn<T extends object>( export const createShopColumn = createColumn(
field: ColumnObject<T>['field'], ({ shopId, partyId, ...params }: { shopId: string; partyId: string; shopName?: string }) => {
selectPartyId: (d: T) => PossiblyAsync<string>, const name$ =
selectShopId?: (d: T) => PossiblyAsync<string>, 'shopName' in params
selectShopName?: (d: T) => PossiblyAsync<string>, ? of(params.shopName)
params: Partial<ColumnObject<T>> = {}, : inject(PartiesStoreService)
): ColumnObject<T> { .get(partyId)
if (!selectShopId) { .pipe(map((party) => party.shops.get(shopId).details.name));
selectShopId = (d) => get(d, field);
}
if (!selectShopName) {
const partiesStoreService = inject(PartiesStoreService);
selectShopName = (d) =>
getPossiblyAsyncObservable(selectPartyId(d)).pipe(
switchMap((partyId) =>
combineLatest([
partiesStoreService.get(partyId),
getPossiblyAsyncObservable(selectShopId(d)),
]),
),
map(([party, shopId]) => party.shops.get(shopId).details.name),
);
}
const sidenavInfoService = inject(SidenavInfoService); const sidenavInfoService = inject(SidenavInfoService);
return { const shopCell = {
field, description: shopId,
header: 'Shop', click: () => {
description: (d) => getPossiblyAsyncObservable(selectShopId(d)), sidenavInfoService.toggle(ShopCardComponent, { id: shopId, partyId });
formatter: (d) => getPossiblyAsyncObservable(selectShopName(d)),
click: (d) => {
combineLatest([
getPossiblyAsyncObservable(selectPartyId(d)),
getPossiblyAsyncObservable(selectShopId(d)),
])
.pipe(take(1))
.subscribe(([partyId, id]) => {
sidenavInfoService.toggle(ShopCardComponent, { id, partyId });
});
}, },
...params, };
} as ColumnObject<T>; return name$.pipe(
} map((shopName) => ({
...shopCell,
value: shopName,
})),
startWith({
...shopCell,
inProgress: true,
}),
);
},
{ header: 'Shop' },
);

View File

@ -1,12 +0,0 @@
import { Column, PossiblyAsync, getPossiblyAsyncObservable } from '@vality/ng-core';
import { map } from 'rxjs/operators';
import { createDomainObjectColumn } from './create-domain-object-column';
export function createTerminalColumn<T extends object>(
selectTerminalId: (d: T) => PossiblyAsync<number>,
): Column<T> {
return createDomainObjectColumn('terminal', (d) =>
getPossiblyAsyncObservable(selectTerminalId(d)).pipe(map((id) => ({ id }))),
);
}

View File

@ -1,39 +1,29 @@
import { inject } from '@angular/core'; import { inject } from '@angular/core';
import { PossiblyAsync, ColumnObject, getPossiblyAsyncObservable } from '@vality/ng-core'; import { createColumn } from '@vality/ng-core';
import get from 'lodash-es/get'; import { of } from 'rxjs';
import { combineLatest } from 'rxjs'; import { map, startWith } from 'rxjs/operators';
import { map, switchMap } from 'rxjs/operators';
import { PartiesStoreService } from '../../../api/payment-processing'; import { PartiesStoreService } from '@cc/app/api/payment-processing';
export function createWalletColumn<T extends object>( export const createWalletColumn = createColumn(
field: ColumnObject<T>['field'], ({ id, partyId, ...params }: { id: string; partyId: string; name?: string }) => {
selectPartyId: (d: T) => PossiblyAsync<string>, const name$ =
selectWalletId?: (d: T) => PossiblyAsync<string>, 'name' in params
selectWalletName?: (d: T) => PossiblyAsync<string>, ? of(params.name)
params: Partial<ColumnObject<T>> = {}, : inject(PartiesStoreService)
): ColumnObject<T> { .getWallet(id, partyId)
if (!selectWalletId) { .pipe(map((wallet) => wallet?.name));
selectWalletId = (d) => get(d, field); const cell = { description: id };
} return name$.pipe(
if (!selectWalletName) { map((name) => ({
const partiesStoreService = inject(PartiesStoreService); ...cell,
selectWalletName = (d) => value: name,
getPossiblyAsyncObservable(selectPartyId(d)).pipe( })),
switchMap((partyId) => startWith({
combineLatest([ ...cell,
partiesStoreService.get(partyId), inProgress: true,
getPossiblyAsyncObservable(selectWalletId(d)), }),
]),
),
map(([party, walletId]) => party.wallets.get(walletId)?.name),
); );
} },
return { { header: 'Wallet' },
field, );
header: 'Wallet',
description: (d) => getPossiblyAsyncObservable(selectWalletId(d)),
formatter: (d) => getPossiblyAsyncObservable(selectWalletName(d)),
...params,
} as ColumnObject<T>;
}

View File

@ -1,11 +1,12 @@
export * from './create-currency-column';
export * from './create-party-column';
export * from './create-shop-column';
export * from './create-predicate-column';
export * from './create-failure-column'; export * from './create-failure-column';
export * from './create-contract-column';
export * from './format-cash-volume'; export * from './format-cash-volume';
export * from './format-rational'; export * from './format-rational';
export * from './format-predicate'; export * from './format-predicate';
export * from './create-wallet-column';
export * from './get-cash-volume-parts'; export * from './get-cash-volume-parts';
export * from './create-contract-column';
export * from './create-currency-column';
export * from './create-domain-object-column';
export * from './create-predicate-column';
export * from './create-shop-column';
export * from './create-wallet-column';
export * from './create-party-column';

View File

@ -1,18 +0,0 @@
import { inject } from '@angular/core';
import { createColumn } from '@vality/ng-core';
import { ContractCardComponent } from '../../components/contract-card/contract-card.component';
import { SidenavInfoService } from '../../components/sidenav-info';
export const createContractColumn = createColumn(
({ id, partyId }: { id: string; partyId: string }) => {
const sidenavInfoService = inject(SidenavInfoService);
return {
value: id,
click: () => {
sidenavInfoService.toggle(ContractCardComponent, { id, partyId });
},
};
},
{ header: 'Contract' },
);

View File

@ -1,71 +0,0 @@
import { getCurrencySymbol } from '@angular/common';
import { inject, LOCALE_ID } from '@angular/core';
import { createColumn, formatCurrency } from '@vality/ng-core';
import { groupBy, uniq } from 'lodash-es';
import { of, combineLatest } from 'rxjs';
import { map, startWith } from 'rxjs/operators';
import { DomainStoreService } from '../../../api/domain-config';
import { AmountCurrencyService } from '../../services';
interface CurrencyValue {
amount: number;
code: string;
}
function formatCurrencyValue(value: CurrencyValue) {
const amountCurrencyService = inject(AmountCurrencyService);
const locale = inject(LOCALE_ID);
return amountCurrencyService.getCurrency(value.code).pipe(
map((currencyObj) =>
formatCurrency(value.amount, value.code, 'long', locale, currencyObj?.exponent),
),
startWith(
(value.amount === 0 ? '0' : '…') +
' ' +
getCurrencySymbol(value.code, 'narrow', locale),
),
);
}
function formatCurrencyValues(values: CurrencyValue[], separator = ' | ') {
return combineLatest(values.map(formatCurrencyValue)).pipe(map((v) => v.join(separator)));
}
export const createCurrencyColumn = createColumn(
(currencyValue: CurrencyValue | { values: CurrencyValue[]; isSum?: boolean }) => {
const isSum = 'isSum' in currencyValue ? currencyValue.isSum : false;
const currencyValues = ('values' in currencyValue ? currencyValue.values : [currencyValue])
.filter(Boolean)
.sort((a, b) => b.amount - a.amount);
if (!currencyValues?.length) {
return of(undefined);
}
const currencyValuesByCode = groupBy(currencyValues, 'code');
let currencyValuesByCodeList = uniq(currencyValues.map((v) => v.code)).map(
(code) => currencyValuesByCode[code],
);
if (isSum) {
currencyValuesByCodeList = currencyValuesByCodeList.map((g) =>
g.reduce(
(sum, v) => {
sum[0].amount += v.amount;
return sum;
},
[{ code: g[0].code, amount: 0 }],
),
);
}
const domainStoreService = inject(DomainStoreService);
return combineLatest([
combineLatest(currencyValuesByCodeList.map((g) => formatCurrencyValues(g))),
domainStoreService.isLoading$,
]).pipe(
map(([currencyValueStrings, inProgress]) => ({
value: currencyValueStrings[0],
description: currencyValueStrings.slice(1).join('; '),
inProgress,
})),
);
},
);

View File

@ -1,37 +0,0 @@
import { inject } from '@angular/core';
import { Reference } from '@vality/domain-proto/internal/domain';
import { createColumn } from '@vality/ng-core';
import { getUnionValue, getUnionKey } from '@vality/ng-thrift';
import { map, startWith } from 'rxjs/operators';
import { DomainStoreService } from '../../../api/domain-config';
import { SidenavInfoService } from '../../components/sidenav-info';
import {
DomainObjectCardComponent,
getDomainObjectDetails,
} from '../../components/thrift-api-crud';
export const createDomainObjectColumn = createColumn(({ ref }: { ref: Reference }) => {
const sourceObj = {
[getUnionKey(ref)]: { ref: getUnionValue(ref), data: {} },
};
return inject(DomainStoreService)
.getObject(ref)
.pipe(
map((obj) => ({
value: getDomainObjectDetails(obj).label || '',
description: getDomainObjectDetails(obj).id || '',
click: () => {
inject(SidenavInfoService).toggle(DomainObjectCardComponent, { ref });
},
})),
startWith({
value: getDomainObjectDetails(sourceObj).label || '',
description: getDomainObjectDetails(sourceObj).id || '',
click: () => {
inject(SidenavInfoService).toggle(DomainObjectCardComponent, { ref });
},
inProgress: true,
}),
);
});

View File

@ -1,32 +0,0 @@
import { inject } from '@angular/core';
import { createColumn } from '@vality/ng-core';
import { of } from 'rxjs';
import { map, startWith } from 'rxjs/operators';
import { PartiesStoreService } from '../../../api/payment-processing';
export const createPartyColumn = createColumn(
({ id, ...params }: { id: string; partyName?: string }) => {
const partyName$ =
'partyName' in params
? of(params.partyName)
: inject(PartiesStoreService)
.get(id)
.pipe(map((party) => party.contact_info.registration_email));
const partyCell = {
description: id,
link: () => `/party/${id}`,
};
return partyName$.pipe(
map((partyName) => ({
...partyCell,
value: partyName,
})),
startWith({
...partyCell,
inProgress: true,
}),
);
},
{ header: 'Party' },
);

View File

@ -1,18 +0,0 @@
import { Predicate } from '@vality/domain-proto/domain';
import { createColumn } from '@vality/ng-core';
import { formatPredicate } from '../table';
export const createPredicateColumn = createColumn(
({ predicate }: { predicate: Predicate }) => {
const value = formatPredicate(predicate);
return {
value,
color: {
True: 'success',
False: 'warn',
}[value],
};
},
{ header: 'Predicate' },
);

View File

@ -1,37 +0,0 @@
import { inject } from '@angular/core';
import { createColumn } from '@vality/ng-core';
import { of } from 'rxjs';
import { map, startWith } from 'rxjs/operators';
import { PartiesStoreService } from '../../../api/payment-processing';
import { ShopCardComponent } from '../../components/shop-card/shop-card.component';
import { SidenavInfoService } from '../../components/sidenav-info';
export const createShopColumn = createColumn(
({ shopId, partyId, ...params }: { shopId: string; partyId: string; shopName?: string }) => {
const shopName$ =
'shopName' in params
? of(params.shopName)
: inject(PartiesStoreService)
.get(partyId)
.pipe(map((party) => party.shops.get(shopId).details.name));
const sidenavInfoService = inject(SidenavInfoService);
const shopCell = {
description: shopId,
click: () => {
sidenavInfoService.toggle(ShopCardComponent, { id: shopId, partyId });
},
};
return shopName$.pipe(
map((shopName) => ({
...shopCell,
value: shopName,
})),
startWith({
...shopCell,
inProgress: true,
}),
);
},
{ header: 'Shop' },
);

View File

@ -1,24 +0,0 @@
import { inject } from '@angular/core';
import { createColumn } from '@vality/ng-core';
import { of } from 'rxjs';
import { map } from 'rxjs/operators';
import { PartiesStoreService } from '../../../api/payment-processing';
export const createWalletColumn = createColumn(
({ id, partyId, ...params }: { id: string; partyId: string; name?: string }) => {
const shopName$ =
'name' in params
? of(params.name)
: inject(PartiesStoreService)
.get(partyId)
.pipe(map((party) => party.wallets.get(id).name));
return shopName$.pipe(
map((name) => ({
value: name,
description: id,
})),
);
},
{ header: 'Wallet' },
);

View File

@ -1,7 +0,0 @@
export * from './create-shop-column';
export * from './create-party-column';
export * from './create-wallet-column';
export * from './create-contract-column';
export * from './create-domain-object-column';
export * from './create-currency-column';
export * from './create-predicate-column';

View File

@ -40,7 +40,7 @@
[(rowSelected)]="selectedCsv" [(rowSelected)]="selectedCsv"
[columns]="columns()" [columns]="columns()"
[data]="data$ | async" [data]="data$ | async"
noActions noDownload
rowSelectable rowSelectable
></v-table> ></v-table>
</div> </div>