<ion-header  class="ion-no-border">
  <ion-toolbar class="header-toolbar">
    <div class="main-header">
      <div class="header-top">
        <div class="left">
          <button class="btn-no-color" (click)="close()">
            <ion-icon slot="end" src='assets/images/icons-arrow-arrow-left.svg'></ion-icon>
          </button>
        </div>
        <div class="middle" *ngFor="let users of dmUsers">
          <ion-label class="title">{{users.name}}</ion-label>
          <span><ion-icon class="{{users.status}}" name="ellipse"></ion-icon></span>
        </div>
        <div hidden class="right">
          <button class="btn-no-color" (click)="openMessagesOptions()">
            <ion-icon src="assets/images/icons-menu.svg"></ion-icon>
          </button>
        </div>
      </div>
      <div hidden class="header-bottom" (click)="addContacts()">
        <div class="header-bottom-icon">
          <ion-icon src="assets/icon/icons-user.svg"></ion-icon>
        </div>
        <div class="header-bottom-contacts">
          <ion-label class="text-color-blue">Adicionar contacto</ion-label>
        </div>
      </div>
    </div>
  </ion-toolbar>
</ion-header>

<ion-content>
  <ion-refresher  name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
    <ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
    <ion-refresher-content>
    </ion-refresher-content>
  </ion-refresher>
  <div class="messages" #scrollMe>
    <div *ngFor="let msg of chatMessageStore.message[roomId] ; let last = last" class='incoming-{{msg.u.username!=loggedUser.me.username}}'>
      <div class="title">
        <ion-label>{{msg.u.name}}</ion-label>
        <span class="time">{{showDateDuration(msg._updatedAt)}}</span>
      </div>
      <div>
        <ion-label>{{msg.msg}}</ion-label>
        {{last ? scrollToBottom() : ''}}
      </div>
    </div>
  </div>

</ion-content>

<!-- <ion-footer>
  <ion-toolbar>
    <ion-row align-items-center class="row">
      <ion-col size="1">
        <ion-label class="ion-no-padding" lines="none">
          <ion-icon (click)="openChatOptions()" class="chat-icon-options" src="assets/icon/icons-chat-options.svg"></ion-icon>
        </ion-label>
      </ion-col>
      <ion-col size="9">
        <ion-item class="ion-no-padding type-message" lines="none">
          <ion-textarea clearOnEdit="true" placeholder="Escrever uma mensagem" auto-grow class="message-input" rows="1" [(ngModel)]="message"></ion-textarea>
          <ion-icon slot="end" src="assets/icon/icons-chat-mic.svg"></ion-icon>
        </ion-item>
      </ion-col>
      <ion-col size="2">
        <ion-label>
          <ion-icon (click)="sendMessage()" class="chat-icon-send" src="assets/icon/icons-chat-send.svg"></ion-icon>
        </ion-label>
      </ion-col>
    </ion-row>
  </ion-toolbar>
</ion-footer> -->

<ion-footer>
  <div class="container width-100 d-flex">
    <div>
      <button class="btn-no-color" (click)="openChatOptions()">
        <ion-icon class="chat-icon-options" src="assets/images/icons-add-new-event.svg"></ion-icon>
      </button>
    </div>
    <div class="width-70">
      <ion-item class="ion-no-padding ion-no-margin type-message" lines="none">
        <ion-textarea clearOnEdit="true" placeholder="Escrever uma mensagem" auto-grow class="message-input" rows="1" [(ngModel)]="message"></ion-textarea>
        <button hidden class="btn-no-color" (click)="notImplemented()">
         <!--  <ion-icon slot="end" src="assets/icon/icons-chat-mic.svg"></ion-icon> -->
        </button>
      </ion-item>
    </div>
    <div>
      <button *ngIf="message" class="btn-no-color" (click)="sendMessage()">
        <ion-icon  class="chat-icon-send" src="assets/icon/icons-chat-send.svg"></ion-icon>
      </button>
      <button *ngIf="!message" class="btn-no-color">
        <ion-icon  class="chat-icon-send" src="assets/icon/icons-chat-send.svg"></ion-icon>
      </button>
    </div>
  </div>
</ion-footer>
