Files
doneit-web/src/app/pages/chat/messages/messages.page.html
T

283 lines
16 KiB
HTML
Raw Normal View History

2022-03-21 13:33:57 +01:00
<ion-header class="ion-no-border">
2020-12-30 11:13:50 +01:00
<ion-toolbar class="header-toolbar">
<div class="main-header">
<div class="header-top">
2021-03-12 11:56:54 +01:00
<div class="left">
2021-04-11 07:05:39 +01:00
<button class="btn-no-color" (click)="close()">
2021-09-30 10:41:40 +01:00
<!-- <ion-icon slot="end" src='assets/images/icons-arrow-arrow-left.svg'></ion-icon> -->
2021-11-16 16:00:14 +01:00
<fa-icon icon="chevron-left" class="header-top-btn font-awesome-1"></fa-icon>
2021-04-11 07:05:39 +01:00
</button>
2021-03-12 11:56:54 +01:00
</div>
<div class="middle-container" *ngIf="!showMessageOptions">
2022-01-14 14:22:31 +01:00
<div class="middle">
2022-03-21 21:24:56 +01:00
<ion-label class="title">{{wsChatMethodsService.getDmRoom(roomId).name}}</ion-label>
2022-01-14 14:22:31 +01:00
<!-- <span><ion-icon class="{{users.status}}" name="ellipse"></ion-icon></span> -->
</div>
</div>
2022-03-21 21:06:54 +01:00
2022-03-21 21:24:56 +01:00
<!-- <div (click)="wsChatMethodsService.getDmRoom(roomId).deleteAll()" >delete all</div> -->
<div class="middle-container-options" *ngIf="showMessageOptions">
2021-09-30 10:41:40 +01:00
<fa-icon (click)="deleteMessage(selectedMsgId)" icon="trash" class="middle-container-options-icons"></fa-icon>
<!-- <ion-icon name="trash"></ion-icon> -->
2020-12-30 11:13:50 +01:00
</div>
2021-08-20 15:08:36 +01:00
<div hidden class="right">
2021-04-11 07:05:39 +01:00
<button class="btn-no-color" (click)="openMessagesOptions()">
2021-11-16 16:00:14 +01:00
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-menu.svg"></ion-icon>
2022-03-21 13:33:57 +01:00
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/images/theme/gov/icons-menu.svg">
</ion-icon>
2021-04-11 07:05:39 +01:00
</button>
2021-07-23 14:43:51 +01:00
</div>
2020-12-30 11:13:50 +01:00
</div>
2021-04-07 15:59:27 +01:00
<div hidden class="header-bottom" (click)="addContacts()">
2020-12-30 11:13:50 +01:00
<div class="header-bottom-icon">
2022-03-21 13:33:57 +01:00
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/icon/icons-user.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/icon/theme/gov/icons-user.svg"></ion-icon>
2020-12-30 11:13:50 +01:00
</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>
2022-07-05 12:02:26 +01:00
<div (click)="handleClick()" class="message-attachments messages" #scrollMe>
2022-07-04 16:45:44 +01:00
2022-07-05 12:02:26 +01:00
<div class="messages-list-item-wrapper container-width-100 file"
2022-03-21 13:33:57 +01:00
*ngFor="let msg of wsChatMethodsService.getDmRoom(this.roomId).messages; let last = last"
[class.messages-list-item-wrapper-active]="msg._id == selectedMsgId">
2022-07-05 12:02:26 +01:00
<div (press)="handlePress(msg._id)" class='file message-container incoming-{{msg.u.username!=sessionStore.user.UserName}}'
2022-03-22 16:11:30 +01:00
*ngIf="msg.msg !=''">
2022-07-05 12:02:26 +01:00
<div class="title file">
2022-06-06 16:09:20 +01:00
<ion-label >{{msg.u.name}}</ion-label>
2022-02-10 15:50:11 +01:00
<span class="time">{{msg.duration}}</span>
2021-09-30 10:41:40 +01:00
</div>
<div>
2022-07-05 12:02:26 +01:00
<!-- <div class="message-attachments"> -->
<div class="file">
<ion-label *ngIf="msg.delate == false">{{msg.msg}}</ion-label>
<ion-label *ngIf="msg.delate == true">{{msg.msg}}</ion-label>
2022-04-13 21:54:31 +01:00
2022-07-05 12:02:26 +01:00
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
2022-03-29 17:14:25 +01:00
2022-07-05 12:02:26 +01:00
<ion-icon *ngIf="msg.messageSend == false" src="assets/images/clock-regular.svg"></ion-icon>
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
</ion-label>
</div>
<!-- </div> -->
{{last ? scrollToBottom() : ''}}
</div>
2022-02-25 15:10:10 +01:00
</div>
2022-01-27 16:12:51 +01:00
2022-03-21 21:06:54 +01:00
<div *ngIf="msg.file && msg.delate == false">
2022-04-26 14:34:52 +01:00
<div (press)="handlePress(msg._id)" class='message-container incoming-{{msg.u.username!=sessionStore.user.UserName}}' *ngIf="msg.file.type != 'application/meeting'">
<div class="title">
<ion-label>{{msg.u.name}}</ion-label>
2022-02-10 15:50:11 +01:00
<span class="time">{{msg.duration}}</span>
</div>
<div>
<div *ngIf="msg.attachments" class="message-attachments">
<div *ngFor="let file of msg.attachments let i = index">
2022-07-05 12:02:26 +01:00
<div class="file" *ngIf="msg.file.type == 'application/img'" (click)="openPreview(msg)">
<div *ngIf="!msg.attachments[0].image_url">
<ion-item class="add-attachment-bg-color" shape="round" lines="none" type="button">
<ion-icon name="image" class="file-icon"></ion-icon>
<ion-label>{{"Imagem"}}</ion-label>
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="icon-download" src="assets/icon/theme/default/icons-download.svg" slot="end"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="icon-download" src="assets/icon/theme/gov/icons-download.svg" slot="end"></ion-icon>
</ion-item>
</div>
2022-02-08 17:44:15 +01:00
<img *ngIf="msg.attachments[0].image_url" src="{{msg.attachments[0].image_url}}" alt="image">
2022-04-26 14:34:52 +01:00
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
2022-03-29 17:14:25 +01:00
<ion-icon *ngIf="msg.messageSend == false" src="assets/images/clock-regular.svg"></ion-icon>
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
</ion-label>
</div>
2022-01-27 16:12:51 +01:00
<div *ngIf="msg.file.type != 'application/img'">
2022-03-18 16:43:15 +01:00
<div class="file add-attachment-bg-color" *ngIf="msg.file.type != 'application/audio'">
2022-03-31 11:56:49 +01:00
<div (click)="docIndex(i); openPreview(msg)" class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
<div *ngIf="!msg.attachments[0].image_url">
<ion-item class="add-attachment-bg-color" shape="round" lines="none" type="button">
2022-08-02 15:08:01 +01:00
<ion-icon *ngIf="msg.attachments[0].type != 'webtrix'" name="document" class="file-icon"></ion-icon>
<ion-icon *ngIf="msg.attachments[0].type == 'webtrix'" src="assets/icon/webtrix.svg" class="file-icon"></ion-icon>
<ion-label>{{file.title}}</ion-label>
2022-08-02 15:08:01 +01:00
<ion-icon *ngIf="ThemeService.currentTheme == 'default' && msg.attachments[0].type != 'webtrix' " class="icon-download" src="assets/icon/theme/default/icons-download.svg" slot="end"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && msg.attachments[0].type != 'webtrix' " class="icon-download" src="assets/icon/theme/gov/icons-download.svg" slot="end"></ion-icon>
</ion-item>
</div>
2022-07-04 16:45:44 +01:00
<div *ngIf="msg.attachments[0].image_url">
<span *ngIf="msg.file.type">
<fa-icon *ngIf="msg.file.type == 'application/pdf'" icon="file-pdf" class="pdf-icon"></fa-icon>
2022-04-05 17:39:14 +01:00
<fa-icon *ngIf="msg.file.type == 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'" icon="file-word" class="word-icon"></fa-icon>
2022-03-21 13:33:57 +01:00
<fa-icon *ngIf="msg.file.type == 'application/word'" icon="file-word" class="word-icon">
</fa-icon>
<fa-icon
*ngIf="msg.file.type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'"
icon="file-word" class="excel-icon"></fa-icon>
<ion-icon *ngIf="msg.file.type == 'application/webtrix'" src="assets/icon/webtrix.svg">
</ion-icon>
</span>
<ion-label class="file-title">{{file.title}}</ion-label>
2022-07-04 16:45:44 +01:00
</div>
<!-- <ion-progress-bar [type]="'indeterminate'" *ngIf="downloadLoader"></ion-progress-bar> -->
</div>
</div>
2022-04-24 20:20:04 +01:00
<div (click)="audioPreview(msg)" class="audio-contentainer" *ngIf="msg.file.type == 'application/audio' && !file.title_link">
2022-03-21 21:09:05 +01:00
<ion-item class="add-attachment-bg-color" shape="round" lines="none" type="button">
<ion-icon name="mic-outline" class="file-icon"></ion-icon>
<ion-label>{{"Mensagem de voz"}}</ion-label>
2022-03-21 21:09:05 +01:00
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="icon-download" src="assets/icon/theme/default/icons-download.svg" slot="end"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="icon-download" src="assets/icon/theme/gov/icons-download.svg" slot="end"></ion-icon>
</ion-item>
</div>
2022-07-05 12:02:26 +01:00
<div class="file audio-contentainer" *ngIf="msg.file.type == 'application/audio' && file.title_link">
2022-04-12 15:48:32 +01:00
<audio [src]="file.title_link | safehtml" preload="metadata" class="d-flex width-100" controls
2022-03-21 13:33:57 +01:00
controlsList="nodownload noplaybackrate"></audio>
2022-03-14 08:09:33 +01:00
</div>
2022-03-14 14:23:29 +01:00
<div class="file-details-optional add-attachment-bg-color">
<ion-label *ngIf="msg.file && msg.file != ''">
<span *ngIf="file.description">{{file.description}}</span>
<span *ngIf="file.description && msg.file.type != 'application/webtrix'"></span>
2022-07-04 16:45:44 +01:00
</ion-label>
2022-03-29 17:14:25 +01:00
2022-04-26 14:34:52 +01:00
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
2022-03-29 17:14:25 +01:00
<ion-icon *ngIf="msg.messageSend == false" src="assets/images/clock-regular.svg"></ion-icon>
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
</ion-label>
</div>
2022-03-21 13:33:57 +01:00
</div>
</div>
</div>
2022-03-21 13:33:57 +01:00
{{last ? scrollToBottom() : ''}}
</div>
</div>
2022-03-21 13:33:57 +01:00
<div *ngIf="msg.file.type == 'application/meeting'" class="info-meeting">
<ion-label class="info-meeting-small">{{msg.u.name}} criou esta reunião</ion-label><br />
<button (click)="goToEvent(msg.file.id)" class="btn-no-color info-meeting-normal">
<ion-label class="info-meeting-normal">{{msg.file.subject}}</ion-label>
</button><br />
<ion-label class="info-meeting-medium">
<ion-icon name="calendar-outline"></ion-icon> De {{showDateDuration(msg.file.start_date)}} a
{{showDateDuration(msg.file.end_date)}}
</ion-label><br />
<ion-label class="info-meeting-medium">
<ion-icon></ion-icon>
<ion-icon name="location-outline"></ion-icon> {{msg.file.venue}}
</ion-label><br />
</div>
2022-01-27 16:12:51 +01:00
</div>
2022-03-21 21:06:54 +01:00
<div *ngIf="msg.file && msg.delate == false">
<div *ngIf="msg.file.type == 'application/meeting'" class="info-meeting">
<ion-label class="info-meeting-small">{{msg.u.name}} criou esta reunião</ion-label><br />
2022-03-21 13:33:57 +01:00
<button (click)="goToEvent(msg.file.id)" class="btn-no-color info-meeting-normal">
<ion-label class="info-meeting-normal">{{msg.file.subject}}</ion-label>
</button><br />
<ion-label class="info-meeting-medium">
<ion-icon name="calendar-outline"></ion-icon> De {{showDateDuration(msg.file.start_date)}} a
{{showDateDuration(msg.file.end_date)}}
</ion-label><br />
<ion-label class="info-meeting-medium">
<ion-icon></ion-icon>
<ion-icon name="location-outline"></ion-icon> {{msg.file.venue}}
</ion-label><br />
</div>
{{last ? scrollToBottom() : ''}}
2022-02-25 15:10:10 +01:00
</div>
2022-03-21 21:06:54 +01:00
<div *ngIf="msg.file && msg.delate == true">
Apagou a mensagem
</div>
2022-07-04 16:45:44 +01:00
</div>
2020-12-30 11:13:50 +01:00
</div>
2021-09-24 15:39:25 +01:00
<ion-fab horizontal="end" vertical="bottom" slot="fixed">
<ion-fab-button *ngIf="scrollToBottomBtn" (click)="scrollToBottomClicked()" color="light" size="small">
<ion-icon name="chevron-down"></ion-icon>
</ion-fab-button>
</ion-fab>
2020-12-30 11:13:50 +01:00
</ion-content>
2021-03-29 16:01:58 +01:00
2022-03-03 22:57:33 +01:00
<ion-footer >
2022-02-24 15:32:23 +01:00
2022-03-21 13:33:57 +01:00
<div class="typing" *ngIf="wsChatMethodsService.getDmRoom(roomId).otherUserType == true">
<ngx-letters-avatar [avatarName]="wsChatMethodsService.getGroupRoom(roomId).name" [width]="30" [circular]="true"
fontFamily="Roboto"></ngx-letters-avatar>
2022-02-25 09:54:37 +01:00
está a escrever ...
2022-02-24 15:32:23 +01:00
</div>
2022-03-14 08:09:33 +01:00
<div class="width-100 pl-20 pr-20">
2022-03-04 18:46:56 +01:00
<span *ngIf="!lastAudioRecorded">{{durationDisplay}}</span>
2022-03-21 13:33:57 +01:00
<audio [src]="audioRecorded" class="d-flex width-100 mt-10 mb-10" *ngIf="lastAudioRecorded" controls
controlsList="nodownload noplaybackrate"></audio>
2022-03-04 18:46:56 +01:00
</div>
2022-02-24 15:32:23 +01:00
2021-03-29 16:01:58 +01:00
<div class="container width-100 d-flex">
<div>
2022-03-04 18:46:56 +01:00
<button *ngIf="!recording && !lastAudioRecorded && allowTyping" class="btn-no-color" (click)="openChatOptions()">
2022-03-21 13:33:57 +01:00
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="chat-icon-options"
src="assets/images/icons-add.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="chat-icon-options"
src="assets/images/theme/gov/icons-add.svg"></ion-icon>
2021-04-09 08:59:22 +01:00
</button>
2022-03-18 11:45:38 +01:00
<button *ngIf="recording || lastAudioRecorded || !allowTyping" class="btn-no-color" (click)="deleteRecording()">
2022-03-14 14:23:29 +01:00
<fa-icon class="icon-size-27" icon="trash"></fa-icon>
2022-03-04 14:51:08 +01:00
</button>
2021-03-29 16:01:58 +01:00
</div>
2022-03-14 14:23:29 +01:00
<div class="width-70 message-container">
2022-03-04 18:46:56 +01:00
<div *ngIf="!recording && !lastAudioRecorded" class="type-message">
2022-03-21 13:33:57 +01:00
<ion-textarea *ngIf="allowTyping" autocomplete="on" autocorrect="on" spellcheck="true" clearOnEdit="true"
placeholder="Escrever uma mensagem" auto-grow class="message-input" rows="1"
[(ngModel)]="wsChatMethodsService.getDmRoom(roomId).message"
(ionChange)="wsChatMethodsService.getDmRoom(roomId).sendTyping()"></ion-textarea>
2022-03-04 18:46:56 +01:00
</div>
2022-03-14 14:23:29 +01:00
<div *ngIf="recording" class="d-flex align-items-center justify-content-center">
<button (click)="stopRecording()" class="btn-no-color d-flex align-items-center justify-content-center">
2022-03-21 13:33:57 +01:00
<ion-icon class="icon-size-45" name="stop-circle-outline" color="danger"></ion-icon>
2021-04-13 14:14:55 +01:00
</button>
2022-03-09 09:12:50 +01:00
</div>
2021-03-29 16:01:58 +01:00
</div>
<div>
2022-03-21 13:33:57 +01:00
<button #recordbtn *ngIf="!wsChatMethodsService.getDmRoom(roomId).message && !lastAudioRecorded"
(click)="startRecording()" class="btn-no-color">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="chat-icon-send"
src="assets/icon/theme/default/icons-chat-record-audio.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="chat-icon-send"
src="assets/icon/theme/gov/icons-chat-record-audio.svg"></ion-icon>
2021-04-12 00:22:47 +01:00
</button>
2022-03-21 13:33:57 +01:00
<button *ngIf="wsChatMethodsService.getDmRoom(roomId).message" class="btn-no-color" (click)="sendMessage()"
class="btn-no-color">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="chat-icon-send"
src="assets/icon/theme/gov/icons-chat-send.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="chat-icon-send"
src="assets/icon/theme/gov/icons-chat-send.svg"></ion-icon>
2021-04-12 00:22:47 +01:00
</button>
2022-03-21 13:33:57 +01:00
<button *ngIf="!wsChatMethodsService.getDmRoom(roomId).message && lastAudioRecorded"
(click)="sendAudio(lastAudioRecorded)" class="btn-no-color">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="chat-icon-send"
src="assets/icon/theme/gov/icons-chat-send.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="chat-icon-send"
src="assets/icon/theme/gov/icons-chat-send.svg"></ion-icon>
2021-04-09 08:59:22 +01:00
</button>
2021-03-29 16:01:58 +01:00
</div>
</div>
2021-11-19 10:28:22 +01:00
2021-07-23 14:43:51 +01:00
</ion-footer>