Move payment adjustments module to section (#234)

This commit is contained in:
Ildar Galeev 2021-01-14 12:20:38 +03:00 committed by GitHub
parent 5bbde6712b
commit 88681edb38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 37 additions and 31 deletions

View File

@ -26,11 +26,11 @@ import { DepositsModule } from './deposits/deposits.module';
import { DomainModule } from './domain';
import icons from './icons.json';
import { NotFoundModule } from './not-found';
import { PaymentAdjustmentModule } from './payment-adjustment/payment-adjustment.module';
import { PayoutsModule } from './payouts/payouts.module';
import { RepairingModule } from './repairing/repairing.module';
import { OperationsModule } from './sections/operations/operations.module';
import { PartyModule } from './sections/party/party.module';
import { PaymentAdjustmentModule } from './sections/payment-adjustment/payment-adjustment.module';
import { SearchClaimsModule } from './sections/search-claims/search-claims.module';
import { SearchPartiesModule } from './sections/search-parties/search-parties.module';
import { SettingsModule } from './settings';

View File

@ -3,7 +3,7 @@ import groupBy from 'lodash-es/groupBy';
import { Observable, Subject, throwError } from 'rxjs';
import { catchError, map, tap } from 'rxjs/internal/operators';
import { PaymentProcessingService } from '../../../thrift-services/damsel/payment-processing.service';
import { PaymentProcessingService } from '../../../../thrift-services/damsel/payment-processing.service';
import { ExecutorService } from '../executor.service';
import { AdjustmentOperationEvent, EventType } from './adjustment-event';
import { ExecResultGroup } from './exec-result-group';

View File

@ -1,7 +1,7 @@
import {
InvoicePaymentAdjustmentParams,
UserInfo,
} from '../../../thrift-services/damsel/gen-model/payment_processing';
} from '../../../../thrift-services/damsel/gen-model/payment_processing';
export interface PaymentAdjustmentCreationParams {
user: UserInfo;

View File

@ -3,7 +3,7 @@ import { MatSnackBar } from '@angular/material/snack-bar';
import forEach from 'lodash-es/forEach';
import groupBy from 'lodash-es/groupBy';
import { InvoicePaymentAdjustmentParams } from '../../../thrift-services/damsel/gen-model/payment_processing';
import { InvoicePaymentAdjustmentParams } from '../../../../thrift-services/damsel/gen-model/payment_processing';
import {
AdjustmentOperationEvent,
BatchPaymentAdjustmentService,

View File

@ -5,12 +5,12 @@ import { MatSnackBar } from '@angular/material/snack-bar';
import { KeycloakService } from 'keycloak-angular';
import { Observable } from 'rxjs';
import { StatPayment } from '../../thrift-services/damsel/gen-model/merch_stat';
import { StatPayment } from '../../../thrift-services/damsel/gen-model/merch_stat';
import {
InvoicePaymentAdjustmentParams,
InvoicePaymentAdjustmentScenario,
UserInfo,
} from '../../thrift-services/damsel/gen-model/payment_processing';
} from '../../../thrift-services/damsel/gen-model/payment_processing';
import {
BatchPaymentAdjustmentService,
CancelAdjustmentService,

View File

@ -1,16 +1,19 @@
import { Component, OnInit } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { MatSnackBar } from '@angular/material/snack-bar';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { StatPayment } from '../thrift-services/damsel/gen-model/merch_stat';
import { StatPayment } from '../../thrift-services/damsel/gen-model/merch_stat';
import { CreateAndCaptureComponent } from './create-and-capture/create-and-capture.component';
import { PaymentAdjustmentService } from './payment-adjustment.service';
import { SearchFormParams } from './search-form/search-form-params';
@UntilDestroy()
@Component({
selector: 'cc-payment-adjustment',
templateUrl: './payment-adjustment.component.html',
styleUrls: ['payment-adjustment.component.scss'],
providers: [PaymentAdjustmentService],
})
export class PaymentAdjustmentComponent implements OnInit {
isLoading = false;
@ -30,9 +33,11 @@ export class PaymentAdjustmentComponent implements OnInit {
) {}
ngOnInit() {
this.paymentAdjustmentService.searchPaymentChanges$.subscribe((payments) => {
this.payments = payments;
});
this.paymentAdjustmentService.searchPaymentChanges$
.pipe(untilDestroyed(this))
.subscribe((payments) => {
this.payments = payments;
});
}
formValueChanges(params: SearchFormParams) {
@ -59,16 +64,19 @@ export class PaymentAdjustmentComponent implements OnInit {
this.payments = [];
this.selectedPayments = [];
this.isLoading = true;
this.paymentAdjustmentService.fetchPayments(this.searchParams).subscribe(
() => {
this.selectedPayments = [];
this.isLoading = false;
},
(e) => {
this.snackBar.open(`${e.message || 'Error'}`, 'OK');
this.isLoading = false;
console.error(e);
}
);
this.paymentAdjustmentService
.fetchPayments(this.searchParams)
.pipe(untilDestroyed(this))
.subscribe(
() => {
this.selectedPayments = [];
this.isLoading = false;
},
(e) => {
this.snackBar.open(`${e.message || 'Error'}`, 'OK');
this.isLoading = false;
console.error(e);
}
);
}
}

View File

@ -25,9 +25,9 @@ import { MatTooltipModule } from '@angular/material/tooltip';
import { ThriftPipesModule } from '@cc/app/shared/pipes';
import { CardContainerModule } from '@cc/components/card-container/card-container.module';
import { DomainModule } from '../domain';
import { PapiModule } from '../papi/papi.module';
import { DamselModule } from '../thrift-services/damsel';
import { DomainModule } from '../../domain';
import { PapiModule } from '../../papi/papi.module';
import { DamselModule } from '../../thrift-services/damsel';
import { ActionItemComponent } from './create-and-capture/action-item/action-item.component';
import { CancelActionsComponent } from './create-and-capture/cancel-actions/cancel-actions.component';
import { CaptureActionsComponent } from './create-and-capture/capture-actions/capture-actions.component';
@ -35,7 +35,6 @@ import { CreateActionsComponent } from './create-and-capture/create-actions/crea
import { CreateAndCaptureComponent } from './create-and-capture/create-and-capture.component';
import { PaymentAdjustmentRoutingModule } from './payment-adjustment-routing.module';
import { PaymentAdjustmentComponent } from './payment-adjustment.component';
import { PaymentAdjustmentService } from './payment-adjustment.service';
import { SearchFormComponent } from './search-form/search-form.component';
import { TableComponent } from './table/table.component';
@ -81,6 +80,5 @@ import { TableComponent } from './table/table.component';
CaptureActionsComponent,
],
entryComponents: [CreateAndCaptureComponent],
providers: [PaymentAdjustmentService],
})
export class PaymentAdjustmentModule {}

View File

@ -2,10 +2,10 @@ import { Injectable } from '@angular/core';
import { Observable, of, Subject } from 'rxjs';
import { mergeMap, shareReplay } from 'rxjs/operators';
import { DomainService } from '../domain';
import { QueryDSL } from '../query-dsl';
import { StatPayment, StatResponse } from '../thrift-services/damsel/gen-model/merch_stat';
import { MerchantStatisticsService } from '../thrift-services/damsel/merchant-statistics.service';
import { DomainService } from '../../domain';
import { QueryDSL } from '../../query-dsl';
import { StatPayment, StatResponse } from '../../thrift-services/damsel/gen-model/merch_stat';
import { MerchantStatisticsService } from '../../thrift-services/damsel/merchant-statistics.service';
import { SearchFormParams } from './search-form/search-form-params';
@Injectable()

View File

@ -14,7 +14,7 @@ import { MatTableDataSource } from '@angular/material/table';
import { i64ToNumber } from '@cc/utils/i64-to-number';
import { StatPayment } from '../../thrift-services/damsel/gen-model/merch_stat';
import { StatPayment } from '../../../thrift-services/damsel/gen-model/merch_stat';
@Component({
selector: 'cc-payment-adjustment-table',