IMP-169: Add payout tool autocomplete for add modification (#331)

This commit is contained in:
Rinat Arsaev 2024-02-21 12:04:28 +07:00 committed by GitHub
parent 6eb3e675cf
commit cd544282c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 47 additions and 10 deletions

8
package-lock.json generated
View File

@ -25,7 +25,7 @@
"@vality/fistful-proto": "2.0.1-8ecf2b7.0", "@vality/fistful-proto": "2.0.1-8ecf2b7.0",
"@vality/machinegun-proto": "1.0.0", "@vality/machinegun-proto": "1.0.0",
"@vality/magista-proto": "2.0.2-28d11b9.0", "@vality/magista-proto": "2.0.2-28d11b9.0",
"@vality/ng-core": "^17.2.1-pr-57-fa662ca.0", "@vality/ng-core": "^17.2.1-pr-57-0134d85.0",
"@vality/payout-manager-proto": "2.0.1-eb4091a.0", "@vality/payout-manager-proto": "2.0.1-eb4091a.0",
"@vality/repairer-proto": "2.0.2-07b73e9.0", "@vality/repairer-proto": "2.0.2-07b73e9.0",
"@vality/thrift-ts": "2.4.1-8ad5123.0", "@vality/thrift-ts": "2.4.1-8ad5123.0",
@ -6454,9 +6454,9 @@
"integrity": "sha512-BsDy5ejotfTtUlwuoX3kz+PYJ5NSTW6m5ZRGv+p5HaKXSjR7tserPdv0q133Wp4T+sg0ED0Qr9Peqsrn+9XlDQ==" "integrity": "sha512-BsDy5ejotfTtUlwuoX3kz+PYJ5NSTW6m5ZRGv+p5HaKXSjR7tserPdv0q133Wp4T+sg0ED0Qr9Peqsrn+9XlDQ=="
}, },
"node_modules/@vality/ng-core": { "node_modules/@vality/ng-core": {
"version": "17.2.1-pr-57-fa662ca.0", "version": "17.2.1-pr-57-0134d85.0",
"resolved": "https://registry.npmjs.org/@vality/ng-core/-/ng-core-17.2.1-pr-57-fa662ca.0.tgz", "resolved": "https://registry.npmjs.org/@vality/ng-core/-/ng-core-17.2.1-pr-57-0134d85.0.tgz",
"integrity": "sha512-VFqaxeAA2v/zmwfR7lsW9zvtjNz5SlXNNJtQBusT1V38AtoPkGu1J5JaoKQSrWwW2KwXYimaSeLF9tFuUAb4bw==", "integrity": "sha512-0wlLzf2+smFYVYqu/iEptyeKrasRsxWRd2hNwqG+cd0eiIwxNWyBMaI0+FuWS141CtodSgF8Ab8CAG2ceD+vkw==",
"dependencies": { "dependencies": {
"@angular/material-date-fns-adapter": "^17.2.0", "@angular/material-date-fns-adapter": "^17.2.0",
"@ng-matero/extensions": "^17.1.0", "@ng-matero/extensions": "^17.1.0",

View File

@ -33,7 +33,7 @@
"@vality/fistful-proto": "2.0.1-8ecf2b7.0", "@vality/fistful-proto": "2.0.1-8ecf2b7.0",
"@vality/machinegun-proto": "1.0.0", "@vality/machinegun-proto": "1.0.0",
"@vality/magista-proto": "2.0.2-28d11b9.0", "@vality/magista-proto": "2.0.2-28d11b9.0",
"@vality/ng-core": "^17.2.1-pr-57-fa662ca.0", "@vality/ng-core": "^17.2.1-pr-57-0134d85.0",
"@vality/payout-manager-proto": "2.0.1-eb4091a.0", "@vality/payout-manager-proto": "2.0.1-eb4091a.0",
"@vality/repairer-proto": "2.0.2-07b73e9.0", "@vality/repairer-proto": "2.0.2-07b73e9.0",
"@vality/thrift-ts": "2.4.1-8ad5123.0", "@vality/thrift-ts": "2.4.1-8ad5123.0",

View File

@ -1,4 +1,4 @@
import { Claim } from '@vality/domain-proto/claim_management'; import { Claim, PayoutToolModificationUnit } from '@vality/domain-proto/claim_management';
import { Party } from '@vality/domain-proto/domain'; import { Party } from '@vality/domain-proto/domain';
import uniqBy from 'lodash-es/uniqBy'; import uniqBy from 'lodash-es/uniqBy';
import { of } from 'rxjs'; import { of } from 'rxjs';
@ -34,6 +34,20 @@ function createClaimOptions(
); );
} }
function createClaimPayoutToolOptions(
modificationUnits: PayoutToolModificationUnit[],
): MetadataFormExtensionOption[] {
return uniqBy(
modificationUnits.map((unit) => ({
label: 'From claim',
details: unit.modification,
value: unit.payout_tool_id,
color: 'primary',
})),
'value',
);
}
function mergeClaimAndPartyOptions( function mergeClaimAndPartyOptions(
claimOptions: MetadataFormExtensionOption[], claimOptions: MetadataFormExtensionOption[],
partyOptions: MetadataFormExtensionOption[], partyOptions: MetadataFormExtensionOption[],
@ -125,5 +139,22 @@ export function createPartyClaimMetadataFormExtensions(
isIdentifier: true, isIdentifier: true,
}), }),
}, },
{
determinant: (data) => of(isTypeWithAliases(data, 'PayoutToolID', 'domain')),
extension: () =>
of({
options: createClaimPayoutToolOptions(
claim.changeset
.map(
(unit) =>
unit.modification.party_modification?.contract_modification
?.modification?.payout_tool_modification,
)
.filter(Boolean),
),
generate,
isIdentifier: true,
}),
},
]; ];
} }

View File

@ -87,9 +87,15 @@ export class DomainMetadataViewExtensionsService {
return undefined; return undefined;
} }
const [ref, obj] = refObj; const [ref, obj] = refObj;
const details = getDomainObjectDetails(obj);
return { return {
value: getDomainObjectDetails(obj).label, value: details.label,
tooltip: getUnionValue(ref), tooltip: details.description
? {
description: details.description,
ref: getUnionValue(ref),
}
: { ref: getUnionValue(ref) },
click: () => { click: () => {
this.sidenavInfoService.toggle( this.sidenavInfoService.toggle(
import( import(

View File

@ -42,8 +42,8 @@ const GET_DOMAIN_OBJECTS_DETAILS: {
/* eslint-disable @typescript-eslint/naming-convention */ /* eslint-disable @typescript-eslint/naming-convention */
currency: (o) => ({ currency: (o) => ({
id: o.ref.symbolic_code, id: o.ref.symbolic_code,
label: o.data.name, label: o.ref.symbolic_code,
description: `Exponent: ${o.data.exponent}`, description: o.data.name,
}), }),
payment_method: (o) => ({ payment_method: (o) => ({
id: inlineJson(o.ref.id, Infinity), id: inlineJson(o.ref.id, Infinity),