date chat ballon date change to commist

This commit is contained in:
Eudes Inácio
2023-09-12 23:15:29 +01:00
parent 86915ee911
commit 9cc97dfc0f
7 changed files with 55 additions and 9 deletions
@@ -55,7 +55,7 @@
<div class='message-container incoming-{{msg.u.username!=sessionStore.user.UserName}}' *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'au' && msg.t != 'ru' && msg.msg !=''" (press)="handlePress(msg._id)" [class.dateLabel]="msg.dateLabel"> <div class='message-container incoming-{{msg.u.username!=sessionStore.user.UserName}}' *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'au' && msg.t != 'ru' && msg.msg !=''" (press)="handlePress(msg._id)" [class.dateLabel]="msg.dateLabel">
<div class="title" *ngIf="!msg.dateLabel"> <div class="title" *ngIf="!msg.dateLabel">
<ion-label>{{msg.u.name ?? ""}}</ion-label> <ion-label>{{msg.u.name ?? ""}}</ion-label>
<span class="time">{{msg.duration}}</span> <span class="time">{{msg.time}}</span>
</div> </div>
<div class="message"> <div class="message">
<ion-label *ngIf="msg.delate == false">{{msg.msg}}</ion-label> <ion-label *ngIf="msg.delate == false">{{msg.msg}}</ion-label>
@@ -79,7 +79,7 @@
<div class='message-container incoming-{{msg.u.username!=sessionStore.user.UserName}}' class='message-container incoming-{{msg.u.username!=sessionStore.user.UserName}}' *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'ru' && msg.file.type != 'application/meeting'" (press)="handlePress(msg._id)"> <div class='message-container incoming-{{msg.u.username!=sessionStore.user.UserName}}' class='message-container incoming-{{msg.u.username!=sessionStore.user.UserName}}' *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'ru' && msg.file.type != 'application/meeting'" (press)="handlePress(msg._id)">
<div class="title"> <div class="title">
<ion-label>{{msg.u.name ?? ""}}</ion-label> <ion-label>{{msg.u.name ?? ""}}</ion-label>
<span class="time">{{msg.duration}}</span> <span class="time">{{msg.time}}</span>
</div> </div>
<div class="message"> <div class="message">
<div *ngIf="msg.attachments" class="message-attachments"> <div *ngIf="msg.attachments" class="message-attachments">
@@ -53,7 +53,7 @@
*ngIf="msg.msg !=''" [class.dateLabel]="msg.dateLabel"> *ngIf="msg.msg !=''" [class.dateLabel]="msg.dateLabel">
<div class="title file" *ngIf="!msg.dateLabel"> <div class="title file" *ngIf="!msg.dateLabel">
<ion-label >{{msg.u.name}}</ion-label> <ion-label >{{msg.u.name}}</ion-label>
<span class="time">{{msg.duration}}</span> <span class="time">{{msg.time}}</span>
</div> </div>
<div> <div>
<div class="file"> <div class="file">
@@ -80,7 +80,7 @@
<div (press)="handlePress(msg._id)" class='message-container incoming-{{msg.u.username!=sessionStore.user.UserName}}' *ngIf="msg.file.type != 'application/meeting'"> <div (press)="handlePress(msg._id)" class='message-container incoming-{{msg.u.username!=sessionStore.user.UserName}}' *ngIf="msg.file.type != 'application/meeting'">
<div class="title"> <div class="title">
<ion-label>{{msg.u.name}}</ion-label> <ion-label>{{msg.u.name}}</ion-label>
<span class="time">{{msg.duration}}</span> <span class="time">{{msg.time}}</span>
</div> </div>
<div> <div>
<div *ngIf="msg.attachments" class="message-attachments"> <div *ngIf="msg.attachments" class="message-attachments">
+13
View File
@@ -5,6 +5,7 @@ import { capitalizeTxt } from 'src/plugin/text';
import { NfService } from 'src/app/services/chat/nf.service'; import { NfService } from 'src/app/services/chat/nf.service';
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service'; import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
import { showDateDuration } from 'src/plugin/showDateDuration'; import { showDateDuration } from 'src/plugin/showDateDuration';
import { showTimeDuration } from 'src/plugin/showTimeDuration';
import { ChatMethodsService } from './chat-methods.service'; import { ChatMethodsService } from './chat-methods.service';
import { MessageModel, attachments } from '../../models/beast-orm'; import { MessageModel, attachments } from '../../models/beast-orm';
import { AESEncrypt } from '../aesencrypt.service'; import { AESEncrypt } from '../aesencrypt.service';
@@ -49,6 +50,7 @@ export class MessageService {
loadHistory = false loadHistory = false
from: 'Offline'|'History'|'stream'| 'send' from: 'Offline'|'History'|'stream'| 'send'
duration = '' duration = ''
time= '';
localReference = null localReference = null
viewed: string[] = [] viewed: string[] = []
received: string[]= [] received: string[]= []
@@ -141,6 +143,7 @@ export class MessageService {
} }
this.calDateDuration() this.calDateDuration()
this.calTime()
} }
@@ -449,6 +452,10 @@ export class MessageService {
this.duration = showDateDuration(date || this._updatedAt); this.duration = showDateDuration(date || this._updatedAt);
} }
private calTime(time = null) {
this.time = showTimeDuration(time || this._updatedAt);
}
async delateStatusFalse() { async delateStatusFalse() {
this.delate = true this.delate = true
@@ -747,6 +754,7 @@ export class MessageServiceDateLabel {
loadHistory = false loadHistory = false
from: 'Offline'|'History'|'stream'| 'send' from: 'Offline'|'History'|'stream'| 'send'
duration = '' duration = ''
time = ''
localReference = null localReference = null
viewed: string[] = [] viewed: string[] = []
received: string[]= [] received: string[]= []
@@ -816,6 +824,7 @@ export class MessageServiceDateLabel {
} }
this.calDateDuration() this.calDateDuration()
this.calTime();
} }
@@ -889,6 +898,10 @@ export class MessageServiceDateLabel {
this.duration = showDateDuration(date || this._updatedAt); this.duration = showDateDuration(date || this._updatedAt);
} }
private calTime(time = null) {
this.time = showTimeDuration(time || this._updatedAt);
}
async delateStatusFalse() { async delateStatusFalse() {
@@ -51,7 +51,7 @@
</div> </div>
<div class="title d-flex" *ngIf="!msg.dateLabel"> <div class="title d-flex" *ngIf="!msg.dateLabel">
<ion-label>{{msg.u.name}}</ion-label> <ion-label>{{msg.u.name}}</ion-label>
<span class="time">{{msg.duration}}</span> <span class="time">{{msg.time}}</span>
</div> </div>
<div class="message"> <div class="message">
<ion-label *ngIf="msg.delate == false">{{msg.msg}}</ion-label> <ion-label *ngIf="msg.delate == false">{{msg.msg}}</ion-label>
@@ -82,7 +82,7 @@
</div> </div>
<div class="title d-flex"> <div class="title d-flex">
<ion-label>{{msg.u.name}}</ion-label> <ion-label>{{msg.u.name}}</ion-label>
<span class="time">{{msg.duration}}</span> <span class="time">{{msg.time}}</span>
</div> </div>
<div class="message"> <div class="message">
<div *ngIf="msg.attachments" class="message-attachments"> <div *ngIf="msg.attachments" class="message-attachments">
@@ -50,7 +50,7 @@
</div> </div>
<div class="title d-flex" *ngIf="!msg.dateLabel"> <div class="title d-flex" *ngIf="!msg.dateLabel">
<ion-label >{{msg.u.name}}</ion-label> <ion-label >{{msg.u.name}}</ion-label>
<span class="time">{{msg.duration}}</span> <span class="time">{{msg.time}}</span>
</div> </div>
<div class="d-flex justify-space-between"> <div class="d-flex justify-space-between">
@@ -84,7 +84,7 @@
</div> </div>
<div class="title d-flex"> <div class="title d-flex">
<ion-label >{{msg.u.name}}</ion-label> <ion-label >{{msg.u.name}}</ion-label>
<span class="time">{{msg.duration}}</span> <span class="time">{{msg.time}}</span>
</div> </div>
<div> <div>
<div *ngIf="msg.attachments" class="message-attachments"> <div *ngIf="msg.attachments" class="message-attachments">
+2 -1
View File
@@ -39,6 +39,7 @@ function showDateDuration(start) {
} }
} }
module.exports = { module.exports = {
showDateDuration: showDateDuration, showDateDuration: showDateDuration
}; };
+32
View File
@@ -0,0 +1,32 @@
function addZero(i) {
if (i < 10) {
i = "0" + i;
}
return i;
}
function showTimeDuration(start) {
let end;
end = new Date();
start = new Date(start);
let customizedDate;
const totalSeconds = Math.floor((end - start) / 1000);
const totalMinutes = Math.floor(totalSeconds / 60);
const totalHours = Math.floor(totalMinutes / 60);
const totalDays = Math.floor(totalHours / 24);
const hours = totalHours - totalDays * 24;
const minutes = totalMinutes - totalDays * 24 * 60 - hours * 60;
const seconds =
totalSeconds - totalDays * 24 * 60 * 60 - hours * 60 * 60 - minutes * 60;
let time = start.getHours() + ":" + addZero(start.getUTCMinutes());
return time;
}
module.exports = {
showTimeDuration: showTimeDuration,
};