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

This commit is contained in:
tiago.kayaya
2022-04-07 15:44:31 +01:00
41 changed files with 1417 additions and 345 deletions
@@ -13,6 +13,7 @@ import { ToastService } from 'src/app/services/toast.service';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { ParticipantsPipe } from 'src/app/pipes/participants.pipe';
import { ThemeService } from 'src/app/services/theme.service'
import { SessionStore } from 'src/app/store/session.service';
@Component({
selector: 'app-edit-event',
@@ -83,6 +84,7 @@ export class EditEventPage implements OnInit {
public stepSeconds = [1, 5, 10, 15, 20, 25];
private participantsPipe = new ParticipantsPipe()
sesseionStora = SessionStore
constructor(
private modalController: ModalController,
@@ -258,19 +260,37 @@ export class EditEventPage implements OnInit {
this.showLoader = true;
try {
await this.eventsService.editEvent(this.postEvent, 2, 3).toPromise()
if(this.initCalendarName != this.postEvent.CalendarName) {
let body = {
"EventId": this.postEvent.EventId,
"CalendarDestinationName": this.postEvent.CalendarName,
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
await this.eventsService.editEvent(this.postEvent, 2, 3).toPromise()
if(this.initCalendarName != this.postEvent.CalendarName) {
let body = {
"EventId": this.postEvent.EventId,
"CalendarDestinationName": this.postEvent.CalendarName,
}
try {
await this.eventsService.changeAgenda(body).toPromise();
} catch (e) {}
}
try {
await this.eventsService.changeAgenda(body).toPromise();
} catch (e) {}
this.showLoader = false;
this.toastService.successMessage()
} else {
await this.eventsService.editEvent(this.postEvent, 2, 3, this.postEvent.CalendarId).toPromise()
if(this.initCalendarName != this.postEvent.CalendarName) {
let body = {
"EventId": this.postEvent.EventId,
"CalendarDestinationName": this.postEvent.CalendarName,
}
try {
await this.eventsService.changeAgenda(body).toPromise();
} catch (e) {}
}
this.showLoader = false;
this.toastService.successMessage()
}
this.showLoader = false;
this.toastService.successMessage()
} catch(error) {
this.showLoader = false
this.toastService.badRequest()
@@ -413,7 +413,7 @@ export class NewEventPage implements OnInit {
});
}
else if(this.CalendarName == 'PR') {
else if(this.loggeduser.Profile == 'PR') {
console.log('PR - Aqui');
console.log(this.postEvent);
this.eventService.postEventPr(this.postEvent, this.postEvent.CalendarName).subscribe(
@@ -448,6 +448,39 @@ export class NewEventPage implements OnInit {
}
this.toastService.successMessage('Evento criado')
});
} else {
this.eventService.postEventGeneric(this.postEvent, this.postEvent.CalendarName).subscribe(
(id) => {
console.log(id);
const eventId: any = id;
const DocumentToSave: EventAttachment[] = this.documents.map((e) => {
return {
SourceTitle: e.Assunto,
ParentId: eventId,
Source: '1',
SourceId: e.Id,
ApplicationId: e.ApplicationType.toString(),
Id: '',
Link: '',
SerialNumber: ''
};
});
DocumentToSave.forEach((attachments, i) => {
this.attachmentsService.setEventAttachmentById(attachments).subscribe((res) =>{
if(DocumentToSave.length == (i+1)){
this.afterSave();
}
});
});
if(DocumentToSave.length == 0){
this.afterSave();
}
this.toastService.successMessage('Evento criado')
});
}
}
@@ -14,6 +14,8 @@ import { ExpedientTaskModalPage } from 'src/app/pages/gabinete-digital/expedient
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { ThemeService } from 'src/app/services/theme.service'
import { RouteService } from 'src/app/services/route.service';
import { CalendarService } from 'src/app/store/calendar.service';
import { SessionStore } from 'src/app/store/session.service';
@Component({
@@ -23,7 +25,7 @@ import { RouteService } from 'src/app/services/route.service';
})
export class ViewEventPage implements OnInit {
loadedEvent: any;
loadedEvent: Event;
isEventEdited: boolean;
eventBody: EventBody;
loadedAttachments:any;
@@ -46,6 +48,7 @@ export class ViewEventPage implements OnInit {
@Input() eventId: string;
@Output() viewEventDetailDismiss = new EventEmitter<any>();
sesseionStora = SessionStore
constructor(
private eventsService: EventsService,
@@ -55,7 +58,8 @@ export class ViewEventPage implements OnInit {
private modalController: ModalController,
public popoverController: PopoverController,
private toastService: ToastService,
public ThemeService: ThemeService
public ThemeService: ThemeService,
private CalendarService: CalendarService
) {
this.isEventEdited = false;
this.loadedEvent = new Event();
@@ -97,24 +101,51 @@ export class ViewEventPage implements OnInit {
loadEvent() {
this.eventsService.getEvent(this.eventId).subscribe(res => {
console.log(res);
this.loadedEvent = res;
this.today = new Date(res.StartDate);
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
}, (error)=> {
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
this.eventsService.getEvent(this.eventId).subscribe(res => {
console.log(res);
this.loadedEvent = res;
this.today = new Date(res.StartDate);
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
}, (error)=> {
this.viewEventDetailDismiss.emit({
type: 'close'
})
if(error.status == 0) {
this.toastService.badRequest('Não é possível visualizar este evento no modo offline')
} else {
this.toastService.badRequest('Este evento já não existe na sua agenda')
}
});
} else {
this.viewEventDetailDismiss.emit({
type: 'close'
})
const event = this.CalendarService.eventSource.find((ele) => ele.id == this.eventId)
if(error.status == 0) {
this.toastService.badRequest('Não é possível visualizar este evento no modo offline')
} else {
this.toastService.badRequest('Este evento já não existe na sua agenda')
if(event?.CalendarId) {
this.eventsService.genericGetEvent(this.eventId, event.CalendarId).subscribe(res => {
this.loadedEvent = res;
this.today = new Date(res.StartDate);
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
}, (error)=> {
this.viewEventDetailDismiss.emit({
type: 'close'
})
if(error.status == 0) {
this.toastService.badRequest('Não é possível visualizar este evento no modo offline')
} else {
this.toastService.badRequest('Este evento já não existe na sua agenda')
}
});
}
});
}
}
async deleteEvent() {
@@ -122,24 +153,52 @@ export class ViewEventPage implements OnInit {
if (this.loadedEvent.IsRecurring) {
const loader = this.toastService.loading()
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => {
this.toastService.successMessage('Evento apagado');
this.close();
},()=>{},
()=>{
loader.remove();
});
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => {
this.toastService.successMessage('Evento apagado');
this.close();
},()=>{},
()=>{
loader.remove();
});
} else {
const event = this.CalendarService.eventSource.find((ele) => ele.id == this.eventId)
if(event?.CalendarId) {
this.eventsService.genericDeleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName, event?.CalendarId).subscribe(async () => {
this.toastService.successMessage('Evento apagado');
this.close();
},()=>{},
()=>{
loader.remove();
});
}
}
} else {
const loader = this.toastService.loading()
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => {
this.toastService.successMessage('Evento apagado');
this.close();
},()=>{},
()=>{
loader.remove();
});
} else {
this.eventsService.genericDeleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName, this.loadedEvent.CalendarId).subscribe(async () => {
this.toastService.successMessage('Evento apagado');
this.close();
},()=>{},
()=>{
loader.remove();
});
}
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => {
this.toastService.successMessage('Evento apagado');
this.close();
},()=>{},
()=>{
loader.remove();
});
}
}
@@ -188,7 +247,7 @@ export class ViewEventPage implements OnInit {
workflowInstanceDataFields: {
FolderID: '',
Subject: selectedDoc.SourceName,
SourceSecFsID: selectedDoc.ApplicationId || selectedDoc.ApplicationID,
SourceSecFsID: selectedDoc.ApplicationId || selectedDoc['ApplicationID'],
SourceType: 'DOC',
SourceID: selectedDoc.SourceId,
DispatchNumber: ''
@@ -254,7 +313,7 @@ export class ViewEventPage implements OnInit {
taskAction: taskAction,
task: this.task,
seachDocuments: this.loadedEvent.Attachments[ this.dicIndex],
aplicationId: this.loadedEvent.Attachments[ this.dicIndex].ApplicationId || this.loadedEvent.Attachments[ this.dicIndex].ApplicationID
aplicationId: this.loadedEvent.Attachments[ this.dicIndex].ApplicationId || this.loadedEvent.Attachments[ this.dicIndex]['ApplicationID']
},
cssClass: classs,
});
@@ -15,6 +15,7 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import {MatMenuModule} from '@angular/material/menu';
import { LettersAvatarModule } from "ngx-letters-avatar";
import { PipesModule } from 'src/app/pipes/pipes.module';
import { SafehtmlPipe } from 'src/app/pipes/safehtml.pipe';
@NgModule({
imports: [
@@ -33,4 +34,4 @@ import { PipesModule } from 'src/app/pipes/pipes.module';
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [GroupMessagesPage]
})
export class GroupMessagesPageModule {}
export class GroupMessagesPageModule {}
@@ -56,6 +56,14 @@
<div class="message">
<ion-label *ngIf="msg.delate == false">{{msg.msg}}</ion-label>
<ion-label *ngIf="msg.delate == true">{{msg.msg}}</ion-label>
<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>
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
</ion-label>
{{last ? scrollToBottom() : ''}}
</div>
</div>
@@ -83,6 +91,13 @@
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>
<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>
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
</ion-label>
</div>
<div *ngIf="msg.file.type != 'application/img'">
<div *ngIf="msg.file.type != 'application/audio'" class="file add-attachment-bg-color">
@@ -90,6 +105,7 @@
<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.wordprocessingml.document'" 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>
@@ -113,6 +129,13 @@
<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>
<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>
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
</ion-label>
</div>
</div>
</div>
@@ -293,3 +293,31 @@
.typing ngx-letters-avatar {
padding-right: 5px;
}
.float-status{
position: relative !important;
float: right;
display: flex;
align-items: self-end;
}
.float-status-image{
position: relative !important;
float: right;
display: flex;
align-items: self-end;
top: -15px;
}
.float-status-webtrix {
position: relative !important;
top: 0px !important;
float: right;
display: flex;
align-items: self-end;
}
.float-status-all {
font-size: 10pt !important;
}
@@ -36,9 +36,11 @@ import { Camera, CameraResultType, CameraSource } from '@capacitor/camera';
import { VoiceRecorder, VoiceRecorderPlugin, RecordingData, GenericResponse, CurrentRecordingStatus } from 'capacitor-voice-recorder';
import { Filesystem, Directory, Encoding } from '@capacitor/filesystem';
import { DomSanitizer } from '@angular/platform-browser';
import { AlertController, NavParams } from '@ionic/angular';
import { File } from '@awesome-cordova-plugins/file/ngx';
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
/*
import * as pdfjsLib from 'pdfjs-dist';
if( pdfjsLib !== undefined ){
@@ -101,6 +103,8 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
durationDisplay = '';
duration = 0;
audioPermissionStatus: 'granted'| 'denied' | 'prompt' | null = null
constructor(
public wsChatMethodsService: WsChatMethodsService,
private modalController: ModalController,
@@ -123,10 +127,12 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
private CameraService: CameraService,
private toastService: ToastService,
private sanitiser: DomSanitizer,
private alertController: AlertController,
private file: File,
private platform: Platform,
private fileOpener: FileOpener,
) {
console.log('OnCONSTRUCTOR');
this.loggedUserChat = authService.ValidatedUserChat['data'];
@@ -13,6 +13,7 @@ import { MatButtonModule } from '@angular/material/button';
import {MatMenuModule} from '@angular/material/menu';
import { LettersAvatarModule } from "ngx-letters-avatar";
import { PipesModule } from 'src/app/pipes/pipes.module';
import { SafehtmlPipe } from 'src/app/pipes/safehtml.pipe';
@NgModule({
imports: [
@@ -25,9 +26,8 @@ import { PipesModule } from 'src/app/pipes/pipes.module';
MatMenuModule,
LettersAvatarModule,
PipesModule,
],
exports: [MessagesPage],
declarations: [MessagesPage]
})
export class MessagesPageModule {}
export class MessagesPageModule {}
@@ -233,6 +233,7 @@
<button #recordbtn *ngIf="!wsChatMethodsService.getDmRoom(roomId).message && !lastAudioRecorded" (click)="startRecording()" class="btn-no-color">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="chat-icon-send" src="assets/icon/theme/default/icons-chat-record-audio.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="chat-icon-send" src="assets/icon/theme/gov/icons-chat-record-audio.svg"></ion-icon>
<!-- <ion-icon *ngIf="audioPermissionStatus != 'granted' " class="chat-icon-send" src="assets/icon/theme/gov/icons-chat-record-audio-disable.svg"></ion-icon> -->
</button>
<button *ngIf="wsChatMethodsService.getDmRoom(roomId).message" class="btn-no-color" (click)="sendMessage()">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="chat-icon-send" src="assets/icon/theme/gov/icons-chat-send.svg"></ion-icon>
+22 -1
View File
@@ -1,5 +1,5 @@
import { AfterViewChecked, AfterViewInit, Component, ElementRef, ChangeDetectorRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core';
import { AnimationController, GestureController, IonSlides, ModalController, PopoverController, Platform } from '@ionic/angular';
import { AnimationController, GestureController, IonSlides, ModalController, PopoverController } from '@ionic/angular';
import { AlertService } from 'src/app/services/alert.service';
import { AuthService } from 'src/app/services/auth.service';
import { ChatService } from 'src/app/services/chat.service';
@@ -35,9 +35,11 @@ import { DocumentViewer, DocumentViewerOptions } from '@ionic-native/document-vi
import { VoiceRecorder, VoiceRecorderPlugin, RecordingData, GenericResponse, CurrentRecordingStatus } from 'capacitor-voice-recorder';
import { Filesystem, Directory, Encoding } from '@capacitor/filesystem';
import { DomSanitizer } from '@angular/platform-browser';
import { AlertController, Platform, NavParams } from '@ionic/angular';
import { File } from '@awesome-cordova-plugins/file/ngx';
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
const IMAGE_DIR = 'stored-images';
@Component({
selector: 'app-messages',
@@ -92,6 +94,8 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
durationDisplay = '';
duration = 0;
audioPermissionStatus: 'granted'| 'denied' | 'prompt' | null = null
constructor(
public popoverController: PopoverController,
private modalController: ModalController,
@@ -120,11 +124,14 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
private processesService: ProcessesService,
private fileToBase64Service: FileToBase64Service,
private sanitiser: DomSanitizer,
private alertController: AlertController,
private file: File,
private platform: Platform,
private fileOpener: FileOpener,
) {
this.loggedUser = authService.ValidatedUserChat['data'];
this.checkAudioPermission()
}
ngOnChanges(changes: SimpleChanges): void {
@@ -149,6 +156,20 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
async checkAudioPermission() {
const permissionStatus = await navigator.permissions.query({ name: 'microphone' } as any)
console.log('permission', permissionStatus.state); // granted, denied, prompt
this.audioPermissionStatus = permissionStatus.state
permissionStatus.onchange = (data : any) => {
// console.log("Permission changed to " + data.state);
// console.log('permission', permissionStatus.state); // granted, denied, prompt
}
}
ngOnInit() {
this.scrollToBottom();
+1 -1
View File
@@ -64,7 +64,7 @@
</div>
</div>
<div class="d-flex flex-1 pr-20 pl-50">
<div class="d-flex flex-1 pr-20 pl-50" *ngIf="p.userPermissionCount([permissionList.Agenda.access, permissionList.Gabinete.access, permissionList.Actions.access, permissionList.Chat.access]) >= 2">
<div *ngIf="p.userPermission([permissionList.Agenda.access]) || p.userPermission([permissionList.Gabinete.access])" class="tab mr-20 d-flex align-center cursor-pointer" (click)="changeRoute('/home/events')"
[class.active]="locationPathname() == '/home/events'">