<!--
  ~ Copyright (C) 2017/2021 e-voyageurs technologies
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<nb-card status="info">
  <nb-card-header>{{ title }}</nb-card-header>
  <nb-card-body>
    <nb-select
      class="intent"
      placeholder="Add shared intent"
      [(selected)]="selectedIntent"
    >
      <nb-option-group
        *ngFor="let category of state.currentIntentsCategories | async"
        [title]="category.category"
      >
        <nb-option
          *ngFor="let intent of category.intents"
          [value]="intent._id"
        >
          {{ intent.intentLabel() }}
        </nb-option>
      </nb-option-group>
    </nb-select>
  </nb-card-body>
  <nb-card-footer class="footer">
    <button
      nbButton
      size="small"
      (click)="dialogRef.close('cancel')"
    >
      Cancel
    </button>
    <button
      nbButton
      size="small"
      status="success"
      class="submit-button"
      (click)="save()"
      [disabled]="!selectedIntent"
    >
      Add
    </button>
  </nb-card-footer>
</nb-card>
