OnClickApply()

in frontend/src/app/customer-service-agent/agent-knowledge-search/agent-knowledge-search.component.ts [220:255]


  OnClickApply() {
    this.showLoading = true
    let selectedRating: any[] = [];
    if (this.rating) {
      selectedRating = [this.rating.toString()]
    }
    let statusVal: any[] = [];
    if (this.statusValue) {
      statusVal = [this.statusValue]
    }
    let sentimentVal: any[] = [];
    if (this.sentimentValue) {
      sentimentVal = [this.sentimentValue]
    }

    let categoryVal: any[] = [];
    if (this.categoryValue) {
      categoryVal = [this.categoryValue]
    }
    this.customerServiceAgentService.searchConversations(
      this.conversationMsgCtrl.value || "", this.userId, selectedRating, statusVal, sentimentVal, categoryVal, "", "", "").subscribe(
        (res: any) => {
          const searchResponse: SearchResponseConversation = res.responses;
          this.showConversationSummary = true;
          this.showFilterSection = false;
          this.conversationsSummary = searchResponse.summary;
          this.showLoading = false;
          this.conversationsResults = searchResponse.search_results.map((searchResult: SearchResultConversation) => {
            searchResult.snippet = String(marked.parse(searchResult.snippet));
            searchResult.conversation = String(marked.parse(searchResult.conversation));
            return searchResult;
          });

        }
      );
  }