<!--
- Initiate bis-invocation-layout
- On AutoSuggest, Create chips of intent invoke description
- Create clickable mat-chip using intent data description.
- On click of mat-chip, intent invoke string will be rendered and 
  bb-textbox get created depends upon occurrences of {{ARG_NAME}} and its properties (MANDATORY_OPT)
-->
<ng-container *ngIf='selectedIntent;then intentInvocTempl else intentInputTempl' class="bis-invoke-container"></ng-container>
    
<ng-template #intentInvocTempl>
  <!-- Added by Pooja S on 31-July-2019 [on the did you mean suggestion] Start-->
  <ng-container *ngIf=' didYouMeanIntents && didYouMeanIntents.length > 0 ' >
    <div class="message-div" >Did you mean?</div>
    <div class="bis-intent-list">
        <bis-chip *ngFor='let intent of didYouMeanIntents' [intent]='intent' [callFromProteusVision] = 'callFromProteusVision' (selected)='onSelectIntent($event)'>
          {{intent.INVOC_DESCR}}
        </bis-chip>
    </div>
  </ng-container>
  <!-- Added by Pooja S on 31-July-2019 [on the did you mean suggestion] End-->
  <div *ngIf=' filteredArgsData && filteredArgsData.values && filteredArgsData.values.length > 0 ' class="bis-intent-list">
    <bis-chip *ngFor='let filterArg of filteredArgsData.values | slice : 0 : 10' [intent]='filterArg' [callFromProteusVision] = 'callFromProteusVision' (selected)='onSelectArgument($event)'>
      {{filterArg.value}}
    </bis-chip>
  </div>
  <!-- Changes made by Pratheek On 18-06-19 [to get the id value from the parent component so to differentiate the welcome panel and quick action panel]-Start -->
  <bis-invocation-layout [intent]='selectedIntent' [targetId]='targetId' [parentId]='assistantID' (invoked)="onInvokeSend($event)" (entered)="onArgumentEnter()" (canceled)="onCancel()" ></bis-invocation-layout>
</ng-template>

<ng-template #intentInputTempl>
  <!-- Added by Pooja S on 31-July-2019 [on the did you mean suggestion] Start-->
  <ng-container *ngIf=' didYouMeanIntents && didYouMeanIntents.length > 0 ' >
    <div class="message-div" >Did you mean?</div>
    <div class="bis-intent-list">
        <bis-chip *ngFor='let intent of didYouMeanIntents' [intent]='intent' [callFromProteusVision] = 'callFromProteusVision' (selected)='onSelectIntent($event)'>
          {{intent.INVOC_DESCR}}
        </bis-chip>
    </div>
  </ng-container>
  <!-- Added by Pooja S on 31-July-2019 [on the did you mean suggestion] End-->
  <div *ngIf='filteredIntents && filteredIntents.length > 0' class="bis-intent-list">
    <!-- <bis-chip *ngFor='let intent of filteredIntents | slice : 0 : 4' [intent]='intent' (selected)='onSelectIntent($event)'>
      {{intent.INVOC_DESCR}}
    </bis-chip>
    <bis-chip *ngIf="filteredIntents.length > 5 " [intent]="'Show More'" (selected)='showMoreIntents($event)' class="showMore">
      <i class="material-icons" >more_horiz</i>
    </bis-chip> -->
    <bis-chip *ngFor='let intent of filteredIntents' [intent]='intent' [callFromProteusVision] = 'callFromProteusVision' (selected)='onSelectIntent($event)'>
      {{intent.INVOC_DESCR}}
    </bis-chip>
  </div>
  <!-- Changes made by Pratheek On 18-06-19 [to hide the white panel after click on done in Quick Action PopUp Panel]-Start -->
  <div *ngIf="assistantID == 'bi-assistant'" class="intent-input-container" >
    <input
      id="bis-intent-input"
      class="intent-input"
      [placeholder]="placeholder"   
      [(ngModel)]="intentInput"
      (keyup)="filterIntents($event.target.value,'text')"
      (keyup.enter)="onInvokeEnter()"
      (focus)="scrollToBottom()"
      [readonly] = "isIntentInputProtected"
    />
    <!-- && !listenAnimation && !stopAnimation added suggested byu prajyot sir -->
    <span id = "bis-sendButton" class="invoke-input-send"
      *ngIf="intentInput && intentInput.trim().length > 0 && !listenAnimation && !stopAnimation"
      touch-click
      (onTouchClick)="onInvokeEnter()">
      <i class="material-icons">send</i>
    </span>
    <span
      class="invoke-input-list"

      *ngIf="(!intentInput || intentInput.trim().length == 0) && !listenAnimation && !stopAnimation"
      touch-click
      (onTouchClick)="showMoreIntents();"
    >
      <i class="material-icons">list</i>
    </span>
    <!-- By Sainath T. on 10/06/2019 [ for speech recognition ] -->
   
    <bis-speech-recognition *ngIf="!isBrowser" 
    class="invoke-input-list" 
    (listenAnimation) = "setListenAnimation($event)"
    (stopAnimation) = "setStopAnimation($event)"
    (placeholder) = "setPlaceholder($event)"
    (isIntentInputProtected) = "setIntentInputProtected($event)"
    (intentInput) = "setIntentInput($event)"
    (onInvokeEnter) = "onInvokeEnter()"
    [targetId] = "targetId"
    ></bis-speech-recognition>
    
   <!-- By Sainath T. on 10/06/2019 [ for speech recognition ] -->
  </div>
</ng-template>
<!-- Changes made by Pratheek On 18-06-19 [to get the id value from the parent component so to differentiate the welcome panel and quick action panel]-Start -->
<bis-selection-list [parentId]='assistantID' (onSelectionChange)="onSelectIntent($event, false)" ></bis-selection-list>
