fix chat and gabinete

This commit is contained in:
peter.maquiran
2025-10-16 16:09:35 +01:00
parent f79df96d48
commit 9e3c6db93a
15 changed files with 127 additions and 57 deletions
+1
View File
@@ -30,6 +30,7 @@ export const MessageEntityAttachmentSchema = z.object({
mimeType: z.string().nullable().optional(),
safeFile: z.any().optional(),
description: z.string().nullable().optional(),
filePath: z.string().nullable().optional()
})
export const MessageEntitySchema = z.object({
@@ -88,6 +88,7 @@ export class MessageCreateUseCaseService {
const validation = zodSafeValidation<IMessage>(MessageEntitySchema, message)
if(validation.isOk()) {
console.log("send data", message);
message.sendAttemp++;
const createMessageLocally = await this.messageLocalDataSourceService.insert(message)
@@ -220,6 +221,8 @@ export class MessageCreateUseCaseService {
}
}
} else {
console.log('cant send error', validation.error);
}
}
}
@@ -17,9 +17,10 @@ export const AttachmentTableSchema = z.object({
docId: z.number().optional(),
mimeType: z.string().nullable().optional(),
id: z.string().uuid().nullable().optional(),
description: z.string().optional()
})
description: z.string().optional(),
filePath: z.string().optional().nullable()
});
export type AttachmentTable = z.infer<typeof AttachmentTableSchema>
export type DexieAttachmentsTableSchema = EntityTable<AttachmentTable, '$id'>;
export const AttachmentTableColumn = '++$id, id, $messageId, messageId, file'
export const AttachmentTableColumn = '++$id, id, $messageId, messageId, file, filePath'
@@ -22,6 +22,7 @@ export class ViewDocumentPage implements OnInit {
docId: any
task: ExpedientTaskModalPageNavParamsTask;
Document: any
link: any;
loader = true
attachment: SearchList[] = [];
@@ -38,6 +39,7 @@ export class ViewDocumentPage implements OnInit {
this.Document = this.navParams.get('Document')
this.task = this.navParams.get('task')
this.attachment = this.navParams.get('attachment')
this.link = this.navParams.get('link')
if(!this.file.title) {
@@ -57,38 +59,35 @@ export class ViewDocumentPage implements OnInit {
ngOnInit() {
this.processes.GetViewer(this.docId, this.applicationId).subscribe(async(res)=> {
if(this.link == undefined) {
this.processes.GetViewer(this.docId, this.applicationId).subscribe(async(res)=> {
const link: string = res.replace('//pdfjs/web/', '/pdfjs/web/')
this.trustedUrl = this.sanitazer.bypassSecurityTrustResourceUrl(link);
const link: string = res.replace('//pdfjs/web/', '/pdfjs/web/')
this.trustedUrl = this.sanitazer.bypassSecurityTrustResourceUrl(link);
// const iframe = document.getElementById("iframe")
// const handleLoad = () => {
// this.loader = false
// };
// iframe.addEventListener('load', handleLoad, true)
if(res == "") {
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
//header: 'Apagar evento!',
message: 'Sem imagem',
buttons: [
{
text: 'Sim',
handler: () => {
this.close();
if(res == "") {
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
//header: 'Apagar evento!',
message: 'Sem imagem',
buttons: [
{
text: 'Sim',
handler: () => {
this.close();
}
}
}
]
});
}
}, ()=>{
this.close();
});
]
});
}
}, ()=>{
this.close();
});
} else {
//console.log(this.link);
this.trustedUrl = this.sanitazer.bypassSecurityTrustResourceUrl(this.link);
}
}
@@ -383,7 +383,7 @@ export class DespachoPrPage implements OnInit {
async reexecutar(note: string, documents: any) {
let body = {
"serialNumber": this.serialNumber,
"action": "Reexecutar",
"action": "Reexecução",
"ActionTypeId": 100000010,
"dataFields": {
"ReviewUserComment": note,
@@ -665,7 +665,8 @@ export class ExpedienteDetailPage implements OnInit {
cssClass: 'modal modal-desktop',
componentProps: {
name: this.task.Folio,
task: this.task
task: this.task,
documents: this.fulltask.Documents
},
});
@@ -452,12 +452,13 @@ export class PedidoPage implements OnInit {
cssClass: 'modal modal-desktop',
componentProps: {
name: this.task.Folio,
task: this.task
task: this.task,
documents: this.fulltask.Documents
},
});
modal.onDidDismiss().then(
()=>{},
() => {},
(error) => {
console.log(error)
}
@@ -11,7 +11,7 @@
src='assets/images/theme/gov/icons-calendar-arrow-left.svg'></ion-icon>
</div>
<div *ngIf="publicationFolderService.FolderDetails[folderId]?.DateBegin != null" class="div-title flex-grow-1">
<p class="title font-25-em mb-10-em">{{publicationFolderService.FolderDetails[folderId].Description}}</p>
<p class="title font-25-em mb-10-em">{{publicationFolderService.FolderDetails[folderId].Detail}}</p>
<p class="item-content-date font-13-em">{{publicationFolderService.FolderDetails[folderId].DateBegin | date:
'dd-MM-yyyy HH:mm'}}</p>
</div>
@@ -39,7 +39,7 @@
<div class="main-container background-white height-100 overflow-y-auto viewport-font-size">
<ion-content *ngIf="publicationFolderService.FolderDetails[folderId]" #VideoManager >
<p class="px-20 item-content-detail font-14-em">{{publicationFolderService.FolderDetails[folderId].Detail}}</p>
<p class="px-20 item-content-detail font-14-em">{{publicationFolderService.FolderDetails[folderId].Description}}</p>
<ion-card *ngFor="let publication of publicationFolderService.publicationList[folderId] let i = index">
<ion-card-content >
@@ -3,7 +3,7 @@
<div class="title-content">
<div *ngIf="publicationFolderService.FolderDetails[folderId]" class="div-title d-flex width-100 flex-grow-1 justify-content-between">
<div class="title">
<ion-label>{{publicationFolderService.FolderDetails[folderId].Description}}</ion-label>
<ion-label>{{publicationFolderService.FolderDetails[folderId].Detail}}</ion-label>
</div>
<div class="actions-icon align-baseline">
<button *ngIf="p.userPermission([p.permissionList.Actions.editPost])" class="btn-no-color" (click)="openEditPublication(publicationFolderService.FolderDetails[folderId].ProcessId)">
@@ -34,7 +34,7 @@
</ion-refresher>
<div class="main-container px-20" *ngIf="publicationFolderService.FolderDetails[folderId]" >
<p class="item-content-detail">{{publicationFolderService.FolderDetails[folderId].Detail}}</p>
<p class="item-content-detail">{{publicationFolderService.FolderDetails[folderId].Description}}</p>
<ion-card *ngFor="let publication of publicationFolderService.publications[folderId] let i = index">
<ion-card-content>
@@ -58,7 +58,7 @@
</span>
</div>
<div class="message-container rotate-div" *ngIf="message.showMessage && !message.meSendOneShot">
<div class="message-container rotate-div" *ngIf="message.showMessage && !message.meSendOneShot || message.showOneShot">
<div *ngIf="message.sender.wxUserId != SessionStore.user.UserId && roomType == RoomTypeEnum.Group">
<b>
{{ message.sender.wxFullName }}
@@ -149,15 +149,20 @@
</div>
<div class="message-container rotate-div" *ngIf="message.meSendOneShot">
Mandou uma mensagen com visualização única
</div>
<div class="message-container rotate-div" *ngIf="message._isDeleted == true && message.id != '' && message.oneShot == false">
Mensagem foi eliminada
</div>
<div class="message-container rotate-div" *ngIf="message._isDeleted == true && message.id != '' && message.oneShot == true">
<div class="message-container rotate-div" *ngIf="message.meSendOneShot && !message.ballon && message._isDeleted == false">
Mandou uma mensagen com visualização única
</div>
<div (click)="forceShowOneShot(message)" class="message-container rotate-div cursor-pointer" *ngIf="message._isDeleted == false && message.oneShot == true && !message.ballon && message.meSendOneShot == false">
Abrir visualização única
</div>
<div class="message-container rotate-div" *ngIf="message._isDeleted == true && message.id != '' && message.oneShot == true && message.showOneShot == false">
Mensagem visualizada
</div>
@@ -217,6 +222,13 @@
<!-- <ion-fab-button *ngIf="p.userPermission([p.permissionList.Agenda.access])" title="Nova Reunião" (click)="bookMeeting()" color="light">
<ion-icon name="calendar"></ion-icon>
</ion-fab-button> -->
<!-- <ion-fab-button
title="Mensagem única"
(click)="onShot = !onShot"
color="light">
<ion-icon [name]="onShot ? 'eye' : 'eye-off-outline'"></ion-icon>
</ion-fab-button> -->
<ion-fab-button title="Adicionar Documento" (click)="addFile()" color="light">
<ion-icon name="document"></ion-icon>
</ion-fab-button>
@@ -967,6 +967,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
url: '',
title_link: '',
},
link: msg.attachments[0].filePath || null,
Document: doc,
applicationId: msg.attachments[0].applicationId,
docId: msg.attachments[0].docId,
@@ -1081,6 +1082,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
if(compressedImage.isOk()) {
const message = this.createMessage();
message.oneShot = oneShot;
@@ -1207,7 +1209,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
async pickPicture() {
const oneShot = await this.askIfOneShot()
const file = await this.FilePickerService.getPicture({
cameraResultType: CameraResultType.Base64
})
@@ -1227,7 +1228,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
if(compressedImage.isOk()) {
const message = this.createMessage();
message.oneShot = oneShot
message.attachments = [{
file: file.value.base64String,
@@ -1250,6 +1250,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
this.scrollToBottomClicked()
}, 100)
let sendMessage = this.chatServiceService.sendMessage(message, this.roomType)
this.onShot = false;
//this.onShot = false;
}
@@ -1484,7 +1485,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
forceShowOneShot(message: MessageViewModal) {
message.forceShowOneShot()
message.forceShowOneShot();
this.chatServiceService.messageDelete({
messageId: message.id,
@@ -12,6 +12,9 @@ import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'
import { ChatServiceService } from 'src/app/module/chat/domain/chat-service.service'
import { UDate } from 'src/app/utils/date';
import { ToastService } from 'src/app/services/toast.service';
import { MessageViewModal } from '../../store/model/message';
import { MessageAttachmentFileType, MessageAttachmentSource } from 'src/app/core/chat/entity/message';
import { RoomType } from 'src/app/core/chat/entity/group';
@Component({
selector: 'app-new-group',
@@ -85,6 +88,8 @@ export class NewGroupPage implements OnInit{
this.dataService.clear();
}
console.log("this.documents", this.documents);
}
onDateExpirationChange(event) {
@@ -132,12 +137,34 @@ export class NewGroupPage implements OnInit{
if(result.isOk()) {
await this.ChatServiceService.getRoomById(result.value.id)
this.addGroupMessage.emit(result.value.id);
for (const doc of this.documents) {
const message = new MessageViewModal();
message.roomId = result.value.id;
message.sentAt = new Date().toISOString();
message.sender = {
userPhoto: '',
wxeMail: SessionStore.user.Email,
wxFullName: SessionStore.user.FullName,
wxUserId: SessionStore.user.UserId
};
// each message has one attachment
message.attachments = [{
fileName: doc.Assunto,
source: MessageAttachmentSource.Webtrix,
description: doc.Assunto,
applicationId: doc.ApplicationId,
docId: doc.DocId,
fileType: MessageAttachmentFileType.Doc,
}];
// send each message separately
this.ChatServiceService.sendMessage(message, RoomType.Group);
}
} else if(result.error instanceof HttpErrorResponse) {
this.httpErrorHandle.httpStatusHandle(result.error)
} else {
this.toastService._badRequest('Por favor, contacta um administrador.');
}
}
createGroupWithAttachmentsCath(res: any) {
@@ -10,6 +10,9 @@ import { UDate } from 'src/app/utils/date';
import { HttpErrorResponse } from '@angular/common/http';
import { z } from 'zod';
import { GroupContactsPage, IGroupContactsPageOutPutSchema } from '../group-contacts/group-contacts.page';
import { MessageViewModal } from '../../store/model/message';
import { MessageAttachmentFileType, MessageAttachmentSource } from 'src/app/core/chat/entity/message';
import { RoomType } from 'src/app/core/chat/entity/group';
const NewGroupModalOutPutSchema = z.object({
@@ -77,7 +80,28 @@ export class NewGroupPage implements OnInit {
if(result.isOk()) {
await this.chatSystemService.getRoomById(result.value.id)
this.addContacts(result.value.id)
//this.addGroupMessage.emit(result.value.id);
for (const doc of this.documents) {
const message = new MessageViewModal();
message.roomId = result.value.id;
message.sentAt = new Date().toISOString();
message.sender = {
userPhoto: '',
wxeMail: SessionStore.user.Email,
wxFullName: SessionStore.user.FullName,
wxUserId: SessionStore.user.UserId
};
// each message has one attachment
message.attachments = [{
fileName: doc.Assunto,
source: MessageAttachmentSource.Webtrix,
description: doc.Assunto,
applicationId: doc.ApplicationId,
docId: doc.DocId,
fileType: MessageAttachmentFileType.Doc,
}];
// send each message separately
this.chatSystemService.sendMessage(message, RoomType.Group);
}
} else if(result.error instanceof HttpErrorResponse) {
// this.httpErrorHandle.httpStatusHandle(result.error)
} else {
+1 -1
View File
@@ -69,7 +69,7 @@ export class MessageViewModal {
if(this._isDeleted == false && this.messageType != IMessageType.information) {
this.showReaction = true
}
if(this._isDeleted == false && this.messageType == IMessageType.normal) {
if(this._isDeleted == false && this.oneShot == false && this.messageType == IMessageType.normal) {
this.showMessage = true
}
+6 -6
View File
@@ -1,11 +1,11 @@
export let versionData = {
"shortSHA": "4870a0cd6",
"SHA": "4870a0cd695183670f21f5e4d3e614ac2e170284",
"shortSHA": "f79df96d4",
"SHA": "f79df96d48944f1df331220836382e65bd257083",
"branch": "developer",
"lastCommitAuthor": "'peter.maquiran'",
"lastCommitTime": "'Wed Sep 24 16:21:52 2025 +0100'",
"lastCommitMessage": "fix messsage",
"lastCommitNumber": "6150",
"changeStatus": "On branch developer\nYour branch is ahead of 'origin/developer' by 7 commits.\n (use \"git push\" to publish your local commits)\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/core/chat/usecase/member/member-admin-use-case.service.ts\n\tmodified: src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.html\n\tmodified: src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts\n\tmodified: src/app/ui/chat/chat.page.html\n\tmodified: src/app/ui/chat/component/messages/messages.page.html\n\tmodified: src/app/ui/chat/component/messages/messages.page.scss\n\tmodified: src/app/ui/chat/component/messages/messages.page.ts\n\tmodified: src/app/ui/chat/store/model/message.ts\n\tmodified: src/app/ui/chat/store/roomStore.ts\n\tmodified: src/environments/environment.ts\n\tmodified: version/git-version.ts",
"lastCommitTime": "'Mon Sep 29 11:34:11 2025 +0100'",
"lastCommitMessage": "fix message",
"lastCommitNumber": "6151",
"changeStatus": "On branch developer\nYour branch is ahead of 'origin/developer' by 8 commits.\n (use \"git push\" to publish your local commits)\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/core/chat/entity/message.ts\n\tmodified: src/app/core/chat/usecase/message/message-create-use-case.service.ts\n\tmodified: src/app/infra/database/dexie/instance/chat/schema/attachment.ts\n\tmodified: src/app/modals/view-document/view-document.page.ts\n\tmodified: src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts\n\tmodified: src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts\n\tmodified: src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts\n\tmodified: src/app/pages/publications/view-publications/view-publications.page.html\n\tmodified: src/app/shared/publication/view-publications/view-publications.page.html\n\tmodified: src/app/ui/chat/component/messages/messages.page.html\n\tmodified: src/app/ui/chat/component/messages/messages.page.ts\n\tmodified: src/app/ui/chat/component/new-group/new-group.page.ts\n\tmodified: src/app/ui/chat/modal/new-group/new-group.page.ts\n\tmodified: src/app/ui/chat/store/model/message.ts\n\tmodified: version/git-version.ts",
"changeAuthor": "peter.maquiran"
}