From 4b4c536d7780c7b4d099dafdc99c3557d0d601ca Mon Sep 17 00:00:00 2001 From: David Heitzer Date: Tue, 20 Sep 2022 10:22:24 -0400 Subject: [PATCH] 538 initial dev/local testing --- .../contact-lookup.component.ts | 16 ++++++++------ .../transaction-type-base.component.spec.ts | 22 +++++++++++++++++++ .../transaction-type-base.component.ts | 1 + .../transaction-group-a.component.html | 3 --- .../transaction-group-b.component.html | 4 ---- .../transaction-group-c.component.html | 4 ---- .../transaction-group-d.component.html | 3 --- .../transaction-group-f.component.html | 16 ++++++-------- 8 files changed, 39 insertions(+), 30 deletions(-) diff --git a/front-end/src/app/shared/components/contact-lookup/contact-lookup.component.ts b/front-end/src/app/shared/components/contact-lookup/contact-lookup.component.ts index 48cad247dd..36cf95fde4 100644 --- a/front-end/src/app/shared/components/contact-lookup/contact-lookup.component.ts +++ b/front-end/src/app/shared/components/contact-lookup/contact-lookup.component.ts @@ -14,11 +14,13 @@ export class ContactLookupComponent { @Input() contactTypeOptions: PrimeOptions = []; @Input() contactTypeInputId = 'entity_type'; @Input() contactTypeFormControl: FormControl = new FormControl(); - @Input() contactTypeReadOnly = true; + @Input() contactTypeReadOnly = false; @Input() contactTypeStyleClass = ""; - @Input() maxFecResults = 10; - @Input() maxFecfileResults = 10; + @Input() maxFecCommitteeResults = 5; + @Input() maxFecfileCommitteeResults = 5; + @Input() maxFecfileIndividualResults = 10; + @Input() maxFecfileOrganizationResults = 10; @Output() fecfileContactSelect = new EventEmitter>(); @@ -49,22 +51,22 @@ export class ContactLookupComponent { switch (this.contactTypeFormControl.value) { case ContactTypes.COMMITTEE: this.contactService.committeeLookup( - searchTerm, this.maxFecResults, - this.maxFecfileResults).subscribe((response) => { + searchTerm, this.maxFecCommitteeResults, + this.maxFecfileCommitteeResults).subscribe((response) => { this.contactLookupList = response && response.toSelectItemGroups(); }); break; case ContactTypes.INDIVIDUAL: this.contactService.individualLookup(searchTerm, - this.maxFecfileResults).subscribe((response) => { + this.maxFecfileIndividualResults).subscribe((response) => { this.contactLookupList = response && response.toSelectItemGroups(); }); break; case ContactTypes.ORGANIZATION: this.contactService.organizationLookup(searchTerm, - this.maxFecfileResults).subscribe((response) => { + this.maxFecfileOrganizationResults).subscribe((response) => { this.contactLookupList = response && response.toSelectItemGroups(); }); diff --git a/front-end/src/app/shared/components/transaction-type-base/transaction-type-base.component.spec.ts b/front-end/src/app/shared/components/transaction-type-base/transaction-type-base.component.spec.ts index 69cc9b3059..87bb3f8896 100644 --- a/front-end/src/app/shared/components/transaction-type-base/transaction-type-base.component.spec.ts +++ b/front-end/src/app/shared/components/transaction-type-base/transaction-type-base.component.spec.ts @@ -314,4 +314,26 @@ describe('TransactionTypeBaseComponent', () => { testOrganizationName).toBeTrue(); }); + it('#onContactLookupSelect COMMITTEE should set fields', () => { + const testEntityType = ContactTypes.COMMITTEE; + const testCommitteeName = 'testCommitteeName'; + const testContact = new Contact(); + testContact.id = '123'; + testContact.type = ContactTypes.COMMITTEE; + testContact.name = testCommitteeName; + + const testContactSelectItem: SelectItem = + { + value: testContact, + } + + component.form.addControl('entity_type', { value: testEntityType }); + component.onContactLookupSelect(testContactSelectItem); + const committeeNameFormControlValue = + component.form.get('contributor_organization_name')?.value; + + expect(committeeNameFormControlValue === + testCommitteeName).toBeTrue(); + }); + }); diff --git a/front-end/src/app/shared/components/transaction-type-base/transaction-type-base.component.ts b/front-end/src/app/shared/components/transaction-type-base/transaction-type-base.component.ts index a75571797d..05bca7fc21 100644 --- a/front-end/src/app/shared/components/transaction-type-base/transaction-type-base.component.ts +++ b/front-end/src/app/shared/components/transaction-type-base/transaction-type-base.component.ts @@ -172,6 +172,7 @@ export abstract class TransactionTypeBaseComponent implements OnInit, OnDestroy this.form.get('contributor_prefix')?.setValue(value.prefix); this.form.get('contributor_suffix')?.setValue(value.suffix); break; + case ContactTypes.COMMITTEE: case ContactTypes.ORGANIZATION: this.form.get('contributor_organization_name')?.setValue(value.name); break; diff --git a/front-end/src/app/transactions/transaction-group-a/transaction-group-a.component.html b/front-end/src/app/transactions/transaction-group-a/transaction-group-a.component.html index e5780ec67d..abee8447f2 100644 --- a/front-end/src/app/transactions/transaction-group-a/transaction-group-a.component.html +++ b/front-end/src/app/transactions/transaction-group-a/transaction-group-a.component.html @@ -8,13 +8,10 @@

Contributor

diff --git a/front-end/src/app/transactions/transaction-group-b/transaction-group-b.component.html b/front-end/src/app/transactions/transaction-group-b/transaction-group-b.component.html index 844ccdac4d..4647bd1bf0 100644 --- a/front-end/src/app/transactions/transaction-group-b/transaction-group-b.component.html +++ b/front-end/src/app/transactions/transaction-group-b/transaction-group-b.component.html @@ -9,12 +9,8 @@

Contributor

diff --git a/front-end/src/app/transactions/transaction-group-c/transaction-group-c.component.html b/front-end/src/app/transactions/transaction-group-c/transaction-group-c.component.html index c69e36cf54..bd65c37a57 100644 --- a/front-end/src/app/transactions/transaction-group-c/transaction-group-c.component.html +++ b/front-end/src/app/transactions/transaction-group-c/transaction-group-c.component.html @@ -9,12 +9,8 @@

Contributor

diff --git a/front-end/src/app/transactions/transaction-group-d/transaction-group-d.component.html b/front-end/src/app/transactions/transaction-group-d/transaction-group-d.component.html index 822711864b..77bc0daef0 100644 --- a/front-end/src/app/transactions/transaction-group-d/transaction-group-d.component.html +++ b/front-end/src/app/transactions/transaction-group-d/transaction-group-d.component.html @@ -9,13 +9,10 @@

Contributor

diff --git a/front-end/src/app/transactions/transaction-group-f/transaction-group-f.component.html b/front-end/src/app/transactions/transaction-group-f/transaction-group-f.component.html index fa53ea8fd5..b74d7e7853 100644 --- a/front-end/src/app/transactions/transaction-group-f/transaction-group-f.component.html +++ b/front-end/src/app/transactions/transaction-group-f/transaction-group-f.component.html @@ -8,15 +8,13 @@

Contributor

- + +