Merge branch 'developer' of bitbucket.org:equilibriumito/gabinete-digital into developer

This commit is contained in:
tiago.kayaya
2022-03-29 00:11:33 +01:00
44 changed files with 533 additions and 504 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ import { ProcessesService } from '../services/processes.service';
import { DespachoStore } from '../store/despacho-store.service';
import { LoaderService } from 'src/app/store/loader.service'
import { SessionStore } from '../store/session.service';
import { PermissionService } from '../services/worker/permission.service';
import { PermissionService } from '../services/permission.service';
import { SortService } from '../services/functions/sort.service';
@Injectable({
+5 -5
View File
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { ProcessesService } from '../services/processes.service';
import { PermissionService } from '../services/worker/permission.service';
import { PermissionService } from '../services/permission.service';
@Injectable({
providedIn: 'root'
@@ -22,10 +22,10 @@ export class PedidoService {
createDeferimento(body: any) {
if(this.p.userRole(['PR'])) {
if(this.p.userRole(['PR'])) {
throw('PR cant create Deferimento')
}
return this.processes.postDeferimento(body)
}
@@ -57,8 +57,8 @@ export class PedidoService {
}
arquivar({note = "", serialNumber, documents= [] }) {
let body = {
"serialNumber": serialNumber,
let body = {
"serialNumber": serialNumber,
"action": "Arquivo",
"ActionTypeId": 95,
"dataFields": {
+34 -31
View File
@@ -1,39 +1,42 @@
<ion-tabs class="tab">
<ion-tab-bar class="bottoms" slot="bottom">
<ion-tab-button tab="events" [class.active]="pathname === '/home/events' ">
<!-- <ion-icon name="home"></ion-icon> -->
<ion-icon *ngIf="pathname != '/home/events'" class="nav-icon" src="assets/images/icons-nav-home.svg"></ion-icon>
<ion-icon *ngIf="pathname == '/home/events'" class="nav-icon" src="assets/images/nav-hover/icons-nav-home-active.svg"></ion-icon>
<!-- <ion-badge color="danger">{{toDayEventStorage.eventsList.length + expedienteGdStore.count}}</ion-badge> -->
<ion-label>Início</ion-label>
</ion-tab-button>
<ion-tab-button tab="agenda" [class.active]="pathname === '/home/agenda' ">
<!-- <ion-icon name="calendar"></ion-icon> -->
<ion-icon *ngIf="pathname != '/home/agenda'" class="nav-icon" src="assets/images/icons-nav-calendar.svg"></ion-icon>
<ion-icon *ngIf="pathname == '/home/agenda'" class="nav-icon" src="assets/images/nav-hover/icons-nav-agenda-active.svg"></ion-icon>
<ion-label style="margin-bottom: 2px;" class="overflow-visible">Agenda</ion-label>
</ion-tab-button>
<ion-tab-button (click)="goto('/home/gabinete-digital')" [class.active]="pathname === '/home/gabinete-digital' ">
<!-- <ion-icon name="file-tray-stacked"></ion-icon> -->
<ion-icon *ngIf="pathname != '/home/gabinete-digital'" class="nav-icon" src="assets/images/icons-nav-gabinete-inactive.svg"></ion-icon>
<ion-icon *ngIf="pathname == '/home/gabinete-digital'" class="nav-icon" src="assets/images/nav-hover/icons-nav-gabinete-active.svg"></ion-icon>
<!-- <ion-badge color="danger" *ngIf="!p.userRole(['PR'])" >{{ documentCounterService.mdTotalDocument }}</ion-badge>
<ion-badge color="danger" *ngIf="p.userRole(['PR'])" >{{ documentCounterService.prTotalDocument }}</ion-badge> -->
<ion-label>Gabinete</ion-label>
</ion-tab-button>
<ion-tab-button tab="events" [class.active]="pathname === '/home/events'">
<!-- <ion-icon name="home"></ion-icon> -->
<ion-icon *ngIf="pathname != '/home/events'" class="nav-icon" src="assets/images/icons-nav-home.svg"></ion-icon>
<ion-icon *ngIf="pathname == '/home/events'" class="nav-icon" src="assets/images/nav-hover/icons-nav-home-active.svg"></ion-icon>
<!-- <ion-badge color="danger">{{toDayEventStorage.eventsList.length + expedienteGdStore.count}}</ion-badge> -->
<ion-label>Início</ion-label>
</ion-tab-button>
<ion-tab-button tab="publications" [class.active]="pathname === '/home/publications' ">
<ion-icon *ngIf="pathname != '/home/publications'" class="nav-icon" src="assets/images/icons-nav-actions.svg"></ion-icon>
<ion-icon *ngIf="pathname == '/home/publications'" class="nav-icon" src="assets/images/nav-hover/icons-nav-actions-active.svg"></ion-icon>
<ion-label style="margin-bottom: 2px;" class="overflow-visible">Ações</ion-label>
</ion-tab-button>
<ion-tab-button tab="chat" [class.active]="pathname === '/home/chat' ">
<ion-icon *ngIf="pathname != '/home/chat'" class="nav-icon" src="assets/images/icons-nav-chat-inactive.svg"></ion-icon>
<ion-icon *ngIf="pathname == '/home/chat'" class="nav-icon" src="assets/images/nav-hover/icons-nav-chat-active.svg"></ion-icon>
<ion-label>Chat</ion-label>
</ion-tab-button>
<ion-tab-button *ngIf="p.userPermission([permissionList.Agenda])" tab="agenda" [class.active]="pathname === '/home/agenda' ">
<!-- <ion-icon name="calendar"></ion-icon> -->
<ion-icon *ngIf="pathname != '/home/agenda'" class="nav-icon" src="assets/images/icons-nav-calendar.svg"></ion-icon>
<ion-icon *ngIf="pathname == '/home/agenda'" class="nav-icon" src="assets/images/nav-hover/icons-nav-agenda-active.svg"></ion-icon>
<ion-label style="margin-bottom: 2px;" class="overflow-visible">Agenda</ion-label>
</ion-tab-button>
<ion-tab-button *ngIf="p.userPermission([permissionList.Gabinete])" (click)="goto('/home/gabinete-digital')" [class.active]="pathname === '/home/gabinete-digital' ">
<!-- <ion-icon name="file-tray-stacked"></ion-icon> -->
<ion-icon *ngIf="pathname != '/home/gabinete-digital'" class="nav-icon" src="assets/images/icons-nav-gabinete-inactive.svg"></ion-icon>
<ion-icon *ngIf="pathname == '/home/gabinete-digital'" class="nav-icon" src="assets/images/nav-hover/icons-nav-gabinete-active.svg"></ion-icon>
<!-- <ion-badge color="danger" *ngIf="!p.userRole(['PR'])" >{{ documentCounterService.mdTotalDocument }}</ion-badge>
<ion-badge color="danger" *ngIf="p.userRole(['PR'])" >{{ documentCounterService.prTotalDocument }}</ion-badge> -->
<ion-label>Gabinete</ion-label>
</ion-tab-button>
<ion-tab-button *ngIf="p.userPermission([permissionList.Actions])" tab="publications" [class.active]="pathname === '/home/publications' ">
<ion-icon *ngIf="pathname != '/home/publications'" class="nav-icon" src="assets/images/icons-nav-actions.svg"></ion-icon>
<ion-icon *ngIf="pathname == '/home/publications'" class="nav-icon" src="assets/images/nav-hover/icons-nav-actions-active.svg"></ion-icon>
<ion-label style="margin-bottom: 2px;" class="overflow-visible">Ações</ion-label>
</ion-tab-button>
<ion-tab-button *ngIf="p.userPermission([permissionList.Actions])" tab="chat" [class.active]="pathname === '/home/chat' ">
<ion-icon *ngIf="pathname != '/home/chat'" class="nav-icon" src="assets/images/icons-nav-chat-inactive.svg"></ion-icon>
<ion-icon *ngIf="pathname == '/home/chat'" class="nav-icon" src="assets/images/nav-hover/icons-nav-chat-active.svg"></ion-icon>
<ion-label>Chat</ion-label>
</ion-tab-button>
</ion-tab-bar>
</ion-tabs>
+12 -3
View File
@@ -16,7 +16,7 @@ import { StorageService } from '../services/storage.service';
import { File } from '@ionic-native/file/ngx';
/* import { WebNotificationPopupService } from '../services/notification/web-notification-popup.service'; */
import { DocumentCounterService } from '../services/worker/document-counter.service';
import { PermissionService } from '../services/worker/permission.service';
import { PermissionService } from '../services/permission.service';
import { BackgroundService } from 'src/app/services/background.service';
import { OfflineManagerService } from 'src/app/services/offline-manager.service';
import { Storage } from '@ionic/storage';
@@ -30,6 +30,8 @@ import { WsChatService } from 'src/app/services/chat/ws-chat.service';
import { environment } from 'src/environments/environment';
import { v4 as uuidv4 } from 'uuid'
import { NativeNotificationService } from 'src/app/services/native-notification.service';
import { UserSession } from '../models/user.model';
import { PermissionList } from '../models/permissionList';
@Component({
selector: 'app-home',
@@ -79,6 +81,8 @@ export class HomePage implements OnInit {
status: string = "";
audioName: string = "";
public user: UserSession;
permissionList = new PermissionList();
constructor(
private router: Router,
@@ -102,12 +106,17 @@ export class HomePage implements OnInit {
private sqliteservice: SqliteService,
public RouteService: RouteService,
private WsChatService: WsChatService,
private NativeNotificationService: NativeNotificationService,) {
private NativeNotificationService: NativeNotificationService,
) {
if (SessionStore.exist) {
this.user = SessionStore.user;
}
/* this.webNotificationPopupService.askNotificationPermission() */
this.NativeNotificationService.askForPermission()
this.router.events.subscribe((val) => {
document.querySelectorAll('ion-modal').forEach((e: any) => e.remove())
document.querySelectorAll('popover-viewport').forEach((e: any) => e.remove())
@@ -16,7 +16,7 @@ import { ToastService } from 'src/app/services/toast.service';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { NgxMatDateFormats } from '@angular-material-components/datetime-picker';
import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
import { PermissionService } from 'src/app/services/worker/permission.service';
import { PermissionService } from 'src/app/services/permission.service';
import { DespachoService } from 'src/app/Rules/despacho.service';
import { PedidoService } from 'src/app/Rules/pedido.service'
import { fullTask } from 'src/app/models/dailyworktask.model';
@@ -7,7 +7,7 @@ import { ExpedientTaskModalPage } from 'src/app/pages/gabinete-digital/expedient
import { DocumentSetUpMeetingPage } from '../document-set-up-meeting/document-set-up-meeting.page';
import { SearchDocumentDetails, SearchFolderDetails } from 'src/app/models/search-document';
import { ExpedientTaskModalPageNavParamsTask } from 'src/app/models/ExpedientTaskModalPage';
import { PermissionService } from 'src/app/services/worker/permission.service';
import { PermissionService } from 'src/app/services/permission.service';
import { SearchedDocumentOptionsPage } from 'src/app/shared/popover/searched-document-options/searched-document-options.page';
import { Location } from '@angular/common';
import { ViewDocumentPage } from '../view-document/view-document.page';
@@ -132,7 +132,7 @@ export class DocumentDetailPage implements OnInit {
}
async viewDocumentModal() {
const selectedDoc = this.LoadedDocument.Documents[ this.dicIndex]
let task = {
+9 -8
View File
@@ -10,28 +10,26 @@ export class MessageModel extends models.Model {
mentions = ArrayField()
msg = models.CharField()
rid = models.CharField()
ts = models.CharField({blank:true})
ts = JsonField({blank:true})
u = JsonField()
_id = models.CharField()
_updatedAt = models.CharField()
_id = models.CharField({blank:true})
_updatedAt = models.IntegerField()
messageSend = models.BooleanField()
offline = models.BooleanField()
viewed = ArrayField({blank:true})
received = ArrayField({blank:true})
localReference = models.CharField({blank:true})
attachments = ArrayField({blank:true})
file = ArrayField({blank:true})
file = JsonField({blank:true})
}
export class DeleteMessageModel extends models.Model {
messageId = models.IntegerField()
messageId = models.CharField()
rid = models.CharField()
ts = models.CharField()
u = JsonField()
needToReceiveBy = ArrayField()
}
@@ -39,6 +37,9 @@ export class DeleteMessageModel extends models.Model {
models.register({
databaseName: 'chat-storage',
type: 'indexedDB',
version: 1,
version: 4,
models: [MessageModel, DeleteMessageModel]
})
window['MessageModel'] = MessageModel
+6
View File
@@ -0,0 +1,6 @@
export class PermissionList{
Agenda = 530;
Gabinete = 531;
Actions = 534;
Chat = 541;
}
+7 -5
View File
@@ -2,12 +2,12 @@ export class UserForm {
username: string;
password: string;
domainName: string;
BasicAuthKey: string;
BasicAuthKey: string;
}
export class LoginUserRespose {
BasicAuthKey: string;
BasicAuthKey: string;
UserId: number;
Authorization: string;
Email: string
@@ -30,11 +30,12 @@ export class LoginUserRespose {
}[]
UserName: string
Profile: any;
UserPermissions: any;
}
export class UserSession {
BasicAuthKey: string;
BasicAuthKey: string;
UserId: number;
Authorization: string;
Email: string
@@ -63,5 +64,6 @@ export class UserSession {
LoginPreference: 'None' | 'Password' | 'Pin' | null;
PIN: string
Inactivity: boolean
UrlBeforeInactivity: string
}
UrlBeforeInactivity: string;
UserPermissions: any;
}
@@ -102,7 +102,10 @@
<div class="message">
<div *ngIf="msg.attachments" class="message-attachments">
<div *ngFor="let file of msg.attachments">
<div *ngIf="msg.file.type == 'application/img'" (click)="openPreview(msg)">
<div *ngIf="msg.file.type == 'application/img' && !msg.attachments[0].image_url">
NOT UPLOADED
</div>
<div *ngIf="msg.file.type == 'application/img' && msg.attachments[0].image_url" (click)="openPreview(msg)">
<img *ngIf="msg.attachments[0].image_url" src="{{msg.attachments[0].image_url}}" alt="image" >
<ion-icon *ngIf="msg.attachments[0].image_url == null" name="download-outline"></ion-icon>
</div>
@@ -118,7 +121,7 @@
<ion-label class="file-title">{{file.title}}</ion-label>
</div>
</div>
<div (click)="audioPreview(msg)" class="audio-contentainer" *ngIf="msg.file.type == 'application/audio' && !file.title_link">
<div class="audio-contentainer" *ngIf="msg.file.type == 'application/audio' && !file.title_link">
<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>{{file.title}}</ion-label>
@@ -35,6 +35,7 @@ import { ProcessesService } from 'src/app/services/processes.service';
import { VoiceRecorder, VoiceRecorderPlugin, RecordingData, GenericResponse, CurrentRecordingStatus } from 'capacitor-voice-recorder';
import { Filesystem, Directory, Encoding } from '@capacitor/filesystem';
import { DomSanitizer } from '@angular/platform-browser';
import { MessageService } from 'src/app/services/chat/message.service';
@Component({
selector: 'app-group-messages',
@@ -43,8 +44,6 @@ import { DomSanitizer } from '@angular/platform-browser';
})
export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
showLoader: boolean;
isGroupCreated: boolean;
loggedUser: any;
@@ -252,15 +251,49 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.lastAudioRecorded = fileName;
})
this.storage.get('recordData').then((recordData) => {
console.log(recordData);
if(recordData.value.recordDataBase64.includes('data:audio')){
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(recordData.value.recordDataBase64);
try {
this.storage.get('recordData').then((recordData) => {
console.log(recordData);
if(recordData?.value?.recordDataBase64.includes('data:audio')){
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(recordData?.value?.recordDataBase64);
}
else{
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(`data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`);
}
});
} catch (error) {}
}
stopRecording() {
this.deleteRecording();
this.allowTyping = false;
console.log('Stop');
if (!this.recording) {
return;
}
this.recording = false;
VoiceRecorder.stopRecording().then(async (result: RecordingData) => {
console.log('==================================',result);
this.recording = false;
if (result.value && result.value.recordDataBase64) {
const recordData = result.value.recordDataBase64;
//console.log(recordData);
const fileName = new Date().getTime() + ".mp3";
//Save file
await this.storage.set('fileName',fileName)
this.storage.set('recordData',result).then(() => {
console.log('Audio recorded saved', result);
setTimeout(async () => {
this.loadFiles();
}, 1000);
})
}
else{
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(`data:${recordData.value.mimeType};base64,${recordData.value.recordDataBase64}`);
}
});
})
}
startRecording() {
@@ -274,32 +307,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.calculateDuration();
}
stopRecording() {
this.deleteRecording();
this.allowTyping = false;
console.log('Stop');
if (!this.recording) {
return;
}
this.recording = false;
VoiceRecorder.stopRecording().then(async (result: RecordingData) => {
console.log(result);
this.recording = false;
if (result.value && result.value.recordDataBase64) {
const recordData = result.value.recordDataBase64;
//console.log(recordData);
const fileName = new Date().getTime() + ".mp3";
//Save file
this.storage.set('fileName',fileName);
this.storage.set('recordData',result).then(() => {
console.log('Audio recorded saved');
})
}
})
setTimeout(async () => {
this.loadFiles();
}, 1000);
}
async deleteRecording(){
this.storage.remove('fileName');
@@ -364,7 +372,6 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
async getChatMembers() {
//return await this.chatService.getMembers(roomId).toPromise();
this.chatService.getAllUsers().subscribe(res => {
console.log(res);
@@ -456,11 +463,11 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.storage.get('recordData').then((recordData) => {
console.log(recordData);
audioFile = recordData;
if(recordData.value.recordDataBase64.includes('data:audio')){
this.audioRecorded = recordData.value.recordDataBase64;
if(recordData?.value?.recordDataBase64.includes('data:audio')){
this.audioRecorded = recordData?.value?.recordDataBase64;
}
else{
this.audioRecorded = `data:${recordData.value.mimeType};base64,${recordData.value.recordDataBase64}`;
this.audioRecorded = `data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`;
}
//Converting base64 to blob
@@ -973,41 +980,11 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
card.el.style['z-index'] = 11;
}
downloadFileMsg(msg) {
console.log('FILE TYPE', msg.file.type)
this.downloadFile = "";
this.AttachmentsService.downloadFile(msg.file.guid).subscribe(async (event) => {
console.log('FILE TYPE 22', msg.file.guid)
var name = msg.file.guid;
if (event.type === HttpEventType.DownloadProgress) {
//this.downloadProgess = Math.round((100 * event.loaded) / event.total);
console.log('FILE TYPE 33', msg.file.type)
} else if (event.type === HttpEventType.Response) {
if (msg.file.type == "application/img") {
this.downloadFile = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
} else if (msg.file.type === 'application/pdf') {
this.downloadFile = event.body;
} else if (msg.file.type == 'application/audio') {
this.downloadFile = new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), '');
}
msg.attachments[0] = {
image_url: this.downloadFile,
name: msg.attachments[0].name,
title: msg.attachments[0].title,
title_link: this.downloadFile,
title_link_download: msg.attachments[0].title_link_download,
ts: msg.attachments[0].ts
}
// save the changes to the storage
msg.save()
}
});
downloadFileMsg(msg: MessageService) {
msg.downloadFileMsg()
}
async openPreview(msg) {
async openPreview(msg: MessageService) {
if (!msg.attachments[0].image_url ||msg.attachments[0].image_url === null || msg.attachments[0].image_url === '') {
this.downloadFileMsg(msg)
@@ -56,7 +56,7 @@
*ngFor="let msg of wsChatMethodsService.getDmRoom(this.roomId).messages; let last = last"
[class.messages-list-item-wrapper-active]="msg._id == selectedMsgId">
<div (press)="handlePress(msg._id)" class='message-container incoming-{{msg.u.username!=loggedUser.me.username}}'
(click)="downloadFileMsg(msg)" *ngIf="msg.msg !=''">
*ngIf="msg.msg !=''">
<div class="title">
<ion-label (click)="hkellor()">{{msg.u.name}}</ion-label>
<span class="time">{{msg.duration}}</span>
@@ -99,7 +99,7 @@
<ion-label class="file-title">{{file.title}}</ion-label>
</div>
</div>
<div (click)="audioPreview(msg)" class="audio-contentainer" *ngIf="msg.file.type == 'application/audio' && !file.title_link">
<div class="audio-contentainer" *ngIf="msg.file.type == 'application/audio' && !file.title_link">
<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>{{file.title}}</ion-label>
+17 -44
View File
@@ -205,15 +205,19 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.lastAudioRecorded = fileName;
})
this.storage.get('recordData').then((recordData) => {
console.log(recordData);
if(recordData.value.recordDataBase64.includes('data:audio')){
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(recordData.value.recordDataBase64);
}
else{
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(`data:${recordData.value.mimeType};base64,${recordData.value.recordDataBase64}`);
}
});
try {
this.storage.get('recordData').then((recordData) => {
console.log(recordData);
if(recordData?.value?.recordDataBase64.includes('data:audio')){
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(recordData?.value?.recordDataBase64);
}
else{
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(`data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`);
}
});
} catch (error) {}
}
startRecording() {
@@ -388,17 +392,16 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
async sendAudio(fileName) {
const roomId = this.roomId
let audioFile;
this.storage.get('recordData').then((recordData) => {
audioFile = recordData;
if(recordData.value.recordDataBase64.includes('data:audio')){
this.audioRecorded = recordData.value.recordDataBase64;
if(recordData?.value?.recordDataBase64.includes('data:audio')){
this.audioRecorded = recordData?.value?.recordDataBase64;
}
else{
this.audioRecorded = `data:${recordData.value.mimeType};base64,${recordData.value.recordDataBase64}`;
this.audioRecorded = `data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`;
}
console.log(this.audioRecorded);
@@ -910,37 +913,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
downloadFileMsg(msg: MessageService) {
console.log('FILE TYPE', msg.file.type)
this.downloadFile = "";
this.AttachmentsService.downloadFile(msg.file.guid).subscribe(async (event) => {
console.log('FILE TYPE 22', msg.file.guid)
var name = msg.file.guid;
if (event.type === HttpEventType.DownloadProgress) {
//this.downloadProgess = Math.round((100 * event.loaded) / event.total);
console.log('FILE TYPE 33', msg.file.type)
} else if (event.type === HttpEventType.Response) {
if (msg.file.type == "application/img") {
this.downloadFile = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
} else if (msg.file.type === 'application/pdf') {
this.downloadFile = event.body;
} else if (msg.file.type == 'application/audio') {
this.downloadFile = new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), '');
}
msg.attachments[0] = {
image_url: this.downloadFile,
name: msg.attachments[0].name,
title: msg.attachments[0].title,
title_link: this.downloadFile,
title_link_download: msg.attachments[0].title_link_download,
ts: msg.attachments[0].ts
}
// save the changes to the storage
msg.save()
}
});
msg.downloadFileMsg()
}
testDownlod(msg: MessageService) {
@@ -16,7 +16,7 @@ import { DespachoService } from 'src/app/Rules/despacho.service'
import { Location } from '@angular/common'
import { fullTask } from 'src/app/models/dailyworktask.model';
import { AttachmentList } from 'src/app/models/Excludetask';
import { PermissionService } from 'src/app/services/worker/permission.service';
import { PermissionService } from 'src/app/services/permission.service';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { SqliteService } from 'src/app/services/sqlite.service';
@@ -359,8 +359,8 @@ export class DespachoPage implements OnInit {
}
async generateDiploma(note:string, documents:any) {
let body = {
"serialNumber": this.serialnumber,
let body = {
"serialNumber": this.serialnumber,
"action": "Reencaminhar",
"ActionTypeId": 99999839,
"dataFields": {
@@ -22,7 +22,7 @@ import { ExpedienteService } from 'src/app/Rules/expediente.service';
import { expedienteTask } from 'src/app/models/dailyworktask.model';
import { TaskService } from 'src/app/Rules/task.service';
import { DocumentViewerPage } from 'src/app/modals/document-viewer/document-viewer.page';
import { PermissionService } from 'src/app/services/worker/permission.service';
import { PermissionService } from 'src/app/services/permission.service';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { ThemeService } from 'src/app/services/theme.service'
@@ -165,7 +165,7 @@ export class ExpedienteDetailPage implements OnInit {
this.onlinecheck = false;
this.sqliteservice.getProcessById(this.serialNumber).then((process) => {
console.log("expedient ditail", process)
var workflow = JSON.parse(process[0].workflowInstanceDataFields);
var origina
if (process[0].originator === "undefined") {
@@ -173,7 +173,7 @@ export class ExpedienteDetailPage implements OnInit {
} else {
origina = JSON.parse(process[0].originator)
}
this.task = {
"SerialNumber": process[0].serialNumber,
"Folio": workflow.Subject,
@@ -191,7 +191,7 @@ export class ExpedienteDetailPage implements OnInit {
"AttachmentsProcessLastInstanceID": workflow.AttachmentsProcessLastInstanceID,
"InstanceID": workflow.InstanceID
}
this.fulltask = {
Documents: JSON.parse(process[0].Documents),
actions: JSON.parse(process[0].actions),
@@ -209,11 +209,11 @@ export class ExpedienteDetailPage implements OnInit {
workflowInstanceID: process[0].workflowInstanceID,
workflowName: process[0].workflowName,
}
})
})
}
}
@@ -11,7 +11,7 @@
<div class="main-content d-flex height-100 border-t-radius">
<!-- Aside left -->
<div class="aside-wrapper d-flex flex-column width-md-40 flex-grow-1">
<div class="aside-wrapper d-flex flex-column width-md-40 flex-grow-1">
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
<div class="title-container">
<div class="title">
@@ -22,7 +22,7 @@ import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe';
//import { NotificationsService } from 'src/app/services/notifications.service';
import { DespachoService } from 'src/app/Rules/despacho.service';
import { ChangeProfileService } from 'src/app/services/change-profile.service';
import { PermissionService } from 'src/app/services/worker/permission.service';
import { PermissionService } from 'src/app/services/permission.service';
import { ThemeService } from 'src/app/services/theme.service'
@@ -115,6 +115,9 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
customTaskPipe = new CustomTaskPipe()
permissions = {
Agenda: 530
}
@ViewChild(ExpedientsPage) expedientesPage: ExpedientsPage;
@ViewChild(PendentesPage) pendentesListPage: PendentesPage;
@ViewChild(EventsToApprovePage) eventsToApprove: EventsToApprovePage;
@@ -256,7 +259,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
let date = new Date(element.taskStartDate);
date.setMonth(date.getMonth() + 1);
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
let task = {
"SerialNumber": element.serialNumber,
"Folio": element.workflowInstanceDataFields.Subject,
@@ -274,11 +277,11 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
"Agenda": element.workflowInstanceDataFields.Agenda,
"customDate": this.setFormatDate(new Date(element.workflowInstanceDataFields.StartDate), new Date(element.workflowInstanceDataFields.EndDate), element.workflowInstanceDataFields.IsAllDayEvent),
}
this.allProcessesList.push(task);
this.allProcessesList = removeDuplicate(this.allProcessesList);
this.allProcessesList = this.sortService.sortDate(this.allProcessesList, 'CreateDate')
});
})
} else {
@@ -287,9 +290,9 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
let date = new Date(element.taskStartDate);
date.setMonth(date.getMonth() + 1);
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
var workflowInstanceDataFields = JSON.parse(element.workflowInstanceDataFields);
let task = {
"SerialNumber": element.serialNumber,
"Folio": workflowInstanceDataFields.Subject,
@@ -306,11 +309,11 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
"Agenda": workflowInstanceDataFields.Agenda,
"customDate": this.setFormatDate(new Date(workflowInstanceDataFields.StartDate), new Date(workflowInstanceDataFields.EndDate), workflowInstanceDataFields.IsAllDayEvent),
}
this.allProcessesList.push(task);
this.allProcessesList = removeDuplicate(this.allProcessesList)
this.allProcessesList = this.sortService.sortDate(this.allProcessesList, 'CreateDate')
});
console.log("All process from db ", allprocess)
})
@@ -23,7 +23,7 @@ import { PedidoService } from 'src/app/Rules/pedido.service';
import { SqliteService } from 'src/app/services/sqlite.service';
import { BackgroundService } from 'src/app/services/background.service';
import { PermissionService } from 'src/app/services/worker/permission.service';
import { PermissionService } from 'src/app/services/permission.service';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { ThemeService } from 'src/app/services/theme.service'
import { DataService } from 'src/app/services/data.service';
+13 -2
View File
@@ -18,6 +18,7 @@ import { ProcessesService } from 'src/app/services/processes.service';
import { AttachmentsService } from 'src/app/services/attachments.service';
import { RoomService } from './chat/room.service';
import { Storage } from '@ionic/storage';
import { InitialsService } from './functions/initials.service';
@Injectable({
providedIn: 'root'
@@ -44,7 +45,8 @@ export class AuthService {
private NfService:NfService,
private processesService: ProcessesService,
private AttachmentsService: AttachmentsService,
private storage: Storage ) {
private storage: Storage,
private initialsService: InitialsService ) {
this.headers = new HttpHeaders();
@@ -74,6 +76,8 @@ export class AuthService {
try {
response = await this.http.post<LoginUserRespose>(environment.apiURL + "UserAuthentication/Login", '', this.opts).toPromise();
console.log(response);
if(saveSession) {
this.SetSession(response, user)
}
@@ -94,6 +98,9 @@ export class AuthService {
} else if(session.RoleID == 100000011) {
session.Profile = 'MDGPR'
}
else{
session.Profile = this.initialsService.getInitials(session.FullName);
}
session.Password = user.password
session.RochetChatUser = user.username.split('@')[0]
@@ -149,7 +156,7 @@ export class AuthService {
this.WsChatService.connect();
this.WsChatService.login().then((message: any) => {
SessionStore.user.RochetChatUserId = message.result.id
SessionStore.save()
this.WsChatService.setStatus('online')
@@ -169,11 +176,15 @@ export class AuthService {
try {
let guid: any = await this.AttachmentsService.uploadFile(formData).toPromise()
message.file.guid = guid.path
console.log('========================================',guid)
// await this.storage.set(guid.path, message.file.image_url).then(() => {
// console.log('add picture to chat IMAGE SAVED')
// // message.getFileFromDb()
// });
message.downloadFileMsg()
return true
} catch(e) {
console.log('failed to upload to server', e)
+46 -29
View File
@@ -10,6 +10,8 @@ import { ChatStorageService } from './chat-storage.service'
import { ChatMethodsService } from './chat-methods.service'
import { MessageModel, DeleteMessageModel } from '../../models/beast-orm'
import { AESEncrypt } from '../aesencrypt.service'
import { HttpClient, HttpEventType } from '@angular/common/http';
import { AttachmentsService } from 'src/app/services/attachments.service';
@Injectable({
providedIn: 'root'
@@ -59,7 +61,8 @@ export class MessageService {
private WsChatService: WsChatService,
private ChatStorageService: ChatStorageService,
private ChatMethodsService: ChatMethodsService,
private AESEncrypt: AESEncrypt) {
private AESEncrypt: AESEncrypt,
private AttachmentsService: AttachmentsService,) {
}
setData({customFields = {}, channels, mentions, msg ,rid ,ts, u, t, _id, id, _updatedAt, file, attachments, temporaryData, localReference , viewed = [], received = [], delate = false, delateRequest =false, }:Message) {
@@ -74,17 +77,21 @@ export class MessageService {
this._id = _id
this._updatedAt = _updatedAt || new Date().getTime()
this.file = file
this.attachments = attachments
this.temporaryData = temporaryData
this.localReference = localReference || null
this.id = id
this.delate = delate
this.delateRequest = delateRequest
if(this.attachments?.length >= 1 && attachments?.length >= 1) {
this.attachments[0] = Object.assign(this.attachments[0], attachments[0])
} else {
this.attachments = attachments
}
this.viewed = [...new Set([...viewed,...this.viewed])];
this.received = [...new Set([...received,...this.received])];
if(!this.ts) {
this.offline = true
this.messageSend = false
@@ -102,7 +109,6 @@ export class MessageService {
}
if(this.hasFile) {
// this.getFileFromDb()
if(this.file.type != 'application/webtrix') {
this.displayType = this.file.type.replace('application/','').toUpperCase()
}
@@ -118,19 +124,6 @@ export class MessageService {
return firstName + ' ' + lastName
}
// getFileFromDb() {
// if(this.hasFile) {
// if (this.file.guid) {
// this.storage.get(this.file.guid).then((image) => {
// if(image != null) {
// this.file.image_url = image
// }
// });
// }
// }
// }
async send(): Promise<any> {
this.sendAttempt++;
@@ -152,7 +145,7 @@ export class MessageService {
this.uploadingFile = false
if(uploadSuccessfully || this.hasSendAttachment == false) {
if(uploadSuccessfully) {
this.hasSendAttachment = true
this.errorUploadingAttachment = false
this.temporaryData = {}
@@ -186,6 +179,11 @@ export class MessageService {
}
async sendRequest(params) {
if(params?.attachments?.image_url) {
delete params?.attachments?.image_url
}
this.ChatMethodsService.send(params).subscribe(
(response: any) => {
const ChatMessage = response.message
@@ -198,12 +196,7 @@ export class MessageService {
type: 'reConnect',
funx: async ()=> {
this.WsChatService.send(params).then(({message, requestId}) => {
let ChatMessage = message.result
this.messageSend = true
this.redefinedMessage(ChatMessage)
})
this.send()
return true
}
})
@@ -222,11 +215,36 @@ export class MessageService {
await this.save()
}
async downloadFileMsg() {
const result = await this.NfService.beforeSendAttachment(this)
if(result) {
downloadFileMsg() {
}
let downloadFile = "";
this.AttachmentsService.downloadFile(this.file.guid).subscribe(async (event) => {
if (event.type === HttpEventType.DownloadProgress) {
} else if (event.type === HttpEventType.Response) {
if (this.file.type == "application/img") {
downloadFile = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
} else if (this.file.type === 'application/pdf') {
downloadFile = event.body as any;
} else if (this.file.type == 'application/audio') {
downloadFile = new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), '');
}
this.attachments[0] = {
image_url: downloadFile,
name: this.attachments[0].name,
title: this.attachments[0].title,
title_link: downloadFile,
title_link_download: this.attachments[0].title_link_download,
ts: this.attachments[0].ts
}
// save the changes to the storage
this.save()
}
});
}
@@ -242,7 +260,6 @@ export class MessageService {
async delateDB() {
// alert('delete data')
const message = await MessageModel.get({_id: this._id})
await message.delete()
+56 -39
View File
@@ -21,6 +21,7 @@ import { ChatMethodsService } from './chat-methods.service'
import { DeleteMessageModel, MessageModel } from '../../models/beast-orm'
import { AESEncrypt } from '../aesencrypt.service'
import { IncomingChatMessage, ChatMessageInterface, falseTypingMethod } from 'src/app/models/message.model';
import { AttachmentsService } from 'src/app/services/attachments.service';
@Injectable({
providedIn: 'root'
@@ -75,7 +76,8 @@ export class RoomService {
private NfService: NfService,
private ChatStorageService: ChatStorageService,
private ChatMethodsService: ChatMethodsService,
private AESEncrypt: AESEncrypt
private AESEncrypt: AESEncrypt,
private AttachmentsService: AttachmentsService
) {
this.NativeNotificationService.askForPermission()
@@ -143,7 +145,7 @@ export class RoomService {
}
}
setData({members, u, customFields = {}, id, name, t, lastMessage = new MessageService(this.storage, this.NfService, this.WsChatService, this.ChatStorageService, this.ChatMethodsService, this.AESEncrypt), _updatedAt }) {
setData({members, u, customFields = {}, id, name, t, lastMessage = new MessageService(this.storage, this.NfService, this.WsChatService, this.ChatStorageService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService), _updatedAt }) {
this.customFields = customFields
this.id = id
this.name = name
@@ -236,7 +238,6 @@ export class RoomService {
const args = message.fields.args
// alert(JSON.stringify(args))
if (typeof args[1] != 'object') {
@@ -269,7 +270,12 @@ export class RoomService {
getRoomMembersIds(): string[] {
return this.members.map((user)=> user._id)
try {
return this.members.map((user)=> user._id)
} catch(error) {
return []
}
}
getAllMemberThatIsNotOffline(): string[] {
@@ -357,37 +363,46 @@ export class RoomService {
* @description delete message in the view
* @param id message ID
*/
async deleteMessage(id) {
await this.messages.forEach(async(message, index) => {
if(message._id == id) {
this.messages.splice(index, 1)
async deleteMessage(_id) {
const id = _id
for (let i =0; i <= this.messages.length; i++) {
if(this.messages[i]?._id == id ) {
if (SessionStore.user.RochetChatUser == message.u.username) {
//Get previous last message from room
const previousLastMessage = this.messages.slice(-1)[0];
this.lastMessage = previousLastMessage;
this.calDateDuration(previousLastMessage._updatedAt)
this.sortRoomList()
if (SessionStore.user.RochetChatUser == this.messages[i]?.u?.username) {
const allMemberThatIsOffline = this.getAllMemberThatIsOffline()
await DeleteMessageModel.create({
messageId: message._id,
rid: message.rid,
ts: message.ts,
u: message.u,
DeleteMessageModel.create({
messageId: this.messages[i]._id,
rid: this.messages[i].rid,
ts: this.messages[i].ts,
u: this.messages[i].u,
needToReceiveBy: allMemberThatIsOffline
})
}
message.delateStatusFalse()
message.delateDB()
this.messages[i]?.delateDB()
//Get previous last message from room
const previousLastMessage = this.messages.slice(-1)[0];
// console.log(_id,'==',this.messages[i]?._id, true)
this.messages.splice(i, 1)
this.lastMessage = previousLastMessage;
this.calDateDuration(previousLastMessage._updatedAt)
this.sortRoomList()
return true
} else {
// console.log(_id,'==',this.messages[i]?._id, false)
}
})
}
}
@@ -411,22 +426,26 @@ export class RoomService {
async sendDeleteRequest(msgId) {
const message = this.messages.find((e)=>e._id = msgId)
message.delateStatusFalse()
const message = this.messages.find((e)=>e._id == msgId)
await message.delateStatusFalse()
this.ChatMethodsService.deleteMessage({_id:msgId, msgId:msgId, roomId:message.rid}).subscribe(
(response: any) => {
message.delateRequest = true
message.save()
this.deleteMessage(msgId)
},
(response) => {
async (response: any) => {
if (response.error.error.startsWith('No message found with the id of')) {
// alert('not found')
message.delateRequest = true
await message.save()
this.deleteMessage(msgId)
},
async (response) => {
if (response?.error?.error.startsWith('No message found with the id of')) {
this.deleteMessage(msgId)
message.delateRequest = true
await message.save()
} else {
// this.deleteMessage(DeletedMessageId)
this.WsChatService.registerCallback({
type: 'reConnect',
funx: async ()=> {
@@ -666,7 +685,7 @@ export class RoomService {
message = this.fix_updatedAt(message)
const wewMessage = new MessageService(this.storage, this.NfService, this.WsChatService, this.ChatStorageService, this.ChatMethodsService, this.AESEncrypt)
const wewMessage = new MessageService(this.storage, this.NfService, this.WsChatService, this.ChatStorageService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService)
wewMessage.setData(message)
wewMessage.loadHistory = this.hasLoadHistory
@@ -694,8 +713,6 @@ export class RoomService {
}
async ChatMessageIsPresentInTheView(ChatMessage:ChatMessageInterface) {
let foundIndex;
@@ -725,7 +742,7 @@ export class RoomService {
async prepareCreate({message, save = true}): Promise<MessageService> {
message = this.fix_updatedAt(message)
const wewMessage = new MessageService(this.storage, this.NfService, this.WsChatService, this.ChatStorageService, this.ChatMethodsService, this.AESEncrypt)
const wewMessage = new MessageService(this.storage, this.NfService, this.WsChatService, this.ChatStorageService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService)
wewMessage.setData(message)
wewMessage.loadHistory = this.hasLoadHistory
@@ -737,7 +754,7 @@ export class RoomService {
simplePrepareMessage(message) {
message = this.fix_updatedAt(message)
const wewMessage = new MessageService(this.storage, this.NfService, this.WsChatService, this.ChatStorageService, this.ChatMethodsService, this.AESEncrypt)
const wewMessage = new MessageService(this.storage, this.NfService, this.WsChatService, this.ChatStorageService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService)
wewMessage.setData(message)
wewMessage.loadHistory = this.hasLoadHistory
@@ -19,6 +19,7 @@ import { AuthService } from '../auth.service';
import { ChatStorageService } from './chat-storage.service'
import { ChatMethodsService } from './chat-methods.service'
import { AESEncrypt } from '../aesencrypt.service'
import { AttachmentsService } from 'src/app/services/attachments.service';
@Injectable({
providedIn: 'root'
@@ -55,7 +56,8 @@ export class WsChatMethodsService {
private authService: AuthService,
private ChatStorageService: ChatStorageService,
private ChatMethodsService:ChatMethodsService,
private AESEncrypt: AESEncrypt
private AESEncrypt: AESEncrypt,
private AttachmentsService:AttachmentsService
) {
this.loggedUser = authService.ValidatedUserChat['data'];
@@ -158,7 +160,10 @@ export class WsChatMethodsService {
} catch(e){}
this.sortRoomList()
setTimeout(()=>{
this.sortRoomList()
}, 1000)
}
async getAllRooms () {
@@ -202,7 +207,11 @@ export class WsChatMethodsService {
console.log('save rooms', rooms)
await this.storage.set('Rooms', rooms);
this.sortRoomList()
setTimeout(()=>{
this.sortRoomList()
}, 1000)
this.loadingWholeList = false
}
@@ -305,7 +314,7 @@ export class WsChatMethodsService {
// create room
if(!this.roomExist(roomId)) {
let room:RoomService = new RoomService(this.WsChatService, new MessageService(this.storage, this.NfService, this.WsChatService, this.ChatStorageService, this.ChatMethodsService, this.AESEncrypt), this.storage, this.platform, this.sqlservice, this.NativeNotificationService, this.sortService, this.ChatService, this.NfService , this.ChatStorageService, this.ChatMethodsService, this.AESEncrypt)
let room:RoomService = new RoomService(this.WsChatService, new MessageService(this.storage, this.NfService, this.WsChatService, this.ChatStorageService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService), this.storage, this.platform, this.sqlservice, this.NativeNotificationService, this.sortService, this.ChatService, this.NfService , this.ChatStorageService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService)
room.setData(setData)
room.receiveMessage()
room.getAllUsers = this.getUsers
+1 -1
View File
@@ -728,7 +728,7 @@ export class WsChatService {
this.wsMsgQueue[requestId] = {message, requestId, loginRequired}
} else {
let messageStr = JSON.stringify(message)
console.log('messageStr', messageStr)
// console.log('messageStr', messageStr)
this.socket.send(messageStr)
}
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { InitialsService } from './initials.service';
describe('InitialsService', () => {
let service: InitialsService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(InitialsService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -0,0 +1,18 @@
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class InitialsService {
constructor() { }
getInitials(name:string){
let names = name.split(' '),
initials = names[0].substring(0, 1).toUpperCase();
if (names.length > 1) {
initials += names[names.length - 1].substring(0, 1).toUpperCase();
}
return initials;
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
import { TestBed } from '@angular/core/testing';
import { PermissionService } from './worker/permission.service';
import { PermissionService } from './permission.service';
describe('PermissionService', () => {
let service: PermissionService;
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { SessionStore } from '../../store/session.service';
import { SessionStore } from '../store/session.service';
@Injectable({
providedIn: 'root'
@@ -15,12 +15,28 @@ export class PermissionService {
if(!Array.isArray(args)) {
args = [args]
}
return args.includes(this.SessionStore.user.Profile)
return args.includes(this.SessionStore.user.Profile)
}
userPermission(args) {
if(!Array.isArray(args)) {
args = [args]
}
for(let permission of (this.SessionStore.user.UserPermissions || [])){
if (args.includes(permission)){
return true;
}
}
return false;
}
role(args: any) {
let UserRoleIsValid = this.userRole(args)
return {
@@ -39,4 +55,4 @@ export class PermissionService {
}
}
}
+2 -2
View File
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { AttachmentsService } from '../attachments.service';
import { EventsService } from '../events.service';
import { PermissionService } from '../worker/permission.service';
import { PermissionService } from '../permission.service';
@@ -18,7 +18,7 @@ export class EventService {
create({body, calendar}) {
if(this.p.userRole(['PR'])) {
return this.eventService.postEventPr(body, calendar)
@@ -60,72 +60,73 @@
</div>
</div>
<div *ngIf="msg.file && msg.delate == false">
<div class="message-item incoming-{{msg.u.username!=loggedUser.me.username}} max-width-45" *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'au' && msg.t != 'ru' && msg.file.type != 'application/meeting'" >
<div *ngIf="msg.file.type != 'application/meeting'">
<div class="message-item-options d-flex justify-content-end">
<fa-icon [matMenuTriggerFor]="beforeMenu" icon="chevron-down" class="message-options-icon cursor-pointer"></fa-icon>
<mat-menu #beforeMenu="matMenu" xPosition="before">
<button (click)="deleteMessage(msg._id)" class="menuButton">Apagar mensagem</button>
</mat-menu>
</div>
<div class="title">
<ion-label>{{msg.u.name}}</ion-label>
<span class="time">{{msg.duration}}</span>
</div>
<div class="message">
<div *ngIf="msg.attachments" class="message-attachments">
<div *ngFor="let file of msg.attachments">
<div *ngIf="msg.file.type == 'application/img'" (click)="openPreview(msg)">
<img *ngIf="msg.attachments[0].image_url" src="{{msg.attachments[0].image_url}}" alt="image">
<ion-icon *ngIf="msg.attachments[0].image_url == null" name="download-outline"></ion-icon>
</div>
<div *ngIf="msg.file.type != 'application/img'">
<div *ngIf="msg.file.type != 'application/audio'" class="file add-attachment-bg-color">
<div (click)="openPreview(msg)" class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
<span *ngIf="msg.file.type">
<fa-icon *ngIf="msg.file.type == 'application/pdf'" icon="file-pdf" class="pdf-icon"></fa-icon>
<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>
<div *ngIf="msg.file">
<div class="message-item incoming-{{msg.u.username!=loggedUser.me.username}} max-width-45" *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'au' && msg.t != 'ru' && msg.file.type != 'application/meeting'" >
<div *ngIf="msg.file.type != 'application/meeting'">
<div class="message-item-options d-flex justify-content-end">
<fa-icon [matMenuTriggerFor]="beforeMenu" icon="chevron-down" class="message-options-icon cursor-pointer"></fa-icon>
<mat-menu #beforeMenu="matMenu" xPosition="before">
<button (click)="deleteMessage(msg._id)" class="menuButton">Apagar mensagem</button>
</mat-menu>
</div>
<div class="title">
<ion-label>{{msg.u.name}}</ion-label>
<span class="time">{{msg.duration}}</span>
</div>
<div class="message">
<div *ngIf="msg.attachments" class="message-attachments">
<div *ngFor="let file of msg.attachments">
<div *ngIf="msg.file.type == 'application/img' && !msg.attachments[0].image_url">
NOT UPLOADED
</div>
<div *ngIf="msg.file.type == 'application/img' &&
msg.attachments[0].image_url" (click)="openPreview(msg)">
<img *ngIf="msg.attachments[0].image_url" src="{{msg.attachments[0].image_url}}" alt="image">
<ion-icon *ngIf="msg.attachments[0].image_url == null" name="download-outline"></ion-icon>
</div>
<div *ngIf="msg.file.type != 'application/img'">
<div *ngIf="msg.file.type != 'application/audio'" class="file add-attachment-bg-color">
<div (click)="openPreview(msg)" class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
<span *ngIf="msg.file.type">
<fa-icon *ngIf="msg.file.type == 'application/pdf'" icon="file-pdf" class="pdf-icon"></fa-icon>
<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>
</div>
</div>
<div (click)="audioPreview(msg)" class="audio-contentainer" *ngIf="msg.file.type == 'application/audio' && !file.title_link">
<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>{{file.title}}</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>
<div class="audio-contentainer" *ngIf="msg.file.type == 'application/audio' && file.title_link">
<audio [src]="file.title_link|safehtml" preload="metadata" controls controlsList="nodownload noplaybackrate"></audio>
</div>
<div class="file-details-optional add-attachment-bg-color">
<ion-label *ngIf="msg.file">
<span *ngIf="file.description">{{file.description}}</span>
<span *ngIf="file.description && msg.file.type != 'application/webtrix'"></span>
<span *ngIf="msg.file.type != 'application/webtrix' && msg.file.type != 'application/audio'">{{msg.displayType}}</span>
</ion-label>
</div>
<div (click)="audioPreview(msg)" class="audio-contentainer" *ngIf="msg.file.type == 'application/audio' && !file.title_link">
<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>{{file.title}}</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>
<div class="audio-contentainer" *ngIf="msg.file.type == 'application/audio' && file.title_link">
<audio [src]="file.title_link|safehtml" preload="metadata" controls controlsList="nodownload noplaybackrate"></audio>
</div>
<div class="file-details-optional add-attachment-bg-color">
<ion-label *ngIf="msg.file">
<span *ngIf="file.description">{{file.description}}</span>
<span *ngIf="file.description && msg.file.type != 'application/webtrix'"></span>
<span *ngIf="msg.file.type != 'application/webtrix' && msg.file.type != 'application/audio'">{{msg.displayType}}</span>
</ion-label>
</div>
</div>
</div>
{{last ? scrollToBottom() : ''}}
</div>
{{last ? scrollToBottom() : ''}}
</div>
</div>
</div>
<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>
</div>
<div *ngIf="msg.file && msg.delate == true">
Apagou a mensagem
<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>
</div>
@@ -274,20 +274,23 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
}
async loadFiles() {
try {
this.storage.get('fileName').then((fileName) => {
this.lastAudioRecorded = fileName;
})
this.storage.get('recordData').then((recordData) => {
console.log(recordData);
if(recordData?.value?.recordDataBase64.includes('data:audio')){
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(recordData?.value?.recordDataBase64);
}
else{
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(`data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`);
}
});
} catch (error) {}
this.storage.get('fileName').then((fileName) => {
this.lastAudioRecorded = fileName;
})
this.storage.get('recordData').then((recordData) => {
console.log(recordData);
if(recordData.value.recordDataBase64.includes('data:audio')){
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(recordData.value.recordDataBase64);
}
else{
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(`data:${recordData.value.mimeType};base64,${recordData.value.recordDataBase64}`);
}
});
}
startRecording() {
@@ -439,19 +442,19 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
}
async sendAudio(fileName) {
const roomId = this.roomId
let audioFile;
this.storage.get('recordData').then((recordData) => {
console.log(recordData);
audioFile = recordData;
if(recordData.value.recordDataBase64.includes('data:audio')){
this.audioRecorded = recordData.value.recordDataBase64;
if(recordData?.value?.recordDataBase64.includes('data:audio')){
this.audioRecorded = recordData?.value?.recordDataBase64;
}
else{
this.audioRecorded = `data:${recordData.value.mimeType};base64,${recordData.value.recordDataBase64}`;
this.audioRecorded = `data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`;
}
//Converting base64 to blob
const encodedData = btoa(this.audioRecorded);
const blob = this.base64toBlob(encodedData, recordData.value.mimeType)
@@ -994,37 +997,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
downloadFileMsg(msg: MessageService) {
console.log('FILE TYPE', msg.file.type)
this.downloadFile = "";
this.AttachmentsService.downloadFile(msg.file.guid).subscribe(async (event) => {
console.log('FILE TYPE 22', msg.file.guid)
var name = msg.file.guid;
if (event.type === HttpEventType.DownloadProgress) {
//this.downloadProgess = Math.round((100 * event.loaded) / event.total);
console.log('FILE TYPE 33', msg.file.type)
} else if (event.type === HttpEventType.Response) {
if (msg.file.type == "application/img") {
this.downloadFile = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
} else if (msg.file.type === 'application/pdf') {
this.downloadFile = event.body;
} else if (msg.file.type == 'application/audio') {
this.downloadFile = new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), '');
}
msg.attachments[0] = {
image_url: this.downloadFile,
name: msg.attachments[0].name,
title: msg.attachments[0].title,
title_link: this.downloadFile,
title_link_download: msg.attachments[0].title_link_download,
ts: msg.attachments[0].ts
}
// save the changes to the storage
msg.save()
}
});
msg.downloadFileMsg()
}
async openPreview(msg) {
+11 -10
View File
@@ -35,7 +35,7 @@
</ion-refresher>
<div class="messages" #scrollMe>
<div class="messages-list-item-wrapper container-width-100"
*ngFor="let msg of wsChatMethodsService.getDmRoom(roomId).messages; let last = last">
*ngFor="let msg of wsChatMethodsService.getDmRoom(roomId).messages; index as i; let last = last">
<div class='message-item incoming-{{msg.u.username!=loggedUser.me.username}} max-width-45' *ngIf="msg.msg !=''">
<div class="message-item-options d-flex justify-content-end">
<fa-icon [matMenuTriggerFor]="beforeMenu" icon="chevron-down" class="message-options-icon cursor-pointer">
@@ -50,7 +50,7 @@
</div>
<div class="d-flex justify-space-between">
<ion-label *ngIf="msg.delate == false" class="flex-0">{{msg.msg}}</ion-label>
<ion-label *ngIf="msg.delate == false" class="flex-0">{{msg.msg}} </ion-label>
<ion-label *ngIf="msg.delate == true" class="flex-0">Apagou a mensagem</ion-label>
<ion-label class="float-status-all float-status" >
@@ -84,7 +84,6 @@
<div *ngIf="msg.file.type == 'application/img'" (click)="openPreview(msg)" dfsdvsvs>
<img src={{msg.attachments[0].image_url}} alt="image">
<ion-label class="float-status-all float-status" >
<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>
@@ -141,24 +140,26 @@
</div>
</div>
<div class="info-meeting" *ngIf="msg.file.type == 'application/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 *ngIf="msg.delate == true" class="info-meeting-small">Apagou a mensagem</ion-label><br />
<ion-label *ngIf="msg.delate == false" class="info-meeting-small">{{msg.u.name}} criou esta reunião</ion-label><br />
<button *ngIf="msg.delate == false" (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-label *ngIf="msg.delate == false" 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-label *ngIf="msg.delate == false" class="info-meeting-medium">
<ion-icon></ion-icon>
<ion-icon name="location-outline"></ion-icon> {{msg.file.venue}}
</ion-label><br />
</div>
</div>
<div *ngIf="msg.file && msg.delate == true">
Apagou a mensagem
</div>
</div>
</div>
+17 -50
View File
@@ -25,7 +25,6 @@ import { WsChatMethodsService } from 'src/app/services/chat/ws-chat-methods.serv
import { WsChatService } from 'src/app/services/chat/ws-chat.service'
import { MessageService } from 'src/app/services/chat/message.service';
import { AttachmentsService } from 'src/app/services/attachments.service';
import { CameraService } from 'src/app/services/camera.service';
import { FileType } from 'src/app/models/fileType';
import { SearchPage } from 'src/app/pages/search/search.page';
@@ -250,26 +249,26 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
async loadFiles() {
try {
this.storage.get('fileName').then((fileName) => {
this.lastAudioRecorded = fileName;
})
this.storage.get('fileName').then((fileName) => {
this.lastAudioRecorded = fileName;
})
this.storage.get('recordData').then((recordData) => {
console.log(recordData);
if(recordData){
if(recordData.value.recordDataBase64.includes('data:audio')){
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(recordData.value.recordDataBase64);
this.storage.get('recordData').then((recordData) => {
console.log(recordData);
if(recordData?.value?.recordDataBase64.includes('data:audio')){
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(recordData?.value?.recordDataBase64);
}
else{
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(`data:${recordData.value.mimeType};base64,${recordData.value.recordDataBase64}`);
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(`data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`);
}
}
});
});
} catch (error) {}
}
startRecording() {
console.log('Recording');
if (this.recording) {
return;
@@ -378,17 +377,16 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
async sendAudio(fileName) {
const roomId = this.roomId
let audioFile;
this.storage.get('recordData').then((recordData) => {
console.log(recordData);
audioFile = recordData;
if(recordData.value.recordDataBase64.includes('data:audio')){
this.audioRecorded = recordData.value.recordDataBase64;
if(recordData?.value?.recordDataBase64.includes('data:audio')){
this.audioRecorded = recordData?.value?.recordDataBase64;
}
else{
this.audioRecorded = `data:${recordData.value.mimeType};base64,${recordData.value.recordDataBase64}`;
this.audioRecorded = `data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`;
}
console.log(this.audioRecorded);
@@ -420,7 +418,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
deleteMessage(msgId: string, msg:MessageService) {
msg.delateStatusFalse()
this.wsChatMethodsService.getDmRoom(this.roomId).sendDeleteRequest(msgId)
}
@@ -904,37 +901,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
downloadFileMsg(msg: MessageService) {
console.log('FILE TYPE', msg.file.type)
this.downloadFile = "";
this.AttachmentsService.downloadFile(msg.file.guid).subscribe(async (event) => {
console.log('FILE TYPE 22', msg.file.guid)
var name = msg.file.guid;
if (event.type === HttpEventType.DownloadProgress) {
//this.downloadProgess = Math.round((100 * event.loaded) / event.total);
console.log('FILE TYPE 33', msg.file.type)
} else if (event.type === HttpEventType.Response) {
if (msg.file.type == "application/img") {
this.downloadFile = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
} else if (msg.file.type === 'application/pdf') {
this.downloadFile = event.body;
} else if (msg.file.type == 'application/audio') {
this.downloadFile = new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), '');
}
msg.attachments[0] = {
image_url: this.downloadFile,
name: msg.attachments[0].name,
title: msg.attachments[0].title,
title_link: this.downloadFile,
title_link_download: msg.attachments[0].title_link_download,
ts: msg.attachments[0].ts
}
// save the changes to the storage
msg.save()
}
});
msg.downloadFileMsg()
}
_arrayBufferToBase64( buffer ) {
+4 -4
View File
@@ -76,7 +76,7 @@
<span>Início</span>
</div>
<div class="tab mr-20 d-flex align-center cursor-pointer" (click)="changeRoute('/home/agenda')"
<div *ngIf="p.userPermission([permissionList.Agenda])" class="tab mr-20 d-flex align-center cursor-pointer" (click)="changeRoute('/home/agenda')"
[class.active]="locationPathname() == '/home/agenda'">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="font-40" src='assets/images/icons-nav-agenda-inactive.svg'></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="font-40" src='assets/images/theme/gov/icons-nav-agenda-inactive.svg'></ion-icon>
@@ -85,7 +85,7 @@
<span>Agenda</span>
</div>
<div class="tab mr-20 d-flex align-center cursor-pointer" (click)="changeRoute('/home/gabinete-digital')"
<div *ngIf="p.userPermission([permissionList.Gabinete])" class="tab mr-20 d-flex align-center cursor-pointer" (click)="changeRoute('/home/gabinete-digital')"
[class.active]="locationPathname() == '/home/gabinete-digital'">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="font-40" src='assets/images/icons-nav-home-dk.svg'></ion-icon>
@@ -94,7 +94,7 @@
<span>Gabinete</span>
</div>
<div class="tab mr-20 d-flex align-center cursor-pointer" (click)="changeRoute('/home/publications')"
<div *ngIf="p.userPermission([permissionList.Actions])" class="tab mr-20 d-flex align-center cursor-pointer" (click)="changeRoute('/home/publications')"
[class.active]="locationPathname() == '/home/publications'">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="font-40" src='assets/images/icons-nav-a-es-inactive.svg'></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="font-40" src='assets/images/theme/gov/icons-nav-a-es-inactive.svg'></ion-icon>
@@ -102,7 +102,7 @@
<span>Acções</span>
</div>
<div class="tab mr-20 d-flex align-center cursor-pointer" (click)="changeRoute('/home/chat')"
<div *ngIf="p.userPermission([permissionList.Chat])" class="tab mr-20 d-flex align-center cursor-pointer" (click)="changeRoute('/home/chat')"
[class.active]="locationPathname() == '/home/chat'">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="font-40" src='assets/images/icons-nav-grupos-inactive-dk-white.svg'></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="font-40" src='assets/images/theme/gov/icons-nav-grupos-inactive-dk-white.svg'></ion-icon>
+5 -2
View File
@@ -6,12 +6,13 @@ import { LoginUserRespose } from 'src/app/models/user.model';
import { ProfilePage } from 'src/app/modals/profile/profile.page';
import { StorageService } from '../../services/storage.service';
import { SessionStore } from 'src/app/store/session.service';
//import { NotificationsService } from '../../services/notifications.service';
import { environment } from 'src/environments/environment';
import { EventTrigger } from '../../services/eventTrigger.service';
import { ThemeService } from '../../services/theme.service';
import { interval } from 'rxjs';
import { RouteService } from 'src/app/services/route.service';
import { PermissionList } from 'src/app/models/permissionList';
import { PermissionService } from 'src/app/services/permission.service';
@Component({
selector: 'app-header',
@@ -29,6 +30,7 @@ export class HeaderPage implements OnInit {
notificationLength: 0;
SessionStore = SessionStore
check: boolean;
permissionList = new PermissionList();
production = environment.production
@@ -41,7 +43,8 @@ export class HeaderPage implements OnInit {
//private notificationsService: NotificationsService,
private eventrigger: EventTrigger,
public ThemeService: ThemeService,
public RouteService: RouteService
public RouteService: RouteService,
public p: PermissionService,
) {
this.loggeduser = SessionStore.user;
router.events.subscribe((val) => {
@@ -7,7 +7,7 @@
</div>
<div class="buttons">
<button (click)="takePicture()" full class="btn-ok" shape="round" >Tirar Fotografia</button>
<!-- <button (click)="addFile()" class="btn-ok" shape="round" >Anexar Documento</button> -->
<!-- <button (click)="addFile()" class="btn-ok" shape="round" >Anexar Documento</button> -->
<button (click)="anexarFoto()" full class="btn-ok" shape="round" >Anexar Fotografia</button>
<button (click)="addDocGestaoDocumental()" class="btn-ok" shape="round" >Gestão Documental</button>
<div class="solid"></div>
@@ -9,7 +9,7 @@ import { BookMeetingModalPage } from 'src/app/pages/gabinete-digital/expediente/
import { DiscartExpedientModalPage } from 'src/app/pages/gabinete-digital/discart-expedient-modal/discart-expedient-modal.page';
import { ToastService } from 'src/app/services/toast.service';
import { customTask, fullTask } from 'src/app/models/dailyworktask.model';
import { PermissionService } from 'src/app/services/worker/permission.service';
import { PermissionService } from 'src/app/services/permission.service';
import { ThemeService } from 'src/app/services/theme.service'
import { Location } from '@angular/common'
import { RouteService } from 'src/app/services/route.service';
@@ -35,7 +35,7 @@ export class DespachosOptionsPage implements OnInit {
public p: PermissionService,
public ThemeService: ThemeService,
private RouteService: RouteService,
) {
) {
this.task = this.navParams.get('task')
this.fulltask = this.navParams.get('fulltask')
@@ -84,7 +84,7 @@ export class DespachosOptionsPage implements OnInit {
this.toastService._badRequest('Processo não encontrado')
});
}
async distartExpedientModal(){
this.popoverController.dismiss();
console.log(this.fulltask);
@@ -98,7 +98,7 @@ export class DespachosOptionsPage implements OnInit {
cssClass: 'discart-expedient-modal',
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss().then(res=>{
if(res['data']=='close'){
@@ -127,7 +127,7 @@ export class DespachosOptionsPage implements OnInit {
await modal.present();
modal.onDidDismiss();
}
async openDelegarModal(task: any) {
this.popoverController.dismiss();
let classs;
@@ -157,8 +157,8 @@ export class DespachosOptionsPage implements OnInit {
}
async generateDiploma(note:string, documents:any){
let body = {
"serialNumber": this.serialNumber,
let body = {
"serialNumber": this.serialNumber,
"action": "Reencaminhar",
"ActionTypeId": 99999839,
"dataFields": {
@@ -198,20 +198,20 @@ export class DespachosOptionsPage implements OnInit {
cssClass: classs,
backdropDismiss: true
});
await modal.present();
modal.onDidDismiss().then(async (res) => {
console.log(res);
if(res.data) {
const DocumentToSave = res.data.documents.map((e) => {
return {
ApplicationId: e.ApplicationType,
SourceId: e.Id,
}
});
let docs = {
ProcessInstanceID: "",
Attachments: DocumentToSave,
@@ -235,11 +235,11 @@ export class DespachosOptionsPage implements OnInit {
this.goBack();
}
});
}
}
async arquivar(note:string, documents:any) {
let body = {
"serialNumber": this.serialNumber,
let body = {
"serialNumber": this.serialNumber,
"action": "Arquivo",
"ActionTypeId": 95,
"dataFields": {
@@ -259,14 +259,14 @@ export class DespachosOptionsPage implements OnInit {
} finally {
loader.remove()
}
}
async executado(note:string, documents:any){
let body = {
"serialNumber": this.serialNumber,
let body = {
"serialNumber": this.serialNumber,
"action": "Conhecimento",
"ActionTypeId": 104,
"dataFields": {
@@ -290,10 +290,10 @@ export class DespachosOptionsPage implements OnInit {
}
async reexecutar(note:string, documents:any){
let body = {
"serialNumber": this.serialNumber,
let body = {
"serialNumber": this.serialNumber,
"action": "Reexecutar",
"ActionTypeId": 100000010,
"dataFields": {
@@ -9,7 +9,7 @@ import { BookMeetingModalPage } from 'src/app/pages/gabinete-digital/expediente/
import { DiscartExpedientModalPage } from 'src/app/pages/gabinete-digital/discart-expedient-modal/discart-expedient-modal.page';
import { ToastService } from 'src/app/services/toast.service';
import { Location } from '@angular/common'
import { PermissionService } from 'src/app/services/worker/permission.service';
import { PermissionService } from 'src/app/services/permission.service';
import { ThemeService } from 'src/app/services/theme.service'
import { RouteService } from 'src/app/services/route.service';
@@ -36,11 +36,11 @@ export class DespachosPrOptionsPage implements OnInit {
private RouteService: RouteService,
public p: PermissionService,
public ThemeService: ThemeService,
) { }
ngOnInit() {
this.profile = "mdgpr";
this.activatedRoute.queryParams.subscribe(params => {
@@ -86,7 +86,7 @@ export class DespachosPrOptionsPage implements OnInit {
console.log(res['data']);
if(res['data']=='openDiscart') {
console.log('open discart');
this.distartExpedientModal();
} else {
@@ -108,7 +108,7 @@ export class DespachosPrOptionsPage implements OnInit {
this.toastService._badRequest('Processo não encontrado')
});
}
async distartExpedientModal() {
this.popoverController.dismiss();
console.log(this.fulltask);
@@ -122,7 +122,7 @@ export class DespachosPrOptionsPage implements OnInit {
cssClass: 'discart-expedient-modal',
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss().then(res=>{
if(res['data']=='close'){
@@ -132,7 +132,7 @@ export class DespachosPrOptionsPage implements OnInit {
this.openMenu(); */
}
this.popoverController.dismiss('close')
});
}
@@ -157,7 +157,7 @@ export class DespachosPrOptionsPage implements OnInit {
modal.onDidDismiss()
}
async openDelegarModal(task: any) {
this.popoverController.dismiss();
let classs;
@@ -187,8 +187,8 @@ export class DespachosPrOptionsPage implements OnInit {
}
async generateDiploma(note:string, documents:any) {
let body = {
"serialNumber": this.serialNumber,
let body = {
"serialNumber": this.serialNumber,
"action": "Reencaminhar",
"ActionTypeId": 99999839,
"dataFields": {
@@ -227,22 +227,22 @@ export class DespachosPrOptionsPage implements OnInit {
cssClass: classs,
backdropDismiss: true
});
await modal.present();
modal.onDidDismiss().then(async (res) => {
console.log(res);
if(res.data){
const DocumentToSave = res.data.documents.map((e) => {
return {
ApplicationId: e.ApplicationType,
SourceId: e.Id,
}
});
let docs = {
ProcessInstanceID: "",
Attachments: DocumentToSave,
@@ -259,15 +259,15 @@ export class DespachosPrOptionsPage implements OnInit {
}
else if(actionName == 'Reexecução') {
await this.reexecutar(res.data.note, docs);
}
}
else if(actionName == 'Concluido') {
await this.concluir(res.data.note, docs);
}
this.goBack();
}
});
}
}
async concluir(note:string, documents:any){
@@ -297,8 +297,8 @@ export class DespachosPrOptionsPage implements OnInit {
}
async arquivar(note:string, documents:any){
let body = {
"serialNumber": this.serialNumber,
let body = {
"serialNumber": this.serialNumber,
"action": "Arquivo",
"ActionTypeId": 95,
"dataFields": {
@@ -323,8 +323,8 @@ export class DespachosPrOptionsPage implements OnInit {
async executado(note:string, documents:any){
let body = {
"serialNumber": this.serialNumber,
let body = {
"serialNumber": this.serialNumber,
"action": "Conhecimento",
"ActionTypeId": 104,
"dataFields": {
@@ -347,10 +347,10 @@ export class DespachosPrOptionsPage implements OnInit {
}
async reexecutar(note:string, documents:any){
let body = {
"serialNumber": this.serialNumber,
let body = {
"serialNumber": this.serialNumber,
"action": "Reexecutar",
"ActionTypeId": 100000010,
"dataFields": {
@@ -7,7 +7,7 @@ import { ToastService } from 'src/app/services/toast.service';
import { Location } from '@angular/common';
import { TaskService } from 'src/app/Rules/task.service'
import { ExpedienteService } from 'src/app/Rules/expediente.service';
import { PermissionService } from 'src/app/services/worker/permission.service';
import { PermissionService } from 'src/app/services/permission.service';
@Component({
selector: 'app-event-details-documents-options',
@@ -15,7 +15,7 @@ import { ToastService } from 'src/app/services/toast.service';
import { Location } from '@angular/common';
import { TaskService } from 'src/app/Rules/task.service'
import { ExpedienteService } from 'src/app/Rules/expediente.service';
import { PermissionService } from 'src/app/services/worker/permission.service';
import { PermissionService } from 'src/app/services/permission.service';
import { ThemeService } from 'src/app/services/theme.service'
import { NewGroupPage } from 'src/app/pages/chat/new-group/new-group.page';
import { RouteService } from 'src/app/services/route.service';
@@ -9,7 +9,7 @@ import { BookMeetingModalPage } from 'src/app/pages/gabinete-digital/expediente/
import { ProcessesService } from 'src/app/services/processes.service';
import { ToastService } from 'src/app/services/toast.service';
import { PedidoService } from 'src/app/Rules/pedido.service';
import { PermissionService } from 'src/app/services/worker/permission.service';
import { PermissionService } from 'src/app/services/permission.service';
import { DataService } from 'src/app/services/data.service';
import { NewGroupPage } from 'src/app/pages/chat/new-group/new-group.page';
@@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';
import {PopoverController } from '@ionic/angular';
import { PermissionService } from 'src/app/services/worker/permission.service';
import { PermissionService } from 'src/app/services/permission.service';
@Component({
selector: 'app-searched-document-options',