Delete unused modules (#23)

This commit is contained in:
Ildar Galeev 2022-01-27 17:49:34 +03:00 committed by GitHub
parent 8f94bea873
commit f19afb0044
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
344 changed files with 111 additions and 10597 deletions

1588
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@
"start": "ng serve --proxy-config proxy.conf.js --port 4200",
"build": "ng build --extra-webpack-config webpack.extra.js",
"test": "ng test",
"lint-cmd": "eslint \"src/**/*.{ts,js,html}\" --max-warnings 1596",
"lint-cmd": "eslint \"src/**/*.{ts,js,html}\" --max-warnings 1307",
"lint-cache-cmd": "npm run lint-cmd -- --cache",
"lint": "npm run lint-cache-cmd",
"lint-fix": "npm run lint-cache-cmd -- --fix",
@ -55,7 +55,6 @@
"moment": "~2.22.2",
"monaco-editor": "^0.21.2",
"ngx-mat-select-search": "^4.0.0",
"pdfmake": "^0.1.64",
"rxjs": "^6.6.3",
"short-uuid": "^4.1.0",
"transliteration": "^2.1.8",
@ -80,11 +79,9 @@
"@types/jwt-decode": "~2.2.1",
"@types/lodash-es": "~4.17.3",
"@types/node": "^16.4.12",
"@types/pdfmake": "^0.1.9",
"@types/uuid": "~3.4.3",
"@typescript-eslint/eslint-plugin": "^5.8.0",
"@typescript-eslint/parser": "~5.8.0",
"ank-proto": "github:valitydev/ank-proto#d638e44eb8632fd62f0d6730294e51637babcc78",
"chalk": "^4.1.0",
"concurrently": "^6.5.1",
"damsel": "github:valitydev/damsel#827f692653e8110b0280a4608ff540d2662842ce",
@ -114,9 +111,8 @@
"messages-proto": "github:valitydev/messages-proto#a177efb574136961bcd0a8236b4bfc425264de29",
"ngx-build-plus": "^13.0.1",
"prettier": "~2.0.4",
"skipper-proto": "github:valitydev/skipper-proto#d33d87cd9080925861f755b11ee1f16378076f74",
"ts-mockito": "^2.6.1",
"ts-node": "~8.8.2",
"typescript": "~4.5.4"
}
}
}

View File

@ -41,12 +41,6 @@ export class AppComponent implements OnInit {
const menuItems = [
{ name: 'Domain config', route: '/domain', activateRoles: [DomainConfigRole.Checkout] },
{ name: 'Payouts', route: '/payouts', activateRoles: [PayoutRole.Read] },
// FR-688
// {
// name: 'Claims-Deprecated',
// route: '/claims-deprecated',
// activateRoles: [ClaimManagementRole.GetClaims],
// },
{ name: 'Claims', route: '/claims', activateRoles: [ClaimManagementRole.GetClaims] },
{
name: 'Payment adjustment',

View File

@ -20,9 +20,7 @@ import 'moment/locale/ru';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { ClaimMgtModule } from './claim-mgt/claim-mgt.module';
import { ClaimModule } from './claim/claim.module';
import { ClaimsModule } from './claims/claims.module';
import { CoreModule } from './core/core.module';
import { DomainModule } from './domain';
import icons from './icons.json';
@ -64,7 +62,6 @@ moment.locale('en');
MatMenuModule,
MatSidenavModule,
MatListModule,
ClaimsModule,
ClaimModule,
PayoutsModule,
PaymentAdjustmentModule,
@ -72,7 +69,6 @@ moment.locale('en');
RepairingModule,
ThemeManagerModule,
SettingsModule,
ClaimMgtModule,
PartyModule,
SearchPartiesModule,
SearchClaimsModule,

View File

@ -1,21 +0,0 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { AppAuthGuardService, ClaimManagementRole } from '@cc/app/shared/services';
@NgModule({
imports: [
RouterModule.forChild([
{
path: 'claim-mgt/party',
loadChildren: () => import('./claim').then((m) => m.ClaimModule),
canActivate: [AppAuthGuardService],
data: {
roles: [ClaimManagementRole.GetClaims],
},
},
]),
],
exports: [RouterModule],
})
export class ClaimMgtRouting {}

View File

@ -1,11 +0,0 @@
import { NgModule } from '@angular/core';
import { ClaimMgtRouting } from './claim-mgt-routing.module';
/**
* @deprecated FR-688
*/
@NgModule({
imports: [ClaimMgtRouting],
})
export class ClaimMgtModule {}

View File

@ -1,23 +0,0 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { AppAuthGuardService, ClaimManagementRole } from '@cc/app/shared/services';
import { ClaimComponent } from './claim.component';
@NgModule({
imports: [
RouterModule.forChild([
{
path: ':party_id/claim/:claim_id',
component: ClaimComponent,
canActivate: [AppAuthGuardService],
data: {
roles: [ClaimManagementRole.GetClaims],
},
},
]),
],
exports: [RouterModule],
})
export class ClaimRoutingModule {}

View File

@ -1,10 +0,0 @@
export enum ClaimStatuses {
/* eslint-disable @typescript-eslint/naming-convention */
pending = 'pending',
review = 'review',
pending_acceptance = 'pending_acceptance',
accepted = 'accepted',
denied = 'denied',
revoked = 'revoked',
/* eslint-enable @typescript-eslint/naming-convention */
}

View File

@ -1,8 +0,0 @@
<div class="container" fxLayout="column" fxLayoutGap="20px" *ngIf="claim$ | async as claim">
<h1 class="mat-headline">Claim #{{ claim.id }}</h1>
<cc-claim-details [claim]="claim"></cc-claim-details>
<cc-claim-conversation
[claim]="claim"
(conversationChangedEvent)="conversationChanged()"
></cc-claim-conversation>
</div>

View File

@ -1,5 +0,0 @@
.container {
padding: 20px 0 20px 0;
max-width: 890px;
margin: 0 auto;
}

View File

@ -1,33 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import Int64 from '@vality/thrift-ts/lib/int64';
import { ClaimManagementService } from '../../thrift-services/damsel/claim-management.service';
import { ClaimService } from './claim.service';
import { RecreateClaimService } from './recreate-claim';
@Component({
templateUrl: 'claim.component.html',
styleUrls: ['claim.component.scss'],
providers: [ClaimManagementService, ClaimService, RecreateClaimService],
})
export class ClaimComponent implements OnInit {
claim$ = this.claimService.claim$;
constructor(private route: ActivatedRoute, private claimService: ClaimService) {}
ngOnInit() {
this.getClaim();
}
conversationChanged() {
this.getClaim();
}
private getClaim() {
this.route.params.subscribe((params) => {
const { party_id, claim_id } = params;
this.claimService.getClaim(party_id, new Int64(Number(claim_id)));
});
}
}

View File

@ -1,50 +0,0 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FlexModule } from '@angular/flex-layout';
import { ReactiveFormsModule } from '@angular/forms';
import { MatBottomSheetModule } from '@angular/material/bottom-sheet';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatDialogModule } from '@angular/material/dialog';
import { MatInputModule } from '@angular/material/input';
import { MatListModule } from '@angular/material/list';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatSelectModule } from '@angular/material/select';
import { MatStepperModule } from '@angular/material/stepper';
import { ApiModelPipesModule, ThriftPipesModule } from '@cc/app/shared/pipes';
import { ConfirmActionDialogModule } from '@cc/components/confirm-action-dialog';
import { ClaimRoutingModule } from './claim-routing.module';
import { ClaimComponent } from './claim.component';
import { ConversationModule } from './conversation/conversation.module';
import { DetailsComponent } from './details/details.component';
import { StatusChangerComponent } from './status-changer/status-changer.component';
/**
* @deprecated FR-688
*/
@NgModule({
imports: [
ClaimRoutingModule,
CommonModule,
MatCardModule,
FlexModule,
MatSelectModule,
ConversationModule,
MatButtonModule,
MatDialogModule,
MatProgressBarModule,
ReactiveFormsModule,
MatInputModule,
MatListModule,
MatBottomSheetModule,
MatStepperModule,
ConfirmActionDialogModule,
ThriftPipesModule,
ApiModelPipesModule,
],
declarations: [ClaimComponent, DetailsComponent, StatusChangerComponent],
entryComponents: [StatusChangerComponent],
})
export class ClaimModule {}

View File

@ -1,26 +0,0 @@
import { Injectable } from '@angular/core';
import { MatSnackBar } from '@angular/material/snack-bar';
import { Subject } from 'rxjs';
import { ClaimManagementService } from '../../thrift-services/damsel/claim-management.service';
import { Claim, ClaimID } from '../../thrift-services/damsel/gen-model/claim_management';
@Injectable()
export class ClaimService {
claim$: Subject<Claim> = new Subject();
constructor(
private claimManagementService: ClaimManagementService,
private snackBar: MatSnackBar
) {}
getClaim(partyID: string, claimID: ClaimID) {
this.claimManagementService.getClaim(partyID, claimID).subscribe(
(claim) => this.claim$.next(claim),
(e) => {
console.error(e);
this.snackBar.open('Error loading the claim', 'OK');
}
);
}
}

View File

@ -1,22 +0,0 @@
import { Pipe, PipeTransform } from '@angular/core';
import { TimelineAction } from './to-timeline-info/model';
@Pipe({
name: 'actionIcon',
})
export class ActionIconPipe implements PipeTransform {
transform(action: TimelineAction): string {
return ({
[TimelineAction.statusPending]: 'visibility',
[TimelineAction.statusReview]: 'forward',
[TimelineAction.statusRevoked]: 'close',
[TimelineAction.statusDenied]: 'close',
[TimelineAction.statusAccepted]: 'done',
[TimelineAction.filesAdded]: 'attach_file',
[TimelineAction.commentAdded]: 'mode_comment',
[TimelineAction.changesAdded]: 'add',
[TimelineAction.partyModification]: 'add',
} as const)[action];
}
}

View File

@ -1,24 +0,0 @@
import { Pipe, PipeTransform } from '@angular/core';
import { TimelineAction } from './to-timeline-info/model';
const TIMELINE_ACTION_NAME_TO_TITLE: { [N in TimelineAction]: string } = {
[TimelineAction.statusPending]: 'Changed status to Pending',
[TimelineAction.statusReview]: 'Changed status to Review',
[TimelineAction.statusRevoked]: 'Changed status to Revoked',
[TimelineAction.statusDenied]: 'Changed status to Denied',
[TimelineAction.statusAccepted]: 'Changed status to Accepted',
[TimelineAction.filesAdded]: 'Files added',
[TimelineAction.commentAdded]: 'Comment added',
[TimelineAction.changesAdded]: 'Changes added',
[TimelineAction.partyModification]: 'Party modification',
};
@Pipe({
name: 'actionName',
})
export class ActionNamePipe implements PipeTransform {
transform(action: TimelineAction): string {
return TIMELINE_ACTION_NAME_TO_TITLE[action] || action;
}
}

View File

@ -1,5 +0,0 @@
<mat-card>
<mat-card-content>
{{ conversation ? conversation.messages[0].text : "Can't load conversation" }}
</mat-card-content>
</mat-card>

View File

@ -1,3 +0,0 @@
mat-card-content {
word-break: break-all;
}

View File

@ -1,12 +0,0 @@
import { Component, Input } from '@angular/core';
import { Conversation } from '../../../../thrift-services/messages/gen-model/messages';
@Component({
selector: 'cc-conversation-comment',
templateUrl: 'comment.component.html',
styleUrls: ['comment.component.scss'],
})
export class CommentComponent {
@Input() conversation: Conversation;
}

View File

@ -1,113 +0,0 @@
<div fxLayout="column" fxLayoutGap="20px">
<h2 class="mat-title">Changeset</h2>
<cc-timeline *ngIf="timelineInfo$ | async as timelineInfo">
<cc-timeline-item *ngFor="let item of timelineInfo">
<cc-timeline-item-title>
<div class="mat-caption">
{{ item.action | actionName }} by {{ item.user_info.username }} at
{{ item.created_at | date: 'dd.MM.yyyy HH:mm:ss' }} ({{
item.created_at | humanizedDuration: { largest: 1, hasAgoEnding: true }
}})
</div>
<div *ngIf="canUseActionsForQuestionary(item.modifications)">
<button mat-icon-button [matMenuTriggerFor]="menu">
<mat-icon>more_horiz</mat-icon>
</button>
<mat-menu #menu="matMenu">
<button
mat-menu-item
*ngIf="questionary$ | async as questionary"
(click)="extractPartyModification(questionary)"
>
Extract party mods
</button>
</mat-menu>
</div>
</cc-timeline-item-title>
<cc-timeline-item-badge>
<mat-icon>{{ item.action | actionIcon }}</mat-icon>
</cc-timeline-item-badge>
<cc-timeline-item-content
*ngIf="item.modifications.length !== 0"
fxLayout="column"
fxLayoutGap="20px"
>
<ng-container *ngFor="let m of item.modifications">
<cc-file-container
*ngIf="item.action === timelineAction.filesAdded"
[fileID]="m.claim_modification.file_modification.id"
></cc-file-container>
<cc-conversation-comment
*ngIf="item.action === timelineAction.commentAdded"
[conversation]="item.data"
></cc-conversation-comment>
<cc-reason
*ngIf="
item.action === timelineAction.statusDenied ||
item.action === timelineAction.statusRevoked
"
[statusModificationUnit]="m.claim_modification.status_modification"
></cc-reason>
<cc-questionary
*ngIf="item.action === timelineAction.changesAdded"
[questionary]="questionary$ | async"
></cc-questionary>
</ng-container>
<ng-container *ngIf="item.action === timelineAction.partyModification">
<mat-expansion-panel *ngFor="let modification of item.modifications">
<mat-expansion-panel-header>
<mat-panel-title> {{ getKey(modification) }} </mat-panel-title>
<mat-panel-description>
{{
modification.claim_modification
? getKey(modification.claim_modification)
: getKey(modification.party_modification)
}}
</mat-panel-description>
</mat-expansion-panel-header>
<cc-pretty-json [object]="modification"></cc-pretty-json>
</mat-expansion-panel>
</ng-container>
</cc-timeline-item-content>
</cc-timeline-item>
</cc-timeline>
<div *ngIf="hasUnsavedModifications$ | async" fxLayout="column" fxLayoutGap="10px">
<cc-unsaved-party-modifications
[partyModifications]="unsavedModifications$ | async"
(partyModificationsChanged)="partyModificationsChanged($event)"
></cc-unsaved-party-modifications>
<div>
<button
mat-button
color="primary"
[disabled]="isSaving$ | async"
(click)="saveModifications()"
>
SAVE
</button>
</div>
<mat-divider></mat-divider>
</div>
<mat-card *ngIf="canAddClaimMod || canAddPartyMod">
<mat-card-content
fxLayout="row"
fxLayoutGap="10px"
fxLayoutAlign="space-between center"
*ngIf="canAddClaimMod"
>
<cc-file-uploader (filesUploaded)="updateConversation($event)"></cc-file-uploader>
<cc-send-comment
fxFlex="100"
*ngIf="
claimStatus !== claimStatuses.Denied &&
claimStatus !== claimStatuses.Revoked &&
canAddClaimMod
"
(conversationSaved)="updateConversation($event)"
></cc-send-comment>
</mat-card-content>
<mat-card-actions *ngIf="canAddPartyMod">
<button mat-button (click)="addPartyModification()">ADD PARTY MODIFICATION</button>
</mat-card-actions>
</mat-card>
</div>

View File

@ -1,160 +0,0 @@
import {
Component,
EventEmitter,
Input,
OnChanges,
OnInit,
Output,
SimpleChanges,
} from '@angular/core';
import { MatBottomSheet } from '@angular/material/bottom-sheet';
import { MatDialog } from '@angular/material/dialog';
import { MatSnackBar } from '@angular/material/snack-bar';
import { Router } from '@angular/router';
import { combineLatest, from, of } from 'rxjs';
import { filter, first, map, switchMap } from 'rxjs/operators';
import { AppAuthGuardService, ClaimManagementRole } from '@cc/app/shared/services';
import { extractClaimStatus } from '@cc/app/shared/utils';
import { getUnionKey } from '@cc/utils/get-union-key';
import { ClaimStatus } from '../../../papi/model';
import {
PartyModificationEmitter,
UnitActionsNavListComponent,
} from '../../../party-modification-creator-legacy';
import { Questionary } from '../../../thrift-services/ank/gen-model/questionary_manager';
import { Claim, Modification } from '../../../thrift-services/damsel/gen-model/claim_management';
import { PartyModification } from '../../../thrift-services/damsel/gen-model/payment_processing';
import { RecreateClaimService } from '../recreate-claim';
import { ConversationService } from './conversation.service';
import { ExtractPartyModificationComponent } from './extract-party-modifications/extract-party-modification.component';
import { QuestionaryService } from './questionary.service';
import { SavePartyModificationsService } from './save-party-modifications.service';
import { TimelineAction } from './to-timeline-info/model';
@Component({
selector: 'cc-claim-conversation',
templateUrl: 'conversation.component.html',
providers: [ConversationService, QuestionaryService, SavePartyModificationsService],
})
export class ConversationComponent implements OnChanges, OnInit {
@Input() claim: Claim;
@Output() conversationChangedEvent = new EventEmitter();
timelineInfo$ = this.conversationService.timelineInfos$;
questionary$ = this.questionaryService.questionary$;
timelineAction = TimelineAction;
claimStatus: ClaimStatus;
claimStatuses = ClaimStatus;
unsavedModifications$ = this.savePartyModService.unsavedModifications$;
hasUnsavedModifications$ = this.savePartyModService.hasUnsavedModifications$;
isSaving$ = this.savePartyModService.isSaving$;
canAddClaimMod = this.appAuthGuardService.userHasRoles([ClaimManagementRole.AddPartyMod]);
canAddPartyMod = this.appAuthGuardService.userHasRoles([ClaimManagementRole.AddPartyMod]);
constructor(
private router: Router,
private conversationService: ConversationService,
private questionaryService: QuestionaryService,
private bottomSheet: MatBottomSheet,
private savePartyModService: SavePartyModificationsService,
private recreateClaimService: RecreateClaimService,
private partyModEmitter: PartyModificationEmitter,
private snackBar: MatSnackBar,
private appAuthGuardService: AppAuthGuardService,
private dialog: MatDialog
) {}
ngOnChanges(changes: SimpleChanges) {
const { currentValue } = changes.claim;
if (currentValue) {
this.claimStatus = extractClaimStatus(currentValue.status);
this.conversationService.enrichWithData(currentValue.changeset);
}
}
ngOnInit() {
this.recreateClaimService.recreated$
.pipe(
switchMap(({ party_id, id }) =>
from(
this.router.navigate([
'claim-mgt',
'party',
party_id,
'claim',
id.toString(),
])
)
)
)
.subscribe(() =>
this.snackBar.open('Claim recreated successfully', 'OK', { duration: 2000 })
);
this.recreateClaimService.extractedModifications$
.pipe(map((mods) => mods.map((modification) => modification.party_modification)))
.subscribe((m) => this.savePartyModService.partyModificationsChanged(m));
this.partyModEmitter.modification$
.pipe(
switchMap((m) => combineLatest([of(m), this.unsavedModifications$.pipe(first())])),
map(([m, unsavedMods]) => [...unsavedMods, m])
)
.subscribe((m) => this.savePartyModService.partyModificationsChanged(m));
this.recreateClaimService.extractError$.subscribe(() =>
this.snackBar.open('An error occurred while claim recreated', 'OK')
);
}
partyModificationsChanged(m: PartyModification[]) {
this.savePartyModService.partyModificationsChanged(m);
}
saveModifications() {
this.savePartyModService.save();
}
updateConversation(modifications: Modification[]) {
this.conversationService
.updateConversation(this.claim.party_id, this.claim.id, modifications)
.subscribe(() => this.conversationChangedEvent.emit());
}
getKey(modification: Modification) {
return getUnionKey(modification);
}
addPartyModification() {
this.bottomSheet.open(UnitActionsNavListComponent, {
data: {
type: 'allActions',
partyID: this.claim.party_id,
},
});
}
extractPartyModification(questionary: Questionary) {
const dialog = this.dialog.open(ExtractPartyModificationComponent, {
disableClose: true,
data: { questionary, partyID: this.claim.party_id },
width: '800px',
});
dialog
.afterClosed()
.pipe(filter((r) => r.length > 0))
.subscribe((result) => {
this.snackBar.open('Party modifications extracted successfully', 'OK', {
duration: 1500,
});
this.partyModificationsChanged(result);
});
}
canUseActionsForQuestionary(modifications: Modification[]) {
return (
modifications.filter((m) => !!m?.claim_modification?.document_modification).length > 0
);
}
}

View File

@ -1,78 +0,0 @@
import { LayoutModule } from '@angular/cdk/layout';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FlexLayoutModule } from '@angular/flex-layout';
import { ReactiveFormsModule } from '@angular/forms';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatDividerModule } from '@angular/material/divider';
import { MatExpansionModule } from '@angular/material/expansion';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { MatListModule } from '@angular/material/list';
import { MatMenuModule } from '@angular/material/menu';
import { MatSelectModule } from '@angular/material/select';
import { QuestionaryDocumentModule } from '@cc/app/shared/components';
import { HumanizeDurationModule } from '@cc/app/shared/pipes/humanize-duration';
import { PrettyJsonModule } from '@cc/components/pretty-json';
import { TimelineModule } from '@cc/components/timeline';
import { MonacoEditorModule } from '../../../monaco-editor';
import { PartyModificationCreatorLegacyModule } from '../../../party-modification-creator-legacy';
import { AnkModule } from '../../../thrift-services';
import { MessagesModule } from '../../../thrift-services/messages';
import { UnsavedPartyModificationsModule } from '../unsaved-party-modifications';
import { ActionIconPipe } from './action-icon.pipe';
import { ActionNamePipe } from './action-name.pipe';
import { CommentComponent } from './comment/comment.component';
import { ConversationComponent } from './conversation.component';
import { ExtractPartyModificationModule } from './extract-party-modifications/extract-party-modification.module';
import { FileContainerModule } from './file-container';
import { FileUploaderModule } from './file-uploader/file-uploader.module';
import { QuestionaryModule } from './questionary/questionary.module';
import { ReasonComponent } from './reason/reason.component';
import { SendCommentComponent } from './send-comment';
@NgModule({
imports: [
LayoutModule,
MatButtonModule,
FlexLayoutModule,
MatFormFieldModule,
MatInputModule,
TimelineModule,
MatIconModule,
CommonModule,
ReactiveFormsModule,
MatExpansionModule,
MonacoEditorModule,
MessagesModule,
MatCardModule,
HumanizeDurationModule,
MatSelectModule,
FileContainerModule,
FileUploaderModule,
AnkModule,
QuestionaryDocumentModule,
MatListModule,
QuestionaryModule,
UnsavedPartyModificationsModule,
PartyModificationCreatorLegacyModule,
MatDividerModule,
ExtractPartyModificationModule,
MatMenuModule,
PrettyJsonModule,
],
declarations: [
ConversationComponent,
ReasonComponent,
SendCommentComponent,
ActionIconPipe,
ActionNamePipe,
CommentComponent,
],
exports: [ConversationComponent],
})
export class ConversationModule {}

View File

@ -1,62 +0,0 @@
import { Injectable } from '@angular/core';
// eslint-disable-next-line you-dont-need-lodash-underscore/flatten
import flatten from 'lodash-es/flatten';
import { from, Observable, Subject } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
import { ClaimManagementService } from '../../../thrift-services/damsel/claim-management.service';
import {
ClaimChangeset,
ClaimID,
Modification,
} from '../../../thrift-services/damsel/gen-model/claim_management';
import { ConversationId } from '../../../thrift-services/messages/gen-model/messages';
import { MessagesService } from '../../../thrift-services/messages/messages.service';
import { addCommentsToTimelineInfos, toTimelineInfo } from './to-timeline-info';
import { TimelineAction, TimelineItemInfo } from './to-timeline-info/model';
@Injectable()
export class ConversationService {
timelineInfos$ = new Subject<TimelineItemInfo[]>();
constructor(
private claimManagementService: ClaimManagementService,
private messagesService: MessagesService
) {}
updateConversation(
partyId: string,
claimId: ClaimID,
modifications: Modification[]
): Observable<void> {
return this.claimManagementService.updateClaim(partyId, claimId, modifications);
}
enrichWithData(changeset: ClaimChangeset) {
from(this.addCommentsToInfo(toTimelineInfo(changeset))).subscribe((infos) =>
this.timelineInfos$.next(infos)
);
}
private addCommentsToInfo(timelineInfos: TimelineItemInfo[]): Observable<TimelineItemInfo[]> {
const commentAddedIds: ConversationId[] = flatten(
timelineInfos
.filter((info) => info.action === TimelineAction.commentAdded)
.map((commentInfo: TimelineItemInfo) =>
commentInfo.modifications.map(
(m) => m.claim_modification.comment_modification.id
)
)
);
return this.messagesService.getConversations(commentAddedIds, {}).pipe(
map((conversationsResponse) =>
addCommentsToTimelineInfos(conversationsResponse.conversations, timelineInfos)
),
catchError((e) => {
console.error(e);
return [timelineInfos];
})
);
}
}

View File

@ -1,110 +0,0 @@
<mat-dialog-content>
<ng-container *ngIf="modType === 'contractor_modification'">
<cc-contractor
*ngIf="mod.contractor_modification.modification.creation"
[form]="form"
[initialValue]="mod.contractor_modification.modification.creation"
></cc-contractor>
</ng-container>
<ng-container *ngIf="modType === 'contract_modification'">
<cc-contract-params
*ngIf="mod.contract_modification?.modification?.creation"
[form]="form"
[initialValue]="mod.contract_modification.modification.creation"
>
</cc-contract-params>
<cc-contract-payout-tool-modification-unit
*ngIf="mod.contract_modification.modification.payout_tool_modification"
[form]="form"
[initialValue]="mod.contract_modification.modification.payout_tool_modification"
>
</cc-contract-payout-tool-modification-unit>
<cc-legal-agreement-binding
*ngIf="mod.contract_modification.modification.legal_agreement_binding"
[form]="form"
[initialValue]="mod.contract_modification.modification.legal_agreement_binding"
>
</cc-legal-agreement-binding>
<cc-adjustment-modification-unit
*ngIf="mod.contract_modification.modification.adjustment_modification"
[form]="form"
[initialValue]="mod.contract_modification.modification.adjustment_modification"
>
</cc-adjustment-modification-unit>
<cc-report-preferences
*ngIf="mod.contract_modification.modification.report_preferences_modification"
[form]="form"
[initialValue]="mod.contract_modification.modification.report_preferences_modification"
>
</cc-report-preferences>
<cc-termination
*ngIf="mod.contract_modification.modification.termination"
[form]="form"
[initialValue]="mod.contract_modification.modification.termination"
>
</cc-termination>
<cc-contractor-id
*ngIf="mod.contract_modification.modification.contractor_modification"
[form]="form"
>
</cc-contractor-id>
</ng-container>
<ng-container *ngIf="modType === 'shop_modification'">
<cc-category-ref
*ngIf="mod.shop_modification.modification.category_modification"
[form]="form"
[initialValue]="mod.shop_modification.modification.category_modification"
>
</cc-category-ref>
<cc-shop-details
*ngIf="mod.shop_modification.modification.details_modification"
[form]="form"
[initialValue]="mod.shop_modification.modification.details_modification"
>
</cc-shop-details>
<cc-shop-location
*ngIf="mod.shop_modification.modification.location_modification"
[form]="form"
[initialValue]="mod.shop_modification.modification.location_modification"
>
</cc-shop-location>
<cc-shop-account-creation
*ngIf="mod.shop_modification.modification.shop_account_creation"
[form]="form"
[initialValue]="mod.shop_modification.modification.shop_account_creation"
>
</cc-shop-account-creation>
<cc-shop-schedule-modification
*ngIf="mod.shop_modification.modification.payout_schedule_modification"
[form]="form"
[initialValue]="mod.shop_modification.modification.payout_schedule_modification"
>
</cc-shop-schedule-modification>
<cc-shop-contract-modification
*ngIf="mod.shop_modification.modification.contract_modification"
[form]="form"
[initialValue]="mod.shop_modification.modification.contract_modification"
>
</cc-shop-contract-modification>
<cc-shop-payout-tool-modification
*ngIf="mod.shop_modification.modification.payout_tool_modification"
[form]="form"
[initialValue]="mod.shop_modification.modification.payout_tool_modification"
>
</cc-shop-payout-tool-modification>
<cc-shop-params
*ngIf="mod.shop_modification.modification.creation"
[form]="form"
[initialValue]="mod.shop_modification.modification.creation"
>
</cc-shop-params>
</ng-container>
</mat-dialog-content>
<mat-dialog-actions fxLayout="row" fxLayoutAlign="space-between center">
<button mat-dialog-close mat-button color="default" [mat-dialog-close]="false">
CANCEL
</button>
<button mat-button color="primary" (click)="save()">
SAVE
</button>
</mat-dialog-actions>

View File

@ -1,42 +0,0 @@
import { Component, Inject } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { prepareModificationsToBackend } from '@cc/app/shared/components/party-modification-creator/create-modification-dialog/prepare-modifications-to-backend';
import { getUnionKey } from '@cc/utils/get-union-key';
import { PartyModification } from '../../../../thrift-services/damsel/gen-model/claim_management';
type ModificationType =
| 'contractor_modification'
| 'contract_modification'
| 'shop_modification'
| 'wallet_modification';
@Component({
templateUrl: 'edit-unsaved-modification.component.html',
})
export class EditUnsavedModificationComponent {
mod: PartyModification = this.data;
form: FormGroup = this.fb.group({});
modType: ModificationType = getUnionKey<PartyModification>(this.mod);
constructor(
private dialogRef: MatDialogRef<EditUnsavedModificationComponent>,
private fb: FormBuilder,
@Inject(MAT_DIALOG_DATA) private data: PartyModification
) {}
save() {
this.dialogRef.close({
[this.modType]: {
id: this.mod[this.modType].id,
modification: {
[getUnionKey(
this.mod[this.modType].modification
)]: prepareModificationsToBackend(this.form.value),
},
},
});
}
}

View File

@ -1,22 +0,0 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FlexModule } from '@angular/flex-layout';
import { MatButtonModule } from '@angular/material/button';
import { MatDialogModule } from '@angular/material/dialog';
import { PartyModificationFormsModule } from '@cc/app/shared/components';
import { EditUnsavedModificationComponent } from './edit-unsaved-modification.component';
@NgModule({
declarations: [EditUnsavedModificationComponent],
entryComponents: [EditUnsavedModificationComponent],
imports: [
CommonModule,
MatDialogModule,
MatButtonModule,
FlexModule,
PartyModificationFormsModule,
],
})
export class EditUnsavedModificationModule {}

View File

@ -1,4 +0,0 @@
export enum ActionType {
AttachNew = 'attachNew',
Attach = 'attach',
}

View File

@ -1,24 +0,0 @@
<div fxLayout="column" fxLayoutGap="24px">
<div class="mat-title">Contractor</div>
<mat-radio-group (change)="targetChanges($event)" fxLayout fxLayoutGap="32px">
<mat-radio-button
*ngFor="let item of actionTypes"
[checked]="selectedTarget === item"
[value]="item"
>{{ item | ccSelectorType }}
</mat-radio-button>
</mat-radio-group>
<ng-container *ngIf="selectedTarget === actionType.AttachNew">
<form [formGroup]="contractorForm">
<mat-form-field fxFlex="">
<input type="text" matInput formControlName="id" placeholder="Contractor ID" />
</mat-form-field>
</form>
</ng-container>
<ng-container *ngIf="selectedTarget === actionType.Attach">
<cc-contractors-table
[contractorForm]="contractorForm"
[partyID]="partyID"
></cc-contractors-table>
</ng-container>
</div>

View File

@ -1,30 +0,0 @@
import { Component, Input, OnInit } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { MatRadioChange } from '@angular/material/radio';
import { PartyID } from '../../../../../thrift-services/damsel/gen-model/domain';
import { ActionType } from './action-type';
@Component({
selector: 'cc-contractor-selector',
templateUrl: 'contractor-selector.component.html',
})
export class ContractorSelectorComponent implements OnInit {
@Input()
partyID: PartyID;
@Input()
contractorForm: FormGroup;
actionType = ActionType;
actionTypes = [ActionType.AttachNew, ActionType.Attach];
selectedTarget = ActionType.AttachNew;
targetChanges($event: MatRadioChange) {
this.selectedTarget = $event.value;
}
ngOnInit(): void {
this.contractorForm.registerControl('id', new FormControl('', [Validators.required]));
}
}

View File

@ -1,36 +0,0 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FlexModule } from '@angular/flex-layout';
import { ReactiveFormsModule } from '@angular/forms';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { MatPaginatorModule } from '@angular/material/paginator';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatRadioModule } from '@angular/material/radio';
import { MatTableModule } from '@angular/material/table';
import { PrettyJsonModule } from '@cc/components/pretty-json';
import { ContractorSelectorComponent } from './contractor-selector.component';
import { ContractorsTableComponent } from './contractors-table/contractors-table.component';
import { SelectorTypePipe } from './selector-type.pipe';
@NgModule({
imports: [
FlexModule,
MatRadioModule,
CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatInputModule,
MatProgressSpinnerModule,
MatCheckboxModule,
MatTableModule,
MatPaginatorModule,
PrettyJsonModule,
],
exports: [ContractorSelectorComponent],
declarations: [ContractorSelectorComponent, SelectorTypePipe, ContractorsTableComponent],
})
export class ContractorSelectorModule {}

View File

@ -1,51 +0,0 @@
<div fxLayout="column">
<div *ngIf="isLoading" fxFlex fxLayout="row" fxLayoutAlign="center center">
<mat-spinner></mat-spinner>
</div>
<div *ngIf="!isLoading && dataSource.data">
<div fxLayout fxLayoutAlign="space-between">
<mat-form-field fxFlex="35">
<input
matInput
type="text"
(keyup)="applyFilter($event.target.value)"
placeholder="Filter"
/>
</mat-form-field>
</div>
<div class="table-container" fxLayout="column">
<table mat-table [dataSource]="dataSource" fxFlex>
<ng-container matColumnDef="select" sticky>
<th mat-header-cell *matHeaderCellDef class="mat-column-select"></th>
<td mat-cell *matCellDef="let item" class="mat-column-select">
<mat-checkbox
[checked]="item.checked"
(change)="change(item, $event)"
></mat-checkbox>
</td>
</ng-container>
<ng-container matColumnDef="id">
<th mat-header-cell *matHeaderCellDef class="mat-column-id">ID</th>
<td mat-cell *matCellDef="let item" class="mat-column-id">
{{ item.data.id }}
</td>
</ng-container>
<ng-container matColumnDef="data">
<th mat-header-cell *matHeaderCellDef>Data</th>
<td mat-cell *matCellDef="let item" class="mat-column-data">
<cc-pretty-json inline="true" [object]="expandData(item)"></cc-pretty-json>
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
</table>
</div>
</div>
<mat-paginator
#paginator
[pageSize]="10"
[pageSizeOptions]="[5, 10, 20]"
showFirstLastButtons
></mat-paginator>
</div>

View File

@ -1,20 +0,0 @@
table {
overflow: auto;
}
.mat-column-select,
.mat-column-id {
padding-left: 8px;
padding-right: 16px;
}
.mat-column-data {
padding-left: 16px;
white-space: nowrap;
}
.table-container {
width: 100%;
max-width: 735px;
overflow: auto;
}

View File

@ -1,80 +0,0 @@
import { Component, Input, OnInit, QueryList, ViewChildren } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { MatCheckboxChange } from '@angular/material/checkbox';
import { MatPaginator } from '@angular/material/paginator';
import { MatSnackBar } from '@angular/material/snack-bar';
import { MatTableDataSource } from '@angular/material/table';
import { map } from 'rxjs/operators';
import { getUnionValue } from '@cc/utils/get-union-key';
import { PartyService } from '../../../../../../papi/party.service';
import { PartyID } from '../../../../../../thrift-services/damsel/gen-model/domain';
import { SelectableItem } from '../selectable-item';
@Component({
selector: 'cc-contractors-table',
styleUrls: ['contractors-table.component.scss'],
templateUrl: 'contractors-table.component.html',
})
export class ContractorsTableComponent implements OnInit {
@Input()
partyID: PartyID;
@Input()
contractorForm: FormGroup;
dataSource: MatTableDataSource<SelectableItem> = new MatTableDataSource();
isLoading = true;
displayedColumns = ['select', 'id', 'data'];
@ViewChildren('paginator') paginator: QueryList<MatPaginator>;
constructor(private partyService: PartyService, private snackBar: MatSnackBar) {}
change(item: SelectableItem, change: MatCheckboxChange) {
for (const selectedItem of this.dataSource.data) {
selectedItem.checked = false;
}
item.checked = change.checked;
const id = change.checked ? item.id : '';
this.contractorForm.setValue({ id });
}
ngOnInit(): void {
this.dataSource.filterPredicate = this.itemsFilter;
this.partyService
.getParty(this.partyID)
.pipe(
map((party) => {
const result = [];
party.contractors.forEach((data, id) => result.push({ data, id }));
return result;
})
)
.subscribe(
(contractors: SelectableItem[]) => {
this.isLoading = false;
this.dataSource = new MatTableDataSource(contractors);
this.dataSource.paginator = this.paginator.first;
},
() => {
this.isLoading = false;
this.snackBar.open('An error occurred when receiving contractors', 'OK');
}
);
}
applyFilter(filterValue: string) {
this.dataSource.filter = filterValue.trim().toLowerCase();
}
expandData(item: any) {
return getUnionValue(getUnionValue(item.data.contractor));
}
private itemsFilter(item: SelectableItem, filter: string): boolean {
return JSON.stringify(item).includes(filter);
}
}

View File

@ -1,7 +0,0 @@
import { Contractor } from '../../../../../thrift-services/damsel/gen-model/domain';
export class SelectableItem {
id: string;
data: Contractor;
checked: boolean;
}

View File

@ -1,19 +0,0 @@
import { Pipe, PipeTransform } from '@angular/core';
import { ActionType } from './action-type';
@Pipe({
name: 'ccSelectorType',
})
export class SelectorTypePipe implements PipeTransform {
transform(value: string): any {
switch (value) {
case ActionType.AttachNew:
return 'Attach new';
case ActionType.Attach:
return 'Select from party';
default:
return value;
}
}
}

View File

@ -1,2 +0,0 @@
export * from './to-individual-entity-party-modification';
export * from './to-legal-entity-party-modification';

View File

@ -1,16 +0,0 @@
import * as uuid from 'uuid/v4';
import {
ContractorModification,
PartyModification,
} from '../../../../../thrift-services/damsel/gen-model/claim_management';
export const toContractorModification = (
modification: ContractorModification,
id: string = uuid()
): PartyModification => ({
contractor_modification: {
id,
modification,
},
});

View File

@ -1,53 +0,0 @@
import { getOr } from '@cc/utils/get-or';
import { QuestionaryData } from '../../../../../thrift-services/ank/gen-model/questionary_manager';
import { PartyModification } from '../../../../../thrift-services/damsel/gen-model/claim_management';
import { createRussianBankAccount } from '../creators/create-russian-bank-account';
import { toContractorModification } from './to-contractor-modification';
const PATH = 'contractor.individual_entity.russian_individual_entity';
export const toIndividualEntityPartyModification = (
d: QuestionaryData,
contractorID: string
): PartyModification =>
toContractorModification(
{
creation: {
legal_entity: {
russian_legal_entity: {
registered_name: getOr(d, `${PATH}.name`, ''),
registered_number: getOr(
d,
`${PATH}.registration_info.individual_registration_info.ogrnip`,
''
),
inn: getOr(d, `${PATH}.inn`, '') || '',
actual_address: getOr(
d,
`${PATH}.registration_info.individual_registration_info.registration_place`,
''
),
post_address: getOr(
d,
`${PATH}.registration_info.individual_registration_info.registration_place`,
''
),
representative_position: '',
representative_full_name: getOr(
d,
`${PATH}.russian_private_entity.fio`,
''
),
representative_document: getOr(
d,
`${PATH}.identity_document.russian_domestic_password.series_number`,
''
),
russian_bank_account: createRussianBankAccount(d),
},
},
},
},
contractorID
);

View File

@ -1,14 +0,0 @@
import { getOr } from '@cc/utils/get-or';
import { QuestionaryData } from '../../../../../thrift-services/ank/gen-model/questionary_manager';
import { InternationalLegalEntity } from '../../../../../thrift-services/damsel/gen-model/domain';
const PATH = 'contractor.legal_entity.international_legal_entity';
export const toInternationalLegalEntity = (d: QuestionaryData): InternationalLegalEntity => ({
legal_name: d.contractor.legal_entity.international_legal_entity.legal_name,
trading_name: getOr(d, `${PATH}.trading_name`, ''),
registered_address: getOr(d, `${PATH}.registered_address`, ''),
actual_address: getOr(d, `${PATH}.actual_address`, ''),
registered_number: getOr(d, `${PATH}.registered_number`, ''),
});

View File

@ -1,25 +0,0 @@
import { QuestionaryData } from '../../../../../thrift-services/ank/gen-model/questionary_manager';
import { PartyModification } from '../../../../../thrift-services/damsel/gen-model/claim_management';
import { toContractorModification } from './to-contractor-modification';
import { toInternationalLegalEntity } from './to-international-legal-entity';
import { toRussianLegalEntity } from './to-russian-legal-entity';
export const toLegalEntityPartyModification = (
d: QuestionaryData,
contractorID: string
): PartyModification =>
toContractorModification(
{
creation: {
legal_entity: {
russian_legal_entity: d.contractor.legal_entity.russian_legal_entity
? toRussianLegalEntity(d)
: undefined,
international_legal_entity: d.contractor.legal_entity.international_legal_entity
? toInternationalLegalEntity(d)
: undefined,
},
},
},
contractorID
);

View File

@ -1,27 +0,0 @@
import { getOr } from '@cc/utils/get-or';
import { QuestionaryData } from '../../../../../thrift-services/ank/gen-model/questionary_manager';
import { RussianLegalEntity } from '../../../../../thrift-services/damsel/gen-model/domain';
import { createRussianBankAccount } from '../creators/create-russian-bank-account';
const PATH = 'contractor.legal_entity.russian_legal_entity';
export const toRussianLegalEntity = (d: QuestionaryData): RussianLegalEntity => ({
registered_name: getOr(d, `${PATH}.name`, ''),
registered_number: getOr(d, `${PATH}.registration_info.legal_registration_info.ogrn`, ''),
inn: getOr(d, `${PATH}.inn`, ''),
actual_address:
getOr(d, `${PATH}.registration_info.legal_registration_info.actual_address`, '') ||
getOr(d, `${PATH}.registration_info.legal_registration_info.registration_address`, ''),
post_address:
getOr(d, `${PATH}.postal_address`, '') ||
getOr(d, `${PATH}.registration_info.legal_registration_info.registration_address`, ''),
representative_position: getOr(d, `${PATH}.legal_owner_info.head_position`, ''),
representative_full_name: getOr(d, `${PATH}.legal_owner_info.russian_private_entity.fio`, ''),
representative_document: getOr(
d,
`${PATH}.legal_owner_info.identity_document.russian_domestic_password.series_number`,
''
),
russian_bank_account: createRussianBankAccount(d),
});

View File

@ -1,18 +0,0 @@
import { PartyModification } from '../../../../../thrift-services/damsel/gen-model/claim_management';
import { PaymentInstitutionRef } from '../../../../../thrift-services/damsel/gen-model/domain';
export const createContractCreation = (
contractorId: string,
contractId: string,
paymentInstitution: PaymentInstitutionRef
): PartyModification => ({
contract_modification: {
id: contractId,
modification: {
creation: {
contractor_id: contractorId,
payment_institution: paymentInstitution,
},
},
},
});

View File

@ -1,25 +0,0 @@
import get from 'lodash-es/get';
import { QuestionaryData } from '../../../../../thrift-services/ank/gen-model/questionary_manager';
import { PartyModification } from '../../../../../thrift-services/damsel/gen-model/claim_management';
import { toIndividualEntityPartyModification, toLegalEntityPartyModification } from '../converters';
export const createContractor = (d: QuestionaryData, contractorID: string): PartyModification => {
const isLegalEntityExist = get(d, 'contractor.legal_entity', false);
const isIndividualEntityExist = get(d, 'contractor.individual_entity', false);
const legalEntityCreation = isLegalEntityExist
? toLegalEntityPartyModification(d, contractorID)
: null;
const individualEntityCreation = isIndividualEntityExist
? toIndividualEntityPartyModification(d, contractorID)
: null;
if (isLegalEntityExist) {
return legalEntityCreation;
} else if (isIndividualEntityExist) {
return individualEntityCreation;
} else {
return null;
}
};

View File

@ -1,22 +0,0 @@
import { getOr } from '@cc/utils/get-or';
import { QuestionaryData } from '../../../../../thrift-services/ank/gen-model/questionary_manager';
import { InternationalBankAccount } from '../../../../../thrift-services/damsel/gen-model/domain';
const PATH = 'bank_account.international_bank_account';
export const createInternationalBankAccount = (d: QuestionaryData): InternationalBankAccount => {
const internationalBankAccount = getOr(d, PATH, null);
const accountNumber = getOr(internationalBankAccount, `number`, '');
const bank = getOr(internationalBankAccount, `bank`, '');
const correspondentAccount = getOr(internationalBankAccount, `correspondent_account`, '');
const iban = getOr(internationalBankAccount, `iban`, '');
const accountHolder = getOr(internationalBankAccount, `account_holder`, '');
return {
number: accountNumber,
bank,
correspondent_account: correspondentAccount,
iban,
account_holder: accountHolder,
};
};

View File

@ -1,34 +0,0 @@
import { QuestionaryData } from '../../../../../thrift-services/ank/gen-model/questionary_manager';
import { PartyModification } from '../../../../../thrift-services/damsel/gen-model/claim_management';
import { createInternationalBankAccount } from './create-international-bank-account';
import { createRussianBankAccount } from './create-russian-bank-account';
export const createPayoutToolCreation = (
d: QuestionaryData,
contractID: string,
payoutToolID: string
): PartyModification => ({
contract_modification: {
id: contractID,
modification: {
payout_tool_modification: {
payout_tool_id: payoutToolID,
modification: {
creation: {
currency: {
symbolic_code: 'RUB',
},
tool_info: {
russian_bank_account: d.bank_account.russian_bank_account
? createRussianBankAccount(d)
: undefined,
international_bank_account: d.bank_account.international_bank_account
? createInternationalBankAccount(d)
: undefined,
},
},
},
},
},
},
});

View File

@ -1,15 +0,0 @@
import { getOr } from '@cc/utils/get-or';
import { QuestionaryData } from '../../../../../thrift-services/ank/gen-model/questionary_manager';
import { RussianBankAccount } from '../../../../../thrift-services/damsel/gen-model/domain';
const PATH = 'bank_account.russian_bank_account';
export const createRussianBankAccount = (d: QuestionaryData): RussianBankAccount => {
const russianBankAccount = getOr(d, PATH, null);
const account = getOr(russianBankAccount, `account`, '');
const bankName = getOr(russianBankAccount, `bank_name`, '');
const bankBik = getOr(russianBankAccount, `bank_bik`, '');
const bankPostAccount = getOr(russianBankAccount, `bank_post_account`, '');
return { account, bank_name: bankName, bank_bik: bankBik, bank_post_account: bankPostAccount };
};

View File

@ -1,10 +0,0 @@
import { PartyModification } from '../../../../../thrift-services/damsel/gen-model/claim_management';
export const createShopAccountCreation = (shopID: string): PartyModification => ({
shop_modification: {
id: shopID,
modification: {
shop_account_creation: { currency: { symbolic_code: 'RUB' } },
},
},
});

View File

@ -1,36 +0,0 @@
import { getOr } from '@cc/utils/get-or';
import { QuestionaryData } from '../../../../../thrift-services/ank/gen-model/questionary_manager';
import { PartyModification } from '../../../../../thrift-services/damsel/gen-model/claim_management';
export const createShopCreation = (
d: QuestionaryData,
contractId: string,
payoutToolId: string,
categoryID: number,
shopID: string
): PartyModification => {
const defaultLocation = { url: '' };
const location = getOr(d, 'shop_info.location', defaultLocation);
const defaultDetails = {
name: '',
description: '',
};
const details = getOr(d, 'shop_info.details', defaultDetails);
return {
shop_modification: {
id: shopID,
modification: {
creation: {
contract_id: contractId,
payout_tool_id: payoutToolId,
location,
details,
category: { id: categoryID },
},
},
},
};
};

View File

@ -1,3 +0,0 @@
export * from './create-contract-creation';
export * from './create-payout-tool-creation';
export * from './create-shop-creation';

View File

@ -1,19 +0,0 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'ccExtractFormCheckboxName',
})
export class ExtractFormCheckboxNamePipe implements PipeTransform {
transform(value: string): string {
switch (value) {
case 'contractCreation':
return 'Contract creation';
case 'payoutToolCreation':
return 'Payout tool creation';
case 'shopCreation':
return 'Shop creation';
default:
return value;
}
}
}

View File

@ -1,14 +0,0 @@
import {
CategoryRef,
PaymentInstitutionRef,
} from '../../../../thrift-services/damsel/gen-model/domain';
interface ContractorId {
id: string;
}
export interface ExtractFormValue {
category: CategoryRef;
payment_institution: PaymentInstitutionRef;
contractor: ContractorId;
}

View File

@ -1,28 +0,0 @@
<div fxLayout="column" fxLayoutAlign="space-between stretch" fxLayoutGap="32px">
<mat-dialog-content>
<div fxLayout="column" fxLayoutGap="32px">
<div class="mat-headline">Party modifications extraction params</div>
<form [formGroup]="form" fxLayout="column" fxLayoutGap="32px">
<cc-contractor-selector
*ngIf="!isContractorAvailable"
[partyID]="partyID"
[contractorForm]="form.get('contractor')"
></cc-contractor-selector>
<mat-divider *ngIf="!isContractorAvailable"></mat-divider>
<cc-category-ref [required]="true" [form]="form.get('category')"></cc-category-ref>
<cc-payment-institution-ref
[required]="true"
[form]="form.get('payment_institution')"
></cc-payment-institution-ref>
</form>
</div>
</mat-dialog-content>
<mat-dialog-actions fxLayout="row" fxLayoutAlign="space-between center">
<button mat-dialog-close mat-button color="default" [mat-dialog-close]="false">
CANCEL
</button>
<button mat-button color="primary" (click)="extract()" [disabled]="!form.valid">
EXTRACT
</button>
</mat-dialog-actions>
</div>

View File

@ -1,38 +0,0 @@
import { Component, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { Questionary } from '../../../../thrift-services/ank/gen-model/questionary_manager';
import { PartyID } from '../../../../thrift-services/damsel/gen-model/domain';
import { ExtractPartyModificationsService } from './extract-party-modifications.service';
export interface ExtractPartyModification {
questionary: Questionary;
partyID: PartyID;
}
@Component({
templateUrl: 'extract-party-modification.component.html',
providers: [ExtractPartyModificationsService],
})
export class ExtractPartyModificationComponent {
form = this.extractPartyModificationsService.form;
partyID: string;
isContractorAvailable: boolean;
constructor(
private dialogRef: MatDialogRef<ExtractPartyModificationComponent>,
private extractPartyModificationsService: ExtractPartyModificationsService,
@Inject(MAT_DIALOG_DATA) private data: ExtractPartyModification
) {
this.partyID = this.data.partyID;
this.isContractorAvailable =
!!this.data.questionary.data.contractor?.legal_entity ||
!!this.data.questionary.data.contractor?.individual_entity;
}
extract() {
this.dialogRef.close(
this.extractPartyModificationsService.mapToModifications(this.data.questionary.data)
);
}
}

View File

@ -1,36 +0,0 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FlexModule } from '@angular/flex-layout';
import { ReactiveFormsModule } from '@angular/forms';
import { MatButtonModule } from '@angular/material/button';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatDialogModule } from '@angular/material/dialog';
import { MatDividerModule } from '@angular/material/divider';
import { MatInputModule } from '@angular/material/input';
import { MatRadioModule } from '@angular/material/radio';
import { PartyModificationFormsModule } from '@cc/app/shared/components';
import { ContractorSelectorModule } from './contractor-selector/contractor-selector.module';
import { ExtractFormCheckboxNamePipe } from './extract-form-checkbox-name.pipe';
import { ExtractPartyModificationComponent } from './extract-party-modification.component';
@NgModule({
declarations: [ExtractPartyModificationComponent, ExtractFormCheckboxNamePipe],
exports: [ExtractPartyModificationComponent],
imports: [
FlexModule,
MatDialogModule,
MatButtonModule,
MatInputModule,
ReactiveFormsModule,
MatCheckboxModule,
CommonModule,
PartyModificationFormsModule,
MatDividerModule,
MatRadioModule,
ContractorSelectorModule,
],
entryComponents: [ExtractPartyModificationComponent],
})
export class ExtractPartyModificationModule {}

View File

@ -1,66 +0,0 @@
import { Injectable } from '@angular/core';
import { FormBuilder } from '@angular/forms';
import * as uuid from 'uuid/v4';
import { QuestionaryData } from '../../../../thrift-services/ank/gen-model/questionary_manager';
import { PartyModification } from '../../../../thrift-services/damsel/gen-model/claim_management';
import { createContractCreation, createPayoutToolCreation, createShopCreation } from './creators';
import { createContractor } from './creators/create-contractor';
import { createShopAccountCreation } from './creators/create-shop-account-creation';
import { ExtractFormValue } from './extract-form-value';
@Injectable()
export class ExtractPartyModificationsService {
form = this.fb.group({
category: this.fb.group({}),
payment_institution: this.fb.group({}),
contractor: this.fb.group({}),
});
constructor(private fb: FormBuilder) {}
mapToModifications(d: QuestionaryData): PartyModification[] {
const {
category,
payment_institution,
contractor: { id },
}: ExtractFormValue = this.form.value;
const contractorID = uuid();
const shopID = uuid();
const contractID = uuid();
const payoutToolID = uuid();
const result = [];
if (d.contractor) {
const contractorCreationModification = createContractor(d, contractorID);
result.push(contractorCreationModification);
}
const contractCreationModification = createContractCreation(
d.contractor ? contractorID : id,
contractID,
payment_institution
);
result.push(contractCreationModification);
const payoutToolCreationModification = createPayoutToolCreation(
d,
contractID,
payoutToolID
);
result.push(payoutToolCreationModification);
const shopCreationModification = createShopCreation(
d,
contractID,
payoutToolID,
category.id,
shopID
);
const shopAccountCreation = createShopAccountCreation(shopID);
result.push(shopCreationModification, shopAccountCreation);
return result;
}
}

View File

@ -1,15 +0,0 @@
/**
* https://github.com/sindresorhus/multi-download/blob/master/index.js
*/
export function download(url: string, name?: string): void {
const a = document.createElement('a');
a.download = name;
a.href = url;
a.style.display = 'none';
document.body.append(a);
a.click();
// Chrome requires the timeout
setTimeout(() => {
a.remove();
}, 100);
}

View File

@ -1,6 +0,0 @@
<mat-card *ngIf="fileData$ | async as fileData">
<mat-card-content fxLayout="row" fxLayoutAlign="space-between">
<div class="mat-body-1">{{ fileData.file_name }}</div>
<mat-icon class="download-icon" (click)="downloadFile()">cloud_download</mat-icon>
</mat-card-content>
</mat-card>

View File

@ -1,7 +0,0 @@
.download-icon {
color: rgba(0, 0, 0, 0.87);
}
.download-icon:hover {
cursor: pointer;
}

View File

@ -1,26 +0,0 @@
import { Component, Input, OnInit } from '@angular/core';
import { FileContainerService } from './file-container.service';
@Component({
selector: 'cc-file-container',
templateUrl: 'file-container.component.html',
styleUrls: ['file-container.component.scss'],
providers: [FileContainerService],
})
export class FileContainerComponent implements OnInit {
@Input()
fileID: string;
fileData$ = this.fileContainerService.fileData$;
constructor(private fileContainerService: FileContainerService) {}
ngOnInit() {
this.fileContainerService.getFileInfo(this.fileID);
}
downloadFile() {
this.fileContainerService.downloadFile(this.fileID);
}
}

View File

@ -1,15 +0,0 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FlexModule } from '@angular/flex-layout';
import { MatCardModule } from '@angular/material/card';
import { MatIconModule } from '@angular/material/icon';
import { FileStorageModule } from '../../../../thrift-services/file-storage';
import { FileContainerComponent } from './file-container.component';
@NgModule({
imports: [CommonModule, MatCardModule, FlexModule, MatIconModule, FileStorageModule],
exports: [FileContainerComponent],
declarations: [FileContainerComponent],
})
export class FileContainerModule {}

View File

@ -1,50 +0,0 @@
import { Injectable } from '@angular/core';
import { MatSnackBar } from '@angular/material/snack-bar';
import * as moment from 'moment';
import { Observable, Subject } from 'rxjs';
import { filter, map, shareReplay, switchMap } from 'rxjs/operators';
import { booleanDelay } from '@cc/utils/boolean-delay';
import { FileStorageService } from '../../../../thrift-services/file-storage/file-storage.service';
import { FileData } from '../../../../thrift-services/file-storage/gen-model/file_storage';
import { download } from './download';
@Injectable()
export class FileContainerService {
private getFileInfo$ = new Subject<string>();
// eslint-disable-next-line @typescript-eslint/member-ordering
fileData$: Observable<FileData> = this.getFileInfo$.pipe(
switchMap((fileID) => this.fileStorageService.getFileData(fileID)),
filter((file) => Object.keys(file).length > 0),
map((file: FileData) => ({ ...file, file_name: decodeURI(file?.file_name) })),
shareReplay(1)
);
// eslint-disable-next-line @typescript-eslint/member-ordering
isLoading$ = this.fileData$.pipe(booleanDelay(), shareReplay(1));
constructor(private fileStorageService: FileStorageService, private snackBar: MatSnackBar) {
this.fileData$.subscribe();
}
getFileInfo(fileID: string) {
this.getFileInfo$.next(fileID);
}
downloadFile(fileID: string) {
this.fileStorageService
.generateDownloadUrl(fileID, moment().add(1, 'h').toISOString())
.subscribe(
(url) => {
if (typeof url === 'string') {
download(url);
} else {
this.snackBar.open('File not found', 'OK');
}
},
() => this.snackBar.open('Download error', 'OK')
);
}
}

View File

@ -1,2 +0,0 @@
export * from './file-container.module';
export * from './file-container.component';

View File

@ -1,5 +0,0 @@
<div ngfSelect class="cc-file-uploader" (filesChange)="startUploading($event)">
<button mat-icon-button [disabled]="disabled || (inProgress$ | async)">
<mat-icon>cloud_upload</mat-icon>
</button>
</div>

View File

@ -1,3 +0,0 @@
.cc-file-uploader:hover {
cursor: pointer;
}

View File

@ -1,34 +0,0 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { Modification } from '../../../../thrift-services/damsel/gen-model/claim_management';
import { FileUploaderService } from './file-uploader.service';
@Component({
selector: 'cc-file-uploader',
templateUrl: 'file-uploader.component.html',
styleUrls: ['file-uploader.component.scss'],
})
export class FileUploaderComponent implements OnInit {
@Output()
filesUploaded: EventEmitter<Modification[]> = new EventEmitter();
@Input()
disabled: boolean;
startUploading$ = this.fileUploaderService.startUploading$;
inProgress$ = this.fileUploaderService.inProgress$;
constructor(private fileUploaderService: FileUploaderService) {}
ngOnInit(): void {
this.fileUploaderService.filesUploaded$.subscribe((values) =>
this.filesUploaded.emit(
values.map((v) => this.fileUploaderService.createModification(v))
)
);
}
startUploading(files: File[]) {
this.startUploading$.next(files);
}
}

View File

@ -1,25 +0,0 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FlexModule } from '@angular/flex-layout';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { ngfModule } from 'angular-file';
import { FileStorageModule } from '../../../../thrift-services/file-storage';
import { FileUploaderComponent } from './file-uploader.component';
import { FileUploaderService } from './file-uploader.service';
@NgModule({
imports: [
FlexModule,
ngfModule,
CommonModule,
MatIconModule,
MatButtonModule,
FileStorageModule,
],
exports: [FileUploaderComponent],
declarations: [FileUploaderComponent],
providers: [FileUploaderService],
})
export class FileUploaderModule {}

View File

@ -1,91 +0,0 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { MatSnackBar } from '@angular/material/snack-bar';
import * as moment from 'moment';
import { forkJoin, merge, Observable, of, Subject } from 'rxjs';
import { catchError, filter, map, shareReplay, switchMap } from 'rxjs/operators';
import { progress } from '@cc/app/shared/custom-operators';
import { Modification } from '../../../../thrift-services/damsel/gen-model/claim_management';
import { FileStorageService } from '../../../../thrift-services/file-storage/file-storage.service';
import { NewFileResult } from '../../../../thrift-services/file-storage/gen-model/file_storage';
import { Value } from '../../../../thrift-services/file-storage/gen-model/msgpack';
@Injectable()
export class FileUploaderService {
startUploading$ = new Subject<File[]>();
filesUploadingError$ = new Subject<null>();
filesUploaded$: Observable<string[]> = this.startUploading$.pipe(
switchMap((files) =>
this.uploadFiles(files).pipe(
catchError(() => {
this.filesUploadingError$.next(null);
return of([]);
})
)
),
filter((v) => !!v.length),
shareReplay(1)
);
inProgress$: Observable<boolean> = progress(
this.startUploading$,
merge(this.filesUploaded$, this.filesUploadingError$)
);
constructor(
private fileStorageService: FileStorageService,
private snackBar: MatSnackBar,
private http: HttpClient
) {
this.filesUploadingError$.subscribe(() => this.snackBar.open('File uploading error', 'OK'));
}
uploadFiles(files: File[]): Observable<string[]> {
return forkJoin(
files.map((file) =>
this.getUploadLink().pipe(
switchMap((uploadData) =>
forkJoin([
of(uploadData.file_data_id),
this.uploadFileToUrl(file, uploadData.upload_url),
])
),
map(([fileId]) => fileId)
)
)
);
}
createModification(id: string): Modification {
return {
claim_modification: {
file_modification: {
id,
modification: {
creation: {},
},
},
},
};
}
private getUploadLink(): Observable<NewFileResult> {
return this.fileStorageService.createNewFile(
new Map<string, Value>(),
moment().add(1, 'h').toISOString()
);
}
private uploadFileToUrl(file: File, url: string): Observable<unknown> {
return this.http.put(url, file, {
headers: {
'Content-Disposition': `attachment;filename=${encodeURI(file.name)}`,
'Content-Type': '',
},
});
}
}

View File

@ -1,29 +0,0 @@
import { Injectable } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { combineLatest, ConnectableObservable, of } from 'rxjs';
import { map, pluck, publishReplay, switchMap } from 'rxjs/operators';
import { AnkService } from '../../../thrift-services/ank/ank.service';
import { Questionary } from '../../../thrift-services/ank/gen-model/questionary_manager';
import { ConversationService } from './conversation.service';
import { TimelineAction } from './to-timeline-info/model';
@Injectable()
export class QuestionaryService {
questionary$ = this.conversationService.timelineInfos$.pipe(
map((timelineInfos) => timelineInfos.find((i) => i.action === TimelineAction.changesAdded)),
pluck('modifications', 0, 'claim_modification', 'document_modification', 'id'),
switchMap((id) => combineLatest([of(id), this.route.params.pipe(pluck('party_id'))])),
switchMap(([questId, partyId]) => this.ankService.get(questId, partyId)),
pluck('questionary'),
publishReplay(1)
) as ConnectableObservable<Questionary>;
constructor(
private conversationService: ConversationService,
private ankService: AnkService,
private route: ActivatedRoute
) {
this.questionary$.connect();
}
}

View File

@ -1,20 +0,0 @@
import { Pipe, PipeTransform } from '@angular/core';
import { AuthorityConfirmingDocumentType } from '../../../../model/questionary';
const AUTHORITY_CONFIRMING_DOCUMENT_TITLE_BY_TYPE: {
[N in AuthorityConfirmingDocumentType]: string;
} = {
meetingOfParticipants: 'Протокол общего собрания акционеров',
meetingOfShareholders: 'Протокол общего собрания участников',
solePartyDecision: 'Решение единственного участника',
};
@Pipe({
name: 'authorityConfirmingDocumentTitle',
})
export class AuthorityConfirmingDocumentTitlePipe implements PipeTransform {
transform(type: AuthorityConfirmingDocumentType | string): string {
return AUTHORITY_CONFIRMING_DOCUMENT_TITLE_BY_TYPE[type] || type;
}
}

View File

@ -1,16 +0,0 @@
<div fxLayout="column" fxLayoutGap="10px">
<cc-details-item title="Наименование банка">
{{ bankAccount?.bank_name | emptyDefault }}
</cc-details-item>
<div fxLayout fxLayoutGap="10px">
<cc-details-item title="БИК" fxFlex>
{{ bankAccount?.bank_bik | emptyDefault }}
</cc-details-item>
<cc-details-item title="Корреспондентский счет" fxFlex>
{{ bankAccount?.bank_post_account | emptyDefault }}
</cc-details-item>
</div>
<cc-details-item title="Расчетный счет">
{{ bankAccount?.account | emptyDefault }}
</cc-details-item>
</div>

View File

@ -1,12 +0,0 @@
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { RussianBankAccount } from '../../../../../thrift-services/ank/gen-model/questionary';
@Component({
selector: 'cc-bank-account-info',
templateUrl: 'bank-account-info.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class BankAccountInfoComponent {
@Input() bankAccount: RussianBankAccount;
}

View File

@ -1 +0,0 @@
export * from './bank-account-info.component';

View File

@ -1,98 +0,0 @@
<div fxLayout="column" fxLayoutGap="10px">
<cc-details-item title="Процент владения капиталом юридического лица">
{{ beneficialOwner?.ownership_percentage | emptyDefault }}
</cc-details-item>
<mat-divider></mat-divider>
<cc-private-entity-info
[privateEntity]="beneficialOwner?.russian_private_entity"
></cc-private-entity-info>
<mat-divider></mat-divider>
<cc-identity-document-info
[identityDocument]="beneficialOwner?.identity_document?.russian_domestic_password"
></cc-identity-document-info>
<mat-divider></mat-divider>
<cc-details-item title="Номер миграционной карты">
{{ beneficialOwner?.migration_card_info?.card_number | emptyDefault }}
</cc-details-item>
<div fxLayout fxLayoutGap="10px">
<cc-details-item title="Дата начала срока пребывания в РФ" fxFlex>{{
beneficialOwner?.migration_card_info?.beginning_date | date | emptyDefault
}}</cc-details-item>
<cc-details-item title="Дата окончания срока пребывания в РФ" fxFlex>{{
beneficialOwner?.migration_card_info?.expiration_date | date | emptyDefault
}}</cc-details-item>
</div>
<mat-divider></mat-divider>
<cc-details-item
title="Документ, подтверждающего право иностранного гражданина или лица без гражданства на пребывание (проживание) в РФ"
>
{{ beneficialOwner?.residence_approve?.name | emptyDefault }}
</cc-details-item>
<div fxLayout fxLayoutGap="10px">
<cc-details-item title="Серия" fxFlex>
{{ beneficialOwner?.residence_approve?.series | emptyDefault }}
</cc-details-item>
<cc-details-item title="Номер" fxFlex>
{{ beneficialOwner?.residence_approve?.number | emptyDefault }}
</cc-details-item>
</div>
<div fxLayout fxLayoutGap="10px">
<cc-details-item title="Дата начала срока действия" fxFlex>{{
beneficialOwner?.residence_approve?.beginning_date | date | emptyDefault
}}</cc-details-item>
<cc-details-item title="Дата окончания срока действия" fxFlex>{{
beneficialOwner?.residence_approve?.expiration_date | date | emptyDefault
}}</cc-details-item>
</div>
<mat-divider></mat-divider>
<div fxLayout fxLayoutGap="10px">
<cc-details-item title="ИНН" fxFlex>{{
beneficialOwner?.inn | emptyDefault
}}</cc-details-item>
<cc-details-item title="СНИЛС" fxFlex>{{
beneficialOwner?.snils | emptyDefault
}}</cc-details-item>
</div>
<mat-divider></mat-divider>
<cc-contact-info
[contactInfo]="beneficialOwner?.russian_private_entity?.contact_info"
></cc-contact-info>
<mat-divider></mat-divider>
<cc-pdl-info [pdl]="beneficialOwner"></cc-pdl-info>
<div fxLayout fxLayoutGap="10px">
<cc-details-item
title="Является ли бенефициарный владелец налогоплательщиком/налоговым резидентом США?"
fxFlex
>
{{
beneficialOwner?.residency_info?.individual_residency_info?.usa_tax_resident
| yesNo
| emptyDefault
}}
</cc-details-item>
<cc-details-item
title="Является ли бенефициарный владелец налогоплательщиком/налоговым резидентом иного иностранного государства (кроме США)?"
fxFlex
>
{{
beneficialOwner?.residency_info?.individual_residency_info?.except_usa_tax_resident
| yesNo
| emptyDefault
}}
</cc-details-item>
</div>
</div>

View File

@ -1,12 +0,0 @@
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { BeneficialOwner } from '../../../../../thrift-services/ank/gen-model/questionary';
@Component({
selector: 'cc-beneficial-owner-info',
templateUrl: 'beneficial-owner-info.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class BeneficialOwnerInfoComponent {
@Input() beneficialOwner: BeneficialOwner;
}

View File

@ -1 +0,0 @@
export * from './beneficial-owner-info.component';

View File

@ -1,8 +0,0 @@
<div fxLayout fxLayoutGap="10px">
<cc-details-item fxFlex title="Email">
{{ contactInfo?.email | emptyDefault }}
</cc-details-item>
<cc-details-item fxFlex title="Телефон">
{{ contactInfo?.phone_number | emptyDefault }}
</cc-details-item>
</div>

View File

@ -1,12 +0,0 @@
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { ContactInfo } from '../../../../../thrift-services/ank/gen-model/questionary';
@Component({
selector: 'cc-contact-info',
templateUrl: 'contact-info.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ContactInfoComponent {
@Input() contactInfo: ContactInfo;
}

View File

@ -1 +0,0 @@
export * from './contact-info.component';

View File

@ -1,11 +0,0 @@
import { Pipe, PipeTransform } from '@angular/core';
import isNil from 'lodash-es/isNil';
@Pipe({
name: 'emptyDefault',
})
export class EmptyDefaultPipe implements PipeTransform {
transform(value: any): string {
return isNil(value) || value === '' ? '-' : value;
}
}

View File

@ -1,16 +0,0 @@
<div fxLayout="column" fxLayoutGap="10px">
<div fxLayout fxLayoutGap="10px">
<cc-details-item title="Серия и номер" fxFlex>
{{ identityDocument?.series_number | emptyDefault }}
</cc-details-item>
<cc-details-item title="Код подразделения" fxFlex>
{{ identityDocument?.issuer_code | emptyDefault }}
</cc-details-item>
</div>
<cc-details-item title="Дата выдачи" fxFlex>
{{ identityDocument?.issued_at | emptyDefault }}
</cc-details-item>
<cc-details-item title="Кем выдан" fxFlex>
{{ identityDocument?.issuer | emptyDefault }}
</cc-details-item>
</div>

View File

@ -1,12 +0,0 @@
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { RussianDomesticPassport } from '../../../../../thrift-services/ank/gen-model/questionary';
@Component({
selector: 'cc-identity-document-info',
templateUrl: 'identity-document-info.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class IdentityDocumentInfoComponent {
@Input() identityDocument: RussianDomesticPassport;
}

View File

@ -1 +0,0 @@
export * from './identity-document-info.component';

View File

@ -1 +0,0 @@
export * from './questionary.component';

View File

@ -1 +0,0 @@
export * from './individual-entity-info.component';

View File

@ -1,15 +0,0 @@
<div fxLayout="column" fxLayoutGap="10px">
<cc-private-entity-info
[privateEntity]="individualEntity?.russian_private_entity"
></cc-private-entity-info>
<mat-divider></mat-divider>
<cc-identity-document-info
[identityDocument]="individualEntity?.identity_document?.russian_domestic_password"
></cc-identity-document-info>
<mat-divider></mat-divider>
<cc-pdl-info [pdl]="individualEntity"></cc-pdl-info>
</div>

View File

@ -1,12 +0,0 @@
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { RussianIndividualEntity } from '../../../../../thrift-services/ank/gen-model/questionary';
@Component({
selector: 'cc-individual-entity-info',
templateUrl: 'individual-entity-info.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class IndividualEntityInfoComponent {
@Input() individualEntity: RussianIndividualEntity;
}

View File

@ -1 +0,0 @@
export * from './legal-owner-info.component';

View File

@ -1,45 +0,0 @@
<div fxLayout="column" fxLayoutGap="10px">
<cc-private-entity-info
[privateEntity]="legalOwnerInfo.russian_private_entity"
></cc-private-entity-info>
<mat-divider></mat-divider>
<div fxLayout fxLayoutGap="10px">
<cc-details-item title="ИНН" fxFlex>{{
legalOwnerInfo.inn | emptyDefault
}}</cc-details-item>
<cc-details-item title="СНИЛС" fxFlex>{{
legalOwnerInfo.snils | emptyDefault
}}</cc-details-item>
</div>
<mat-divider></mat-divider>
<div fxLayout fxLayoutGap="10px">
<cc-details-item title="Должность" fxFlex>{{
legalOwnerInfo.head_position | emptyDefault
}}</cc-details-item>
<cc-details-item title="Срок полномочий" fxFlex>{{
legalOwnerInfo.term_of_office | emptyDefault
}}</cc-details-item>
</div>
<mat-divider></mat-divider>
<cc-pdl-info [pdl]="legalOwnerInfo"></cc-pdl-info>
<cc-details-item title="Действует на основании" fxFlex>
{{
legalOwnerInfo.authority_confirming_document?.type
| authorityConfirmingDocumentTitle
| emptyDefault
}}
</cc-details-item>
<mat-divider></mat-divider>
<cc-identity-document-info
[identityDocument]="legalOwnerInfo.identity_document?.russian_domestic_password"
></cc-identity-document-info>
</div>

View File

@ -1,11 +0,0 @@
import { Component, Input } from '@angular/core';
import { LegalOwnerInfo } from '../../../../../thrift-services/ank/gen-model/questionary';
@Component({
selector: 'cc-legal-owner-info',
templateUrl: 'legal-owner-info.component.html',
})
export class LegalOwnerInfoComponent {
@Input() legalOwnerInfo: LegalOwnerInfo;
}

View File

@ -1,3 +0,0 @@
export * from './organization-info.component';
export * from './international-entity';
export * from './russian-entity';

View File

@ -1 +0,0 @@
export * from './international-entity.component';

View File

@ -1,19 +0,0 @@
<div fxLayout="column" fxLayoutGap="10px">
<div fxLayout fxLayoutGap="10px">
<cc-details-item title="Legal name" fxFlex>{{
entity?.legal_name | emptyDefault
}}</cc-details-item>
<cc-details-item title="Trading name" fxFlex>{{
entity?.trading_name | emptyDefault
}}</cc-details-item>
</div>
<cc-details-item title="Registered address">
{{ entity?.registered_address | emptyDefault }}
</cc-details-item>
<cc-details-item title="Actual address">
{{ entity?.actual_address | emptyDefault }}
</cc-details-item>
<cc-details-item title="Registered number">
{{ entity?.registered_number | emptyDefault }}
</cc-details-item>
</div>

View File

@ -1,12 +0,0 @@
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { InternationalLegalEntity } from '../../../../../../thrift-services/ank/gen-model/questionary';
@Component({
selector: 'cc-international-entity',
templateUrl: 'international-entity.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class InternationalEntityComponent {
@Input() entity: InternationalLegalEntity;
}

View File

@ -1,7 +0,0 @@
<div class="cc-organization-info">
<cc-international-entity
*ngIf="isInternationalLegalEntity"
[entity]="entity"
></cc-international-entity>
<cc-russian-entity *ngIf="!isInternationalLegalEntity" [entity]="entity"></cc-russian-entity>
</div>

View File

@ -1,22 +0,0 @@
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { getUnionValue } from '@cc/utils/get-union-key';
import { Contractor } from '../../../../../thrift-services/ank/gen-model/questionary';
@Component({
selector: 'cc-organization-info',
templateUrl: 'organization-info.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class OrganizationInfoComponent {
@Input() contractor: Contractor;
get entity() {
return getUnionValue(getUnionValue(this.contractor)) as any;
}
get isInternationalLegalEntity() {
return !!this.contractor?.legal_entity?.international_legal_entity;
}
}

View File

@ -1 +0,0 @@
export * from './russian-entity.component';

View File

@ -1,58 +0,0 @@
<div fxLayout="column" fxLayoutGap="10px">
<div fxLayout fxLayoutGap="10px">
<cc-details-item title="Имя" fxFlex>{{ entity?.name | emptyDefault }}</cc-details-item>
<cc-details-item title="ИНН" fxFlex>{{ entity?.inn | emptyDefault }}</cc-details-item>
</div>
<cc-details-item title="Адрес регистрации">
{{ registrationAddress | emptyDefault }}
</cc-details-item>
<mat-divider></mat-divider>
<cc-details-item title="Штатная численность организации">
{{ entity?.additional_info?.staff_count | emptyDefault }}
</cc-details-item>
<div fxLayout fxLayoutGap="10px">
<cc-details-item title="Наличие в штате главного бухгалтера" fxFlex>
{{
!!entity?.additional_info?.accountant_info?.with_chief_accountant
| yesNo
| emptyDefault
}}
</cc-details-item>
<cc-details-item title="Бухгалтерский учет осуществляет" fxFlex>
{{ accountantType | emptyDefault }}
</cc-details-item>
<cc-details-item title="ИНН организации, ведущей бухгалтерский учет" fxFlex>
{{
entity?.additional_info?.accountant_info?.without_chief_accountant
?.accounting_organization?.inn | emptyDefault
}}
</cc-details-item>
</div>
<mat-divider></mat-divider>
<div fxLayout fxLayoutGap="10px">
<cc-details-item fxFlex title="Наличие выгодоприобретателя">
{{ entity?.additional_info?.has_beneficiary | yesNo | emptyDefault }}
</cc-details-item>
<cc-details-item
fxFlex
title="Наличие решений о ликвидации или о любой процедуре, применяемой в деле о банкротстве"
>
{{ entity?.additional_info?.has_liquidation_process | yesNo | emptyDefault }}
</cc-details-item>
</div>
<mat-divider></mat-divider>
<div fxLayout fxLayoutGap="10px">
<cc-details-item fxFlex title="Планируемое количество операций в месяц">
{{ entity?.additional_info?.month_operation_count | emptyDefault }}
</cc-details-item>
<cc-details-item fxFlex title="Планируемая сумма операций в месяц">
{{ entity?.additional_info?.month_operation_sum | emptyDefault }}
</cc-details-item>
</div>
</div>

View File

@ -1,42 +0,0 @@
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import get from 'lodash-es/get';
import { getUnionKey } from '@cc/utils/get-union-key';
import {
RussianIndividualEntity,
RussianLegalEntity,
WithoutChiefAccountant,
} from '../../../../../../thrift-services/ank/gen-model/questionary';
const WITHOUT_CHIEF_ACCOUNTANT_TITLES: { [name in keyof WithoutChiefAccountant]: string } = {
accounting_organization: 'Организация ведущая бухгалтерский учет',
head_accounting: 'Руководитель организации',
individual_accountant: 'Бухгалтер - индивидуальный специалист',
};
@Component({
selector: 'cc-russian-entity',
templateUrl: 'russian-entity.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class RussianEntityComponent {
@Input() entity: RussianLegalEntity | RussianIndividualEntity;
get registrationAddress() {
if (this.entity?.registration_info?.individual_registration_info) {
return this.entity.registration_info.individual_registration_info.registration_place;
} else if (this.entity?.registration_info?.legal_registration_info) {
return this.entity.registration_info.legal_registration_info.registration_address;
}
return '';
}
get accountantType() {
return WITHOUT_CHIEF_ACCOUNTANT_TITLES[
getUnionKey(
get(this.entity, ['additional_info', 'accountant_info', 'without_chief_accountant'])
)
];
}
}

View File

@ -1 +0,0 @@
export * from './pdl-info.component';

View File

@ -1,8 +0,0 @@
<div fxLayout fxLayoutGap="10px">
<cc-details-item title="Принадлежность к категории ПДЛ" fxFlex>{{
pdl?.pdl_category | yesNo | emptyDefault
}}</cc-details-item>
<cc-details-item title="Степень родства ПДЛ" fxFlex>{{
pdl?.pdl_relation_degree | emptyDefault
}}</cc-details-item>
</div>

View File

@ -1,11 +0,0 @@
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
@Component({
selector: 'cc-pdl-info',
templateUrl: 'pdl-info.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class PdlInfoComponent {
@Input()
pdl: { pdl_category: string; pdl_relation_degree: string };
}

Some files were not shown because too many files have changed in this diff Show More