mirror of
https://github.com/valitydev/dashboard.git
synced 2024-11-06 02:25:23 +00:00
FR-724: Select payment institution (#559)
This commit is contained in:
parent
2754370cda
commit
849cf88f93
@ -1,2 +0,0 @@
|
||||
export * from './payment-institution-autocomplete-field.component';
|
||||
export * from './payment-institution-autocomplete-field.module';
|
@ -1,16 +0,0 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
|
||||
import { SelectSearchFieldModule } from '@dsh/components/form-controls/select-search-field';
|
||||
|
||||
import { PaymentInstitutionAutocompleteFieldComponent } from './payment-institution-autocomplete-field.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule, MatInputModule, MatFormFieldModule, ReactiveFormsModule, SelectSearchFieldModule],
|
||||
declarations: [PaymentInstitutionAutocompleteFieldComponent],
|
||||
exports: [PaymentInstitutionAutocompleteFieldComponent],
|
||||
})
|
||||
export class PaymentInstitutionAutocompleteFieldModule {}
|
@ -0,0 +1,2 @@
|
||||
export * from './payment-institution-field.component';
|
||||
export * from './payment-institution-field.module';
|
@ -1,5 +1,6 @@
|
||||
<dsh-select-search-field
|
||||
[label]="label"
|
||||
*transloco="let t; scope: 'payment-institution-field'; read: 'paymentInstitutionField'"
|
||||
[label]="label || t('label')"
|
||||
[required]="required"
|
||||
[options]="options$ | async"
|
||||
[formControl]="formControl"
|
@ -9,12 +9,12 @@ import { Option } from '@dsh/components/form-controls/select-search-field';
|
||||
import { coerceBoolean } from '@dsh/utils';
|
||||
|
||||
@Component({
|
||||
selector: 'dsh-payment-institution-autocomplete-field',
|
||||
templateUrl: 'payment-institution-autocomplete-field.component.html',
|
||||
providers: [provideValueAccessor(PaymentInstitutionAutocompleteFieldComponent)],
|
||||
selector: 'dsh-payment-institution-field',
|
||||
templateUrl: 'payment-institution-field.component.html',
|
||||
providers: [provideValueAccessor(PaymentInstitutionFieldComponent)],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class PaymentInstitutionAutocompleteFieldComponent extends WrappedFormControlSuperclass<PaymentInstitution> {
|
||||
export class PaymentInstitutionFieldComponent extends WrappedFormControlSuperclass<PaymentInstitution> {
|
||||
@Input() label: string;
|
||||
@Input() @coerceBoolean required = false;
|
||||
|
@ -0,0 +1,24 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { TranslocoModule } from '@ngneat/transloco';
|
||||
|
||||
import { SelectSearchFieldModule } from '@dsh/components/form-controls/select-search-field';
|
||||
|
||||
import { PaymentInstitutionFieldComponent } from './payment-institution-field.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
MatInputModule,
|
||||
MatFormFieldModule,
|
||||
ReactiveFormsModule,
|
||||
SelectSearchFieldModule,
|
||||
TranslocoModule,
|
||||
],
|
||||
declarations: [PaymentInstitutionFieldComponent],
|
||||
exports: [PaymentInstitutionFieldComponent],
|
||||
})
|
||||
export class PaymentInstitutionFieldModule {}
|
@ -35,15 +35,17 @@
|
||||
[label]="t('country')"
|
||||
formControlName="country"
|
||||
></dsh-country-autocomplete-field>
|
||||
|
||||
<dsh-payment-institution-autocomplete-field
|
||||
[label]="t('paymentInstitution')"
|
||||
formControlName="paymentInstitution"
|
||||
></dsh-payment-institution-autocomplete-field>
|
||||
</div>
|
||||
|
||||
<mat-divider></mat-divider>
|
||||
|
||||
<dsh-payment-institution-field
|
||||
[label]="t('paymentInstitution')"
|
||||
formControlName="paymentInstitution"
|
||||
></dsh-payment-institution-field>
|
||||
|
||||
<mat-divider></mat-divider>
|
||||
|
||||
<h2 class="dsh-title">{{ t('payoutToolTitle') }}</h2>
|
||||
|
||||
<dsh-payout-tool-form [form]="payoutTool"></dsh-payout-tool-form>
|
||||
|
@ -12,7 +12,7 @@ import { TranslocoModule } from '@ngneat/transloco';
|
||||
import { BaseDialogModule } from '@dsh/app/shared/components/dialog/base-dialog';
|
||||
import { CategoryAutocompleteFieldModule } from '@dsh/app/shared/components/inputs/category-autocomplete-field/category-autocomplete-field.module';
|
||||
import { CountryAutocompleteFieldModule } from '@dsh/app/shared/components/inputs/country-autocomplete-field';
|
||||
import { PaymentInstitutionAutocompleteFieldModule } from '@dsh/app/shared/components/inputs/payment-institution-autocomplete-field';
|
||||
import { PaymentInstitutionFieldModule } from '@dsh/app/shared/components/inputs/payment-institution-field';
|
||||
import { ShopDetailsFormModule } from '@dsh/app/shared/components/shop-creation/shop-details-form';
|
||||
import { CountryCodesModule } from '@dsh/app/shared/services';
|
||||
import { ButtonModule } from '@dsh/components/buttons';
|
||||
@ -39,7 +39,7 @@ import { InternationalShopFormControllerService } from './services/international
|
||||
BaseDialogModule,
|
||||
CountryAutocompleteFieldModule,
|
||||
CategoryAutocompleteFieldModule,
|
||||
PaymentInstitutionAutocompleteFieldModule,
|
||||
PaymentInstitutionFieldModule,
|
||||
MatSelectModule,
|
||||
ShopDetailsFormModule,
|
||||
],
|
||||
|
@ -6,6 +6,8 @@
|
||||
>
|
||||
<dsh-shop-details-form formControlName="shopDetails"></dsh-shop-details-form>
|
||||
<mat-divider></mat-divider>
|
||||
<dsh-payment-institution-field formControlName="paymentInstitution"></dsh-payment-institution-field>
|
||||
<mat-divider></mat-divider>
|
||||
<dsh-org-details-form formControlName="orgDetails"></dsh-org-details-form>
|
||||
<mat-divider></mat-divider>
|
||||
|
||||
|
@ -2,7 +2,6 @@ import { Component, Injector, ChangeDetectionStrategy, OnInit } from '@angular/c
|
||||
import { FormBuilder } from '@ngneat/reactive-forms';
|
||||
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
|
||||
|
||||
import { Shop } from '@dsh/api-codegen/capi';
|
||||
import {
|
||||
createValidatedAbstractControlProviders,
|
||||
getFormValueChanges,
|
||||
@ -28,8 +27,8 @@ export class ShopFormComponent extends ValidatedWrappedAbstractControlSuperclass
|
||||
orgDetails: null,
|
||||
bankAccount: null,
|
||||
payoutTool: null,
|
||||
paymentInstitution: null,
|
||||
});
|
||||
bankShopControl = this.fb.control<Shop>(null);
|
||||
bankAccountType = BankAccountType;
|
||||
|
||||
constructor(injector: Injector, private fb: FormBuilder) {
|
||||
|
@ -9,19 +9,20 @@ import { MatRadioModule } from '@angular/material/radio';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { TranslocoModule } from '@ngneat/transloco';
|
||||
|
||||
import { KonturFocusModule } from '@dsh/api';
|
||||
import { ClaimsModule } from '@dsh/api/claims';
|
||||
import { ContractorDetailsModule } from '@dsh/app/shared';
|
||||
import { PayoutToolDetailsModule } from '@dsh/app/shared/components';
|
||||
import { BaseDialogModule } from '@dsh/app/shared/components/dialog/base-dialog';
|
||||
import { PaymentInstitutionFieldModule } from '@dsh/app/shared/components/inputs/payment-institution-field';
|
||||
import { ShopFieldModule } from '@dsh/app/shared/components/inputs/shop-field';
|
||||
import { ShopDetailsFormModule } from '@dsh/app/shared/components/shop-creation/shop-details-form/shop-details-form.module';
|
||||
import { ButtonModule } from '@dsh/components/buttons';
|
||||
import { FormatInputModule } from '@dsh/components/form-controls';
|
||||
import { DetailsItemModule } from '@dsh/components/layout';
|
||||
|
||||
import { KonturFocusModule } from '../../../../api';
|
||||
import { DaDataModule } from '../../../../dadata';
|
||||
import { ShopPayoutToolDetailsService } from '../../../../sections/payment-section/integrations/shops/services/shop-payout-tool-details/shop-payout-tool-details.service';
|
||||
import { ContractorDetailsModule } from './../../api-model-details/contractor-details/contractor-details.module';
|
||||
import { ExistingBankAccountComponent } from './components/existing-bank-account/existing-bank-account.component';
|
||||
import { ExistingContractFormComponent } from './components/existing-contract-form/existing-contract-form.component';
|
||||
import { NewContractorFormComponent } from './components/new-contractor-form/new-contractor-form.component';
|
||||
@ -53,6 +54,7 @@ import { CreateRussianShopEntityService } from './services/create-russian-shop-e
|
||||
ShopDetailsFormModule,
|
||||
KonturFocusModule,
|
||||
ContractorDetailsModule,
|
||||
PaymentInstitutionFieldModule,
|
||||
],
|
||||
declarations: [
|
||||
CreateRussianShopEntityComponent,
|
||||
|
@ -34,6 +34,7 @@ export class CreateRussianShopEntityService {
|
||||
orgDetails: { contract, newContractor },
|
||||
payoutTool,
|
||||
bankAccount,
|
||||
paymentInstitution,
|
||||
}: RussianShopForm): PartyModification[] {
|
||||
const contractorID = this.idGenerator.uuid();
|
||||
const contractID = this.idGenerator.uuid();
|
||||
@ -69,7 +70,7 @@ export class CreateRussianShopEntityService {
|
||||
}),
|
||||
createContractCreationModification(contractID, {
|
||||
contractorID,
|
||||
paymentInstitution: { id: contract?.paymentInstitutionID ?? 1 },
|
||||
paymentInstitution: { id: contract?.paymentInstitutionID ?? paymentInstitution?.id ?? 1 },
|
||||
}),
|
||||
];
|
||||
if (!payoutToolID) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { PayoutTool } from '@dsh/api-codegen/capi';
|
||||
import { PaymentInstitution, PayoutTool } from '@dsh/api-codegen/capi';
|
||||
|
||||
import { ShopDetailsForm } from '../../shop-details-form/shop-details-form.component';
|
||||
import { OrgDetailsForm } from '../components/org-details-form/org-details-form.component';
|
||||
@ -9,6 +9,7 @@ export interface RussianShopForm {
|
||||
bankAccountType: BankAccountType;
|
||||
shopDetails: ShopDetailsForm;
|
||||
orgDetails: OrgDetailsForm;
|
||||
paymentInstitution: PaymentInstitution;
|
||||
bankAccount?: RussianBankAccountForm;
|
||||
payoutTool?: PayoutTool;
|
||||
}
|
||||
|
@ -1,12 +1,13 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Translation, TranslocoLoader } from '@ngneat/transloco';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class TranslocoHttpLoaderService implements TranslocoLoader {
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
getTranslation(langPath: string) {
|
||||
return this.http.get<Translation>(`/assets/i18n/${langPath}.json`);
|
||||
getTranslation(lang: string): Observable<Translation> {
|
||||
return this.http.get<Translation>(`/assets/i18n/${lang}.json`);
|
||||
}
|
||||
}
|
||||
|
3
src/assets/i18n/payment-institution-field/en.json
Normal file
3
src/assets/i18n/payment-institution-field/en.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"label": "Payment organization"
|
||||
}
|
3
src/assets/i18n/payment-institution-field/ru.json
Normal file
3
src/assets/i18n/payment-institution-field/ru.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"label": "Платежная организация"
|
||||
}
|
Loading…
Reference in New Issue
Block a user