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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/machines/machines.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
></v-autocomplete-field>
<cc-domain-object-field
formControlName="provider_id"
name="provider"
type="provider"
></cc-domain-object-field>
<mat-form-field>
<mat-label>Status</mat-label>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<v-dialog title="Edit Candidate">
<div [formGroup]="form" class="flex flex-col gap-4">
<cc-domain-object-field formControlName="terminal" name="terminal"></cc-domain-object-field>
<cc-domain-object-field formControlName="terminal" type="terminal"></cc-domain-object-field>
<v-input-field formControlName="description" label="Description"></v-input-field>
<div class="flex gap-2">
<v-input-field
Expand Down
4 changes: 2 additions & 2 deletions src/app/withdrawals/withdrawals.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
<cc-domain-object-field
formControlName="terminalId"
label="Terminal"
name="terminal"
type="terminal"
></cc-domain-object-field>
<cc-domain-object-field
formControlName="providerId"
label="Provider"
name="provider"
type="provider"
></cc-domain-object-field>
</ng-template>
</v-filters>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<v-input-field [formField]="shopForm.name" label="Name"></v-input-field>
<v-input-field [formField]="shopForm.description" label="Description"></v-input-field>
<cc-domain-object-field
[formField]="$any(shopForm.termsetId)"
[formField]="shopForm.termsetId"
label="Termset"
name="term_set_hierarchy"
type="term_set_hierarchy"
></cc-domain-object-field>
<cc-account-field [accountsNumber]="2" [formField]="shopForm.account"></cc-account-field>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<v-input-field [formField]="walletForm.name" label="Name"></v-input-field>
<v-input-field [formField]="walletForm.description" label="Description"></v-input-field>
<cc-domain-object-field
[formField]="$any(walletForm.termsetId)"
[formField]="walletForm.termsetId"
label="Termset"
name="term_set_hierarchy"
type="term_set_hierarchy"
></cc-domain-object-field>
<cc-account-field [formField]="walletForm.account"></cc-account-field>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[appearance]="appearance"
[formControl]="control"
[hint]="hint"
[label]="label || (name | titlecase)"
[label]="label || (type | titlecase)"
[multiple]="multiple()"
[options]="options$ | async"
[progress]="!!(progress$ | async)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class DomainObjectFieldComponent<T extends keyof Reference> extends FormC
> {
private fetchDomainObjectsService = inject(FetchDomainObjectsService);

@Input() name: T;
@Input() type: T;
@Input() label: string;
@Input({ transform: booleanAttribute }) required: boolean;
@Input() size?: SelectFieldComponent['size'];
Expand All @@ -63,7 +63,7 @@ export class DomainObjectFieldComponent<T extends keyof Reference> extends FormC

search(search: string) {
this.fetchDomainObjectsService.load(
{ type: DomainObjectType[this.name], query: search },
{ type: DomainObjectType[this.type], query: search },
{ size: 1000 },
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { Router } from '@angular/router';

import { ThriftAstMetadata, metadata$ } from '@vality/domain-proto';
import { PartyConfigRef, Reference, ShopID, base } from '@vality/domain-proto/domain';
import { PartyConfigRef, Reference, base } from '@vality/domain-proto/domain';
import { ThriftData, ThriftViewExtension, isTypeWithAliases } from '@vality/ng-thrift';

import { DomainObjectsStoreService } from '~/api/domain-config';
import { PartiesStoreService } from '~/api/payment-processing';

import { SidenavInfoService } from '../../../../../sidenav-info';
import { DomainObjectCardComponent } from '../../../../domain';

const DOMAIN_OBJECT_ID_TYPE_MAP = { ShopConfigObject: 'ShopID', WalletConfigObject: 'WalletID' };

@Injectable({
providedIn: 'root',
Expand Down Expand Up @@ -49,29 +50,6 @@ export class DomainMetadataViewExtensionsService {
}),
),
},
{
determinant: (data) => of(isTypeWithAliases(data, 'ShopID', 'domain')),
extension: (_, shopId: ShopID) =>
this.partiesStoreService.getShop(shopId).value$.pipe(
map((p) => ({
value: p.data.name,
tooltip: shopId,
click: () => {
this.sidenavInfoService.toggle(DomainObjectCardComponent, {
ref: { shop_config: { id: shopId } },
});
},
})),
startWith({
value: String(shopId),
click: () => {
this.sidenavInfoService.toggle(DomainObjectCardComponent, {
ref: { shop_config: { id: shopId } },
});
},
}),
),
},
{
determinant: (data) => of(isTypeWithAliases(data, 'Timestamp', 'base')),
extension: (_, value: base.Timestamp) =>
Expand Down Expand Up @@ -106,17 +84,21 @@ export class DomainMetadataViewExtensionsService {
f.type as string,
).ast;
const refType = objectFields.find((n) => n.name === 'ref').type as string;
const idType =
DOMAIN_OBJECT_ID_TYPE_MAP[f.type as keyof typeof DOMAIN_OBJECT_ID_TYPE_MAP];
return {
determinant: (data) =>
of(
isTypeWithAliases(data, refType, 'domain') &&
(isTypeWithAliases(data, refType, 'domain') &&
!isTypeWithAliases(
data?.trueParent?.trueParent,
'DomainObject',
'domain',
),
)) ||
(!!idType && isTypeWithAliases(data, idType, 'domain')),
),
extension: (_, refId) => {
extension: (_, refIdOrId) => {
const refId = idType ? { id: refIdOrId } : refIdOrId;
const ref = { [f.name]: refId };
return this.domainObjectsStoreService.getLimitedObject(ref).value$.pipe(
map((obj) => {
Expand Down
Loading