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 474d2f2882..b6b503c546 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 @@ -360,4 +360,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 f0b17f4239..0df33e4de2 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 @@ -173,6 +173,7 @@ export abstract class TransactionTypeBaseComponent implements OnInit, OnDestroy this.form.get('contributor_employer')?.setValue(value.employer); this.form.get('contributor_occupation')?.setValue(value.occupation); 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

- + +