diff --git a/package-lock.json b/package-lock.json index 5c9f6e18..db019b92 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,7 +30,7 @@ "@vality/dominant-cache-proto": "2.0.1-99f38c9.0", "@vality/fistful-proto": "2.0.1-4ff4ea3.0", "@vality/magista-proto": "2.0.1-cf0eff8.0", - "@vality/ng-core": "0.7.1-pr-26-5b97f36.0", + "@vality/ng-core": "15.0.0", "@vality/payout-manager-proto": "2.0.1-b079679.0", "@vality/repairer-proto": "2.0.1-8f7973d.0", "@vality/thrift-ts": "2.4.1-8ad5123.0", @@ -6602,9 +6602,9 @@ "integrity": "sha512-59ncaJpt7tXFLOq9KrDu4OgrDQr9vTQ3j30T0hjN+ZIsPBsE+lld/pGKASWLLQfwvTtvp9laAuKgQGX9GuvIiQ==" }, "node_modules/@vality/ng-core": { - "version": "0.7.1-pr-26-5b97f36.0", - "resolved": "https://registry.npmjs.org/@vality/ng-core/-/ng-core-0.7.1-pr-26-5b97f36.0.tgz", - "integrity": "sha512-d95e80Y6yrPSGmfqVQWmREPEH8TVEDqaobphcroa9a+FHzjexh14+mDh3jxcgYlsuLMI4j1+yBXMDwTqCWXMcw==", + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/@vality/ng-core/-/ng-core-15.0.0.tgz", + "integrity": "sha512-7ux9yH80Bu7QnONFzmY8BSlxCZojvervVuecZdLAhvCo0/W6/NysOjzt3skSsi4S9I0vEtfaJ2kYpFqfqLjuJA==", "dependencies": { "@ng-matero/extensions": "^15.0.0", "@s-libs/js-core": "^15.2.0", @@ -27589,9 +27589,9 @@ "integrity": "sha512-59ncaJpt7tXFLOq9KrDu4OgrDQr9vTQ3j30T0hjN+ZIsPBsE+lld/pGKASWLLQfwvTtvp9laAuKgQGX9GuvIiQ==" }, "@vality/ng-core": { - "version": "0.7.1-pr-26-5b97f36.0", - "resolved": "https://registry.npmjs.org/@vality/ng-core/-/ng-core-0.7.1-pr-26-5b97f36.0.tgz", - "integrity": "sha512-d95e80Y6yrPSGmfqVQWmREPEH8TVEDqaobphcroa9a+FHzjexh14+mDh3jxcgYlsuLMI4j1+yBXMDwTqCWXMcw==", + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/@vality/ng-core/-/ng-core-15.0.0.tgz", + "integrity": "sha512-7ux9yH80Bu7QnONFzmY8BSlxCZojvervVuecZdLAhvCo0/W6/NysOjzt3skSsi4S9I0vEtfaJ2kYpFqfqLjuJA==", "requires": { "@ng-matero/extensions": "^15.0.0", "@s-libs/js-core": "^15.2.0", diff --git a/package.json b/package.json index 3198ade5..1cd65baa 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "@vality/dominant-cache-proto": "2.0.1-99f38c9.0", "@vality/fistful-proto": "2.0.1-4ff4ea3.0", "@vality/magista-proto": "2.0.1-cf0eff8.0", - "@vality/ng-core": "0.7.1-pr-26-5b97f36.0", + "@vality/ng-core": "15.0.0", "@vality/payout-manager-proto": "2.0.1-b079679.0", "@vality/repairer-proto": "2.0.1-8f7973d.0", "@vality/thrift-ts": "2.4.1-8ad5123.0", diff --git a/src/app/api/claim-management/types/claim-status.ts b/src/app/api/claim-management/types/claim-status.ts index f1b64dea..0786280b 100644 --- a/src/app/api/claim-management/types/claim-status.ts +++ b/src/app/api/claim-management/types/claim-status.ts @@ -1,8 +1,8 @@ -import { ClaimStatus as ClaimStatusUnion } from '@vality/domain-proto/claim_management'; +import { ClaimStatus } from '@vality/domain-proto/claim_management'; import { enumerate } from '@cc/utils'; -export const CLAIM_STATUSES = enumerate()( +export const CLAIM_STATUSES = enumerate()( 'pending', 'review', 'pending_acceptance', @@ -10,13 +10,3 @@ export const CLAIM_STATUSES = enumerate()( 'denied', 'revoked' ); - -/** @deprecated use CLAIM_STATUS - it checks for the occurrence of all elements */ -export enum ClaimStatus { - Pending = 'pending', - Review = 'review', - Denied = 'denied', - Revoked = 'revoked', - Accepted = 'accepted', - PendingAcceptance = 'pending_acceptance', -} diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 1b161518..fb9ed666 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -3,12 +3,12 @@ import { KeycloakService } from 'keycloak-angular'; import { AppAuthGuardService } from '@cc/app/shared/services'; +import { ROUTING_CONFIG as CLAIMS_ROUTING_CONFIG } from './sections/claims/routing-config'; import { ROUTING_CONFIG as DEPOSITS_ROUTING_CONFIG } from './sections/deposits/routing-config'; import { ROUTING_CONFIG as DOMAIN_ROUTING_CONFIG } from './sections/domain/routing-config'; import { ROUTING_CONFIG as PAYMENTS_ROUTING_CONFIG } from './sections/payments/routing-config'; import { ROUTING_CONFIG as PAYOUTS_ROUTING_CONFIG } from './sections/payouts/payouts/routing-config'; import { ROUTING_CONFIG as REPAIRING_ROUTING_CONFIG } from './sections/repairing/routing-config'; -import { ROUTING_CONFIG as CLAIMS_ROUTING_CONFIG } from './sections/search-claims/routing-config'; import { ROUTING_CONFIG as PARTIES_ROUTING_CONFIG } from './sections/search-parties/routing-config'; import { ROUTING_CONFIG as SOURCES_ROUTING_CONFIG } from './sections/sources/routing-config'; import { ROUTING_CONFIG as WALLETS_ROUTING_CONFIG } from './sections/wallets/routing-config'; diff --git a/src/app/app.module.ts b/src/app/app.module.ts index b8d27724..9fa69b51 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -28,8 +28,8 @@ import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { CoreModule } from './core/core.module'; import icons from './icons.json'; +import { ClaimsModule } from './sections/claims/claims.module'; import { PayoutsModule } from './sections/payouts'; -import { SearchClaimsModule } from './sections/search-claims/search-claims.module'; import { SearchPartiesModule } from './sections/search-parties/search-parties.module'; import { SectionsModule } from './sections/sections.module'; import { @@ -68,7 +68,7 @@ export let AppInjector: Injector; MatSidenavModule, MatListModule, SearchPartiesModule, - SearchClaimsModule, + ClaimsModule, KeycloakTokenInfoModule, PayoutsModule, SectionsModule, diff --git a/src/app/sections/claim/claim.component.html b/src/app/sections/claim/claim.component.html index a2d7cf39..03a08261 100644 --- a/src/app/sections/claim/claim.component.html +++ b/src/app/sections/claim/claim.component.html @@ -1,20 +1,26 @@ - - + + {{ claim.status | ccUnionKey | keyTitle | titlecase }} -
-
- - Claims / Claim details - - - {{ party.contact_info.email }} (#{{ party.id }}) - -
-

Changeset

@@ -78,6 +84,13 @@ (claimChanged)="reloadClaim()" > + diff --git a/src/app/sections/claim/utils/get-modification-name.ts b/src/app/sections/claim/utils/get-modification-name.ts index 94d637c0..e47aa4fb 100644 --- a/src/app/sections/claim/utils/get-modification-name.ts +++ b/src/app/sections/claim/utils/get-modification-name.ts @@ -1,22 +1,18 @@ import { Modification } from '@vality/domain-proto/claim_management'; +import isObject from 'lodash-es/isObject'; +import { getUnionKey } from '../../../../utils'; import { MODIFICATIONS_NAME_TREE } from './types/modifications-name-tree'; export function getModificationName(modification: Modification) { - let value: unknown = modification; - let name: unknown = MODIFICATIONS_NAME_TREE; - while (value) { - if (typeof value === 'object') { - const key = Object.keys(value).find((k) => Object.keys(name).includes(k)); - value = value[key]; - name = name[key]; - } - if (!name) { - console.error('Unknown modification:', modification); - return 'Unknown Modification'; - } - if (typeof name === 'string') { - return name + ' Modification'; - } + let currentValue: unknown = modification; + let currentName: unknown = MODIFICATIONS_NAME_TREE; + while (isObject(currentName) && isObject(currentValue)) { + const key = Object.keys(currentValue).find((k) => Object.keys(currentName).includes(k)); + currentValue = currentValue?.[key]; + currentName = currentName?.[key]; } + return typeof currentName === 'string' + ? `${currentName} Modification` + : getUnionKey(modification); } diff --git a/src/app/sections/claim/utils/types/modifications-name-tree.ts b/src/app/sections/claim/utils/types/modifications-name-tree.ts index 0393fa3e..9c1fd59c 100644 --- a/src/app/sections/claim/utils/types/modifications-name-tree.ts +++ b/src/app/sections/claim/utils/types/modifications-name-tree.ts @@ -1,85 +1,8 @@ -import { - CashRegisterModificationUnit, - ClaimModification, - CommentModificationUnit, - ContractAdjustmentModificationUnit, - ContractModificationUnit, - ContractorModificationUnit, - DocumentModificationUnit, - FileModificationUnit, - Modification, - PartyModification, - PayoutToolModificationUnit, - ShopModificationUnit, - StatusModificationUnit, - WalletModificationUnit, - WalletModification, - IdentityModification, -} from '@vality/domain-proto/claim_management'; -import { Overwrite } from 'utility-types'; +import { Modification } from '@vality/domain-proto/claim_management'; -type OverwriteAll = U; +type ModificationsNameTree = { [N in keyof T]?: ModificationsNameTree | string }; -type ModificationsName = { - [P in keyof T]-?: string; -}; -type ModificationUnitsName< - T extends { modification: object }, - O extends { [N in keyof T['modification']]?: unknown } = Record -> = { - modification: Overwrite, O>; -}; - -type ModificationsNameTree = OverwriteAll< - Modification, - { - claim_modification: OverwriteAll< - ClaimModification, - { - document_modification: ModificationUnitsName; - file_modification: ModificationUnitsName; - comment_modification: ModificationUnitsName; - status_modification: ModificationUnitsName; - external_info_modification: string; - } - >; - party_modification: OverwriteAll< - PartyModification, - { - contractor_modification: ModificationUnitsName; - contract_modification: ModificationUnitsName< - ContractModificationUnit, - { - adjustment_modification: ModificationUnitsName; - payout_tool_modification: ModificationUnitsName; - } - >; - shop_modification: ModificationUnitsName< - ShopModificationUnit, - { - cash_register_modification_unit: ModificationUnitsName; - } - >; - wallet_modification: ModificationUnitsName; - } - >; - identity_modification: OverwriteAll< - IdentityModification, - { - creation: string; - } - >; - wallet_modification: OverwriteAll< - WalletModification, - { - creation: string; - account_creation: string; - } - >; - } ->; - -export const MODIFICATIONS_NAME_TREE: ModificationsNameTree = { +export const MODIFICATIONS_NAME_TREE: ModificationsNameTree = { claim_modification: { document_modification: { modification: { @@ -154,16 +77,19 @@ export const MODIFICATIONS_NAME_TREE: ModificationsNameTree = { }, wallet_modification: { modification: { - creation: 'Wallet Creation', - account_creation: 'Wallet Account Creation', + creation: 'Old Wallet Creation', + account_creation: 'Old Wallet Account Creation', }, }, }, identity_modification: { - creation: 'Identity Creation', + modification: { + creation: 'Identity Creation', + }, }, wallet_modification: { - creation: 'Wallet Creation', - account_creation: 'Wallet Account Creation', + modification: { + creation: 'Wallet Creation', + }, }, }; diff --git a/src/app/sections/search-claims/search-claims-routing.module.ts b/src/app/sections/claims/claims-routing.module.ts similarity index 74% rename from src/app/sections/search-claims/search-claims-routing.module.ts rename to src/app/sections/claims/claims-routing.module.ts index 4d450555..f9d6e356 100644 --- a/src/app/sections/search-claims/search-claims-routing.module.ts +++ b/src/app/sections/claims/claims-routing.module.ts @@ -3,15 +3,15 @@ import { RouterModule } from '@angular/router'; import { AppAuthGuardService } from '@cc/app/shared/services'; +import { ClaimsComponent } from './claims.component'; import { ROUTING_CONFIG } from './routing-config'; -import { SearchClaimsComponent } from './search-claims.component'; @NgModule({ imports: [ RouterModule.forChild([ { path: 'claims', - component: SearchClaimsComponent, + component: ClaimsComponent, canActivate: [AppAuthGuardService], data: ROUTING_CONFIG, }, @@ -19,4 +19,4 @@ import { SearchClaimsComponent } from './search-claims.component'; ], exports: [RouterModule], }) -export class SearchClaimsComponentRouting {} +export class ClaimsComponentRouting {} diff --git a/src/app/sections/claims/claims-table/claims-table.component.html b/src/app/sections/claims/claims-table/claims-table.component.html new file mode 100644 index 00000000..4247718f --- /dev/null +++ b/src/app/sections/claims/claims-table/claims-table.component.html @@ -0,0 +1,10 @@ + + + diff --git a/src/app/sections/search-claims/search-table/search-table.component.scss b/src/app/sections/claims/claims-table/claims-table.component.scss similarity index 100% rename from src/app/sections/search-claims/search-table/search-table.component.scss rename to src/app/sections/claims/claims-table/claims-table.component.scss diff --git a/src/app/sections/claims/claims-table/claims-table.component.ts b/src/app/sections/claims/claims-table/claims-table.component.ts new file mode 100644 index 00000000..63607909 --- /dev/null +++ b/src/app/sections/claims/claims-table/claims-table.component.ts @@ -0,0 +1,72 @@ +import { Component, Input, Output, EventEmitter } from '@angular/core'; +import { Router } from '@angular/router'; +import { Claim, ClaimStatus } from '@vality/domain-proto/claim_management'; +import { Column, LoadOptions, TagColumn } from '@vality/ng-core'; +import startCase from 'lodash-es/startCase'; +import { map } from 'rxjs/operators'; + +import { getUnionKey } from '../../../../utils'; +import { PartiesStoreService } from '../../../api/payment-processing'; + +@Component({ + selector: 'cc-claims-table', + templateUrl: './claims-table.component.html', + styleUrls: ['./claims-table.component.scss'], +}) +export class ClaimsTableComponent { + @Input() data!: Claim[]; + @Input() isLoading?: boolean | null; + @Input() hasMore?: boolean | null; + + @Output() update = new EventEmitter(); + @Output() more = new EventEmitter(); + + columns: Column[] = [ + { field: 'id', pinned: 'left' }, + { + field: 'party', + description: 'party_id', + formatter: (claim) => + this.partiesStoreService.get(claim.party_id).pipe(map((p) => p.contact_info.email)), + }, + { + field: 'status', + type: 'tag', + formatter: (claim) => getUnionKey(claim.status), + typeParameters: { + label: (claim) => startCase(getUnionKey(claim.status)), + tags: { + pending: { color: 'pending' }, + review: { color: 'pending' }, + pending_acceptance: { color: 'pending' }, + accepted: { color: 'success' }, + denied: { color: 'warn' }, + }, + }, + } as TagColumn, + 'revision', + { field: 'created_at', type: 'datetime' }, + { field: 'updated_at', type: 'datetime' }, + { + field: 'operation', + header: '', + type: 'menu', + pinned: 'right', + width: '0', + typeParameters: { + items: [ + { + label: 'Details', + click: (claim) => this.navigateToClaim(claim.party_id, claim.id), + }, + ], + }, + }, + ]; + + constructor(private router: Router, private partiesStoreService: PartiesStoreService) {} + + navigateToClaim(partyId: string, claimID: number) { + void this.router.navigate([`/party/${partyId}/claim/${claimID}`]); + } +} diff --git a/src/app/sections/claims/claims.component.html b/src/app/sections/claims/claims.component.html new file mode 100644 index 00000000..c76e7c95 --- /dev/null +++ b/src/app/sections/claims/claims.component.html @@ -0,0 +1,35 @@ + + + + + + + + + + {{ + status | keyTitle | titlecase + }} + + + + + + + + + diff --git a/src/app/sections/claims/claims.component.ts b/src/app/sections/claims/claims.component.ts new file mode 100644 index 00000000..2297046c --- /dev/null +++ b/src/app/sections/claims/claims.component.ts @@ -0,0 +1,64 @@ +import { Component, OnInit } from '@angular/core'; +import { NonNullableFormBuilder } from '@angular/forms'; +import { untilDestroyed, UntilDestroy } from '@ngneat/until-destroy'; +import { PartyID } from '@vality/domain-proto/domain'; +import { DialogService, LoadOptions, QueryParamsService, clean } from '@vality/ng-core'; +import { debounceTime } from 'rxjs'; +import { startWith } from 'rxjs/operators'; + +import { CLAIM_STATUSES } from '../../api/claim-management'; +import { CreateClaimDialogComponent } from './components/create-claim-dialog/create-claim-dialog.component'; +import { FetchClaimsService } from './fetch-claims.service'; + +@UntilDestroy() +@Component({ + templateUrl: './claims.component.html', +}) +export class ClaimsComponent implements OnInit { + isLoading$ = this.fetchClaimsService.isLoading$; + claims$ = this.fetchClaimsService.result$; + hasMore$ = this.fetchClaimsService.hasMore$; + claimStatuses = CLAIM_STATUSES; + filtersForm = this.fb.group({ + party_id: undefined as string, + claim_id: undefined as number, + statuses: [[] as string[]], + }); + active = 0; + + private selectedPartyId: PartyID; + + constructor( + private fetchClaimsService: FetchClaimsService, + private dialogService: DialogService, + private fb: NonNullableFormBuilder, + private qp: QueryParamsService + ) {} + + ngOnInit(): void { + this.filtersForm.patchValue(this.qp.params); + this.filtersForm.valueChanges + .pipe(startWith(null), debounceTime(500), untilDestroyed(this)) + .subscribe(() => { + this.load(); + }); + } + + load(options?: LoadOptions): void { + const filters = clean(this.filtersForm.value); + void this.qp.set(filters); + this.fetchClaimsService.load( + { ...filters, statuses: filters.statuses?.map((status) => ({ [status]: {} })) || [] }, + options + ); + this.active = Object.keys(filters).length; + } + + more(): void { + this.fetchClaimsService.more(); + } + + create() { + this.dialogService.open(CreateClaimDialogComponent, { partyId: this.selectedPartyId }); + } +} diff --git a/src/app/sections/search-claims/search-claims.module.ts b/src/app/sections/claims/claims.module.ts similarity index 69% rename from src/app/sections/search-claims/search-claims.module.ts rename to src/app/sections/claims/claims.module.ts index cb086cbd..cd7a1f99 100644 --- a/src/app/sections/search-claims/search-claims.module.ts +++ b/src/app/sections/claims/claims.module.ts @@ -14,25 +14,22 @@ import { MatProgressBarModule } from '@angular/material/progress-bar'; import { MatSelectModule } from '@angular/material/select'; import { MatSnackBarModule } from '@angular/material/snack-bar'; import { MatTableModule } from '@angular/material/table'; -import { ActionsModule, DialogModule } from '@vality/ng-core'; +import { ActionsModule, DialogModule, TableModule, FiltersModule } from '@vality/ng-core'; -import { ClaimSearchFormModule, PageLayoutModule } from '@cc/app/shared/components'; +import { PageLayoutModule } from '@cc/app/shared/components'; import { MerchantFieldModule } from '@cc/app/shared/components/merchant-field'; import { ApiModelPipesModule, ThriftPipesModule } from '@cc/app/shared/pipes'; import { EmptySearchResultModule } from '@cc/components/empty-search-result'; -import { TableModule } from '@cc/components/table'; +import { ClaimsComponentRouting } from './claims-routing.module'; +import { ClaimsTableComponent } from './claims-table/claims-table.component'; +import { ClaimsComponent } from './claims.component'; import { CreateClaimDialogComponent } from './components/create-claim-dialog/create-claim-dialog.component'; -import { SearchClaimsComponentRouting } from './search-claims-routing.module'; -import { SearchClaimsComponent } from './search-claims.component'; -import { SearchClaimsService } from './search-claims.service'; -import { ClaimMailPipePipe } from './search-table/claim-mail-pipe.pipe'; -import { SearchTableComponent } from './search-table/search-table.component'; @NgModule({ imports: [ CommonModule, - SearchClaimsComponentRouting, + ClaimsComponentRouting, MatButtonModule, MatCardModule, MatDialogModule, @@ -47,7 +44,6 @@ import { SearchTableComponent } from './search-table/search-table.component'; ReactiveFormsModule, FlexLayoutModule, MatExpansionModule, - ClaimSearchFormModule, EmptySearchResultModule, ApiModelPipesModule, ThriftPipesModule, @@ -56,13 +52,9 @@ import { SearchTableComponent } from './search-table/search-table.component'; DialogModule, MerchantFieldModule, PageLayoutModule, + TableModule, + FiltersModule, ], - declarations: [ - SearchClaimsComponent, - SearchTableComponent, - ClaimMailPipePipe, - CreateClaimDialogComponent, - ], - providers: [SearchClaimsService], + declarations: [ClaimsComponent, ClaimsTableComponent, CreateClaimDialogComponent], }) -export class SearchClaimsModule {} +export class ClaimsModule {} diff --git a/src/app/sections/search-claims/components/create-claim-dialog/create-claim-dialog.component.html b/src/app/sections/claims/components/create-claim-dialog/create-claim-dialog.component.html similarity index 100% rename from src/app/sections/search-claims/components/create-claim-dialog/create-claim-dialog.component.html rename to src/app/sections/claims/components/create-claim-dialog/create-claim-dialog.component.html diff --git a/src/app/sections/search-claims/components/create-claim-dialog/create-claim-dialog.component.ts b/src/app/sections/claims/components/create-claim-dialog/create-claim-dialog.component.ts similarity index 100% rename from src/app/sections/search-claims/components/create-claim-dialog/create-claim-dialog.component.ts rename to src/app/sections/claims/components/create-claim-dialog/create-claim-dialog.component.ts diff --git a/src/app/sections/search-claims/search-claims.service.ts b/src/app/sections/claims/fetch-claims.service.ts similarity index 52% rename from src/app/sections/search-claims/search-claims.service.ts rename to src/app/sections/claims/fetch-claims.service.ts index 434a4408..809c93cc 100644 --- a/src/app/sections/search-claims/search-claims.service.ts +++ b/src/app/sections/claims/fetch-claims.service.ts @@ -1,37 +1,42 @@ import { Injectable } from '@angular/core'; import { Claim, ClaimSearchQuery } from '@vality/domain-proto/claim_management'; -import { Observable } from 'rxjs'; -import { map } from 'rxjs/operators'; +import { FetchSuperclass, FetchResult, FetchOptions, NotifyLogService } from '@vality/ng-core'; +import { Observable, of } from 'rxjs'; +import { map, catchError } from 'rxjs/operators'; import { ClaimManagementService } from '@cc/app/api/claim-management'; -import { FetchResult, PartialFetcher } from '@cc/app/shared/services'; -@Injectable() -export class SearchClaimsService extends PartialFetcher< +@Injectable({ providedIn: 'root' }) +export class FetchClaimsService extends FetchSuperclass< Claim, Omit > { - private readonly searchLimit = 10; - - constructor(private claimManagementService: ClaimManagementService) { + constructor( + private claimManagementService: ClaimManagementService, + private log: NotifyLogService + ) { super(); } protected fetch( params: Omit, - continuationToken: string + { size, continuationToken }: FetchOptions ): Observable> { return this.claimManagementService .SearchClaims({ ...params, continuation_token: continuationToken, - limit: this.searchLimit, - } as ClaimSearchQuery) + limit: size, + }) .pipe( map((r) => ({ result: r.result, continuationToken: r.continuation_token, - })) + })), + catchError((err) => { + this.log.errorOperation(err, 'receive', 'claims'); + return of({ result: [] }); + }) ); } } diff --git a/src/app/sections/search-claims/routing-config.ts b/src/app/sections/claims/routing-config.ts similarity index 100% rename from src/app/sections/search-claims/routing-config.ts rename to src/app/sections/claims/routing-config.ts diff --git a/src/app/sections/payments/components/payments-table/payments-table.component.ts b/src/app/sections/payments/components/payments-table/payments-table.component.ts index b3a36b89..4e01573f 100644 --- a/src/app/sections/payments/components/payments-table/payments-table.component.ts +++ b/src/app/sections/payments/components/payments-table/payments-table.component.ts @@ -48,14 +48,13 @@ export class PaymentsTableComponent { { field: 'status', type: 'tag', - formatter: (data) => startCase(getUnionKey(data.status)), + formatter: (data) => getUnionKey(data.status), typeParameters: { - value: (data) => getUnionKey(data.status), + label: (data) => startCase(getUnionKey(data.status)), tags: { pending: { color: 'pending' }, processed: { color: 'pending' }, captured: { color: 'success' }, - cancelled: {}, refunded: { color: 'success' }, failed: { color: 'warn' }, charged_back: { color: 'success' }, @@ -86,7 +85,7 @@ export class PaymentsTableComponent { field: 'menu', header: '', pinned: 'right', - maxWidth: 0, + width: '0', type: 'menu', typeParameters: { items: [ diff --git a/src/app/sections/search-claims/search-claims.component.html b/src/app/sections/search-claims/search-claims.component.html deleted file mode 100644 index 3e491c76..00000000 --- a/src/app/sections/search-claims/search-claims.component.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/src/app/sections/search-claims/search-claims.component.ts b/src/app/sections/search-claims/search-claims.component.ts deleted file mode 100644 index 47312be6..00000000 --- a/src/app/sections/search-claims/search-claims.component.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { MatSnackBar } from '@angular/material/snack-bar'; -import { PartyID } from '@vality/domain-proto/domain'; -import { DialogService, cleanPrimitiveProps, clean } from '@vality/ng-core'; - -import { ClaimSearchForm } from '@cc/app/shared/components'; - -import { CreateClaimDialogComponent } from './components/create-claim-dialog/create-claim-dialog.component'; -import { SearchClaimsService } from './search-claims.service'; - -@Component({ - templateUrl: './search-claims.component.html', -}) -export class SearchClaimsComponent implements OnInit { - doAction$ = this.searchClaimService.doAction$; - claims$ = this.searchClaimService.searchResult$; - hasMore$ = this.searchClaimService.hasMore$; - private selectedPartyId: PartyID; - - constructor( - private searchClaimService: SearchClaimsService, - private snackBar: MatSnackBar, - private dialogService: DialogService - ) {} - - ngOnInit(): void { - this.searchClaimService.errors$.subscribe((e) => - this.snackBar.open(`An error occurred while search claims (${String(e)})`, 'OK') - ); - } - - search(v: ClaimSearchForm): void { - this.selectedPartyId = v?.party_id; - this.searchClaimService.search( - cleanPrimitiveProps({ ...v, statuses: clean(v.statuses?.map((s) => ({ [s]: {} }))) }) - ); - } - - fetchMore(): void { - this.searchClaimService.fetchMore(); - } - - create() { - this.dialogService.open(CreateClaimDialogComponent, { partyId: this.selectedPartyId }); - } -} diff --git a/src/app/sections/search-claims/search-table/claim-mail-pipe.pipe.ts b/src/app/sections/search-claims/search-table/claim-mail-pipe.pipe.ts deleted file mode 100644 index 5aa9ef45..00000000 --- a/src/app/sections/search-claims/search-table/claim-mail-pipe.pipe.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Pipe, PipeTransform } from '@angular/core'; -import { Claim } from '@vality/domain-proto/claim_management'; - -@Pipe({ - name: 'ccClaimMail', -}) -export class ClaimMailPipePipe implements PipeTransform { - transform(value: Claim): string { - let res = 'Unknown'; - - const changeSet = value.changeset; - if (changeSet.length > 0) { - const modificationUnit = changeSet[0]; - res = modificationUnit.user_info.email; - } - - return res; - } -} diff --git a/src/app/sections/search-claims/search-table/search-table.component.html b/src/app/sections/search-claims/search-table/search-table.component.html deleted file mode 100644 index 024ee87c..00000000 --- a/src/app/sections/search-claims/search-table/search-table.component.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Claim ID{{ claim.id }}Party -
{{ claim | ccClaimMail }}
-
{{ claim.party_id }}
-
Status - {{ claim.status | ccClaimStatusThrift | ccClaimStatus }} - Revision - {{ claim.revision }} - Updated At - {{ claim.updated_at | date : 'dd.MM.yyyy HH:mm:ss' }} - Created At - {{ claim.created_at | date : 'dd.MM.yyyy HH:mm:ss' }} - - - - - -
diff --git a/src/app/sections/search-claims/search-table/search-table.component.ts b/src/app/sections/search-claims/search-table/search-table.component.ts deleted file mode 100644 index 684ffbf8..00000000 --- a/src/app/sections/search-claims/search-table/search-table.component.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Component, Input } from '@angular/core'; -import { Router } from '@angular/router'; -import { Claim } from '@vality/domain-proto/claim_management'; - -@Component({ - selector: 'cc-search-table', - templateUrl: './search-table.component.html', - styleUrls: ['./search-table.component.scss'], -}) -export class SearchTableComponent { - @Input() - claims: Claim[]; - - displayedColumns = [ - 'claimID', - 'party', - 'status', - 'revision', - 'updatedAt', - 'createdAt', - 'actions', - ]; - - constructor(private router: Router) {} - - navigateToClaim(partyId: string, claimID: number) { - void this.router.navigate([`/party/${partyId}/claim/${claimID}`]); - } -} diff --git a/src/app/sections/sources/create-source/create-source.component.html b/src/app/sections/sources/create-source/create-source.component.html index c7b59f1b..a92d7aae 100644 --- a/src/app/sections/sources/create-source/create-source.component.html +++ b/src/app/sections/sources/create-source/create-source.component.html @@ -1,10 +1,9 @@ - + >
{{ title }} {{ description }} @@ -15,6 +17,22 @@
+
+ +
+ {{ pathPart.label }} + {{ pathPart.label }} +
+
/
+
+
diff --git a/src/app/shared/components/page-layout/page-layout.component.ts b/src/app/shared/components/page-layout/page-layout.component.ts index 39f0a85e..35da8f9e 100644 --- a/src/app/shared/components/page-layout/page-layout.component.ts +++ b/src/app/shared/components/page-layout/page-layout.component.ts @@ -1,5 +1,6 @@ import { Location } from '@angular/common'; import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; +import { Params } from '@angular/router'; @Component({ selector: 'cc-page-layout', @@ -11,9 +12,16 @@ export class PageLayoutComponent { @Input() title!: string; @Input() description?: string; @Input() progress?: boolean; + @Input() path?: { + label: string; + link?: unknown[] | string | null | undefined; + queryParams?: Params | null; + tooltip?: string; + }[]; // 1 and 2 is default history length - isBackAvailable = window.history.length > 2; + isBackAvailable = + window.history.length > 2 && window.location.pathname.split('/').slice(1).length > 1; constructor(private location: Location) {} diff --git a/src/app/shared/components/page-layout/page-layout.module.ts b/src/app/shared/components/page-layout/page-layout.module.ts index 18fdeb29..ce26b962 100644 --- a/src/app/shared/components/page-layout/page-layout.module.ts +++ b/src/app/shared/components/page-layout/page-layout.module.ts @@ -1,14 +1,26 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { FlexModule } from '@angular/flex-layout'; +import { FlexModule, GridModule } from '@angular/flex-layout'; +import { MatButtonModule } from '@angular/material/button'; import { MatIconModule } from '@angular/material/icon'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; +import { MatTooltipModule } from '@angular/material/tooltip'; +import { RouterLink } from '@angular/router'; import { PageLayoutActionsComponent } from './components/page-layout-actions/page-layout-actions.component'; import { PageLayoutComponent } from './page-layout.component'; @NgModule({ - imports: [CommonModule, FlexModule, MatIconModule, MatProgressSpinnerModule], + imports: [ + CommonModule, + FlexModule, + MatIconModule, + MatProgressSpinnerModule, + GridModule, + RouterLink, + MatButtonModule, + MatTooltipModule, + ], declarations: [PageLayoutComponent, PageLayoutActionsComponent], exports: [PageLayoutComponent, PageLayoutActionsComponent], }) diff --git a/src/app/shared/pipes/thrift/claim-status-thrift.pipe.ts b/src/app/shared/pipes/thrift/claim-status-thrift.pipe.ts deleted file mode 100644 index d0396f5e..00000000 --- a/src/app/shared/pipes/thrift/claim-status-thrift.pipe.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Pipe, PipeTransform } from '@angular/core'; -import { ClaimStatus as UnionClaimStatus } from '@vality/domain-proto/claim_management'; - -import { extractClaimStatus } from '../../utils'; - -@Pipe({ - name: 'ccClaimStatusThrift', -}) -export class ClaimStatusThriftPipe implements PipeTransform { - transform(value: UnionClaimStatus): string { - return extractClaimStatus(value); - } -} diff --git a/src/app/shared/pipes/thrift/thrift-pipes.module.ts b/src/app/shared/pipes/thrift/thrift-pipes.module.ts index fb61434f..13d29c11 100644 --- a/src/app/shared/pipes/thrift/thrift-pipes.module.ts +++ b/src/app/shared/pipes/thrift/thrift-pipes.module.ts @@ -1,6 +1,5 @@ import { NgModule } from '@angular/core'; -import { ClaimStatusThriftPipe } from './claim-status-thrift.pipe'; import { KeyTitlePipe } from './key-title.pipe'; import { MapUnionPipe } from './map-union.pipe'; import { ThriftInt64Pipe } from './thrift-int64.pipe'; @@ -9,7 +8,6 @@ import { UnionKeyPipe } from './union-key.pipe'; import { UnionValuePipe } from './union-value.pipe'; const PIPES = [ - ClaimStatusThriftPipe, MapUnionPipe, ThriftInt64Pipe, ThriftViewPipe, diff --git a/src/app/shared/utils/extract-claim-status.ts b/src/app/shared/utils/extract-claim-status.ts deleted file mode 100644 index 7744d84b..00000000 --- a/src/app/shared/utils/extract-claim-status.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { ClaimStatus as UnionClaimStatus } from '@vality/domain-proto/claim_management'; - -import { ClaimStatus } from '@cc/app/api/claim-management'; -import { getUnionKey } from '@cc/utils/get-union-key'; - -export const CLAIM_STATUS_BY_UNION_CLAIM_STATUS: { - [name in keyof UnionClaimStatus]-?: ClaimStatus; -} = { - accepted: ClaimStatus.Accepted, - denied: ClaimStatus.Denied, - revoked: ClaimStatus.Revoked, - pending: ClaimStatus.Pending, - review: ClaimStatus.Review, - pending_acceptance: ClaimStatus.PendingAcceptance, -}; - -export const extractClaimStatus = (status: UnionClaimStatus): ClaimStatus => - CLAIM_STATUS_BY_UNION_CLAIM_STATUS[getUnionKey(status)]; diff --git a/src/app/shared/utils/index.ts b/src/app/shared/utils/index.ts index c73d0f87..9c2b63bd 100644 --- a/src/app/shared/utils/index.ts +++ b/src/app/shared/utils/index.ts @@ -1,4 +1,3 @@ -export * from './extract-claim-status'; export * from './component-changes'; export * from './polling-conditions'; export * from './deposit-status'; diff --git a/src/app/styles/styles.scss b/src/app/styles/styles.scss index 93bdeb26..0af1221a 100644 --- a/src/app/styles/styles.scss +++ b/src/app/styles/styles.scss @@ -1,16 +1,12 @@ -@use '@angular/material' as mat; @use '@vality/ng-core' as v; @import './all-component-themes'; -@include v.core(); - $app-theme: v.create-light-theme(); +@include v.core(); @include v.all-component-themes($app-theme); @include all-component-themes($app-theme); - @include v.typography-hierarchy($app-theme); - @include v.app($app-theme); .cc-code {