Skip to content

Commit

Permalink
Add searchName array and triggerRecipientIdentifierChange method to m…
Browse files Browse the repository at this point in the history
…anage recipient search functionality
  • Loading branch information
Andy-Chih committed Oct 17, 2024
1 parent 6d4f9f4 commit 998a088
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ export class QuestionSubmissionFormComponent implements DoCheck {
isMCQDropDownEnabled: boolean = false;
isSaved: boolean = false;
hasResponseChanged: boolean = false;
// Initial a new array to store names
searchName: string[] = [];

@Input()
formMode: QuestionSubmissionFormMode = QuestionSubmissionFormMode.FIXED_RECIPIENT;
Expand Down Expand Up @@ -94,6 +96,9 @@ export class QuestionSubmissionFormComponent implements DoCheck {
this.model.isTabExpandedForRecipients.set(recipient.recipientIdentifier, true);
});
this.hasResponseChanged = Array.from(this.model.hasResponseChangedForRecipients.values()).some((value) => value);
// Initialize the searchName array with empty strings, matching the length of recipientSubmissionForms.
this.searchName = Array.from({ length: this.model.recipientSubmissionForms.length }, () => "");

}

@Input()
Expand Down Expand Up @@ -360,6 +365,14 @@ export class QuestionSubmissionFormComponent implements DoCheck {
(recipientSubmissionFormModel: FeedbackResponseRecipientSubmissionFormModel) =>
recipientSubmissionFormModel.recipientIdentifier === recipient.recipientIdentifier);
}

// Method to handle changes in the recipient identifier.
triggerRecipientIdentifierChange(index: number, data: any): void {
if (this.searchName[index] !== undefined) {
this.searchName[index] = "";
}
this.triggerRecipientSubmissionFormChange(index, 'recipientIdentifier', data);
}

/**
* Triggers the change of the recipient submission form.
Expand Down

0 comments on commit 998a088

Please sign in to comment.